I'm trying to give Austria additional votes in WC for each City State that they have annexed (or conquered), using a dummy building with <ExtraLeagueVotes>1</ExtraLeagueVotes> that i insert into the city with the following Lua script:
The script seems to work fine but there is a problem with the Diplo-Annex function. When Austria Diplo-Annexes a City State, the Original Owner ID of that City State is changed to the Austrian ID (I can see this with the Live Tuner), so the pCity:GetOriginalOwner() method will refer to Austria, and I cannot tell the difference between a Diplo-Annexed city and a "real Austrian" city. If i conquer the City State outright, everything works fine.
Anyone knows a good workaround or other way of doing this?
Code:
----------------------------------------------------------------------------------------------------------------------------
--City State vote bonus [AUSTRIA]
-------------------------------------------------------------------------------------------------------------------------
local CSVoteBuildingID = GameInfoTypes["BUILDING_AUSTRIA_CS_VOTE"]
local RenaissanceEraID = GameInfoTypes["ERA_RENAISSANCE"]
local IndustrialEraID = GameInfoTypes["ERA_INDUSTRIAL"]
local ModernEraID = GameInfoTypes["ERA_MODERN"]
local AtomicEraID = GameInfoTypes["ERA_POSTMODERN"]
local FutureEraID = GameInfoTypes["ERA_FUTURE"]
function CityStateVoteBonus(iPlayer)
local pPlayer = Players[iPlayer]
if pPlayer:IsAlive() and pPlayer:GetCivilizationType() == GameInfoTypes["CIVILIZATION_AUSTRIA"] then
local GameEraID = Game.GetCurrentEra()
local pCapital = pPlayer:GetCapitalCity()
local iNumExtraVotes = 0
local iTotExtraVotes = 0
if GameEraID == RenaissanceEraID then iNumExtraVotes = 1 end
if GameEraID == IndustrialEraID then iNumExtraVotes = 1.5 end
if GameEraID == ModernEraID then iNumExtraVotes = 2 end
if GameEraID == AtomicEraID then iNumExtraVotes = 3 end
if GameEraID == FutureEraID then iNumExtraVotes = 4 end
for pCity in pPlayer:Cities() do
local OriginalOwner = Players[pCity:GetOriginalOwner()]
if OriginalOwner:IsMinorCiv() then
iTotExtraVotes = iTotExtraVotes + iNumExtraVotes
end
end
iTotExtraVotes = math.ceil(iTotExtraVotes - 0.1) --rounding fragments up
pCapital:SetNumRealBuilding(CSVoteBuildingID, iTotExtraVotes)
end
end
GameEvents.PlayerDoTurn.Add(CityStateVoteBonus)
The script seems to work fine but there is a problem with the Diplo-Annex function. When Austria Diplo-Annexes a City State, the Original Owner ID of that City State is changed to the Austrian ID (I can see this with the Live Tuner), so the pCity:GetOriginalOwner() method will refer to Austria, and I cannot tell the difference between a Diplo-Annexed city and a "real Austrian" city. If i conquer the City State outright, everything works fine.
Anyone knows a good workaround or other way of doing this?