How do I make it so that once all enemies are destroyed, the next wave starts?
It seems pretty simple, but how do I make one wave begin when all enemies of the previous wave are destroyed? I have tried setting this up properly but no success. Can someone help?
asked Dec 15 '18 at 02:40 AM in Blueprint Scripting
You will need to have a variable keep track of how many "enemies" you have in your level. Depending on how you get them into your level (dynamic spawning vs placed) there are various ways to get that number ("get all actors" if they are manually placed, or add each to an array during dynamic spawning). Once you have that number, each time an enemy is killed subtract one from the total, then check and see if it equals 0, if yes then you have completed the "wave" and can spawn new enemies, if not do nothing.
answered Dec 15 '18 at 03:30 AM
Nebula Games Inc
If you're destroying the enemy actors every time they die then run a "Get all actors of class" every time the enemy dies, and compare the return array to a Length node attached to a branch node where you will have a true and false return. If the length of the return array is == (equal to) the specified number you're comparing against, then do something. Here's a small example.
Edit When you run the "Get All Actors of Class" node, it only gets actors that are spawned in the world. So as long as that number is less than or Equal to the number you want, to spawn the next wave. It'll do whatever you want it to do, off the "True" pin on the Branch Node.
Follow this question
Once you sign in you will be able to subscribe for any updates here