I have been trying to create a "safety net" mod that would provide money if a human controlled nation's money fell below 10. I created the mod in the Events_Plugin.BSF file based on the example wiki, but it never seems to execute. I've set the trigger to the absurdly high "1000 money" for testing, so it should trigger in the first turns, but nothing happens.
The code is here:
Code: Select all
FUNCTION Event_EntryPoint()
{
// Define safety net events for money, metal and manpower
EventCustom_SafetyMoney();
}
//// Human Safety Net Functions ////
// Turn to start looking for event (turn 2, game is zero based)
#define EVTCUSTOM_SAFETY_TURNSTART 0
// Amount to trigger the event
#define EVTCUSTOM_SAFEMONEY_CHECK 1000
// Amount of safety net
#define EVTCUSTOM_SAFEMONEY_AMOUNT 5000
FUNCTION EventCustom_SafetyMoney()
{
int facCount;
int facIndex;
int factionID;
if (GetTurn() >= EVTCUSTOM_SAFETY_TURNSTART)
{
// Loop Around Factions to find the Humans
facCount = GetNumFactions();
for (facIndex = 0; facIndex < facCount; facIndex++)
{
if (Faction_AI_IsHumanPlayer(factionID) == TRUE )
{
if (Faction_GetResource(factionID, gResourceMoney) < EVTCUSTOM_SAFEMONEY_CHECK)
{
Faction_AddResource(factionID, gResourceMoney, EVTCUSTOM_SAFEMONEY_AMOUNT);
Message_Faction_ChangeResourcePrivate(factionID, Faction_Politic_SeatOfPower(factionID), EVTCUSTOM_SAFEMONEY_AMOUNT, MSG_IMP_TOP, "IDS_MSG_EVENT_SAFEMONEY");
}
}
}
}
}
Any thoughts?? (I've also changed all the if clauses to "if (TRUE == TRUE)", but the whole script never executes.
Bob