When trying to create a special ability for a character that requires a specific duration the obvious first thought might be to use a wait trigger. However, in practice in a complicated map this will cause too much interference with other triggers making it impractical especially in multiplayer enviroment. While there are various ways around. This technique is even more value able when your dealing with multiple different special abilities all being activated at the same time each with different potential timers. This can also be used to make a cool down timer if you want time between spell casts that do not have a duration themselves.
For example. You want a spell that creates 2 Ultralisks at a location around the player that lasts for 15 seconds.
Duration Timers using Spider Mines:
Simply put the method uses Spider Mines created a specific location to act as a timer exploiting the fact that they will stack indefinately in one spot even for multiple players.
Example of how to do it
Create a location the spider mine will be made. "Timer1"
Trigger 1: This activates the timer
Condition: switch 1(Activate Mines)
Action: Create 1 spider mine at "Timer1" for p1 (thus creates one every second or so)
Preserve Trigger
Trigger 2: This disables the timer
Condition: switch 1(Activate Mines) is cleared
Action: Remove all spider mines at location "Timer1" for p1
Preserve Trigger
Trigger 3: Trigger that does your abilities
Condition: Up to you
Action: Create 2 Ultralisks for player 1 at location X
set switch 1(Activate Mines)
Preserve trigger
Trigger 4: Trigger that ends the timer
Condition: Switch 1 is set
Player 1 brings at least 15 spider mines to location "Timer1"
(additional conditions depend on trigger 3 conditions)
Action: Remove all Ultralisks for player 1
Clear switch 1 er (this then removes all mines)
Preserve
Thus now you can apply this to any special ability, if you want to have multiple special abilities with timers
going off at the same time you can either create another location for that timer OR use a different player to create the spider mines at the same location (all will stack). In my map I use the 4 computer players mines and one location per player character to do all the timers.
Note: This only works for short durations like under a minute else your building just too many units on the map.
To add a cool down timer takes it a step further but is essentially the same idea. The way I did it was easy.
To activate a special ability you build a shuttle from a robo facility (you have 4 robo facilities each that trigger different things). Thus to prevent a player from activating a spell onces its been cast till the end of the duration, or just as a cool down till you want them to use it agian do the following.
Once the player has brought the shuttle to the location, give the building to a computer player thus the player can't activate it agian (note: you WON'T loose your hot key). Start a timer as mentioned above, and when the timer is up give the player back the building.
If you would like to see more examples and the actual triggers you can see how I did it in the demo version of my map in this thread http://www.staredit.net/?topic=1229
Hope this is helpful.
MTROUT
None.