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

Scripted effect · Legends of the Dead files

war_end_legitimacy_effect

war_end_legitimacy_effect = { LOSER = … WINNER = … }

game/common/scripted_effects/06_dlc_ce1_legitimacy_effects.txt, line 125 (123 lines). Parameters: $LOSER$, $WINNER$.

war_end_legitimacy_effect is a scripted effect in Crusader Kings III, in the Legends of the Dead files, written at line 125 of its file. A call passes 2 parameters: LOSER and WINNER. The game's script calls it in 2 places, among them add_legitimacy_attacker_defeat_effect (scripted effect) and add_legitimacy_attacker_victory_effect (scripted effect). Patch 1.20.1.2, from game/common/scripted_effects/06_dlc_ce1_legitimacy_effects.txt.

What it does

  • If

    • scope:attacker:
      • One of these

        • this = character:125501
        • or

          this = character:mpo_mongol_1
      • Has “temujin jamukha war var” (a variable the game's script sets)
    • scope:defender:
      • One of these

        • this = character:125501
        • or

          this = character:mpo_mongol_1

    Then

    Otherwise

    • $WINNER$ = { … }

• 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)
war_end_legitimacy_effect = {
	# Special rewards for Temüjin vs Jamukha
	if = {
		limit = {
			scope:attacker = {
				OR = {
					this = character:125501
					this = character:mpo_mongol_1
				}
				has_variable = temujin_jamukha_war_var
			}
			scope:defender = {
				OR = {
					this = character:125501
					this = character:mpo_mongol_1
				}
			}
		}
		scope:attacker = {
			add_legitimacy = 500
		}
	}
	else = {
		if = {
			limit = {
				any_in_list = { list = target_titles }
			}
			ordered_in_list = {
				list = target_titles
				order_by = tier
				save_scope_as = target_title
				save_scope_value_as = {
					name = title_tier_minus_1
					value = {
						value = scope:target_title.tier
						subtract = 1
					}
				}
			}
		}
		$WINNER$ = {
			if = {
				limit = {
					is_valid_for_legitimacy_change = yes
					primary_title.tier <= $LOSER$.primary_title.tier
				}
				send_interface_toast = {
					type = msg_legitimacy_gain
					title = legitimacy_gain_toast
					left_icon = $WINNER$
					right_icon = $LOSER$
					
					add_legitimacy = {
						value = {
							value = 1

							# You get a lot of Legitimacy for punching above your weight
							add = $LOSER$.primary_title.tier
							subtract = primary_title.tier

							multiply = 50
						}
						
						if = { # We give you extra Legitimacy for Religious Wars
							limit = {
								root.war ?= {
									OR = {
										using_cb = minor_religious_war
										using_cb = religious_war
									}
								}
							}
							multiply = 2
						}
						else_if = { # And even more for Holy Wars
							limit = {
								root.war ?= {
									OR = {
										using_cb = major_religious_war
										using_cb = undirected_great_holy_war
										using_cb = directed_great_holy_war
									}
								}
							}
							multiply = 3
						}
						
						if = { # We give you extra Legitimacy for special On Start Wars
							limit = {
								root.war ?= {
									OR = {
										using_cb = norman_conquest_cb
										using_cb = norwegian_invasion_cb
										using_cb = sons_of_lothbrok_invasion_cb
									}
								}
							}
							multiply = 4
						}
						
						if = { # And we 50% increase whatever you have if you are a nomad
							limit = {
								government_has_flag = government_is_nomadic
							}
							multiply = 1.5
						}
					}
				}
			}
			# Special extra Legitimacy gain for Byzantine rulers since their procedence didn't matter as much, to prevent them from always having 0 Legitimacy basically
			hidden_effect = {
				if = {
					limit = {
						exists = scope:target_title
						scope:target_title = title:e_byzantium
						$WINNER$ = { is_valid_for_legitimacy_change = yes }
					}
					add_legitimacy = 1000
				}
			}

As written in game/common/scripted_effects/06_dlc_ce1_legitimacy_effects.txt.

The first 120 of its 123 lines; the rest is in game/common/scripted_effects/06_dlc_ce1_legitimacy_effects.txt from line 125.

Where it is used

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

Source: game/common/scripted_effects/06_dlc_ce1_legitimacy_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?