$MissionContext Events

From Galactineers
Jump to navigationJump to search


OnMissionInitialize()

This event is triggered during initialization of the mission. It is used to setup mission objectives, timers, counters, and everything else you need during the mission.

function OnMissionInitialize() {
  global $MissionContext;

}


OnMissionStarted()

This event is triggered when all players finished loading the mission. Can be used to e.g. display story-telling messages.

function OnMissionStarted() {
  global $MissionContext;

}


OnMissionUpdateTick()

This event is triggered once every second. It can be used to check for conditions which are not covered by any other event. Should not contain too CPU-intense code.

function OnMissionUpdateTick() {
  global $MissionContext;

}


OnShipDamaged()

This event is when a ship is under attack and receiving damage.

function OnShipDamaged($shipId) {
  global $MissionContext;

}
Parameters
Parameter Type Description
$shipId integer The Id of the ship returned from the AddShip command.


OnShipKilled()

This event is when a ship has been killed, after it has been removed from the $MissionContext->EnemiesShipList resp. $MissionContext->PlayersShipList. That way you can evaluate the new state/count of all ships on the map.

function OnShipKilled($shipId) {
  global $MissionContext;

}
Parameters
Parameter Type Description
$shipId integer The Id of the ship returned from the AddShip command.


OnShipKilling()

This event is when a ship has been killed, before it gets removed from the $MissionContext->EnemiesShipList resp. $MissionContext->PlayersShipList. That way you can check wether a friendly or a hostile ship has been killed.

function OnShipKilling($shipId) {
  global $MissionContext;

}
Parameters
Parameter Type Description
$shipId integer The Id of the ship returned from the AddShip command.


OnTimerExpired()

This event is when a timer has expired.

function OnTimerExpired($timerId) {
  global $MissionContext;

}
Parameters
Parameter Type Description
$timerId string The Id of the timer used during creation of the timer with the SetTimer command.


OnTrigger()

This event is when a trigger has been triggered.

function OnTrigger($triggerId, $shipId) {
  global $MissionContext;

}
Parameters
Parameter Type Description
$triggerId string The Id of the trigger used during creation of the trigger with the SetTrigger command.
$ship string If the trigger involved a ship (e.g. the AddInRegionTrigger or AddOutsideRegionTrigger), the ship Id returned from the AddShip command is passed.