SerialEventCityPopulationChanged

From Civilization Modding Wiki
Revision as of 08:52, 14 February 2012 by Killmeplease (talk | contribs)
Jump to navigationJump to search

Description

Fired when a population of a particular city was changed.

Description on the official wiki is wrong: event is fired for both human player and AIs, for discovered and yet not discovered cities as well.

Example

 function OnCityPopulationChanged(x, y, newPop)
   local pPlot = Map.GetPlot(ToGridFromHex(x, y))
   local pCity = pPlot:GetPlotCity()
   local pPlayer = Players[pCity:GetOwner()]
   DoSomething(pCity)
 end
 Events.SerialEventCityPopulationChanged.Add(OnCityPopulationChanged)