Uighur_Caesar
Comandante en Jefe
I'm trying to make a UB that cost 1 gold for every heretic in the city and if no heretics are present it yields +2 faith. I'm not really sure if there's an easy way to detect heretics so I've tried this:
The Lua Log doesn't give me any errors but the dummies that subtract 1 gold aren't created. Are there any better ways of doing this or are there just mistakes with this code?
Code:
local SaudiID = GameInfoTypes["CIVILIZATION_UC_SAUDI"]
function Heretics(playerID)
local player = Players[playerID]
if (player:IsEverAlive() and player:GetCivilizationType() ~= SaudiID) then
local heretics = player:GetReligionCreatedByPlayer()
end
return Heretics
end
function ShariaHeretics(playerID, cityID)
local player = Players[playerID]
if (player:IsAlive() and player:GetCivilizationType() == SaudiID) then
local city = player:GetCityByID(cityID)
for city in player:Cities() do
if city:IsHasBuilding(sharia) then
local numHeretics = city:GetNumFollowers(heretics)
local hereticCost = GameInfoTypes["BUILDING_UC_HERETIC_COST"]
city:SetNumRealBuilding(hereticCost, numHeretics)
end
end
end
end
GameEvents.PlayerDoTurn.Add(ShariaHeretics)
The Lua Log doesn't give me any errors but the dummies that subtract 1 gold aren't created. Are there any better ways of doing this or are there just mistakes with this code?