Hi, I need some help on my UA which is spawning a free settler in the capital every time you advance to a new era. However my code seems to give a settler everytime a player in the game advances an era, and not just my civ. Any help? Code below...
Code:
function Cou_GetSettlerFromEra(playerID)
local player = Players[playerID]
if (player:IsAlive() and player:GetCivilizationType() == civilisationID) then
for city in player:Cities() do
if city:IsCapital() then
local plot = city:Plot()
local plotX = plot:GetX()
local plotY = plot:GetY()
player:InitUnit(GameInfoTypes["UNIT_SETTLER"], plotX, plotY)
print("grox settler")
end
end
end
end
Events.SerialEventEraChanged.Add(Cou_GetSettlerFromEra)