Script reference

Functions called from game

FunctionDescriptionParameters
void initiate() Called after game was initialized and before first game step
void step() Called after each game logic step. STEPS_PER_SECOND steps per second, independent of rendering FPS
void terminate() Called on script engine termination. Useful to release resources. Whatever request made from here to EngineInterface will be ignored
string onMissionEnd() Called right after step when call to EngineInterface.endMission() was made, and before terminate(). This function is not called if mission is ended by player.
Return string is name of next mission. Return empty string if there is no next mission, or mission failed. This allows you to branch campaign based on game state at mission end.
Note: this is only place where you can place objects into pools without warping, using EngineInterface.storeObjectToPool, so you can use them in later mission (e.g. you want to return to this place in state as you left it).
string getObjectives() This function is called from engine to get current mission objectives (for reading by player). You can use '\n' character to create a new line (e.g. "- destroy enemy \n - protect allies", will display two lines). New lines are also added where text wouldn't fit on screen or should not overlap other UI elements.
void terminate() Called on script engine termination. Useful to release resources. Whatever request made from here to EngineInterface will be ignored
void onObjectDestroyed(Object@) Called every time objects is about to be removed from game when destroyed.
void onObjectWarpout(Object@) Called every time objects is about to be removed from game after it warped out.