The code seems to work now, but I noticed it doesn't seem to add the dummy buildings. I followed what you said, so did I messed up again?
I tried to build the building normally, by not adding it from IGE, so I'm not sure what went wrong.
I tried to build the building normally, by not adding it from IGE, so I'm not sure what went wrong.
Code:
local iSmeltingPit = GameInfoTypes.BUILDING_SMELTING_PIT
local iSmeltDummy = GameInfoTypes.BUILDING_SMELTING_DUMMY
local iCiv = GameInfoTypes.CIVILIZATION_DECEPTICON
function SmeltingPitExtraProduction(PlayerID)
local pPlayer = Players[PlayerID]
if pPlayer:GetCivilizationType() == iCiv then
for pCity in pPlayer:Cities() do
local iOriginalCityOwner = pCity:GetOriginalOwner()
if iOriginalCityOwner ~= PlayerID then
print("This city appears to captured by the Decepticons!")
if (pCity:GetNumBuilding(iSmeltingPit) > 0) then
print("It appears that there's Smelting Pit building in this city!")
pCity:SetNumRealBuilding(iSmeltDummy, 1)
print("A Smetling Pit Dummy Building has been added!")
end
end
end
end
end
GameEvents.PlayerDoTurn.Add(SmeltingPitExtraProduction)