Im doing a tower defense variant and need some trigger help:
I have 1 trigger that runs each time a unit dies. That trigger adds a unit bounty depending on which unit died to the player and at the end of that trigger it runs another trigger which checks to see if there are any remaining enemies on the map. If there are remaining enemies nothing happens. If there aren't any remaining enemies a wave completion bounty is added to each player and initiates a timer for the next wave.
Here is were my problem comes into play.
I have towers that do AOE damage and if I happen to kill off the last 15 units on the map in one fell swoop the trigger activates the wave bounty trigger 15 times which adds 15xwave boundy, 15 wave completion messages, etc...
How would I go about making sure that the wave bounty trigger only runs 1 time?
Make a Timer, "Timer 5"
Replace all of your actions with Setting Timer 5 as a one shot timer for 1 second.
Put all of the actions that used to be there in a seperate trigger which is activated when Timer 5 expires.
I understand what your saying, but in an instance where i kill 1 unit and then .5 second later kill the last unit on the board. The one shot timer wont expire for the last unit dieing (since the first unit activated the timer first) and then it will never progress to the next wave. Correct?
So let me get this straight. Create a new trigger that when a unit dies create a 1 shot timer for 1 second long. Set another trigger that executes when timer expires that adds bounty and also activates a 3rd trigger that checks to see if it's the last unit on the map? Am I getting this straight? I'm a little confused on your first post as to how exactly the triggers should be setup.
You might wanna check out the Critical Section function. It forces a set of actions to be run one at a time. Remember that it needs a global true/false variable in it's Lock parameter to work.
@Etravex:
No, you aren't getting it straight. Create a new trigger that when a unit dies and is the last unit on the map, create a 1 shot timer for 1 second long. Set another trigger that executes when timer expires that adds bounty.
Im doing a tower defense variant and need some trigger help:
I have 1 trigger that runs each time a unit dies. That trigger adds a unit bounty depending on which unit died to the player and at the end of that trigger it runs another trigger which checks to see if there are any remaining enemies on the map. If there are remaining enemies nothing happens. If there aren't any remaining enemies a wave completion bounty is added to each player and initiates a timer for the next wave.
Here is were my problem comes into play. I have towers that do AOE damage and if I happen to kill off the last 15 units on the map in one fell swoop the trigger activates the wave bounty trigger 15 times which adds 15xwave boundy, 15 wave completion messages, etc...
How would I go about making sure that the wave bounty trigger only runs 1 time?
Thank you
@Andernerd: Go
I understand what your saying, but in an instance where i kill 1 unit and then .5 second later kill the last unit on the board. The one shot timer wont expire for the last unit dieing (since the first unit activated the timer first) and then it will never progress to the next wave. Correct?
@Andernerd: Go
So let me get this straight. Create a new trigger that when a unit dies create a 1 shot timer for 1 second long. Set another trigger that executes when timer expires that adds bounty and also activates a 3rd trigger that checks to see if it's the last unit on the map? Am I getting this straight? I'm a little confused on your first post as to how exactly the triggers should be setup.
You might wanna check out the Critical Section function. It forces a set of actions to be run one at a time. Remember that it needs a global true/false variable in it's Lock parameter to work.
There are conditions like "Count units in area by owned player". When you're using them it shouldn't be a problem.