Results 1 to 13 of 13

Thread: Compatibility & Info For Modders

  1. #1
    Magnar's Avatar Artifex
    Join Date
    Jul 2013
    The last place you look

    Default Compatibility & Info For Modders

    This mod is for vanilla however, we have tried to make it as easy as possible to edit the mod to your own liking.

    This thread will explain how to create your own submod or how to add your mod's units so that they work with this mod.

    If you would like to include People of Rome 2 in your mod please pm either litharion or myself.

    If you want to make your units compatible with the population system, we will be creating a system so that all modded units can be made compatible and there will be a separate pack which will be for those using modded units.

    All compatible unit mods will be listed below.

    Compatibility For Modders
    Spoiler Alert, click show to read: 

    Adding units
    Spoiler Alert, click show to read: 

    We will release an optional "compatibility" pack which will add all additional units from other packs so that they can be used with this mod.

    To get your units into this pack you'll need to send 2 completed tables to us in a pack. You can find both the tables in our pack: script/_lib/lib_units.lua

    The tables you'll need to complete are:

    The format of this table is: main units unit_key= { unit class cost, total number of men, population requirement},

    Unit class cost table is:

    Noble: 1
    Warrior/Middle Clas: 2
    Commoner/Subject: 3
    Foreigner/Helot/Perigrini: 4

    The population requirement will usually be the same as the number of men in the unit, it is there because we allow for units to cost more or less men than the size of the unit if you so wish to do.


    unit_to_pop_table = {
    Aet_Cav = { 2, 80, 80 },
    Aet_Sword = { 2, 160, 160 },
    Afr_Archers = { 2, 120, 120 },
    these 3 units all require the 2nd class population to recruit.


    The format of this table is

    "main units unit_key",


    manpower_all_units = {

    when you fill this table out, only include your units and not vanilla unit keys.

    If you are adding mercenaries in your mod you will ALSO need to add them to some other tables as well as the above mentioned tables.


    This table assigns the mercenaries to their cultural groups so that they will require citizen pop from those with who have this cultural group assigned and foreign population from those that dont. It is possible to add your mercenary unit to multiple mercenary cultural groups.

    The format for this table is;

    ["mercenary cultural key"] = {"mercenary unit key 1","mercenary unit key 2" },

    use our cultural keys if you want them added to the universal unit compatibility pack. If you see a need for another cultural mercenary key then ask myself about getting one set up.


    The format for this table is;

    " main units unit key",
    mercenary_units_table = {

    This serves a similar purpose as the manpower_all_units (you need to add the keys to both)

    If anything is not clear please ask and we will further clarify.

    Sub Mods
    Spoiler Alert, click show to read: 
    We encourage you to make sub mods for People of Rome 2 adding your own take on balance and our mechanics. If we get enough then we will get a sub mod section.

    How to mod what :

    Anything text related:
    Spoiler Alert, click show to read: 

    All things text related are in the script/_lib/lib_population_ui_tables.lua file

    Changing Class Names:

    You can create a new set of class names by following the format in both ui_unit_classes and ui_region_pop_classes tables

    the class names are then assigned to the factions in the ui_faction_unique_name_table table

    UI text changes:
    All UI texts are found in the UI_data_table table.

    Region starting populations:

    All starting region populations are in the script/_lib/lib_population_tables.lua file

    They can be changed by editing the rom_region_to_pop_table table

    The format for this table is:
    region_key = { 1st class starting population, 2nd class, 3rd class, 4th class (foreign) },

    Spoiler Alert, click show to read: 

    All population growth modifiers are found in script/_lib/lib_population_modifiers.lua file

    The population_modifier table has many modifiers hat can be changed/

    For any set of 4 numbers in {} brackets, the order is always 1st class pop, 2nd, 3rd, 4th unless otherwise specified and the values are 0.01 = 1% and the value 1 is 100%

    Most modifiers allow different classes to grow at their own unique rate if so desired.

    This table divides all growth by the number of turns in a year. You can speed up or slow down all growth for a campaign by changing these numbers. Dont make them 0 or bad things will happen.

    This allows for a growth bonus for specific classes for each culture

    Technology and building growth:
    These require a little more work.
    The mod is set up so that each building and tech can have a different growth impact depending on if the faction has a cultural majority in the region or not.

    Once you have added your changes to technology and or buildings you will also need to do some db editing to make the effect show in the in-game UI.

    There are 8 effects already set up for this which you can use. They have no impact other than to display the appropriate text.

    When faction has main culture use:


    When faction doesnt have main culture use:


    The numbers correspond with the class levels so PoR2_dummy_pop_growth_1 is for 1st class population growth

    When you use these in the db you will also need to put in the corresponding nubmer from the .lua file into which ever effects_junction table you use (buildings or technology) so that the value is displayed also.

    Note that the number you use in the db is different to the number in the .lua file.

    DB - 1 = 1%
    LUA - 0.01 = 1%

    The tables to use for main culture population growth for tech and buildings are:

    And for non majority province culture

    Spoiler Alert, click show to read: 

    All population migrationmodifiers are found in script/_lib/lib_population_immigration.lua file

    various migration factors and weights can be set here in this table. These values are added to each other and multiplied by the relative ideal class ratio and then compared to adjacent regions to determine how many people will move to and from which regions.

    This table determines the factions ideal ration. To add a different ratio for a faction you can add another entry below the current default entry and instead of default you put the faction key.

    Normally people can only migrate to adjacent regions. This table allows people to move from any one region to any other specified region.

    The table format is:

    region to move from = {"regions to move to"},

    To have migration work properly you will need to make sure each region added also has the region added to its own table

    emp_aegyptos_myos_hormos = { "emp_bosporus_phanagoria", },
    emp_bosporus_phanagoria = { "emp_aegyptos_myos_hormos", },

    If only 1 region has it and not the corresponding region, then population will only be able to move one way.

    Also, don't add adjacent regions to this table as they are accounted for seperately. This table is only for those regions which are not adjacent. Immigration is only inter-factional and not international.


    Spoiler Alert, click show to read: 

    All population economic modifiers are found in script/_lib/lib_population_economics.lua file

    Ideal Class Ratios

    A number of economic effects are based on relative population class ratios. The ideal rations are defined in the faction_pop_ratio_eco table.

    You can create faction or cultural specific ideal rations by adding another sub table to this table and assigning it to the faction(s) in the faction_to_faction_pop_class table. All factions not assigned a specific ratio group will use the default.

    The population total size levels are set in economic_data table, if the population of the region is greater than one of thsoe nubmers then the correspoinding effect is applied.

    All economic effects are applied in the db.

    Guide for translators
    Spoiler Alert, click show to read: 

    Currently the mod isnt set up to handle foreign languages. We are working to fix this issue.

    For Mod Users
    Here you can find the latest version of the additional units compatibility pack (when available):
    Not currently available
    Last edited by Magnar; February 27, 2016 at 04:05 AM.

  2. #2

    Default Re: Compatibility & Info For Modders

    Hello, Magnar. I have a question. It´s posible to add units since the mod like you explain or is necesary add all units and send to you, to complete the changes.
    And if we are in the second case how i can export to you.


  3. #3
    Magnar's Avatar Artifex
    Join Date
    Jul 2013
    The last place you look

    Default Re: Compatibility & Info For Modders

    add all units and send to me please otherwise you can just add the whole mod to your pack and just put your units in.

  4. #4

    Default Re: Compatibility & Info For Modders

    And how to do when using x3 troop size ? What tables to modify ?

  5. #5
    Magnar's Avatar Artifex
    Join Date
    Jul 2013
    The last place you look

    Default Re: Compatibility & Info For Modders

    you'll need to modify the units script file

  6. #6

    Default Re: Compatibility & Info For Modders

    Quote Originally Posted by Magnar View Post
    you'll need to modify the units script file
    Sorry, the .pack file don't have any units.main tables. What units script file to modify you're talking about, please ?
    Last edited by leonardusius; November 22, 2016 at 07:48 AM.

  7. #7
    Magnar's Avatar Artifex
    Join Date
    Jul 2013
    The last place you look

    Default Re: Compatibility & Info For Modders

    im not at mymodding pc for the next few weeks so cant give you the exact location.

    i think it is script/population_units.lua

  8. #8

    Default Re: Compatibility & Info For Modders

    Hello! I want to make some changes in POR2 to implement it in my mod REM. And i need help!
    I made: foreigner_mechanic_on = false
    occupied_growth_modifier = {-0.6,-0.5,-0.3,-0.3},
    So my aim to make bigger drop in population by classes when you occupy settlement. But when i change these numbers, start new camp and occupy, nothing different..Can you tell me what I am doing wrong?
    By the way how to change population decrease when you raze city?

  9. #9
    Magnar's Avatar Artifex
    Join Date
    Jul 2013
    The last place you look

    Default Re: Compatibility & Info For Modders

    the growth modifier is applied the turn after capturing of the settlement and included in the growth mechanic. This is done at the start of a turn.

  10. #10

    Default Re: Compatibility & Info For Modders

    Thanks for the answer Magnar! I know that the growth modifier is applied the turn after capturing. But my question is still there! I change these numbers many times: occupied_growth_modifier = {-0.6,-0.5,-0.3,-0.3}, but nothing different happens next turn.

    1) For example, I need after occupy settlement: upper class pop drop by 60%, mid drop by 50%, low drop by 30%, foreign pop drop by 30%. So how to do that?

    2) Turn after raze settlement population drop around 50% - where I can change this number? Regards!

  11. #11
    Magnar's Avatar Artifex
    Join Date
    Jul 2013
    The last place you look

    Default Re: Compatibility & Info For Modders

    looted_growth_modifier = {-0.3,-0.3,-0.3,-0.3},
    occupied_growth_modifier = {-0.2,-0.2,-0.2,-0.15},

    are the 2 that deal with those events.

    looted is for raze + loot
    occupied is jsut for looted

  12. #12

    Default Re: Compatibility & Info For Modders

    Hi Magnar,

    How did you create/edit the extension-less files ui/campaign_ui/province_details_panel and settlement_panel files?

  13. #13
    Jake Armitage's Avatar Primicerius
    Join Date
    Apr 2011
    apartment 6

    Default Re: Compatibility & Info For Modders

    They are luac files (compressed lua), I don't think they are moddable at all without an informatic engineer (so someone who really has knowledge) cracking them. Think it would require a lot of time and trials too.
    Or am I wrong, Magnar?

    Alpaca tried this for Napoleon (or another TW game) a lot of years ago

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts