basically i want to start a trigger when the last unit of a specific player dies.
To do this i have 2 triggers which i named "UnitDies" and "GiveMinerals". "UnitDies" triggers everytime any unit of a specific player dies.
When the last unit of the specific player died i want to start the trigger "GiveMinerals". Therefore i got a if-then-else condition in my trigger "UnitDies" which does the following:
if(number of living units in whole map of specific player == 0) then start trigger "GiveMinerals".
So the problem is if 2 or more units die simultaneously and they were the last units then the trigger "GiveMinerals" will be started multiple times.
How can i ensure that "GiveMinerals" will only be triggered one time after the last unit has died?
I tried to solve this with a boolean variable. At the beginning of the "GiveMinerals" trigger i set the boolean variable true and only enter the "GiveMinerals" trigger if this boolean variable is false.
This works most of the times, but not always.
From your description, everything seems to be alright. Can you please post the complete trigger? First, switch the post format to BBCode at the bottom of the reply textbox. Then, copy your triggers as text (highlight all the things in the triggers, then press Ctrl+Shift+C), and then paste it here in [code] format (like this [code] Your Trigger [/code] without the spaces)
Hi,
basically i want to start a trigger when the last unit of a specific player dies.
To do this i have 2 triggers which i named "UnitDies" and "GiveMinerals". "UnitDies" triggers everytime any unit of a specific player dies. When the last unit of the specific player died i want to start the trigger "GiveMinerals". Therefore i got a if-then-else condition in my trigger "UnitDies" which does the following: if(number of living units in whole map of specific player == 0) then start trigger "GiveMinerals".
So the problem is if 2 or more units die simultaneously and they were the last units then the trigger "GiveMinerals" will be started multiple times. How can i ensure that "GiveMinerals" will only be triggered one time after the last unit has died?
I tried to solve this with a boolean variable. At the beginning of the "GiveMinerals" trigger i set the boolean variable true and only enter the "GiveMinerals" trigger if this boolean variable is false. This works most of the times, but not always.
Hi
From your description, everything seems to be alright. Can you please post the complete trigger? First, switch the post format to BBCode at the bottom of the reply textbox. Then, copy your triggers as text (highlight all the things in the triggers, then press Ctrl+Shift+C), and then paste it here in [code] format (like this [code] Your Trigger [/code] without the spaces)
Would the Trigger Execution Count condition work?
@xKenneth: Go
the correct format for codes are << code>> <</code>>
Ok the problem was i needed to query the boolean variable in another condition i have in my trigger "UnitDies". It works fine now.
@ScorpSCII: Go
I didn't try this but i guess this would do also. Thanks for the advice.