Spawn waves of enemies with delay

In a nutshell, don’t use a loop, use an IF.

EDIT: Read your question a bit more closely, gimme 5…

So, you could use the graph below, and plug the delay you read from the table into the delay node. But this doesn’t account for the table being ordered randomly.

I’d say, make a new BP ‘Enemy spawner’, all it contains is a little bit of code. Run down the table and spawn as many other spawners as you need, and each one does something like this with it’s params:

1 Like

Looking to spawn waves of enemies, where each enemy has a spawn delay. The enemy type and spawn information comes from a table.

Right now I can only spawn all the enemies of a wave at the same time. I tried to use timers unsuccessfully.

I tried to use “Set timer by event” but it doesn’t allow parameters so when the timer goes off the event won’t know which enemy to spawn.

I tried spawning all the enemies of the wave and added a delay in the enemy blue print on “begin play” but the behavior trees are still active during the delay so that doesn’t work.

The only solution I can think of is this:

  1. loop through all enemies in wave
    building a queue of enemies from
    smallest to largest delay
  2. set timer to first enemy in queue
  3. when timer goes off spawn all enemies in front of queue with same spawn delay. Dequeue spawned enemies.
  4. set new timer to next enemy in queue

Seems like there should be a simpler solution.

thanks. that worked!!
Allows for random ordering since i spawn all enemies by wave.