• 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.
I'm looking for a way to check if two characters have the same name or not, all I've found is same_regnal_name. The information says it's just defined by first name, so will it work for unlanded characters? If not, what else can I use?

No idea, seeing as vanilla makes no use of that condition. I'd be interested in knowing if it works, though.
 
  • 1
Reactions:
No idea, seeing as vanilla makes no use of that condition. I'd be interested in knowing if it works, though.
Following up on this, I created a targeted decision, with third_party_potential being same_regnal_name = ROOT, and the third party does in fact only show those with the same first name, despite both being landless and untitled!

It also shows the original target (since by definition he has the same name as himself), so you'd want to put in NOT = { character = ROOT } as well.
 
  • 2
Reactions:
Hey everyone, coming back to CK2 and modding/scripting so a bit rusty...I just want to get a simple event running basically so I can give Females titles and land without having to change so many laws first. Something like this....

namespace = entitledladies

character_event = {
id = entitledladies.1
desc = Standin Text
picture = "GFX_evt_council"
only_playable = yes <-------What is only_player? This is just for me rn

trigger = {
primary_title = {
AND = {
is_feudal = yes
religion_group = christian
is_heretic = no
has_law = status_of_woman_2 #<------So basically I just want an event to trigger when I get to status of woman 2, and change the inheritance laws to absolute cognatic/elective.

OR = {
martial = 24
diplomacy = 24
stewardship = 24
learning = 24

}
}
}
}

mean_time_to_happen = {
months = 1
}

option = {
name = yes
add_law = true_cognatic_succession #<----I got this to work before, rn it pretends to work but not really
}

}

#Any help is much appreciated
 
Hey everyone, coming back to CK2 and modding/scripting so a bit rusty...I just want to get a simple event running basically so I can give Females titles and land without having to change so many laws first. Something like this....

namespace = entitledladies

character_event = {
id = entitledladies.1
desc = Standin Text
picture = "GFX_evt_council"
only_playable = yes <-------What is only_player? This is just for me rn

trigger = {
primary_title = {
AND = {
is_feudal = yes
religion_group = christian
is_heretic = no
has_law = status_of_woman_2 #<------So basically I just want an event to trigger when I get to status of woman 2, and change the inheritance laws to absolute cognatic/elective.

OR = {
martial = 24
diplomacy = 24
stewardship = 24
learning = 24

}
}
}
}

mean_time_to_happen = {
months = 1
}

option = {
name = yes
add_law = true_cognatic_succession #<----I got this to work before, rn it pretends to work but not really
}

}

#Any help is much appreciated
Welcome back to the headache that is CK2 scripting :D For future reference, you can put code in [ code][ /code] tags (without the spaces). It also helps us understand your code better if you try to format it with indents.

only_playable doesn't limit to only the player, it limits it to characters that a player could play. In other words, feudal lords of count tier or higher or merchant republic leaders or patricians. You want ai = no to limit it to the player.

Succession laws were always a headache for me to deal with too. The first thing I can think of is that maybe your character doesn't meet the potential or allow blocks in \common\laws\succession_laws.txt.
 
Welcome back to the headache that is CK2 scripting :D For future reference, you can put code in [ code][ /code] tags (without the spaces). It also helps us understand your code better if you try to format it with indents.

only_playable doesn't limit to only the player, it limits it to characters that a player could play. In other words, feudal lords of count tier or higher or merchant republic leaders or patricians. You want ai = no to limit it to the player.

Succession laws were always a headache for me to deal with too. The first thing I can think of is that maybe your character doesn't meet the potential or allow blocks in \common\laws\succession_laws.txt.
Cool thanks for the tips, I've only tested this on random starts at the beginning so I probably am not meeting some criteria...I especially wanted to make sure I didn't write a completely broken line of code...Like I cant remember when to use things like >> add_law = 123 >>add_law = {name = law123} if you know what I mean...Appreciate the help so far.

Update = https://forum.paradoxplaza.com/forum/threads/modding-quick-questions.589686/page-2056#post-28701934
I've already asked this question before so this should help, I think this was the original scripting that actually worked...Ill probably be able to work with this and fix it up
 
Last edited:
Two questions regarding diplomatic_immunity = yes:

- Does it only protect you from the hardcoded hostile diplomatic interactions, or from all comparable effects, i.e. would something like imprison = ROOT fail if diplomatic_immunity = yes for the scoped character?

- What exactly are "hostile diplomatic interactions"? The wiki lists imprisonment and title revokation, but does it also cover e.g. war declaration, the assassination button, vassal retraction, or execution?
 
#
Code:
CUSTOM_POWER;Power:$NUM$;;;;;;;;;;;;;x
# POWER_PANEL;[GetPower];;;;;;;;;;;;;x
# 00_customizable_localisation_Power..txt
defined_text = {
    name = GetPower

    use_first_valid = yes # Defaults to no
    text = {
        trigger = {
            relative_power = {
                who = FROM
                power >= 0.0
            }
        }
        localisation_key = CUSTOM_POWER

    }
}
"How do I transfer the 'Power' value to the localisation_key value?"
Output:
Power:NO_TEXT_FOR_KEY NUM
Expect:
Power:4.0
 
Code:
defined_text = {
    name = GetPower

    use_first_valid = yes # Defaults to no
    export_to_variable = {
        which = myvar
        value = holding_total_levy
        who = THIS
    }
    text = {
        trigger = {
            check_variable = {
                which = myvar value > 0
            }
        }
        localisation_key = [THIS.myvar.GetValue]

    }
}
Can 'export_to_variable' be used in defining 'defined text'? What should be the 'who' value?
 
Last edited:
Does anyone know if or where I can edit the parameters for "automatic empire disintegration"...Its tied to an event in EMF, I suppose i could just disable the event...But I'd rather modify the "AED" threshold for empires to be dissolved when their realm size goes below a certain amount.
 
Code:
defined_text = {
    name = GetPower

    use_first_valid = yes # Defaults to no
    export_to_variable = {
        which = myvar
        value = holding_total_levy
        who = THIS
    }
    text = {
        trigger = {
            check_variable = {
                which = myvar value > 0
            }
        }
        localisation_key = [THIS.myvar.GetValue]

    }
}
Can 'export_to_variable' be used in defining 'defined text'? What should be the 'who' value?

custom_loc as a whole cannot take any commands, so you need to be exporting the variable somewhw

Additionally, defined_text always points at a loc tag in vanilla to my knowledge, and might not be able to have "raw" [<something>] in it.

Does anyone know if or where I can edit the parameters for "automatic empire disintegration"...Its tied to an event in EMF, I suppose i could just disable the event...But I'd rather modify the "AED" threshold for empires to be dissolved when their realm size goes below a certain amount.

Since it isn't vanilla you're better off asking in the relevant mod's thread or going through the files of the mod in question.
 
custom_loc as a whole cannot take any commands, so you need to be exporting the variable somewhw

Additionally, defined_text always points at a loc tag in vanilla to my knowledge, and might not be able to have "raw" [<something>] in it.



Since it isn't vanilla you're better off asking in the relevant mod's thread or going through the files of the mod in question.
Funny thing is my realm size was 99/100, and I had a castle under construction...But I managed to post-pone the event by going to war until i had100...because the trigger has war=no
 
Code:
# 00_army_triggered_modifiers.txt
character_army_trigger ={
    potential = {
        character = FROM
    }
    FROM = {
        export_to_variable = {
            which = armyNum
            value = holding_total_levy
            who = FROM
        }
    }
}
# localisation.csv
CHAR_AGE;[THIS.armyNum.GetValue]\nAge
I tried exporting the value in the above code but the code didn't work. My wish is to show the army number in the character info tooltip. I have no idea where to use to export value.
 
Code:
# 00_army_triggered_modifiers.txt
character_army_trigger ={
    potential = {
        character = FROM
    }
    FROM = {
        export_to_variable = {
            which = armyNum
            value = holding_total_levy
            who = FROM
        }
    }
}
# localisation.csv
CHAR_AGE;[THIS.armyNum.GetValue]\nAge
I tried exporting the value in the above code but the code didn't work. My wish is to show the army number in the character info tooltip. I have no idea where to use to export value.

Triggers are also not capable of taking commands; they are per definition made up of conditions.

What you're trying to do sounds both redundant (you can already see a breakdown of troops in the character window) and like a performance nightmare (the exporting can't only happen on mouseover, and if you want it to be accurate you need frequent updates for every character).
 
death effect does not trigger succession immediately, I have to wait for a day, is it possible to trigger it with death effect?

If I'm understanding the question correctly, no.
 
I'm not following. Using the death command always immediately triggers death and succession for me. Is this about the random_accident_death_effect scripted effect? That uses the death command too, so I'm not sure why that wouldn't be instant as well.
 
Nobody getting traits except inherited traits

Hi y'all, in my overhaul mod with modded traits, newly generated characters simply stop getting traits. The exception is those that are inherited. Everything else that is supposed to fire over the years doesn't, including education.
 
Nobody getting traits except inherited traits

Hi y'all, in my overhaul mod with modded traits, newly generated characters simply stop getting traits. The exception is those that are inherited. Everything else that is supposed to fire over the years doesn't, including education.
If it's an overhaul mod, there's no easy way to pinpoint one thing. For education traits not showing up on adulthood, that could be an issue with an on_action firing. Have you altered the on_actions file?
 
Nobody getting traits except inherited traits

Hi y'all, in my overhaul mod with modded traits, newly generated characters simply stop getting traits. The exception is those that are inherited. Everything else that is supposed to fire over the years doesn't, including education.
Very uneducated, quick guess :
Your traits file(s) need to have a different name (including numbers) than vanilla trait files or include all traits.
I suspect that's not the case. At least that's a standard cause for mods missing traits in-game.
 
I have a custom religion that the player can found by decision. I would like to randomly decide what its holy sites are based on proximity to the player at the time the religion is founded. (Similar to how Alternate Start randomly generates holy sites based on proximity to centers of that religion.)

I know of the set_holy_site command, but I'm not sure how to tell the game to choose holy sites based on proximity in the same manner as Alternate Start's holy site randomization. Can someone point me in a direction for this, please? Thanks.

The holy_site_spread parameter in \common\alternate_start\01_spread.txt gives some ideas, but I'm completely lost on how to translate that to a scripted command activated by the religion-founding decision.