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

From Galactineers
Jump to navigationJump to search
Line 25: Line 25:
 
$MissionContext->AddInRegionTrigger('myTrigger', 'myCircle', 17);
 
$MissionContext->AddInRegionTrigger('myTrigger', 'myCircle', 17);
 
</source>
 
</source>
 +
  
 
==AddOutsideRegionTrigger()==
 
==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.
+
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:
 +
<source lang="php">
 +
$MissionContext->AddOutsideRegionTrigger($triggerId, $regionId, $shipId)
 +
</source>
  
  
Line 69: Line 73:
 
$shipId2 = $MissionContext->AddShip('Rosinante', array(6, -7), 45, $playerId);     
 
$shipId2 = $MissionContext->AddShip('Rosinante', array(6, -7), 45, $playerId);     
 
</source>
 
</source>
 +
  
 
==MoveShip()==
 
==MoveShip()==
 
This command moves an existing ship to the target coordinates.
 
This command moves an existing ship to the target coordinates.
 +
<source lang="php">
 +
$MissionContext->MoveShip($shipId, $coordinates)
 +
</source>
  
 
| class="wikitable"
 
| class="wikitable"
Line 90: Line 98:
 
$MissionContext->MoveShip($rosinante);
 
$MissionContext->MoveShip($rosinante);
 
</source>
 
</source>
 +
  
 
==RemoveCounter()==
 
==RemoveCounter()==
 
Removes an existing counter from the UI of the players.
 
Removes an existing counter from the UI of the players.
 +
<source lang="php">
 +
$MissionContext->RemoveCounter($counterId)
 +
</source>
 
{| class="wikitable"
 
{| class="wikitable"
 
|+ Parameters
 
|+ Parameters
Line 108: Line 120:
 
$MissionContext->RemoveCounter('myCounter');
 
$MissionContext->RemoveCounter('myCounter');
 
</source>
 
</source>
 +
  
 
==RemoveMissionObjective()==
 
==RemoveMissionObjective()==
 
Removes an existing mission objective from the UI of the players.
 
Removes an existing mission objective from the UI of the players.
 +
<source lang="php">
 +
$MissionContext->RemoveMissionObjective($objectiveId)
 +
</source>
 +
 
{| class="wikitable"
 
{| class="wikitable"
 
|+ Parameters
 
|+ Parameters
Line 126: Line 143:
 
$MissionContext->RemoveMissionObjective('myObjective');
 
$MissionContext->RemoveMissionObjective('myObjective');
 
</source>
 
</source>
 +
  
 
==RemoveTimer()==
 
==RemoveTimer()==
 
Removes an existing timer, and prevents its expiration.
 
Removes an existing timer, and prevents its expiration.
 +
<source lang="php">
 +
$MissionContext->RemoveTimer($timerId)
 +
</source>
 +
 
{| class="wikitable"
 
{| class="wikitable"
 
|+ Parameters
 
|+ Parameters
Line 144: Line 166:
 
$MissionContext->RemoveTimer('myTimer');
 
$MissionContext->RemoveTimer('myTimer');
 
</source>
 
</source>
 +
  
 
==RemoveTrigger()==
 
==RemoveTrigger()==
 
Removes an existing trigger and prevents it from being triggered.
 
Removes an existing trigger and prevents it from being triggered.
 +
<source lang="php">
 +
$MissionContext->RemoveTrigger($triggerId)
 +
</source>
 +
 
{| class="wikitable"
 
{| class="wikitable"
 
|+ Parameters
 
|+ Parameters
Line 162: Line 189:
 
$MissionContext->RemoveTrigger('myTrigger');
 
$MissionContext->RemoveTrigger('myTrigger');
 
</source>
 
</source>
 +
  
 
==SendSystemMessage()==
 
==SendSystemMessage()==
 
Sends an orange system chat message to all players.
 
Sends an orange system chat message to all players.
 +
<source lang="php">
 +
$MissionContext->SendSystemMessage($messages)
 +
</source>
 +
 
{| class="wikitable"
 
{| class="wikitable"
 
|+ Parameters
 
|+ Parameters
Line 183: Line 215:
 
==SetCounter()==
 
==SetCounter()==
 
Adds or updates a counter visible to all players.
 
Adds or updates a counter visible to all players.
 +
<source lang="php">
 +
$MissionContext->SetCounter($counterId, $value, $counterTexts)
 +
</source>
 +
 
{| class="wikitable"
 
{| class="wikitable"
 
|+ Parameters
 
|+ Parameters
Line 206: Line 242:
 
==SetMissionObjective()==
 
==SetMissionObjective()==
 
Adds or updates a mission objective visible to all players.
 
Adds or updates a mission objective visible to all players.
 +
<source lang="php">
 +
$MissionContext->SetCounter($objectiveId, $objectiveTexts)
 +
</source>
 
{| class="wikitable"
 
{| class="wikitable"
 
|+ Parameters
 
|+ Parameters
Line 227: Line 266:
 
==SetMissionFailed()==
 
==SetMissionFailed()==
 
Ends the mission with a fail.
 
Ends the mission with a fail.
 +
<source lang="php">
 +
$MissionContext->SetMissionFailed($loseTexts)
 +
</source>
 +
 
{| class="wikitable"
 
{| class="wikitable"
 
|+ Parameters
 
|+ Parameters
Line 245: Line 288:
 
==SetMissionSuccessful()==
 
==SetMissionSuccessful()==
 
Ends the mission with a win. Will trigger the loot distribution.
 
Ends the mission with a win. Will trigger the loot distribution.
 +
<source lang="php">
 +
$MissionContext->SetMissionSuccessful($winTexts)
 +
</source>
 +
 
{| class="wikitable"
 
{| class="wikitable"
 
|+ Parameters
 
|+ Parameters
Line 259: Line 306:
 
$MissionContext->SetMissionSuccessful(array('EN' => 'All enemies have been defeated.', 'DE' => 'Alle Feinde wurden zerstört.'));
 
$MissionContext->SetMissionSuccessful(array('EN' => 'All enemies have been defeated.', 'DE' => 'Alle Feinde wurden zerstört.'));
 
</source>
 
</source>
 +
 +
 +
==SetRegion()==
 +
Defines a region on the map. This function has an overload for two region types:
 +
 +
  
 
[[Category:Modding:PVEMissions:mission.php]]
 
[[Category:Modding:PVEMissions:mission.php]]

Revision as of 19:20, 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)
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

Example:

$MissionContext->SetRegion('myCircle', array(10, 12), 7);
$MissionContext->AddInRegionTrigger('myTrigger', 'myCircle', 17);


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:

$MissionContext->AddOutsideRegionTrigger($triggerId, $regionId, $shipId)


AddShip()

This command adds a new ship to the map. The function call looks like this:

$shipId = $MissionContext->AddShip($definitionId, $coordinates, $rotation, $owner)
Parameters
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.
Return Value
Type Description
int The Id of the ship on the map for use in MoveShip command or OnShipKilled trigger for example.

Examples:

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

$MissionContext->MoveShip($shipId, $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. |}

Example:

$rosinante = $MissionContext->AddShip('Rosinante', array(6, -7), 45, '4711');  
$MissionContext->MoveShip($rosinante);


RemoveCounter()

Removes an existing counter from the UI of the players.

$MissionContext->RemoveCounter($counterId)
Parameters
Parameter Type Description
$counterId string The Id of the counter used when creating the counter with the SetCounter command.

Example:

$MissionContext->SetCounter('myCounter', 12, array('EN' => 'This counter has the value 12.));
$MissionContext->RemoveCounter('myCounter');


RemoveMissionObjective()

Removes an existing mission objective from the UI of the players.

$MissionContext->RemoveMissionObjective($objectiveId)
Parameters
Parameter Type Description
$objectiveId string The Id of the objective used when creating the objective with the SetMissionObjective command.

Example:

$MissionContext->SetMissionObjective('myObjective', array('EN' => 'This is an objective'));
$MissionContext->RemoveMissionObjective('myObjective');


RemoveTimer()

Removes an existing timer, and prevents its expiration.

$MissionContext->RemoveTimer($timerId)
Parameters
Parameter Type Description
$timerId string The Id of the timer used when creating the timer with the SetTimer command.

Example:

$MissionContext->SetTimer('myTimer', 12, true, array('EN' => 'This is a visible timer.'));
$MissionContext->RemoveTimer('myTimer');


RemoveTrigger()

Removes an existing trigger and prevents it from being triggered.

$MissionContext->RemoveTrigger($triggerId)
Parameters
Parameter Type Description
$trigger string The Id of the trigger used when creating the trigger with the AddInRegionTrigger or AddOutsideRegionTrigger command.

Example:

$MissionContext->AddInRegionTrigger('myTrigger', 'myCircle', 18);
$MissionContext->RemoveTrigger('myTrigger');


SendSystemMessage()

Sends an orange system chat message to all players.

$MissionContext->SendSystemMessage($messages)
Parameters
Parameter Type Description
$messages array The array of translated messages.

Example:

$MissionContext->SendSystemMessage(array('EN' => 'This is a message', 'DE' => 'Dies ist eine Nachricht'));


SetCounter()

Adds or updates a counter visible to all players.

$MissionContext->SetCounter($counterId, $value, $counterTexts)
Parameters
Parameter Type Description
$counterId string The Id which can be used to call RemoveCounter or SetCounter (in order to update it again) later.
$value integer The (new) value of the counter.
$counterTexts array The array of translated counter descriptions

Example:

$MissionContext->SetCounter('enemyCounter', 20, array('EN' => 'Remaining enemies', 'DE' => 'Verbleibende Feinde.')); //Create
$MissionContext->SetCounter('enemyCounter', $MissionContext->EnemiesShipList->Count, array('EN' => 'Remaining enemies', 'DE' => 'Verbleibende Feinde.')); //Update


SetMissionObjective()

Adds or updates a mission objective visible to all players.

$MissionContext->SetCounter($objectiveId, $objectiveTexts)
Parameters
Parameter Type Description
$objectiveId string The Id which can be used to call RemoveMissionObjective or SetMissionObjective (in order to update it again) later.
$objectiveTexts array The array of translated objective texts.

Example:

$MissionContext->SetMissionObjective('killEnemies', array('EN' => 'Kill the first three enemies', 'DE' => 'Zerstöre die ersten drei Feinde.')); //Create
$MissionContext->SetMissionObjective('killEnemies', array('EN' => 'Kill all remaining enemies', 'DE' => 'Zerstöre alle verbleibenden Feinde.')); //Update


SetMissionFailed()

Ends the mission with a fail.

$MissionContext->SetMissionFailed($loseTexts)
Parameters
Parameter Type Description
$loseTexts array The array of translated texts why the mission was lost.

Example:

$MissionContext->SetMissionFailed(array('EN' => 'The timer has expired.', 'DE' => 'Die Zeit ist abgelaufen.'));


SetMissionSuccessful()

Ends the mission with a win. Will trigger the loot distribution.

$MissionContext->SetMissionSuccessful($winTexts)
Parameters
Parameter Type Description
$winTexts array The array of translated texts why the mission was won.

Example:

$MissionContext->SetMissionSuccessful(array('EN' => 'All enemies have been defeated.', 'DE' => 'Alle Feinde wurden zerstört.'));


SetRegion()

Defines a region on the map. This function has an overload for two region types: