====== 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
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);
From OP2 _Player
enum MoraleLevels MoraleLevel() const;
From Enums.h
enum MoraleLevels
{
moraleGreat = 0,
moraleGood,
moraleOK,
moralePoor,
moraleRotten
};
===== 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
int InitProc()
{
TethysGame::FreeMoraleLevel(-1);
if (TethysGame::UsesMorale() == 0)
{
TethysGame::ForceMoraleGood(-1);
}
}
----
- //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]]//