Other great resources: Official JS API docs, Scripting Forum
eventGameLoaded()
- Aubergine
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:
- eventGameInit() – triggered once when a new game is started
- eventStartLevel() – triggered once when a new game is loaded, and also after a new level is loaded due to using loadLevel().
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 }
Availability
Requires:
- Warzone 3.2 and above.
See also
Related articles:
- Environment Sequences – recommended reading!
- eventGameSaving() – triggered just before a game is saved
- eventGameSaved() – triggered just after a game is saved
- eventGameInit() – triggered once at the start of a new game
- eventStartLevel() – triggered once at the start of a new game, and once after a new level is loaded
- Events & Timers – documentation for all other events in the JS API