CK3 DatabaseCrusader Kings III · 1.20.1.2 “Crozier” · unofficial
Silk & Silverout Tue, Nov 17What's free, what needs the DLC, price →

Scripted effect · Tours and Tournaments files

tournament_contest_versus_battle_effect

tournament_contest_versus_battle_effect = { CHOOSE_WINNER = … CONTEST = … INJURY_CHANCE = … }

game/common/scripted_effects/04_dlc_ep2_tournament_effects.txt, line 2125 (377 lines). Parameters: $CHOOSE_WINNER$, $CONTEST$, $INJURY_CHANCE$.

tournament_contest_versus_battle_effect is a scripted effect in Crusader Kings III, in the Tours and Tournaments files, written at line 2125 of its file. A call passes 3 parameters: CHOOSE_WINNER, CONTEST and INJURY_CHANCE. The game's script calls it in 2 places, among them contest_events.0802 (event) and contest_events.0830 (event). Patch 1.20.1.2, from game/common/scripted_effects/04_dlc_ep2_tournament_effects.txt.

The comment above it in the file

Randomize versus bout outcome based on skill

What it does

  • If

    • scope:choose_winner = yes

    Then

  • scope:activity › Depending on activity.var:contest versus progress:
    • When activity.var:contest versus progress is 0:
      • add_to_guest_subset = { name = semi_finalist target = scope:contest_winner phase = tournament_phase_$CONTEST$ }
    • When activity.var:contest versus progress is 1:
      • add_to_guest_subset = { name = finalist target = scope:contest_winner phase = tournament_phase_$CONTEST$ }
    • When activity.var:contest versus progress is 2:
      • add_to_guest_subset = { name = winner target = scope:contest_winner phase = tournament_phase_$CONTEST$ }
      • add_to_guest_subset = { name = second_place target = scope:contest_loser phase = tournament_phase_$CONTEST$ }
  • If

    • scope:injury_chance ?= yes

    Then

  • If

    • One of these

      • exists = scope:sabotage_murder_wound
      • or

        exists = scope:sabotage_murder_death

    Then

    • Depending on exists:
      • When exists is scope:sabotage murder wound:
      • When exists is scope:sabotage murder death:
    • If

      • scope:host: Is played by the AI

      Then

  • scope:contest_winner:
    • trigger_event = { on_action = contest_bout_$CONTEST$_outcome_pulse }
  • scope:contest_loser:
    • trigger_event = { on_action = contest_bout_$CONTEST$_outcome_pulse }
  • scope:activity:

• 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)
tournament_contest_versus_battle_effect = {
	save_temporary_scope_value_as = {
		name = choose_winner
		value = $CHOOSE_WINNER$
	}
	save_temporary_scope_value_as = {
		name = injury_chance
		value = $INJURY_CHANCE$
	}
	set_variable = {
		name = progress_to_victory
		value = progress_to_victory_active_contestant_value
	}
	var:next_versus_match = {
		save_scope_as = next_versus_match
		if = {
			limit = { is_alive = yes }
			set_variable = {
				name = progress_to_victory
				value = progress_to_victory_active_contestant_value
			}
		}
	}
	# Determine winner
	if = {
		limit = { scope:choose_winner = yes }
		random_list = {
			# ROOT WINS
			10 = {
				trigger = {
					is_alive = yes
					save_temporary_scope_as = versus_matchee_temp
				}
				desc = tournament_contest_versus_battle_win_tt
				modifier = {
					exists = var:progress_to_victory_score
					add = var:progress_to_victory_score
				}
				modifier = {
					exists = var:contest_aptitude
					add = {
						value = var:contest_aptitude
						divide = 2
					}
				}
				# Prefer unmatched rivals of players to not get knocked out
				modifier = {
					is_ai = yes
					scope:next_versus_match = { is_ai = yes }
					scope:activity = {
						any_guest_subset = {
							name = contestant
							exists = var:progress_to_victory
							this != scope:next_versus_match
							is_ai = no
							has_any_bad_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
					factor = 2
				}
				modifier = {
					has_variable = murder_sabotage_target
					factor = 0.5
				}
				# If aptitude is higher, more likely to win
				modifier = {
					exists = var:contest_aptitude
					exists = scope:next_versus_match.var:contest_aptitude
					var:contest_aptitude > scope:next_versus_match.var:contest_aptitude
					factor = 2
				}
				# If have at least double aptitude of other character, you win
				modifier = {
					exists = var:contest_aptitude
					exists = scope:next_versus_match.var:contest_aptitude
					contest_aptitude_fetch_half_value >= scope:next_versus_match.var:contest_aptitude
					add = 1000
				}
				show_chance = no
                versus_contest_round_outcome_tooltip_effect = {
					WINNER = root
					LOSER = scope:next_versus_match
				}
				save_scope_as = contest_winner
				scope:next_versus_match = { save_scope_as = contest_loser }
			}
			# VERSUS CONTESTANT WINS
			10 = {
				desc = tournament_contest_versus_battle_lose_tt
				trigger = {
					scope:next_versus_match = { is_alive = yes }
				}
				modifier = {
					exists = scope:next_versus_match.var:progress_to_victory_score
					add = scope:next_versus_match.var:progress_to_victory_score
				}
				modifier = {
					exists = scope:next_versus_match.var:contest_aptitude
					add = {
						value = scope:next_versus_match.var:contest_aptitude
						divide = 2
					}
				}
				# Prefer unmatched rivals of players to not get knocked out
				modifier = {
					is_ai = yes
					scope:next_versus_match = { is_ai = yes }
					scope:activity = {
						any_guest_subset = {
							name = contestant
							exists = var:progress_to_victory
							this != root
							is_ai = no
							has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:next_versus_match }
						}
					}
					factor = 2
				}
				modifier = {
					scope:next_versus_match = { has_variable = murder_sabotage_target }

As written in game/common/scripted_effects/04_dlc_ep2_tournament_effects.txt.

The first 120 of its 377 lines; the rest is in game/common/scripted_effects/04_dlc_ep2_tournament_effects.txt from line 2125.

Where it is used

Every place in common/, events/ and history/ that calls tournament_contest_versus_battle_effect.

Source: game/common/scripted_effects/04_dlc_ep2_tournament_effects.txt and every file of common/, events/ and history/ that calls it, Crusader Kings III 1.20.1.2.

Spotted a mistake on this page?