Im trying to make a combo/continuous(multi) kill system but im struggling on how to do it. Its a top down shooter where zombies are spawned. And my idea is when i shoot and kill the zombies continuously, to get bonus points progressively. For example if i kill 5 zombies i get 10, if i kill 15 - 20, 20 - 30 points. But i dont know how to do it. The volume spawner spawns my enemy actor and is possessed my an ai , but whatever variable i make it is resetted when the new enemy is spawned. Any ideas if i can do such a thing in blueprints?
Add the variable inside a PlayerState Class BluePrint
There are many different ways to set this up, so I’ll give you the easiest example I can think of:
Create a variable in your Player BP (called: KillCounter) of type Integer.
Create a function in your Player BP called “fnAddKill”
Before the AI dies (Destroy Actor node), Cast to your Player BP and call fnAddKill.
fnAddKill will basically add 1 to the variable KillCounter and then check a series of conditions. So for example, you can do a Branch and check if KillCounter is > 5, if true, add an extra 10 to variable KillCounter. You can then add many different branches to keep checking the value of KillCounter.
Hope this helps!
Yeah i have a kill counter but i want it to reset if the player hasnt killed an enemy for 5 seconds or if lets say 5 shots dont hit
Look at getting the latest ‘Game Time’ in seconds & storing that in a var called ‘OldGameTime’.
Then in every subsequent run, compare (NewGameTime - OldGameTime) > 5 secs, if so Branch.
This can be done in a 1000 ways including timers / gates, but the above is probably the easiest.