Re: Making a scenario using "Regicide" type of victory
Posted: 14 Jul 2018, 19:02
Heh, nevermind, it's not really important)
The only one active forum about Empire Earth II
https://forum.ee2.eu/
To prevent your previous error, there is a function called: IsPlayerHumanControlled().
So it could look like this to prevent debug message displaying:The " ! " before function name, means to execute it when it's FALSE.Code: Select all
if(!IsPlayerHumanControlled(US_ARMY)){ ForceSurrenderOffer(..., ...); }
So same effect as:Code: Select all
if(IsPlayerHumanControlled(US_ARMY)){ //do nothing } else { ForceSurrenderOffer(..., ...); }
Code: Select all
RULE ruleObj_Korean_Peninsula2 ONESHOT
if (!DoesUnitExist( "tx_King_Korean_1" )
)
then KingDeadAction2
END_RULE
ACTION KingDeadAction2
SCRIPT WORLD
ForceSurrenderOffer(2, 1);
END_SCRIPT
END_ACTION
Code: Select all
RULE ruleObj_Korean_Peninsula2 ONESHOT
if (!DoesUnitExist( "tx_King_Korean_1" )
)
then KingDeadAction2
END_RULE
ACTION KingDeadAction2
SCRIPT WORLD
if(!IsPlayerHumanControlled(2)){
ForceSurrenderOffer(2, 1);
}
else {
//Other stuff to kill this player. CreateGroup, etc.
}
END_SCRIPT
END_ACTION
Code: Select all
RULE ruleObj_Korean_Peninsula2 ONESHOT
if (!DoesUnitExist( "tx_King_Korean_1" )
)
then KingDeadAction2
END_RULE
ACTION KingDeadAction2
SCRIPT WORLD
if(!IsPlayerHumanControlled(2)){
ForceSurrenderOffer(2, 1);
}
else {
CreateNamedGroup("Group_Korea_1");
AddUnitsByTypeToGroup("Group_Korea_1", "Everything", 2, kPlayerMode_Self, NULL);
AddUnitsByAttributeToGroup("Group_Korea_1", "Everything", 2, kPlayerMode_Self, NULL);
if(NumUnitsInGroup("Group_Korea_1") > 0){
SelectGroupForPlayer("Group_Korea_1", 2);
KillSelection();
ClearSelection();
}
}
END_SCRIPT
END_ACTION
Was AI Diplomacy Enabled in Initialization?// void ForceSurrenderOffer(int in_iPlayerAI, int in_iPlayerHuman)
// force the AI in_iPlayerAI to surrender to in_iPlayerHuman
// YOU HAVE TO ENABLE STRATEGIC LEVEL DIPLOMACY FOR THIS PLAYER, OR YOU
// WILL GET A WEIRD CRASH WITH A NON OBVIOUS ERROR MESSAGE:
// DO THIS FIRST: SetAIDiplomacyEnabled()
ForceSurrenderOffer(2, 1);