• 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.
so i have a question. What would you do in an event in order to write an event that will effectively make tribal vassals have two choices under their liege upon their liege death under elective Gavelkind:

First option will be the "Stay a vassal" option which will effectively do nothing and just have the vassal remain a vassal of their liege.

Second option: Will be the independent option which will make the vassal independent of their liege.

i got it working (sort of) when i tried to apply a similar code to the On-death on action event code written more in line for the player instead of the AI making the decision.

but i can't seem to get it working for the On-action on_elective_gavelkind_succession = { } onaction event.

i'm trying to base it off the other events in the game files which does exactly that but for Vassal limit calculations or even the other one which does it for the junior heir in the elective gavelkind succession upon the ruler's death.
#Regular Tribal Vassals can declare independence upon succession of the ruler. character_event = { id = EGS.100 desc = EVTDESC_EGS100 picture = GFX_evt_throne_room border = GFX_event_normal_frame_intrigue is_triggered_only = yes trigger = { top_liege = { OR = { tier = DUKE tier = KING tier = EMPEROR } OR = { has_law = tribal_organization_0 has_law = tribal_organization_1 } has_law = succ_elective_gavelkind is_tribal = yes } is_tribal = yes } immediate = { sound_effect = pagan_reformation } option = { name = EVTOPTB_EGS100 ai_chance = { factor = 100 modifier = { factor = 2 opinion = { who = FROM value = 25 } } modifier = { factor = 2 opinion = { who = FROM value = 50 } } modifier = { factor = 4 trait = content } } } option = { name = EVTOPTA_EGS100 ai_chance = { factor = 100 modifier = { factor = 2 NOT = { opinion = { who = FROM value = -25 } } } modifier = { factor = 2 NOT = { opinion = { who = FROM value = -50 } } } modifier = { factor = 4 trait = ambitious } } set_defacto_liege = THIS } }
I don't see anything obviously wrong with your code, but I'd suggest running it through the Validator if you haven't already.

Reading the entry for on_elective_gavelkind_succession in the Event modding page on the wiki seems to imply that it only fires for secondary heirs, not for all vassals. If that's the case, then you'll want to use another on_action trigger, such as on_death (but with more limits to the trigger to narrow it down to the proper succession type you want it to fire for).

Not related to your question, but you can reduce your code for the top_liege's tier limit by using higher_real_tier_than = COUNT
 
  • 1Like
Reactions:
Does anyone know whether the "Elector Titles Held" modifier is at all accessible to modify outside the MAX_ELECTOR_TITLES_LEGALLY_HELD define? In particular, I'm interested in being able to modify the magnitude.
 
Does anyone know whether the "Elector Titles Held" modifier is at all accessible to modify outside the MAX_ELECTOR_TITLES_LEGALLY_HELD define? In particular, I'm interested in being able to modify the magnitude.
I looked at this a few different ways and couldn't see anything. I suspect it's hardcoded. That's not any kind of certainty, but I guess at least you know someone else looked at it :-/

I can think of a workaround to drastically decrease (or eliminate) the opinion penalty (write your own succession law with electors selected like the HRE's princely elective). However, I can't think of an elegant workaround to either increase or slightly decrease the penalty.
 
How do I have the game scope to the liege of a liege of the current character (any_courtier)?

For instance I want to create a targeted decision to where a landed character abdicates to their liege, that character and all of their courtiers move to the liege's court.

The code I have currently is
Code:
effect = {
            abdicate_to = liege
            move_character = liege
            any_courtier = liege
}

So what this does in game currently is

Current character gives all titles to their liege
Current character move to lieges court
Current character's courtiers move to current character's court that they are already in (which causes them to scatter all over the place because the court is destroyed)

What I want it to do is

Current character gives all titles to their liege.
Current character move to lieges court
Current character's courtiers move to current character's liege's court
 
How do I have the game scope to the liege of a liege of the current character (any_courtier)?

For instance I want to create a targeted decision to where a landed character abdicates to their liege, that character and all of their courtiers move to the liege's court.

The code I have currently is
Code:
effect = {
            abdicate_to = liege
            move_character = liege
            any_courtier = liege
}

So what this does in game currently is

Current character gives all titles to their liege
Current character move to lieges court
Current character's courtiers move to current character's court that they are already in (which causes them to scatter all over the place because the court is destroyed)

What I want it to do is

Current character gives all titles to their liege.
Current character move to lieges court
Current character's courtiers move to current character's liege's court
abdicate_to and move_character are commands, whereas any_courtier is a scope, i.e. something that can be told to do something with a command or checked against various conditions. So your first problem is that liege is not a command either, and you are trying to tell a scope that it is another scope, something that is incorrect in this case and impossible for the code in that manner.

You want something more like.
Code:
any_courtier = { move_character = liege }

However, in this case, that particular code is nonsense, because by definition a courtier is already in their liege's court.

You should probably move the any_courtier part up to before the abdicate_to command.

Code:
effect = {
     liege = {
          ROOT = {
               any_courtier = { move_character = PREVPREV }
               abdicate_to = PREV
               move_character = PREV
          }
     }
}

Scoping to liege from ROOT yields the liege of ROOT, while scoping to any_courtier from ROOT targets courtiers of ROOT. PREV is used to step back in the scope chain. In this case, PREVPREV is stepping two scopes back. The current scope is any_courtier, so stepping one scope back from that is ROOT, and stepping two scopes back from that is liege. Therefore, in this case, PREVPREV points to ROOT's liege and moves all his courtiers there. By moving his courtiers there before he abdicates, you don't get the random scattering. If you have his courtiers move after abdicating, he technically doesn't have any courtiers any more, though that may be an effect that takes an in-game day to fully realize, hence it "moves" them to his just-destroyed court, before scattering as you indicated.

I hope my explanation and code help.
 
  • 2
Reactions:
How do you write a condition that returns true if a title has been newly created (and false if not)? I'm pretty sure there's a way to test for this, but I've run out of ideas...

Background:
  • I'm writing an on_new_holder event which allows characters to resize their dynamically-created merc companies immediately after creation - ie. without altering anything in the vanilla code.
  • The reason is because my dynamic companies have size 10k and therefore have hiring cost >1k, which means no AI ever hires them, so it would be nice to be able to downgrade them to size 1k / hiring cost 100 (or whatever, I'll give options).
  • The fact I'm having to use the very-generic on_new_holder means I want to be as exclusive as possible in my event triggers.
    • I "have" to use on_new_holder because I couldn't find any other on_action which works. Notably, on_create_title doesn't work, probably because dynamic merc titles are created by the band_creator's primary_title and there's no such thing as a title_event.
  • I've tried a LOT of different things, but I didn't document them thoroughly as I went along, so I don't want to write them up here. Suffice it to say that, whenever I try to access the previous title holder (which should be null), it seems like the null scope is always treated in the least-convenient way for my purpose.
 
How do you write a condition that returns true if a title has been newly created (and false if not)? I'm pretty sure there's a way to test for this, but I've run out of ideas...

Background:
  • I'm writing an on_new_holder event which allows characters to resize their dynamically-created merc companies immediately after creation - ie. without altering anything in the vanilla code.
  • The reason is because my dynamic companies have size 10k and therefore have hiring cost >1k, which means no AI ever hires them, so it would be nice to be able to downgrade them to size 1k / hiring cost 100 (or whatever, I'll give options).
  • The fact I'm having to use the very-generic on_new_holder means I want to be as exclusive as possible in my event triggers.
    • I "have" to use on_new_holder because I couldn't find any other on_action which works. Notably, on_create_title doesn't work, probably because dynamic merc titles are created by the band_creator's primary_title and there's no such thing as a title_event.
  • I've tried a LOT of different things, but I didn't document them thoroughly as I went along, so I don't want to write them up here. Suffice it to say that, whenever I try to access the previous title holder (which should be null), it seems like the null scope is always treated in the least-convenient way for my purpose.

<title> = { any_previous_holder = { always = no } } probably works, assuming the current holder isn't included in that scope because of some interesting design approach. The title probably can use e.g. a primary_title scope rather than a specific tag.
 
  • 1
Reactions:
How do you write a condition that returns true if a title has been newly created (and false if not)? I'm pretty sure there's a way to test for this, but I've run out of ideas...

Background:
  • I'm writing an on_new_holder event which allows characters to resize their dynamically-created merc companies immediately after creation - ie. without altering anything in the vanilla code.
  • The reason is because my dynamic companies have size 10k and therefore have hiring cost >1k, which means no AI ever hires them, so it would be nice to be able to downgrade them to size 1k / hiring cost 100 (or whatever, I'll give options).
  • The fact I'm having to use the very-generic on_new_holder means I want to be as exclusive as possible in my event triggers.
    • I "have" to use on_new_holder because I couldn't find any other on_action which works. Notably, on_create_title doesn't work, probably because dynamic merc titles are created by the band_creator's primary_title and there's no such thing as a title_event.
  • I've tried a LOT of different things, but I didn't document them thoroughly as I went along, so I don't want to write them up here. Suffice it to say that, whenever I try to access the previous title holder (which should be null), it seems like the null scope is always treated in the least-convenient way for my purpose.

<title> = { any_previous_holder = { always = no } } probably works, assuming the current holder isn't included in that scope because of some interesting design approach. The title probably can use e.g. a primary_title scope rather than a specific tag.

NOT = { any_previous_holder = { always = yes } } should work in an event fired by on_new_holder, perhaps on_create_title too. Vanilla uses this in k_jerusalem, for the first time someone creates it and gains that ridiculous 5000 prestige.
 
  • 1
Reactions:
<title> = { any_previous_holder = { always = no } } probably works, assuming the current holder isn't included in that scope because of some interesting design approach. The title probably can use e.g. a primary_title scope rather than a specific tag.
I tried a few variations on this, and it didn't work. Specifically:

Code:
    trigger = {
...
        # There is no previous title holder
        # The following do not work:
        #FROM = { any_previous_holder = { always = no } }
        #primary_title = { any_previous_holder = { always = no } }
        #FROMFROM = { always = no }

(The on_action event will pop something up to the band_creator if the trigger succeeds. I can use this in conjunction with a saved game and quitting/reopening CK2 to test multiple different possibilities. If creating a band pops up the dialog - it works. If not, it doesn't work.)

However, the following code seems to work, even though I could've sworn I ruled it out a few hours ago:

Code:
    trigger = {
...

        # There is no previous title holder
        # Current test code:
        NOT = { FROMFROM = { always = yes } } # For on_new_holder, FROMFROM is defined to be the previous holder

This seems theoretically sound to me - does it also look correct to you? (EDIT: Looks like this is pretty much what @Whizzer suggested in his simultaneous post, so it's probably OK.)
 
Code:
    trigger = {
...

        # There is no previous title holder
        # Current test code:
        NOT = { FROMFROM = { always = yes } } # For on_new_holder, FROMFROM is defined to be the previous holder

This seems theoretically sound to me - does it also look correct to you?

Yes, this is how you detect the absence of a certain scope.
 
Yes, this is how you detect the absence of a certain scope.
I tried your exact suggestion, and you might be interested to know that FROM = { NOT = { any_previous_holder = { always = yes } } } does not work! (And neither does primary_title = { NOT = { any_previous_holder = { always = yes } } }.)

I think this might be a case where the any_previous_holder scope has someone in it, even though it really shouldn't.

I guess I'm very very lucky that the devs decided to leave FROMFROM empty as expected...

Full working event code, for posterity:
Code:
# Called from on_new_holder
# ROOT is the character, FROM is the title, FROMFROM is the old holder
character_event = {
    id = EXPDTargetedVanillaMerc.100
    hide_window = yes
    is_triggered_only = yes
    
    trigger = {
        
        #######################################################################################
        #                                                                                     #
        # WARNING: THIS LOGIC IS EXTREMELY DELICATE                                           #
        # A lot of conditions that seem like they should work... actually don't.              #
        # Be sure to test any alterations thoroughly, to ensure they are working as intended. #
        #                                                                                     #
        #######################################################################################
        
        # We only want to continue for newly-created dynamic bloodline/nomad merc companies
        
        # Title is landless merc adventurer with no income siphon
        #  --- Feudal merc companies have a siphon and should not be adventurer titles
        #  --- Base game merc companies should not be adventurer titles and should not have a band_creator (see below)
        FROM = {
            is_landless_type_title = yes
            mercenary = yes
            adventurer = yes
            mercenary_siphon_factor == 0
        }
        
        # There is no previous title holder
        NOT = { FROMFROM = { always = yes } }
        # NB: The following seemingly-correct conditions do not work:
        #FROM = { any_previous_holder = { always = no } }
        #primary_title = { any_previous_holder = { always = no } }
        #FROMFROM = { always = no }
        #FROM = { NOT = { any_previous_holder = { always = yes } } }
        #primary_title = { NOT = { any_previous_holder = { always = yes } } }
        
        # NB: We can't check for the merc captain having "started merc company" char modifier, because this is added after the title is created, ie. after this event is triggered.
        
        # Band creator can in theory create bloodline/nomad merc companies
        # (IE: Copy the from_potential block of the targeted decision to "Send away as mercenary")
        # NB: We can't shortcut this with is_targeted_decision_potential, because there's no way to guarantee that there's another potential target for the decision.
        FROM = {
            band_creator = {
                is_playable = yes
                OR = {
                    has_dlc = "Horse Lords"
                    any_owned_bloodline = {
                        has_bloodline_flag = bloodline_mercenary_traditions
                    }
                }
                is_adult = yes
                prisoner = no
                NOT = { trait = incapable }
                OR = {
                    government = nomadic_government
                    has_character_modifier = mercenary_traditions
                    any_owned_bloodline = {
                        has_bloodline_flag = bloodline_mercenary_traditions
                    }
                }
            }
        }
        
    }
    
    immediate = {
        FROM = {
            band_creator = {
                character_event = { id = EXPDTargetedVanillaMerc.200 }
            }
        }
    }
    
}
 
I tried your exact suggestion, and you might be interested to know that FROM = { NOT = { any_previous_holder = { always = yes } } } does not work! (And neither does primary_title = { NOT = { any_previous_holder = { always = yes } } }.)

I think this might be a case where the any_previous_holder scope has someone in it, even though it really shouldn't.

I guess I'm very very lucky that the devs decided to leave FROMFROM empty as expected...

Full working event code, for posterity:
Code:
# Called from on_new_holder
# ROOT is the character, FROM is the title, FROMFROM is the old holder
character_event = {
    id = EXPDTargetedVanillaMerc.100
    hide_window = yes
    is_triggered_only = yes
    
    trigger = {
        
        #######################################################################################
        #                                                                                     #
        # WARNING: THIS LOGIC IS EXTREMELY DELICATE                                           #
        # A lot of conditions that seem like they should work... actually don't.              #
        # Be sure to test any alterations thoroughly, to ensure they are working as intended. #
        #                                                                                     #
        #######################################################################################
        
        # We only want to continue for newly-created dynamic bloodline/nomad merc companies
        
        # Title is landless merc adventurer with no income siphon
        #  --- Feudal merc companies have a siphon and should not be adventurer titles
        #  --- Base game merc companies should not be adventurer titles and should not have a band_creator (see below)
        FROM = {
            is_landless_type_title = yes
            mercenary = yes
            adventurer = yes
            mercenary_siphon_factor == 0
        }
        
        # There is no previous title holder
        NOT = { FROMFROM = { always = yes } }
        # NB: The following seemingly-correct conditions do not work:
        #FROM = { any_previous_holder = { always = no } }
        #primary_title = { any_previous_holder = { always = no } }
        #FROMFROM = { always = no }
        #FROM = { NOT = { any_previous_holder = { always = yes } } }
        #primary_title = { NOT = { any_previous_holder = { always = yes } } }
        
        # NB: We can't check for the merc captain having "started merc company" char modifier, because this is added after the title is created, ie. after this event is triggered.
        
        # Band creator can in theory create bloodline/nomad merc companies
        # (IE: Copy the from_potential block of the targeted decision to "Send away as mercenary")
        # NB: We can't shortcut this with is_targeted_decision_potential, because there's no way to guarantee that there's another potential target for the decision.
        FROM = {
            band_creator = {
                is_playable = yes
                OR = {
                    has_dlc = "Horse Lords"
                    any_owned_bloodline = {
                        has_bloodline_flag = bloodline_mercenary_traditions
                    }
                }
                is_adult = yes
                prisoner = no
                NOT = { trait = incapable }
                OR = {
                    government = nomadic_government
                    has_character_modifier = mercenary_traditions
                    any_owned_bloodline = {
                        has_bloodline_flag = bloodline_mercenary_traditions
                    }
                }
            }
        }
        
    }
    
    immediate = {
        FROM = {
            band_creator = {
                character_event = { id = EXPDTargetedVanillaMerc.200 }
            }
        }
    }
    
}

I think that means any_previous_holder already accesses the title creator, which makes it slightly unintuitive.
 
I think that means any_previous_holder already accesses the title creator, which makes it slightly unintuitive.
I tried primary_title = { NOT = { any_previous_holder = { NOT = { character = ROOT } } } }, and it works!

So, yes, it appears that any_previous_holder includes the current holder - in this context, anyway. I think that's worth a tentative wiki update.
 
  • 1
Reactions:
In a third party decision, how do you get ROOT to show up at the top of the third-party picker? (So you can see their stats and traits while you are picking the third party.)

(This is present for many vanilla hardcoded decisions - eg. marriage - but I can't think of any vanilla scripted decisions where this is possible, so I have nothing to copy from.)
 
In a third party decision, how do you get ROOT to show up at the top of the third-party picker? (So you can see their stats and traits while you are picking the third party.)

(This is present for many vanilla hardcoded decisions - eg. marriage - but I can't think of any vanilla scripted decisions where this is possible, so I have nothing to copy from.)

It would have to be done by scoring ROOT higher in third_party_score. Does ROOT even show up in the list at all?
 
It would have to be done by scoring ROOT higher in third_party_score. Does ROOT even show up in the list at all?
The scope of the list is set by the third_party_potential block, so you can include anyone you like. Normally, the whole purpose of a third party decision is to pick two different characters to interact with each other, so you would normally want to exclude ROOT from the list to avoid confusion (ROOT interacting with themselves?!). However, you could probably twist the logic to include ROOT in the list.

---

While testing it out I realised that I may have misinterpreted the purpose of the empty part of the third-party picker.

I wanted something like this, where ROOT is placed at the separate section at the top so you can quickly check their age/traits/etc:
20240420125846_1.jpg

Instead, it seems the third-party picker puts whoever is currently selected in the separate section at the top. This explains why it is empty the first time you click it - and, since I rarely change my mind, I was under the impression that it was always empty:
20240420130231_1.jpg20240420130243_1.jpg

---

So, my question is now: Is there a way to change the behaviour of the third-party picker so that it always shows someone who is not in the list? (In this case, I want to show ROOT.)

And, separately: Is it possible to preselect a third-party character, so the player doesn't even have to open the list? (Eg: In the screenshots, it would be nice to always preselect the husband, since that's who I want 99% of the time.) (NB: I tested it and it's not as simple as setting one third party to have a unique highest score.)
 
Last edited:
The scope of the list is set by the third_party_potential block, so you can include anyone you like. Normally, the whole purpose of a third party decision is to pick two different characters to interact with each other, so you would normally want to exclude ROOT from the list to avoid confusion (ROOT interacting with themselves?!). However, you could probably twist the logic to include ROOT in the list.

Not quite, since you always have to use a filter, either based on ROOT or FROM. Most filters tend to reduce the list of potential characters a lot.

So, my question is now: Is there a way to change the behaviour of the third-party picker so that it always shows someone who is not in the list? (In this case, I want to show ROOT.)

There are filters (_including_me) that include ROOT, so long as the third party is filtered based on ROOT.

And, separately: Is it possible to preselect a third-party character, so the player doesn't even have to open the list? (Eg: In the screenshots, it would be nice to always preselect the husband, since that's who I want 99% of the time.) (NB: I tested it and it's not as simple as setting one third party to have a unique highest score.)

No, definitely not possible, unless Paradox implemented this, but didn't bother to document it anywhere. Your guess is as good as mine as to what the script would look like.
 
  • 1
Reactions:
As you can see on my images there is no character in provinces just empty green land, even some that are taken by one faction still have no character in some provinces.

Is there way to fix this? or like a tutorial to personally mod and add more counties or characters?

20240309102857_1.jpg

20240309103412_1.jpg

thank you for your time!
 
As you can see on my images there is no character in provinces just empty green land, even some that are taken by one faction still have no character in some provinces.

Is there way to fix this? or like a tutorial to personally mod and add more counties or characters?

thank you for your time!
That looks heavily modded, so it's possible that there's a mod conflict. To check this: disable all mods except the one mod you're checking, start a new game, and see if the problem is still present.

Beyond that, unfortunately, your description isn't enough for me to understand what you are trying to do. Can you give more details and/or upload your mod?

(You say something about adding new counties, but the province layout looks the same as in the base game, so I don't think you're trying to modify the map. And you say something about adding new characters, but this looks like a game that's been in progress for centuries - pagan kingdom of Wales with capital in Kent - so this doesn't show an attempt to modify the history. Your screenshots suggest you're trying to change something in an ongoing save game, but that directly contradicts your text. IE: Clarification needed!)
 
On the Scopes wiki page, any_trade_route_province is listed as being from a province scope. This confused me (how do you scope to a province on a trade route from another province), so I checked for vanilla instances of it. It's used once in events, in jd_chinese_diplomacy_events.txt, where it's used from a Character scope.

Is this an error on the wiki maybe, or have I misunderstood something?

Assuming that it does work from Character scope, as in that events file, does it find only trade route provinces in one's demesne, or everywhere in your realm?
 
Last edited: