Hi
I'm working on a mod where a wonder uses the "FreeBuilding" xml to give a lesser version of itself to all cities but this means it also gives it to the city the wonder is built in. I would like to use a lua script to remove the lesser version from the city the wonder is but have no idea how to as I'm very new to lua.
The script that I tried to use:
function GreaterRunestoneCheck(playerID)
local player = Players[playerID]
for city in player:Cities() do
if city:GetNumRealBuilding(GameInfoTypes["BUILDING_BIGRUNESTONE"]) > 0 then
ˇ city_object:SetNumRealBuilding(BUILDING_SMALLRUNESTONE, 0)
end
end
end
GameEvents.PlayerDoTurn.Add(GreaterRunestoneCheck)
I have also tried this one,
city:SetNumRealBuilding(GameInfoTypes["BUILDING_SMALLRUNESTONE"], 0)
also does the freebuilding xml give the building back to the city if you remove it? perhaps it didn't work because of that?
Thanks in advance
I'm working on a mod where a wonder uses the "FreeBuilding" xml to give a lesser version of itself to all cities but this means it also gives it to the city the wonder is built in. I would like to use a lua script to remove the lesser version from the city the wonder is but have no idea how to as I'm very new to lua.
The script that I tried to use:
function GreaterRunestoneCheck(playerID)
local player = Players[playerID]
for city in player:Cities() do
if city:GetNumRealBuilding(GameInfoTypes["BUILDING_BIGRUNESTONE"]) > 0 then
ˇ city_object:SetNumRealBuilding(BUILDING_SMALLRUNESTONE, 0)
end
end
end
GameEvents.PlayerDoTurn.Add(GreaterRunestoneCheck)
I have also tried this one,
city:SetNumRealBuilding(GameInfoTypes["BUILDING_SMALLRUNESTONE"], 0)
also does the freebuilding xml give the building back to the city if you remove it? perhaps it didn't work because of that?
Thanks in advance