OnCityPopulationChanged event fires for training units in GS ?!

Discussion in 'Civ6 - Creation & Customization' started by Serp, Apr 22, 2019.

  1. Serp

    Serp King

    Joined:
    Apr 1, 2015
    Messages:
    650
    Hi,

    it seems the event CityPopulationChanged is fired everytime a new unit is created in Gathering Storm (at least if the city has at least 2 citizen). This does not happen for base game nor Rise and Fall.

    I don't own GS, so I can not test further, but maybe someone knows what and why this was changed? How to know if it really was a population change in the city, versus a trained unit?
     
  2. Serp

    Serp King

    Joined:
    Apr 1, 2015
    Messages:
    650
    Advice from "FearSunn": Save the latest population and only recognize the event, if the pop amount changed for this city of this player.
    Its a workaround, but it works.
     
  3. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    7,241
    Location:
    Illinois, USA
    Can confirm this bug seems to be real for both Events.CityPopulationChanged and GameEvents.OnCityPopulationChanged

    GameEvents.OnCityPopulationChanged will show a value of '0' for the iPopulationChange argument when it fires under this condition, tho.

    GameEvents.OnCityPopulationChanged(iPlayer, iCityID, iPopulationChange)
    Events.CityPopulationChanged(iPlayer, iCityId, iTotalCityPopulation)

    So even with this bug GameEvents.OnCityPopulationChanged should be safe to use when sorting for whether the 3rd argument is recieving a value of '0' from the gamecore.
     
    Serp likes this.

Share This Page