Is there an easier way to make every province a certain pop size?

  • We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

YTnuBF

Captain
65 Badges
Apr 5, 2014
354
181
  • Victoria 2: A House Divided
  • Heir to the Throne
  • Magicka
  • Majesty 2
  • March of the Eagles
  • Cities in Motion 2
  • Victoria: Revolutions
  • Semper Fi
  • Sengoku
  • Sword of the Stars II
  • Europa Universalis IV: Res Publica
  • Victoria 2: Heart of Darkness
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Knights of Honor
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Hearts of Iron III: Their Finest Hour
  • Crusader Kings II: Sword of Islam
  • Darkest Hour
  • Europa Universalis IV: Art of War
  • Hearts of Iron III
  • For the Motherland
  • For The Glory
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Divine Wind
  • Europa Universalis III
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Crusader Kings III
  • Victoria 2
  • Europa Universalis IV
  • Crusader Kings II: Conclave
  • Europa Universalis III: Collection
  • Cities: Skylines
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
You can make it an event that is run at game start.

I wrote an event to do this and tested that it works.

You can add this event to any existing event text file or create a new event text file.
If you create a new event text file you need to define a namespace at the start of the new event text file.

Then make it run at game start by editing the file \\ImperatorRome\game\common\on_action\00_specific_from_code.txt .
In that file go to the on_game_initialized = { } code block and scroll to the events = { } block within it starting at line 1985.
You'll see other event names already within it so just add a new line at the end with the event name makeupanamehere.1 .

The name of the event here is just an example and you can change it to fit some other event naming scheme

Then the events block in \\ImperatorRome\game\common\on_action\00_specific_from_code.txt at the end of on_game_initialized will look like this :

Code:
    events = {
        syr_flavour.1
        flavor_sel.1
        startup_events.1
        startup_events.2
        startup_events.7
        tutorial.1
        dhe_body.4
        dhe_dde_pyrrhus.24
        flavor_egy.8
        dhe_mithridates.1
        dhe_heraclea_pontica.1
        makeupanamehere.1
    }

------------------------------------------------------
Here below is the code of the actual event itself :

Code:
namespace = makeupanamehere # you can remove this line if you have an existing event naming scheme

makeupanamehere.1 = {
    type = country_event

    hidden = yes

    trigger = {
        has_land = yes
        tag = ROM
        NOR = {
            tag = REB
            tag = PIR
            tag = MER
            tag = BAR
        }
    }

    immediate = {
        every_province = {
            limit = {
                any_pops_in_province = {
                    count >= 1
                }
            }
            # KILL EXTRA POPS
            # count NOBLES and kill
            if = {
                limit = {
                    any_pops_in_province = {
                        count > 1
                        pop_type = nobles
                    }
                }
                while = {
                    limit = {
                        any_pops_in_province = {
                            count > 1
                            pop_type = nobles
                        }
                    }
                    random_pops_in_province = {
                        limit = {
                            pop_type = nobles
                        }
                        kill_pop = yes
                    }
                }
            }
            # count CITIZENS and kill
            if = {
                limit = {
                    any_pops_in_province = {
                        count > 2
                        pop_type = citizen
                    }
                }
                while = {
                    limit = {
                        any_pops_in_province = {
                            count > 2
                            pop_type = citizen
                        }
                    }
                    random_pops_in_province = {
                        limit = {
                            pop_type = citizen
                        }
                        kill_pop = yes
                    }
                }
            }
            # count FREEMEN and kill
            if = {
                limit = {
                    any_pops_in_province = {
                        count > 2
                        pop_type = freemen
                    }
                }
                while = {
                    limit = {
                        any_pops_in_province = {
                            count > 2
                            pop_type = freemen
                        }
                    }
                    random_pops_in_province = {
                        limit = {
                            pop_type = freemen
                        }
                        kill_pop = yes
                    }
                }
            }
            # count TRIBESMEN and kill
            if = {
                limit = {
                    any_pops_in_province = {
                        count > 2
                        pop_type = tribesmen
                    }
                }
                while = {
                    limit = {
                        any_pops_in_province = {
                            count > 2
                            pop_type = tribesmen
                        }
                    }
                    random_pops_in_province = {
                        limit = {
                            pop_type = tribesmen
                        }
                        kill_pop = yes
                    }
                }
            }
            # count SLAVES and kill
            if = {
                limit = {
                    any_pops_in_province = {
                        count > 2
                        pop_type = slaves
                    }
                }
                while = {
                    limit = {
                        any_pops_in_province = {
                            count > 2
                            pop_type = slaves
                        }
                    }
                    random_pops_in_province = {
                        limit = {
                            pop_type = slaves
                        }
                        kill_pop = yes
                    }
                }
            }
            # CREATE POPS
            # create nobles
            if = {
                limit = {
                    any_pops_in_province = {
                        count < 1
                        pop_type = nobles
                    }
                }
                create_pop = nobles
            }
            # create CITIZENS
            if = {
                limit = {
                    any_pops_in_province = {
                        count < 2
                        pop_type = citizen
                    }
                }
                while = {
                    limit = {
                        any_pops_in_province = {
                            count < 2
                            pop_type = citizen
                        }
                    }
                    create_pop = citizen
                }
            }
            # create FREEMEN
            if = {
                limit = {
                    any_pops_in_province = {
                        count < 2
                        pop_type = freemen
                    }
                }
                while = {
                    limit = {
                        any_pops_in_province = {
                            count < 2
                            pop_type = freemen
                        }
                    }
                    create_pop = freemen
                }
            }
            # create TRIBESMEN
            if = {
                limit = {
                    any_pops_in_province = {
                        count < 2
                        pop_type = tribesmen
                    }
                }
                while = {
                    limit = {
                        any_pops_in_province = {
                            count < 2
                            pop_type = tribesmen
                        }
                    }
                    create_pop = tribesmen
                }
            }
            # create SLAVES
            if = {
                limit = {
                    any_pops_in_province = {
                        count < 2
                        pop_type = slaves
                    }
                }
                while = {
                    limit = {
                        any_pops_in_province = {
                            count < 2
                            pop_type = slaves
                        }
                    }
                    create_pop = slaves
                }
            }
        }
    }

}


This event will target the country of Rome (Tag = ROM) but then run for every province in the world that has at least 1 existing pop.
To exclude wastelands, the ocean etc.

Then it will systematically go thru each pop class and count if there are more than 2 in the province, or more than 1 for nobles.
Then it will keep killing those pops while there remain more than the wanted number of them there.

Then once that's over the event will start creating pops and keeps creating suitable pops while there are fewer than what you wanted.

The game will chug for a second or two when you start a new game as it goes thru each province and completes the killing and creating of pops.

EDIT : Events are located inside the \\ImperatorRome\game\events\ folder. I added the event in a .TXT file, too, below.
If a province already contains the desired amount of a specific pop the event will do nothing to that pop type in that province.
 

Attachments

  • makeupanamehere_events.txt
    3,7 KB · Views: 0
Last edited:
  • 1
Reactions: