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.
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+(kills+kills))Variable-Setkillseast=(kills+(kills+kills))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==falsekillseast==5000ThenVariable-Setkillbuffcheck=trueUI-Display"Team East killed 5000 units. +100% ..."for(Allplayers)toSubtitleareaUnit-Remove2dmg80%bufffromcannonUnit-Add1dmg100%bufftocannonfromcannonElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfAndConditionskillbuffcheck==falsekillseast==4000ThenVariable-Setkillbuffcheck=trueUI-Display"Team East killed 4000 units. +80% d..."for(Allplayers)toSubtitleareaUnit-Remove2dmg60%bufffromcannonUnit-Add1dmg80%bufftocannonfromcannonElse...
Rollback Post to RevisionRollBack
A programmer started to cuss Because getting to sleep was a fuss As he lay in his bed Looping 'round in his head Was: while (!asleep()) sheep++;