Yep, this is doable. You just need a way to grab the right realm/title/court, and then it's a simple
if
statement to add and remove traits.
If you want to do it in your own court (or the root character's court, more specifically), it should be as simple as just an effect to grab all courtiers/guests and vassals.
Code:
every_courtier_or_guest = { # Grab every courtier or guest
if = { # Remove any conflicting traits
limit = {
has_trait = callous
}
remove_trait = callous
}
else_if = {
limit = {
has_trait = sadistic
}
remove_trait = sadistic
}
add_trait = compassionate # Then add the desired trait
}
every_vassal_or_below = { # Do the same for all vassals and their vassals; if you also want to do it to their courts, you can just add the above effect into this one, doing it to all of their courtiers too
if = {
limit = {
has_trait = callous
}
remove_trait = callous
}
else_if = {
limit = {
has_trait = sadistic
}
remove_trait = sadistic
}
add_trait = compassionate
}
As an example, say for some reason I wanted to write an event where one of my children who is at a distant court turns everyone in their new realm (above and below them) into a reveler.
Code:
random_child = { # Scope into a character
limit = {
NOT = { is_in_the_same_court_as = root } # For this, I want a character who is in a different court as a ruler, spouse, hostage, guest, etc.
}
top_liege = { # Find their highest-level liege...
if = { # Make them a reveler
limit = { NOT = { has_trait = lifestyle_reveler } }
add_trait = lifestyle_reveler
}
every_courtier_or_guest = { # And make all their courtiers/guests revelers
if = {
limit = { NOT = { has_trait = lifestyle_reveler } }
add_trait = lifestyle_reveler
}
}
every_vassal_or_below = { # And make all vassals revelers, as well as those vassals' own courtiers
if = {
limit = { NOT = { has_trait = lifestyle_reveler } }
add_trait = lifestyle_reveler
}
every_courtier_or_guest = {
if = {
limit = { NOT = { has_trait = lifestyle_reveler } }
add_trait = lifestyle_reveler
}
}
}
}
}
I hope that's helpful. If you need more direct advice, let me know and I can walk you through a more specific situation. But basically, just find a way to grab the right character with a list builder (e.g.,
every_vassal_or_below
,
every_courtier_or_guest
, basically anything that is
random_
or
every_
), or an existing scope (e.g., save a scope called
scope:child
and then do it to them), or by selecting a specific character with
character:123456
(you can find their specific charcter ID in the history files).