(info) Other great resources: Official JS API docs, Scripting Forum

gameTime

An integer representing the number of milliseconds since the game started.

 

Notes

When the game is paused, the game timer is also paused. The JS API will update the value of gameTime every time it calls your script, for example when triggering an event or running a timed or queued function.

The game time can be useful in campaigns or other scenarios where your script requires the human player to complete some objective or mission within a set amount of time, however setMissionTime() might be a better approach for that kind of thing.

The rate at which gameTime increases is affected by the game speed. So if you slow the game down to 0.5 (50%) then gameTime will increase at half the normal rate.

Examples

You can use Javascript's Date object with gameTime...
var gameDate = new Date(gameTime);
 
gameDate.setFullYear(2100); // this is Warzone 2100 after all!
 
console("War diary, "+gameDate.toLocaleString()); // LOL!
The gameTime global is incremented by 100ms every 100ms (source).
Availability STABLE

Requires:

  • Warzone 3.1 Beta 1 or above.
Contents

Jump to:

Â