Results 1 to 13 of 13

Thread: Compatibility & Info For Modders

  1. #1
    Magnar's Avatar Artifex
    Join Date
    Jul 2013
    Location
    The last place you look
    Posts
    4,370

    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:
    unit_to_pop_table:

    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.

    eg;

    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.

    manpower_all_units:

    The format of this table is

    "main units unit_key",

    eg;

    manpower_all_units = {
    "Aet_Cav",
    "Aet_Sword",
    "Afr_Archers",
    }

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

    Mercenaries:
    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.

    mercenary_units_to_faction_class;

    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.

    mercenary_units_table

    The format for this table is;

    " main units unit key",
    eg;
    mercenary_units_table = {
    "Mer_Afr_Archers",
    "Mer_Afr_Cav",
    }

    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) },

    Growth:
    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.

    campaign_turn_per_year;
    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.

    culture_growth_bonus:
    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:

    PoR2_dummy_pop_growth_1
    PoR2_dummy_pop_growth_2
    PoR2_dummy_pop_growth_3
    PoR2_dummy_pop_growth_4

    When faction doesnt have main culture use:

    PoR2_dummy_pop_growth_1_not_culture
    PoR2_dummy_pop_growth_2_not_culture
    PoR2_dummy_pop_growth_3_not_culture
    PoR2_dummy_pop_growth_4_not_culture

    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:
    building_pop_growth_own_culture_table
    tech_pop_growth_own_culture_table

    And for non majority province culture
    building_pop_growth_foreign_culture_table
    tech_pop_growth_foreign_culture_table


    Migration
    Spoiler Alert, click show to read: 

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

    immigration_modifiers:
    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.

    faction_region_pop_ratio:
    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.

    region_sea_additional_adjacent
    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

    eg
    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.


    Economics

    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 03: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.

    Greetings

  3. #3
    Magnar's Avatar Artifex
    Join Date
    Jul 2013
    Location
    The last place you look
    Posts
    4,370

    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
    Location
    The last place you look
    Posts
    4,370

    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 06:48 AM.

  7. #7
    Magnar's Avatar Artifex
    Join Date
    Jul 2013
    Location
    The last place you look
    Posts
    4,370

    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
    Location
    The last place you look
    Posts
    4,370

    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
    Location
    The last place you look
    Posts
    4,370

    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 Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    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
    http://www.twcenter.net/forums/showt...Lua-Decompiler

Posting Permissions

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