Other great resources: Official JS API docs, Scripting Forum

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Overview

This event is triggered once at the start of the game before the map is ready.

You can use it to initialise your scripts but don't try interacting with the map or any game objects at this point as they won't be ready – for that you'll need to use eventStartLevel() instead.

Availability

Warzone 3.1 Beta 1 and above.

Syntax

function eventGameInit() {
  // do stuff
}

Parameters

This event has no parameters.

Return value

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

Example

Choose a research path based on AI difficulty
var insaneResearchPath = [ /* research items here */ ];
var hardResearchPath = [ /* research items here */ ];
var mediumResearchPath = [ /* research items here */ ];
var easyResearchPath = [ /* research items here */ ];


function eventGameInit() {
  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;
    }
  }
}

See also

  • No labels