sman1975
Emperor
Hello, I'm working on an historical scenario, based on World War 1 - with several playable civs representing the great and not-so-great powers in Europe.
Obviously, I need to some "alliances" between those civs. I've been using the 'GetScenarioDiploModifier' statement in LUA, but am getting mixed results.
Here is the code:
The "Civ names" (such as AMERICA and UNITEDKINGDOM) are generated like this in the global file:
From looking at the LUA log, here's what I see (over the course of a few game turns):
InitDiplomacy: Adjusting relations for France-Germany
InitDiplomacy: Adjusting relations for UK-Germany
InitDiplomacy: Adjusting relations for Russia-Germany
InitDiplomacy: Adjusting relations for France-Germany
InitDiplomacy: Adjusting relations for UK-Germany
InitDiplomacy: Adjusting relations for Russia-Germany
These specific relationships are about the only ones I'm seeing in the log - representing 3 of the 14 different relationships, and fire frequently during the game. I never see the other relationships fire at all - especially the ones where the return value is negative (i.e. reinforcing a friendly relationship).
Appreciate it if anyone can advise if I'm using these correctly, or if as usual I'm off in left field somewhere...
Thanks!
Obviously, I need to some "alliances" between those civs. I've been using the 'GetScenarioDiploModifier' statement in LUA, but am getting mixed results.
Here is the code:
Code:
--==============================================================================================================================================
--
-- Starting Diplo Relations Functions
GameEvents.GetScenarioDiploModifier1.Add(function(ePlayer1, ePlayer2)
local eCiv1 = Players[ePlayer1]:GetCivilizationType()
local eCiv2 = Players[ePlayer2]:GetCivilizationType()
if ((eCiv1 == FRANCE and eCiv2 == GERMANY) or (eCiv1 == GERMANY and eCiv2 == FRANCE)) then
print("Adjusting relations for France-Germany")
return 100
else
return 0
end
end)
GameEvents.GetScenarioDiploModifier2.Add(function(ePlayer1, ePlayer2)
local eCiv1 = Players[ePlayer1]:GetCivilizationType()
local eCiv2 = Players[ePlayer2]:GetCivilizationType()
if ((eCiv1 == UNITEDKINGDOM and eCiv2 == GERMANY) or (eCiv1 == GERMANY and eCiv2 == UNITEDKINGDOM)) then
print("Adjusting relations for UK-Germany")
return 100
else
return 0
end
end)
GameEvents.GetScenarioDiploModifier3.Add(function(ePlayer1, ePlayer2)
local eCiv1 = Players[ePlayer1]:GetCivilizationType()
local eCiv2 = Players[ePlayer2]:GetCivilizationType()
if ((eCiv1 == RUSSIA and eCiv2 == GERMANY) or (eCiv1 == GERMANY and eCiv2 == RUSSIA)) then
print("Adjusting relations for Russia-Germany")
return 50
else
return 0
end
end)
GameEvents.GetScenarioDiploModifier4.Add(function(ePlayer1, ePlayer2)
local eCiv1 = Players[ePlayer1]:GetCivilizationType()
local eCiv2 = Players[ePlayer2]:GetCivilizationType()
if ((eCiv1 == AUSTRIA and eCiv2 == GERMANY) or (eCiv1 == GERMANY and eCiv2 == AUSTRIA)) then
print("Adjusting relations for Austria-Germany")
return -100
else
return 0
end
end)
GameEvents.GetScenarioDiploModifier5.Add(function(ePlayer1, ePlayer2)
local eCiv1 = Players[ePlayer1]:GetCivilizationType()
local eCiv2 = Players[ePlayer2]:GetCivilizationType()
if ((eCiv1 == AMERICA and eCiv2 == FRANCE) or (eCiv1 == FRANCE and eCiv2 == AMERICA)) then
print("Adjusting relations for America-France")
return -100
else
return 0
end
end)
GameEvents.GetScenarioDiploModifier6.Add(function(ePlayer1, ePlayer2)
local eCiv1 = Players[ePlayer1]:GetCivilizationType()
local eCiv2 = Players[ePlayer2]:GetCivilizationType()
if ((eCiv1 == AMERICA and eCiv2 == UNITEDKINGDOM) or (eCiv1 == UNITEDKINGDOM and eCiv2 == AMERICA)) then
print("Adjusting relations for America-UK")
return -100
else
return 0
end
end)
GameEvents.GetScenarioDiploModifier7.Add(function(ePlayer1, ePlayer2)
local eCiv1 = Players[ePlayer1]:GetCivilizationType()
local eCiv2 = Players[ePlayer2]:GetCivilizationType()
if ((eCiv1 == AUSTRIA and eCiv2 == SERBIA) or (eCiv1 == SERBIA and eCiv2 == AUSTRIA)) then
print("Adjusting relations for Austria-Serbia")
return 100
else
return 0
end
end)
GameEvents.GetScenarioDiploModifier8.Add(function(ePlayer1, ePlayer2)
local eCiv1 = Players[ePlayer1]:GetCivilizationType()
local eCiv2 = Players[ePlayer2]:GetCivilizationType()
if ((eCiv1 == ITALY and eCiv2 == GERMANY) or (eCiv1 == GERMANY and eCiv2 == ITALY)) then
print("Adjusting relations for Italy-Germany")
return -25
else
return 0
end
end)
GameEvents.GetScenarioDiploModifier9.Add(function(ePlayer1, ePlayer2)
local eCiv1 = Players[ePlayer1]:GetCivilizationType()
local eCiv2 = Players[ePlayer2]:GetCivilizationType()
if ((eCiv1 == BULGARIA and eCiv2 == OTTOMANS) or (eCiv1 == OTTOMANS and eCiv2 == BULGARIA)) then
print("Adjusting relations for Ottoman-Bulgaria")
return 25
else
return 0
end
end)
GameEvents.GetScenarioDiploModifier10.Add(function(ePlayer1, ePlayer2)
local eCiv1 = Players[ePlayer1]:GetCivilizationType()
local eCiv2 = Players[ePlayer2]:GetCivilizationType()
if ((eCiv1 == ROMANIA and eCiv2 == OTTOMANS) or (eCiv1 == OTTOMANS and eCiv2 == ROMANIA)) then
print("Adjusting relations for Ottoman-Romania")
return 25
else
return 0
end
end)
GameEvents.GetScenarioDiploModifier11.Add(function(ePlayer1, ePlayer2)
local eCiv1 = Players[ePlayer1]:GetCivilizationType()
local eCiv2 = Players[ePlayer2]:GetCivilizationType()
if ((eCiv1 == GREECE and eCiv2 == OTTOMANS) or (eCiv1 == OTTOMANS and eCiv2 == GREECE)) then
print("Adjusting relations for Ottoman-Greece")
return 25
else
return 0
end
end)
GameEvents.GetScenarioDiploModifier12.Add(function(ePlayer1, ePlayer2)
local eCiv1 = Players[ePlayer1]:GetCivilizationType()
local eCiv2 = Players[ePlayer2]:GetCivilizationType()
if ((eCiv1 == UNITEDKINGDOM and eCiv2 == OTTOMANS) or (eCiv1 == OTTOMANS and eCiv2 == UNITEDKINGDOM)) then
print("Adjusting relations for Ottoman-UK")
return 50
else
return 0
end
end)
GameEvents.GetScenarioDiploModifier13.Add(function(ePlayer1, ePlayer2)
local eCiv1 = Players[ePlayer1]:GetCivilizationType()
local eCiv2 = Players[ePlayer2]:GetCivilizationType()
if ((eCiv1 == AUSTRIA and eCiv2 == RUSSIA) or (eCiv1 == RUSSIA and eCiv2 == AUSTRIA)) then
print("Adjusting relations for Austria-Russia")
return 100
else
return 0
end
end)
GameEvents.GetScenarioDiploModifier14.Add(function(ePlayer1, ePlayer2)
local eCiv1 = Players[ePlayer1]:GetCivilizationType()
local eCiv2 = Players[ePlayer2]:GetCivilizationType()
if ((eCiv1 == FRANCE and eCiv2 == UNITEDKINGDOM) or (eCiv1 == UNITEDKINGDOM and eCiv2 == FRANCE)) then
print("Adjusting relations for France-UK")
return -100
else
return 0
end
end)
The "Civ names" (such as AMERICA and UNITEDKINGDOM) are generated like this in the global file:
Code:
AMERICA = GameInfoTypes["CIVILIZATION_GW_AMERICA"]
UNITEDKINGDOM = GameInfoTypes["CIVILIZATION_GW_ENGLAND"]
From looking at the LUA log, here's what I see (over the course of a few game turns):
InitDiplomacy: Adjusting relations for France-Germany
InitDiplomacy: Adjusting relations for UK-Germany
InitDiplomacy: Adjusting relations for Russia-Germany
InitDiplomacy: Adjusting relations for France-Germany
InitDiplomacy: Adjusting relations for UK-Germany
InitDiplomacy: Adjusting relations for Russia-Germany
These specific relationships are about the only ones I'm seeing in the log - representing 3 of the 14 different relationships, and fire frequently during the game. I never see the other relationships fire at all - especially the ones where the return value is negative (i.e. reinforcing a friendly relationship).
Appreciate it if anyone can advise if I'm using these correctly, or if as usual I'm off in left field somewhere...
Thanks!