Upward Timers in GTA 2 Mission Scripts

Faking an upward timer is possible by using ADD_TIME_TO_TIMER once per second in a WHILE_EXEC loop. Normally, a timer will lose 1 second per second. Simply add 2 seconds during each second and it will count upwards!

This code runs in a separate thread, so you can add it to any level. Check for naming conflicts, then adjust the coordinates for the PLAYER_PED. Make sure the THREAD_TRIGGER covers the start point for the first player, as that's the only player who will definitely be in the level.

You can see it working in Army Base and few of my other levels where you must complete a mission.

Complete Code Example

This can be added to any existing script. If your level has a main loop, use that instead of the COUNTER called loopage.

First published on GTAMP Forum by me. That thread has lots of re-usable code samples.

// Your other objects go here.

// Player:
PLAYER_PED p1 = (202.5,240.0,2.0) 07 000 // Yellow

// Upward Timer
// http://projectcerbera.com/gta/2/tutorials/upward-timers
FORWARD upward_timer:
COUNTER loopage = 1 // main loop
COUNTER stage = 1 // tracks the thing we are timing
COUNTER timer = 3 // count frames from 1-30 every second
// Note: Starting at 2 or 3 removes flicker from the timer.
TIMER_DATA time_taken // display the time taken
                                p1, 202.0,242.0,2.0, 4.0,4.0, upward_timer:) 
 // Setup
 DELAY_HERE (330) // wait for Time Limit to go away
 DISPLAY_TIMER (time_taken, 12) // 330 frames = 11 seconds
 // Remove
 WHILE_EXEC (stage = 0) // don't want it any more
  CLEAR_TIMER (time_taken)
 // Display and Update
 WHILE_EXEC (stage = 1) // until JOB COMPLETE
  IF (timer = 30) // once per second
   SET timer = 1 // reset interval
   ADD_TIME_TO_TIMER (time_taken, 2)
   ++timer // count 1 frame
 // Pause Timer
 // Note: Lets players see how long they took to complete.
 WHILE_EXEC (stage = 2)
  IF (timer = 30) // once per second
   SET timer = 1 // reset interval
   ADD_TIME_TO_TIMER (time_taken, 1)
   ++timer // count by 1 frame


// Your other commands go here.


This timer starts as soon as the level begins. It pauses if any part of your script does SET stage = 2. You can remove the timer with SET stage = 0 anywhere in your code. Feel free to integrate it however you like, though.


In multiplayer games, you can set a Time Limit. GTA2 displays this when the game starts but it will delete any mission script timer. You have to wait 11 seconds for it to go away. That was discovered by Elypter, IIRC.

Time Limit reminders later on in the game will not delete your timers.