Scripted effect
hostile_scheme_monthly_discovery_chance_effect
hostile_scheme_monthly_discovery_chance_effect = yesgame/common/scripted_effects/00_scheme_scripted_effects.txt, line 57 (183 lines). No parameters.
hostile_scheme_monthly_discovery_chance_effect is a scripted effect in Crusader Kings III, written at line 57 of its file. It takes no parameters: hostile_scheme_monthly_discovery_chance_effect = yes. The game's script calls it in 24 places, among them Abduct (scheme), Abduct Foe (scheme) and Challenge Status (scheme). Patch 1.20.1.2, from game/common/scripted_effects/00_scheme_scripted_effects.txt.
The comment above it in the file
What percentage chance is there that a scheme will be discovered per month? tl;dr = generally, 10% of 100 - secrecy rating. So if you have 60% secrecy, that's a 4% chance per month.
What it does
- Else, if all of these hold:
- Conditions › scope:scheme:
If
a check the game hides
Then
scheme_target_character.host = { save_temporary_scope_as = breach_host_temp }
Else if
a check the game hides
Then
scheme_target_title.holder = { save_temporary_scope_as = breach_host_temp }
Otherwise
- Never
- scope:breach_host_temp › If has a Adventurer Government:
court_position:second_camp_officer ?= { save_temporary_scope_as = breach_maker_temp }
- Then:
If
scope:breach_host_temp = scope:ownerscope:owner != scope:target
Then
- …% chance of:
If
scheme_breaches >= scheme_breaches_about_to_hit_limit_value
Then
Otherwise
add_scheme_breach = 1scope:owner:Otherwise
Else if
NOT = { scope:owner = scope:target }NOT = { scope:owner = scope:spymaster }NOT = { scope:owner = scope:spymaster.liege }NOT = { scheme_is_character_agent = scope:spymaster }
Then
- …% chance of:
If
is_scheme_exposed = no
Then
increment_breaches_with_message_effect = yes- scope:target.host: Event hostile_scheme_discovery.2001
Else if
scheme_breaches >= scheme_breaches_about_to_hit_limit_value
Then
add_scheme_breach = 1- scope:target.host: Event hostile_scheme_discovery.1002
Otherwise
- Conditions › scope:scheme:
• 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)
hostile_scheme_monthly_discovery_chance_effect = {
# If we're in the first X months of a scheme, give a grace period.
if = {
limit = {
has_variable = secrecy_grace_period
var:secrecy_grace_period >= 1
}
change_variable = {
name = secrecy_grace_period
add = -1
}
}
# Otherwise we want to start checking for discovery.
else_if = {
# Without a spymaster, you can't discover schemes.
## This isn't tooltipped for the person doing the scheming: communicating it (and when it turns on, and when it turns off) would be erratic and spammy, so we just let them think they're getting nice'n'lucky.
limit = {
scope:scheme = {
# Character
trigger_if = {
limit = { exists = scheme_target_character.host }
scheme_target_character.host = { save_temporary_scope_as = breach_host_temp }
}
# Title
trigger_else_if = {
limit = { exists = scheme_target_title.holder }
scheme_target_title.holder = { save_temporary_scope_as = breach_host_temp }
}
# Fallback
trigger_else = { always = no }
scope:breach_host_temp ?= {
# Second for Adventurers
trigger_if = {
limit = { has_government = landless_adventurer_government }
court_position:second_camp_officer ?= { save_temporary_scope_as = breach_maker_temp }
}
# Spymaster for everyone else
trigger_else = {
cp:councillor_spymaster ?= { save_temporary_scope_as = breach_maker_temp }
}
}
}
}
# Sort scopes.
## Vs. titles.
if = {
limit = { exists = scope:target.holder }
scope:target.holder = { save_scope_as = target }
}
## Vs. characters.
else = {
scope:target = { save_scope_as = target }
}
## Nab the spymaster too.
scope:breach_maker_temp = { save_scope_as = spymaster }
# Alright, now we roll for discovery.
# Save chance for simple debugging
save_scope_value_as = {
name = discovery_chance
value = monthly_scheme_discovery_chance_value
}
## ... if scope:target lives at scope:owner's court.
if = {
limit = {
scope:breach_host_temp = scope:owner
scope:owner != scope:target
NOT = { exists = scope:scheme.var:had_self_court_discovery }
}
random = {
chance = scope:discovery_chance
# Either increment breaches.
if = {
limit = { scheme_breaches >= scheme_breaches_about_to_hit_limit_value }
increment_breaches_with_message_effect = yes
}
# Or expose us generally.
else = {
add_scheme_breach = 1
scope:owner = { play_sound_effect = "event:/DLC/EP3/SFX/Stingers/Scheme_Rework/ep3_mx_sting_schemerework_scheme_suffering_breaches" }
set_variable = {
name = had_self_court_discovery
value = yes
years = 3
}
scope:owner = {
if = {
limit = {
scope:scheme = { is_savable_murder_scheme_trigger = yes }
}
trigger_event = hostile_scheme_discovery.4002
}
else = { trigger_event = hostile_scheme_discovery.4001 }
}
# Flag that we're discovering something so that on-going events don't fire.
save_scope_value_as = {
name = discovery_event_happening
value = yes
}
}
}
}
## ... otherwise they're at different courts.
else_if = {
limit = {
NOR = {
# You won't expose your own Scheme
scope:owner = scope:target
# Spymaster won't expose their own Scheme
scope:owner = scope:spymaster
# Spymaster won't expose *your* (liege's) Scheme
scope:owner = scope:spymaster.liege
# Spymaster won't expose a scheme if they are an agent of it
## Secrecy is still relevant, you can still be discovered, just not on the monthly tick.
scheme_is_character_agent = scope:spymaster
}
}
# Roll to see whether we discover something.
random = {
chance = scope:discovery_chance
# If the scheme isn't exposed, then we do that first.As written in game/common/scripted_effects/00_scheme_scripted_effects.txt.
The first 120 of its 183 lines; the rest is in game/common/scripted_effects/00_scheme_scripted_effects.txt from line 57.
Where it is used
Every place in common/, events/ and history/ that calls hostile_scheme_monthly_discovery_chance_effect.
Schemes (24)
- Abduct
- Abduct Foe
- Challenge Status
- Claim Throne
- Convert to Witchcraft
- Damage Legitimacy
18 more
- Depose
- Disbelieve Mandala
- Elope
- Fabricate Hook
- Generate Claim
- Heist Treasury
- Mug Wealthy Citizenry
- Murder
- Murder Foe
- Overthrow Regent
- Raid Estate
- Seduce
- Seize Realm
- Seize Throne
- Siphon Gold from the Treasury
- Slander
- Steal Artifact
- Steal Herd
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.