AW Arcaeca
Deus Vult
I'm looking for a way to give a new civ +2 production and +1 gold in all cities with 10 or more population after electronics. And almost all of that can be done with just XML... except for the part about needing 10 population, as far as I know.
Given that, I'm looking for a way to give a dummy building to those 10-pop cities using as little Lua as possible, though it looks like I'll need some.
So would this code work at all?
What I'm guessing is the main problem is the line that says
since doesn't that function, IIRC, only work with a team, not a player?
Given that, I'm looking for a way to give a dummy building to those 10-pop cities using as little Lua as possible, though it looks like I'll need some.
So would this code work at all?
Code:
function NewCivProductionBonus
local pPlayer = players[playerID]
if (pPlayer:IsAlive()) and (pPlayer:GetCivilization() == GameInfoTypes.CIVILIZATION_THIS_CIV) then
local pCity = pPlayer:GetCities()
local pCityPop = pCity:GetPopulation()
if (pCityPop >= 10) and (pPlayer:IsHasTech(GameInfoTypes.TECH_ELECTRONICS)) then
pCity:SetNumRealBuilding(GameInfoTypes.BUILDING_THIS_CIV_BONUS, 1)
else
pCity:SetNumRealBuilding(GameInfoTypes.BUILDING_THIS_CIV_BONUS, 0)
end
end
Events.ActivePlayerTurnStart.Add(NewCivProductionBonus)
Code:
if (pCityPop >= 10) and (pPlayer:IsHasTech(GameInfoTypes.TECH_ELECTRONICS)) then