﻿activity_coronation = {
	is_shown = {
		coronation_trigger = yes
		trigger_if = {
			limit = {
				highest_held_title_tier = tier_kingdom
			}
			custom_tooltip = {
				text = already_coronated_trigger
				OR = {
					has_realm_law = uncrowned
					AND = {
						has_game_rule = coronation_laws_off
						NOR = {
							has_variable = crowned_king_var
							has_variable = crowned_emperor_var
						}
					}
				}
			}
		}
		trigger_else_if = {
			limit = {
				highest_held_title_tier >= tier_empire
			}
			custom_tooltip = {
				text = already_coronated_trigger
				NOR = {
					has_realm_law = crowned_emperor
					AND = {
						has_realm_law = crowned_king
						faith = { has_doctrine = doctrine_no_anointment }
					}
				}
			}
		}
		trigger_else = {
			always = yes
		}
	}

	can_start_showing_failures_only = {
		NOT = { is_activity_type_on_cooldown = activity_coronation }
		is_available = yes
		custom_tooltip = {
			text = activity_coronation_underage_tt
			age >= coronation_minimum_age_value
		}
		highest_held_title_tier >= tier_kingdom

		trigger_if = {
			limit = {
				scope:special_option ?= flag:coronation_type_anointment
				NOT = { faith.religious_head ?= this }
			}
			custom_tooltip = {
				text = activity_coronation_not_approved_anointment
				faith.religious_head = {
					is_target_in_variable_list = {
						name = supported_anointments
						target = root
					}
				}
			}
		}
	}

	is_location_valid = {
		has_holding = yes
		trigger_if = { # If it is an anointment, it must happen within the HoF's lands if they hold a holy site
			limit = {
				scope:special_option ?= flag:coronation_type_anointment
				scope:host.faith.religious_head ?= { 
					is_landed = yes 
					faith = {
						any_holy_site = {
							barony.holder = {
								OR = {
									this = scope:host.faith.religious_head
									any_liege_or_above = { this = scope:host.faith.religious_head }
								}
							}
						}
					}
				}
			}
			custom_tooltip = {
				text = coronation_location_hof_owned
				barony = { is_holy_site_of = scope:host.faith }
				barony.holder = {
					OR = {
						this = scope:host.faith.religious_head
						any_liege_or_above = { this = scope:host.faith.religious_head }
					}
				}
			}
		}
		#If it is an anointment and HoF has no holy site - but you do - must be held there
		trigger_else_if = { # If it is an anointment, it must happen within the HoF's lands if they hold a holy site
			limit = {
				scope:special_option ?= flag:coronation_type_anointment
				scope:host.faith = {
					any_holy_site = {
						barony.holder = {
							OR = {
								this = scope:host
								any_liege_or_above = { this = scope:host }
							}
						}
					}
				}
				#head of faith has no holy site
				scope:host.faith.religious_head ?= { 
					OR = {
						is_landed = no
						NOT = {
							faith = {
								any_holy_site = {
									barony.holder = {
										OR = {
											this = scope:host.faith.religious_head
											any_liege_or_above = { this = scope:host.faith.religious_head }
										}
									}
								}
							}
						}
					}
				}
			}
			custom_tooltip = {
				text = coronation_location_holy_site_host
				barony = { is_holy_site_of = scope:host.faith }
				barony.holder = {
					OR = {
						this = scope:host
						any_liege_or_above = { this = scope:host }
					}
				}
			}
		}
		trigger_else = { # Else it must happen in your lands
			custom_tooltip = {
				text = coronation_location_owned
				county.holder ?= {
					OR = {
						this = scope:host
						any_liege_or_above = { this = scope:host }
					}
				}
			}
		}
		trigger_if = {
			limit = {
				NOT = { is_county_capital = yes }
			}
			custom_tooltip = {
				text = coronation_location_neither_capital_nor_holy_site
				OR = {
					this = scope:host.capital_province
					is_county_capital = yes
					barony = { is_holy_site_of = scope:host.faith }
				}
			}
		}
	}

	cost = {
		gold = {
			add = {
				if = {
					limit = {
						has_treasury = no
					}
					add = {
						value = base_coronation_cost
						desc = CORONATION_BASE_COST
					}
					if = {
						limit = {
							highest_held_title_tier >= tier_empire
						}
						add = {
							value = 30
							add = {
								value = 30
								multiply = activity_cost_scale_by_era
								subtract = 30
							}
							desc = coronation_empire_req
						}
					}
					#The bigger your realm, the more it costs
					if = {
						limit = {
							realm_size >= 1
							highest_held_title_tier > tier_empire
						}
						add = {
							value = realm_size
							add = {
								value = realm_size
								multiply = activity_cost_scale_by_era
								subtract = realm_size
							}
							multiply = 0.125
							desc = coronation_realm_size_desc
						}
					}
					else_if = {
						limit = {
							realm_size >= 1
							highest_held_title_tier > tier_kingdom
						}
						add = {
							value = realm_size
							add = {
								value = realm_size
								multiply = activity_cost_scale_by_era
								subtract = realm_size
							}
							multiply = 0.25
							desc = coronation_realm_size_desc
						}
					}
					else_if = {
						limit = {
							realm_size >= 1
							highest_held_title_tier = tier_kingdom
						}
						add = {
							value = realm_size
							add = {
								value = realm_size
								multiply = activity_cost_scale_by_era
								subtract = realm_size
							}
							multiply = 0.5
							desc = coronation_realm_size_desc
						}
					}
	
					#Government types
					if = {
						limit = {
							government_has_flag = government_is_tribal
						}
						multiply = 0.66
						desc = coronation_tribal_req
					}
					if = {
						limit = {
							government_has_flag = government_is_nomadic
						}
						multiply = 0.1
						desc = coronation_nomadic_reg
					}
	
					#AI discounts
					if = {
						limit = {
							is_ai = yes
							has_game_rule = hard_difficulty
						}
						multiply = 0.5
					}
					else_if = {
						limit = {
							is_ai = yes
							has_game_rule = very_hard_difficulty
						}
						multiply = 0.25
					}
					else_if = {
						limit = {
							is_ai = yes
						}
						multiply = 0.75
					}
					if = {
						limit = {
							exists = primary_title
							primary_title.title_held_years >= 5
							is_ai = yes
						}
						multiply = 0.5
					}
					if = {
						limit = {
							is_ai = yes
							exists = primary_title
							OR = {
								has_trait = conqueror
								has_trait = greatest_of_khans
								primary_title.title_held_years >= 10
							}
						}
						multiply = 0
					}
				}
				else = {
					value = 0
				}
			}
		}
		treasury = {
			add = {
				if = {
					limit = {
						has_treasury = yes
					}
					add = {
						value = base_coronation_cost
						desc = CORONATION_BASE_COST
					}
					if = {
						limit = {
							highest_held_title_tier >= tier_empire
						}
						add = {
							value = 30
							add = {
								value = 30
								multiply = activity_cost_scale_by_era
								subtract = 30
							}
							desc = coronation_empire_req
						}
					}
					#The bigger your realm, the more it costs
					if = {
						limit = {
							realm_size >= 1
							highest_held_title_tier > tier_empire
						}
						add = {
							value = realm_size
							add = {
								value = realm_size
								multiply = activity_cost_scale_by_era
								subtract = realm_size
							}
							multiply = 0.125
							desc = coronation_realm_size_desc
						}
					}
					else_if = {
						limit = {
							realm_size >= 1
							highest_held_title_tier > tier_kingdom
						}
						add = {
							value = realm_size
							add = {
								value = realm_size
								multiply = activity_cost_scale_by_era
								subtract = realm_size
							}
							multiply = 0.25
							desc = coronation_realm_size_desc
						}
					}
					else_if = {
						limit = {
							realm_size >= 1
							highest_held_title_tier = tier_kingdom
						}
						add = {
							value = realm_size
							add = {
								value = realm_size
								multiply = activity_cost_scale_by_era
								subtract = realm_size
							}
							multiply = 0.5
							desc = coronation_realm_size_desc
						}
					}
	
					#Government types
					if = {
						limit = {
							government_has_flag = government_is_tribal
						}
						multiply = 0.66
						desc = coronation_tribal_req
					}
					if = {
						limit = {
							government_has_flag = government_is_nomadic
						}
						multiply = 0.1
						desc = coronation_nomadic_reg
					}
	
					#AI discounts
					if = {
						limit = {
							is_ai = yes
							has_game_rule = hard_difficulty
						}
						multiply = 0.5
					}
					else_if = {
						limit = {
							is_ai = yes
							has_game_rule = very_hard_difficulty
						}
						multiply = 0.25
					}
					else_if = {
						limit = {
							is_ai = yes
						}
						multiply = 0.75
					}
					if = {
						limit = {
							exists = primary_title
							primary_title.title_held_years >= 5
							is_ai = yes
						}
						multiply = 0.5
					}
					if = {
						limit = {
							is_ai = yes
							exists = primary_title
							OR = {
								has_trait = conqueror
								has_trait = greatest_of_khans
								primary_title.title_held_years >= 10
							}
						}
						multiply = 0
					}
				}
				else = {
					value = 0
				}
			}
		}
		herd = {
			if = {
				limit = {
					government_has_flag = government_is_nomadic
				}
				add = {
					value = domicile.medium_herd_value
					min = 200
					desc = CORONATION_BASE_COST
				}
			}
			if = {
				limit = {
					confederation ?= { has_cohesion_level_parameter = any_member_activity_cost_reduced }
				}
				multiply = {
					value = 0.9
					desc = CB_COHESION_PARAMETER_DISCOUNT
				}
			}
			if = {
				limit = {
					highest_held_title_tier >= tier_empire
					government_has_flag = government_is_nomadic
				}
				add = {
					value = domicile.minor_herd_value
					min = 200
					desc = coronation_empire_req
				}
			}
			#The bigger your realm, the more it costs
			if = {
				limit = {
					government_has_flag = government_is_nomadic
					realm_size >= 1
					highest_held_title_tier > tier_empire
				}
				add = {
					value = realm_size
					multiply = 2
					desc = coronation_realm_size_desc
				}
			}
			else_if = {
				limit = {
					government_has_flag = government_is_nomadic
					realm_size >= 1
					highest_held_title_tier = tier_empire
				}
				add = {
					value = realm_size
					multiply = 4
					desc = coronation_realm_size_desc
				}
			}
			else_if = {
				limit = {
					government_has_flag = government_is_nomadic
					realm_size >= 1
					highest_held_title_tier < tier_empire
				}
				add = {
					value = realm_size
					multiply = 6
					desc = coronation_realm_size_desc
				}
			}

			#AI discounts
			if = {
				limit = {
					is_ai = yes
					has_game_rule = hard_difficulty
				}
				multiply = 0.5
			}
			else_if = {
				limit = {
					is_ai = yes
					has_game_rule = very_hard_difficulty
				}
				multiply = 0.25
			}
			else_if = {
				limit = {
					is_ai = yes
				}
				multiply = 0.75
			}
			if = {
				limit = {
					exists = primary_title
					primary_title.title_held_years >= 5
					is_ai = yes
				}
				multiply = 0.5
			}
			if = {
				limit = {
					is_ai = yes
					exists = primary_title
					OR = {
						has_trait = conqueror
						has_trait = greatest_of_khans
						primary_title.title_held_years >= 10
					}
				}
				multiply = 0
			}
		}
	}

	is_valid = {
		scope:host = {
			# Standard checks
			is_alive = yes
			is_incapable = no
			is_imprisoned = no
			is_landed_or_landless_administrative = yes
			trigger_if = {
				limit = {
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = coronation_type_anointment
						}
					}
				}
				NOT = { has_trait = excommunicated }
			}

			# If no one shows up
			trigger_if = {
				limit = {
					involved_activity = { is_current_phase_active = yes }
				}
				involved_activity = { has_attending_activity_guests = yes }
			}

			# Dead officiator
			custom_tooltip = {
				NOT = {
					has_character_flag = cancelled_coronation
				}
				text = coronation_cancelled_dead_officiator_desc
			}

			# Somehow lost the primary title
			trigger_if = {
				limit = {
					has_variable = coronation_primary_title
				}
				custom_tooltip = {
					var:coronation_primary_title ?= primary_title
					text = coronation_cancelled_wrong_primary_title_desc
				}
			}		
		}
	}

	on_host_death = {
		every_attending_character = {
			limit = { is_alive = yes }
			trigger_event = {
				id = ach_maintenance_events.0100
				days = 1 # So you don't get spammed
			}
		}
	}

	on_invalidated = {
		# Host becomes incapable
		if = {
			limit = {
				scope:host = { is_incapable = yes }
			}
			scope:activity = {
				activity_type = { save_scope_as = activity_type }
			}
			scope:host = {
				trigger_event = activity_system.0330
			}
			every_attending_character = {
				limit = { NOT = { this = scope:host } }
				trigger_event = activity_system.0331
			}
		}
		

		# Host becomes unlanded
		if = {
			limit = {
				scope:host = {
					is_landed_or_landless_administrative = no
				}
			}
			scope:activity = {
				activity_type = { save_scope_as = activity_type }
			}
			every_attending_character = {
				trigger_event = activity_system.0320
			}
		}

		# Host is dead
		if = {
			limit = {
				scope:host = { is_alive = no }
			}
			scope:activity = {
				activity_host = { save_scope_as = host }
			}
			every_attending_character = {
				limit = {
					NOT = { this = scope:host }
				}
				trigger_event = ach_maintenance_events.0100
			}
		}

		#Host has been imprisoned
		if = {
			limit = {
				scope:host = { is_imprisoned = yes }
			}
			#Host has been imprisoned
			scope:activity = {
				activity_host = { save_scope_as = host }
			}
			every_attending_character = {
				limit = {
					NOT = { this = scope:host }
				}
				trigger_event = ach_maintenance_events.0101
			}
			scope:host = { trigger_event = ach_maintenance_events.0102 }
		}

		# No one shows up
		if = { 
			limit = {
				has_attending_activity_guests = no
			}
			scope:host = { trigger_event = ach_maintenance_events.0103 }
		}

		# Officiator death
		if = {
			limit = {
				scope:host = { has_character_flag = cancelled_coronation }
			}
			scope:activity = {
				activity_host = { save_scope_as = host }
			}
			scope:activity = {
				every_attending_character = {
					limit = {
						NOT = { this  = scope:host }
					}
					trigger_event = ach_maintenance_events.0104
				}
			}
		}

		# Host excommunicated during anointment

		if = {
			limit = {
				scope:host = { has_trait = excommunicated }
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = coronation_type_anointment
					}
				}
			}
			scope:activity = {
				activity_host = { save_scope_as = host }
			}
			scope:activity = {
				every_attending_character = {
					limit = {
						NOT = { this  = scope:host }
					}
					trigger_event = ach_maintenance_events.0105
				}
			}
			scope:host = {
				trigger_event = ach_maintenance_events.0106
			}
		}

		#Cleanup
		if = {
			limit = {
				scope:host = {
					is_alive = yes
				}
			}
			scope:host = {
				remove_character_flag = no_coronation_events
			}
		}
		scope:host = {
			remove_variable = coronation_primary_title
			remove_variable = hide_make_primary_title
		}
		var:officiator ?= {
			remove_character_flag = coronation_officiator
		}
	}

	cooldown = {
		years = 3
	}

	ui_predicted_cost = {
		gold = {
			add = {
				add = {
					value = base_coronation_cost
					desc = CORONATION_BASE_COST
				}
				if = {
					limit = {
						highest_held_title_tier >= tier_empire
					}
					add = {
						value = 30
						add = {
							value = 30
							multiply = activity_cost_scale_by_era
							subtract = 30
						}
						desc = coronation_empire_req
					}
				}
				#The bigger your realm, the more it costs
				if = {
					limit = {
						realm_size >= 1
						highest_held_title_tier > tier_empire
					}
					add = {
						value = realm_size
						add = {
							value = realm_size
							multiply = activity_cost_scale_by_era
							subtract = realm_size
						}
						multiply = 0.125
						desc = coronation_realm_size_desc
					}
				}
				else_if = {
					limit = {
						realm_size >= 1
						highest_held_title_tier > tier_kingdom
					}
					add = {
						value = realm_size
						add = {
							value = realm_size
							multiply = activity_cost_scale_by_era
							subtract = realm_size
						}
						multiply = 0.25
						desc = coronation_realm_size_desc
					}
				}
				else_if = {
					limit = {
						realm_size >= 1
						highest_held_title_tier = tier_kingdom
					}
					add = {
						value = realm_size
						add = {
							value = realm_size
							multiply = activity_cost_scale_by_era
							subtract = realm_size
						}
						multiply = 0.5
						desc = coronation_realm_size_desc
					}
				}
				#Government types
				if = {
					limit = {
						government_has_flag = government_is_tribal
					}
					multiply = 0.66
					desc = coronation_tribal_req
				}
				if = {
					limit = {
						government_has_flag = government_is_nomadic
					}
					multiply = 0.1
					desc = coronation_nomadic_reg
				}

				#Medium ceremony cost
				add = {
					value = coronation_medium_ceremony_value
					add = {
						value = coronation_medium_ceremony_value
						multiply = activity_cost_scale_by_era
						subtract = coronation_medium_ceremony_value
					}
					#The bigger your realm, the more it costs
					if = {
						limit = {
							realm_size >= 1
							highest_held_title_tier > tier_empire
						}
						add = {
							value = realm_size
							add = {
								value = realm_size
								multiply = activity_cost_scale_by_era
								subtract = realm_size
							}
							multiply = 0.05
						}
					}
					else_if = {
						limit = {
							realm_size >= 1
							highest_held_title_tier > tier_kingdom
						}
						add = {
							value = realm_size
							add = {
								value = realm_size
								multiply = activity_cost_scale_by_era
								subtract = realm_size
							}
							multiply = 0.1
						}
					}
					else_if = {
						limit = {
							realm_size >= 1
							highest_held_title_tier = tier_kingdom
						}
						add = {
							value = realm_size
							add = {
								value = realm_size
								multiply = activity_cost_scale_by_era
								subtract = realm_size
							}
							multiply = 0.15
						}
					}
					if = {
						limit = {
							has_variable = coronation_discount
						}
						multiply = 0.5
					}
					if = {
						limit = {
							OR = {
								government_has_flag = government_is_nomadic
								government_has_flag = government_is_tribal
							}
						}
						multiply = 0.66
					}
				}
				#Medium feast cost
				add = {
					value = coronation_medium_feast_value
					add = {
						value = coronation_medium_feast_value
						multiply = activity_cost_scale_by_era
						subtract = coronation_medium_feast_value
					}
					#The bigger your realm, the more it costs
					if = {
						limit = {
							realm_size >= 1
							highest_held_title_tier > tier_empire
						}
						add = {
							value = realm_size
							add = {
								value = realm_size
								multiply = activity_cost_scale_by_era
								subtract = realm_size
							}
							multiply = 0.1
						}
					}
					else_if = {
						limit = {
							realm_size >= 1
							highest_held_title_tier > tier_kingdom
						}
						add = {
							value = realm_size
							add = {
								value = realm_size
								multiply = activity_cost_scale_by_era
								subtract = realm_size
							}
							multiply = 0.15
						}
					}
					else_if = {
						limit = {
							realm_size >= 1
							highest_held_title_tier = tier_kingdom
						}
						add = {
							value = realm_size
							add = {
								value = realm_size
								multiply = activity_cost_scale_by_era
								subtract = realm_size
							}
							multiply = 0.2
						}
					}
					if = {
						limit = {
							has_variable = coronation_discount
						}
						multiply = 0.5
					}
					if = {
						limit = {
							OR = {
								government_has_flag = government_is_nomadic
								government_has_flag = government_is_tribal
							}
						}
						multiply = 0.66
					}
				}
			}
			if = {
				limit = {
					confederation ?= { has_cohesion_level_parameter = any_member_activity_cost_reduced }
				}
				multiply = {
					value = 0.9
					desc = CB_COHESION_PARAMETER_DISCOUNT
				}
			}
		}
		herd = {
			if = {
				limit = {
					government_has_flag = government_is_nomadic
				}
				add = {
					value = domicile.medium_herd_value
					min = 200
					desc = CORONATION_BASE_COST
				}
			}
			if = {
				limit = {
					highest_held_title_tier >= tier_empire
					government_has_flag = government_is_nomadic
				}
				add = {
					value = domicile.minor_herd_value
					min = 200
					desc = coronation_empire_req
				}
			}
			#The bigger your realm, the more it costs
			if = {
				limit = {
					government_has_flag = government_is_nomadic
					realm_size >= 1
					highest_held_title_tier > tier_empire
				}
				add = {
					value = realm_size
					multiply = 2
					desc = coronation_realm_size_desc
				}
			}
			else_if = {
				limit = {
					government_has_flag = government_is_nomadic
					realm_size >= 1
					highest_held_title_tier = tier_empire
				}
				add = {
					value = realm_size
					multiply = 4
					desc = coronation_realm_size_desc
				}
			}
			else_if = {
				limit = {
					government_has_flag = government_is_nomadic
					realm_size >= 1
					highest_held_title_tier < tier_empire
				}
				add = {
					value = realm_size
					multiply = 6
					desc = coronation_realm_size_desc
				}
			}

			#AI discounts
			if = {
				limit = {
					is_ai = yes
					has_game_rule = hard_difficulty
				}
				multiply = 0.5
			}
			else_if = {
				limit = {
					is_ai = yes
					has_game_rule = very_hard_difficulty
				}
				multiply = 0.25
			}
			else_if = {
				limit = {
					is_ai = yes
				}
				multiply = 0.75
			}
			if = {
				limit = {
					exists = primary_title
					primary_title.title_held_years >= 5
					is_ai = yes
				}
				multiply = 0.5
			}
			if = {
				limit = {
					is_ai = yes
					exists = primary_title
					OR = {
						has_trait = conqueror
						has_trait = greatest_of_khans
						primary_title.title_held_years >= 10
					}
				}
				multiply = 0
			}
		}
	}

	###################
	# OPTIONS
	###################

	special_option_category = special_type

	options = {
		special_type = {
			# Regular Coronation
			coronation_type_normal = {
				default = {
					trigger_if = {
						limit = {
							highest_held_title_tier >= tier_empire
							faith = {
								has_doctrine = doctrine_spiritual_head
							}
						}
						NOT = {
							faith = {
								has_doctrine = doctrine_imperial_anointment
							}
						}
					}
					trigger_else = {
						always = yes
					}
				}
				is_valid = {
					custom_tooltip = {
						text = already_coronated_trigger
						NOT = {
							has_realm_law = crowned_king
						}
					}
					trigger_if = {
						limit = {
							highest_held_title_tier >= tier_empire
							faith = {
								has_doctrine = doctrine_spiritual_head
							}
						}
						NOT = {
							faith = {
								has_doctrine = doctrine_imperial_anointment
							}
						}
					}
				}
				ai_will_do = {
					value = 100
					if = {
						limit = {
							highest_held_title_tier > tier_kingdom
							faith = {
								has_doctrine = doctrine_spiritual_head
								OR = {
									has_doctrine = doctrine_imperial_anointment
									has_doctrine = doctrine_anointment_permitted
								}
							}
							faith.religious_head ?= {
								is_target_in_variable_list = {
									name = supported_anointments
									target = root
								}
								is_alive = yes
								is_imprisoned = no
								is_ai = yes
								has_contagious_deadly_disease_trigger = no
								custom_description = {
									text = ALREADY_IN_ACTIVITY
									NOR = {
										exists = involved_activity
										has_variable = homage_liege_scope
										has_character_flag = meditation_character_flag
										has_character_flag = petition_liege_character_flag
									}
								}
								NOT = {
									has_any_bad_relationship_with_character_trigger = { CHARACTER = root }
								}
							}
						}
						multiply = 0
					}
				}
			}
			# Anointment
			coronation_type_anointment = {
				default = {
					trigger_if = {
						limit = {
							highest_held_title_tier >= tier_empire
						}
						faith = {
							has_doctrine = doctrine_imperial_anointment
						}
					}
					trigger_else = {
						always = no
					}
				}
				is_valid = {
					#trigger_ifs are to make player-facing triggers look nice
					faith = {
						has_doctrine = doctrine_spiritual_head
						trigger_if = {
							limit = {
								NOT = {
									has_doctrine = doctrine_anointment_permitted
								}
							}
							has_doctrine = doctrine_imperial_anointment
						}
						trigger_else = {
							has_doctrine = doctrine_anointment_permitted
						}
						religious_head ?= {
							save_temporary_scope_as = hof_temp
						}
					}
					trigger_if = {
						limit = {
							exists = scope:hof_temp
						}
						scope:hof_temp = {
							is_alive = yes
							is_imprisoned = no
							custom_description = {
								text = HOF_is_ai_tt
								is_ai = yes
							}
							has_contagious_deadly_disease_trigger = no
							custom_description = {
								text = ALREADY_IN_ACTIVITY
								NOR = {
									is_travelling = yes
									exists = involved_activity
									has_variable = homage_liege_scope
									has_character_flag = meditation_character_flag
									has_character_flag = local_shrine_rite
									has_character_flag = petition_liege_character_flag
								}
							}
						}
					}
					trigger_else = {
						custom_description = {
							text = HOF_DOESNT_EXIST
							exists = scope:hof_temp
						}
					}
					highest_held_title_tier >= tier_empire
					NOT = { has_trait = excommunicated }
					trigger_if = {
						limit = {
							is_ai = no
						}
						piety_level >= 2	
					}		
				}

				ai_will_do = {
					#If valid, the AI should attempt anointment. Unless they hate the pope
					#They will likely often go for regular coronation regardless because they can't afford this or haven't done the request anointment interaction
					value = 100
					if = {
						limit = {
							highest_held_title_tier > tier_kingdom
							AND = {
								exists = faith.religious_head
								faith.religious_head ?= { has_any_bad_relationship_with_character_trigger = { CHARACTER = root } }
							}			
						}
						add = -90
					}
				}
			}
		}
		ceremony_size = {
			coronation_small_ceremony = {
				default = {
					coronation_has_proper_artifact_trigger = no
					highest_held_title_tier = tier_kingdom
				}
				is_valid = {
					custom_tooltip = {
						text = anointment_minimum
						trigger_if = {
							limit = {
								exists = scope:special_option
							}
							NOT = { scope:special_option = flag:coronation_type_anointment }
						}
					}
				}
				ai_will_do = {
					value = 0
					if = {
						limit = {
							monthly_character_income <= 0
						}
						add = 50
					}
					if = {
						limit = {
							NOT = {
								can_make_expensive_purchase_trigger = { PRICE = activity_minor_gold_value }
							}
						}
						add = 10
					}
					if = {
						limit = {
							OR = {
								has_trait = arrogant
								has_trait = gregarious
								has_trait = generous
								has_trait = gluttonous
								has_trait = ambitious
							}
						}
						multiply = 0.1
					}
				}
			}
			coronation_medium_ceremony = {
				default = {
					OR = {
						highest_held_title_tier >= tier_empire
						coronation_has_proper_artifact_trigger = yes
					}			
				}
				cost = {
					gold = {
						value = {
							if = {
								limit = {
									has_treasury = no
								}
								value = coronation_medium_ceremony_value
								add = {
									value = coronation_medium_ceremony_value
									multiply = activity_cost_scale_by_era
									subtract = coronation_medium_ceremony_value
								}
								#The bigger your realm, the more it costs
								if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier > tier_empire
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.05
									}
								}
								else_if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier > tier_kingdom
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.1
									}
								}
								else_if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier = tier_kingdom
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.15
									}
								}
								if = {
									limit = {
										has_variable = coronation_discount
									}
									multiply = 0.5
								}
								if = {
									limit = {
										OR = {
											government_has_flag = government_is_nomadic
											government_has_flag = government_is_tribal
										}
									}
									multiply = 0.66
								}
								if = {
									limit = {
										is_ai = yes
										#Go for the cheap option if you poor
										monthly_character_income > 0
									}
									multiply = coronation_amenity_ai_discount_value
								}
								if = {
									limit = {
										OR = {
											has_trait = conqueror
											has_trait = greatest_of_khans
										}
										is_ai = yes
									}
									multiply = 0.1
								}
								desc = coronation_medium_ceremony
								if = {
									limit = {
										exists = primary_title
										primary_title.title_held_years >= 5
										is_ai = yes
									}
									multiply = 0.5
								}
								if = {
									limit = {
										is_ai = yes
										exists = primary_title
										OR = {
											has_trait = conqueror
											has_trait = greatest_of_khans
											primary_title.title_held_years >= 10
										}
									}
									multiply = 0.1
								}
							}
							else = {
								value = 0
							}
						}
					}
					treasury = { #Make sure this matches the gold cost above
						value = {
							if = {
								limit = {
									has_treasury = yes
								}
								value = coronation_medium_ceremony_treasury_value
								add = {
									value = coronation_medium_ceremony_treasury_value
									multiply = activity_cost_scale_by_era
									subtract = coronation_medium_ceremony_treasury_value
								}
								#The bigger your realm, the more it costs
								if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier > tier_empire
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.05
									}
								}
								else_if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier > tier_kingdom
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.1
									}
								}
								else_if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier = tier_kingdom
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.15
									}
								}
								if = {
									limit = {
										has_variable = coronation_discount
									}
									multiply = 0.5
								}
								if = {
									limit = {
										OR = {
											government_has_flag = government_is_nomadic
											government_has_flag = government_is_tribal
										}
									}
									multiply = 0.66
								}
								if = {
									limit = {
										is_ai = yes
										#Go for the cheap option if you poor
										monthly_character_income > 0
									}
									multiply = coronation_amenity_ai_discount_value
								}
								if = {
									limit = {
										OR = {
											has_trait = conqueror
											has_trait = greatest_of_khans
										}
										is_ai = yes
									}
									multiply = 0.1
								}
								desc = coronation_medium_ceremony
								if = {
									limit = {
										exists = primary_title
										primary_title.title_held_years >= 5
										is_ai = yes
									}
									multiply = 0.5
								}
								if = {
									limit = {
										is_ai = yes
										exists = primary_title
										OR = {
											has_trait = conqueror
											has_trait = greatest_of_khans
											primary_title.title_held_years >= 10
										}
									}
									multiply = 0.1
								}
							}
							else = {
								value = 0
							}
						}
					}
				}
				is_valid = {
					trigger_if = {
						limit = {
							coronation_proper_artifact_crown_trigger = yes
						}
						custom_tooltip = {
							text = coronation_no_crown_trigger
							coronation_has_proper_artifact_trigger = yes
						}
					}
					trigger_else_if = {
						limit = {
							coronation_proper_artifact_regalia_trigger = yes
						}
						custom_tooltip = {
							text = coronation_no_regalia_trigger
							coronation_has_proper_artifact_trigger = yes
						}
					}
					trigger_else = {
						custom_tooltip = {
							text = coronation_no_crown_or_regalia_trigger
							coronation_has_proper_artifact_trigger = yes
						}
					}
				}
				ai_will_do = {
					value = 75
					# Financial preference.
					add = activity_option_likes_middling_expense_value
					if = {
						limit = {
							can_make_expensive_purchase_trigger = { PRICE = activity_minor_gold_value }
						}
						add = 10
					}
					if = {
						limit = {
							# Some characters just don't want to make a whole big thing of it.
							NOR = {
								has_trait = greedy
								has_trait = shy
								has_trait = humble
								has_trait = temperate
								has_trait = content
							}
							# Or have more than a certain amount of positive greed.
							ai_greed <= medium_positive_ai_value
							# _Then_ we check to see how your finances are.
							short_term_gold >= activity_option_expense_gold_low_value
						}
						add = {
							value = 50
							desc = debug_gui.activity_weight.gold.prefers_expense
						}
					}
				}
			}
			coronation_large_ceremony = {
				cost = {
					gold = {
						value = {
							if = {
								limit = {
									has_treasury = no
								}
								value = coronation_large_ceremony_value
								add = {
									value = coronation_large_ceremony_value
									multiply = activity_cost_scale_by_era
									subtract = coronation_large_ceremony_value
								}
								#The bigger your realm, the more it costs
								if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier > tier_empire
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.15
									}
								}
								else_if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier > tier_kingdom
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.2
									}
								}
								else_if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier = tier_kingdom
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.3
									}
								}
								if = {
									limit = {
										has_variable = coronation_discount
									}
									multiply = 0.5
								}
								if = {
									limit = {
										OR = {
											government_has_flag = government_is_nomadic
											government_has_flag = government_is_tribal
										}
									}
									multiply = 0.66
								}
								if = {
									limit = {
										is_ai = yes
										#Go for the cheap option if you poor
										monthly_character_income > 0
									}
									multiply = coronation_amenity_ai_discount_value
								}
								if = {
									limit = {
										OR = {
											has_trait = conqueror
											has_trait = greatest_of_khans
										}
										is_ai = yes
									}
									multiply = 0.25
								}
								desc = coronation_medium_ceremony
							}
							else = {
								value = 0
							}
						}
						
					}
					treasury = {
						value = {
							if = {
								limit = {
									has_treasury = yes
								}
								value = coronation_large_ceremony_treasury_value
								add = {
									value = coronation_large_ceremony_treasury_value
									multiply = activity_cost_scale_by_era
									subtract = coronation_large_ceremony_treasury_value
								}
								#The bigger your realm, the more it costs
								if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier > tier_empire
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.15
									}
								}
								else_if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier > tier_kingdom
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.2
									}
								}
								else_if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier = tier_kingdom
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.3
									}
								}
								if = {
									limit = {
										has_variable = coronation_discount
									}
									multiply = 0.5
								}
								if = {
									limit = {
										OR = {
											government_has_flag = government_is_nomadic
											government_has_flag = government_is_tribal
										}
									}
									multiply = 0.66
								}
								if = {
									limit = {
										is_ai = yes
										#Go for the cheap option if you poor
										monthly_character_income > 0
									}
									multiply = coronation_amenity_ai_discount_value
								}
								if = {
									limit = {
										OR = {
											has_trait = conqueror
											has_trait = greatest_of_khans
										}
										is_ai = yes
									}
									multiply = 0.25
								}
								desc = coronation_medium_ceremony
							}
							else = {
								value = 0
							}
						}
					}
				}
				is_valid = {
					trigger_if = {
						limit = {
							coronation_proper_artifact_crown_trigger = yes
						}
						custom_tooltip = {
							text = coronation_no_crown_trigger
							coronation_has_proper_artifact_trigger = yes
						}
					}
					trigger_else_if = {
						limit = {
							coronation_proper_artifact_regalia_trigger = yes
						}
						custom_tooltip = {
							text = coronation_no_regalia_trigger
							coronation_has_proper_artifact_trigger = yes
						}
					}
					trigger_else = {
						custom_tooltip = {
							text = coronation_no_crown_or_regalia_trigger
							coronation_has_proper_artifact_trigger = yes
						}
					}
				}
				ai_will_do = {
					value = 0
					# Financial preference.
					add = activity_option_likes_middling_expense_value
					if = {
						limit = {
							can_make_expensive_purchase_trigger = { PRICE = activity_minor_gold_value }
						}
						add = 100
					}
					if = {
						limit = {
							# Some characters just don't want to make a whole big thing of it.
							NOR = {
								has_trait = greedy
								has_trait = shy
								has_trait = humble
								has_trait = temperate
								has_trait = content
							}
							# Or have more than a certain amount of positive greed.
							ai_greed <= high_positive_ai_value
							# _Then_ we check to see how your finances are.
							short_term_gold >= activity_option_expense_gold_high_value
						}
						add = {
							value = 200
							desc = debug_gui.activity_weight.gold.prefers_expense
						}
					}
				}
			}
		}
		ceremony_feast_type = {
			ceremony_feast_type_austere = {
				default = {
					coronation_has_proper_artifact_trigger = no
					highest_held_title_tier = tier_kingdom
				}
				is_valid = {
					custom_tooltip = {
						text = anointment_minimum
						trigger_if = {
							limit = {
								exists = scope:special_option
							}
							NOT = { scope:special_option = flag:coronation_type_anointment }
						}
					}
				}
				ai_will_do = {
					value = 0
					if = {
						limit = {
							monthly_character_income <= 0
						}
						add = 50
					}
					if = {
						limit = {
							NOT = {
								can_make_expensive_purchase_trigger = { PRICE = activity_minor_gold_value }
							}
						}
						add = 25
					}
					if = {
						limit = {
							OR = {
								has_trait = arrogant
								has_trait = gregarious
								has_trait = generous
								has_trait = gluttonous
								has_trait = ambitious
							}
						}
						multiply = 0.1
					}
				}
			}
			ceremony_feast_type_regular = {
				default = {
					OR = {
						highest_held_title_tier >= tier_empire
						coronation_has_proper_artifact_trigger = yes
					}
				}
				cost = {
					gold = {
						value = {
							if = {
								limit = {
									has_treasury = no
								}
								value = coronation_medium_feast_value
								add = {
									value = coronation_medium_feast_value
									multiply = activity_cost_scale_by_era
									subtract = coronation_medium_feast_value
								}
								#The bigger your realm, the more it costs
								if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier > tier_empire
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.1
									}
								}
								else_if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier > tier_kingdom
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.15
									}
								}
								else_if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier = tier_kingdom
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.2
									}
								}
								if = {
									limit = {
										OR = {
											government_has_flag = government_is_nomadic
											government_has_flag = government_is_tribal
										}
									}
									multiply = 0.66
								}
								if = {
									limit = {
										has_variable = coronation_discount
									}
									multiply = 0.5
								}
								if = {
									limit = {
										is_ai = yes
										#Go for the cheap option if you poor
										monthly_character_income > 0
									}
									multiply = coronation_amenity_ai_discount_value
								}
								if = {
									limit = {
										OR = {
											has_trait = conqueror
											has_trait = greatest_of_khans
										}
										is_ai = yes
									}
									multiply = 0.1
								}
								desc = ceremony_feast_type_regular
								if = {
									limit = {
										exists = primary_title
										primary_title.title_held_years >= 5
										is_ai = yes
									}
									multiply = 0.5
								}
								if = {
									limit = {
										is_ai = yes
										exists = primary_title
										OR = {
											has_trait = conqueror
											has_trait = greatest_of_khans
											primary_title.title_held_years >= 10
										}
									}
									multiply = 0.1
								}
							}
							else = {
								value = 0
							}
						}
					}
					treasury = {
						value = {
							if = {
								limit = {
									has_treasury = yes
								}
								value = coronation_medium_feast_treasury_value
								add = {
									value = coronation_medium_feast_treasury_value
									multiply = activity_cost_scale_by_era
									subtract = coronation_medium_feast_treasury_value
								}
								#The bigger your realm, the more it costs
								if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier > tier_empire
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.1
									}
								}
								else_if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier > tier_kingdom
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.15
									}
								}
								else_if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier = tier_kingdom
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.2
									}
								}
								if = {
									limit = {
										OR = {
											government_has_flag = government_is_nomadic
											government_has_flag = government_is_tribal
										}
									}
									multiply = 0.66
								}
								if = {
									limit = {
										has_variable = coronation_discount
									}
									multiply = 0.5
								}
								if = {
									limit = {
										is_ai = yes
										#Go for the cheap option if you poor
										monthly_character_income > 0
									}
									multiply = coronation_amenity_ai_discount_value
								}
								if = {
									limit = {
										OR = {
											has_trait = conqueror
											has_trait = greatest_of_khans
										}
										is_ai = yes
									}
									multiply = 0.1
								}
								desc = ceremony_feast_type_regular
								if = {
									limit = {
										exists = primary_title
										primary_title.title_held_years >= 5
										is_ai = yes
									}
									multiply = 0.5
								}
								if = {
									limit = {
										is_ai = yes
										exists = primary_title
										OR = {
											has_trait = conqueror
											has_trait = greatest_of_khans
											primary_title.title_held_years >= 10
										}
									}
									multiply = 0.1
								}
							}
							else = {
								value = 0
							}
						}
					}
				}
				is_valid = {
					trigger_if = {
						limit = {
							coronation_proper_artifact_crown_trigger = yes
						}
						custom_tooltip = {
							text = coronation_no_crown_trigger
							coronation_has_proper_artifact_trigger = yes
						}
					}
					trigger_else_if = {
						limit = {
							coronation_proper_artifact_regalia_trigger = yes
						}
						custom_tooltip = {
							text = coronation_no_regalia_trigger
							coronation_has_proper_artifact_trigger = yes
						}
					}
					trigger_else = {
						custom_tooltip = {
							text = coronation_no_crown_or_regalia_trigger
							coronation_has_proper_artifact_trigger = yes
						}
					}
				}

				ai_will_do = {
					value = 75
					# Financial preference.
					add = activity_option_likes_middling_expense_value
					# Fanciness preference.
					## We just use slightly reduced fanciness prefs here.
					add = {
						value = activity_option_likes_ostentatious_food_option_value
						multiply = 0.5
					}
					if = {
						limit = {
							can_make_expensive_purchase_trigger = { PRICE = activity_minor_gold_value }
						}
						add = 10
					}
					if = {
						limit = {
							# Some characters just don't want to make a whole big thing of it.
							NOR = {
								has_trait = greedy
								has_trait = shy
								has_trait = humble
								has_trait = temperate
								has_trait = content
							}
							# Or have more than a certain amount of positive greed.
							ai_greed <= medium_positive_ai_value
							# _Then_ we check to see how your finances are.
							short_term_gold >= activity_option_expense_gold_low_value
						}
						add = {
							value = 50
							desc = debug_gui.activity_weight.gold.prefers_expense
						}
					}
				}
			}
			ceremony_feast_type_lavish = {
				cost = {
					gold = {
						value = {
							if = {
								limit = {
									has_treasury = no
								}
								value = coronation_large_feast_value
								add = {
									value = coronation_large_feast_value
									multiply = activity_cost_scale_by_era
									subtract = coronation_large_feast_value
								}
								#The bigger your realm, the more it costs
								if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier > tier_empire
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.3
									}
								}
								else_if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier > tier_kingdom
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.45
									}
								}
								else_if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier = tier_kingdom
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.6
									}
								}
								if = {
									limit = {
										has_variable = coronation_discount
									}
									multiply = 0.5
								}
								if = {
									limit = {
										OR = {
											government_has_flag = government_is_nomadic
											government_has_flag = government_is_tribal
										}
									}
									multiply = 0.66
								}
								if = {
									limit = {
										is_ai = yes
										#Go for the cheap option if you poor
										monthly_character_income > 0
									}
									multiply = coronation_amenity_ai_discount_value
								}
								if = {
									limit = {
										OR = {
											has_trait = conqueror
											has_trait = greatest_of_khans
										}
										is_ai = yes
									}
									multiply = 0.25
								}
								desc = ceremony_feast_type_lavish
							}
							else = {
								value = 0
							}
						}
					}
					treasury = {
						value = {
							if = {
								limit = {
									has_treasury = yes
								}
								value = coronation_large_feast_treasury_value
								add = {
									value = coronation_large_feast_treasury_value
									multiply = activity_cost_scale_by_era
									subtract = coronation_large_feast_treasury_value
								}
								#The bigger your realm, the more it costs
								if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier > tier_empire
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.3
									}
								}
								else_if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier > tier_kingdom
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.45
									}
								}
								else_if = {
									limit = {
										realm_size >= 1
										highest_held_title_tier = tier_kingdom
									}
									add = {
										value = realm_size
										add = {
											value = realm_size
											multiply = activity_cost_scale_by_era
											subtract = realm_size
										}
										multiply = 0.6
									}
								}
								if = {
									limit = {
										has_variable = coronation_discount
									}
									multiply = 0.5
								}
								if = {
									limit = {
										OR = {
											government_has_flag = government_is_nomadic
											government_has_flag = government_is_tribal
										}
									}
									multiply = 0.66
								}
								if = {
									limit = {
										is_ai = yes
										#Go for the cheap option if you poor
										monthly_character_income > 0
									}
									multiply = coronation_amenity_ai_discount_value
								}
								if = {
									limit = {
										OR = {
											has_trait = conqueror
											has_trait = greatest_of_khans
										}
										is_ai = yes
									}
									multiply = 0.25
								}
								desc = ceremony_feast_type_lavish
							}
							else = {
								value = 0
							}
						}
					}
				}
				is_valid = {
					trigger_if = {
						limit = {
							coronation_proper_artifact_crown_trigger = yes
						}
						custom_tooltip = {
							text = coronation_no_crown_trigger
							coronation_has_proper_artifact_trigger = yes
						}
					}
					trigger_else_if = {
						limit = {
							coronation_proper_artifact_regalia_trigger = yes
						}
						custom_tooltip = {
							text = coronation_no_regalia_trigger
							coronation_has_proper_artifact_trigger = yes
						}
					}
					trigger_else = {
						custom_tooltip = {
							text = coronation_no_crown_or_regalia_trigger
							coronation_has_proper_artifact_trigger = yes
						}
					}
				}
				ai_will_do = {
					value = 0
					# Financial preference.
					add = activity_option_likes_middling_expense_value
					# Fanciness preference.
					add = activity_option_likes_ostentatious_food_option_value
					if = {
						limit = {
							can_make_expensive_purchase_trigger = { PRICE = activity_minor_gold_value }
						}
						add = 100
					}
					if = {
						limit = {
							# Some characters just don't want to make a whole big thing of it.
							NOR = {
								has_trait = greedy
								has_trait = shy
								has_trait = humble
								has_trait = temperate
								has_trait = content
							}
							# Or have more than a certain amount of positive greed.
							ai_greed <= high_positive_ai_value
							# _Then_ we check to see how your finances are.
							short_term_gold >= activity_option_expense_gold_high_value
						}
						add = {
							value = 200
							desc = debug_gui.activity_weight.gold.prefers_expense
						}
					}
				}
			}
		}
	}

	province_description = {
		desc = activity_coronation_province_desc

		triggered_desc = {
			trigger = {
				this = scope:host.capital_province
			}
			desc = activity_coronation_capital_province
		}

		triggered_desc = {
			trigger = {
				barony = { is_holy_site_of = scope:host.faith }
			}
			desc = activity_coronation_holy_site_province
		}

		triggered_desc = {
			trigger = {
				has_province_modifier = coronation_ancient_tradition_modifier
			}
			desc = activity_coronation_ancient_tradition_province
		}

		triggered_desc = {
			trigger = {
				has_province_modifier = coronation_long_tradition_modifier
			}
			desc = activity_coronation_long_tradition_province
		}

		triggered_desc = {
			trigger = {
				has_province_modifier = coronation_tradition_modifier
			}
			desc = activity_coronation_tradition_province
		}
	}

	province_score = {
		add = coronation_province_reference_value
	}

	max_province_icons = 3

	province_filter = holy_sites_realm
	ai_province_filter = holy_sites_realm

	max_guest_arrival_delay_time = { months = 8 }

	ai_check_interval = 6

	ai_will_do = { #AI should always do coronations asap as possible if they fulfill the requirements
		value = 1000
		#...unless the game rule is turned off
		if = {
			limit = {
				has_game_rule = coronation_laws_off
			}
			divide = 20
		}
	}

	ai_will_select_province = {
		value = 5
		if = {
			limit = {
				this = scope:host.capital_province
			}
			add = 20
		}
		if = {
			limit = {
				barony = { is_holy_site_of = scope:host.faith }
			}
			add = 20
		}
		if = {
			limit = {
				has_province_modifier = coronation_ancient_tradition_modifier
			}
			add = 100
		}
		if = {
			limit = {
				has_province_modifier = coronation_tradition_modifier
			}
			add = 50
		}
		if = {
			limit = {
				has_province_modifier = coronation_long_tradition_modifier
			}
			add = 20
		}
		#AI should generally avoid other peoples' counties
		if = {
			limit = {
				NOT = {
					county.holder ?= scope:host
				}
			}
			multiply = 0.1
		}
		#Head of Faith holy site
		if = {
			limit = {
				barony = { is_holy_site_of = scope:host.faith }
				barony.holder ?= {
					OR = {
						this = scope:host.faith.religious_head
						any_liege_or_above = { this = scope:host.faith.religious_head }
					}
				}
			}
			add = 100
		}
	}

	###################
	# PHASES
	###################

	phases = {
		#Prelude phase
		coronation_phase_preparations = {
			location_source = pickable
			is_predefined = yes
			order = 1

			on_phase_active = {
				# Intro event for the phase
				trigger_event = coronation_events.0200
				if = {
					limit = { this = scope:host }
					# Intent reward check
					switch = {
						trigger = has_activity_intent
						coronation_impress_attendees = {
							set_variable = {
								name = host_intent_start
								value = flag:coronation_impress_attendees
							}
						}
						coronation_embrace_supporters = {
							set_variable = {
								name = host_intent_start
								value = flag:coronation_embrace_supporters
							}
						}
						coronation_exalt_crown = {
							set_variable = {
								name = host_intent_start
								value = flag:coronation_exalt_crown
							}
						}
						coronation_weaken_detractors = {
							set_variable = {
								name = host_intent_start
								value = flag:coronation_weaken_detractors
							}
						}
					}
					# Vassals send you an angry letter if you didn't invite any
					if = {
						limit = {
							NOT = {
								any_vassal = {
									is_participant_in_activity = scope:activity
								}
							}
						}
						trigger_event = {
							id = coronation_events.3001
							days = 3
						}
					}
					# Progress activity
					scope:activity = { progress_activity_phase_after = { weeks = 6 } }
					# Set up guest subsets
					scope:activity = {
						every_attending_character = {
							limit = {
								NOR = {
									government_has_flag = government_is_herder
									this = scope:host
									has_activity_intent = coronation_offer_support
								}
								trigger_if = {
									limit = {
										has_activity_intent = coronation_disrupt_loyalists
									}
									has_activity_intent = coronation_disrupt_loyalists
								}
								trigger_else = {
									#Opinion combined with a less direct reason
									opinion = {
										target = scope:host
										value < 10
									}
									OR = {
										opinion = {
											target = scope:host
											value <= -30
										}
										AND = {
											is_a_faction_member = yes
											is_vassal_of = scope:host
										}
										has_activity_intent = coronation_seize_advantages
										is_causing_raid_hostility_towards = scope:host
										scope:host = {
											is_causing_raid_hostility_towards = prev
										}
										is_at_war_with = scope:host
										has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
									}
								}
								scope:activity = {
									trigger_if = {
										limit = {
											has_variable_list = blocked_from_detractors	
										}
										NOT = {
											is_target_in_variable_list = {
												name = blocked_from_detractors
												target = prev
											}
										}
									}
									trigger_if = {
										limit = {
											has_variable_list = locked_into_supporters
										}
										NOT = {
											is_target_in_variable_list = {
												name = locked_into_supporters
												target = prev
											}
										}
									}
								}
								#Players should have a reason they can see for their assignment
								trigger_if = {
									limit = {
										is_ai = no
									}
									OR = {
										has_activity_intent = coronation_disrupt_loyalists
										AND = {
											is_a_faction_member = yes
											is_vassal_of = scope:host
										}
										is_causing_raid_hostility_towards = scope:host
										scope:host = {
											is_causing_raid_hostility_towards = prev
										}
										is_at_war_with = scope:host
										has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
										reverse_opinion = {
											target = scope:host
											value < -80
										}
									}
								}
							}
							add_to_list = detractor
						}
						every_attending_character = {
							limit = {
								NOR = {
									government_has_flag = government_is_herder
									this = scope:host
									has_activity_intent = coronation_disrupt_loyalists
									AND = {
										is_vassal_of = scope:host
										is_a_faction_member = yes
									}
									is_at_war_with = scope:host
									is_causing_raid_hostility_towards = scope:host
									scope:host = {
										is_causing_raid_hostility_towards = prev
									}
								}
								trigger_if = {
									limit = {
										has_activity_intent = coronation_offer_support
									}
									has_activity_intent = coronation_offer_support
								}
								trigger_else = {
									OR = {
										opinion = {
											target = scope:host
											value > 50
										}
										is_allied_to = scope:host
										has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host }
										is_obedient_to = scope:host
									}
									opinion = {
										target = scope:host
										value >= 20
									}
								}
								
								NOT = { this = scope:host }
								scope:activity = {
									trigger_if = {
										limit = {
											has_variable_list = blocked_from_supporters
										}
										NOT = {
											is_target_in_variable_list = {
												name = blocked_from_supporters
												target = prev
											}
										}
									}
									trigger_if = {
										limit = {
											has_variable_list = locked_into_detractors
										}
										NOT = {
											is_target_in_variable_list = {
												name = locked_into_detractors
												target = prev
											}
										}
									}
								}
								#Players should have a reason they can see for their assignment
								trigger_if = {
									limit = {
										is_ai = no
									}
									OR = {
										has_activity_intent = coronation_offer_support
										AND = {
											any_tributary = {
												this = scope:host
											}
											reverse_opinion = {
												target = scope:host
												value > 60
											}
										}
										AND = {
											any_vassal = {
												this = scope:host
											}
											reverse_opinion = {
												target = scope:host
												value > 60
											}
										}
										AND = {
											exists = scope:host.house
											house ?= scope:host.house
											reverse_opinion = {
												target = scope:host
												value > 60
											}
										}
										is_allied_to = scope:host
										has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host }
										reverse_opinion = {
											target = scope:host
											value > 80
										}
									}
								}
							}
							add_to_list = supporter
						}
						every_in_list = {
							list = detractor
							scope:activity = {
								add_to_guest_subset = {
									name = detractor
									target = prev
								}
							}
						}
						every_in_list = {
							list = supporter
							limit = {
								NOT = {
									is_in_list = detractor
								}
							}
							scope:activity = {
								add_to_guest_subset = {
									name = supporter
									target = prev
								}
							}
						}
						if = {
							limit = {
								any_in_list = {
									list = supporter
									count >= 3
								}
							}
							ordered_in_list = {
								list = supporter
								max = 3
								order_by = coronation_supporter_sort_value
								scope:activity = {
									add_to_variable_list = {
										name = major_supporter
										target = prev
									}
								}
							}
						}
						else_if = {
							limit = {
								any_in_list = {
									list = supporter
									count = 2
								}
							}
							ordered_in_list = {
								list = supporter
								max = 2
								order_by = coronation_supporter_sort_value
								scope:activity = {
									add_to_variable_list = {
										name = major_supporter
										target = prev
									}
								}
							}
						}
						else_if = {
							limit = {
								any_in_list = {
									list = supporter
									count = 1
								}
							}
							ordered_in_list = {
								list = supporter
								max = 1
								order_by = coronation_supporter_sort_value
								scope:activity = {
									add_to_variable_list = {
										name = major_supporter
										target = prev
									}
								}
							}
						}
						if = {
							limit = {
								any_in_list = {
									list = detractor
									count >= 3
								}
							}
							ordered_in_list = {
								list = detractor
								max = 3
								order_by = coronation_detractor_sort_value
								scope:activity = {
									add_to_variable_list = {
										name = major_detractor
										target = prev
									}
								}
							}
						}
						else_if = {
							limit = {
								any_in_list = {
									list = detractor
									count = 2
								}
							}
							ordered_in_list = {
								list = detractor
								max = 2
								order_by = coronation_detractor_sort_value
								scope:activity = {
									add_to_variable_list = {
										name = major_detractor
										target = prev
									}
								}
							}
						}
						else_if = {
							limit = {
								any_in_list = {
									list = detractor
									count = 1
								}
							}
							ordered_in_list = {
								list = detractor
								max = 1
								order_by = coronation_detractor_sort_value
								scope:activity = {
									add_to_variable_list = {
										name = major_detractor
										target = prev
									}
								}
							}
						}
					}
				}
			}
			
			on_weekly_pulse = {
				if = { #host
					limit = {
						this = scope:host
						NOT = { has_character_flag = no_coronation_events }
					}
					trigger_event = { on_action = coronation_first_phase_host_events }
				}
				else_if = { #major supporter/detractor guest and players
					limit = {
						NOT = { this = scope:host }
					}
					trigger_event = { on_action = coronation_first_phase_guest_events }
				}
			}
		}
		#Ceremony phase
		coronation_phase_coronation = {
			location_source = pickable
			is_predefined = yes
			order = 2

			on_enter_phase = {
				if = {
					limit = { 
						this = scope:host 
						has_multiple_players = no
					}
					scope:activity = { progress_activity_phase_after = { days = 3 } }
				}
				else_if = {
					limit = {
						this = scope:host
						has_multiple_players = yes
					}
					scope:activity = { progress_activity_phase_after = { weeks = 8 } }
					trigger_event = coronation_events.0050
				}
			}

			on_phase_active = {
				# Intro event for the phase
				### All Ceremony events goes through this one
				trigger_event = coronation_events.0205
			}
		}
		#Banquet phase
		coronation_phase_feast = {
			location_source = pickable
			is_predefined = yes
			order = 3

			on_enter_phase = {
				scope:activity = { progress_activity_phase_after = { days = 3 } }
			}
			
			on_phase_active = {
				# Intro event for the phase
				trigger_event = coronation_events.0210
				if = {
					limit = { this = scope:host }
					scope:activity = { progress_activity_phase_after = { weeks = 6 } }
					trigger_event = { #Coronation ending events	
						id = coronation_events.0310
						days = 41
					}
				}
			}
			
			on_weekly_pulse = {
				if = {
					limit = {
						this = scope:host
					}
					trigger_event = { on_action = coronation_third_phase_host_events }
				}
				else_if = {
					limit = {
						NOT = { this = scope:host }
					}
					trigger_event = { on_action = coronation_third_phase_guest_events }
				}
			}

			on_end = {			
			}
		}
	}

	host_intents = {
		intents = { coronation_impress_attendees coronation_embrace_supporters coronation_weaken_detractors coronation_exalt_crown }
		default = coronation_impress_attendees
		player_defaults = { coronation_impress_attendees }
	}

	guest_intents = {
		intents = { coronation_bear_witness coronation_offer_support coronation_advocate_domain coronation_profess_rights coronation_seize_advantages coronation_disrupt_loyalists }
		default = coronation_bear_witness
		player_defaults = { coronation_bear_witness }
	}

	pulse_actions = {
		entries = {
			# Feast APAs
			excellent_food impressed_courtly_vassal hook_trusting_guest leftover_food_giveaway virtuous_feast noble_privileges good_kitty good_puppy antiquarian_admires_artifact jester_entertained_guests apa_executioner spouse_skill_diplomacy_improves spouse_gives_host_prestige spouse_manages_feast_splendidly spouse_impresses_clergy spouse_gives_hook relation_gains_friend lauded_food children_bonding guest_impressed_by_court_artifact guest_chokes_on_bone guest_brawl friend_lauds_efforts courtly_vassals_appeased spouse_insults_host host_gains_diplo_xp host_gains_steward_xp host_gains_intrigue_xp ridiculed_food guest_tells_fantastic_joke
			# Tournament APAs
			tournament_prayed_temple tournament_host_gifted 
			# Pilgrimage APAs
			apa_overcome_with_emotion apa_comet_sighted apa_good_omen
			# Playdate APAs
			apa_joked_together apa_sang_nice_song apa_had_charming_convo 
			# Hunt APAs
			hunt_dog_bond hunt_poetic_inspiration
			# Wedding APAs
			dynasty_blessing cultural_acceptance royal_gift gossip_with_guests contact_network admired_venue knight_praised poetry_performance music_performance floral_exhibit spouse_impressed
			# Journey APAs
			apa_child_learns_something apa_scribe_makes_notes apa_spotted_by_locals apa_spouse_learns_something apa_ate_local_food apa_entourage_stops_pickpocket 
			# Coronation APAs
			loyalty_pledge nobles_cheer regalia_impresses_attendees supporters_bond detractors_bond befriend_loyalists supporter_stresses_detractor praised_king_together bonded_over_help beautiful_choir_song heir_diplomacy_boost heir_stewardship_boost heir_learning_boost
			# General Actions
			guest_friendship guest_insulted
		}
		chance_of_no_event = 5
	}

	# Guests
	special_guests = {
		coronation_hof_guest = {
			is_required = yes

			is_shown = {
				scope:special_option ?= flag:coronation_type_anointment
				exists = faith.religious_head
				NOT = { faith.religious_head = this }
			}

			select_character = {
				faith.religious_head ?= {
					save_scope_as = character
				}
			}
		}
	}

	max_guests = 100

	guest_invite_rules = {
		rules = {
			2 = activity_invite_rule_rivals
			2 = activity_invite_rule_lovers
			2 = activity_invite_rule_potential_lovers
			1 = activity_invite_rule_hof
			
			# MP 
			6 = activity_invite_mp
		}
		defaults = {
			1 = activity_invite_rule_close_family
			1 = activity_invite_spouses_close_family
			2 = activity_invite_rule_extended_family
			2 = activity_invite_spouses_extended_family
			2 = activity_invite_rule_friends
			2 = activity_invite_rule_potential_friends
			2 = activity_invite_rule_councillors
			1 = activity_invite_rule_vassals
			1 = activity_invite_rule_tributaries
			2 = activity_invite_rule_fellow_vassals
			3 = activity_invite_rule_courtiers
			4 = activity_invite_rule_guests
			2 = activity_invite_rule_all_lieges
			2 = activity_invite_neighbouring_rulers
			1 = activity_invite_rule_landless_adventurers_restricted_range
		}
	}

	can_be_activity_guest = {
		is_adult = yes
		in_diplomatic_range = scope:host
		is_pool_guest = no
	}

	guest_join_chance = {
		base = -25
		base_activity_modifier = yes

		# Scripted Modifiers
		activity_guest_shared_ai_accept_modifier = yes

		#All vassals attend if they are capable
		modifier = {
			is_vassal_of = scope:host
			NOT = { faith.religious_head ?= this }
			add = 500
			desc = coronation_special_vassal_value
		}
		modifier = {
			is_vassal_of = scope:host
			faith.religious_head ?= this
			scope:special_type = flag:coronation_type_anointment
			add = 25
			desc = coronation_special_vassal_value
		}
		modifier = {
			faith.religious_head ?= this
			NOT = { scope:special_type = flag:coronation_type_anointment }
			add = -1000
			desc = coronation_pope_not_anointment
		}
		#Lieges, suzerains and tributaries are a bit more likely to attend
		modifier = {
			any_vassal = {
				this = scope:host
			}
			desc = coronation_liege_value
			add = 50
		}
		modifier = {
			any_tributary = {
				this = scope:host
			}
			desc = coronation_suzerain_value
			add = 10
		}
		modifier = {
			suzerain ?= scope:host
			highest_held_title_tier < scope:host.highest_held_title_tier
			desc = coronation_tributary_value
			add = 100
		}
		modifier = {
			suzerain ?= scope:host
			highest_held_title_tier = scope:host.highest_held_title_tier
			desc = coronation_tributary_value
			add = 20
		}

		# Special modifier for the HoF
		modifier = {
			faith.religious_head ?= this
			scope:special_type = flag:coronation_type_anointment
			is_target_in_variable_list = {
				name = supported_anointments
				target = scope:host
			}
			add = 10000
			desc = coronation_hof_supported_anointment
		}
	}

	guest_subsets = {
		supporter
		detractor
	}

	# on_actions
	on_start = {
		activity_setup_special_type_progression_effect = yes
		scope:host = {
			if = {
				limit = {
					has_variable = crowned_king_var
				}
				remove_variable = crowned_king_var
			}
			if = {
				limit = {
					has_variable = crowned_emperor_var
				}
				remove_variable = crowned_emperor_var
			}
			set_variable = {
				name = coronation_primary_title
				value = scope:host.primary_title
			}
			set_variable = {
				name = hide_make_primary_title
				value = 1
			}
		}							
		
		# Activity Province
		scope:activity = {
			if = {
				limit = {
					activity_location = scope:host.capital_province
				}
				change_variable = {
					name = activity_special_type_progression
					add = 5
				}
			}
			if = {
				limit = {
					activity_location.barony = { is_holy_site_of = scope:host.faith }
				}
				change_variable = {
					name = activity_special_type_progression
					add = 5
				}
			}
			if = {
				limit = {
					activity_location = { has_province_modifier = coronation_ancient_tradition_modifier }
				}
				change_variable = {
					name = activity_special_type_progression
					add = 15
				}
			}
			else_if = {
				limit = {
					activity_location = { has_province_modifier = coronation_tradition_modifier }
				}
				change_variable = {
					name = activity_special_type_progression
					add = 10
				}
			}
			else_if = {
				limit = {
					activity_location = { has_province_modifier = coronation_long_tradition_modifier }
				}
				change_variable = {
					name = activity_special_type_progression
					add = 5
				}
			}
		}
		# Activity Options
		if = {
			limit = {
				has_activity_option = {
					category = ceremony_feast_type
					option = ceremony_feast_type_regular
				}
			}
			change_variable = {
				name = activity_special_type_progression
				add = 15
			}
		}
		else_if = {
			limit = {
				has_activity_option = {
					category = ceremony_feast_type
					option = ceremony_feast_type_lavish
				}
			}
			change_variable = {
				name = activity_special_type_progression
				add = 30
			}
		}
		if = {
			limit = {
				has_activity_option = {
					category = ceremony_size
					option = coronation_medium_ceremony
				}
			}
			change_variable = {
				name = activity_special_type_progression
				add = 10
			}
		}
		else_if = {
			limit = {
				has_activity_option = {
					category = ceremony_size
					option = coronation_large_ceremony
				}
			}
			change_variable = {
				name = activity_special_type_progression
				add = 20
			}
		}
		#Being first to hold your title gives you a little boost
		if = {
			limit = {
				scope:host.primary_title = {
					NOT = {
						exists = previous_holder
					}
				}
			}
			change_variable = {
				name = activity_special_type_progression
				add = 5
			}
		}
		#Factions damage starting magnificence
		scope:host = {
			every_targeting_faction = {
				limit = {
					OR = {
						faction_is_type = claimant_faction
						faction_is_type = nation_fracturing_faction
					}
				}
				scope:activity = {
					change_variable = {
						name = activity_special_type_progression
						add = -3
					}
				}
			}
			every_targeting_faction = {
				limit = {
					NOR = {
						faction_is_type = claimant_faction
						faction_is_type = nation_fracturing_faction
					}
				}
				scope:activity = {
					change_variable = {
						name = activity_special_type_progression
						add = -1
					}
				}
			}
			every_targeting_faction = {
				limit = {
					OR = {
						faction_is_type = claimant_faction
						faction_is_type = nation_fracturing_faction
					}
					faction_power > 50
				}
				scope:activity = {
					change_variable = {
						name = activity_special_type_progression
						add = -3
					}
				}
			}
			every_targeting_faction = {
				limit = {
					NOR = {
						faction_is_type = claimant_faction
						faction_is_type = nation_fracturing_faction
					}
					faction_power > 50
				}
				scope:activity = {
					change_variable = {
						name = activity_special_type_progression
						add = -1
					}
				}
			}
			every_targeting_faction = {
				limit = {
					OR = {
						faction_is_type = claimant_faction
						faction_is_type = nation_fracturing_faction
					}
					faction_power >= faction_power_threshold
				}
				scope:activity = {
					change_variable = {
						name = activity_special_type_progression
						add = -3
					}
				}
			}
			every_targeting_faction = {
				limit = {
					NOR = {
						faction_is_type = claimant_faction
						faction_is_type = nation_fracturing_faction
					}
					faction_power >= faction_power_threshold
				}
				scope:activity = {
					change_variable = {
						name = activity_special_type_progression
						add = -1
					}
				}
			}
			every_targeting_faction = {
				limit = {
					OR = {
						faction_is_type = claimant_faction
						faction_is_type = nation_fracturing_faction
					}
					faction_power >= 150
				}
				scope:activity = {
					change_variable = {
						name = activity_special_type_progression
						add = -3
					}
				}
			}
			every_targeting_faction = {
				limit = {
					NOR = {
						faction_is_type = claimant_faction
						faction_is_type = nation_fracturing_faction
					}
					faction_power >= 150
				}
				scope:activity = {
					change_variable = {
						name = activity_special_type_progression
						add = -1
					}
				}
			}
			every_targeting_faction = {
				limit = {
					OR = {
						faction_is_type = claimant_faction
						faction_is_type = nation_fracturing_faction
					}
					faction_power >= 200
				}
				scope:activity = {
					change_variable = {
						name = activity_special_type_progression
						add = -3
					}
				}
			}
			every_targeting_faction = {
				limit = {
					NOR = {
						faction_is_type = claimant_faction
						faction_is_type = nation_fracturing_faction
					}
					faction_power >= 200
				}
				scope:activity = {
					change_variable = {
						name = activity_special_type_progression
						add = -1
					}
				}
			}
			every_targeting_faction = {
				limit = {
					OR = {
						faction_is_type = claimant_faction
						faction_is_type = nation_fracturing_faction
					}
					discontent_per_month > 0
					months_until_max_discontent <= 12
				}
				scope:activity = {
					change_variable = {
						name = activity_special_type_progression
						add = -3
					}
				}
			}
			every_targeting_faction = {
				limit = {
					NOR = {
						faction_is_type = claimant_faction
						faction_is_type = nation_fracturing_faction
					}
					discontent_per_month > 0
					months_until_max_discontent <= 12
				}
				scope:activity = {
					change_variable = {
						name = activity_special_type_progression
						add = -1
					}
				}
			}
			every_targeting_faction = {
				limit = {
					OR = {
						faction_is_type = claimant_faction
						faction_is_type = nation_fracturing_faction
					}
					discontent_per_month > 0
					months_until_max_discontent <= 8
				}
				scope:activity = {
					change_variable = {
						name = activity_special_type_progression
						add = -3
					}
				}
			}
			every_targeting_faction = {
				limit = {
					NOR = {
						faction_is_type = claimant_faction
						faction_is_type = nation_fracturing_faction
					}
					discontent_per_month > 0
					months_until_max_discontent <= 8
				}
				scope:activity = {
					change_variable = {
						name = activity_special_type_progression
						add = -1
					}
				}
			}
			every_targeting_faction = {
				limit = {
					OR = {
						faction_is_type = claimant_faction
						faction_is_type = nation_fracturing_faction
					}
					discontent_per_month > 0
					months_until_max_discontent <= 4
				}
				scope:activity = {
					change_variable = {
						name = activity_special_type_progression
						add = -3
					}
				}
			}
			every_targeting_faction = {
				limit = {
					OR = {
						faction_is_type = claimant_faction
						faction_is_type = nation_fracturing_faction
					}
					discontent_per_month > 0
					months_until_max_discontent <= 4
				}
				scope:activity = {
					change_variable = {
						name = activity_special_type_progression
						add = -1
					}
				}
			}
		}
		# Set HoF as officiant in anointments
		if = {
			limit = {
				scope:special_option ?= flag:coronation_type_anointment
				exists = scope:host.faith.religious_head
			}
			scope:activity = {
				set_variable = {
					name = officiator
					value = scope:host.faith.religious_head
				}
			}
		}					
	}
	
	on_enter_passive_state = {
		scope:activity = {
			if = {
				limit = {
					NOT = { has_variable = progressed_to_active }
					# Everyone who accepted is here
					any_attending_character = {
						count = all
						location = scope:activity.activity_location
					}
					# There are no open invitations
					any_invited_character = {
						count = 0
					}
				}
				set_variable = progressed_to_active
				scope:activity = { progress_activity_phase_after = { days = 1 } }
			}
		}

		if = {
			limit = {
				scope:activity = { has_current_phase = coronation_phase_preparations }
			}
			trigger_event = ach_coronation.0001
		}
	}

	on_complete = {
		var:officiator ?= {
			remove_character_flag = coronation_officiator
		}	
		if = {
			limit = {
				this = scope:host
			}
			remove_character_flag = no_coronation_events
			if = {
				limit = {
					scope:activity = {
						has_activity_option = {
							category = ceremony_size
							option = coronation_small_ceremony
						}
						var:activity_special_type_progression < 50
					}
				}
				if = {
					limit = {
						is_ai = no
					}
					add_character_modifier = {
						modifier = ach_coronation_low_ceremony_modifier
						years = 10
					}
				}
				#A small chance AI suffer for the cheapness they rely on
				else = {
					random = {
						chance = {
							value = 5
							#personality fits
							if = {
								limit = {
									OR = {
										has_trait = humble
										has_trait = content
										has_trait = impatient
										prestige_level <= 1
									}
								}
								add = 5
							}
						}
						add_character_modifier = {
							modifier = ach_coronation_low_ceremony_modifier
							years = 10
						}
					}
				}
			}
			if = {
				limit = {
					is_ai = no
					scope:activity = {
						has_activity_option = {
							category = ceremony_feast_type
							option = ceremony_feast_type_austere
						}
						var:activity_special_type_progression < 50
					}
				}
				if = {
					limit = { is_ai = no }
					if = {
						limit = { government_has_flag = government_is_mandala }
						add_character_modifier = {
							modifier = mandala_coronation_low_feast_modifier
							years = 10
						}
					}
					else = {
						add_character_modifier = {
							modifier = ach_coronation_low_feast_modifier
							years = 10
						}
					}
				}
				#A small chance AI suffer for the cheapness they rely on
				else = {
					random = {
						chance = {
							value = 5
							#personality fits
							if = {
								limit = {
									OR = {
										has_trait = temperate
										has_trait = greedy
										has_trait = shy
										stress_level >= 1
									}
								}
								add = 5
							}
						}
						if = {
							limit = { government_has_flag = government_is_mandala }
							add_character_modifier = {
								modifier = mandala_coronation_low_feast_modifier
								years = 10
							}
						}
						else = {
							add_character_modifier = {
								modifier = ach_coronation_low_feast_modifier
								years = 10
							}
						}
					}
				}
			}
			#In case of failure during ceremony phase... setting realm laws here
			if = {
				limit = {
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = coronation_type_anointment
						}
					}
					NOT = {
						has_realm_law = crowned_emperor
					}
				}
				coronation_change_law_effect = yes
			}
			else_if = {
				limit = {
					has_realm_law = uncrowned
				}
				coronation_change_law_effect = yes
			}
			else = {
				show_as_tooltip = {
					coronation_change_law_effect = yes
				}
			}
			coronation_disburse_rewards_effect = yes
			coronation_upgrade_oath_value_effect = yes
			if = {
				limit = {
					scope:activity = { has_variable = officiator }
				}
				if = {
					limit = {
						scope:activity.activity_host.faith.religious_head ?= scope:activity.var:officiator
					}
					create_character_memory = {
						type = crowned_by_hof_memory
						participants = {
							hof = scope:activity.var:officiator
						}
					}
				}
				else = {
					create_character_memory = {
						type = held_a_coronation_memory
						participants = {
							coronator = scope:activity.var:officiator
						}
					}
				}
			}
			remove_variable = coronation_primary_title
			remove_variable = hide_make_primary_title
		}
		if = {
			limit = {
				NOT = {
					this = scope:host
				}
			}
			create_character_memory = {
				type = witnessed_a_coronation_memory
				participants = {
					host = scope:host
				}
			}
		}
		scope:activity.activity_location = {
			if = {
				limit = {
					exists = scope:activity.var:activity_special_type_progression
					scope:activity.var:activity_special_type_progression >= 50
				}
				if = {
					limit = {
						has_variable = coronation_tradition_location
					}
					change_variable = {
						name = coronation_tradition_location
						add = 1
					}
					if = {
						limit = {
							var:coronation_tradition_location >= 15
							NOT = { has_province_modifier = coronation_ancient_tradition_modifier }
						}
						add_province_modifier = coronation_ancient_tradition_modifier
						remove_province_modifier = coronation_long_tradition_modifier
					}
					else_if = {
						limit = {
							var:coronation_tradition_location >= 10
							var:coronation_tradition_location < 15
							NOT = { has_province_modifier = coronation_long_tradition_modifier }
						}
						add_province_modifier = coronation_long_tradition_modifier
						remove_province_modifier = coronation_tradition_modifier
					}
					else_if = {
						limit = {
							var:coronation_tradition_location >= 5
							var:coronation_tradition_location < 10
							NOT = { has_province_modifier = coronation_tradition_modifier }
						}
						add_province_modifier = coronation_tradition_modifier
					}
				}
				else = {
					set_variable = {
						name = coronation_tradition_location
						value = 1
					}
				}
			}
		}

		# Struggle Catalysts
		fp3_struggle_catalysts_for_activities_effect = yes
	}

	### Plugin widgets
	activity_window_widgets = {
		coronation_supporter_detractor_widget = "window_activity_contestants_right_bar_container"
		coronation_special_type_progression = "activity_plugin_widgets_summary"
	}

	### Characters & Backgrounds
	## Characters
	window_characters = {
		# Find an important character
		guest = {
			camera = camera_body_right
			
			effect = {
				if = {
					limit = {
						scope:activity = { NOT = { has_current_phase = coronation_phase_coronation } }
						scope:host.location = scope:activity.activity_location
					}
					ordered_attending_character = {
						order_by = {
							value = 1
							add = {
								value = highest_held_title_tier
								multiply = 15
							}
							add = {
								value = domain_size
								multiply = 3
							}
							add = realm_size
						}
						limit = {
							location = scope:activity.activity_location
							NOT = {
								this = scope:host
							}
						}
						add_to_list = characters
					}
				}
			}

			scripted_animation = coronation_guest_animation
		}

		# Find the officiant if they exist, otherwise an important character
		guest = {
			camera = camera_body_right
			
			effect = {
				if = {
					limit = {
						scope:host.location = scope:activity.activity_location
						exists = scope:activity.var:officiator
						scope:activity.var:officiator.location ?= scope:activity.activity_location
					}
					scope:activity.var:officiator = {
						add_to_list = characters
					}
				}
				else_if = {
					limit = {
						scope:host.location = scope:activity.activity_location
						scope:activity = { NOT = { has_current_phase = coronation_phase_coronation } }
						any_attending_character = {
							count >= 4
							location = scope:activity.activity_location
							NOT = {
								this = scope:host
							}
						}
					}
					ordered_attending_character = {
						order_by = {
							value = 1
							add = {
								value = highest_held_title_tier
								multiply = 15
							}
							add = {
								value = domain_size
								multiply = 3
							}
							add = realm_size
						}
						check_range_bounds = no
						position = 3
						limit = {
							location = scope:activity.activity_location
							NOT = {
								this = scope:host
							}
						}
						add_to_list = characters
					}
				}
			}

			scripted_animation = coronation_guest_animation
		}

		# Host
		host = {
			camera = camera_body
			
			effect = {
				if = {
					limit = {
						scope:host.location = scope:activity.activity_location
					}
					scope:host = {
						add_to_list = characters
					}
				}
			}

			scripted_animation = coronation_host_animation
		}
		
		travel_host = {
			camera = camera_event_horse_left
			
			effect = {
				if = {
					limit = {
						NOT = {
							scope:host.location = scope:activity.activity_location
						}
					}
					scope:host = {
						add_to_list = characters
					}
				}
			}

			scripted_animation = {
				triggered_animation = {
					trigger = {
						scope:character.location = { is_sea_province = yes }
					}
					animation = { idle }
				}
				triggered_animation = {
					trigger = { scope:character = { has_trait = impatient } }
					animation = { jockey_gallop }
				}
				animation = jockey_walk
			}
		}

		# Find a family member/spouse/heir
		guest = {
			camera = camera_body_left_slight
			
			effect = {
				if = {
					limit = {
						scope:host.location = scope:activity.activity_location
						scope:activity = { NOT = { has_current_phase = coronation_phase_coronation } }
					}
					ordered_attending_character = {
						order_by = {
							value = 1
							if = {
								limit = {
									is_close_family_of = scope:host
								}
								add = 25
							}
							if = {
								limit = {
									has_relation_friend = scope:host
								}
								add = 25
							}
							if = {
								limit = { 
									this = scope:host.primary_spouse
								}
								add = 50
							}
							if = {
								limit = {
									is_primary_heir_of = scope:host
								}
								add = 25
							}
						}
						limit = {
							location = scope:activity.activity_location
							NOR = { 
								this = scope:host 
								scope:activity.var:officiator ?= this
							}
						}
						add_to_list = characters
					}
				}
			}

			scripted_animation = coronation_guest_animation
		}

		# Find an important member
		guest = {
			camera = camera_body_left
			
			effect = {
				if = {
					limit = {
						scope:host.location = scope:activity.activity_location
						scope:activity = { 
							NOT = { has_current_phase = coronation_phase_coronation } 
						}
						any_attending_character = {
							count >= 3
							location = scope:activity.activity_location
							NOT = {
								this = scope:host
							}
						}
					}
					ordered_attending_character = {
						order_by = {
							value = 1
							add = {
								value = highest_held_title_tier
								multiply = 15
							}
							add = {
								value = domain_size
								multiply = 3
							}
							add = realm_size
						}
						check_range_bounds = no
						position = 2
						limit = {
							location = scope:activity.activity_location
							NOT = {
								this = scope:host
							}
						}
						add_to_list = characters
					}
				}
			}

			scripted_animation = coronation_guest_animation
		}
	}

	## Activity Backgrounds
	# Arrival - Courtyard Pictures
	background = { #Nomadic MENA
		trigger = {
			scope:activity ?= {
				OR = {
					AND = {
						activity_location.county.title_province = {
							has_holding_type = tribal_holding
						}
						activity_location.culture ?= {
							OR = {
								has_cultural_tradition = tradition_saharan_nomads
								has_cultural_tradition = tradition_desert_nomads
							}
						}
					}
					activity_location.county.title_province = {
						has_holding_type = nomad_holding
					}
				}
				activity_location.culture ?= { has_building_gfx = mena_building_gfx }
				activity_location ?= {
					OR = {
						terrain = drylands
						terrain = desert
						terrain = oasis
						terrain = desert_mountains
						terrain = floodplains
						terrain = hills
						terrain = steppe
					}
				}
				has_current_phase = coronation_phase_preparations
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/desert_nomad.dds"
		environment = "environment_travel_desert"
		ambience = "event:/SFX/Events/Backgrounds/desert_day"
	}
	background = { #Nomads and steppe tribals
		trigger = {
			scope:activity ?= {
				OR = {
					activity_location.county.title_province = {
						has_holding_type = nomad_holding
					}
					AND = {
						activity_location.county.title_province = {
							has_holding_type = tribal_holding
						}
						activity_location.culture ?= { has_graphical_steppe_culture_group_trigger = yes }
					}
					scope:host = {
						is_landless_adventurer = yes
						culture ?= { has_graphical_steppe_culture_group_trigger = yes }
					}
				}
				has_current_phase = coronation_phase_preparations
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/mpo_camp_steppe.dds"
		environment = "environment_mpo_camp_steppe"
		ambience = "event:/DLC/CE2/Events/Event_Images/mpo_camp_steppe"
	}
	background = { #Western/Northern tribals
		trigger = {
			scope:activity = {
				activity_location.county.title_province ?= {
					has_holding_type = tribal_holding
				}
				OR = {
					activity_location = {
						steppe_building_gfx_use_western_trigger = yes
					}
					activity_location.culture ?= {
						OR = {
							has_building_gfx = western_building_gfx 
							has_building_gfx = mediterranean_building_gfx 
							has_building_gfx = byzantine_building_gfx 
							has_building_gfx = norse_building_gfx 
							has_building_gfx = iberian_building_gfx 
						}
					}
				}
				has_current_phase = coronation_phase_preparations
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/market_tribal.dds"
		environment = "environment_event_market_tribal"
		ambience = "event:/SFX/Events/Backgrounds/townmarket_day_tribal_pagan"
	}
	background = { #tribal tibetans
		trigger = {
			scope:activity = {
				activity_location.county.title_province ?= {
					has_holding_type = tribal_holding
				}
				activity_location.culture ?= {
					OR = {
						has_cultural_pillar = heritage_tibetan
						has_cultural_pillar = heritage_qiangic
						has_cultural_pillar = heritage_chinese
					}
				}
				has_current_phase = coronation_phase_preparations
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/mpo_rural_village_asian.dds"
		environment = "environment_mpo_rural_village_asian"
		ambience = "event:/DLC/CE2/Events/Event_Images/mpo_rural_village_asian"
	}
	background = { #Non-Nomadic tribal MENA
		trigger = {
			scope:activity = {
				activity_location.county.title_province ?= {
					has_holding_type = tribal_holding
				}
				OR = {
					activity_location.culture ?= { has_building_gfx = mena_building_gfx }
					activity_location.faith.religion ?= religion:islam_religion
				}
				has_current_phase = coronation_phase_preparations
			}
			
		}
		texture = "gfx/interface/illustrations/event_scenes/market_east.dds"
		environment = "environment_event_market_east"
		ambience = "event:/SFX/Events/Backgrounds/town_market_middleeastern_day"
	}
	background = { #tribal fallback
		trigger = {
			scope:activity.activity_location.county.title_province ?= {
				has_holding_type = tribal_holding
			}
			has_current_phase = coronation_phase_preparations
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_holysite_tribal.dds"
		environment = "environment_event_garden"
		ambience = "event:/DLC/FP1/SFX/Events/event_temple" 
	}
	background = {	#Constantinople
		trigger = {
			scope:activity ?= {
				activity_location.county = title:c_byzantion
				has_current_phase = coronation_phase_preparations
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep3_constantinople.dds"
		environment = "environment_ep3_constantinople"
		ambience = "event:/DLC/EP3/SFX/Events/Event_Images/ep3_evn_eventimage_constantinople" 
	}
	background = {	#FP2
		trigger = {
			scope:activity ?= {
				activity_location = {
					OR = {
						culture = { has_building_gfx = iberian_building_gfx }
						geographical_region = world_europe_west_iberia
					}
				}
				has_current_phase = coronation_phase_preparations
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/fp2_courtyard.dds"
		environment = "environment_event_fp2_courtyard" 
		ambience = "event:/DLC/FP2/SFX/Events/courtyard" 
	}
	background = {	#Mandala shrine
		trigger = {
			scope:activity ?= {
				activity_location = {
					OR = {
						culture = { has_building_gfx = southeast_asian_building_gfx }
						steppe_building_gfx_use_southeast_asian_trigger = yes
					}
					
				}
				has_current_phase = coronation_phase_preparations
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_holysite_indian.dds"
		environment = "environment_indian_holy_site"
		ambience = "event:/DLC/EP2/SFX/Events/Backgrounds/evn_background_jungle"
	}
	background = {	#Indian Courtyard
		trigger = {
			scope:activity ?= {
				activity_location = {
					OR = {
						culture = { has_graphical_india_culture_group_trigger = yes }
						steppe_building_gfx_use_indian_trigger = yes
					}
				}
				has_current_phase = coronation_phase_preparations
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/bp1_courtyard_indian.dds"
		environment = "environment_event_bp1_courtyard_indian" 
		ambience = "event:/SFX/Events/Backgrounds/castle_courtyard_western"
	}
	background = {	#MENA Courtyard
		trigger = {
			scope:activity ?= {
				activity_location = {
					OR = {
						culture = { has_graphical_mena_culture_group_trigger = yes }
						culture = { has_building_gfx = iranian_building_gfx }
						steppe_building_gfx_use_mena_trigger = yes
					}
				}
				has_current_phase = coronation_phase_preparations
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/bp1_courtyard_mena.dds"
		environment = "environment_event_bp1_courtyard_mena"
		ambience = "event:/SFX/Events/Backgrounds/castle_courtyard_western"
	}
	background = {	#East Asia
		trigger = {
			scope:activity ?= {
				activity_location ?= {
					OR = {
						culture ?= {
							has_graphical_east_asia_culture_group_trigger = yes
						}
						steppe_building_gfx_use_east_asian_trigger = yes
					}
				}
			}
			has_current_phase = coronation_phase_preparations
		}
		texture = "gfx/interface/illustrations/event_scenes/tgp_courtyard_asia.dds"
		environment = "environment_tgp_courtyard_asia"
		ambience = "event:/DLC/EP4/SFX/Events/Event_Backgrounds/tgp_courtyard_asia"
	}
	background = { # Fallback
		trigger = {
			scope:activity ?= { has_current_phase = coronation_phase_preparations }
		}
		texture = "gfx/interface/illustrations/event_scenes/bp2_courtyard.dds"
		environment = "environment_bp2_courtyard"
		ambience = "event:/DLC/FP2/SFX/Events/courtyard" 
	}

	# Ceremony - Throne Room Pictures
	background = { # MPO - High Dominance
		trigger = {
			scope:activity ?= {
				activity_location = { NOT = { has_holding_type = church_holding } }
				scope:host = {
					government_has_flag = government_is_nomadic
					OR = {
						has_realm_law = nomadic_authority_3
						has_realm_law = nomadic_authority_4
						has_realm_law = nomadic_authority_5
						has_trait = greatest_of_khans
					}
				}
				has_current_phase = coronation_phase_coronation
			}
		}
		texture = "gfx/interface/illustrations/main_menu/mpo_frontend_nomad.dds"
		environment = "environment_mpo_frontend_nomad_main"
		ambience = "event:/DLC/CE2/Events/Event_Images/mpo_nomadic_throneroom"
	}
	background = { # MPO - Nomads
		trigger = {
			scope:activity ?= {
				activity_location = { NOT = { has_holding_type = church_holding } }
				scope:host = {
					government_has_flag = government_is_nomadic
					NOR = {
						has_realm_law = nomadic_authority_4
						has_realm_law = nomadic_authority_5
						has_trait = greatest_of_khans
					}
				}
				has_current_phase = coronation_phase_coronation
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/mpo_tent_interior_mongol.dds"
		environment = "environment_mpo_tent_interior_mongol"
		ambience = "event:/DLC/CE2/Events/Event_Images/mpo_tent_interior_mongol"
	}
	background = { #FP1 Tribal
		trigger = {
			scope:activity ?= {
				activity_location = {
					NOT = { has_holding_type = church_holding }
					culture = { has_building_gfx = norse_building_gfx }
				}
				activity_location.county.title_province = {
					has_holding_type = tribal_holding
				}
				has_current_phase = coronation_phase_coronation
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/fp1_throneroom_tribal.dds"
		environment = "environment_event_fp1_throneroom_tribal"
		ambience = "event:/DLC/FP1/SFX/Events/event_throneroom"
	}
	background = { #Tribal
		trigger = {
			scope:activity ?= {
				activity_location = { NOT = { has_holding_type = church_holding } }
				activity_location.county.title_province = {
					has_holding_type = tribal_holding
				}
				has_current_phase = coronation_phase_coronation
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/throneroom_tribal.dds"
		environment = "environment_frontend_tribal_main"
		ambience = "event:/SFX/Events/Backgrounds/throneroom_tribal_pagan"
	}
	background = { # Byzanntium
		trigger = {
			scope:activity ?= {
				activity_location = { NOT = { has_holding_type = church_holding } }
				scope:host = {
					OR = {
						location = province:b_constantinople
						AND = {
							primary_title = title:e_byzantium
							title:c_byzantion = {
								any_de_jure_top_liege = { this = root } 
							}
						}
					}
				}
				has_current_phase = coronation_phase_coronation
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep3_byzantine_throne_room.dds"
		environment = "environment_ep3_byzantine_throne_room"
		ambience = "event:/DLC/EP3/SFX/Events/Event_Images/ep3_evn_eventimage_byzantine_throne_room" 
	}
	background = { # TGP Japan
		trigger = {
			scope:activity ?= {
				activity_location = {
					NOT = { has_holding_type = church_holding }
					OR = {
						culture = { has_graphical_japanese_culture_group_trigger = yes }
						steppe_building_gfx_use_japanese_trigger = yes
					}
				}
				has_current_phase = coronation_phase_coronation
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/tgp_japan_throne_room.dds"
		environment = "environment_tgp_frontend_japan_main"
		ambience = "event:/DLC/EP4/SFX/Events/Event_Backgrounds/tgp_study_asia"
	}
	background = { # East Asia
		trigger = {
			scope:activity ?= {
				activity_location = {
					NOT = { has_holding_type = church_holding }
					OR = {
						culture = { has_graphical_east_asia_culture_group_trigger = yes }
						steppe_building_gfx_use_east_asian_trigger = yes
					}
				}
				has_current_phase = coronation_phase_coronation
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/tgp_asia_throne_room.dds"
		environment = "environment_tgp_frontend_celestial_main"
		ambience = "event:/DLC/EP4/SFX/Events/Event_Backgrounds/tgp_study_asia"
	}
	background = {	#Iran
		trigger = {
			scope:activity ?= {
				activity_location = {
					NOT = { has_holding_type = church_holding }
					OR = {
						culture ?= { has_building_gfx = iranian_building_gfx }
						geographical_region = world_persian_empire
						steppe_building_gfx_use_iranian_trigger = yes
					}
				}
				has_current_phase = coronation_phase_coronation
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/fp3_throneroom.dds"
		environment = "environment_event_temple"
		ambience = "event:/SFX/Events/Backgrounds/throneroom_middleeastern_african" 
	}
	background = {	#Iberia
		trigger = {
			scope:activity ?= {
				activity_location = {
					NOT = { has_holding_type = church_holding }
					OR = {
						culture ?= { has_building_gfx = iberian_building_gfx }
						geographical_region = world_europe_west_iberia
					}
				}
				has_current_phase = coronation_phase_coronation
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/fp2_throneroom.dds"
		environment = "environment_event_fp2_throneroom"
		ambience = "event:/DLC/FP2/SFX/Events/throneroom" 
	}
	background = {	#Norse Non-Tribal
		trigger = {
			scope:activity ?= {
				activity_location = { NOT = { has_holding_type = church_holding } }
				scope:host = {
					location.culture ?= { has_building_gfx = norse_building_gfx }
					NOT = { government_has_flag = government_is_tribal }
				}
				has_current_phase = coronation_phase_coronation
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/fp1_throneroom_nontribal.dds"
		environment = "environment_event_fp1_throneroom_nontribal"
		ambience = "event:/DLC/FP1/SFX/Events/event_throneroom_nontribal"
	}
	background = { #MENA
		trigger = {
			scope:activity ?= {
				activity_location = { 
					NOT = { has_holding_type = church_holding }
					OR = {
						steppe_building_gfx_use_mena_trigger = yes
						culture = { has_graphical_mena_culture_group_trigger = yes }
					}
				}
				has_current_phase = coronation_phase_coronation
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/throneroom_east.dds"
		environment = "environment_frontend_east_main"
		ambience = "event:/SFX/Events/Backgrounds/throneroom_middleeastern_african"
	}
	background = { #India
		trigger = {
			scope:activity ?= {
				activity_location = {
					NOT = { has_holding_type = church_holding }
					OR = {
						steppe_building_gfx_use_indian_trigger = yes
						culture = { has_graphical_india_culture_group_trigger = yes }
					}
				}
				has_current_phase = coronation_phase_coronation
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/throneroom_india.dds"
		environment = "environment_frontend_india_main"
		ambience = "event:/SFX/Events/Backgrounds/throneroom_middleeastern_african"
	}

	background = { #Mediterrenean
		trigger = {
			scope:activity ?= {
				activity_location = {
					NOT = { has_holding_type = church_holding }
					OR = {
						culture = { has_graphical_mediterranean_culture_group_trigger = yes }
						steppe_building_gfx_use_mediterranean_trigger = yes
					}
				}
				has_current_phase = coronation_phase_coronation
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/throneroom_mediterranean.dds"
		environment = "environment_frontend_mediterranean_main"
		ambience = "event:/SFX/Events/Backgrounds/throneroom_mediterranean"
	}

	background = { #Western
		trigger = {
			scope:activity ?= {
				activity_location = { NOT = { has_holding_type = church_holding } }
				has_current_phase = coronation_phase_coronation
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/throneroom_west.dds"
		environment = "environment_frontend_west_main"
		ambience = "event:/SFX/Events/Backgrounds/throneroom_western"
	}

	# Ceremony - Church Pictures
	
	background = {	# FP3
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_coronation
			}
			scope:host.religion = religion:zoroastrianism_religion
		}
		texture = "gfx/interface/illustrations/event_scenes/fp3_temple.dds"
		environment = "environment_event_fp3_temple"
		ambience = "event:/SFX/Events/Backgrounds/temple_generic" 
	}
	background = {
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_coronation
				OR = {
					#Coronation in nomadic holding
					activity_location = {
						OR = {
							has_holding_type = tribal_holding
							has_holding_type = nomad_holding
							has_holding_type = herder_holding
						}
					}
					#Ruler faith matches
					scope:host = {
						OR = {
							religion = religion:tengrism_religion
							religion = religion:magyar_religion
							religion = religion:siberian_religion
							religion = religion:kamuyism_religion
							AND = {
								religion = religion:buddhism_religion
								scope:activity.activity_location ?= {
									OR = {
										geographical_region = world_tibet
										geographical_region = world_steppe_tarim
									}
								}
								OR = {
									government_has_flag = government_is_tribal
									government_has_flag = government_is_nomadic
								}
							}
						}
					}
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/mpo_temple_steppe.dds"
		environment = "environment_mpo_temple_steppe" 
		ambience = "event:/DLC/CE2/Events/Event_Images/mpo_temple_steppe"
	}
	background = { # EP3 - Hagia Sophia for Byzantium
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_coronation
			}
			scope:host = {
				scope:activity.activity_location.county = title:c_byzantion
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep3_hagia_sophia.dds"
		environment = "environment_ep3_hagia_sophia"
		ambience = "event:/DLC/EP3/SFX/Events/Event_Images/ep3_evn_eventimage_hagia_sophia" 
	}
	background = {	# FP2
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_coronation
				OR = {
					activity_location.culture ?= { has_building_gfx = iberian_building_gfx }
					activity_location ?= { geographical_region = world_europe_west_iberia }
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/fp2_temple.dds"
		environment = "environment_event_fp2_temple"
		ambience = "event:/DLC/FP2/SFX/Events/temple" 
	}
	background = { #Orthodox holy site
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_coronation
			}
			scope:host = {
				OR = {
					religion = religion:eastern_orthodox_religion
					religion = religion:catholic_religion
					religion = religion:protestant_religion
				}
				scope:activity.activity_location ?= {
					OR = {
						AND = {
							culture = {	has_graphical_mediterranean_culture_group_trigger = yes }
							scope:host.faith = faith:orthodox
						}
						geographical_region = graphical_mena
						geographical_region = graphical_india
						geographical_region = world_europe_south_east
						geographical_region = world_asia_minor
					}
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep3_holysite_orthodox.dds"
		environment = "environment_ep3_holysite_orthodox"
		ambience = "event:/DLC/EP3/SFX/Events/Event_Images/ep3_evn_eventimage_orthodox_holy_site"
	}
	background = { #Western holy site
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_coronation
				activity_location = {
					OR = {
						culture ?= { has_graphical_western_culture_group_trigger = yes }
						steppe_building_gfx_use_western_trigger = yes
					}
				}
			}
			scope:host = {
				religion = religion:christianity_religion
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_holysite_western.dds"
		environment = "environment_western_holy_site"
		ambience = "event:/SFX/Events/Backgrounds/temple_christian"
	}
	background = { #Generic christian church
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_coronation
			}
			scope:host = { religion = religion:christianity_religion }
		}
		texture = "gfx/interface/illustrations/event_scenes/church.dds"
		environment = "environment_event_church"
		ambience = "event:/SFX/Events/Backgrounds/temple_christian"
	}
	background = {
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_coronation
			}
			scope:host = {
				faith = { religion = religion:islam_religion }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_holysite_mena.dds"
		environment = "environment_generic_holy_site_mena" 				
		ambience = "event:/DLC/EP2/SFX/Events/Backgrounds/evn_background_holysite_mena"
	}
	background = { # FP1
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_coronation
			}
			scope:host = { religion = religion:germanic_religion }
		}
		texture = "gfx/interface/illustrations/event_scenes/fp1_tribal_temple.dds"
		environment = "environment_event_fp1_tribal_temple"
		ambience = "event:/DLC/FP1/SFX/Events/event_temple"
	}
	background = { #East Asian
		trigger = {
			scope:activity ?= {
				has_current_phase = coronation_phase_coronation
				activity_location = {
					faith.religion ?= {
						OR = {
							is_in_family = rf_eastern
							is_in_family = rf_sinitic
							this = religion:shintoism_religion
						}
					}
					OR = {
						culture ?= {
							has_graphical_east_asia_culture_group_trigger = yes
						}
						steppe_building_gfx_use_east_asian_trigger = yes
					}
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/tgp_temple_asia.dds"
		environment = "environment_tgp_temple_asia"
		ambience = "event:/DLC/EP4/SFX/Events/Event_Backgrounds/tgp_temple_asia"
	}
	background = { #Dharmic (Outdoors)
		trigger = {
			scope:activity ?= {
				has_current_phase = coronation_phase_coronation
				activity_location ?= {
					OR = {
						culture = { has_graphical_india_culture_group_trigger = yes }
						steppe_building_gfx_use_indian_trigger = yes
						faith.religion ?= {	is_in_family = rf_eastern }
					}
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_holysite_indian.dds"
		environment = "environment_indian_holy_site"
		ambience = "event:/DLC/EP2/SFX/Events/Backgrounds/evn_background_jungle"
	}
	background = { # generic tribal
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_coronation
			}
			scope:host = {
				religion = { is_in_family = rf_pagan }
				OR = {
					government_has_flag = government_is_tribal
					government_has_flag = government_is_nomadic
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_holysite_tribal.dds"
		environment = "environment_event_garden"
		ambience = "event:/DLC/FP1/SFX/Events/event_temple"
	}
	background = {
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_coronation
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/temple.dds"
		environment = "environment_event_temple"
		ambience = "event:/SFX/Events/Backgrounds/temple_generic"
	}

	# Banquet/Feast - Feast Pictures
	background = { #Nomad
		trigger = {
			scope:activity ?= {
				has_current_phase = coronation_phase_feast
				OR = {
					activity_location.county.title_province = {
						has_holding_type = nomad_holding
					}
					activity_location.culture ?= { has_graphical_steppe_culture_group_trigger = yes }
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_feast_steppe.dds"
		environment = "environment_steppe_feast"
		ambience = "event:/DLC/EP2/SFX/Events/Backgrounds/evn_background_steppe"
	}
	background = {	# EP3
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_feast 
				activity_location.culture = { has_building_gfx = byzantine_building_gfx }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep3_feast_byzantine.dds"
		environment = "environment_ep3_byzantine_feast"
		ambience = "event:/SFX/Events/Backgrounds/corner_of_tavern"
	}
	background = {	# FP1
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_feast 
				OR = {
					AND = {
						activity_location.culture ?= { has_building_gfx = western_building_gfx }
						activity_location.county.title_province = {
							has_holding_type = tribal_holding
						}
					}
					activity_location.culture = { has_building_gfx = norse_building_gfx }
				}
				
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/fp1_viking_feast.dds"
		environment = "environment_event_fp1_viking_feast"
		ambience = "event:/DLC/FP1/SFX/Events/event_viking_feast"
	}
	background = {
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_feast
				activity_location = {
					OR = {
						steppe_building_gfx_use_indian_trigger = yes
						culture = { has_graphical_india_culture_group_trigger = yes }
					}
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_feast_indian.dds"
		environment = "environment_indian_feast"
		ambience = "event:/SFX/Events/Backgrounds/feasthall"
	}
	background = {
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_feast 
				activity_location.culture = { has_building_gfx = african_building_gfx }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_feast_sub_saharan.dds"
		environment = "environment_sub-saharan_feast"
		ambience = "event:/SFX/Events/Backgrounds/feasthall"
	}
	background = { #East Asian
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_feast 
				activity_location = {
					OR = {
						culture = { has_graphical_east_asia_culture_group_trigger = yes }
						steppe_building_gfx_use_east_asian_trigger = yes
					}
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/tgp_feast_asia.dds"
		environment = "environment_tgp_feast_asia"
		ambience = "event:/DLC/EP4/SFX/Events/Event_Backgrounds/tgp_feast_asia"
	}
	background = {
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_feast 
				activity_location = {
					OR = {
						steppe_building_gfx_use_mena_trigger = yes 
						culture ?= {
							OR = {
								has_building_gfx = arabic_group_building_gfx
								has_building_gfx = berber_group_building_gfx
								has_building_gfx = iberian_building_gfx
								has_building_gfx = iranian_building_gfx
							}
						}
					}
				}

			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_feast_mena.dds"
		environment = "environment_mena_feast"
		ambience = "event:/SFX/Events/Backgrounds/feasthall"
	}
	background = { #East Asia
		trigger = {
			scope:activity ?= {
				has_current_phase = coronation_phase_feast 
			}
			activity_location.culture = { has_graphical_east_asia_culture_group_trigger = yes }
		}
		texture = "gfx/interface/illustrations/event_scenes/tgp_feast_asia.dds"
		environment = "environment_tgp_feast_asia"
		ambience = "event:/DLC/EP4/SFX/Events/Event_Backgrounds/tgp_feast_asia"
	}
	background = { #fallback Western
		trigger = {
			scope:activity ?= { 
				has_current_phase = coronation_phase_feast 
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/feast.dds"
		environment = "environment_event_feast"
		ambience = "event:/SFX/Events/Backgrounds/feasthall"
	}

	# Travel
	background = { # Bridge
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				is_riverside_province = yes
				geographical_region = world_europe
				OR = {
					terrain = farmlands
					terrain = plains
					terrain = mountains
					terrain = hills
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_travel_bridge.dds"
		environment = "environment_travel_bridge"
		ambience = "event:/SFX/Events/Backgrounds/mountains_day"
	}

	background = { #Rice Fields - If we have Paddy fields AND/or terraced hills
	#This goes before other terrain since it can override in many different terrains if built
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				terrain = farmlands
				OR = {
					terrain = terraced_hills
					has_building_or_higher = paddy_fields_01
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/tgp_rice_fields.dds"
		environment = "environment_tgp_rice_fields"
		ambience = "event:/DLC/EP4/SFX/Events/Event_Backgrounds/tgp_rice_fields"
	}

	background = { #Farmlands - East Asia
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				terrain = farmlands
				culture = { has_graphical_east_asia_culture_group_trigger = yes }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/tgp_farm_asia.dds"
		environment = "environment_tgp_farm_asia"
		ambience = "event:/DLC/EP4/SFX/Events/Event_Backgrounds/tgp_farm_asia"
	}
	
	background = { # Farmland, settled
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				terrain = farmlands
				exists = province_owner
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_travel_farm.dds"
		environment = "environment_travel_farmlands"
		ambience = "event:/SFX/Events/Backgrounds/fields_farms_day"
	}
	background = { # Farmland, unsettled
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				terrain = farmlands
				NOT = { exists = province_owner }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/farms.dds"
		environment = "environment_event_farms"
		ambience = "event:/SFX/Events/Backgrounds/fields_farms_day"
	}

	background = { #Desert, settled
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				graphical_wilderness_desert_trigger = yes
				exists = province_owner
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_travel_desert.dds"
		environment = "environment_travel_desert"
		ambience = "event:/SFX/Events/Backgrounds/desert_day"
	}
	background = { #Desert, unsettled
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				graphical_wilderness_desert_trigger = yes
				NOT = { exists = province_owner }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/desert.dds"
		environment = "environment_event_bp1_desert"
		ambience = "event:/SFX/Events/Backgrounds/desert_day"
	}

	background = { #forest snowy
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location ?= { hunt_snowy_forest_trigger = yes }
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_hunt_snowy_forest.dds"
		environment = "environment_hunt_snowy_forest"
		ambience = "event:/SFX/Events/Backgrounds/mountains_day"
	}

	background = { #forest_pine
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				graphical_wilderness_forest_pine_trigger = yes
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/forest_pine.dds"
		environment = "environment_event_forest_pine"
		ambience = "event:/SFX/Events/Backgrounds/coniferous_forest_day"
	}

	background = { #forest
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				graphical_wilderness_forest_trigger = yes
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/forest.dds"
		environment = "environment_event_forest"
		ambience = "event:/SFX/Events/Backgrounds/deciduous_forest_day"
	}

	background = { #mountains, settled
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				graphical_wilderness_mountains_trigger = yes
				exists = province_owner
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_travel_mountains.dds"
		environment = "environment_travel_mountain_settlement"
		ambience = "event:/SFX/Events/Backgrounds/mountains_day"
	}
	background = { #mountains, unsettled
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				graphical_wilderness_mountains_trigger = yes
				NOT = { exists = province_owner }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/mountains.dds"
		environment = "environment_event_mountains"
		ambience = "event:/SFX/Events/Backgrounds/mountains_day"
	}

	background = { #steppe, settled
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				graphical_wilderness_steppe_trigger = yes
				exists = province_owner
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_travel_steppe.dds"
		environment = "environment_travel_steppe_settlement"
		ambience = "event:/SFX/Events/Backgrounds/steppe_day"
	}
	background = { #steppe, unsettled
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				graphical_wilderness_steppe_trigger = yes
				NOT = { exists = province_owner }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/steppe.dds"
		environment = "environment_event_steppe"
		ambience = "event:/SFX/Events/Backgrounds/steppe_day"
	}

	background = { #drylands (formerly desert)
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				graphical_drylands_trigger = yes
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/drylands.dds"
		environment = "environment_event_desert"
		ambience = "event:/SFX/Events/Backgrounds/desert_day"
	}

	background = { #wetlands
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				graphical_wilderness_wetlands_trigger = yes
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/bp1_wetlands.dds"
		environment = "environment_event_bp1_wetlands" 
		ambience = "event:/SFX/Events/Backgrounds/deciduous_forest_day"
	}

	background = { #jungle
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				graphical_wilderness_jungle_trigger = yes
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/bp1_jungle.dds"
		environment = "environment_event_bp1_jungle"
		ambience = "event:/SFX/Events/Backgrounds/deciduous_forest_day"
	}

	background = { #plains, settled
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				graphical_plains_trigger = yes
				exists = province_owner
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_travel_hills.dds"
		environment = "environment_travel_hills_settlement"
		ambience = "event:/SFX/Events/Backgrounds/fields_farms_day"
	}
	background = { #plains, unsettled
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				graphical_plains_trigger = yes
				NOT = { exists = province_owner }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/bp1_plains.dds"
		environment = "environment_event_bp1_plains"
		ambience = "event:/SFX/Events/Backgrounds/fields_farms_day"
	}

	background = { #hills, settled
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				graphical_hills_trigger = yes
				exists = province_owner
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_travel_hills.dds"
		environment = "environment_travel_hills_settlement"
		ambience = "event:/SFX/Events/Backgrounds/fields_farms_day"
	}
	background = { #hills, unsettled
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				graphical_hills_trigger = yes
				NOT = { exists = province_owner }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/bp1_hills.dds"
		environment = "environment_event_bp1_hills"
		ambience = "event:/SFX/Events/Backgrounds/fields_farms_day"
	}

	background = { #sea
		trigger = {
			OR = {
				NOT = {
					scope:host.location = scope:activity.activity_location
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest.location
					NOT = {
						scope:activity.special_guest:honorary_guest.location ?= scope:activity.activity_location
					}
				}
				AND = {
					exists = scope:activity.special_guest:honorary_guest_regular.location
					NOT = {
						scope:activity.special_guest:honorary_guest_regular.location ?= scope:activity.activity_location
					}
				}
			}
			scope:host.location = {
				is_sea_province = yes
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/fp1_ocean.dds"
		environment = "environment_event_fp1_ocean"
		ambience = "event:/DLC/FP1/SFX/Events/event_ocean_longship"
	}
	# End Travel
}
