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

nikkythegreat

Major
42 Badges
Dec 26, 2017
739
1.843
  • Age of Wonders: Planetfall
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Surviving Mars: First Colony Edition
  • Cities: Skylines Industries
  • Stellaris: Megacorp
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Ancient Relics
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Lithoids
  • Hearts of Iron IV: La Resistance
  • Stellaris: Federations
  • Imperator: Rome - Magna Graecia
  • Crusader Kings III
  • Battle for Bosporus
  • Empire of Sin
  • Stellaris: Necroids
  • Stellaris: Nemesis
  • Cities: Skylines - Green Cities
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Cities: Skylines
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • BATTLETECH
  • Surviving Mars
  • Hearts of Iron IV: Death or Dishonor
  • Stellaris: Synthetic Dawn
  • Age of Wonders III
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
I wanted to make a province have +1 trade route for every 20 citizens it has in the province. So I edited the files to add 0.05 trade route to the output of citizens.

But the game for some reason only counts citizens in the provincial capital and not the other territories.

Does anyone know how to get around this?
 
I wanted to make a province have +1 trade route for every 20 citizens it has in the province. So I edited the files to add 0.05 trade route to the output of citizens.

But the game for some reason only counts citizens in the provincial capital and not the other territories.

Does anyone know how to get around this?

I think this is a balance thing from Pdox' side. Trade routes from cities only count if that city is the provincial capital as well.
 
I wanted to make a province have +1 trade route for every 20 citizens it has in the province. So I edited the files to add 0.05 trade route to the output of citizens.

But the game for some reason only counts citizens in the provincial capital and not the other territories.

Does anyone know how to get around this?
Make a province modifier that works by citizen count?
 
Code:
namespace = cit_trade

##################################################################
# state_improvement
##################################################################

cit_trade.1 = {
    type = province_event
    hidden = yes

    trigger = {
        is_state_capital = yes
        num_of_citizen > 0
    }
   
    immediate = {
        set_variable = {
            name = cit_in_state
            value = 0
        }
        state = {
            ordered_state_province = {
                limit = { num_of_citizen > 0 }
                order_by = num_of_citizen
                ordered_pops_in_province = {
                    limit = { pop_type = citizen }
                    order_by = pop_happiness
                    change_variable = {
                        name = cit_in_state
                        add = 1
                    }
                }
            }
        }
        trigger_event = {
            id = cit_trade.2
        }
    }
}
cit_trade.2 = { #Citizen Trade bonus
    type = province_event
    hidden = yes

    trigger = {
        is_state_capital = yes
        cit_in_state >= 20
    }
   
    immediate = {
        if = {
            limit = {
                cit_in_state >= 20
                cit_in_state < 40
            }
            state = {
                add_state_modifier = {
                    name = cit_trade_1
                    duration = duration = 366
                    mode = add
                }
            }
        }
        else_if = {
            limit = {
                cit_in_state >= 40
                cit_in_state < 60
            }
            state = {
                add_state_modifier = {
                    name = cit_trade_2
                    duration = duration = 366
                    mode = add
                }
            }
        }
        else_if = {
            limit = {
                cit_in_state >= 60
                cit_in_state < 80
            }
            state = {
                add_state_modifier = {
                    name = cit_trade_3
                    duration = duration = 366
                    mode = add
                }
            }
        }
        else = {
            limit = { }
        }
    }
}
Ok, I think I might have something that would work, but it's hard to be sure.

I defined 3 state modifiers here, but you may have to make much more.
Code:
cit__trade_1 = {
    local_state_trade_routes = 1
}
cit__trade_2 = {
    local_state_trade_routes = 2
}
cit__trade_3 = {
    local_state_trade_routes = 3
}

Then I put the first event in the yearly pulse.
Code:
yearly_province_pulse = {
    random_events = {
        25 = 0
        75 = slave_revolts.1
    }
    events = {
        cit_trade.1
    }
}
Now how this is supposed to work is that the first event fires for every state capital, which then goes to the state scope, and systematically goes through provinces, and systematically goes through pops in each province adding a point to the variable defined in the first event. Then the second event fires as a result of the first event, and it checks to see if the variable which should equal the number of citizens in the state and should be saved in the state capital, is greater than 20, then there's an If, else_if, else progression to see which tier of citizen number the state has and give the correct state modifier accordingly.

There's so much that can go wrong here, but this is my best attempt.

I also tried to cut corners a bit, so that it doesn't fire when it's unnceccessary, like I assumed if there's no citizen in the state capital, that there are no citizens in the state.
 
Last edited:
Make a province modifier that works by citizen count?

Oh my!!!!
Brilliant Stars_and_Bars!! Been looking for such an advice for ages in other games too!!!

When you define a modifier, where do you put that code? I think I might have come across it ones but that would have been some other game and not by paradox.
 
Oh my!!!!
Brilliant Stars_and_Bars!! Been looking for such an advice for ages in other games too!!!

When you define a modifier, where do you put that code? I think I might have come across it ones but that would have been some other game and not by paradox.
You can put any modifier in the modifiers folder, but as you can see in the folder, the modifiers in vanilla are put in different files to keep things straight. Always use the # to make comments to remember what things are supposed to do, it's super helpful when you're adding a lot to your personal mod.