• 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.
Would it be possible to prevent the AI from firing councillors?
 
Would it be possible to prevent the AI from firing councillors?

It should be possible since the AI should be bound by the same restrictions under Full Council Authority already. However, it might be side-effecty since the AI won't be able to appoint its powerful vassals (pissing them off) if they are ineligible the moment it goes "I need a <voter>!".
 
  • 1
Reactions:
Right, the cons probably outweight the pros. I wish I could rid the council of a malcontent or two but I guess there's only so much I can do to prevent the AI from harming itself.
 
Is it possible to check if a character has Iqta government? Are there non Muslim religions where a landed court chaplain isn't theocratic (would reformed temporal pagan would allow it maybe)?
 
Is it possible to check if a character has Iqta government?

"government = muslim_government" would cover characters that currently have the government, but in some cases you might want to check eligibility as well (e.g. a Muslim MR does not pass the check).

Are there non Muslim religions where a landed court chaplain isn't theocratic (would reformed temporal pagan would allow it maybe)?

Nomad Clan vassals are also eligible. Temporal pagans are not eligible by default.
 
  • 1
Reactions:
Are there non Muslim religions where a landed court chaplain isn't theocratic (would reformed temporal pagan would allow it maybe)?
Short answer: yes, nomad clan heads can be court chaplain as long as they have the same religion as their liege.

Long answer:

First, you need to locate the specification of the court chaplain job (.../common/job_titles/00_job_titles.txt). Here's the base game version:
Code:
job_spiritual = {
...
    allow = {
        can_be_spiritual_trigger = yes
    }
This points you to a scripted_trigger:
Code:
can_be_spiritual_trigger = {
    independent = no
    prisoner = no
    NOT = { trait = incapable }
    NOT = { trait = in_hiding }
    NOT = { has_character_modifier = resigned_in_anger }
    NOT = {
        liege = {
            has_opinion_modifier = {
                who = ROOT
                modifier = opinion_resigned_from_council
            }
        }
    }

    liege = {
        religion = ROOT
    }
    OR = {
        AND = {
            is_adult = yes
            OR = {
                is_female = no
                religion_allows_female_temple_holders = yes
                has_religion_feature = religion_matriarchal
            }
            OR = {
                is_female = yes
                religion_allows_male_temple_holders = yes
                has_religion_feature = religion_patriarchal
            }
            OR = {
                NOT = { religion = hindu }
                trait = brahmin
                is_ascetic_trigger = yes
            }
        }
        has_character_flag = special_spiritual
    }
 
    OR = {
        is_theocracy = yes
        AND = {
            liege = { is_tribal = yes }
            is_ruler = no
        }
        liege = { religion_group = muslim }
        AND = {
            clan = yes
            liege = {
                is_nomadic = yes
            }
        }
        AND = {
            has_autocephaly = no
            is_ruler = no
        }
        AND = {
            has_autocephaly = yes
            is_ruler = no
            NOT = {
                any_vassal = { is_theocracy = yes }
            }
        }
    }
 
    OR = {
        NOT = { religion_group = muslim }
        NOT = { liege = { religion_group = muslim } }
        trait = detached_priest
        trait = martial_cleric
        trait = scholarly_theologian
        trait = mastermind_theologian
        has_character_flag = special_spiritual
    }
}
Your question specifically relates to this part:
Code:
    OR = {
        is_theocracy = yes
        AND = {
            liege = { is_tribal = yes }
            is_ruler = no
        }
        liege = { religion_group = muslim }
        AND = {
            clan = yes
            liege = {
                is_nomadic = yes
            }
        }
        AND = {
            has_autocephaly = no
            is_ruler = no
        }
        AND = {
            has_autocephaly = yes
            is_ruler = no
            NOT = {
                any_vassal = { is_theocracy = yes }
            }
        }
    }
...which says that there are 2 ways in which non-theocratic rulers can be court chaplain:
  • if the potential court chaplain's liege is a muslim (ie. that the cc is a muslim, since he must be of the same religion as his liege), or
  • if he is head of a nomad clan in a nomad empire (note that it's technically possible, but very rare without player involvement, to have nomad clan heads in non-nomadic empires).
 
Last edited:
  • 1
Reactions:
I redid my councillor script from scratch... It mostly works, outside of regencies. In my test it fires everyone, except the regent and the chaplain, which is intended. What is not intended is that it appoints nobody by the end of the script. So that should be the 3rd event (1009) of the chain that is faulty.

In short, I use a decision to send an event to my character:
Code:
decisions = {
 
    TEST_councilor_script = {
        only_playable = yes
         is_high_prio = yes
        ai_check_interval = 12

        potential = {
            is_ruler = yes
            ai = no
        }
        allow = {
            always = yes
        }
        effect = {
            ROOT = {             
                hidden_tooltip = {
                    character_event = { id = CR.1000 }
                }
            }
        }
        ai_will_do = {
            factor = 0
        }
    }
}

Then it filters out the tier of the ruler and possible regencies to send the correct event, duke with regents shouldn't run the script. Here the event that I intend to fire is CR.1008:

Code:
#Is there a regent? What is the ruler's tier?
character_event = {
    id = CR.1000
    hide_window = yes

    is_triggered_only = yes

    immediate = {
        if = { #king and emperor no regency script
            limit = {
                has_regent = no
                higher_real_tier_than = DUKE
            }
            character_event = { id = CR.1001 }
        }
        if = { #king and emperor regency script
            limit = {
                has_regent = yes
                higher_real_tier_than = DUKE
            }
            character_event = { id = CR.1008 }
        }
        if = { #count and duke no regency script
            limit = {
                has_regent = no
                lower_real_tier_than = KING
            }
            character_event = { id = CR.1004 }
        }
    }
}

Event 1008 then remove every councilor's job, except for the chaplain and the regent (which are meant to keep whatever job they have), and assign everyone else the title title_councilmember_dummy, whose main purpose is to give everyone the is_voter tag while (most) jobs have no councillor so I can easily appoint characters.

Then it moves on to event 1009.

Code:
#Flagging every potential councillor king regency edition
character_event = {
    id = CR.1008
    hide_window = yes

    is_triggered_only = yes

    immediate = {
        set_character_flag = swapping_councillors
        any_voter = {
            limit = {
                has_minor_title = title_councilmember_king
                NOT = {
                    has_minor_title = title_regent
                }
            }
            remove_title = title_councilmember_king
            give_minor_title = title_councilmember_dummy
        }
        any_voter = {
            limit = {
                has_minor_title = title_councilmember_emperor
                NOT = {
                    has_minor_title = title_regent
                }
            }
            remove_title = title_councilmember_emperor
            give_minor_title = title_councilmember_dummy
        }
        job_chancellor = {
            if = {
                limit = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
                remove_title = job_chancellor
                give_minor_title = title_councilmember_dummy
            }
        }
        job_marshal = {
            if = {
                limit = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
                remove_title = job_marshal
                give_minor_title = title_councilmember_dummy
            }
        }
        job_treasurer = {
            if = {
                limit = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
                remove_title = job_treasurer
                give_minor_title = title_councilmember_dummy
            }
        }
        job_spymaster = {
            if = {
                limit = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
                remove_title = job_spymaster
                give_minor_title = title_councilmember_dummy
            }
        }
        character_event = { id = CR.1009 }
    }
}

Up to that point, the script seem to be working as intended.

Event 1009 picks one job, assign a character with good attributes among the title_councilmember_dummy holders to the job and proceeds like that one job at a time until the entire council is full again. Every time there's an extra step (the "if") to check that the regent does not hold the job title has it seems to mess the code, and also to keep the AI from bypassing the rules of regency (you can't change the regent's job).

Code:
#Councillor script regency default edition
character_event = {
    id = CR.1009
    hide_window = yes

    is_triggered_only = yes

    immediate = {
        if = {
            limit = {
                job_spymaster = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
            }
            random_voter = {
                limit = {
                    can_be_spymaster_trigger = yes
                    NOT = {
                        has_job_title = job_spiritual
                        has_minor_title = title_regent
                    }
                }
                preferred_limit = {
                    intrigue > 19
                    opinion = {
                        who = ROOT
                        value > 24
                    }
                }
                preferred_limit = {
                    intrigue > 14
                    opinion = {
                        who = ROOT
                        value > 24
                    }
                }
                preferred_limit = {
                    intrigue > 19
                    opinion = {
                        who = ROOT
                        value > 0
                    }
                }
                preferred_limit = {
                    intrigue > 14
                    opinion = {
                        who = ROOT
                        value > 0
                    }
                }
                preferred_limit = {
                    intrigue > 9
                    opinion = {
                        who = ROOT
                        value > 0
                    }
                }
                preferred_limit = {
                    ai_honor > -1
                    opinion = {
                        who = ROOT
                        value > 0
                    }
                }
                preferred_limit = {
                    ai_honor > -1
                    opinion = {
                        who = ROOT
                        value > -20
                    }
                }
                remove_title = title_councilmember_dummy
                give_job_title = job_spymaster
            }
        }
        if = {
            limit = {
                job_chancellor = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
            }
            random_voter = { #chancellor
                limit = {
                    can_be_chancellor_trigger = yes
                    NOR = {
                        has_job_title = job_spymaster
                        has_job_title = job_spiritual
                        has_minor_title = title_regent
                    }
                }
                preferred_limit = {
                    diplomacy > 21
                }
                preferred_limit = {
                    diplomacy > 18
                }
                preferred_limit = {
                    diplomacy > 15
                }
                preferred_limit = {
                    diplomacy > 11
                    stewardship < 12
                    martial < 12
                }
                preferred_limit = {
                    diplomacy > 5
                    stewardship < 12
                    martial < 12
                }
                preferred_limit = {
                    diplomacy > 8
                }
                remove_title = title_councilmember_dummy
                give_job_title = job_chancellor
            }
        }
        if = {
            limit = {
                job_treasurer = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
            }
            random_voter = { #treasurer
                limit = {
                    can_be_treasurer_trigger = yes
                    has_minor_title = title_councilmember_dummy
                }
                preferred_limit = {
                    stewardship > 19
                    martial < 12
                }
                preferred_limit = {
                    stewardship > 16
                    martial < 12
                }
                preferred_limit = {
                    stewardship > 12
                    martial < 12
                }
                preferred_limit = {
                    stewardship > 16
                }
                preferred_limit = {
                    stewardship > 5
                    martial < 12
                }
                preferred_limit = {
                    martial < 12
                }
                remove_title = title_councilmember_dummy
                give_job_title = job_treasurer
            }
        }
        if = {
            limit = {
                job_marshal = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
            }
            random_voter = { #marshal
                limit = {
                    can_be_marshal_trigger = yes
                    has_minor_title = title_councilmember_dummy
                }
                preferred_limit = {
                    martial > 21
                }
                preferred_limit = {
                    martial > 17
                }
                preferred_limit = {
                    martial > 13
                }
                preferred_limit = {
                    martial > 10
                }
                preferred_limit = {
                    martial > 7
                }
                preferred_limit = {
                    martial > 4
                }
                remove_title = title_councilmember_dummy
                give_job_title = job_marshal
            }
        }
        random_voter = { #councilmember_king no check so that characters in hiding keep their council seat
            limit = {
                has_minor_title = title_councilmember_dummy
            }
            remove_title = title_councilmember_dummy
            give_minor_title = title_councilmember_king
        }
        random_voter = { #councilmember_emperor no check so that characters in hiding keep their council seat
            limit = {
                has_minor_title = title_councilmember_dummy
            }
            remove_title = title_councilmember_dummy
            give_minor_title = title_councilmember_emperor
        }
        any_voter = {
            limit = {
                has_minor_title = title_councilmember_dummy
            }
            remove_title = title_councilmember_dummy
        }
        clr_character_flag = swapping_councillors
    }
}
 
Last edited:
That's what I get when running my script. The regent is the spymaster.

1742133491622.png


This is what the working non regency version of the script does:
1742135160596.png
 
Last edited:
I redid my councillor script from scratch... It mostly works, outside of regencies. In my test it fires everyone, except the regent and the chaplain, which is intended. What is not intended is that it appoints nobody by the end of the script. So that should be the 3rd event (1009) of the chain that is faulty.
[/code]

I suggest placing various log = "Script got to this point" in your events, to verify that script is executed as you think it should be. Very useful to find out where things go wrong. Be sure to have logging enabled first.
 
  • 1
Reactions:
I redid my councillor script from scratch... It mostly works, outside of regencies. In my test it fires everyone, except the regent and the chaplain, which is intended. What is not intended is that it appoints nobody by the end of the script. So that should be the 3rd event (1009) of the chain that is faulty.

In short, I use a decision to send an event to my character:
Code:
decisions = {
 
    TEST_councilor_script = {
        only_playable = yes
         is_high_prio = yes
        ai_check_interval = 12

        potential = {
            is_ruler = yes
            ai = no
        }
        allow = {
            always = yes
        }
        effect = {
            ROOT = {            
                hidden_tooltip = {
                    character_event = { id = CR.1000 }
                }
            }
        }
        ai_will_do = {
            factor = 0
        }
    }
}

Then it filters out the tier of the ruler and possible regencies to send the correct event, duke with regents shouldn't run the script. Here the event that I intend to fire is CR.1008:

Code:
#Is there a regent? What is the ruler's tier?
character_event = {
    id = CR.1000
    hide_window = yes

    is_triggered_only = yes

    immediate = {
        if = { #king and emperor no regency script
            limit = {
                has_regent = no
                higher_real_tier_than = DUKE
            }
            character_event = { id = CR.1001 }
        }
        if = { #king and emperor regency script
            limit = {
                has_regent = yes
                higher_real_tier_than = DUKE
            }
            character_event = { id = CR.1008 }
        }
        if = { #count and duke no regency script
            limit = {
                has_regent = no
                lower_real_tier_than = KING
            }
            character_event = { id = CR.1004 }
        }
    }
}

Event 1008 then remove every councilor's job, except for the chaplain and the regent (which are meant to keep whatever job they have), and assign everyone else the title title_councilmember_dummy, whose main purpose is to give everyone the is_voter tag while (most) jobs have no councillor so I can easily appoint characters.

Then it moves on to event 1009.

Code:
#Flagging every potential councillor king regency edition
character_event = {
    id = CR.1008
    hide_window = yes

    is_triggered_only = yes

    immediate = {
        set_character_flag = swapping_councillors
        any_voter = {
            limit = {
                has_minor_title = title_councilmember_king
                NOT = {
                    has_minor_title = title_regent
                }
            }
            remove_title = title_councilmember_king
            give_minor_title = title_councilmember_dummy
        }
        any_voter = {
            limit = {
                has_minor_title = title_councilmember_emperor
                NOT = {
                    has_minor_title = title_regent
                }
            }
            remove_title = title_councilmember_emperor
            give_minor_title = title_councilmember_dummy
        }
        job_chancellor = {
            if = {
                limit = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
                remove_title = job_chancellor
                give_minor_title = title_councilmember_dummy
            }
        }
        job_marshal = {
            if = {
                limit = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
                remove_title = job_marshal
                give_minor_title = title_councilmember_dummy
            }
        }
        job_treasurer = {
            if = {
                limit = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
                remove_title = job_treasurer
                give_minor_title = title_councilmember_dummy
            }
        }
        job_spymaster = {
            if = {
                limit = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
                remove_title = job_spymaster
                give_minor_title = title_councilmember_dummy
            }
        }
        character_event = { id = CR.1009 }
    }
}

Up to that point, the script seem to be working as intended.

Event 1009 picks one job, assign a character with good attributes among the title_councilmember_dummy holders to the job and proceeds like that one job at a time until the entire council is full again. Every time there's an extra step (the "if") to check that the regent does not hold the job title has it seems to mess the code, and also to keep the AI from bypassing the rules of regency (you can't change the regent's job).

Code:
#Councillor script regency default edition
character_event = {
    id = CR.1009
    hide_window = yes

    is_triggered_only = yes

    immediate = {
        if = {
            limit = {
                job_spymaster = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
            }
            random_voter = {
                limit = {
                    can_be_spymaster_trigger = yes
                    NOT = {
                        has_job_title = job_spiritual
                        has_minor_title = title_regent
                    }
                }
                preferred_limit = {
                    intrigue > 19
                    opinion = {
                        who = ROOT
                        value > 24
                    }
                }
                preferred_limit = {
                    intrigue > 14
                    opinion = {
                        who = ROOT
                        value > 24
                    }
                }
                preferred_limit = {
                    intrigue > 19
                    opinion = {
                        who = ROOT
                        value > 0
                    }
                }
                preferred_limit = {
                    intrigue > 14
                    opinion = {
                        who = ROOT
                        value > 0
                    }
                }
                preferred_limit = {
                    intrigue > 9
                    opinion = {
                        who = ROOT
                        value > 0
                    }
                }
                preferred_limit = {
                    ai_honor > -1
                    opinion = {
                        who = ROOT
                        value > 0
                    }
                }
                preferred_limit = {
                    ai_honor > -1
                    opinion = {
                        who = ROOT
                        value > -20
                    }
                }
                remove_title = title_councilmember_dummy
                give_job_title = job_spymaster
            }
        }
        if = {
            limit = {
                job_chancellor = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
            }
            random_voter = { #chancellor
                limit = {
                    can_be_chancellor_trigger = yes
                    NOR = {
                        has_job_title = job_spymaster
                        has_job_title = job_spiritual
                        has_minor_title = title_regent
                    }
                }
                preferred_limit = {
                    diplomacy > 21
                }
                preferred_limit = {
                    diplomacy > 18
                }
                preferred_limit = {
                    diplomacy > 15
                }
                preferred_limit = {
                    diplomacy > 11
                    stewardship < 12
                    martial < 12
                }
                preferred_limit = {
                    diplomacy > 5
                    stewardship < 12
                    martial < 12
                }
                preferred_limit = {
                    diplomacy > 8
                }
                remove_title = title_councilmember_dummy
                give_job_title = job_chancellor
            }
        }
        if = {
            limit = {
                job_treasurer = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
            }
            random_voter = { #treasurer
                limit = {
                    can_be_treasurer_trigger = yes
                    has_minor_title = title_councilmember_dummy
                }
                preferred_limit = {
                    stewardship > 19
                    martial < 12
                }
                preferred_limit = {
                    stewardship > 16
                    martial < 12
                }
                preferred_limit = {
                    stewardship > 12
                    martial < 12
                }
                preferred_limit = {
                    stewardship > 16
                }
                preferred_limit = {
                    stewardship > 5
                    martial < 12
                }
                preferred_limit = {
                    martial < 12
                }
                remove_title = title_councilmember_dummy
                give_job_title = job_treasurer
            }
        }
        if = {
            limit = {
                job_marshal = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
            }
            random_voter = { #marshal
                limit = {
                    can_be_marshal_trigger = yes
                    has_minor_title = title_councilmember_dummy
                }
                preferred_limit = {
                    martial > 21
                }
                preferred_limit = {
                    martial > 17
                }
                preferred_limit = {
                    martial > 13
                }
                preferred_limit = {
                    martial > 10
                }
                preferred_limit = {
                    martial > 7
                }
                preferred_limit = {
                    martial > 4
                }
                remove_title = title_councilmember_dummy
                give_job_title = job_marshal
            }
        }
        random_voter = { #councilmember_king no check so that characters in hiding keep their council seat
            limit = {
                has_minor_title = title_councilmember_dummy
            }
            remove_title = title_councilmember_dummy
            give_minor_title = title_councilmember_king
        }
        random_voter = { #councilmember_emperor no check so that characters in hiding keep their council seat
            limit = {
                has_minor_title = title_councilmember_dummy
            }
            remove_title = title_councilmember_dummy
            give_minor_title = title_councilmember_emperor
        }
        any_voter = {
            limit = {
                has_minor_title = title_councilmember_dummy
            }
            remove_title = title_councilmember_dummy
        }
        clr_character_flag = swapping_councillors
    }
}
At a glance, your problem might be that that you're looking for random_voter. If they're not on the council, then they're not a voter, and since you just fired (mostly) everyone, you have no random voters available other than the ones that are still currently on the council.
 
  • 1
Reactions:
Everyone should still be a voter due to having title_councilmember_dummy minor title and I know the title works as the same script without the regent checks works fine.
 
Do they get a "Recently fired"/"Fired me" opinion partway through the process that makes them ineligible to be appointed to a(nother) council title?
 
Thanks for the suggestions. It was a dumb issue actually.

Code:
        job_chancellor = {
            if = {
                limit = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
                remove_title = job_chancellor
                give_minor_title = title_councilmember_dummy
            }
        }

job_chancellor should have been inside the if and limit, like this:

Code:
        if = {
            limit = {
                job_chancellor = {
                    NOT = {
                        has_minor_title = title_regent
                    }
                }
                job_chancellor = {
                    remove_title = job_chancellor
                    give_minor_title = title_councilmember_dummy
                }
            }
        }
 
Do I add pre-triggers to triggers = { } or do they have their own bracketty thingy?
 
Do I add pre-triggers to triggers = { } or do they have their own bracketty thingy?
No, they do not go inside the trigger = {} block, but nor do they have their own block. The only brackets they're within are the overall ones for the event.

I always put my pre-triggers right before the trigger block myself.
 
  • 1
Reactions:
How would you go to make character flags visible in game (for testing purposes)?
 
How would you go to make character flags visible in game (for testing purposes)?

Using the "charinfo" command in the console (if you don't mind other info being visible, e.g. real_father), or updating the CHARACTER_TOOLTIP UI string to add some custom_loc only visible if someone has the flag (if you don't want the full charinfo; this is more work).
 
  • 1
Reactions: