Difference between revisions of "Modding:PVEMissions:mission.php:MissionContextCommands"
From Galactineers
Jump to navigationJump to searchLInsoDeTeh (talk | contribs) |
LInsoDeTeh (talk | contribs) |
||
| Line 1: | Line 1: | ||
{{DISPLAYTITLE:$MissionContext Commands}} | {{DISPLAYTITLE:$MissionContext Commands}} | ||
| + | ==AddInRegionTrigger()== | ||
| + | This command adds a trigger for when a ship is inside a certain region. The function call like this: | ||
| + | <source lang="php"> | ||
| + | $MissionContext->AddInRegionTrigger($triggerId, $regionId, $shipId) | ||
| + | </source> | ||
| + | |||
| + | {| class="wikitable" | ||
| + | |+ Parameters | ||
| + | |- | ||
| + | ! Parameter | ||
| + | ! Type | ||
| + | ! Description | ||
| + | |- | ||
| + | | $triggerId || string || The Id which is passed in the ''OnTrigger'' event handler and can be used in the ''RemoveTrigger'' command. | ||
| + | |- | ||
| + | | $regionId || string || The Id of a region that has been defined with the ''SetRegion'' command before. | ||
| + | |- | ||
| + | | $shipId || integer || The Id of a ship | ||
| + | |} | ||
| + | |||
| + | |||
| + | ==AddOutsideRegionTrigger()== | ||
| + | This command adds a trigger for when a ship is '''not''' inside a certain region. The function signature and parameters are identical to the ''AddInRegionTrigger'' command. | ||
| + | |||
| + | ==AddShip()== | ||
| + | This command adds a new ship to the map. The function call looks like this: | ||
<source lang="php"> | <source lang="php"> | ||
| − | + | $shipId = $MissionContext->AddShip($definitionId, $coordinates, $rotation, $owner) | |
| − | + | </source> | |
| − | + | {| class="wikitable" | |
| + | |+ Parameters | ||
| + | |- | ||
| + | ! Parameter | ||
| + | ! Type | ||
| + | ! Description | ||
| + | |- | ||
| + | | $definitionId || string || The Id of the <ShipDefinition> from the [[Modding:PVEMissions:shipdefinitions.xml|shipdefinitions.xml]]. | ||
| + | |- | ||
| + | | $coordinates || array || The x and z coordinates where to spawn the ship. | ||
| + | |- | ||
| + | | $rotation || integer || The rotation (in degrees) of the ship. | ||
| + | |- | ||
| + | | $owner || string || The PlayerId of the ship owner. 'X' for enemies, 'Y' for allies, the playerId from the ''$MissionContext->PlayerList'' property for a player. | ||
| + | |} | ||
| + | |||
| + | {| class="wikitable" | ||
| + | |+ Return Value | ||
| + | |- | ||
| + | ! Type | ||
| + | ! Description | ||
| + | |- | ||
| + | | int || The Id of the ship on the map for use in ''MoveShip'' command or ''OnShipKilled'' trigger for example. | ||
| + | |} | ||
| + | |||
| + | ===Example:=== | ||
| + | <source lang="php"> | ||
| + | $shipId = $MissionContext->AddShip('PirateProbe', array(10, 12), 0, 'X'); | ||
| + | |||
| + | $playerId = $MissionContext->PlayersList[0]; | ||
| + | $shipId2 = $MissionContext->AddShip('Rosinante', array(6, -7), 45, $playerId); | ||
</source> | </source> | ||
| + | |||
| + | |||
| + | ==MoveShip()== | ||
| + | This command moves an existing ship to the target coordinates. | ||
| + | |||
| + | | class="wikitable" | ||
| + | |+ Parameters | ||
| + | |- | ||
| + | ! Parameter | ||
| + | ! Type | ||
| + | ! Description | ||
| + | |- | ||
| + | | $shipId || integer || The Id of the ship received from the ''AddShip'' command or from the ''$MissionContext->PlayerShipList'' or ''$MissionContext->EnemyShipList'' properties. | ||
| + | |- | ||
| + | | $coordinates || array || The x and z coordinates where to move the ship. | ||
| + | |} | ||
| + | |||
[[Category:Modding:PVEMissions:mission.php]] | [[Category:Modding:PVEMissions:mission.php]] | ||
Revision as of 17:48, 15 March 2016
AddInRegionTrigger()
This command adds a trigger for when a ship is inside a certain region. The function call like this:
$MissionContext->AddInRegionTrigger($triggerId, $regionId, $shipId)| Parameter | Type | Description |
|---|---|---|
| $triggerId | string | The Id which is passed in the OnTrigger event handler and can be used in the RemoveTrigger command. |
| $regionId | string | The Id of a region that has been defined with the SetRegion command before. |
| $shipId | integer | The Id of a ship |
AddOutsideRegionTrigger()
This command adds a trigger for when a ship is not inside a certain region. The function signature and parameters are identical to the AddInRegionTrigger command.
AddShip()
This command adds a new ship to the map. The function call looks like this:
$shipId = $MissionContext->AddShip($definitionId, $coordinates, $rotation, $owner)| Parameter | Type | Description |
|---|---|---|
| $definitionId | string | The Id of the <ShipDefinition> from the shipdefinitions.xml. |
| $coordinates | array | The x and z coordinates where to spawn the ship. |
| $rotation | integer | The rotation (in degrees) of the ship. |
| $owner | string | The PlayerId of the ship owner. 'X' for enemies, 'Y' for allies, the playerId from the $MissionContext->PlayerList property for a player. |
| Type | Description |
|---|---|
| int | The Id of the ship on the map for use in MoveShip command or OnShipKilled trigger for example. |
Example:
$shipId = $MissionContext->AddShip('PirateProbe', array(10, 12), 0, 'X');
$playerId = $MissionContext->PlayersList[0];
$shipId2 = $MissionContext->AddShip('Rosinante', array(6, -7), 45, $playerId);
MoveShip()
This command moves an existing ship to the target coordinates.
| class="wikitable" |+ Parameters |- ! Parameter ! Type ! Description |- | $shipId || integer || The Id of the ship received from the AddShip command or from the $MissionContext->PlayerShipList or $MissionContext->EnemyShipList properties. |- | $coordinates || array || The x and z coordinates where to move the ship. |}