1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

City Pacification Time

Discussion in 'Civ4 - Modding Tutorials & Reference' started by Geomec, Jul 26, 2020.

  1. Geomec

    Geomec Chieftain

    Joined:
    Oct 19, 2015
    Messages:
    2
    I was hoping someone could tell me what controls the amount of turns it takes to pacify a conquered city. U would like to be able to change the variables to increase or decrease it depending on the scenarios.
     
  2. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    775
    Location:
    Germany
    From the acquireCity function CvCity.cpp (edited for readability - without much success):
    Code:
    iTeamCulturePercent = pNewCity->calculateTeamCulturePercent(getTeam());
    if (iTeamCulturePercent < GC.getDefineINT("OCCUPATION_CULTURE_PERCENT_THRESHOLD"))
    {
        pNewCity->changeOccupationTimer(
         (
          (GC.getDefineINT("BASE_OCCUPATION_TURNS")
           + (pNewCity->getPopulation() * GC.getDefineINT("OCCUPATION_TURNS_POPULATION_PERCENT")) / 100)
         )
         * (100 - iTeamCulturePercent))
         / 100);
    }
    The city is named "pNewCity" because, technically, a new city object is created upon conquest. To be clear, this code can only be changed by recompiling the DLL. The constants referenced by getDefineINT are easy to change though in Assets\XML\GlobalDefines.xml. CvCity::changeOccupationTimer and CvCity::setOccupation timer are exposed to Python, and there are callbacks onCityAcquired and onCityAcquiredAndKept. So one could probably set the occupation timer arbitrarily through Python code.
     

Share This Page