op2_sdk:morale

no way to compare when less than two revisions

Differences

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


Previous revision
op2_sdk:morale [2016/10/12 21:32] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Morale ======
  
 +''Reviewed For: SDK 2.1''
 +
 +Colony morale can be set as either fixed or variable individually per colony. If creating a multiplayer scenario, check to see if the players' desire steady morale and set appropriately. For land rush games, consider setting morale as fixed until after the player establishes a base.
 +
 +===== Morale Table =====
 +
 +^Level^Value^MoraleLevels Enum^
 +|Excellent (Great)|99|0|
 +|Good (OK)        |75|1|
 +|Fair             |50|2|
 +|Poor             |25|3|
 +|Terrible (Rotten)|0|4|
 +
 +===== Useful Functions =====
 +
 +From TethysGame
 +<code cpp>
 +static int __fastcall UsesMorale();
 +
 +static void __fastcall ForceMoraleGreat(int playerNum);
 +static void __fastcall ForceMoraleGood(int playerNum);
 +static void __fastcall ForceMoraleOK(int playerNum);
 +static void __fastcall ForceMoralePoor(int playerNum);
 +static void __fastcall ForceMoraleRotten(int playerNum);
 +static void __fastcall FreeMoraleLevel(int playerNum);
 +</code>
 +
 +From OP2 _Player
 +<code cpp>
 +enum MoraleLevels MoraleLevel() const;
 +</code>
 +
 +From Enums.h
 +<code cpp>
 +enum MoraleLevels 
 +{
 +    moraleGreat = 0,
 +    moraleGood,
 +    moraleOK,
 +    moralePoor,
 +    moraleRotten
 +};
 +</code>
 +
 +===== Noted Bugs =====
 +
 +Calling ForceMoraleX functions after tick 0 will cause a "Cheated Game!" message to appear. 
 +
 +ForceMoraleX is buggy if playerNum is not -1. You may need to call the function twice for the correct effect. FreeMoraleLevel is not affected by this bug.
 +
 +
 +===== Sample Code =====
 +
 +Check for Steady Morale in Multiplayer
 +<code cpp>
 +int InitProc()
 +{
 +    TethysGame::FreeMoraleLevel(-1);
 +    
 +    if (TethysGame::UsesMorale() == 0)
 +    {
 + TethysGame::ForceMoraleGood(-1);
 +    }
 +}
 +</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/morale.txt
  • Last modified: 2016/10/12 21:32
  • by 127.0.0.1