I've been struggling for some time to correctly implement double and triple spawn prevention via triggers.
I'm working a basic turret defense map, and the last two units in any given wave are occasionally killed at the same time. I have a trigger set up to count the number of units remaining whenever a unit dies, and if there are none left to spawn the next wave. When the last two or three units die at the same time, the next two or three waves spawn all at once.
In an attempt to resolve this issue I created a Double Spawn Prevention variable and set it to 0 after spawning a wave. When the final unit in a wave dies, an If / Then/ Else action checks for Double Spawn Prevention == 0, then sets the Double Spawn Prevention variable to 1 and call the Spawn Waves trigger.
My hope was that this would confine the Spawn Waves trigger to one run per cycle, since the If / Then / Else action would check the Double Spawn Prevention variable and thereby block another spawn until the end of the round. Unfortunately, no such luck.
Any advice on what else I could try? I've copied some of the relevant triggers below, for reference.
LocalVariablesWaves=0<Integer>ActionsUnit-Create5WaveTypes[CurrentWaveNumber] for player 10 at (Center of Spawn) (No Options)
Variable - Set Double Spawn Prevention = 0
0
@bzdover: Go
Seems to be working. Thanks so much for your help!
[Resolved].
0
@b0ne123: Go
Using an array check for each wave...brilliant idea! Thanks mate I'll try it and post back with results.
P.S. Income Wars is an awesome map!
0
I've been struggling for some time to correctly implement double and triple spawn prevention via triggers.
I'm working a basic turret defense map, and the last two units in any given wave are occasionally killed at the same time. I have a trigger set up to count the number of units remaining whenever a unit dies, and if there are none left to spawn the next wave. When the last two or three units die at the same time, the next two or three waves spawn all at once.
In an attempt to resolve this issue I created a Double Spawn Prevention variable and set it to 0 after spawning a wave. When the final unit in a wave dies, an If / Then/ Else action checks for Double Spawn Prevention == 0, then sets the Double Spawn Prevention variable to 1 and call the Spawn Waves trigger.
My hope was that this would confine the Spawn Waves trigger to one run per cycle, since the If / Then / Else action would check the Double Spawn Prevention variable and thereby block another spawn until the end of the round. Unfortunately, no such luck.
Any advice on what else I could try? I've copied some of the relevant triggers below, for reference.
Unit Dies
<</code>>
Spawn Waves
Thanks guys!