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

Scripted effect · The Royal Court files

damage_artifact_in_battle_effect

damage_artifact_in_battle_effect = { ARTIFACT = … DURABILITY_LOSS = … IS_DUEL = … LOCATION = … OPPONENT = … OWNER = … }

game/common/scripted_effects/00_ep1_artifact_effects.txt, line 177 (58 lines). Parameters: $ARTIFACT$, $DURABILITY_LOSS$, $IS_DUEL$, $LOCATION$, $OPPONENT$, $OWNER$.

damage_artifact_in_battle_effect is a scripted effect in Crusader Kings III, in the The Royal Court files, written at line 177 of its file. A call passes 6 parameters: ARTIFACT, DURABILITY_LOSS, IS_DUEL, LOCATION, OPPONENT and OWNER. The game's script calls it in 2 places, among them siege.0031 (event) and siege.0032 (event). Its body carries 2 texts of the game's own for the player. Patch 1.20.1.2, from game/common/scripted_effects/00_ep1_artifact_effects.txt.

What it does

  • $ARTIFACT$ = { … }
  • If

    • scope:DAIBE_artifact.artifact_durability <= 0

    Then

    • destroy_artifact = scope:DAIBE_artifact

    Otherwise

    • $OWNER$ = { … }

• 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 (58 lines of game script)
damage_artifact_in_battle_effect = {
	# Save scopes for localization
	$OWNER$ = {
		save_scope_as = DAIBE_owner
	}
	$OPPONENT$ = { save_scope_as = DAIBE_opponent }
	$LOCATION$ = { save_scope_as = DAIBE_location }
	$ARTIFACT$ = {
		save_scope_as = DAIBE_artifact 

		# Suppress generic notifications, as we will send custom ones
		set_variable = {
			name = suppress_artifact_notifications
			value = yes
			days = 1
		}

		set_variable = {
			name = DAIBE_damage
			value = $DURABILITY_LOSS$
			days = 1
		}

		# Damage the artifact by the specified amount
		add_durability = {
			value = 0
			subtract = var:DAIBE_damage
		}
	}

	# Transformed into an if / else as I found the following note somewhere else:
	# NOTE: We must not run ANY script after we destroy an artifact, or we will cause errors
	if = {
		# If the artifact has no durability left, destroy it now.
		limit = { scope:DAIBE_artifact.artifact_durability <= 0 }
		destroy_artifact = scope:DAIBE_artifact
	}
	# Send notifications to the relevant party IF the artifact was not destroyed
	else = {
		$OWNER$ = {
			# Send the toast
			send_interface_toast = {
				title = artifact_damaged_toast
				left_icon = scope:DAIBE_artifact
				right_icon = scope:DAIBE_opponent
				if = {
					limit = {
						$IS_DUEL$ = yes
					}
					custom_tooltip = artifact_damaged_in_duel
				}
				else = {
					custom_tooltip = artifact_damaged_in_siege
				}
			}
		}
	}
}

As written in game/common/scripted_effects/00_ep1_artifact_effects.txt.

Where it is used

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

Source: game/common/scripted_effects/00_ep1_artifact_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?