Differences

This shows you the differences between two versions of the page.

Link to this comparison view

op2_sdk:victory_and_defeat_conditions [2016/10/12 21:32] (current)
Line 1: Line 1:
 +====== Victory and Defeat Conditions ======
  
 +''​Reviewed For: SDK 2.1''​
 +
 +Outpost 2 scenarios can contain multiple conditions to stipulate either victory or defeat. These conditions can be dynamically enabled or disabled as game play progresses to shift a scenario'​s focus.
 +
 +Victory and defeat triggers require a hook to a separate trigger that tracks if a specific event has occurred. ​
 +
 +For victory conditions, the text placed in the variable missionObjective will be displayed on the Mission Objectives screen in game.
 +
 +For non-multiplayer games, Victory and Defeat condition triggers are not automatically saved and loaded by Outpost 2. These triggers must be saved by placing them in a custom structure with all other data requiring tracking between saving and loading the scenario. See the save regions section for details.
 +
 +For multiplayer games, it is not recommended to create failure conditions. When a player loses a multiplayer game due to a failure trigger, they will be immediately ejected from the games and all other players will receive a message saying the losing player is having connection problems that pauses the game. To allow losing players to continue watching the game and keep from pausing the game for other'​s when they lose, do not set failure conditions in multiplayer games.
 +
 +Victory and defeat conditions should be hooked to triggers in the InitProc() function. Victory or defeat conditions that cannot be covered by the established triggers alone can be implemented through the AIProc() function. ​
 +
 +===== Useful Functions =====
 +
 +//From Triggers.h//​
 +<code cpp>
 +Trigger __fastcall CreateVictoryCondition(
 +    int bEnabled, int bOneShot, Trigger&​ victoryTrigger,​ const char* missionObjective);​
 +
 +Trigger __fastcall CreateFailureCondition(
 +    int bEnabled, int bOneShot, Trigger&​ failureTrigger,​ const char* failureCondition);​
 +</​code>​
 +
 +//From OP2Helper.cpp//​
 +<code cpp>
 +void CreateStarshipVictoryCondition()
 +void CreateLastOneStandingVictoryCondition()
 +void CreateNoCommandCenterFailureCondition(int playerNum)
 +</​code>​
 +
 +
 +===== Unused Variables =====
 +
 +  * For the functions ''​CreateVictoryCondition''​ and ''​CreateFailureCondition'',​ the variable ''​int bOneShot''​ is not used and should be set to 0. 
 +  * For the function ''​CreateFailureCondition'',​ the variable ''​const char* failureCondition''​ is not used and should be set to ""​.
 +
 +===== Sample Code =====
 +
 +Set space race victory condition for a colony game
 +<code cpp>
 +int InitProc()
 +{
 +    ​
 +}
 +</​code>​
 +
 +---- 
 + - //Go Back to [[op2_sdk:​programming_scenario_dlls|Programming a Scenario]]//​\\
 + - //Go Back to [[op2_sdk:​software_development_kit_sdk|Outpost 2 Mapmaking]]//​\\
 + - //Go Back to [[outpost_2:​outpost_2|Outpost 2 Main page]]//\\
 + - //Go Back to [[http://​wiki.outpost2.net/​doku.php?​id=start|Wiki Home Page]]//
  • op2_sdk/victory_and_defeat_conditions.txt
  • Last modified: 2016/10/12 21:32
  • (external edit)