Help with wave spawner

Hello, I’m really new to UE4 so if this is terrible then my apologies, I’m trying to create a zombie game where zombies will spawn once all the others are dead, in an infinite loop with progressivly more zombies.

Currently when I overlap the wave spawner it does spawn the first wave of zombies however there is no second wave, this is my current blueprint (i have called the wave event at the end of zombie KO which isnt pictured, still doesnt work)

I have also tried to do a for loop before create AI however it crashes my editor and says there is an infinite loop.

The way I handled it was rather than using a spawn volume, I used an actor as a spawn location and got a random point on the NavMesh within a specified radius.

Ignore the enemy check, I was limiting the number of spawn enemies in the level at any given time.

You might want to add a spawn sound so you know if it’s actually happening. I had my spawn point just a hair too low and it caused the enemies to collide with the terrain and either fail to spawn or spawn under the floor, either way, it looked like they weren’t spawning but the sound indicated the logic was still firing since it came after the spawn actor node.

Thanks for your reply. I’ve tried what you’ve said and it works fine however my problem is that when one wave ends, another doesnt start. Do you have any logic for spawning a new wave when all enemies are down?

There are a few ways you could do it. The ways I’ve played with were getting all actors of class for the enemy class and if it was 0 then I’d start a timer that would call the spawn event I had created. I used the timer to give a brief delay before bringing in the next wave and then used a timer to give a brief delay between enemy spawns so that it wasn’t just a mass of mobs spawning simultaneously (a random time between 0.5 and 1.5 seconds between spawns).

The second method I have played with was to spawn the wave and do a count of enemies remaining that decreases after each kill. When that count reaches 0, I had it reload the level, this time with modifications done to the number of enemies, the frequency of spawn rates, health and movement speeds, etc, to add progressive challenge per wave and to allow for a “Continue from highest level reached” type of save system.

Really appreciate your help with this. I have decided to scrap the blueprints I had as I just couldnt get it to work and instead created something inside level blueprint (not sure if this is a good place to do such a thing but I’m just interested in getting it to work currently). It’s currently spawning zombies one by one with a delay of 2seconds (not ideal as I prefer to them all spawn at once)

I have everything set up fine, all linked to the HUD so it counts the amount of zombies remaining and the wave number however it’s not working properly. I feel like I could fix the issues I have if once all AI is dead the player has to press the E key to continue onto the next wave. Do you know how I could achieve this? I have attached a blueprint below of my logic.

I have also attached a picture of a common problem I am facing, when I complete a wave sometimes it will still tell me I have 1 zombie to kill who hasnt spawned but continue spawning that waves zombies so I can’t progress any further.

Thanks alot.
276634-

I’m really not too clued up with unreal but I have a feeling the reason behind the zombies killed glitching is due to me killing the last zombie or a zombie in general on the same second that it checks to increase the wave?

(After some testing I’ve decided it glitches if I kill at zombie at the same time it spawns a new one… idk how to fix that :/)

No problem at all. I’ve gotten plenty of help from people on here :slight_smile:

Take a look at how kills are being tracked. Rather than having it performed by an on-tick event, it might work better for you to call a custom event following the Destroy Actor node on enemy death or to just add the logic right there after the Destroy Actor and store the count in the Player Character or Controller if you’re planning on going Multiplayer.

This is the logic I had fire off when an enemy is killed and the actor is destroyed. Hopefully this helps.

Have you had any luck with this?