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_place_effect

calculate_chariot_odds_to_place_effect = yes

game/common/scripted_effects/07_dlc_ep3_scripted_effects.txt, line 4606 (262 lines). No parameters.

calculate_chariot_odds_to_place_effect is a scripted effect in Crusader Kings III, in the Roads to Power files, written at line 4606 of its file. It takes no parameters: calculate_chariot_odds_to_place_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.

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_place_effect = {
	scope:activity = {
		### INDIVIDUAL ODDS
		# Set odds to place
		set_variable = {
			name = total_chance_place
			value = 0
		}
		every_guest_subset = {
			name = charioteers
			set_variable = {
				name = odds_place_a
				value = {
					value = charioteer_chance_to_win
					multiply = 2
				}
			}
			scope:activity = {
				change_variable = {
					name = total_chance_place
					add = {
						value = prev.charioteer_chance_to_win
						min = 1
					}
				}
			}
		}
		every_guest_subset = {
			name = charioteers
			set_variable = {
				name = odds_place_b
				value = {
					value = scope:activity.var:total_chance_place
					subtract = var:odds_place_a
					min = 1
				}
			}
		}

		# Calc percent chance to win
		every_guest_subset = {
			name = charioteers
			set_variable = {
				name = percent_chance_to_place
				value = {
					add = var:odds_place_a
					divide = {
						value = 0
						add = var:odds_place_a
						add = var:odds_place_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
		# Initialize variables
		set_variable = {
			name = blue_odds_place_a
			value = 0
		}
		set_variable = {
			name = blue_odds_place_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_place_a
					add = {
						value = prev.var:odds_place_a
						min = 1
					}
				}
			}
		}
		# Set the B variable based on the total amount of chance - the opporutnity for success
		change_variable = {
			name = blue_odds_place_b
			add = {
				value = var:total_chance_place
				subtract = var:blue_odds_place_a
				min = 1
			}
		}
		# Calculate the percentage chance of success for readability
		set_variable = {
			name = blue_percent_chance_to_place
			value = {
				add = var:blue_odds_place_a
				divide = {
					value = 0
					add = var:blue_odds_place_a
					add = var:blue_odds_place_b
				}
				multiply = 100
				min = 1
				max = 99
			}
		}

		# GREENS
		# Initialize variables
		set_variable = {
			name = green_odds_place_a
			value = 0
		}
		set_variable = {
			name = green_odds_place_b
			value = 0
		}

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

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

Where it is used

Every place in common/, events/ and history/ that calls calculate_chariot_odds_to_place_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?