Difference between revisions of "Modding:PVEMissions:mission.php:MissionContextEvents"

From Galactineers
Jump to navigationJump to search
(Created page with "{{DISPLAYTITLE:$MissionContext Events}} Category:Modding:PVEMissions:mission.php")
 
Line 1: Line 1:
 
{{DISPLAYTITLE:$MissionContext Events}}
 
{{DISPLAYTITLE:$MissionContext Events}}
 +
 +
==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.
 +
<source lang="php">
 +
function OnMissionInitialize() {
 +
  global $MissionContext;
 +
 +
}
 +
</source>
 +
 +
 +
==OnMissionStarted()==
 +
This event is triggered when all players finished loading the mission. Can be used to e.g. display story-telling messages.
 +
<source lang="php">
 +
function OnMissionStarted() {
 +
  global $MissionContext;
 +
 +
}
 +
</source>
 +
 +
 +
==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.
 +
<source lang="php">
 +
function OnMissionUpdateTick() {
 +
  global $MissionContext;
 +
 +
}
 +
</source>
 +
 +
 +
==OnShipDamaged()==
 +
This event is when a ship is under attack and receiving damage.
 +
<source lang="php">
 +
function OnShipDamaged($shipId) {
 +
  global $MissionContext;
 +
 +
}
 +
</source>
 +
 +
{| class="wikitable"
 +
|+ 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.
 +
<source lang="php">
 +
function OnShipKilled($shipId) {
 +
  global $MissionContext;
 +
 +
}
 +
</source>
 +
 +
{| class="wikitable"
 +
|+ 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.
 +
<source lang="php">
 +
function OnShipKilling($shipId) {
 +
  global $MissionContext;
 +
 +
}
 +
</source>
 +
 +
{| class="wikitable"
 +
|+ 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.
 +
<source lang="php">
 +
function OnTimerExpired($timerId) {
 +
  global $MissionContext;
 +
 +
}
 +
</source>
 +
 +
{| class="wikitable"
 +
|+ 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.
 +
<source lang="php">
 +
function OnTimerExpired($triggerId, $shipId) {
 +
  global $MissionContext;
 +
 +
}
 +
</source>
 +
 +
{| class="wikitable"
 +
|+ 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.
 +
|}
 +
  
  
 
[[Category:Modding:PVEMissions:mission.php]]
 
[[Category:Modding:PVEMissions:mission.php]]

Revision as of 19:44, 15 March 2016


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 OnTimerExpired($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.