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

eventGameLoaded()

This event is triggered once after a saved game is loaded.

 

Overview

This event is triggered once, when a saved game is loaded, just prior to the game being resumed.

The primary use of this event is to re-create any data objects that might not have been persisted when the game was saved. For example, if you have objects that you didn't store on the global scope because they contained functions (and functions can't be persisted to a save game) you can recreate them prior to the loaded game resuming.

This event is not to be confused with:

(warning) It is recommended that you read Environment Sequences to gain a fuller understanding of this event in context of the initialisation sequence of a loaded game.

Syntax

function eventGameLoaded() {
  // do stuff
}

Parameters

This event has no parameters.

Return value

Warzone does not process your event handler's return value.

Example

function eventGameLoaded() {
  // don't restart your timers - they were persisted in the save game
  // and get restarted automatically by the game engine
 
  // instead, use this to recreate objects that weren't stored in the save game
}
There's no need to restart timers in this event – they will already be running because they are persisted in save games (that's why you have to specify the function names as strings).

Availability

Requires:

  • Warzone 3.2 and above.

See also

Related articles: