Need Help with Testing - Changing Feudal vassals to Imperial via Targeted Decision

RLTYProds

Recruit
1 Badges
Dec 5, 2020
9
1
  • Crusader Kings II
Hi. So I found that many of my vassals are still Feudal after enacting Imperial Administration, and according to the changelogs, the only way to turn them into Imperial is by revoking then regiving their titles or giving new ones outright.

Is there an easier way to do change them to imperial? My plan was to make a mod that does this via targeted decision, but since it's my first time making a mod like this, I'd like to ask for help. Mainly, whats the command that lets someone change their government?

So far, this is what I have. I used Stop Vassal's External Wars as a template since it was already a mod that uses targeted decision and is fairly short in length.

Code:
targetted_decisions = {
    transition_vassal_to_ig = {
        filter = realm
        ai_target_filter = self
        ai = no
   
        from_potential = {
            higher_tier_than = king
            NOT = { owes_favor_to = ROOT }
        }
       
        potential = {
            always = yes
        }
       
        allow = {
            FROM = {
                prestige = 100
                NOT = { trait = incapable }
                prisoner = no
                in_seclusion = no
                AND = {
                    has_law = law_voting_power_0
                }
            }
        }
       
        effect = {
            FROM = { prestige = -100 }
                set_government = imperial_government
                government = imperial_government
                set_government = emf_imperial_government
                government = emf_imperial_government              
        }
       
        ai_will_do = {
            factor = 0
        }
    }
}

Apologies if it's looking super wrong. Again, it's my first time doing this. What it does right now is it deducts my prestige...and that's about it.

I'd appreciate any help on this. Have a good day. :)
 

RLTYProds

Recruit
1 Badges
Dec 5, 2020
9
1
  • Crusader Kings II
I think I got it. It turns your direct vassal's titles into viceroyalties. Basically it's the opposite of the "Make Title Inheritable" targeted decision, because I took the code from it and flipped it so that it turns Feudal vassals into Imperial viceroys instead. It removes the viceroy_exempt flag as well, and the decision does not show up for indirect vassals, Holy Orders or Merchant Republics. It should be compatible with any other HIP-compatible mod.

I tested it and it does give me the decision to revoke or re-give the title when the holder dies. :D

If anyone wants to test it out for bugs or unforeseen consequences, I'd appreciate it.

Here's the code, if you wanna see it without downloading the whole thing:

Code:
targetted_decisions = {

    transition_vassal_to_ig = {
        only_playable = yes
        filter = vassals
        ai_target_filter = vassals
        ai_check_interval = 3

        from_potential = {
            OR = {
                AND = {
                    independent = yes
                    emf_imperial_government = yes
                }
                AND = {
                    independent = no
                    is_feudal = yes
                    emf_imperial_government = no
                    primary_title = { has_flag = viceroy_exemption }
                }
            }
        }
        potential = {
            OR = {
                ai = yes
                AND = {
                    FROM = { ai = no }
                    ai = no
                }
            }
            is_playable = yes
            vassal_of = FROM
            emf_imperial_government = no
            primary_title = {
                NOT = { temporary = yes }           
                higher_tier_than = COUNT
                has_flag = viceroy_exemption
            }
            NOT = { government = order_government }           
            NOT = { character = FROM }
        }
        allow = {
            ROOT = { war = no }
            FROM = {
                custom_tooltip = {
                    text = NEEDS_200_PRESTIGE_COST
                    prestige >= 200
                }
                war = no
                has_regent = no
            }
        }
        effect = {
            FROM = { prestige = -200 }
            prestige = 200
            primary_title = { clr_flag = viceroy_exemption }
            emf_switch_to_imperial = yes
            if = {
                limit = { is_rival = FROM }
                remove_rival = FROM
            }
            any_demesne_title = {
                limit = { tier = DUKE }
                ROOT = { opinion = { who = FROM modifier = opinion_granted_duchy } }
            }
            any_demesne_title = {
                limit = { tier = KING }
                ROOT = { opinion = { who = FROM modifier = opinion_granted_kingdom } }
            }
        }
        ai_will_do = {
            factor = 1
            modifier = {
                factor = 0
                FROM = { emf_imperial_government = yes }
            }
        }
    }
 

Attachments

  • 00_Make_Title_Viceregal.rar
    150,3 KB · Views: 0