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

steal_artifact_in_siege_effect

steal_artifact_in_siege_effect = { ARTIFACT = … ATTACKER = … DEFENDER = … IS_RAID = … LOCATION = … }

game/common/scripted_effects/00_ep1_artifact_effects.txt, line 1 (110 lines). Parameters: $ARTIFACT$, $ATTACKER$, $DEFENDER$, $IS_RAID$, $LOCATION$.

steal_artifact_in_siege_effect is a scripted effect in Crusader Kings III, in the The Royal Court files, written at line 1 of its file. A call passes 5 parameters: ARTIFACT, ATTACKER, DEFENDER, IS_RAID and LOCATION. The game's script calls it in 3 places, among them raiding.0014 (event), 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

  • If does not have “artifact prevent transfer” (a variable the game's script sets) › scope:this_artifact:
    • If

      • Has “ai to ai destroy in sieges” (a variable the game's script sets)
      • scope:SAISE_attacker: Is played by the AI
      • scope:SAISE_defender: Is played by the AI

      Then

      • destroy_artifact = this

      Otherwise

      • set_owner = { … }
      • scope:SAISE_defender:
        • add_personal_artifact_claim = scope:this_artifact
      • scope:SAISE_defender:
        • If

          • $IS_RAID$ = yes

          Then

          • … was stolen by … in … raid on …

          Otherwise

          • … was stolen by … in the siege of …

• 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 (110 lines of game script)
steal_artifact_in_siege_effect = {
	if = {
		limit = { NOT = { has_variable = artifact_prevent_transfer } }
		# Save scopes for localization
		$LOCATION$ = { save_scope_as = SAISE_location }
		$ATTACKER$ = { save_scope_as = SAISE_attacker }
		$DEFENDER$ = { save_scope_as = SAISE_defender }
		$ARTIFACT$ = { save_scope_as = this_artifact }

		scope:this_artifact = {
			# Suppress generic notifications, as we will send custom ones
			set_variable = {
				name = suppress_artifact_notifications
				value = yes
				days = 1
			}
			if = {
				limit = {
					NOT = { has_variable = stolen_artifact }
				}
				set_variable = {
					name = stolen_artifact
					value = 1
				}
			}
			else = {
				change_variable = {
					name = stolen_artifact
					add = 1
				}
			}

			# Transfer the artifact to its new owner
			if = {
				limit = {
					has_variable = ai_to_ai_destroy_in_sieges
					scope:SAISE_attacker = {
						is_ai = yes
					}
					scope:SAISE_defender = {
						is_ai = yes
					}
				}
				destroy_artifact = this
			}
			else = {
				set_owner = {
					target = scope:SAISE_attacker
					history = {
						location = scope:SAISE_location
						actor = scope:SAISE_defender
						recipient = scope:SAISE_attacker
						type = taken_in_siege
					}
				}
				scope:SAISE_defender = { add_personal_artifact_claim = scope:this_artifact }
				if = {
					limit = {
						scope:SAISE_attacker = {
							has_ep3_dlc_trigger = yes
							is_roman_emperor_trigger = yes
							culture = { has_cultural_parameter = holds_triumphs }
						}
					}
					scope:SAISE_attacker = {
						set_variable = {
							name = byz_valid_for_trophy
							value = scope:this_artifact
							years = 9
						}
					}
				}
				
				# Send notifications to the relevant parties
				scope:SAISE_defender = {
					send_interface_toast = {
						type = msg_artifact_lost
						title = artifact_lost_toast
						left_icon = scope:this_artifact
						right_icon = scope:SAISE_attacker
						if = {
							limit = { $IS_RAID$ = yes }
							custom_tooltip = artifact_lost_in_raid
						}
						else = {
							custom_tooltip = artifact_lost_in_siege
						}
					}
				}
				scope:SAISE_attacker = {
					send_interface_toast = {
						type = msg_artifact_gained
						right_icon = scope:this_artifact
					}
					if = {
						limit = {
							NOT = { any_claimed_artifact = { this = scope:this_artifact } }
						}
						scope:this_artifact = {
							set_variable = {
								name = last_person_to_steal
								value = scope:SAISE_attacker
							}
						} 
					}
				}
			}
		}
	}
}

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 steal_artifact_in_siege_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?