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

From Galactineers
Jump to navigationJump to search
Line 65: Line 65:
 
|}
 
|}
  
 +
==OnButtonClicked()==
 +
This event is triggered when a player clicks on a button, which has been created with the ''$MissionContext->Add'' or ''$MissionContext->AddButton'' command.
 +
<source lang="php">
 +
function OnButtonClicked($buttonId, $playerId) {
 +
  global $MissionContext;
  
 +
}
 +
</source>
  
 +
{| class="wikitable"
 +
|+ Parameters
 +
|-
 +
! Parameter
 +
! Type
 +
! Description
 +
|-
 +
| $buttonId || string|| The id of the button which has been clicked
 +
|-
 +
| $playerId|| string || The player who clicked the button
 +
|}
  
 
==OnMissionInitialize()==
 
==OnMissionInitialize()==

Revision as of 18:03, 26 August 2016


OnBuildingDamaged()

This event is triggered when a building is under attack and receiving damage.

function OnBuildingDamaged($coordinates, $type) {
  global $MissionContext;

}
Parameters
Parameter Type Description
$coordinates array The x,y,z coordinates of the building
$coordinates string The type of building, e.g. Foundry


OnBuildingKilled()

This event is triggered when a building has been destroyed, after it has been removed from the $MissionContext->EnemiesBuildingList or $MissionContext->AlliedBuildingsList. That way you can evalueate the new state/count of buildings on the map.

function OnBuildingDamaged($coordinates, $type) {
  global $MissionContext;

}
Parameters
Parameter Type Description
$coordinates array The x,y,z coordinates of the building
$coordinates string The type of building, e.g. Foundry

OnBuildingKilling()

This event is triggered when a building has been destroyed, before it gets removed from the $MissionContext->EnemiesBuildingList or $MissionContext->AlliedBuildingsList. That way you can check wether a friendly or hostile building has been destroyed.

function OnBuildingDamaged($coordinates, $type) {
  global $MissionContext;

}
Parameters
Parameter Type Description
$coordinates array The x,y,z coordinates of the building
$coordinates string The type of building, e.g. Foundry

OnButtonClicked()

This event is triggered when a player clicks on a button, which has been created with the $MissionContext->Add or $MissionContext->AddButton command.

function OnButtonClicked($buttonId, $playerId) {
  global $MissionContext;

}
Parameters
Parameter Type Description
$buttonId string The id of the button which has been clicked
$playerId string The player who clicked the button

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.