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
Trigger __fastcall CreateVictoryCondition( int bEnabled, int bOneShot, Trigger& victoryTrigger, const char* missionObjective); Trigger __fastcall CreateFailureCondition( int bEnabled, int bOneShot, Trigger& failureTrigger, const char* failureCondition);
From OP2Helper.cpp
void CreateStarshipVictoryCondition() void CreateLastOneStandingVictoryCondition() void CreateNoCommandCenterFailureCondition(int playerNum)
Unused Variables
- For the functions
CreateVictoryCondition
andCreateFailureCondition
, the variableint bOneShot
is not used and should be set to 0.- For the function
CreateFailureCondition
, the variableconst char* failureCondition
is not used and should be set to “”.
Sample Code
Set space race victory condition for a colony game
int InitProc() { }
- Go Back to Programming a Scenario
- Go Back to Outpost 2 Mapmaking
- Go Back to Outpost 2 Main page
- Go Back to Wiki Home Page