Scripted effect
generic_scheme_process_ending_effect
generic_scheme_process_ending_effect = { FAILURE_EVENT_ID = … FAILURE_EVENT_TYPE = … RESULTS_TOOLTIP = … SUCCESS_EVENT_ID = … SUCCESS_EVENT_TYPE = … }game/common/scripted_effects/00_scheme_scripted_effects.txt, line 262 (192 lines). Parameters: $FAILURE_EVENT_ID$, $FAILURE_EVENT_TYPE$, $RESULTS_TOOLTIP$, $SUCCESS_EVENT_ID$, $SUCCESS_EVENT_TYPE$.
generic_scheme_process_ending_effect is a scripted effect in Crusader Kings III, written at line 262 of its file. A call passes 5 parameters: FAILURE_EVENT_ID, FAILURE_EVENT_TYPE, RESULTS_TOOLTIP, SUCCESS_EVENT_ID and SUCCESS_EVENT_TYPE. The game's script calls it in 3 places, among them scheme_critical_moments.1001 (event), scheme_critical_moments.2611 (event) and scheme_critical_moments.2621 (event). Its body carries 1 text of the game's own for the player. Patch 1.20.1.2, from game/common/scripted_effects/00_scheme_scripted_effects.txt.
The comment above it in the file
Sort the ending for a scheme.
What it does
scheme_target_culture ?= { … }scheme_target_faith ?= { … }scheme_target_title ?= { … }- …% chance of:
If a check the game hides passes: the same again (1 line)
scheme_owner = { … }
Else if a check the game hides passes: the same again (1 line)
scheme_owner = { … }
Else if
a check the game hides
Then
If
a check the game hides
Then
scheme_owner = { … }
task_contract ?= { complete_task_contract = success_standard }scope:owner:Otherwise
Otherwise
If
a check the game hides
Then
scheme_owner = { … }
task_contract ?= { complete_task_contract = failure_standard }Otherwise
• the game's own tooltip text · ◦ our reading of the script line · code the script where neither exists
“They” is whatever it runs on (the scope it is called in). The scripted triggers and effects it calls link to their own pages; $PARAMETERS$ stay as written: each call fills them in.
The script as written (120 lines of game script)
generic_scheme_process_ending_effect = {
# Grab our scopes.
save_scope_as = scheme
scheme_owner = { save_scope_as = owner }
## Targets.
scheme_target_character ?= {
save_scope_as = target
save_scope_as = target_character
}
scheme_target_culture ?= {
save_scope_as = target
culture_head ?= { save_scope_as = target_character }
}
scheme_target_faith ?= {
save_scope_as = target
main_rite.head_of_rite ?= { save_scope_as = target_character }
}
scheme_target_title ?= {
save_scope_as = target
if = {
limit = { exists = holder }
holder = { save_scope_as = target_character }
}
else = {
title_capital_county.holder = { save_scope_as = target_character }
}
}
# Success roll.
random = {
chance = scheme_success_chance
custom_tooltip = $RESULTS_TOOLTIP$
save_scope_value_as = {
name = scheme_successful
value = yes
}
# Interception saves.
## Unique saves roll.
### E.g., your dog flings itself in front of an assassin for you.
if = {
limit = { is_savable_murder_scheme_trigger = yes }
# We use a scripted effect so that mods can overwrite it without overwriting the whole block.
scheme_unique_interception_roll_effect = yes
}
## Repeatable saves roll.
### E.g., your bodyguard flings itself in front of an assassin for you.
if = {
limit = { is_savable_murder_scheme_trigger = yes }
random = {
chance = scope:target.scheme_intercept_repeatable_chance_total_value
save_scope_value_as = {
name = interception_repeatable
value = yes
}
}
}
}
# Secrecy roll.
## We check this after an interception so that, if a successful scheme is intercepted, we can boost its success a little to compensate.
if = {
limit = { is_type_secret = yes }
## First, determine our secrecy value.
save_scope_value_as = {
name = discovery_chance
value = {
value = 100
subtract = scheme_secrecy
# Boost this up a bit if the scheme was intercepted.
if = {
limit = {
OR = {
exists = scope:interception_unique
exists = scope:interception_repeatable
}
}
add = -30
}
# And make sure there's always _some_ risk.
min = 5
}
}
random = {
chance = scope:discovery_chance
custom_tooltip = scheme_remain_secret_roll_tt
save_scope_value_as = {
name = scheme_discovered
value = yes
}
# Grab an exposer.
if = {
limit = { exists = scope:target.host }
scope:target.host = { save_scope_as = murder_exposer }
}
else = {
scope:target_character = { save_scope_as = murder_exposer }
}
# Set up assorted cosmetics for murders.
scope:owner = {
# Portraits.
save_scope_as = owner_to_reveal
# Plus a flavour scope we use.
random_memory = {
limit = {
has_memory_category = negative
has_memory_participant = scope:target_character
NOR = { # These read poorly
has_memory_type = became_rivals
has_memory_type = became_nemesis
}
}
save_scope_as = bad_memory
}
}
}
}
# Process ending on_actions.
## Scheme intercepted by a unique flag, stopping a killing at the last moment.
if = {
limit = { exists = scope:interception_unique }
scheme_owner = {
trigger_event = { on_action = pick_unique_murder_intercept_on_action }As written in game/common/scripted_effects/00_scheme_scripted_effects.txt.
The first 120 of its 192 lines; the rest is in game/common/scripted_effects/00_scheme_scripted_effects.txt from line 262.
Where it is used
Every place in common/, events/ and history/ that calls generic_scheme_process_ending_effect.
Source: game/common/scripted_effects/00_scheme_scripted_effects.txt and every file of common/, events/ and history/ that calls it, Crusader Kings III 1.20.1.2.