Mezzzzz
Chieftain
Ok, I've been naive. The solution I was sure would work, did not. So I regret if anyone re-used the content of my original post and felt disappointed after trying it :s
Even though, I still think the code from Danmacsch and DarkScythe is a good base so this is what I've so far;
The purpose is having a xml dummy building activated when both condition resource_horse and improvement_pasture are validated on any tile worked by a city.
I'd appreciate if someone could tell me what am I doing wrong exactly. Thanks!
Even though, I still think the code from Danmacsch and DarkScythe is a good base so this is what I've so far;
Code:
function Horsespasturebonus(playerID)
local player = Players[playerID]
if player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_MYCIVILIZATION"] and player:IsAlive() and not player:IsMinorCiv() and not player:IsBarbarian() then
for city in player:Cities() do
if plot:GetResourceType() == GameInfoTypes["RESOURCE_HORSE"] then
if plot:GetImprovementType() == GameInfoTypes["IMPROVEMENT_PASTURE"] then
city:SetNumRealBuilding(GameInfoTypes["BUILDING_IMPROVED_PASTURE"], 1)
else
if plot:GetImprovementType() ~= GameInfoTypes["IMPROVEMENT_PASTURE"] then
city:SetNumRealBuilding(GameInfoTypes["BUILDING_IMPROVED_PASTURE"], 0)
end
end
end
end
end
GameEvents.PlayerDoTurn.Add(Horsespasturebonus)
The purpose is having a xml dummy building activated when both condition resource_horse and improvement_pasture are validated on any tile worked by a city.
I'd appreciate if someone could tell me what am I doing wrong exactly. Thanks!