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
don't know how much waves you have but I'm using a similar system and it workes. but I'm not changing my check variable back to false.
and maybe put the if double == 0 into the spawn wave trigger and not the unit dies trigger
killcounter+buffingEventsUnit-AnyUnitdiesLocalVariablescannon=NoUnit<Unit>i=0<Integer>ConditionsAndConditions(Ownerof(Killingunit))<=6((Ownerof(Killingunit))mod2)!=((Ownerof(Triggeringunit))mod2)(Unittypeof(Triggeringunit))!=Broodling-(Escort)(Unittypeof(Triggeringunit))!=SelendisInterceptor(CarrierHero)ActionsVariable-Modifykills[(Ownerof(Killingunit))]:+1Variable-Setkillswest=(kills[1]+(kills[3]+kills[5]))Variable-Setkillseast=(kills[2]+(kills[4]+kills[6]))Trigger-Runbuffcheckeast(CheckConditions,Don't Wait until it finishes)Trigger-Runbuffcheckwest(CheckConditions,Don't Wait until it finishes)
buffcheckeastEventsLocalVariablescannon=Cannon[141.50,51.50]<Unit>ConditionsOrConditionskillseast==5000killseast==4000killseast==3000killseast==2000killseast==1000ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfAndConditionskillbuffcheck[4]==falsekillseast==5000ThenVariable-Setkillbuffcheck[4]=trueUI-Display"Team East killed 5000 units. +100% ..."for(Allplayers)toSubtitleareaUnit-Remove2dmg80%bufffromcannonUnit-Add1dmg100%bufftocannonfromcannonElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfAndConditionskillbuffcheck[3]==falsekillseast==4000ThenVariable-Setkillbuffcheck[3]=trueUI-Display"Team East killed 4000 units. +80% d..."for(Allplayers)toSubtitleareaUnit-Remove2dmg60%bufffromcannonUnit-Add1dmg80%bufftocannonfromcannonElse...
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!
@bzdover: Go
don't know how much waves you have but I'm using a similar system and it workes. but I'm not changing my check variable back to false. and maybe put the if double == 0 into the spawn wave trigger and not the unit dies trigger
@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!
@bzdover: Go
Seems to be working. Thanks so much for your help!
[Resolved].