Scripted effect
raise_diarch_opinion_with_loyalty_update_effect
raise_diarch_opinion_with_loyalty_update_effect = { OPINION_AMOUNT = … OPINION_TYPE = … }game/common/scripted_effects/00_diarchy_scripted_effects.txt, line 1968 (109 lines). Parameters: $OPINION_AMOUNT$, $OPINION_TYPE$.
raise_diarch_opinion_with_loyalty_update_effect is a scripted effect in Crusader Kings III, written at line 1968 of its file. A call passes 2 parameters: OPINION_AMOUNT and OPINION_TYPE. The game's script calls it in 9 places, among them … Second Capital (event bp2_yearly.0611), A Tool for the Wielding (event bp2_yearly.0661) and Gifts for the … (event bp2_yearly.0621). Its body carries 11 texts of the game's own for the player. Patch 1.20.1.2, from game/common/scripted_effects/00_diarchy_scripted_effects.txt.
The comment above it in the file
Fire a tooltip saying what effect this'll have on regent opinion. We don't need to use this _every_where, as otherwise it'd have to supplant the opinion effect entirely, but it's cool to use it in any specific regency events where flat opinion might be a nicer gain than usual.
What it does
Every line of it is script with no tooltip text: the script is below.
The script as written (109 lines of game script)
raise_diarch_opinion_with_loyalty_update_effect = {
# Check the current opinion.
diarch = {
save_opinion_value_as = {
name = diarch_old_opinion
target = prev
}
}
# Plus, save $OPINION_AMOUNT$ so that we can use it in subsequent script values.
save_scope_value_as = {
name = opinion_amount
value = $OPINION_AMOUNT$
}
# Process the loyalty update tooltip.
diarch = {
# Self-interested.
## Hates you too much to be able to tell.
if = {
limit = {
diarch_loyalty <= diarch_loyalty_visibly_disloyal_threshold
scope:diarch_old_opinion <= -100
scope:opinion_amount >= 1
}
liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.self_interested.overflow_edgecase }
}
### Since save_opinion_value_as doesn't account for overspill past -100, and as we've got some special conditions that make the move from -100 to -99 very dramatic under certain circumstances, we need to have this vague option to cover up systemic inaccuracies.
## Self-interested remains static.
else_if = {
limit = {
diarch_loyalty <= diarch_loyalty_visibly_disloyal_threshold
raise_diarch_opinion_with_loyalty_update_value <= diarch_loyalty_visibly_disloyal_threshold
}
liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.self_interested.remains_static }
}
## Self-interested to selfless.
else_if = {
limit = {
diarch_loyalty <= diarch_loyalty_visibly_disloyal_threshold
raise_diarch_opinion_with_loyalty_update_value >= diarch_loyalty_visibly_loyal_threshold
}
liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.self_interested.to_selfless }
}
## Self-interested to situational.
else_if = {
limit = { diarch_loyalty <= diarch_loyalty_visibly_disloyal_threshold }
liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.self_interested.to_situational }
}
# Situational.
## Situational to selfless.
else_if = {
limit = {
diarch_has_situational_loyalty_trigger = yes
raise_diarch_opinion_with_loyalty_update_value >= diarch_loyalty_visibly_loyal_threshold
}
liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.situational.to_selfless }
}
## Situational to self-interested.
else_if = {
limit = {
diarch_has_situational_loyalty_trigger = yes
raise_diarch_opinion_with_loyalty_update_value <= diarch_loyalty_visibly_disloyal_threshold
}
liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.situational.to_self_interested }
}
## Situational remains static.
else_if = {
limit = { diarch_has_situational_loyalty_trigger = yes }
liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.situational.remains_static }
}
# Selfless.
## Is too loyal to be able to tell.
else_if = {
limit = {
diarch_loyalty >= diarch_loyalty_visibly_loyal_threshold
scope:diarch_old_opinion >= 100
scope:opinion_amount <= -1
}
liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.selfless.overflow_edgecase }
}
### As above, we need this vague option to account for overspill.
## Selfless remains static.
else_if = {
limit = {
diarch_loyalty >= diarch_loyalty_visibly_loyal_threshold
raise_diarch_opinion_with_loyalty_update_value >= diarch_loyalty_visibly_loyal_threshold
}
liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.selfless.remains_static }
}
## Selfless to self-interested.
else_if = {
limit = {
diarch_loyalty >= diarch_loyalty_visibly_loyal_threshold
raise_diarch_opinion_with_loyalty_update_value <= diarch_loyalty_visibly_disloyal_threshold
}
liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.selfless.to_self_interested }
}
## Selfless to situational.
else_if = {
limit = { diarch_loyalty >= diarch_loyalty_visibly_loyal_threshold }
liege = { custom_tooltip = raise_diarch_opinion_with_loyalty_update_effect.tt.selfless.to_situational }
}
}
# Now, add the new opinion.
reverse_add_opinion = {
target = diarch
modifier = $OPINION_TYPE$
opinion = scope:opinion_amount
}
}As written in game/common/scripted_effects/00_diarchy_scripted_effects.txt.
Where it is used
Every place in common/, events/ and history/ that calls raise_diarch_opinion_with_loyalty_update_effect.
Events (7)
- … Second Capital
bp2_yearly.0611 - A Tool for the Wielding
bp2_yearly.0661 - Gifts for the …
bp2_yearly.0621 - Quid Pro Quo
bp2_yearly.0641 - vizierate.1001
- Whenever You Need …
bp2_yearly.0651
1 more
- Whispered Words
bp2_yearly.0631
Scripted effects inside an event file (2)
- bp2_yearly_0611_charming_roll_for_hook_effect
- bp2_yearly_roll_chance_of_extra_stuff_effect
Source: game/common/scripted_effects/00_diarchy_scripted_effects.txt and every file of common/, events/ and history/ that calls it, Crusader Kings III 1.20.1.2.