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

EvilKnievel82

Major
31 Badges
Jun 10, 2015
521
5
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Res Publica
  • Crusader Kings II
  • Europa Universalis IV: Pre-order
  • Europa Universalis IV: Mandate of Heaven
  • Stellaris: Federations
  • Age of Wonders III
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Age of Wonders: Planetfall
  • Stellaris: Lithoids
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Cadet
  • Stellaris: Galaxy Edition
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: El Dorado
  • Stellaris - Path to Destruction bundle
  • Stellaris: Synthetic Dawn
  • Imperator: Rome
Hi! I have just started my first mod to change some of the more frustrating aspects of managing governors: the changing of policy on appointent. At the start of the game this may be manageble but mid-lategame you either ignore policies mostly or just pile up tons of tyranny and spend a lot of influence just to undo the changes when a governor dies and you have to appoint a new one.

For some reason I cannot keep the game from changing policies on appointment by editing the file: common/governor_policies/00_default
(more on that below) so I had to do the poor mans version of a fix:
a) just limiting the tyranny cost to cases of a governor or state with low loyalty (<50)
b) reducing the influence cost to a low number (0,5) and adding some gold cost (0.1x income) instead (this may also be better with a loyalty dependency)

Back to my initial question :
Maybe some smart people here can tell me what I did wrong here in changing "common/governor_policies/00_default" :

acquisition_of_wealth = {
province = {
monthly_local_governor_wage = 0.2
local_tax_modifier = 0.1
state_commerce_modifier = 0.1
}
if = {
limit = {is_ai = yes}
ai_will_do = {
modifier = {
add = 5
governor_or_ruler = { has_trait = gluttonous }
}
modifier = {
add = 15
governor_or_ruler = { loyalty <= 40 }
}
modifier = {
add = {
value = governor_or_ruler.corruption
divide = 2
}
}
}
}
if = {
limit = {is_ai = no}
ai_will_do = {
modifier = {
add = 1100
governor_policy = acquisition_of_wealth
}
modifier = {
subtract = 100
}
}
}
on_action = acquisition_of_wealth_pulse
}
...(similar for other policies)

So my understanding was that the value of the modifier decides the chance for a certain policy to be taken. So I figured make
a) one case for ai empire (first if{}) so the ai is not crippled by policies staying the same and
b) a second case for the player empire (second if{}). For the second case I added a huge modifier when the same policy is already the current policy and always subtract a smaller modifier (so the number is negative in all other cases).
However, the above seems to change nothing, policies are still changed on appointment. Thanks in advance if you can help :)
 
Code:
acquisition_of_wealth = {
    province = {
        monthly_local_governor_wage = 0.2
        local_tax_modifier = 0.1
        state_commerce_modifier = 0.1
    }
    if = {
        limit = {is_ai = yes}
        ai_will_do = {
            modifier = {
                add = 5
                governor_or_ruler = { has_trait = gluttonous }
            }
            modifier = {
                add = 15
                governor_or_ruler = { loyalty <= 40 }
            }
            modifier = {
                add = {
                value = governor_or_ruler.corruption
                divide = 2
                }
            }
        }
    }
    if = {
        limit = {is_ai = no}
        ai_will_do = {
            modifier = {
                add = 1100
                governor_policy = acquisition_of_wealth
            }
            modifier = {
                subtract = 100
            }
        }
    }
    on_action = acquisition_of_wealth_pulse
}
First off, your coding etiquette is awful and I had to adjust it before looking at the actual code.
Secondly, ai_will_do does absolutely nothing if the country in question is run by a player.
Thirdly, I don't understand why you think editing the governor policy will affect the underlying system of when the policy changes. The system has to work for every policy, even for ones you totally make up, so it's impossible that editing a single policy would affect that.

Either it's hardcoded, or there's some kind of event that causes it to allow the governor to change policies if they're new.
 
First off, your coding etiquette is awful and I had to adjust it before looking at the actual code.
Well I had proper indentations in the code and they got lost in copy pasting, do they stay when you use a the CODE environment in a post?

Secondly, ai_will_do does absolutely nothing if the country in question is run by a player.
Well then this wiki page seems to be pretty misleading :
https://imperator.paradoxwikis.com/Governor_policy_modding

Thirdly, I don't understand why you think editing the governor policy will affect the underlying system of when the policy changes. The system has to work for every policy, even for ones you totally make up, so it's impossible that editing a single policy would affect that.
Either it's hardcoded, or there's some kind of event that causes it to allow the governor to change policies if they're new.
I did not add the ai_will_do parts but just the if{} brackets with the limits. Obviously I edited all policies and only pasted the first one as an example, thus the "...(similar for other policies)"

There were already ai-weights in the file, I did not add them. That's why I though by changing them I would also affect the changes done by the "player-ai" when you appoint a governor ;) If you look at the weights for the different policies in the original file It does coincide with what happens when you install a new governor, i.e. certain policies are never chosen (centralize, decentralize for example) because the modifiers are zero. I attached the original file for reference. My guess is either the same weights are listed somethere else for the player or they are hardcoded for some reason...
 

Attachments

  • 00_default.txt
    5,2 KB · Views: 9
It definitely is the right file for the job. I could brute force the game to always take social mobility on a governor change (factors of zero on all but one policy), which it would never choose before. My guess is I will have to change the trigger (probably the scope is wrong (state?)) and I have to check if the employer is ai or not...
 
Well I had proper indentations in the code and they got lost in copy pasting, do they stay when you use a the CODE environment in a post?


Well then this wiki page seems to be pretty misleading :
https://imperator.paradoxwikis.com/Governor_policy_modding


I did not add the ai_will_do parts but just the if{} brackets with the limits. Obviously I edited all policies and only pasted the first one as an example, thus the "...(similar for other policies)"

There were already ai-weights in the file, I did not add them. That's why I though by changing them I would also affect the changes done by the "player-ai" when you appoint a governor ;) If you look at the weights for the different policies in the original file It does coincide with what happens when you install a new governor, i.e. certain policies are never chosen (centralize, decentralize for example) because the modifiers are zero. I attached the original file for reference. My guess is either the same weights are listed somethere else for the player or they are hardcoded for some reason...
Hmm, you may be right about the ai_will_do, though there is definitely some question of scoping here. I think I know why your code doesn't work, it's all scoped wrong.
I am not sure what the default scope for government policies are (My guess is the state scope), but I am very sure that the is_ai trigger which is scoped to country values does not apply to this scenario. Also the governor_policy trigger has a province scope. The triggers page on the wiki is your friend when it comes to these kinds of things.
 
It definitely is the right file for the job. I could brute force the game to always take social mobility on a governor change (factors of zero on all but one policy), which it would never choose before. My guess is I will have to change the trigger (probably the scope is wrong (state?)) and I have to check if the employer is ai or not...
Code:
acquisition_of_wealth = {
    province = {
        monthly_local_governor_wage = 0.2
        local_tax_modifier = 0.1
        state_commerce_modifier = 0.1
    }
    ai_will_do = {
        modifier = {
            add = 5
            governor_or_ruler = { has_trait = gluttonous }
        }
        modifier = {
            add = 15
            governor_or_ruler = { loyalty <= 40 }
        }
        modifier = {
            add = {
            value = governor_or_ruler.corruption
            divide = 2
            }
        }
       modifier = {
            any_state_province = {
               governor_policy = acquisition_of_wealth
               owner = {
                   is_ai = no
               }
           }
           add = 1000
        }
    }
}
Try something like this.
 
Thanks, I'll try that, but for know I am actually trying to just improve the weighting, so that it chooses something reasonable most of the time and the code can work for ai and player countries...
 
Thanks, I'll try that, but for know I am actually trying to just improve the weighting, so that it chooses something reasonable most of the time and the code can work for ai and player countries...
Why would it need to work for AI countries? How could it even work for AI countries? I thought the whole problem was that it forced players to waste their political influence on changing provinces when they didn't actually want the policy changed. AIs don't have this problem because their choices are already based off the weighting and nothing else.
 
Why would it need to work for AI countries? How could it even work for AI countries? I thought the whole problem was that it forced players to waste their political influence on changing provinces when they didn't actually want the policy changed. AIs don't have this problem because their choices are already based off the weighting and nothing else.
Well I realized that one could actually avoid even more changes of policies if the weighting would actually choose a policy that is useful most of the time by itself. just keeping the policies the same on governor change may only reduce the number of necessary policy changes but not reduce it enough IMO. I mean you probably need 2-3 policy changes per province even if the the policies were not changed with every new governor.

However, some of the triggers are very obscure and i cannot find any clear documentation on them (e.g. state_level_loyalty) so the triggers don't do what I expect them to. For example I would like local autonomy to be chosen only if loyalty in the province is below 33. However, if i use a trigger with state_level_loyalty < 33 (as the original file does) local autonomy is also chosen for a lot of provinces with 100 loyalty (for which the weighting should be 0). So either the trigger does something different to what i think or it is bugged altogether.

In the end I may actually just do what I initially set out to do and only make player governors keep the present policies.
 
Well I realized that one could actually avoid even more changes of policies if the weighting would actually choose a policy that is useful most of the time by itself. just keeping the policies the same on governor change may only reduce the number of necessary policy changes but not reduce it enough IMO. I mean you probably need 2-3 policy changes per province even if the the policies were not changed with every new governor.

However, some of the triggers are very obscure and i cannot find any clear documentation on them (e.g. state_level_loyalty) so the triggers don't do what I expect them to. For example I would like local autonomy to be chosen only if loyalty in the province is below 33. However, if i use a trigger with state_level_loyalty < 33 (as the original file does) local autonomy is also chosen for a lot of provinces with 100 loyalty (for which the weighting should be 0). So either the trigger does something different to what i think or it is bugged altogether.

In the end I may actually just do what I initially set out to do and only make player governors keep the present policies.
Hmm, you have to think about this mathematically. If you want the ai to only choose local autonomy when provincial loyalty is below 33%, then you have to do the opposite. The weight should be "state_level_loyalty >33" and then you should attach some huge negative modifier to this.