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

Rototornik

Private
17 Badges
Jun 21, 2017
12
7
  • Hearts of Iron IV: Cadet
  • Age of Wonders: Planetfall - Revelations
  • Age of Wonders: Planetfall Season pass
  • Age of Wonders: Planetfall Premium edition
  • Age of Wonders: Planetfall Deluxe edition
  • Age of Wonders: Planetfall
  • Surviving Mars: Digital Deluxe Edition
  • Age of Wonders III
  • Surviving Mars
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris
  • War of the Roses
  • Crusader Kings II
  • Leviathan: Warships
  • Darkest Hour
We've all experienced the late game lag. Two centuries, three, sometimes four pass and the game becomes unbearably slow. The culprits are many; inheritance calculations, poor optimization, endless wars, courtiers...
Even though Paradox took some steps in the right direction and introduced the pruning mechanic (or was it there from the start?), it doesn't quite work.
My character's court regularly fills up to 150. Some vassals have up to 200, and one champ had even accumulated a whooping 576 courtiers. Peculiarly, foreign realms didn't seem to have this issue.
The solution, I believed, was to aid the pruning process and ease the load on the CPU.

So I wrote an event that fires for each ruler, kills every unimportant character in his/her/its court, and does the same for every vassal, thus purging every court in the realm.
Nifty, right? The first version worked a bit too well and ended plenty of dynasties, but it also made the game fly.

After some edits it works... most of the time.

Code:
any_courtier = {
        
            limit = {
                is_ruler=no
                has_job_title = no
                has_minor_title = no   
                not={trigger={ any_close_relative ={is_ruler=yes}}}
                or={
                    is_marriage_adult=no
                    is_married=no
                    not={trigger={any_spouse={is_ruler=yes }}}
                    }
                
            }           
            
            death = {death_reason = death_natural}
            
        }

In some courts, it works perfectly. In others, it kills even heirs and ruler's children. In some it doesn't do anything. It even purged the Borjigins, excluding Genghis himself and all but one son.

Can any of you modders help perfect this little tool of mass murder?
Here's the whole thing for those interested:
Code:
#All unimportant courtiers die, starter event

character_event =
{
    id = 108101
    is_triggered_only = yes
    desc = "Purge all unimportant characters, part 1"
    picture = GFX_evt_emissary
    option =
    {
        name = "Purge!"
        root = { character_event = { id = 108102 } }
        any_independent_ruler = { character_event = {hide_window = yes id = 108102 } }   
    }
}

#purge event

character_event =
{
    id = 108102
    desc = "Purge all unimportant characters, part 2"
    picture = GFX_evt_emissary
    is_triggered_only = yes
    option={
        name= "get on with it"
        
        any_courtier = {
        
            limit = {
                is_ruler=no
                has_job_title = no
                has_minor_title = no   
                not={trigger={ any_close_relative ={is_ruler=yes}}}
                or={
                    is_marriage_adult=no
                    is_married=no
                    not={trigger={any_spouse={is_ruler=yes }}}
                    }
                
            }           
            
            death = {death_reason = death_natural}
            
        }
        any_vassal={
                    character_event={ id=108102 }
                    }
    
    }
    
}
 
"NOT"s don't take a "trigger" parameter. You can just do
Code:
NOT = { any_close_relative = { is_ruler = yes }}

Side note, I found the "or" a bit confusing. I assume it's there to make sure only unmarried adults die (that seems to be what it does right now), in which case it'd probably be clearer to just do this:

Code:
any_courtier = {

    limit = {
        is_ruler=no
        has_job_title = no
        has_minor_title = no
        NOT = { any_close_relative = { is_ruler = yes }}
        is_adult = yes
        is_married = no
    }

    death = { death_reason = death_natural }
}
 
"NOT"s don't take a "trigger" parameter. You can just do
Code:
NOT = { any_close_relative = { is_ruler = yes }}

Side note, I found the "or" a bit confusing. I assume it's there to make sure only unmarried adults die (that seems to be what it does right now), in which case it'd probably be clearer to just do this:

Code:
any_courtier = {

    limit = {
        is_ruler=no
        has_job_title = no
        has_minor_title = no
        NOT = { any_close_relative = { is_ruler = yes }}
        is_adult = yes
        is_married = no
    }

    death = { death_reason = death_natural }
}
Hey, thanks!
The OR is to ensure random lowborn kids, unmarried adults, and adults married to non-rulers fall within the limit. Tbh I'm not sure if my logic is sound there, this is my first attempt at modding this.
 
Hey, thanks!
The OR is to ensure random lowborn kids, unmarried adults, and adults married to non-rulers fall within the limit. Tbh I'm not sure if my logic is sound there, this is my first attempt at modding this.

In that case, I don't think it's needed at all - the limit as a whole includes all people who match all the conditions, so adding more conditions to it will only ever cause fewer people to be included. It should be enough to do

Code:
any_courtier = {

   limit = {
        is_ruler=no
        has_job_title = no
        has_minor_title = no
        NOT = { any_close_relative = { is_ruler = yes }}
        NOT = { any_spouse = { is_ruler = yes }}

        # Though I'd probably add these as well:
        # NOT = { any_consort = { is_ruler = yes }}
        # NOT = { any_claim = { always = yes }}
    }

    death = { death_reason = death_natural }
}
 
In that case, I don't think it's needed at all - the limit as a whole includes all people who match all the conditions, so adding more conditions to it will only ever cause fewer people to be included. It should be enough to do

Code:
any_courtier = {

   limit = {
        is_ruler=no
        has_job_title = no
        has_minor_title = no
        NOT = { any_close_relative = { is_ruler = yes }}
        NOT = { any_spouse = { is_ruler = yes }}

        # Though I'd probably add these as well:
        # NOT = { any_consort = { is_ruler = yes }}
        # NOT = { any_claim = { always = yes }}
    }

    death = { death_reason = death_natural }
}
This would kill the spouses of the ruler's children though unless they meet some other condition, if they live in the court of their parent-in-law. And while it may be unlikely, even mortals having great grandchildren (aka not close relatives) is quite plausible.