Revision as of 19:57, 27 November 2010 by Payne (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Timers can be used to notify players how or when a certain event is about to occur. Timers are created purely through triggers.

Creating your Timer

To create a timer, you may want to start with a Global Timer Variable (a variable in the trigger list on the left). This is so that you can use it for the trigger that initiates when the timer ends. So make a new trigger and make the event when you want your Timer to start. The action should be Start Timer (found easily through the Timer category).

You may choose to make it a One-Shot timer (timer only appears once) or a Repeating Timer (a timer that repeats until stopped). Then you want to set your variable which is the default selection for a new action. You would want it to be "Set (Your Global Timer Variable) == (Last Created Timer)". Now if you test it the timer will initiate but you can't see how much time is remaining. That brings us to Timer Windows.

Timer Windows

Now create another trigger after the Set Variable trigger. This should be set to "Create Timer Window" found also in the Timer category. It is optional to change the (Last Created Timer) to the Variable Timer which may or may not be better. Now you have a Timer that is shown in-game! The title part is a text type-in part that will show what the timer is for. If you want a Countdown Timer then you will want to use Remaining time and if you want a count-up timer, than you will use elapsed time.

Timer Events

To create an effect when a timer ends you will have to make a new trigger. You will create an event that defines the end of your timer. A perfect event is "Timer Expires" under the Timer category and you will change the Timer into your global variable. Now you will have a trigger that activates when your timer ends, now you can make actions that happen when the timer ends.

Finished Product

A simple timer trigger would be:

The in game view of the timers.
The in game view of the timers.

Timer = (New timer) <Timer>

Create Timer
         Game - Map initialization
   Local Variables
         Timer - Start Timer as a Repeating timer that will expire in 10.0 Real Time seconds
         Timer - Create a timer window for (Last started timer), with the title "Remaining Time", using Remaining time (initially Visible)
         Timer - Create a timer window for (Last started timer), with the title "Elapsed Time", using Elapsed time (initially Visible)
Timer Ends
         Timer - Timer expires
   Local Variables
         Unit - Create 1 Marine for player 1 at (Center of (Entire map)) using default facing (No Options)

See Also