I'm currently working to move all my player-specific triggers from the current system of "duplicate triggers for every player)" to "1 trigger for all players, variables using arrays". Here's an example of the old system:
+ Events
- Timer - Yeehaw Timer[1] expires
+ Actions
-Variable - Set CanYeehaw?[1] = true
This trigger sets player 1's CanYeehaw variable to true when player 1's Yeehaw Timer expires. Right now I copy this trigger 3 times and apply it to the other players (by changing the number), but is there a way to have 1 trigger for all players' timers?
Something along the lines of...
if the switch statement does not allow you to select "triggering timer" then you will need to loop through the timer array and determine which index is the "triggering timer" such as
It is possible, not as easy as you wrote it, but still quite flexible.
First of all, let me say that the step you're doing is absolutly necessary and will make your development so much easier and more fun! At the beginning (in wc3) I used to have huge blocks of if then elses or triggers for every player,... ugly and the most annoying thing is: When you want or need to change something you will need to do it x times :D
Ok now to your problem:
Edit: Ok, you got an answer while I was typing.. I suggested this solution too:
for each i 0 - 15
if "EventTimer" = timer[i] then
o do something for player i
The advantage is that you don't need to copy over the actions you do for the player over and over. But if you want to do different things for each player you should pick the first method.
The editor requires me to specify either a specific variable timer or the Last Created Timer in the "[Timer] expires" event. This kind of counters both those strategies!
EDIT:
Unless, if I specify multiple Timer expires events, it will wait for only one of them to expire, not all of them...
If you cant select the "any timer" event then you will need to add an event for each timer you want the trigger to run on. You can then remove the conditions on the trigger.
The trigger doesn "wait" for anything.... It fires when the listed events occur.
And dont refer to "events" as fucntions.... they are two completely different things.
Hello!
I'm currently working to move all my player-specific triggers from the current system of "duplicate triggers for every player)" to "1 trigger for all players, variables using arrays". Here's an example of the old system:
+ Events
- Timer - Yeehaw Timer[1] expires
+ Actions
-Variable - Set CanYeehaw?[1] = true
This trigger sets player 1's CanYeehaw variable to true when player 1's Yeehaw Timer expires. Right now I copy this trigger 3 times and apply it to the other players (by changing the number), but is there a way to have 1 trigger for all players' timers? Something along the lines of...
+ Events
- Timer - Yeehaw Timer[x] expires
+ Actions
- Variable - Set CanYeehaw?[x] = true
Do do this with multiple timers and one trigger
if the switch statement does not allow you to select "triggering timer" then you will need to loop through the timer array and determine which index is the "triggering timer" such as
Excellent solution. Thank you very much! :)
Actually, the problem is that there is no function such as "Any timer". =(
It is possible, not as easy as you wrote it, but still quite flexible.
First of all, let me say that the step you're doing is absolutly necessary and will make your development so much easier and more fun! At the beginning (in wc3) I used to have huge blocks of if then elses or triggers for every player,... ugly and the most annoying thing is: When you want or need to change something you will need to do it x times :D
Ok now to your problem:
Edit: Ok, you got an answer while I was typing.. I suggested this solution too:
for each i 0 - 15
o do something for player i
The advantage is that you don't need to copy over the actions you do for the player over and over. But if you want to do different things for each player you should pick the first method.
The editor requires me to specify either a specific variable timer or the Last Created Timer in the "[Timer] expires" event. This kind of counters both those strategies!
EDIT: Unless, if I specify multiple Timer expires events, it will wait for only one of them to expire, not all of them...
No, just do what SouLCarveRR said, but instead of making 15 conditions, make 15 events like:
...etc. then use the switch he mentioned.
edit: oh you edited while i was postin' ;{ but yeah, trigger fires when any of specified events occurs.
If you cant select the "any timer" event then you will need to add an event for each timer you want the trigger to run on. You can then remove the conditions on the trigger.
The trigger doesn "wait" for anything.... It fires when the listed events occur.
And dont refer to "events" as fucntions.... they are two completely different things.
Woohoo! Thank you very much, guys. I managed to get the trigger working with your combined help. Much obliged. :)