LeeS
Imperator
I wrote a function to make all major players declare war on each other once they meet. I had understood that there were "issues" involved in trying to do this forcified war condition, but it seemed to work without a hitch. So Am I missing something fundamental that is about to bite me later ?
Code:
function EveryoneHatesEveryone(iPlayer)
local pPlayer = Players[iPlayer]
if not pPlayer:IsAlive() then return end
local pPlayersTeam = pPlayer:GetTeam()
for iMajPlayer = 0, GameDefines.MAX_MAJOR_CIVS - 1 do
if Players[iMajPlayer] ~= pPlayer then
local OtherPlayer = Players[iMajPlayer]
if OtherPlayer:IsAlive() then
local OtherPlayerTeam = OtherPlayer:GetTeam()
if Teams[pPlayersTeam]:IsHasMet(OtherPlayerTeam) then
if Teams[pPlayersTeam]:CanDeclareWar(OtherPlayerTeam) then
Teams[pPlayersTeam]:DeclareWar(OtherPlayerTeam)
Teams[pPlayersTeam]:SetPermanentWarPeace(OtherPlayerTeam, true)
end
end
end
end
end
end
GameEvents.PlayerDoTurn.Add(EveryoneHatesEveryone)