• 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.
Back for some more insight... This seems simple and I checked the archives... but I can't figure it out, so here I am :D

When modding minor-titles how to add a parameter for the recipient to resign when they meet a certain criteria?... It seems that "allowed_to_hold" only checks the requirements 'before' the title is gained and doesn't actively remove holders that technically no longer meet the requirements....

so for example...

Code:
title_ladyinwaiting = {   #<---Title = "Lady" intended to give bonuses to "unmarried" women  potentially allowing for bettor suitors or proposals...


    dignity = 0.05
    realm_in_name = yes
    grant_limit = 3
    opinion_effect = 5
    show_as_title = yes

    monthly_salary = 0.5
    monthly_prestige = 0.5

    is_unique = no

    allowed_to_hold = {
        is_adult = yes
        is_female = yes
        is_married = no                     #<----how to have this character automatically resign the minor-title when they become married?
        religion_group = christian         #<----If this ^^ isnt possible, how to resign them without an opinion malice "revoked my honorary title -20"
...}
Are you 100% sure that the title isn't automatically revoked when allowed_to_hold evaluates to false? (Eg: When the lady in waiting gets married.)

Because the documentation for lose_effect strongly implies that it should work that way: "lose_effect ... Fires when a title is lost if allowed_to_hold evaluates to false".

Bear in mind that you may need to wait a few days (maybe even a month or two) for the criteria to be automatically evaluated.

Also, have you run your code through the Validator and checked the error log, to ensure that you haven't made any syntax errors? (You haven't posted the full code so we can't see for ourselves.) CK2's scripting engine can sometimes behave oddly if there are syntax errors, and it's possible that syntax errors might stop it from properly evaluating your allowed_to_hold clause.

---

If all other options are exhausted, you could write an event that only fires for ladies-in-waiting, which fires them if they no longer fit the criteria. Set it to trigger in all relevant on_actions, for example: on_yearly_pulse, on_marriage, on_become_imprisoned_any_reason, on_forced_consort, on_character_convert_religion, on_character_convert_secret_religion. This is the least-preferred option because it's probably going to be expensive in terms of performance.

---

Finally, if the community agrees that allowed_to_hold doesn't work in the way implied by the wiki documentation (ie. that title holders don't get booted if allowed_to_hold evaluates to false), then that documentation probably needs to be updated.
 
  • 1
Reactions:
I am also under the impression that allowed_to_hold will remove someone if they no longer meet the criteria. It fits my experience as well, though I haven't been paying especially close attention to it.
 
  • 1Like
Reactions:
Are you 100% sure that the title isn't automatically revoked when allowed_to_hold evaluates to false? (Eg: When the lady in waiting gets married.)

Because the documentation for lose_effect strongly implies that it should work that way: "lose_effect ... Fires when a title is lost if allowed_to_hold evaluates to false".

Bear in mind that you may need to wait a few days (maybe even a month or two) for the criteria to be automatically evaluated.

Also, have you run your code through the Validator and checked the error log, to ensure that you haven't made any syntax errors? (You haven't posted the full code so we can't see for ourselves.) CK2's scripting engine can sometimes behave oddly if there are syntax errors, and it's possible that syntax errors might stop it from properly evaluating your allowed_to_hold clause.

---

If all other options are exhausted, you could write an event that only fires for ladies-in-waiting, which fires them if they no longer fit the criteria. Set it to trigger in all relevant on_actions, for example: on_yearly_pulse, on_marriage, on_become_imprisoned_any_reason, on_forced_consort, on_character_convert_religion, on_character_convert_secret_religion. This is the least-preferred option because it's probably going to be expensive in terms of performance.

---

Finally, if the community agrees that allowed_to_hold doesn't work in the way implied by the wiki documentation (ie. that title holders don't get booted if allowed_to_hold evaluates to false), then that documentation probably needs to be updated.
I will double check...I too thought this was true but maybe I just need to give it more time...You know how things are, one can get in a hurry
 
  • 1Like
Reactions:
Well I gave it a few months to no avail... I had a 'lady' that was married and I consoled the 'ugly' trait on her and she still wouldnt lose the title....here is the full code so far in case I am missing something that is breaking the code

Code:
title_ladyinwaiting = {
    dignity = 0.05
    realm_in_name = yes
    grant_limit = 3
    opinion_effect = 5
    show_as_title = yes

    monthly_salary = 0.5
    monthly_prestige = 0.5

    is_unique = no

    allowed_to_hold = {
        is_adult = yes
        is_female = yes
        is_married = no
        religion_group = christian
        is_heretic = no
        NOR = {
            trait = incapable
            trait = infirm
            trait = imbecile
            trait = possessed
            trait = hunchback
            trait = clubfooted
            trait = dwarf
            trait = ugly
        }
    }
   
    allowed_to_grant = {
        AND = {
            is_feudal = yes
            religion_group = christian
            OR = {
                martial = 8
                diplomacy = 8
                stewardship = 8
                learning = 8
               
            }
        }
    }
   
    gain_effect = {
        if = {
        limit = { is_lowborn = yes }
        dynasty = father_bastard
        }
        add_character_modifier = {
                name = lady_in_waiting_modifier
                duration = -1
        }   
        add_trait = fair
        add_trait = chaste
        liege = {
            add_character_modifier = {
                name = personal_ladies_modifier
                duration = -1
                stacking = yes
            }
             if = {
                    limit = {
                        check_variable = {
                            which = ladies_stacks_counter
                            value == 0
                        }
                    }
                    set_variable = {
                        which = ladies_stacks_counter
                        value = 1
                    }
                }
                else = {
                    change_variable = {
                        which = ladies_stacks_counter
                        value = 1
                    }
                }
        }
    }
   
    lose_effect = {  
        liege = {
            remove_character_modifier = personal_ladies_modifier
                subtract_variable = {
                    which = ladies_stacks_counter
                    value = 1
                }
                set_variable = {
                    which = temporary_ladies_stacks_counter
                    value = 0
                }
                while = {
                    limit = {
                        check_variable = {
                            which = ladies_stacks_counter
                            which > temporary_ladies_stacks_counter
                        }
                    }
                    change_variable = {
                        which = temporary_ladies_stacks_counter
                        value = 1
                    }
                    add_character_modifier = {
                        name = personal_ladies_modifier
                        duration = -1
                        stacking = yes
                    }
                }
        }
    }
   
    retire_effect = {   
        liege = {
            remove_character_modifier = personal_ladies_modifier
                subtract_variable = {
                    which = ladies_stacks_counter
                    value = 1
                }
                set_variable = {
                    which = temporary_ladies_stacks_counter
                    value = 0
                }
                while = {
                    limit = {
                        check_variable = {
                            which = ladies_stacks_counter
                            which > temporary_ladies_stacks_counter
                        }
                    }
                    change_variable = {
                        which = temporary_ladies_stacks_counter
                        value = 1
                    }
                    add_character_modifier = {
                        name = personal_ladies_modifier
                        duration = -1
                        stacking = yes
                    }
                }
        }
    }
   
    death_effect = {
        liege = {
            remove_character_modifier = personal_ladies_modifier
                subtract_variable = {
                    which = ladies_stacks_counter
                    value = 1
                }
                set_variable = {
                    which = temporary_ladies_stacks_counter
                    value = 0
                }
                while = {
                    limit = {
                        check_variable = {
                            which = ladies_stacks_counter
                            which > temporary_ladies_stacks_counter
                        }
                    }
                    change_variable = {
                        which = temporary_ladies_stacks_counter
                        value = 1
                    }
                    add_character_modifier = {
                        name = personal_ladies_modifier
                        duration = -1
                        stacking = yes
                    }
                }
        }
    }

    message = no
}
 
Last edited:
So I tested our problem on a few more minor-titles...I was able to assign the 'eunuch' title to the appropriate character, but after using the console to remove the trait they simply wouldnt resign the title even though they clearly no longer have the requirements, I also did this with 'court dwarf'...And I repeated the test on court educator which basically only requires a minimum of "5 learning", once the character went below 5 learning they still kept their title....I waited a good 2 years with no results in resignation...It seems the engine doesn't force out those that no longer fit the 'allowed to hold', and the character will only retire the minor-title through event or death or relocation.

I also noticed in my docs
#lose_effect: fires when a title is lost through most causes
as opposed to the wiki
#lose_effect: Fires when a title is lost if allowed_to_hold evaluates to false

I further tested how the engine behaves differently regarding "lose_, retire_, and death_effect...

To test this I added to the code for 'lady'
#gain_effect = add_trait fair/ add_trait chaste/ add_trait honest
#lose_effect = remove_trait chaste
#retire_effect = remove_trait honest
#death_effect = remove trait fair

And then tested a few known ways for the minor-title to be lost

If the 'lady' is #moved to another court= "lose_effect"
if the 'lady' is #imprisoned= "lose_effect"
if the 'lady' is #forced to resign= "lose_effect", with a ?hard-coded? "revoked my honorary title"
if the 'lady' is #killed/dies= 'death_effect', this is important because it seems to not trigger the 'lose_effect' like every other loss of title instance.

(have not found an instance yet of 'retire_effect' actually taking precedence over 'lose_effect')
 
Last edited:
So I tested our problem on a few more minor-titles...I was able to assign the 'eunuch' title to the appropriate character, but after using the console to remove the trait they simply wouldnt resign the title even though they clearly no longer have the requirements, I also did this with 'court dwarf'...And I repeated the test on court educator which basically only requires a minimum of "5 learning", once the character went below 5 learning they still kept their title....I waited a good 2 years with no results in resignation...It seems the engine doesn't force out those that no longer fit the 'allowed to hold', and the character will only retire the minor-title through event or death or relocation.

I also noticed in my docs
#lose_effect: fires when a title is lost through most causes
as opposed to the wiki
#lose_effect: Fires when a title is lost if allowed_to_hold evaluates to false

Strange; I've never noticed this on my own, but I've also not been paying attention to stats/traits and minor title loss. The allowed_to_hold block at least is relevant for losing minor titles due to stuff like imprisonment, as I know a Court Physician that you imprison over a botched treatment loses the title despite that not being explicitly coded in the relevant event...

Does the character keep the title if you save and reload? If not, it might be that trait and stat gain/loss doesn't force a minor title validation (potentially coupled with there not being some "Can my minor title holders still hold their titles?" check frequently/at all); I know that trait gain/loss at least doesn't force a government validation (most likely for performance reasons, as trait gain/loss is rather common while vanilla has no instances of traits affecting government eligibility).


(Also, on a non-bug tangent: If being Ugly should disqualify a lady-in-waiting, perhaps being Disfigured (and/or generally maimed) also should disqualify them?)
 
  • 2
Reactions:
Strange; I've never noticed this on my own, but I've also not been paying attention to stats/traits and minor title loss. The allowed_to_hold block at least is relevant for losing minor titles due to stuff like imprisonment, as I know a Court Physician that you imprison over a botched treatment loses the title despite that not being explicitly coded in the relevant event...

Does the character keep the title if you save and reload? If not, it might be that trait and stat gain/loss doesn't force a minor title validation (potentially coupled with there not being some "Can my minor title holders still hold their titles?" check frequently/at all); I know that trait gain/loss at least doesn't force a government validation (most likely for performance reasons, as trait gain/loss is rather common while vanilla has no instances of traits affecting government eligibility).


(Also, on a non-bug tangent: If being Ugly should disqualify a lady-in-waiting, perhaps being Disfigured (and/or generally maimed) also should disqualify them?)
I did try to save and reload during my court-eunuch (that wasnt a eunuch) test with no results...

Lol-Somehow I knew the 'ugly' thing would get brought up...You are correct in your thinking, but to explain it "ugly" was basically just a place holder for now...So in the future it will probably include traits mentioned and others such as hedonist or cruel etc...I'll also most likely adjust the other parameters like removing the 'add_trait=fair', since the 'lady-in-waiting-modifier' currently includes an attraction opinion bonus....though I would prefer to add traits over modifiers to encourage event triggers, I'm not sure I want to add a genetic trait haphazardly...

Was also thinking about adding some special 'if' instance for particularly special waifu candidates, so lets say you find a lady who is humble, attractive, genius etc all the good stuff....maybe she'll get a better bonus like "add_character_modifier=famous_lady_in_waiting" or "add_trait=beauty" to make her a renowned beauty like the tournament event.
 
Last edited:
If the allowed_to_hold block isn't checked in order to have people lose their minor title for no longer qualifying, you could always write an event that checks for anyone who's lost the prerequisite and then removes it.
 
  • 2
Reactions:
If the allowed_to_hold block isn't checked in order to have people lose their minor title for no longer qualifying, you could always write an event that checks for anyone who's lost the prerequisite and then removes it.
Beat you to it ;-p
If all other options are exhausted, you could write an event that only fires for ladies-in-waiting, which [revokes the title] if they no longer fit the criteria. Set it to trigger in all relevant on_actions, for example: on_yearly_pulse, on_marriage, on_become_imprisoned_any_reason, on_forced_consort, on_character_convert_religion, on_character_convert_secret_religion. This is the least-preferred option because it's probably going to be expensive in terms of performance.
@General Officer: If you do go down this route, I suggest you move the criteria for lady-in-waiting into a scripted_trigger, to avoid code duplication (and therefore make maintenance easier and avoid the weird errors that can result from forgetting to keep every copy of the code completely in sync).
 
  • 2Like
Reactions:
Beat you to it ;-p

@General Officer: If you do go down this route, I suggest you move the criteria for lady-in-waiting into a scripted_trigger, to avoid code duplication (and therefore make maintenance easier and avoid the weird errors that can result from forgetting to keep every copy of the code completely in sync).
I see another archive for me to study thanks for the recommendation...In the immediate here is my quick-fix (so far) event for my ladies to resign...Suppose I could use this for any minor title with a few tweaks...

Code:
namespace = ladiesinwaitingresign

character_event = {
    id = ladiesinwaitingresign.1
    desc = EVTDESC_Ladies_in_waiting_1
    picture = "GFX_evt_council"
    has_minor_title = title_ladyinwaiting
    
    trigger = {
        AND = {
            is_married = yes
            has_character_modifier = lady_in_waiting_modifier
        }
    }    
    
    mean_time_to_happen = {
        months = 2
    }
    
    option = {
        name = EVTOPTA_Ladies_in_waiting_2
        remove_title = title_ladyinwaiting
        remove_character_modifier = lady_in_waiting_modifier
    }
    
}
 
I see another archive for me to study thanks for the recommendation...In the immediate here is my quick-fix (so far) event for my ladies to resign...Suppose I could use this for any minor title with a few tweaks...

Code:
namespace = ladiesinwaitingresign

character_event = {
    id = ladiesinwaitingresign.1
    desc = EVTDESC_Ladies_in_waiting_1
    picture = "GFX_evt_council"
    has_minor_title = title_ladyinwaiting
 
    trigger = {
        AND = {
            is_married = yes
            has_character_modifier = lady_in_waiting_modifier
        }
    }
 
    mean_time_to_happen = {
        months = 2
    }
 
    option = {
        name = EVTOPTA_Ladies_in_waiting_2
        remove_title = title_ladyinwaiting
        remove_character_modifier = lady_in_waiting_modifier
    }
 
}
I spotted an error immediately (has_minor_title is not a valid pre-trigger for events). There may be others - hence why everyone should use the Validator.

---

Otherwise, FYI, MTTH events have a massive impact on performance, so you basically shouldn't ever use them. It's OK I guess for a proof-of-concept, but you'll probably run into issues if you add lots of MTTH events, especially if you continue this pattern of having no pre-triggers. As written, the game needs to continuously evaluate the trigger (because MTTH) for every character in the game (because no pre-trigger).

The best way to do "fix" the MTTH performance issue would be to convert the event into an on_action event.

If you wanted to keep the MTTH, you should at least apply some pre-triggers. I noticed that has_character_flag is a valid pre-trigger for events. So, you could set a character flag on the lady-in-waiting in the gain_effect, remove it in the remove_effect, and use the flag as a pre-trigger for this event.
 
Last edited:
I spotted an error immediately (has_minor_title is not a valid pre-trigger for events). There may be others - hence why I everyone should use the Validator.

---

Otherwise, FYI, MTTH events have a massive impact on performance, so you basically shouldn't ever use them. It's OK I guess for a proof-of-concept, but you'll probably run into issues if you add lots of MTTH events, especially if you continue this pattern of having no pre-triggers. As written, the game needs to continuously evaluate the trigger (because MTTH) for every character in the game (because no pre-trigger).

The best way to do "fix" the MTTH performance issue would be to convert the event into an on_action event.

If you wanted to keep the MTTH, you should at least apply some pre-triggers. I noticed that has_character_flag is a valid pre-trigger for events. So, you could set a character flag on the lady-in-waiting in the gain_effect, remove it in the remove_effect, and use the flag as a pre-trigger for this event.
Ah yes I forgot pre-triggers are very specific. I initially had the pretrigger set to is_female=yes, and the has_minor_title part in other-triggers. I changed it to be more specific to the title in the attempt to save performance...I will look into on_action events and using the charater_flag pre-trigger, or has_job_title
 
Ah yes I forgot pre-triggers are very specific. I initially had the pretrigger set to is_female=yes, and the has_minor_title part in other-triggers. I changed it to be more specific to the title in the attempt to save performance...I will look into on_action events and using the charater_flag pre-trigger, or has_job_title
has_job_title (as an event pre-trigger) has no documentation on the wiki. Pre-triggers are sometimes coded differently, so it's possible that it might work for any minor title, not just for specific council jobs. (In Conditions, has_job_title only works for council jobs - it's distinctly different to has_minor_title.) You should probably run some careful tests before going down this particular route.
 
  • 1Like
Reactions:
Ah yes I forgot pre-triggers are very specific. I initially had the pretrigger set to is_female=yes, and the has_minor_title part in other-triggers. I changed it to be more specific to the title in the attempt to save performance...I will look into on_action events and using the charater_flag pre-trigger, or has_job_title

has_job_title (as an event pre-trigger) has no documentation on the wiki. Pre-triggers are sometimes coded differently, so it's possible that it might work for any minor title, not just for specific council jobs. (In Conditions, has_job_title only works for council jobs - it's distinctly different to has_minor_title.) You should probably run some careful tests before going down this particular route.
Indeed, and thanks for the feedback btw...I fixed our proof of concept MTTH event to have (pre-trigger=only_women/>is_married and 'has_modifier') but it does seem the 'on_action' route is the most efficient...now I have to go and create a whole new folder and everything o_O

While I'm here 'set_character_flag = x' can just be put in the 'minor_titles' section as mentioned for anyone wondering. There isnt a specific 'character_flag folder'.

And does anyone know a quick-fix for applying the commander portraits or other portrait changes to characters? So for example if I give my minor-title 'lady' to a character she might gain a crown or veil in her portrait? So perhaps something like...

Code:
gain_effect = {
?portrait_in_command?
                      or
?portrait_tier = x123?
   }
 
Last edited:
While I'm here 'set_character_flag = x' can just be put in the 'minor_titles' section as mentioned for anyone wondering. There isnt a specific 'character_flag folder'.

Took a while to parse what you mean there. But, yes, set_character_flag is just a generic scripting command - it can be used anywhere and doesn't require any supporting definitions in other text files.

If you haven't already read the Scripting page (and you're going to continue modding for a while), it might be interesting to do so, because it covers a little bit of everything possible in CK2 modding.

And does anyone know a quick-fix for applying the commander portraits or other portrait changes to characters? So for example if I give my minor-title 'lady' to a character she might gain a crown or veil in her portrait? So perhaps something like...

I don't think there's a quick fix.

I believe what you're looking for is ...\interface\portrait_properties\00_portrait_properties.txt . Headgear settings start in line 1908: "# p5 headgear". The reason I say there's no "quick fix" is because there doesn't seem to be a specific section in here that will put a veil on a woman. (Unless one of the "hoods" is actually a veil for female characters?)

If there truly isn't a pre-existing layer for a veil, you'll need to link it up fully in ALL of the relevant portraits (MOST of which are in ...\interface\portraits ). And, for that, you might need to track down (or create!) the image for the veil (in ...\gfx\characters ) and find (or create!) that image's reference (some .gfx file somewhere in ...\gfx\).

There's a reason I don't get into UI modding...
 
Ah yes I forgot pre-triggers are very specific. I initially had the pretrigger set to is_female=yes, and the has_minor_title part in other-triggers. I changed it to be more specific to the title in the attempt to save performance...I will look into on_action events and using the charater_flag pre-trigger, or has_job_title
Another thing, for pre triggers, you want to use only_women = yes instead, according to the documentation here: https://ck2.paradoxwikis.com/Event_modding#Pre-triggers
 
  • 1
  • 1Like
Reactions:
Took a while to parse what you mean there. But, yes, set_character_flag is just a generic scripting command - it can be used anywhere and doesn't require any supporting definitions in other text files.

If you haven't already read the Scripting page (and you're going to continue modding for a while), it might be interesting to do so, because it covers a little bit of everything possible in CK2 modding.



I don't think there's a quick fix.

I believe what you're looking for is ...\interface\portrait_properties\00_portrait_properties.txt . Headgear settings start in line 1908: "# p5 headgear". The reason I say there's no "quick fix" is because there doesn't seem to be a specific section in here that will put a veil on a woman. (Unless one of the "hoods" is actually a veil for female characters?)

If there truly isn't a pre-existing layer for a veil, you'll need to link it up fully in ALL of the relevant portraits (MOST of which are in ...\interface\portraits ). And, for that, you might need to track down (or create!) the image for the veil (in ...\gfx\characters ) and find (or create!) that image's reference (some .gfx file somewhere in ...\gfx\).

There's a reason I don't get into UI modding...
Thanks for the info
 
Here is the (unfinished but functional) work we've accomplished so far for the minor-title "knight" and "lady"...thanks again for all the help from everyone. Feel free to use this code for your own game or make suggestions, though it is still a WIP subject to change. Going to make an official mod release eventually, that may include more changes and more minor-titles such as "Falconer", 'Maid of honor", "Herald" etc ...But this is a part-time affair so it may take awhile...

Code:
#Minor_titles

title_personalknight = {
    dignity = 0.45
    show_as_title = yes
    realm_in_name = yes
    grant_limit = 10
    opinion_effect = 10
    revoke_allowed = no

    monthly_salary = 0.5
    monthly_prestige = 0.5

    is_unique = no

    allowed_to_hold = {
        is_adult = yes
        is_ruler = no
        is_female = no
        religion_group = christian
        is_heretic = no
        martial = 8
        learning = 4
        NOR = {
            trait = incapable
            trait = infirm
            trait = imbecile
            trait = possessed
            trait = hunchback
            trait = clubfooted
            trait = dwarf
        }
    }
 
    allowed_to_grant = {
        AND = {
            is_feudal = yes
            religion_group = christian
            OR = {
                martial = 8
                diplomacy = 8
                stewardship = 8
                learning = 8
   
            }
        }
    }
 
    gain_effect = {
 
        add_character_modifier = {
            name = knight_of_the_realm_modifier
            duration = -1
        }
 
        if = {
        limit = { is_lowborn = yes }
        dynasty = father_bastard
        }
 
        liege = {
            add_character_modifier = {
                name = personal_knights_modifier
                duration = -1
                stacking = yes
            }
             if = {
                    limit = {
                        check_variable = {
                            which = knight_stacks_counter
                            value == 0
                        }
                    }
                    set_variable = {
                        which = knight_stacks_counter
                        value = 1
                    }
                }
                else = {
                    change_variable = {
                        which = knight_stacks_counter
                        value = 1
                    }
                }
        }
    }
 
    lose_effect = {
        liege = {
            remove_character_modifier = personal_knights_modifier
                subtract_variable = {
                    which = knight_stacks_counter
                    value = 1
                }
                set_variable = {
                    which = temporary_knight_stacks_counter
                    value = 0
                }
                while = {
                    limit = {
                        check_variable = {
                            which = knight_stacks_counter
                            which > temporary_knight_stacks_counter
                        }
                    }
                    change_variable = {
                        which = temporary_knight_stacks_counter
                        value = 1
                    }
                    add_character_modifier = {
                        name = personal_knights_modifier
                        duration = -1
                        stacking = yes
                    }
                }
        }
    }
 
    retire_effect = {
        liege = {
            remove_character_modifier = personal_knights_modifier
                subtract_variable = {
                    which = knight_stacks_counter
                    value = 1
                }
                set_variable = {
                    which = temporary_knight_stacks_counter
                    value = 0
                }
                while = {
                    limit = {
                        check_variable = {
                            which = knight_stacks_counter
                            which > temporary_knight_stacks_counter
                        }
                    }
                    change_variable = {
                        which = temporary_knight_stacks_counter
                        value = 1
                    }
                    add_character_modifier = {
                        name = personal_knights_modifier
                        duration = -1
                        stacking = yes
                    }
                }
        }
    }
 
    death_effect = {
        liege = {
            remove_character_modifier = personal_knights_modifier
                subtract_variable = {
                    which = knight_stacks_counter
                    value = 1
                }
                set_variable = {
                    which = temporary_knight_stacks_counter
                    value = 0
                }
                while = {
                    limit = {
                        check_variable = {
                            which = knight_stacks_counter
                            which > temporary_knight_stacks_counter
                        }
                    }
                    change_variable = {
                        which = temporary_knight_stacks_counter
                        value = 1
                    }
                    add_character_modifier = {
                        name = personal_knights_modifier
                        duration = -1
                        stacking = yes
                    }
                }
        }
    }

    message = no
}


title_ladyinwaiting = {
    dignity = 0.05
    realm_in_name = yes
    grant_limit = 3
    opinion_effect = 5
    show_as_title = yes

    monthly_salary = 0.5
    monthly_prestige = 0.5

    is_unique = no

    allowed_to_hold = {
        is_adult = yes
        is_female = yes
        is_married = no
        is_pregnant = no
        religion_group = christian
        is_heretic = no
        NOR = {
            trait = incapable
            trait = infirm
            trait = lunatic
            trait = possessed
            trait = hunchback
            trait = clubfooted
            trait = dwarf
            trait = imbecile
            trait = inbred
            trait = ugly
            trait = maimed
            trait = mangled
            trait = one_eyed
            trait = one_handed
            trait = one_legged
            trait = severely_injured
            trait = syphilitic
            trait = leper
            trait = rabies
            trait = cancer
        }
    }
 
    allowed_to_grant = {
        AND = {
            is_feudal = yes
            religion_group = christian
            OR = {
                martial = 8
                diplomacy = 8
                stewardship = 8
                learning = 8
   
            }
        }
    }
 
    gain_effect = {
 
        add_trait = chaste
 
        set_character_flag = lady_in_waiting
 
        add_character_modifier = {
            name = lady_in_waiting_modifier
            duration = -1
        }
 
            if = {
                limit = { trait = fair }                     #<---While I'm here...how should I write the if/else block, to have "lustful" ladies 'not' gain the "chaste" trait?
                add_trait = beauty                          #<?--aka--? #if = { trait = lustful } add_trait = lustful }  else = { add_trait = chaste  }  ????
            }
            if = {
                limit = { is_lowborn = yes }
                dynasty = father_bastard
            }
 
        liege = {
            add_character_modifier = {
                name = personal_ladies_modifier
                duration = -1
                stacking = yes
            }
             if = {
                    limit = {
                        check_variable = {
                            which = ladies_stacks_counter
                            value == 0
                        }
                    }
                    set_variable = {
                        which = ladies_stacks_counter
                        value = 1
                    }
                }
                else = {
                    change_variable = {
                        which = ladies_stacks_counter
                        value = 1
                    }
                }
        }
    }
 
    lose_effect = {
        remove_character_flag = lady_in_waiting
        liege = {
            remove_character_modifier = personal_ladies_modifier
                subtract_variable = {
                    which = ladies_stacks_counter
                    value = 1
                }
                set_variable = {
                    which = temporary_ladies_stacks_counter
                    value = 0
                }
                while = {
                    limit = {
                        check_variable = {
                            which = ladies_stacks_counter
                            which > temporary_ladies_stacks_counter
                        }
                    }
                    change_variable = {
                        which = temporary_ladies_stacks_counter
                        value = 1
                    }
                    add_character_modifier = {
                        name = personal_ladies_modifier
                        duration = -1
                        stacking = yes
                    }
                }
        }
    }
 
    retire_effect = {
        remove_character_flag = lady_in_waiting
        liege = {
            remove_character_modifier = personal_ladies_modifier
                subtract_variable = {
                    which = ladies_stacks_counter
                    value = 1
                }
                set_variable = {
                    which = temporary_ladies_stacks_counter
                    value = 0
                }
                while = {
                    limit = {
                        check_variable = {
                            which = ladies_stacks_counter
                            which > temporary_ladies_stacks_counter
                        }
                    }
                    change_variable = {
                        which = temporary_ladies_stacks_counter
                        value = 1
                    }
                    add_character_modifier = {
                        name = personal_ladies_modifier
                        duration = -1
                        stacking = yes
                    }
                }
        }
    }
 
    death_effect = {
        liege = {
            remove_character_modifier = personal_ladies_modifier
                subtract_variable = {
                    which = ladies_stacks_counter
                    value = 1
                }
                set_variable = {
                    which = temporary_ladies_stacks_counter
                    value = 0
                }
                while = {
                    limit = {
                        check_variable = {
                            which = ladies_stacks_counter
                            which > temporary_ladies_stacks_counter
                        }
                    }
                    change_variable = {
                        which = temporary_ladies_stacks_counter
                        value = 1
                    }
                    add_character_modifier = {
                        name = personal_ladies_modifier
                        duration = -1
                        stacking = yes
                    }
                }
        }
    }

    message = no
}

#place-holder MTTH event for ladies to resign 

namespace = ladiesinwaitingresign               #<---Will probably replace this with an on-action clause, but also looking into promotion mechanics
                                                                        #<--So for example when our "Lady in waiting" gets married, it will replace her minor-title with "Esteemed Lady"
character_event = {
    id = ladiesinwaitingresign.1
    desc = EVTDESC_Ladies_in_waiting_1
    picture = "GFX_evt_council"
    has_character_flag = lady_in_waiting
 
    trigger = {
        OR = {
            is_married = yes
            is_pregnant = yes
        }
    }
 
    mean_time_to_happen = {
        months = 2
    }
 
    option = {
        name = EVTOPTA_Ladies_in_waiting_2
        remove_title = title_ladyinwaiting
        remove_character_modifier = lady_in_waiting_modifier
    }
 
}


#event_modifiers

personal_knights_modifier = {
    monthly_character_piety = 0.1
    monthly_character_prestige = 0.1
    church_opinion = 1
    castle_levy_size = 0.001
    castle_tax_modifier = -0.001
    retinuesize = 1
    combat_rating = 1
    icon = 17
}

knight_of_the_realm_modifier = {
    martial = 2
    combat_rating = 10
    liege_opinion = 10
    church_opinion = 10
    icon = 17
}

lady_in_waiting_modifier = {
    sex_appeal_opinion = 20
    icon = 39
}

personal_ladies_modifier = {
    general_opinion = 5
    icon = 39
}


#localization

#CODE;ENGLISH;FRENCH;GERMAN;;SPANISH;;;;;;;;;x
title_personalknight;Knight;;;;;;;;;;;;;x
title_personalknight_desc; Men that display knightly quality can qualify to serve as the personal household retainers of the local ruler. They are to be legally and justly knighted.;;;;;;;;;;;;;x
personal_knights_modifier;Household Knights;;;;;;;;;;;;;x
personal_knights_modifier_desc;This ruler has gathered a personal retinue of Knights.;;;;;;;;;;;;;x
knight_of_the_realm_modifier;Knight;;;;;;;;;;;;;x
knight_of_the_realm_modifier_desc;Having attained the qualities befitting a knight, this person has been legally and justly knighted.;;;;;;;;;;;;;x
title_ladyinwaiting;Lady;;;;;;;;;;;;;x
title_ladyinwaiting_desc;This maiden has shown promise and is awaiting a good marriage.;;;;;;;;;;;;;x
lady_in_waiting_modifier_desc;This maiden has shown promise and is awaiting a good marriage.;;;;;;;;;;;;;x
lady_in_waiting_modifier;Lady in waiting;;;;;;;;;;;;;x
personal_ladies_modifier;Court Ladies;;;;;;;;;;;;;x
personal_ladies_modifier_desc;This ruler has gathered a notable group of esteemed ladies seeking proper marriages.;;;;;;;;;;;;;x
 
Last edited:
Is papal/cardinal election score hardcoded? I was hoping to alter it