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

Scripted effect · Roads to Power files

calculate_chariot_odds_to_win_effect

calculate_chariot_odds_to_win_effect = yes

game/common/scripted_effects/07_dlc_ep3_scripted_effects.txt, line 4344 (261 lines). No parameters.

calculate_chariot_odds_to_win_effect is a scripted effect in Crusader Kings III, in the Roads to Power files, written at line 4344 of its file. It takes no parameters: calculate_chariot_odds_to_win_effect = yes. The game's script calls it in 1 place, among them calculate_chariot_race_odds_effect (scripted effect). Patch 1.20.1.2, from game/common/scripted_effects/07_dlc_ep3_scripted_effects.txt.

The comment above it in the file

Odds are represented in the format A:B, where A is the number of ways/opportunities a character has to succeed, and B represents how many ways/opportunities they have to fail
These same calculations are done for the teams overall
Individual odds are saved on the individual character
Team odds are saved on the activity scope

What it does

• 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)
calculate_chariot_odds_to_win_effect = {
	scope:activity = {
		### INDIVIDUAL ODDS
		# Set odds to win
		set_variable = {
			name = total_chance_win
			value = 0
		}
		# Set odds_win_a (number of ways to win)
		every_guest_subset = {
			name = charioteers
			set_variable = {
				name = odds_win_a
				value = charioteer_chance_to_win
			}
			scope:activity = {
				change_variable = {
					name = total_chance_win
					add = {
						value = prev.charioteer_chance_to_win
						min = 1
					}
				}
			}
		}
		# set odds_win_b (number of ways to lose)
		every_guest_subset = {
			name = charioteers
			set_variable = {
				name = odds_win_b
				value = {
					value = scope:activity.var:total_chance_win
					subtract = var:odds_win_a
					min = 1
				}
			}
		}

		# Calc percent chance to win
		every_guest_subset = {
			name = charioteers
			set_variable = {
				name = percent_chance_to_win
				value = {
					add = var:odds_win_a
					divide = {
						value = 0
						add = var:odds_win_a
						add = var:odds_win_b
					}
					multiply = 100
					min = 1
					max = 99
				}
			}
		}
		##########

		### TEAM ODDS
		# For each of the 4 teams, we calculate their odds to win/place/show. These variables are saved on the activity
		# BLUES
		# Initialize variables
		set_variable = {
			name = blue_odds_win_a
			value = 0
		}
		set_variable = {
			name = blue_odds_win_b
			value = 0
		}

		# Account for each team member
		every_guest_subset = {
			name = charioteers
			limit = { has_trait = charioteer_blue }
			scope:activity = {
				change_variable = {
					name = blue_odds_win_a
					add = {
						value = prev.var:odds_win_a
						min = 1
					}
				}
			}
		}
		# Set the B variable based on the total amount of chance - the opporutnity for success
		change_variable = {
			name = blue_odds_win_b
			add = {
				value = var:total_chance_win
				subtract = var:blue_odds_win_a
				min = 1
			}
		}
		# Calculate the percentage chance of success for readability
		set_variable = {
			name = blue_percent_chance_to_win
			value = {
				add = var:blue_odds_win_a
				divide = {
					value = 0
					add = var:blue_odds_win_a
					add = var:blue_odds_win_b
				}
				multiply = 100
				min = 1
				max = 99
			}
		}

		# GREENS
		# Initialize variables
		set_variable = {
			name = green_odds_win_a
			value = 0
		}
		set_variable = {
			name = green_odds_win_b
			value = 0
		}

As written in game/common/scripted_effects/07_dlc_ep3_scripted_effects.txt.

The first 120 of its 261 lines; the rest is in game/common/scripted_effects/07_dlc_ep3_scripted_effects.txt from line 4344.

Where it is used

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

Source: game/common/scripted_effects/07_dlc_ep3_scripted_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?