Would it be possible to prevent the AI from firing councillors?
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)?
Short answer: yes, nomad clan heads can be court chaplain as long as they have the same religion as their liege.Are there non Muslim religions where a landed court chaplain isn't theocratic (would reformed temporal pagan would allow it maybe)?
job_spiritual = {
...
allow = {
can_be_spiritual_trigger = yes
}
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
}
}
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 }
}
}
}
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
}
}
}
#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 }
}
}
}
#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 }
}
}
#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
}
}
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]
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.At a glance, your problem might be that that you're looking forI 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 } }
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.If minor titles can be voters (other than regent), that's news to me.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.
If minor titles can be voters (other than regent), that's news to me.
job_chancellor = {
if = {
limit = {
NOT = {
has_minor_title = title_regent
}
}
remove_title = job_chancellor
give_minor_title = title_councilmember_dummy
}
}
if = {
limit = {
job_chancellor = {
NOT = {
has_minor_title = title_regent
}
}
job_chancellor = {
remove_title = job_chancellor
give_minor_title = title_councilmember_dummy
}
}
}
No, they do not go inside theDo I add pre-triggers to triggers = { } or do they have their own bracketty thingy?
trigger = {}
block, but nor do they have their own block. The only brackets they're within are the overall ones for the event.How would you go to make character flags visible in game (for testing purposes)?