Hello, I've been trying to create my own mod but I simply can't find a way to change city yield dynamically. What I want to achieve is to make a city give 1 faith per 2 population. I had something like this that worked:
function FaithPerPop(pPlayer)
print("Function Loaded")
for pCity in pPlayer:Cities() do
local pPop = pCity:GetPopulation();
if (pPop >= 2) then
print("Pop is bigger or equal 2")
local x = pCity
lot():GetX();
local y = pCity
lot():GetY();
Game.SetPlotExtraYield(x, y, YieldTypes.YIELD_FAITH, pPop/2)
end
end
end
Problem here is that it kept increasing the faith on the city tile by pPop/2 every single turn. Also I am not sure this is the best way to do this since there is no indication that the faith changed because the civs unique trait. Any ideas how to do this?
function FaithPerPop(pPlayer)
print("Function Loaded")
for pCity in pPlayer:Cities() do
local pPop = pCity:GetPopulation();
if (pPop >= 2) then
print("Pop is bigger or equal 2")
local x = pCity

local y = pCity

Game.SetPlotExtraYield(x, y, YieldTypes.YIELD_FAITH, pPop/2)
end
end
end
Problem here is that it kept increasing the faith on the city tile by pPop/2 every single turn. Also I am not sure this is the best way to do this since there is no indication that the faith changed because the civs unique trait. Any ideas how to do this?
