Results 1 to 6 of 6

Thread: Question: How to Mod Peasants Economy

  1. #1

    Default Question: How to Mod Peasants Economy

    Hello,
    What file inside the DB allow us to change how many peasant units do you get per province/region?
    Sincerely,

    ~someone who wants more peasants

  2. #2
    Frunk's Avatar Form Follows Function
    Artifex

    Join Date
    Jun 2009
    Location
    Gold Coast
    Posts
    6,507

    Default Re: Question: How to Mod Peasants Economy


  3. #3
    Litharion's Avatar Artifex
    Join Date
    Sep 2013
    Location
    Germany
    Posts
    2,622

    Default Re: Question: How to Mod Peasants Economy

    effect_bundles_to_effects_junctions_tables

    These effect bundles contain the number of peasants per region

    wh_dlc07_bundle_peasant_penalty_0 to wh_dlc07_bundle_peasant_penalty_100

    The effect you are looking for is wh_dlc07_effect_dummy_base_peasants.

  4. #4

    Default Re: Question: How to Mod Peasants Economy

    Alright so I went through this headache myself already. I'm still tweaking it but at least I know what to look at. My Filthy Peasant mod was worthless until someone else pointed me towards the scripts. You can't change the peasant economy through the database itself since all the values are attached to "dummy_whatever" meaning they don't actually change anything. What you want to do is copy the data.pack file and extract the script using Pack File Manager. The file is script/campaign/main_warhammer/wh_dlc07_peasant_economy. There you will see several conditions scripted to determine increase, penalties, etc as well as the amount of increase those actions give you. You can affect base peasants, peasants per settlement, extra peasants from tech, for faction leader, and can set which units count as peasants.

  5. #5

    Default Re: Question: How to Mod Peasants Economy

    Quote Originally Posted by Litharion View Post
    effect_bundles_to_effects_junctions_tables

    These effect bundles contain the number of peasants per region

    wh_dlc07_bundle_peasant_penalty_0 to wh_dlc07_bundle_peasant_penalty_100

    The effect you are looking for is wh_dlc07_effect_dummy_base_peasants.
    Can you further explain the mechanics of peasant economy pls? For example, I have a vanilla saved game with 24/27 show on meter, while I still got 11% unkeep penalty. I don't understand what is this limit figure mean? If I remember it correctly, at the beginning of the game if your peasants reach 10/10 you will got 8% unkeep penalty.

    Furthermore, I had subscribed a mod from workshop. I compared the modified effects_bundle_to_effects_junctions_tables with vanilla one, it modified wh_dlc07_effect_dummy_base_peasants from 2 to 3. I still doesn't figure out how it calculate the penalty.


    Waiting for your reply....

  6. #6
    Litharion's Avatar Artifex
    Join Date
    Sep 2013
    Location
    Germany
    Posts
    2,622

    Default Re: Question: How to Mod Peasants Economy

    wh_dlc07_peasant_economy.lua

    Code:
    PEASANTS_EFFECT_PREFIX = "wh_dlc07_bundle_peasant_penalty_";
    PEASANTS_PER_REGION = 3; -- change this value the effect should match
    PEASANTS_BASE_AMOUNT = 6; -- change this value the effect should match
    PEASANTS_RATIO_POSITIVE = true;
    PEASANTS_WARNING_COOLDOWN = 1;
    show_peasant_debug = true;
    
    function Calculate_Economy_Penalty(faction) -- function used to calculate the penalty
    ...
    
            local peasants_per_region_fac = PEASANTS_PER_REGION;
            local peasants_base_amount_fac = PEASANTS_BASE_AMOUNT;
            
            -- Peasants Per Region Modifiers
            if faction:name() == "wh_main_brt_carcassonne" then
                peasants_base_amount_fac = peasants_base_amount_fac + 5;
            end
            if faction:has_technology("tech_dlc07_brt_economy_farm_4") then
                peasants_per_region_fac = peasants_per_region_fac + 1;
            end
            
            -- Make sure player has regions
            if faction:region_list():num_items() < 1 then
                peasants_base_amount_fac = 0;
            end
            
            local free_peasants = (region_count * peasants_per_region_fac) + peasants_base_amount_fac;
            free_peasants = math.max(1, free_peasants);
            output_P("Free Peasants: "..free_peasants);
            local peasant_percent = (peasant_count / free_peasants) * 100;
            output_P("Peasant Percent: "..peasant_percent.."%");
            peasant_percent = RoundUp(peasant_percent);
            output_P("Peasant Percent Rounded: "..peasant_percent.."%");
            peasant_percent = math.min(peasant_percent, 200);
            output_P("Peasant Percent Clamped: "..peasant_percent.."%");
    So to summarize, the effects mentioned above handle the User Interface part and are only dummy effects.

    Everything else is determined by the script above.

    campaign -> main_warhammer -> wh_dlc07_peasant_economy.lua
    Last edited by Litharion; November 09, 2017 at 04:48 PM.

Posting Permissions

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