Im creating this survival map where waves of units spawn and stufff... now i have a simple trigger to check if all the units in the wave are dead and if so it runs the "WaveDone trigger", the trigger is shown below. However when i kill multiple units at the same time with an AOE attack the trigger WaveDone will run multiple times, i can not have this! it ruins my game! so there is a better way out there right? or an extra statement to not make it run multiple times.
I don't know what you mean, set a booleaan where and what would i check with the boolean check if the trigger has alrdy run or something? i dont get it, i mean 5 units die at the same time(last units of wave), so the trigger gets runned 5 times and 5 times it will say that player 5 has 0 units so it also runs wavedone 5 times, how am i going to solve this with a boolean?
I mean a boolean as in a variable. Create a global variable of the type "Boolean" and add a condition so that the boolean must be false. As soon as the other conditions are also met, set this boolean to true.
Like this, not matter how many units die it will only show the text message a single time.
b = False <Boolean>
Events
Unit - Any Unit dies
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
b == False
Then
Variable - Set b = True
UI - Display "1" for (All players) to Subtitle area
WaveDoneEventsLocalVariablesConditionsWaveisDone==TrueActionsVariable-SetWaveisDone=FalseUI-Display("Congratulations, you have beat Wave..."+((Text(CurrentWave))+""))for(Allplayers)toDirectiveareaTrigger-TurnWavePauseOnVariable-ModifyCurrentWave:+1
You should have the condition before the variable set. You can add next to your "Number of Living Units..." condition and have them both under a "And" condition. Also you should have a wait before you set the boolean to false again.
If you make your triggers look like this, then it should work.
WaveCheckEventsUnit-AnyUnitdiesConditions(Ownerof(Triggeringunit))==5ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfAndConditionsWaveisDone==False(NumberofLivingunitsin(Anyunitsin(Entiremap)ownedbyplayer5matching(NoValue),withatmostAnyAmount))<1ThenVariable-SetWaveisDone=TrueTrigger-RunWaveDone(CheckConditions,Waituntilitfinishes)General-Wait1.0GameTimesecondsVariable-SetWaveisDone=FalseWaveDoneEventsLocalVariablesConditionsActionsUI-Display("Congratulations, you have beat Wave..."+((Text(CurrentWave))+""))for(Allplayers)toDirectiveareaTrigger-TurnWavePauseOnVariable-ModifyCurrentWave:+1
Hey, im reopening this because i found out during testing it sometimes doesnt run the WaveDone trigger while all units of player 5 are dead, i tested it witch chat messages, 0 units left and the wave sometimes doesnt run wavedone which i must mean that the boolean return false when it is actually suppose to turn true :/ i have set it up exactly the way you recommended though.
maybe someone knows whats going on? or another solution?
i can not have it bug, it freezes up the whole game and nomore wave will come because the trigger are like a chain reaction.
Like.......... why is this happening... please someone...? Any other solution to my problem above without using the boolean? i thought it wouldn't be this hard i mean, there are a lot of custom games using waves...
I made a periodic trigger to check if all units are dead in a playergroup where i store all the units in the wave instead of checking each time a units dies. so if units die at the same time now it doesn´t matter.
Anyway i dont like the way i fixed it, the other trigger was better, but it bugged......................................................................................
hey ppl,
Im creating this survival map where waves of units spawn and stufff... now i have a simple trigger to check if all the units in the wave are dead and if so it runs the "WaveDone trigger", the trigger is shown below. However when i kill multiple units at the same time with an AOE attack the trigger WaveDone will run multiple times, i can not have this! it ruins my game! so there is a better way out there right? or an extra statement to not make it run multiple times.
help much appreciated.
You could disable the trigger and enable it again with the other trigger.
@Exaken: Go
good idea, think it will work ill try it, but not very nice solution right.
Also other ways for doing this?
UPDATE
I tried it, it doen't work
I think because the triggers are run exactly at the same time becus the AOE kills the units exactly at the same time.
How about setting a boolean and checking for it?
@Exaken: Go
I don't know what you mean, set a booleaan where and what would i check with the boolean check if the trigger has alrdy run or something? i dont get it, i mean 5 units die at the same time(last units of wave), so the trigger gets runned 5 times and 5 times it will say that player 5 has 0 units so it also runs wavedone 5 times, how am i going to solve this with a boolean?
I mean a boolean as in a variable. Create a global variable of the type "Boolean" and add a condition so that the boolean must be false. As soon as the other conditions are also met, set this boolean to true.
Like this, not matter how many units die it will only show the text message a single time.
b = False <Boolean>
@Exaken: Go
I have now set it up like this but it isnt working:
You should have the condition before the variable set. You can add next to your "Number of Living Units..." condition and have them both under a "And" condition. Also you should have a wait before you set the boolean to false again.
@Exaken: Go
ik begrijp er geen zak meer van...
If you make your triggers look like this, then it should work.
@Exaken: Go
Ahh, it is working now, though i do not really understand why it is working it seems to always do its job.
hope it stays working.
thx for the help man!
Np, glad I could help. :)
@Exaken: Go
Hey, im reopening this because i found out during testing it sometimes doesnt run the WaveDone trigger while all units of player 5 are dead, i tested it witch chat messages, 0 units left and the wave sometimes doesnt run wavedone which i must mean that the boolean return false when it is actually suppose to turn true :/ i have set it up exactly the way you recommended though.
maybe someone knows whats going on? or another solution?
i can not have it bug, it freezes up the whole game and nomore wave will come because the trigger are like a chain reaction.
@Rice87: Go
Like.......... why is this happening... please someone...? Any other solution to my problem above without using the boolean? i thought it wouldn't be this hard i mean, there are a lot of custom games using waves...
Yes i fixed it, no im not satisfied.
I made a periodic trigger to check if all units are dead in a playergroup where i store all the units in the wave instead of checking each time a units dies. so if units die at the same time now it doesn´t matter.
Anyway i dont like the way i fixed it, the other trigger was better, but it bugged......................................................................................
still if anyone got a better way, do tell