thread's name. How do I raze cities founded by the player?
Here's my code:
And here are the funny results:
plot:SetImprovementType(0)
others:
Here's my code:
Code:
function tcm_Raze(playerID)
local player = Players[playerID]
if player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_TCM_CIV"] then
for city in player:Cities() do
if city:IsHasBuilding(GameInfoTypes["BUILDING_TCM_RAZE"]) then
local plot = city:Plot()
city:SetFood(-99)
city:FoodConsumption(true, 100)
if city:GetPopulation() <= 0 then
-- Failed attempts bellow:
-- plot:SetImprovementType(-1)
-- plot:SetImprovementType(0)
-- plot:SetFeatureType(-1)
-- player:Raze(city)
end
city:ChangeResistanceTurns(99)
city:ChangePopulation(-1)
end
end
end
end
GameEvents.PlayerDoTurn.Add(tcm_Raze)
And here are the funny results:
plot:SetImprovementType(0)
Spoiler :

others:
Spoiler :
