Timers in GTA 2 Mission Scripts

Timers are used in a number of missions in GTA 2 but are a little tricky sometimes to do.

First of all, you need to create the timer. This is done with the TIMER_DATA command. An example would be:

TIMER_DATA missiontimer01

Call the missiontimer01 whatever you like. Now we’re ready to do stuff with it.

Displaying a Timer

Now, this timer won’t do anything. For a basic timer, you now have to add the DISPLAY_TIMER command for it to show on screen. So, to show it onscreen, use the following command:

DISPLAY_TIMER (timer_name, seconds)

The timer name is a previously declared timer, and the seconds are what it should count down from in real seconds. So, our one could be like:

DISPLAY_TIMER (missiontimer01, 30)

This would show our timer with 30 seconds on the clock. And that’s it for a basic timer. For more complex features, they include clearing the timer and adding time to a timer (below).

Clearing a Timer

To clear a timer, call up the CLEAR_TIMER command. To remove the one above, the code would be this:

CLEAR_TIMER (missiontimer01)

Doesn’t get much easier than that!

Extend a Timer (aka Time Bonus)

To extend a timer, for example when you have killed someone, use this command:

ADD_TIME_TO_TIMER (timer_name, seconds)

If I wanted to add 30 seconds to our timer, I would simply use this:

ADD_TIME_TO_TIMER (missiontimer01, 30)

(Originally written by Chris “Pyro” Hockley and formatted by Ben “Cerbera” Millard with full permission.)