Scripted effect
configure_start_single_combat_effect
configure_start_single_combat_effect = { FATALITY = … FIXED = … INVALIDATION_EVENT = … LOCALE = … OUTPUT_EVENT = … SC_ATTACKER = … SC_DEFENDER = … SC_INITIATOR = … }game/common/scripted_effects/00_single_combat_effects.txt, line 9 (180 lines). Parameters: $FATALITY$, $FIXED$, $INVALIDATION_EVENT$, $LOCALE$, $OUTPUT_EVENT$, $SC_ATTACKER$, $SC_DEFENDER$, $SC_INITIATOR$.
configure_start_single_combat_effect is a scripted effect in Crusader Kings III, written at line 9 of its file. A call passes 8 parameters: FATALITY, FIXED, INVALIDATION_EVENT, LOCALE, OUTPUT_EVENT, SC_ATTACKER, SC_DEFENDER and SC_INITIATOR. The game's script calls it in 52 places, among them Challenge for Artifact (interaction), Challenge to Duel (interaction) and Punish Criminal (interaction). Patch 1.20.1.2, from game/common/scripted_effects/00_single_combat_effects.txt.
What it does
If
a check the game hides
Then
clear_saved_scope = sc_finished
If
scope:sc_attacker != scope:sc_defender
Then
single_combat_apply_default_shirtlessness_effect = { ATTACKER = scope:sc_attacker DEFENDER = scope:sc_defender }scope:sc_attacker:scope:sc_defender:- scope:sc_defender: Event single_combat.0001
Otherwise
error_log = debug_log.single_combat_setup.attacker_and_defender_same_person
• 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)
configure_start_single_combat_effect = {
# DOCUMENTATION
## scope:sc_initiator
### Who started the combat? This is who the output/invalidation events will fire for.
## scope:sc_attacker
### The attacking party.
## scope:sc_defender
### The defending party.
## scope:fatality = flag:default/possible/no/always
### default: always if tribal, no otherwise.
### possible: losing can be fatal, but isn't necessarily.
### no: losing is never fatal.
### always: losing always fatal.
### practice: no death, no wounds.
## scope:fixed = flag:no/flag:sc_attacker/scope:sc_defender
### No: the match uses normal rules.
### scope:sc_attacker: the attacker will always win.
### scope:challenged: the defender will always win.
## scope:locale = flag:XYZ
### These just trigger the event background of the same name. New ones can be added as needed, but should be added across all three events (round, victory, loss/single_combat.0001, single_combat.0031, single_combat.0041), as we can't add a scripted list.
### terrain_scope
### battlefield
### alley_night
### alley_day
### temple
### corridor_night
### corridor_day
### courtyard
### dungeon
### docks
### feast
### market
### tavern
### throne_room
### army_camp
## output event ID
### Which event fires after the combat's completion?
# Sort parties.
$SC_INITIATOR$ = { save_scope_as = sc_initiator }
$SC_ATTACKER$ = { save_scope_as = sc_attacker }
$SC_DEFENDER$ = { save_scope_as = sc_defender }
# Arrange aftermath.
## We're doing this early so we can invalidate well in a sec.
if = {
limit = { exists = scope:sc_finished }
clear_saved_scope = sc_finished
}
save_scope_value_as = {
name = follow_up_event
value = event_id:$OUTPUT_EVENT$
}
save_scope_value_as = {
name = invalidation_event
value = event_id:$INVALIDATION_EVENT$
}
# Invalidation check: have we managed to set scope:sc_attacker and scope:sc_defender to the same person?
## If so, invalidate the duel, because this will cause crashes on Mac due to the duel's logic then looping in on itself later.
### Shocking to hear Mac has problems, I know.
if = {
limit = {
scope:sc_attacker != scope:sc_defender
}
# Make sure they're clean for setup.
hidden_effect = { remove_single_combat_info_effect = yes }
# Set them both to busy for the single combat.
scope:sc_attacker = {
set_variable = {
name = engaged_in_single_combat
value = yes
}
}
scope:sc_defender = {
set_variable = {
name = engaged_in_single_combat
value = yes
}
}
## Then try to take shirts off.
single_combat_apply_default_shirtlessness_effect = {
ATTACKER = scope:sc_attacker
DEFENDER = scope:sc_defender
}
# Set rules.
save_scope_value_as = {
name = fatality
value = flag:$FATALITY$
}
save_scope_value_as = {
name = fixed
value = flag:$FIXED$
}
save_scope_value_as = {
name = locale
value = flag:$LOCALE$
}
## Note where the fight is taking place, if we're using a specific location.
if = {
limit = { scope:locale = flag:terrain_scope }
scope:sc_defender.location = { save_scope_as = background_terrain_scope }
}
# Configure starting bonus/threshold variables.
scope:sc_attacker = {
set_variable = {
name = sc_attacker_injury_bonus
value = starting_injury_bonus
}
}
scope:sc_defender = {
set_variable = {
name = sc_defender_injury_bonus
value = starting_injury_bonus
}
set_variable = {
name = success_threshold
value = starting_success_threshold
}
}
# Configure starting round variables.
scope:sc_attacker = {As written in game/common/scripted_effects/00_single_combat_effects.txt.
The first 120 of its 180 lines; the rest is in game/common/scripted_effects/00_single_combat_effects.txt from line 9.
Where it is used
Every place in common/, events/ and history/ that calls configure_start_single_combat_effect.
Character interactions (5)
Events (46)
- A Challenger
tribal.1003 - A Courtly Gift
court.9001 - A Disgrace to the Gods
fp1_jomsvikings.0041 - A Fool's Feast
bp1_yearly.3202 - A King for a Bard
martial_chivalry.5100 - A Land at War
hold_court.6100
40 more
- A Long Awaited Coup: Gleaming Swords
diarchy.9021 - A Strange Figure
legend_spread_events.8010 - Allegiance, Burped
jason_locale_events.200 - Bandits!
ep3_laamp_flavour_ewan.4001 - Bring Me … Head
laamp_base_contract_schemes.1301 - Burning Rivalry
bp1_yearly.5728 - Challenge Brought: House …
fp3_misc_decisions.0022 - Challenger Approaching
bp2_yearly.5100 - Confronting a Viper
ep3_story_cycle_harrying.3021 - Distant Lands: Arrival
legend_spread_events.8122 - Drunken Brawl
bp1_yearly.5717 - easteregg_event.0001
- Eyes in the Night: Feral Hound
ep3_laamp_flavour_ewan.4062 - For the Sins of a …
bp1_yearly.6000 - Foremost …
court.8160 - Hearty Competition
fp1_yearly.2100 - Home Sweet Home?
ep3_laamps.6001 - Hook, Line...
bp1_yearly.5709 - Hungriest Among the Brood
mpo_nomad_events.1020 - Hunting the Beech Marten
fp2_struggle.2010 - It's Time to D-D-D-D-D-D-D-Duel
single_combat.1004 - Learn Language: Infantile Fables
learn_language_ongoing.1120 - Rescuer
ep3_contract_event.0570 - Return of the King of Thieves
fp2_struggle.2021 - Rightful Lands
hold_court.8210 - Rites of Passage: Duel
bp2_yearly.7021 - single_combat.1001
- single_combat.1002
- Slavers
ep3_laamp_flavour_ewan.4071 - Study Rite: Heretical Tales
study_faith_ongoing.1120 - Suspicious Snickering
trait_specific.8501 - The Bored Berserker
fp1_yearly.2200 - The Final Challenge
tgp_japan_yearly_events.1120 - The Frontier Beckons
fp3_yearly.8004 - The Kurultai
coronation_events.6121 - The Law in …
ep3_laamp_flavour_ewan.3071 - The Two …s
bp1_yearly.9010 - Trial-by-Combat: …
fp1_tbc.0001 - Wanderlust
fp1_yearly.2000 - Your Money or Your Life
ep3_story_cycle_harrying.3010
Scripted effects inside an event file (1)
- ep3_laamp_flavour_ewan_2091_start_duel_to_death_effect
Source: game/common/scripted_effects/00_single_combat_effects.txt and every file of common/, events/ and history/ that calls it, Crusader Kings III 1.20.1.2.