This event is triggered once at the start of a new game before the map is ready. |
This event is only ever triggered once when a new game starts, it is not called when a saved game is loaded.
When the event is triggered, all your scripts have been loaded and basic game initialisation is complete:
The eventGameInit() event is primarily aimed at script initialisation or, in the case of rules.js, player initialisation.
If you want to set custom events (timers, etc.), it is best practice to do that in eventStartLevel(). Furthermore, it is best practice to only issue orders (research, production, attacks, etc.) after eventStartLevel() – usually triggered by some other event or timer.
It is recommended that you read Environment Sequences to gain a fuller understanding of this event in context of the initialisation sequence of a new game / level.
function eventGameInit() { // do stuff } |
This event has no parameters.
Warzone does not process your event handler's return value.
var insaneResearchPath = [ /* research items here */ ]; var hardResearchPath = [ /* research items here */ ]; var mediumResearchPath = [ /* research items here */ ]; var easyResearchPath = [ /* research items here */ ]; function eventGameInit() { // choose a research path switch (difficulty) { case INSANE: { global.researchPath = insaneResearchPath; break; } case HARD: { global.researchPath = hardResearchPath; break; } case MEDIUM: { global.researchPath = mediumResearchPath; break; } case EASY: { global.researchPath = easyResearchPath; break; } } // but do not start any research yet... // research can only be started *after* eventStartLevel() } |
AvailabilityRequires:
|
See alsoRelated articles:
|