﻿namespace = coronation_events

#########################################
# Coronation - Flavor Events			#
# coronation_events - 6000-6999			#
# Jason "Dirty Dog" Cantalini			#
#########################################

scripted_trigger coronation_events_6000_valid_switch_title_trigger = {
	is_landless_type_title = no
	#Only one tier beneath host
	tier = scope:host.highest_held_title_tier_minus_one
	#Host isn't already de jure liege
	NOT = { de_jure_liege = scope:host.primary_title }
	#Shouldn't be possible if the de jure liege is at war for your title
	trigger_if = {
		limit = {
			exists = de_jure_liege.holder
		}
		de_jure_liege.holder = {
			NOT = {
				any_character_war = {
					primary_attacker = prev
					primary_defender = {
						OR = {
							this = scope:host
							this = root
						}
					}
					any_in_list = {
						list = war_targets
						OR = {
							this = root.primary_title
							any_in_de_jure_hierarchy = {
								this = root.primary_title
							}
						}
						
					}
				}
			}
		}
	}
	#Either borders liege title or borders yours, so we won't make disjointed messes
	any_de_jure_county = {
		OR = {
			any_neighboring_county = {
				duchy = {
					OR = {
						this = scope:host.capital_county.duchy
						this = root.primary_title
						kingdom = scope:host.primary_title
					}
				}
			}
			duchy = scope:host.capital_county.duchy
		}		
	}
	#Every county is in realm
	any_de_jure_county = {
		count = all
		holder = {
			OR = {
				this = scope:host
				any_liege_or_above = {
					this = scope:host
				}
			}
		}
	}
}
scripted_effect coronation_events_6000_confederation_de_jure_effect = {
	hidden_effect = {
		scope:host = {
			primary_title = {
				set_destroy_on_gain_same_tier = no
			}
		}
	}
	
	#Switch de jure
	every_in_list = {
		list = new_confederation_de_jure
		set_de_jure_liege_title = scope:host.primary_title
	}
	
	if = {
		limit = {
			root = scope:loyal_vassal
		}
		add_prestige = {
			add = minor_prestige_loss
			multiply = "list_size(new_confederation_de_jure)"
		}
		reverse_add_opinion = {
			modifier = impressed_opinion
			target = scope:host
			opinion = 30
		}
	}
	else = {
		hidden_effect = {
			add_prestige = {
				add = minor_prestige_loss
				multiply = "list_size(new_confederation_de_jure)"
			}
			reverse_add_opinion = {
				modifier = impressed_opinion
				target = scope:host
				opinion = 30
			}
		}
	}
	
	#If this is the Confederation's first de jure duchy, give liege chance to confirm and remove "destroy on gain same tier"
	if = {
		limit = {
			scope:host.primary_title = {
				any_direct_de_jure_vassal_title = {
					count = all
					holder ?= {
						OR = {
							this = root
							this = scope:host
						}
					}
				}
			}
		}
		scope:host = {
			primary_title = {
				custom_tooltip = confederation_remove_destroy_chance_tt
			}
		}
	}
	if = {
		limit = {
			scope:host.primary_title = {
				NOT = {
					exists = empire
				}
			}
		}
		scope:host = {
			primary_title = {
				set_de_jure_liege_title = scope:de_jure_empire
			}
		}
	}
	
	scope:activity = {
		add_activity_log_entry = {
			key = coronation_confederation_de_jure_log
			character = scope:host
			target = scope:loyal_vassal
			score = 100
			show_in_conclusion = yes
		}
	}
	scope:loyal_vassal = {
		create_character_memory = {
			type = offered_realm_to_confederation_memory
			participants = {
				liege = scope:host
			}
		}
	}
}
# You are a vassal at a confederation kingdom's coronation and it feels p good
coronation_events.6000 = {
	type = activity_event
	title = coronation_events.6000.t
	desc = coronation_events.6000.desc
	left_portrait = {
		character = root
		animation = admiration
	}
	center_portrait = {
		character = scope:host
		animation = laugh
		camera = camera_event_left
	}
	right_portrait = {
		character = scope:other_vassal
		animation = standing_horse
		camera = camera_event_standing_with_horse_right
	}
	override_background = {
		reference = courtyard
	}
	theme = coronation_activity
	cooldown = { years = 1 }

	trigger = {
		liege ?= { this = scope:activity.activity_host }
		is_ruler = yes
		highest_held_title_tier >= tier_county
		scope:activity = {
			activity_host = {
				#The succession law is really the only thing that makes it a Confederation kingdom
				primary_title = {
					has_title_law = confederation_elective_succession_law
				}
				highest_held_title_tier = tier_kingdom
				NOR = {
					tyranny >= low_tyranny
					has_trait = arrogant
					dread >= 80
				}
			}
			any_attending_character = {
				NOR = {
					this = root
					this = scope:activity.activity_host
					is_in_guest_subset = {
						name = detractor
					}
				}
				liege = scope:activity.activity_host
				age >= 6
			}
		}
	}
	weight_multiplier = {
		base = 1
		modifier = {
			add = -0.5
			has_trait = paranoid
		}
		modifier = {
			add = -0.25
			has_trait = arrogant
		}
		modifier = {
			add = -0.2
			ai_sociability <= medium_negative_ai_value
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity = {
			activity_host = { save_scope_as = host }
			random_attending_character = {
				limit = {
					NOR = {
						this = root
						this = scope:host
						is_in_guest_subset = {
							name = detractor
						}
					}
					liege = scope:activity.activity_host
					age >= 6
				}
				save_scope_as = other_vassal
			}
		}
		if = {
			limit = {
				NOT = {
					culture = scope:host.culture
				}
			}
			scope:host.culture = {
				add_to_list = other_confed_cultures
			}
		}
		scope:host = {
			every_vassal = {
				limit = {
					NOT = {
						culture = root.culture
					}
				}
				culture = {
					add_to_list = other_confed_cultures
				}
			}
		}
		#Switch de jure
		every_held_title = {
			limit = {
				coronation_events_6000_valid_switch_title_trigger = yes
			}
			add_to_list = new_confederation_de_jure
		}
		#Get completely controlled
		every_held_title = {
			limit = {
				tier = tier_county
				is_landless_type_title = no
				duchy ?= {
					coronation_events_6000_valid_switch_title_trigger = yes
					any_de_jure_county = {
						count = all
						holder = {
							OR = {
								this = root
								liege = root
							}
						}
					}
					NOR = {
						is_in_list = new_confederation_de_jure
						exists = holder
					}
				}
			}
			duchy = {
				add_to_list = new_confederation_de_jure
			}
		}
		scope:host = {
			every_held_title = {
				limit = {
					coronation_events_6000_valid_switch_title_trigger = yes
				}
				add_to_list = new_confederation_de_jure
			}
			every_held_title = {
				limit = {
					tier = tier_county
					is_landless_type_title = no
					duchy = {
						NOT = {
							is_in_list = new_confederation_de_jure
						}
						coronation_events_6000_valid_switch_title_trigger = yes
						any_de_jure_county = {
							count = all
							holder = {
								OR = {
									this = scope:host
									liege = scope:host
								}
							}
						}
						NOR = {
							is_in_list = new_confederation_de_jure
							exists = holder
						}
					}
				}
				duchy = {
					add_to_list = new_confederation_de_jure
				}
			}
			capital_county.empire ?= {
				save_scope_as = de_jure_empire
			}
		}
	}
	#My sub-realm belongs forever to the Confederation!
	option = {
		name = coronation_events.6000.a
		flavor = coronation_events.6000.a.flavor
		trigger = {
			any_held_title = {
				coronation_events_6000_valid_switch_title_trigger = yes
				any_de_jure_county = {
					any_neighboring_county = {
						duchy = {
							OR = {
								this = scope:host.capital_county.duchy
								kingdom = scope:host.primary_title
							}
						}
					}
				}
			}
			OR = {
				has_activity_intent = coronation_offer_support
				scope:host.primary_title = {
					any_de_jure_county = {
						count >= 1
						exists = this
					}
				}
			}
		}
		save_scope_as = loyal_vassal
		custom_description_no_bullet = { text = if_host_accepts_oath_tt }
		show_as_tooltip = {
			coronation_events_6000_confederation_de_jure_effect = yes
		}
		#Notify liege
		scope:host = {
			#Effects will actually be done in mirror event
			trigger_event = coronation_events.6001
		}
		stress_impact = {
			fickle = medium_stress_impact_gain
			greedy = minor_stress_impact_gain
			arbitrary = medium_stress_impact_gain
		}
		ai_chance = {
			base = 200
			ai_value_modifier = {
				ai_honor = 1
				ai_greed = -1
			}
			modifier = {
				add = 50
				has_trait = loyal
			}
			modifier = {
				add = -100
				NOT = { is_in_guest_subset = { name = supporter } }
			}
			#Want this to keep happening if it already happened once
			modifier = {
				add = 150
				scope:host.primary_title = {
					any_de_jure_county = {
						count >= 1
					}
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = fickle
					has_trait = greedy
					has_trait = arbitrary
					has_trait = disloyal
					is_in_guest_subset = { name = detractor }
				}
			}
		}
	}
	#My family should get involved and be well-known here
	option = {
		name = coronation_events.6000.b
		flavor = coronation_events.6000.b.flavor
		trigger = {
			house ?= {
				NOT = {
					has_variable = confederation_house_promoted
				}
			}
		}
		custom_tooltip = house_confederation_vote_bonus_tt
		save_scope_as = root_scope
		#Boosted AI interest in picking your candidate
		house = {
			set_variable = {
				name = confederation_house_promoted
				years = 10
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = coronation_house_candidates_log
				character = scope:root_scope
				score = 20
				show_in_conclusion = yes
			}
		}
		#Because custom tooltip inside house scope doesn't work properly...
		show_as_tooltip = {
			if = {
				limit = {
					has_activity_intent = coronation_bear_witness
				}
				add_piety = minor_piety_gain
			}
			if = {
				limit = {
					has_activity_intent = coronation_seize_advantages
				}
				add_prestige = minor_prestige_gain
			}
			else = {
				add_prestige = miniscule_prestige_gain
			}
			every_courtier = {
				custom = custom.every_house_member
				if = {
					limit = {
						root = { has_activity_intent = coronation_bear_witness }
					}
					add_piety = minor_piety_gain
					root = { custom_tooltip = improved_because_intent_tt }
				}
				if = {
					limit = {
						root = { has_activity_intent = coronation_seize_advantages }
					}
					add_prestige = minor_prestige_gain
					root = { custom_tooltip = improved_because_intent_tt }
				}
				else = {
					add_prestige = miniscule_prestige_gain
				}
			}
		}
		hidden_effect = {
			house = {
				every_house_member = {
					custom = custom.every_house_member
					if = {
						limit = {
							root = { has_activity_intent = coronation_bear_witness }
						}
						add_piety = minor_piety_gain
					}
					if = {
						limit = {
							root = { has_activity_intent = coronation_seize_advantages }
						}
						add_prestige = minor_prestige_gain
					}
					else = {
						add_prestige = miniscule_prestige_gain
					}
				}
			}
		}
		stress_impact = {
			ambitious = miniscule_stress_impact_loss
			content = minor_stress_impact_gain
			humble = minor_stress_impact_gain
			shy = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
				ai_greed = 1
			}
			modifier = {
				add = 150
				has_activity_intent = coronation_seize_advantages
			}
			modifier = {
				add = 50
				has_activity_intent = coronation_bear_witness
			}
			modifier = {
				add = 100
				is_in_guest_subset = { name = detractor }
			}
			modifier = {
				add = -100
				is_in_guest_subset = { name = supporter }
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = humble
					has_trait = content
				}
			}
		}
	}
	#confederates together is very naice
	option = {
		name = coronation_events.6000.c
		hidden_effect = {
			scope:host = {
				reverse_add_opinion = {
					target = root
					modifier = trust_opinion
					opinion = 10
				}
				every_vassal = {
					reverse_add_opinion = {
						target = root
						modifier = trust_opinion
						opinion = 10
					}
				}
			}
		}
		scope:host = {
			add_opinion = {
				target = root
				modifier = trust_opinion
				opinion = 10
			}
			every_vassal = {
				custom = custom.every_fellow_vassal
				limit = {
					NOT = {
						this = root
					}
				}
				add_opinion = {
					target = root
					modifier = trust_opinion
					opinion = 10
				}
			}
		}
		if = {
			limit = {
				has_activity_intent = coronation_bear_witness
				any_in_list = {
					list = other_confed_cultures
					count >= 1
				}
			}
			every_in_list = {
				custom = custom.every_other_culture_confederation
				list = other_confed_cultures
				change_cultural_acceptance = {
					target = root.culture
					value = minor_cultural_acceptance_gain
					desc = confederation_camraderie
				}
			}
			custom_tooltip = improved_because_intent_tt
		}
		else_if = {
			limit = {
				has_activity_intent = coronation_bear_witness
				has_legitimacy = yes
			}
			add_legitimacy = miniscule_legitimacy_gain
			custom_tooltip = improved_because_intent_tt
		}
		stress_impact = {
			gregarious = minor_stress_impact_loss
			trusting = minor_stress_impact_loss
			compassionate = miniscule_stress_impact_loss
			content = miniscule_stress_impact_loss
			arrogant = minor_stress_impact_gain
			ambitious = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
				ai_sociability = 1
			}
			modifier = {
				add = 50
				has_activity_intent = coronation_bear_witness
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = ambitious
					has_trait = arrogant
				}
			}
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

#Host response event
# Your vassal wants to swear their domain to confederation forever
coronation_events.6001 = {
	type = activity_event
	title = coronation_events.6001.t
	desc = coronation_events.6001.desc
	left_portrait = {
		character = root
		animation = personality_honorable
		camera = camera_event_very_left
	}
	center_portrait = {
		character = scope:loyal_vassal
		animation = celebrate_sword
		camera = camera_event_center_pointing_left
	}
	right_portrait = {
		character = scope:other_vassal
		animation = toast
		camera = camera_event_very_right
	}
	override_background = {
		reference = courtyard
	}
	theme = coronation_activity

	immediate = {
		# For MP
		coronation_busy_effect = yes

		custom_tooltip = coronation_tt_positive_tiny
		scope:activity = { activity_special_type_progression_tiny = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}
		scope:loyal_vassal = {
			primary_title = {
				de_jure_liege = {
					save_scope_as = old_de_jure
				} 
			}
		}
	}

	#If this is my de jure land... surely I should get a vote strength...?
	option = {
		name = coronation_events.6001.a
		trigger = {
			NOR = {
				has_character_flag = confederation_politicking_vote_2
				has_character_flag = confederation_politicking_vote
			}
		}
		save_scope_as = root_scope
		if = {
			limit = {
				has_activity_intent = coronation_weaken_detractors
			}
			add_character_flag = {
				flag = confederation_politicking_vote_2
				years = 10
			}
			custom_tooltip = confederation_elective_extra_vote_2
			custom_tooltip = improved_because_intent_tt
			scope:activity = {
				add_activity_log_entry = {
					key = coronation_vote_log_2
					character = scope:root_scope
					score = 20
					show_in_conclusion = yes
				}
			}
		}
		else = {
			add_character_flag = {
				flag = confederation_politicking_vote
				years = 10
			}
			custom_tooltip = confederation_elective_extra_vote
			scope:activity = {
				add_activity_log_entry = {
					key = coronation_vote_log
					character = scope:root_scope
					score = 20
					show_in_conclusion = yes
				}
			}
		}
		scope:loyal_vassal = {
			send_interface_toast = {
				type = event_toast_effect_good
				title = confederation_king_accepts_promise_tt
				left_icon = scope:host
				scope:loyal_vassal = {
					coronation_events_6000_confederation_de_jure_effect = yes
				}
			}
		}
		if = {
			limit = {
				primary_title = {
					any_de_jure_county = {
						count = 0
					}
				}
			}
			stress_impact = {
				arrogant = medium_stress_impact_gain
				ambitious = medium_stress_impact_gain

			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 1
				ai_energy = 1
			}
			modifier = {
				add = 100
				primary_title = {
					any_de_jure_county = {
						count >= 1
					}
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = arrogant
					has_trait = ambitious
				}
				primary_title = {
					any_de_jure_county = {
						count = 0
					}
				}
			}
		}
	}
	#Sounds good man
	option = {
		name = coronation_events.6001.b
		if = {
			limit = {
				has_activity_intent = coronation_exalt_crown
			}
			add_legitimacy = minor_legitimacy_gain
			custom_tooltip = improved_because_intent_tt
		}
		else = {
			add_legitimacy = miniscule_legitimacy_gain
		}
		scope:loyal_vassal = {
			send_interface_toast = {
				type = event_toast_effect_good
				title = confederation_king_accepts_promise_tt
				left_icon = scope:host
				scope:loyal_vassal = {
					coronation_events_6000_confederation_de_jure_effect = yes
				}
			}
		}
		
		if = {
			limit = {
				primary_title = {
					any_de_jure_county = {
						count = 0
					}
				}
			}
			stress_impact = {
				arrogant = medium_stress_impact_gain
				ambitious = medium_stress_impact_gain

			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 1
				ai_energy = 1
			}
			modifier = {
				add = 100
				primary_title = {
					any_de_jure_county = {
						count >= 1
					}
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = arrogant
					has_trait = ambitious
				}
				primary_title = {
					any_de_jure_county = {
						count = 0
					}
				}
			}
		}
	}
	#Nooooo, think of the kingdoms of old!
	option = {
		name = coronation_events.6001.c
		flavor = coronation_events.6001.c.flavor
		scope:loyal_vassal = {
			send_interface_toast = {
				type = event_toast_effect_bad
				title = confederation_king_rejects_promise_tt
				left_icon = scope:host
				scope:host = {
					if = {
						limit = {
							NOT = {
								has_character_modifier = admires_regal_kingdoms
							}
						}
						add_character_modifier = {
							modifier = admires_regal_kingdoms
							years = 10
						}
					}
					if = {
						limit = {
							scope:loyal_vassal = {
								is_ai = yes
							}
						}
						scope:loyal_vassal = {
							set_relation_rival = {
								target = root
								reason = rival_traitor_to_confederation
							}
						}
						coronation_move_towards_detractor_effect = { CHARACTER = scope:loyal_vassal }
					}
					add_tyranny = medium_tyranny_gain
				}
			}
		}
		
		stress_impact = {
			humble = medium_stress_impact_gain
			just = medium_stress_impact_gain
			content = medium_stress_impact_gain
			trusting = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_greed = 1
				ai_energy = 1
				ai_honor = -1
			}
			modifier = {
				add = -30
				scope:loyal_vassal = {
					is_ai = no
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = humble
					has_trait = just
					has_trait = content
					has_trait = trusting
					primary_title = {
						any_de_jure_county = {
							count >= 1
						}
					}
				}
			}
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}


scripted_trigger coronation_events_6010_assailant_trigger = {
	NOR = {
		is_allied_to = scope:activity.activity_host
		has_any_good_relationship_with_character_trigger = { CHARACTER = scope:activity.activity_host }
		is_tributary_of_suzerain_or_above = scope:activity.activity_host
		any_tributary = {
			this = scope:activity.activity_host
		}
		any_truce_target = {
			this = scope:activity.activity_host
		}
	}
	highest_held_title_tier >= tier_duchy
	current_military_strength >= 300
}
scripted_effect coronation_events_6010_defender_effect = {
	add_trait = loyal
	if = {
		limit = {
			government_has_flag = government_is_nomadic
		}
		vassal_contract_set_obligation_level = { type = liege_war_participation_obligation level = 1 }
		add_prestige = medium_prestige_gain
		reverse_add_opinion = {
			modifier = grateful_opinion
			target = scope:host
			opinion = 40
		}
	}
	else = {
		#You will join liege's defensive wars
		custom_tooltip = confederation_alliance
		custom_tooltip = confederation_join_war_offer_tt
		scope:host = {
			if = {
				limit = {
					root = scope:host
				}
				hidden_effect = {
					add_opinion = {
						target = scope:loyal_vassal
						modifier = event_negotiated_alliance_opinion
					}
				}
			}
			else = {
				add_opinion = {
					target = scope:loyal_vassal
					modifier = event_negotiated_alliance_opinion
				}
			}
			add_to_variable_list = {
				name = confed_vassals_defensive
				target = scope:loyal_vassal 
			}
		}
		#Gain alliance with liege
		create_alliance = {
			target = scope:host
			allied_through_owner = scope:loyal_vassal
			allied_through_target = scope:host
		}
	}
}
scripted_effect coronation_events_6010_defender_effect_2 = {
	if = {
		limit = {
			highest_skill = martial
			OR = {
				has_education_martial_trigger = yes
				has_focus_martial = yes
			}
			NOT = {
				has_trait = unyielding_defender
			}
		}
		add_trait = unyielding_defender
		add_martial_skill = 1
	}
	else = {
		custom_tooltip = best_commander_gains_defender_tt
		hidden_effect = {
			ordered_courtier = {
				order_by = martial
				limit = {
					NOR = {
						has_trait = unyielding_defender
						has_trait = infirm
						has_trait = incapable
					}
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:loyal_vassal }
					is_imprisoned = no
				}
				add_trait = unyielding_defender
				add_martial_skill = 3
			}
		}
	}
	scope:activity = {
		add_activity_log_entry = {
			key = coronation_confederation_defender_log
			character = scope:loyal_vassal
			target = scope:host
			score = 50
			show_in_conclusion = yes
		}
	}
	create_character_memory = {
		type = promised_to_defend_confederation_memory
		participants = {
			liege = scope:host
		}
	}
}

#Can the king alone defend the Confederation from those who hate us...?
coronation_events.6010 = {
	type = activity_event
	title = coronation_events.6010.t
	desc = coronation_events.6010.desc
	left_portrait = {
		character = scope:warrior_1
		animation = throne_room_two_handed_passive_shield
		hide_info = yes
	}
	center_portrait = {
		character = root
		animation = dismissal
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:warrior_2
		animation = horse_archer_idle
		hide_info = yes
		camera = camera_event_horse_right_forward
	}
	lower_left_portrait = scope:host
	lower_right_portrait = scope:assailer
	override_background = {
		reference = burning_building
	}
	override_effect_2d = {
		reference = smoke	
	}

	theme = coronation_activity
	cooldown = { years = 1 }

	trigger = {
		is_ruler = yes
		current_military_strength >= 100
		highest_held_title_tier >= tier_county
		liege ?= scope:activity.activity_host
		scope:activity = {
			activity_host = {
				#The succession law is really the only thing that makes it a Confederation kingdom
				primary_title = {
					has_title_law = confederation_elective_succession_law
				}
				highest_held_title_tier = tier_kingdom
				any_neighboring_top_liege_realm_owner = {
					coronation_events_6010_assailant_trigger = yes
				}
			}
		}
	}
	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity.activity_host = {
			save_scope_as = host
		}
		coronation_add_magnificence_log_effect = {
			VALUE = flag:negative
			CHAR = root
		}
		scope:activity.activity_location = { 
			if = {
				limit = {
					root = { is_ai = no }
					scope:host = { is_ai = yes }
				}
				county = {
					change_county_control = minor_county_control_loss
				}
				custom_tooltip = coronation_tt_negative
				scope:activity = { activity_special_type_progression_negative = yes }
			}
			save_scope_as = location
		}
		scope:host = {
			primary_heir ?= {
				save_scope_as = confederation_heir
			}
			ordered_neighboring_top_liege_realm_owner = {
				order_by = {
					value = "opinion(scope:host)"
					multiply = -1
				}
				limit = {
					highest_held_title_tier >= tier_empire
					current_military_strength >= scope:host.current_military_strength
					coronation_events_6010_assailant_trigger = yes
				}
				alternative_limit = {
					highest_held_title_tier >= tier_kingdom
					current_military_strength >= scope:host.current_military_strength
					coronation_events_6010_assailant_trigger = yes
				}
				alternative_limit = {
					current_military_strength >= scope:host.current_military_strength
					coronation_events_6010_assailant_trigger = yes
				}
				alternative_limit = {
					coronation_events_6010_assailant_trigger = yes
				}
				save_scope_as = assailer
			}
		}
		create_character = {
			template = mercenary
			dynasty = none
			location = scope:activity.activity_location
			gender_female_chance = root_soldier_female_chance
			faith = scope:activity.activity_location.faith
			culture = scope:activity.activity_location.culture
			save_scope_as = warrior_1
		}
		create_character = {
			template = mercenary
			dynasty = none
			location = scope:activity.activity_location
			gender_female_chance = root_soldier_female_chance
			faith = scope:activity.activity_location.faith
			culture = scope:activity.activity_location.culture
			save_scope_as = warrior_2
		}
		scope:warrior_1 = {
			add_character_flag = need_military_outfit
		}
		scope:warrior_2 = {
			add_character_flag = need_military_outfit
		}
	}
	
	#I will fight beside the Confederation king!
	option = {
		name = coronation_events.6010.a
		trigger = {
			NOT = {
				is_at_war_with = scope:host
			}
			OR = {
				AND = {
					government_has_flag = government_is_nomadic
					NOT = {
						subject_contract_has_flag = vassal_contract_liege_forced_war_override
					}
				}
				NOR = {
					government_has_flag = government_is_nomadic
					is_allied_to = scope:host
				}
			}
			#Too many icons being displayed on option
			trigger_if = {
				limit = {
					has_activity_intent = coronation_offer_support
				}
				has_activity_intent = coronation_offer_support
			}
			trigger_else_if = {
				limit = {
					has_trait = loyal
				}
				has_trait = loyal
			}
			trigger_else_if = {
				limit = {
					has_trait = just
				}
				has_trait = just
			}
			trigger_else = {
				has_trait = brave
			}
		}
		custom_description_no_bullet = { text = if_host_accepts_oath_tt }
		save_scope_as = loyal_vassal
		show_as_tooltip = {
			coronation_events_6010_defender_effect = yes
			coronation_events_6010_defender_effect_2 = yes
		}
		#Notify liege
		scope:host = {
			#Effects will actually be done in mirror event
			trigger_event = coronation_events.6011
		}
		stress_impact = {
			just = miniscule_stress_impact_loss
			brave = miniscule_stress_impact_loss
			fickle = medium_stress_impact_gain
			craven = major_stress_impact_gain
			arbitrary = medium_stress_impact_gain
			paranoid = minor_stress_impact_gain
		}
		ai_chance = {
			base = 150
			ai_value_modifier = {
				ai_honor = 1
				ai_boldness = 1
			}
			modifier = {
				add = -75
				opinion = {
					target = scope:host
					value <= -20
				}
			}
			modifier = {
				add = 50
				OR = {
					has_trait = just
					has_trait = brave
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = craven
					has_trait = fickle
					has_trait = arbitrary
					has_trait = paranoid
					has_trait = disloyal
				}
			}
		}
	}
	#If it is OUR throne, surely I should have a claim to it...
	option = {
		name = coronation_events.6010.b
		flavor = coronation_events.6010.b.flavor
		trigger = {
			NOR = {
				has_perk = meritocracy_perk
				AND = {
					is_diarch_of_target = scope:host
					scope:host = {
						NOT = { has_diarchy_parameter = can_be_instantly_dismissed }
					}
				}
				AND = {
					is_powerful_vassal_of = scope:host
					any_character_struggle = {
						involvement = involved
						has_struggle_phase_parameter = unlocks_claim_throne_for_powerful_vassals
						is_secondary_character_involvement_involved_trigger = {
							CHAR = scope:host
						}
					}
				}
				AND = {
					any_character_struggle = {
						involvement = involved
						has_struggle_phase_parameter = unlocks_claim_throne_for_all
						is_secondary_character_involvement_involved_trigger = {
							CHAR = scope:host
						}
					}
				}
				AND = {
					exists = title:d_sunni.holder
					is_vassal_of = title:d_sunni.holder
					any_character_struggle = {
						involvement = involved
						has_struggle_phase_parameter = unlocks_claim_throne_for_caliph_vassals
					}
				}
				has_character_flag = confederation_claim_throne
			}
			has_activity_intent = coronation_disrupt_loyalists
		}
		custom_tooltip = confederation_claim_throne
		add_character_flag = confederation_claim_throne

		stress_impact = {
			ambitious = miniscule_stress_impact_loss
			content = medium_stress_impact_gain
			humble = medium_stress_impact_gain
			just = medium_stress_impact_gain
		}
		ai_chance = {
			base = 150
			ai_value_modifier = {
				ai_greed = 1
				ai_honor = -1
			}
			modifier = {
				add = 50
				OR = {
					has_trait = deceitful
					has_trait = ambitious
				}
			}
			modifier = {
				OR = {
					has_trait = disloyal
					is_in_guest_subset = { name = detractor }
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = humble
					has_trait = content
					has_trait = just
				}
			}
		}
	}
	#I need to get him replaced...
	option = {
		name = coronation_events.6010.c
		trigger = {
			NOR = {
				has_character_flag = confederation_politicking_vote_2
				has_character_flag = confederation_politicking_vote
			}
		}
		add_legitimacy = minor_legitimacy_gain
		save_scope_as = root_scope
		#Additional vote
		if = {
			limit = {
				has_activity_intent = coronation_seize_advantages
			}
			add_character_flag = {
				flag = confederation_politicking_vote_2
				years = 10
			}
			custom_tooltip = confederation_elective_extra_vote_2
			custom_tooltip = improved_because_intent_tt
			scope:activity = {
				add_activity_log_entry = {
					key = coronation_vote_log_2
					character = scope:root_scope
					score = 20
					show_in_conclusion = yes
				}
			}
			
		}
		else = {
			add_character_flag = {
				flag = confederation_politicking_vote
				years = 10
			}
			custom_tooltip = confederation_elective_extra_vote
			scope:activity = {
				add_activity_log_entry = {
					key = coronation_vote_log
					character = scope:root_scope
					score = 20
					show_in_conclusion = yes
				}
			}
		}
		
		#Disrupt loyalists bonus
		if = {
			limit = {
				NOT = {
					scope:confederation_heir = {
						has_character_flag = harm_confederation_candidacy
					}
				}
				#Limit how much this gets stolen from players/happens from non-players
				OR = {
					is_ai = no
					is_powerful_vassal = yes
				}
				scope:confederation_heir = {
					OR = {
						AND = {
							exists = scope:house.host
							house ?= scope:host.house
						}
						AND = {
							exists = involved_activity 
							is_in_guest_subset = { name = supporter }
						}
					}
					NOR = {
						AND = {
							exists = root.house
							house ?= root.house
						}
						is_allied_to = root
					}
				}
				has_activity_intent = coronation_disrupt_loyalists
			}
			custom_tooltip = harm_confederation_candidate_vote_tt
			scope:confederation_heir = {
				add_character_flag = {
					flag = harm_confederation_candidacy
					years = 10
				}
			}
			if = {
				limit = {
					scope:host.primary_heir.dynasty ?= {
						this = scope:host.dynasty
					}
				}
				reverse_add_opinion = {
					target = scope:host
					modifier = ruined_my_heir_opinion
					opinion = -20
				}
			}
			custom_tooltip = improved_because_intent_tt
		}
		stress_impact = {
			arrogant = miniscule_stress_impact_loss
			humble = medium_stress_impact_gain
			trusting = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
				ai_vengefulness = 1
			}
			modifier = {
				add = 50
				has_trait = arrogant
			}
			modifier = {
				OR = {
					has_trait = disloyal
					is_in_guest_subset = { name = detractor }
				}
				add = 50
			}
			modifier = {
				add = 50
				has_activity_intent = coronation_disrupt_loyalists
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = humble
					has_trait = trusting
				}
			}
		}
	}
	#confederates together STRONK
	option = {
		name = coronation_events.6010.d
		add_character_modifier = {
			modifier = confederation_warrior_modifier
			years = 10
		}
		hidden_effect = {
			scope:host = {
				reverse_add_opinion = {
					target = root
					modifier = admires_resolve_opinion
					opinion = 10
				}
				every_vassal = {
					limit = {
						NOT = {
							this = root
						}
					}
					reverse_add_opinion = {
						target = root
						modifier = admires_resolve_opinion
						opinion = 5
					}
				}
			}
		}
		scope:host = {
			add_opinion = {
				target = root
				modifier = admires_resolve_opinion
				opinion = 10
			}
			add_character_modifier = {
				modifier = confederation_warrior_modifier
				years = 10
			}
			every_vassal = {
				custom = custom.every_fellow_vassal
				limit = {
					NOT = {
						this = root
					}
				}
				add_opinion = {
					target = root
					modifier = admires_resolve_opinion
					opinion = 5
				}
				add_character_modifier = {
					modifier = confederation_warrior_modifier
					years = 10
				}
			}
		}
		custom_tooltip = confederation_warrior_modifier_stacking_tt
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
			}
		}
	}
	after = {
		# For MP
		coronation_ready_effect = yes

		scope:warrior_1 = {
			silent_disappearance_effect = yes
		}
		scope:warrior_2 = {
			silent_disappearance_effect = yes
		}
	}
}

scripted_trigger coronation_events_6011_trigger = {
	is_adult = yes
	age <= 32
	is_courtier_of = $CHARACTER$
	is_imprisoned = no
	is_healthy = yes
	OR = {
		AND = {
			is_male = yes
			faith_dominant_gender_male_or_equal = yes
		}
		AND = {
			is_female = yes
			faith_dominant_gender_female_or_equal = yes
		}
	}
	NOR = {
		is_primary_heir_of = $CHARACTER$
		is_player_heir_of = $CHARACTER$
	}
	trigger_if = {
		limit = {
			has_variable = coronation_events_6011_liege
		}
		var:coronation_events_6011_liege = {
			NOT = {
				this = $CHARACTER$
			}
		}
	}
	prowess >= low_skill_rating
	opinion = {
		target = $CHARACTER$
		value > 0
	}
	NOT = {
		has_any_bad_relationship_with_character_trigger = { CHARACTER = $CHARACTER$ }
	}
}
scripted_trigger coronation_events_6011_county_trigger = {
	is_landless_type_title = no
	NOT = {
		any_county_province = {
			has_holding_type = church_holding
		}
	}
	any_county_province = {
		has_holding = no
	}
	any_county_province = {
		has_holding_type = tribal_holding
		OR = {
			has_building_or_higher = palisades_01
			has_building_or_higher = war_camps_01
			has_building_or_higher = warrior_lodges_01
		}
	}
}

#Host response event
# Your vassal wants to swear to aid you in war
coronation_events.6011 = {
	type = activity_event
	title = coronation_events.6011.t
	desc = coronation_events.6011.desc
	left_portrait = {
		character = root
		animation = stress
	}
	center_portrait = {
		character = scope:loyal_vassal
		animation = rage
		camera = camera_event_center_pointing_left
	}
	right_portrait = {
		character = scope:warrior_youth
		animation = throne_room_two_handed_passive_shield
	}
	lower_center_portrait = scope:assailer
	lower_right_portrait = scope:warrior_youth_vassal
	override_background = {
		reference = burning_building
	}
	override_effect_2d = {
		reference = smoke
	}
	theme = coronation_activity

	trigger = {
		NOT = {
			has_character_flag = ach_6011_recently_triggered
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes
		add_character_flag = {
			flag = ach_6011_recently_triggered
			months = 1
		}

		#Trash the place a bit
		scope:location.county = {
			change_county_control = miniscule_county_control_loss
		}
		custom_tooltip = coronation_tt_negative
		scope:activity = { activity_special_type_progression_negative = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:negative
			CHAR = root
		}

		ordered_sibling = {
			order_by = martial
			limit = {
				coronation_events_6011_trigger = { CHARACTER = root }
				martial >= average_skill_rating
			}
			save_scope_as = warrior_youth
		}
		if = {
			limit = {
				NOT = {
					exists = scope:warrior_youth
				}
			}
			ordered_child = {
				order_by = martial
				limit = {
					coronation_events_6011_trigger = { CHARACTER = root }
					martial >= average_skill_rating
				}
				save_scope_as = warrior_youth
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:warrior_youth
				}
				exists = house
			}
			house = {
				ordered_house_member = {
					order_by = martial
					limit = {
						coronation_events_6011_trigger = { CHARACTER = root }
						martial >= average_skill_rating
					}
					save_scope_as = warrior_youth
				}
			}
		}
		scope:warrior_youth = {
			add_character_flag = need_military_outfit
		}
		scope:loyal_vassal = {
			ordered_sibling = {
				order_by = martial
				limit = {
					coronation_events_6011_trigger = { CHARACTER = scope:loyal_vassal }
					martial >= average_skill_rating
				}
				save_scope_as = warrior_youth_vassal
			}
			if = {
				limit = {
					NOT = {
						exists = scope:warrior_youth_vassal
					}
				}
				ordered_child = {
					order_by = martial
					limit = {
						coronation_events_6011_trigger = { CHARACTER = scope:loyal_vassal }
						martial >= average_skill_rating
					}
					save_scope_as = warrior_youth_vassal
				}
			}
			if = {
				limit = {
					NOT = {
						exists = scope:warrior_youth_vassal
					}
					exists = house
				}
				house = {
					ordered_house_member = {
						order_by = martial
						limit = {
							coronation_events_6011_trigger = { CHARACTER = scope:loyal_vassal }
							martial >= average_skill_rating
						}
						save_scope_as = warrior_youth_vassal
					}
				}
			}
		}
		if = {
			limit = {
				capital_county = {
					coronation_events_6011_county_trigger = yes
				}
			}
			capital_county = {
				save_scope_as = pacifying_county
			}
		}
		else = {
			ordered_held_title = {
				order_by = development_level
				limit = {
					tier = tier_county
					coronation_events_6011_county_trigger = yes
				}
				save_scope_as = pacifying_county
			}
		}
		scope:loyal_vassal = {
			if = {
				limit = {
					capital_county = {
						coronation_events_6011_county_trigger = yes
					}
				}
				capital_county = {
					save_scope_as = pacifying_county_vassal
				}
			}
			else = {
				ordered_held_title = {
					order_by = development_level
					limit = {
						tier = tier_county
						coronation_events_6011_county_trigger = yes
					}
					save_scope_as = pacifying_county_vassal
				}
			}
		}
	}
	#Brace your lands for peace, my vassal, not war
	option = {
		trigger = {
			exists = scope:pacifying_county
			exists = scope:pacifying_county_vassal
			government_has_flag = government_is_tribal
			#Done this way so it doesn't show too many traits
			OR = {
				trigger_if = {
					limit = {
						has_trait = architect
					}
					has_trait = architect
				}
				trigger_else_if = {
					limit = {
						has_trait = administrator
					}
					has_trait = administrator
				}
				trigger_else_if = {
					limit = {
						has_trait = scholar
					}
					has_trait = scholar
				}
				trigger_else_if = {
					limit = {
						has_trait = diplomat
					}
					has_trait = diplomat
				}
				trigger_else_if = {
					limit = {
						has_trait = theologian
					}
					has_trait = theologian
				}
				trigger_else_if = {
					limit = {
						has_trait = compassionate
					}
					has_trait = compassionate
				}
				trigger_else_if = {
					limit = {
						has_trait = trusting
					}
					has_trait = trusting
				}
				trigger_else = {
					has_trait = zealous
				}
				culture = {
					has_cultural_tradition = tradition_pacifism
				}
				faith = {
					OR = {
						has_doctrine = tenet_pacifism
						has_doctrine = tenet_dharmic_pacifism
					}
				}
			}
			scope:loyal_vassal = {
				is_ai = yes
			}
		}
		name = coronation_events.6011.a
		flavor = coronation_events.6011.a.flavor
		add_piety = major_piety_gain
		add_prestige = major_prestige_loss
		scope:pacifying_county = {
				random_county_province = {
					limit = {
						OR = {
							has_building_or_higher = warrior_lodges_01
							has_building_or_higher = palisades_01
							has_building_or_higher = war_camps_01
						}	
					}
					if = {
						limit = {
							has_building_or_higher = war_camps_01
						}
						destroy_or_downgrade_tribal_building_effect = { BUILDING = war_camps }
					}
					if = {
						limit = {
							has_building_or_higher = palisades_01
						}
						destroy_or_downgrade_tribal_building_effect = { BUILDING = palisades }
					}
					if = {
						limit = {
							has_building_or_higher = warrior_lodges_01
						}
						destroy_or_downgrade_building_effect = { BUILDING = warrior_lodges }
					}
				}
				random_county_province = {
					limit = {
						has_holding = no
					}
					begin_create_holding = church_holding
				}
			}
		scope:loyal_vassal = {
			scope:pacifying_county_vassal = {
				random_county_province = {
					limit = {
						OR = {
							has_building_or_higher = warrior_lodges_01
							has_building_or_higher = palisades_01
							has_building_or_higher = war_camps_01
						}	
					}
					if = {
						limit = {
							has_building_or_higher = war_camps_01
						}
						destroy_or_downgrade_tribal_building_effect = { BUILDING = war_camps }
					}
					if = {
						limit = {
							has_building_or_higher = palisades_01
						}
						destroy_or_downgrade_tribal_building_effect = { BUILDING = palisades }
					}
					if = {
						limit = {
							has_building_or_higher = warrior_lodges_01
						}
						destroy_or_downgrade_building_effect = { BUILDING = warrior_lodges }
					}
				}
				random_county_province = {
					limit = {
						has_holding = no
					}
					begin_create_holding = church_holding
				}
			}
		}
		stress_impact = {
			zealous = miniscule_stress_impact_loss
			compassionate = miniscule_stress_impact_loss
			paranoid = major_stress_impact_gain
			wrathful = medium_stress_impact_gain
			vengeful = major_stress_impact_gain
			cynical = medium_stress_impact_gain
			sadistic = major_stress_impact_gain
		}
		ai_chance = {
			base = 200
			ai_value_modifier = {
				ai_compassion = 1
				ai_zeal = 1
				ai_energy = -1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = paranoid
					has_trait = wrathful
					has_trait = vengeful
					has_trait = cynical
					has_trait = sadistic
				}
			}
		}
	}
	
	#Yes, we all should fight! In fact, send your youths to join a warband led by my kin
	option = {
		trigger = {
			has_activity_intent = coronation_embrace_supporters
			exists = scope:warrior_youth
			exists = scope:warrior_youth_vassal
			scope:loyal_vassal = {
				is_ai = yes
			}
			trigger_if = {
				limit = {
					government_has_flag = government_is_tribal
				}
				has_dlc_feature = landless_playable
			}
		}
		name = coronation_events.6011.b
		flavor = coronation_events.6011.b.flavor

		#youth becomes laamp or landless nomad
		scope:warrior_youth = {
			if = {
				limit = {
					root = { government_has_flag = government_is_nomadic }
				}
				save_scope_as = holder
				create_nomad_title = {
					name = nomad_title_name
					holder = scope:warrior_youth
					government = nomad_government
					save_scope_as = new_nomad_title
				}
				change_government = nomad_government
				hidden_effect = {
					add_gold = 30
				}
				root = {
					pay_herd = {
						target = scope:warrior_youth
						value = domicile.medium_herd_value
					}
				}
			}
			else = {
				create_landless_adventurer_title_tooltip_effect = yes
				add_character_modifier = {
					modifier = ep3_voluntary_laamp_character_modifier
					years = 5
				}
				hidden_effect = {
					# Create Adventurer
					create_landless_adventurer_title_effect = {
						REASON = flag:runaway_allowed
						FLAVOR_CHAR = scope:warrior_youth
					}
					domicile ?= {
						change_provisions = major_provisions_gain
					}
				}
				root = {
					pay_short_term_gold = {
						target = scope:warrior_youth
						gold = medium_gold_value
					}
				}
				
				
				add_realm_law = camp_purpose_mercenaries
				# Debug tracking
				if = {
					limit = {
						is_ai = yes
						debug_only = yes
					}
					if = {
						limit = { exists = global_var:ai_voluntary_laamp_count }
						change_global_variable = {
							name = ai_voluntary_laamp_count
							add = 1
						}
					}
					else = {
						set_global_variable = {
							name = ai_voluntary_laamp_count
							value = 1
						}
					}
					debug_log = "AI became adventurer voluntarily"
					debug_log_scopes = yes
				}
			}
			
			add_courtier = scope:warrior_youth_vassal
			hidden_effect = {
				scope:warrior_youth_vassal = {
					add_trait = lifestyle_blademaster
				}
			}

			if = {
				limit = {
					government_has_flag = government_is_nomadic
				}
				create_maa_regiment = {
					type = steppe_raiders
					check_can_recruit = no
					size = 2
				}
				create_maa_regiment = {
					type = horse_archers
					check_can_recruit = no
					size = 2
				}
			}
			else_if = {
				limit = {
					culture = {
						culture_specializes_in_light_cavalry_maa = yes
					}
				}
				create_maa_regiment = {
					type = light_horsemen
					check_can_recruit = no
					size = 3
				}
			}
			else_if = {
				limit = {
					culture = {
						culture_specializes_in_archer_maa = yes
					}
				}
				create_maa_regiment = {
					type = bowmen
					check_can_recruit = no
					size = 3
				}
				create_maa_regiment = {
					type = bowmen
					check_can_recruit = no
					size = 2
				}
			}
			else_if = {
				limit = {
					culture = {
						culture_specializes_in_pikemen_maa = yes
					}
				}
				create_maa_regiment = {
					type = pikemen_unit
					check_can_recruit = no
					size = 3
				}
			}
			else = {
				create_maa_regiment = {
					type = light_footmen
					check_can_recruit = no
					size = 3
				}
				create_maa_regiment = {
					type = light_footmen
					check_can_recruit = no
					size = 2
				}
			}
			custom_tooltip = confederate_king_youth_warrior_tt
			add_opinion = {
				target = scope:host
				modifier = event_negotiated_alliance_opinion
			}
			create_alliance = {
				target = scope:host
				allied_through_owner = scope:warrior_youth
				allied_through_target = scope:host
			}
		}

		scope:warrior_youth = {
			set_variable = {
				name = coronation_events_6011_liege
				value = root
				years = 5
			}
		}
		scope:loyal_vassal = {
			coronation_events_6010_defender_effect = yes
			#The king doesn't need to see the rest
			hidden_effect = {
				coronation_events_6010_defender_effect_2 = yes
			}
		}
		stress_impact = {
			paranoid = minor_stress_impact_gain
			arbitrary = minor_stress_impact_gain
		}
		ai_chance = {
			base = 300
			ai_value_modifier = {
				ai_honor = 1
			}
			opinion_modifier = {
				who = root
				opinion_target = scope:loyal_vassal
				multiplier = 3
			}
			modifier = {
				add = -200
				OR = {
					has_trait = paranoid
					has_trait = arbitrary
				}
			}
		}
	}
	#I accept, we must defend our peoples
	option = {
		name = coronation_events.6011.c
		scope:loyal_vassal = {
			send_interface_toast = {
				type = event_toast_effect_good
				title = confederation_king_accepts_promise_tt
				left_icon = scope:host
				coronation_events_6010_defender_effect = yes
				#The king doesn't need to see the rest
				hidden_effect = {
					coronation_events_6010_defender_effect_2 = yes
				}
			}
		}
		stress_impact = {
			trusting = miniscule_stress_impact_loss
			arrogant = minor_stress_impact_gain
			arbitrary = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 0.5
			}
			opinion_modifier = {
				who = root
				opinion_target = scope:loyal_vassal
				multiplier = 1
			}
			modifier = {
				add = -50
				OR = {
					has_trait = arrogant
					has_trait = arbitrary
				}
			}
		}
	}
	#I can defend us all, thank you
	option = {
		name = {
			trigger = {
				has_activity_intent = coronation_exalt_crown
			}
			text = coronation_events.6011.d_house
		}
		name = {
			text = coronation_events.6011.d
		}
		if = {
			limit = {
				government_has_flag = government_is_nomadic
			}
			custom_tooltip = coronation_tt_positive_major
			scope:activity = { activity_special_type_progression_major = yes }
			coronation_add_magnificence_log_effect = {
				VALUE = flag:positive_major
				CHAR = root
			}
		}
		else = {
			custom_tooltip = coronation_tt_positive_medium
			scope:activity = { activity_special_type_progression_medium = yes }
			coronation_add_magnificence_log_effect = {
				VALUE = flag:positive_medium
				CHAR = root
			}
		}
		#exalt the crown bonus
		if = {
			limit = {
				has_activity_intent = coronation_exalt_crown
			}
			dynasty = {
				add_dynasty_prestige = miniscule_dynasty_prestige_value
			}
			custom_tooltip = improved_because_intent_tt
		}
		hidden_effect = {
			scope:loyal_vassal = {
				send_interface_toast = {
					type = event_toast_effect_bad
					title = confederation_king_rejects_promise_tt
					left_icon = scope:host
					reverse_add_opinion = {
						target = scope:host
						modifier = loyalty_opinion
						opinion = 15
					}
				}
			}
		}
		stress_impact = {
			arrogant = miniscule_stress_impact_loss
			trusting = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_sociability = -0.5
			}
			modifier = {
				add = -30
				scope:loyal_vassal = {
					is_ai = no
				}
			}
			modifier = {
				add = -50
				OR = {
					has_trait = trusting
					has_trait = humble
				}
			}
		}
	}
	after = {
		# For MP
		coronation_ready_effect = yes

		scope:warrior_youth ?= {
			remove_character_flag = need_military_outfit
		}
	}
}

scripted_trigger coronation_events_6020_foe_trigger = {
	save_temporary_scope_as = foe_temp
	NOT = {
		government_has_flag = government_is_herder
	}
	#sedentaries shouldn't go off invading nomadic lands
	trigger_if = {
		limit = {
			$CHARACTER$ = {
				NOT = {
					government_has_flag = government_is_nomadic
				}
			}
		}
		NOT = {
			government_has_flag = government_is_nomadic
		}
	}
	$CHARACTER$ = {
		NOR = {
			var:coronation_war_foe ?= {
				this = scope:foe_temp
			}
			var:coronation_war_foe_2 ?= {
				this = scope:foe_temp
			}
		}
	}
	is_ruler = yes
	trigger_if = {
		limit = {
			exists = scope:activity.var:officiator
		}
		NOT = {
			this = scope:activity.var:officiator
		}
	}
	highest_held_title_tier >= tier_county
	current_military_strength <= $CHARACTER$.current_military_strength
	trigger_if = {
		limit = {
			is_participant_in_activity = scope:activity
		}
		NOT = { is_in_guest_subset = { name = supporter } }
	}
	OR = {
		NOT = {
			is_vassal_or_below_of = root
		}
		AND = {
			is_vassal_of = root
			OR = {
				has_activity_intent = coronation_disrupt_loyalists
				has_any_bad_relationship_with_character_trigger = { CHARACTER = root }
				root = { has_imprisonment_reason = scope:foe_temp }
				is_a_faction_member = yes
				AND = {
					any_claim = {
						holder ?= root
					}
					NOT = {
						any_parent = {
							this = root
						}
					}
				}
				opinion = {
					target = root
					value < -50
				}
			}
		}
	}
	NOR = {
		is_allied_to = root
		is_allied_to = $CHARACTER$
		has_truce = $CHARACTER$
		is_tributary_of_suzerain_or_above = root
		is_tributary_of_suzerain_or_above = $CHARACTER$
		root = {
			is_tributary_of_suzerain_or_above = scope:foe_temp
		}
		any_warden_hostage = {
			home_court = $CHARACTER$
		}
		has_any_good_relationship_with_character_trigger = { CHARACTER = root }
		has_any_good_relationship_with_character_trigger = { CHARACTER = $CHARACTER$ }
	}
	any_sub_realm_county = {
		any_neighboring_county = {
			holder = {
				OR = {
					this = $CHARACTER$
					any_liege_or_above = {
						this = $CHARACTER$
					}
				}
			}
		}
	}
}
scripted_trigger coronation_events_6020_supporter_trigger = {
	is_ai = yes
	location = scope:activity.activity_location
	save_temporary_scope_as = supporter_temp
	NOR = {
		this = root
		scope:activity.var:officiator ?= this
	}
	is_vassal_of = root
	exists = capital_county
	is_at_war = no
	gold > 0
	#They have at least SOME army like c'mon
	current_military_strength >= 200
	##Borders vassal to attack or independent ruler to attack
	OR = {
		any_neighboring_top_liege_realm_owner = {
			coronation_events_6020_foe_trigger = {CHARACTER = scope:supporter_temp }
		}
		root = {
			any_vassal = {
				NOT = { this = scope:supporter_temp }
				coronation_events_6020_foe_trigger = { CHARACTER = scope:supporter_temp }
			}
		}
	}
	ai_boldness >= 0
	OR = {
		ai_greed > 0
		ai_energy > 0
		ai_zeal > 0
		ai_honor > 0
		ai_boldness >= medium_positive_ai_value
	}
	OR = {
		government_has_flag = government_is_nomadic
		government_has_flag = government_is_tribal
		culture = {
			NOT = {
				has_cultural_era_or_later = culture_era_early_medieval
			}
		}
		capital_county ?= {
			development_level >= 1
		}
	}
}
scripted_effect coronation_events_6020_mass_mobilization_effect = {
	add_martial_lifestyle_xp = medium_lifestyle_xp
	scope:supporter = {
		if = {
			limit = {
				has_variable = mass_mobilitization_development_progress_value
			}
			custom_tooltip = mass_mob_dev_progress_tt
			hidden_effect = {
				every_held_title = {
					limit = {
						tier = tier_county
					}
					change_development_progress_with_overflow = scope:supporter.var:mass_mobilitization_development_progress_value
				}
			}
		}
		#Nomads lose fertility
		else_if = {
			limit = {
				has_variable = mass_mobilitization_fertility_value
			}
			custom_tooltip = mass_mob_fertility_tt
			hidden_effect = {
				every_held_title = {
					limit = {
						tier = tier_county
						county_fertility > 0
					}
					change_county_fertility = scope:supporter.var:mass_mobilitization_fertility_value
				}
			}
		}
		#Tribal era just does development progress
		else = {
			
			custom_tooltip = mass_mob_dev_tt
			hidden_effect = {
				every_held_title = {
					limit = {
						tier = tier_county
						development_level >= 1
					}
					change_development_level = {
						add = scope:supporter.var:mass_mobilitization_development_value
						min = {
							value = development_level
							multiply = -1
						}
					}
				}
			}
		}
	}
	
	if = {
		limit = {
			scope:supporter.capital_county = {
				title_province = {
					has_holding_type = nomad_holding
				}
			}
		}
		scope:supporter = {
			spawn_army = {
				levies = 0
				men_at_arms = {
					type = horse_archers
					stacks = {
						value = var:mass_mobilitization_total
						multiply = -1
						min = 1
					}
				}
				men_at_arms = {
					type = nomadic_riders
					stacks = {
						value = var:mass_mobilitization_total
						multiply = -4
						min = 1
					}
				}
				location = scope:supporter.capital_province
				origin = scope:supporter.capital_province
				inheritable = no
				uses_supply = yes
				name = coronation_mobilized_army_name
			}
		}
	}
	else_if = {
		limit = {
			scope:supporter.capital_county = {
				culture = {
					has_innovation = innovation_advanced_bowmaking
					NOR = {
						culture_specializes_in_light_cavalry_maa = yes
						culture_specializes_in_heavy_infantry_maa = yes
						culture_specializes_in_pikemen_maa = yes
					}
				}
			}
		}
		scope:supporter = {
			spawn_army = {
				levies = {
					value = var:mass_mobilitization_total
					multiply = -600
						min = 100
				}
				men_at_arms = {
					type = crossbowmen
					stacks = {
						value = var:mass_mobilitization_total
						multiply = -1
						min = 1
					}
				}
				location = scope:supporter.capital_province
				origin = scope:supporter.capital_province
				inheritable = no
				uses_supply = yes
				name = coronation_mobilized_army_name
			}
		}
	}
	else_if = {
		limit = {
			scope:supporter.capital_county = {
				culture = { culture_specializes_in_heavy_infantry_maa = yes }
				culture = { has_innovation = innovation_quilted_armor }
			}
		}
		scope:supporter = {
			spawn_army = {
				levies = {
					value = var:mass_mobilitization_total
					multiply = -600
					min = 100
				}
				men_at_arms = {
					type = armored_footmen
					stacks = {
						value = var:mass_mobilitization_total
						multiply = -1
						min = 1
					}
				}
				location = scope:supporter.capital_province
				origin = scope:supporter.capital_province
				inheritable = no
				uses_supply = yes
				name = coronation_mobilized_army_name
			}
		}
	}
	else_if = {
		limit = {
			scope:supporter.capital_county.culture = { culture_specializes_in_light_cavalry_maa = yes }
		}
		scope:supporter = {
			spawn_army = {
				levies = {
					value = var:mass_mobilitization_total
					multiply = -600
					min = 100
				}
				men_at_arms = {
					type = light_horsemen
					stacks = {
						value = var:mass_mobilitization_total
						multiply = -1
						min = 1
					}
				}
				location = scope:supporter.capital_province
				origin = scope:supporter.capital_province
				inheritable = no
				uses_supply = yes
				name = coronation_mobilized_army_name
			}
		}
	}
	else_if = {
		limit = {
			scope:supporter.capital_county = {
				culture ={ culture_specializes_in_archer_cavalry_maa = yes }
			}
		}
		scope:supporter = {
			spawn_army = {
				levies = {
					value = var:mass_mobilitization_total
					multiply = -600
					min = 100
				}
				men_at_arms = {
					type = horse_archers
					stacks = {
						value = var:mass_mobilitization_total
						multiply = -1
						min = 1
					}
				}
				location = scope:supporter.capital_province
				origin = scope:supporter.capital_province
				inheritable = no
				uses_supply = yes
				name = coronation_mobilized_army_name
			}
		}
	}
	else_if = {
		limit = {
			scope:supporter.capital_county.culture = { culture_specializes_in_pikemen_maa = yes }
		}
		scope:supporter = {
			spawn_army = {
				levies = {
					value = var:mass_mobilitization_total
					multiply = -600
					min = 100
				}
				men_at_arms = {
					type = pikemen_unit
					stacks = {
						value = var:mass_mobilitization_total
						multiply = -1
						min = 1
					}
				}
				location = scope:supporter.capital_province
				origin = scope:supporter.capital_province
				inheritable = no
				uses_supply = yes
				name = coronation_mobilized_army_name
			}
		}
	}
	else_if = {
		limit = {
			scope:supporter.capital_county.culture = { culture_specializes_in_archer_maa = yes }
		}
		scope:supporter = {
			spawn_army = {
				levies = {
					value = var:mass_mobilitization_total
					multiply = -600
					min = 100
				}
				men_at_arms = {
					type = bowmen
					stacks = {
						value = var:mass_mobilitization_total
						multiply = -1
						min = 1
					}
				}
				location = scope:supporter.capital_province
				origin = scope:supporter.capital_province
				inheritable = no
				uses_supply = yes
				name = coronation_mobilized_army_name
			}
		}
	}
	else = {
		scope:supporter = {
			spawn_army = {
				levies = {
					value = var:mass_mobilitization_total
					multiply = -600
					min = 100
				}
				men_at_arms = {
					type = light_footmen
					stacks = {
						value = var:mass_mobilitization_total
						multiply = -1
						min = 1
					}
				}
				location = scope:supporter.capital_province
				origin = scope:supporter.capital_province
				inheritable = no
				uses_supply = yes
				name = coronation_mobilized_army_name
			}
		}
	}
}
scripted_effect coronation_events_6020_save_claim_effect = {
	if = {
		limit = {
			NOT = {
				any_claim = {
					OR = {
						holder ?= $FOE$
						holder ?= {
							any_liege_or_above = {
								this = $FOE$
							}
						}
					}
					tier >= tier_county
				}
			}
		}
		#SAVE ONE OF FOE'S KINGDOMS
		$FOE$ = {
			ordered_held_title = {
				order_by = {
					value = 0
					every_de_jure_county = {
						limit = {
							OR = {
								holder = $FOE$
								holder = {
									any_liege_or_above = {
										this = $FOE$
									}
								}
							}
						}
						add = 1
					}
				}
				limit = {
					tier = tier_kingdom
					any_de_jure_county = {
						OR = {
							holder = $FOE$
							holder = {
								any_liege_or_above = {
									this = $FOE$
								}
							}
						}
						any_neighboring_county = {
							OR = {
								holder = scope:supporter
								holder = {
									any_liege_or_above = {
										this = scope:supporter
									}
								}
							}
						}
					}
				}
				alternative_limit = {
					tier = tier_duchy
					any_de_jure_county = {
						OR = {
							holder = $FOE$
							holder = {
								any_liege_or_above = {
									this = $FOE$
								}
							}
						}
						any_neighboring_county = {
							OR = {
								holder = scope:supporter
								holder = {
									any_liege_or_above = {
										this = scope:supporter
									}
								}
							}
						}
					}
				}
				alternative_limit = {
					tier = tier_county
					any_neighboring_county = {
						OR = {
							holder = scope:supporter
							holder = {
								any_liege_or_above = {
									this = scope:supporter
								}
							}
						}
					}
				}
				if = {
					limit = {
						$FOE$ = scope:foe
					}
					save_scope_as = title_claim_1
				}
				else = {
					save_scope_as = title_claim_2
				}
			}
		}
	}
}
scripted_effect coronation_events_6020_declare_war_effect = {
	if = {
		limit = {
			root = {
				OR = {
					has_realm_law_flag = admin_vassal_wars_banned
					has_realm_law_flag = admin_vassal_wars_permission_only
					has_realm_law_flag = vassal_all_wars_banned
					has_realm_law_flag = vassal_internal_wars_banned
				}
			}
		}
		if = {
			limit = {
				government_allows = administrative
				NOT = {
					has_variable = admin_permission_to_declare_war
				}
			}
			custom_tooltip = {
				text = admin_gain_war_permission_desc
				set_variable = admin_permission_to_declare_war
			}
		}
		else_if = {
			limit = {
				government_has_flag = government_is_feudal
				vassal_contract_obligation_level:war_declaration_rights < 1
			}
			vassal_contract_set_obligation_level = {
				type = war_declaration_rights
				level = 1
			}
		}
	}
	#Give the supporter a claim to a neighboring duchy, if possible
	#Give the supporter a claim to a neighboring county

	#Already has existing claim... just declare war
	if = {
		limit = {
			NOT = {
				any_claim = {
					OR = {
						holder ?= $FOE$
						holder ?= {
							any_liege_or_above = {
								this = $FOE$
							}
						}
					}
					tier >= tier_county
				}
			}
		}
		if = {
			limit = {
				$FOE$ = scope:foe
			}
			add_unpressed_claim = scope:title_claim_1
		}
		else = {
			add_unpressed_claim = scope:title_claim_2
		}
		$FOE$ = {
			add_opinion = {
				modifier = outraged_opinion
				target = root
				opinion = -30
			}
		}
		scope:supporter = {
			add_opinion = {
				modifier = grateful_opinion
				target = root
				opinion = 30
			}
		}
	}
	#Declare war
	ordered_claim = {
		order_by = tier
		limit = {
			holder = {
				OR = {
					this ?= $FOE$
					any_liege_or_above = {
						this = $FOE$
					}
				}
			}
			
			tier >= tier_county
		}
		save_scope_as = claim
	}
	hidden_effect = {
		scope:supporter = {
			start_war = {
				cb = claim_cb
				target = $FOE$
				target_title = scope:claim
				claimant = scope:supporter
			}
		}
	}
	$FOE$ = {
		save_scope_as = supporter_war_target
	}
	scope:activity = {
		add_activity_log_entry = {
			key = coronation_supporter_declares_war_log
			character = scope:supporter
			target = scope:supporter_war_target
			score = 50
			show_in_conclusion = yes
		}
	}
	
}

#A supporter wants to be unleashed against your foes
coronation_events.6020 = {
	type = activity_event
	title = coronation_events.6020.t
	desc = coronation_events.6020.desc
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = { 
					faith.religion = religion:eastern_orthodox_religion 
					faith.religion = religion:catholic_religion 
					faith.religion = religion:protestant_religion 
				}
			}
			animation = acknowledging
		}
		animation = chancellor
	}
	center_portrait = {
		character = scope:supporter
		animation = inspect_weapon
	}
	lower_center_portrait = scope:foe
	lower_right_portrait = scope:foe_2
	theme = coronation_activity
	cooldown = { weeks = 2 }

	trigger = {
		scope:activity = {
			any_guest_subset = {
				name = supporter
				coronation_events_6020_supporter_trigger = yes

				OR = {
					root = {
						#Realm law does not restrict war
						NOR = {
							has_realm_law_flag = admin_vassal_wars_banned
							has_realm_law_flag = admin_vassal_wars_permission_only
							has_realm_law_flag = vassal_all_wars_banned
							has_realm_law_flag = vassal_internal_wars_banned
						}
					}
					#Admin war restriction and admin workarounds available
					AND = {
						root = {
							OR = {
								has_realm_law_flag = admin_vassal_wars_banned
								has_realm_law_flag = admin_vassal_wars_permission_only
							}
						}
						OR = {
							has_variable = admin_permission_to_declare_war
							government_allows = administrative
						}
					}
					#Feudal war restriction and feudal workarounds available
					AND = {
						root = {
							OR = {
								has_realm_law_flag = vassal_all_wars_banned
								has_realm_law_flag = vassal_internal_wars_banned
							}
						}
						OR = {
							vassal_contract_obligation_level:war_declaration_rights < 1
							government_has_flag = government_is_feudal
						}
					}
				}
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 2
			scope:activity = {
				any_guest_subset = {
					name = supporter
					coronation_events_6020_supporter_trigger = yes
	
					OR = {
						root = {
							#Realm law does not restrict war
							NOR = {
								has_realm_law_flag = admin_vassal_wars_banned
								has_realm_law_flag = admin_vassal_wars_permission_only
								has_realm_law_flag = vassal_all_wars_banned
								has_realm_law_flag = vassal_internal_wars_banned
							}
						}
						#Admin war restriction and admin workarounds available
						AND = {
							root = {
								OR = {
									has_realm_law_flag = admin_vassal_wars_banned
									has_realm_law_flag = admin_vassal_wars_permission_only
								}
							}
							OR = {
								has_variable = admin_permission_to_declare_war
								government_allows = administrative
							}
						}
						#Feudal war restriction and feudal workarounds available
						AND = {
							root = {
								OR = {
									has_realm_law_flag = vassal_all_wars_banned
									has_realm_law_flag = vassal_internal_wars_banned
								}
							}
							OR = {
								vassal_contract_obligation_level:war_declaration_rights < 1
								government_has_flag = government_is_feudal
							}
						}
					}
					save_temporary_scope_as = weight_supporter
				}
				OR = {
					any_guest_subset = {
						name = detractor
						coronation_events_6020_foe_trigger = { CHARACTER = scope:weight_supporter }
					}
					root = {
						any_relation = {
							type = rival
							coronation_events_6020_foe_trigger = { CHARACTER = scope:weight_supporter }
						}
					}
				}
				
			}
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		#Save host and location
		scope:activity = {
			activity_location = { save_scope_as = location }
			activity_host = { save_scope_as = host }
		}
		#Save fighty supporter
		scope:activity = {
			ordered_guest_subset = {
				order_by = current_military_strength
				
				name = supporter
				limit = {
					coronation_events_6020_supporter_trigger = yes
				}
				save_scope_as = supporter
			}
			#Save detractor as foe
			ordered_guest_subset = {
				order_by = {
					value = "reverse_opinion(scope:supporter)"
					multiply = -1
				}
				name = detractor
				limit = {
					coronation_events_6020_foe_trigger = { CHARACTER = scope:supporter }
				}
				save_scope_as = foe
			}
		}
		#Any neighboring ruler as foe
		scope:supporter = {
			ordered_neighboring_top_liege_realm_owner = {
				order_by = {
					value = "reverse_opinion(scope:supporter)"
					multiply = -1
				}
				limit = {
					coronation_events_6020_foe_trigger = { CHARACTER = scope:supporter }
				}
				save_scope_as = foe
			}
		}
		#A vassal that's in the outs
		ordered_vassal = {
			order_by = {
				value = "reverse_opinion(scope:supporter)"
				multiply = -1
			}
			limit = {
				coronation_events_6020_foe_trigger = { CHARACTER = scope:supporter }
			}
			save_scope_as = foe
		}
		#SECOND FOE
		scope:activity = {
			ordered_guest_subset = {
				order_by = {
					value = "reverse_opinion(scope:supporter)"
					multiply = -1
				}
				name = detractor
				limit = {
					coronation_events_6020_foe_trigger = { CHARACTER = scope:supporter }
					NOT = { this = scope:foe }
				}
				save_scope_as = foe_2
			}
		}
		#Any neighboring ruler as foe
		scope:supporter = {
			ordered_neighboring_top_liege_realm_owner = {
				order_by = {
					value = "reverse_opinion(scope:supporter)"
					multiply = -1
				}
				limit = {
					coronation_events_6020_foe_trigger = { CHARACTER = scope:supporter }
					NOT = { this = scope:foe }
				}
				save_scope_as = foe_2
			}
		}
		#A vassal that's in the outs
		ordered_vassal = {
			order_by = {
				value = "reverse_opinion(scope:supporter)"
				multiply = -1
			}
			limit = {
				coronation_events_6020_foe_trigger = { CHARACTER = scope:supporter }
				NOT = { this = scope:foe }
			}
			save_scope_as = foe_2
		}
		if = {
			limit = {
				scope:supporter = {
					OR = {
						government_has_flag = government_is_tribal
					}
					culture = {
						NOT = {
							has_cultural_era_or_later = culture_era_early_medieval
						}
					}
				}
			}
			scope:supporter = {
				set_variable = {
					name = mass_mobilitization_development_progress_value
					value = -50
				}
				set_variable = {
					name = mass_mobilitization_total
					value = {
						if = {
							limit = {
								scope:supporter = {
									government_has_flag = government_is_tribal
								}
							}
							add = -1
						}
						else = {
							#Half of early medievals
							add = -0.5
						}
						multiply = domain_size
					}	
				}
			}
		}
		else_if = {
			limit = {
				scope:supporter = {
					government_has_flag = government_is_nomadic
				}
			}
			scope:supporter = {
				set_variable = {
					name = mass_mobilitization_fertility_value
					value = -100
				}
				set_variable = {
					name = mass_mobilitization_total
					value = {
						if = {
							limit = {
								current_year >= 1100
							}
							add = -1.5
						}
						else = {
							add = -1
						}
						multiply = domain_size
					}	
				}
			}
		}
		else = {
			scope:supporter = {
				set_variable = {
					name = mass_mobilitization_development_value
					value = {
						if = {
							limit = {
								scope:supporter.culture = { has_cultural_era_or_later = culture_era_late_medieval }
							}
							add = -1
						}
						if = {
							limit = {
								scope:supporter.culture = { has_cultural_era_or_later = culture_era_high_medieval }
							}
							add = -1
						}
						add = -1
					}
				}
				set_variable = {
					name = mass_mobilitization_total
					value = {
						add = var:mass_mobilitization_development_value
						multiply = domain_size
					}	
				}
			}
		}
		scope:supporter = {
			coronation_events_6020_save_claim_effect = { FOE = scope:foe }
			if = {
				limit = {
					exists = scope:foe_2
				}
				coronation_events_6020_save_claim_effect = { FOE = scope:foe_2 }
			}
		}
		scope:supporter = {
			set_variable = {
				name = coronation_war_foe
				value = scope:foe
				months = 6
			}
			if = {
				limit = {
					exists = scope:foe_2
				}
				set_variable = {
					name = coronation_war_foe_2
					value = scope:foe_2
					months = 6
				}
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:title_claim_1
				}
			}
			scope:supporter = {
				ordered_claim = {
					order_by = tier
					limit = {
						holder = scope:foe
					}
					save_scope_as = title_claim_1
				}
			}
		}
		if = {
			limit = {
				exists = scope:foe_2
				NOT = {
					exists = scope:title_claim_2
				}
			}
			scope:supporter = {
				ordered_claim = {
					order_by = tier
					limit = {
						holder = scope:foe_2
					}
					save_scope_as = title_claim_2
				}
			}
		}
	}
	#Special Intent option (TARGET 1)
	option = {
		name = coronation_events.6020.a
		trigger = {
			has_activity_intent = coronation_weaken_detractors
		}
		#Increase armies and tank development effect
		coronation_events_6020_mass_mobilization_effect = yes
		scope:supporter = {
			coronation_events_6020_declare_war_effect = { FOE = scope:foe }
			if = {	
				limit = {
					exists = scope:title_claim_1
				}
				custom_tooltip = coronation_supporter_declare_war_tt
			}
			else = {
				custom_tooltip = coronation_supporter_declare_war_no_title_tt
			}
			if = {
				limit = {
					involved_activity ?= scope:activity
				}
				remove_from_activity = scope:activity
			}
		}
		if = {
			limit = {
				scope:foe = { involved_activity ?= scope:activity }
			}
			scope:foe = { remove_from_activity = scope:activity }
		}
		stress_impact = {
			forgiving = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
			calm = miniscule_stress_impact_gain
			content = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 1
				ai_compassion = -1
			}
			modifier = {
				add = 50
				OR = {
					government_has_flag = government_is_tribal
					government_has_flag = government_is_nomadic
				}
			}
			modifier = {
				add = -100
				OR = {
					has_realm_law_flag = admin_vassal_wars_banned
					has_realm_law_flag = admin_vassal_wars_permission_only
					has_realm_law_flag = vassal_all_wars_banned
					has_realm_law_flag = vassal_internal_wars_banned
				}
				scope:supporter = {
					NOR = {
						has_variable = admin_permission_to_declare_war
						vassal_contract_obligation_level:war_declaration_rights < 1
					}
				}
			}
			opinion_modifier = { # Opinion Factor
				who = root
				opinion_target = scope:foe
				multiplier = -2
				desc = AI_OPINION_REASON
			}
			opinion_modifier = { # Opinion Factor
				who = root
				opinion_target = scope:supporter
				multiplier = 1
				desc = AI_OPINION_REASON
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = forgiving
					has_trait = compassionate
					has_trait = calm
					has_trait = content
				}
			}
		}
	}
	#Special Intent option (TARGET 2)
	option = {
		name = coronation_events.6020.b
		trigger = {
			has_activity_intent = coronation_weaken_detractors
			exists = scope:foe_2
		}
		coronation_events_6020_mass_mobilization_effect = yes
		scope:supporter = {
			coronation_events_6020_declare_war_effect = { FOE = scope:foe_2 }

			if = {	
				limit = {
					exists = scope:title_claim_2
				}
				custom_tooltip = coronation_supporter_declare_war_2_tt
			}
			else = {
				custom_tooltip = coronation_supporter_declare_war_no_title_2_tt
			}
			if = {
				limit = {
					involved_activity ?= scope:activity
				}
				remove_from_activity = scope:activity
			}
		}
		if = {
			limit = {
				scope:foe_2 = { involved_activity ?= scope:activity }
			}
			scope:foe_2 = { remove_from_activity = scope:activity }
		}
		stress_impact = {
			forgiving = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
			calm = miniscule_stress_impact_gain
			content = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 1
				ai_compassion = -1
			}
			modifier = {
				add = 50
				OR = {
					government_has_flag = government_is_tribal
					government_has_flag = government_is_nomadic
				}
			}
			modifier = {
				add = -100
				OR = {
					has_realm_law_flag = admin_vassal_wars_banned
					has_realm_law_flag = admin_vassal_wars_permission_only
					has_realm_law_flag = vassal_all_wars_banned
					has_realm_law_flag = vassal_internal_wars_banned
				}
				scope:supporter = {
					NOR = {
						has_variable = admin_permission_to_declare_war
						vassal_contract_obligation_level:war_declaration_rights < 1
					}
				}
			}
			opinion_modifier = { # Opinion Factor
				who = root
				opinion_target = scope:foe_2
				multiplier = -2
				desc = AI_OPINION_REASON
			}
			opinion_modifier = { # Opinion Factor
				who = root
				opinion_target = scope:supporter
				multiplier = 1
				desc = AI_OPINION_REASON
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = forgiving
					has_trait = compassionate
					has_trait = calm
					has_trait = content
				}
			}
		}
	}
	#Normal declare (TARGET 1)
	option = {
		name = coronation_events.6020.c
		scope:supporter = {
			coronation_events_6020_declare_war_effect = { FOE = scope:foe }

			if = {	
				limit = {
					exists = scope:title_claim_1
				}
				custom_tooltip = coronation_supporter_declare_war_tt
			}
			else = {
				custom_tooltip = coronation_supporter_declare_war_no_title_tt
			}
			if = {
				limit = {
					involved_activity ?= scope:activity
				}
				remove_from_activity = scope:activity
			}
		}
		if = {
			limit = {
				scope:foe = { involved_activity ?= scope:activity }
			}
			scope:foe = { remove_from_activity = scope:activity }
		}
		stress_impact = {
			forgiving = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 1
				ai_compassion = -1
			}
			opinion_modifier = { # Opinion Factor
				who = root
				opinion_target = scope:foe
				multiplier = -2
				desc = AI_OPINION_REASON
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = forgiving
					has_trait = compassionate
				}
			}
		}
	}
	#Normal declare (TARGET 2)
	option = {
		trigger = { exists = scope:foe_2 }
		name = coronation_events.6020.d
		scope:supporter = {
			coronation_events_6020_declare_war_effect = { FOE = scope:foe_2 }

			if = {	
				limit = {
					exists = scope:title_claim_2
				}
				custom_tooltip = coronation_supporter_declare_war_2_tt
			}
			else = {
				custom_tooltip = coronation_supporter_declare_war_no_title_2_tt
			}
			if = {
				limit = {
					involved_activity ?= scope:activity
				}
				remove_from_activity = scope:activity
			}
		}
		if = {
			limit = {
				scope:foe_2 = { involved_activity ?= scope:activity }
			}
			scope:foe_2 = { remove_from_activity = scope:activity }
		}
		stress_impact = {
			forgiving = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 1
				ai_compassion = -1
			}
			opinion_modifier = { # Opinion Factor
				who = root
				opinion_target = scope:foe_2
				multiplier = -2
				desc = AI_OPINION_REASON
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = forgiving
					has_trait = compassionate
				}
			}
		}
	}
	#Redirect your passion to this great occasion
	option = {
		name = coronation_events.6020.e
		#Option improved by an intent (and player is informed of this)
		if = {
			limit = {
				has_activity_intent = coronation_impress_attendees
			}
			custom_tooltip = coronation_tt_positive_medium
			scope:activity = { activity_special_type_progression_medium = yes }
			coronation_add_magnificence_log_effect = {
				VALUE = flag:positive_medium
				CHAR = root
			}
		}
		else = {
			custom_tooltip = coronation_tt_positive_tiny
			scope:activity = { activity_special_type_progression_tiny = yes }
			coronation_add_magnificence_log_effect = {
				VALUE = flag:positive_tiny
				CHAR = root
			}
		}


		stress_impact = {
			vengeful = minor_stress_impact_gain
			sadistic = miniscule_stress_impact_gain
			wrathful = minor_stress_impact_gain
			paranoid = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = -2
			}
			modifier = {
				add = -50
				OR = {
					has_trait = sadistic
					has_trait = paranoid
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = vengeful
					has_trait = wrathful
				}
			}
		}
	}
	after = {
		# For MP
		coronation_ready_effect = yes

		scope:supporter = {
			remove_variable = mass_mobilitization_development_value
			remove_variable = mass_mobilitization_development_progress_value
			remove_variable = mass_mobilitization_fertility_value
			remove_variable = mass_mobilitization_total
		}
	}
}

scripted_effect coronation_events_6030_choose_courtesan_effect = {
	had_sex_with_effect = {
		CHARACTER = $COURTESAN$
		PREGNANCY_CHANCE = pregnancy_chance
	}

	#Add to court
	add_courtier = $COURTESAN$
	#Add progress to lover relation
	set_relation_lover = {
		reason = lover_coronation_courtesan
		target = $COURTESAN$
	}
	if = {
		limit = {
			NOT = {
				has_trait = rakish
			}
		}
		random = {
			chance = 5
			add_trait = rakish
		}
	}
	if = {
		limit = {
			scope:host = {
				is_ai = yes
			}
			OR = {
				intrigue > scope:host.intrigue
				intrigue >= high_skill_rating
			}
			custom_tooltip = host_has_courtesan_hooks_tt
		}
	}
	$COURTESAN$ = {
		add_character_flag = {
			flag = picked_courtesan
			days = 30
		}
	}
}

#horny king is hosting a courtesan sex party
coronation_events.6030 = {
	type = activity_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					involved_activity = { has_activity_type = activity_coronation }
				}
				desc = coronation_events.6030.t
			}
			desc = coronation_events.6030.t_feast
		}
	}
	desc = coronation_events.6030.desc
	left_portrait = {
		character = scope:fearsome_courtesan
		animation = flirtation
		camera = camera_event_center_pointing_slighty_left
	}
	center_portrait = {
		character = scope:cunning_courtesan
		animation = admiration
		camera = camera_event_left_forward
	}
	right_portrait = {
		character = scope:host
		animation = eccentric
	}
	lower_left_portrait = scope:experienced_courtesan
	lower_center_portrait = scope:funny_courtesan_1
	lower_right_portrait = scope:funny_courtesan_2
	theme = coronation_activity
	override_background = {
		reference = bedchamber
	}
	cooldown = { months = 6 }

	trigger = {
		is_adult = yes
		is_playable_character = yes
		NOT = {
			this = involved_activity.activity_host
		}
		trigger_if = {
			limit = {
				is_ai = yes
			}
			might_cheat_on_every_partner_trigger = yes
		}
		NOR = {
			has_trait = celibate
			has_trait = chaste
			is_incapable = yes
			has_contagious_deadly_disease_trigger = yes
			is_eunuch_trigger = yes
			has_trait = leper
		}
		involved_activity = {
			activity_host = {
				OR = {
					AND = {
						#It's a trap!
						is_ai = yes
						OR = {
							intrigue > decent_skill_rating
							highest_skill = intrigue
						}
						opinion = {
							target = root
							value > -50
						}
					}
					#Actually likes you
					opinion = {
						target = root
						value > 0
					}
				}
				
				NOR = {
					has_contagious_deadly_disease_trigger = yes
					has_trait = leper
					is_incapable = yes
					has_trait = celibate
					has_trait = chaste
				}
				is_adult = yes
				OR = {
					has_trait = deviant
					might_cheat_on_every_partner_trigger = yes
					has_trait = rakish
					has_trait = seducer
					has_trait = lustful
				}
				#Let's make this simple and only do same-gender pairs between root and host
				OR = {
					AND = {
						is_male = yes
						root = { is_male = yes }
					}
					AND = {
						is_male = no
						root = { is_male = no }
					}
				}
				#Sexuality that matches root's
				OR = {
					AND = {
						is_attracted_to_men = yes
						root = { is_attracted_to_men = yes }
					}
					AND = {
						is_attracted_to_women = yes
						root = { is_attracted_to_women = yes }
					}
				}
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = -1
			involved_activity.activity_host = {
				might_cheat_on_every_partner_trigger = no
			}
		}
		modifier = {
			add = -1
			involved_activity.activity_host = {
				OR = {
					AND = {
						faith = {
							has_doctrine = doctrine_adultery_men_shunned
						}
						is_male = yes
						is_married = yes
					}
					AND = {
						faith = {
							has_doctrine = doctrine_adultery_women_shunned
						}
						is_female = yes
						is_married = yes
					}
				}
			}
		}
		modifier = {
			add = -2
			involved_activity.activity_host = {
				OR = {
					AND = {
						faith = {
							has_doctrine = doctrine_adultery_men_crime
						}
						is_male = yes
						is_married = yes
					}
					AND = {
						faith = {
							has_doctrine = doctrine_adultery_women_crime
						}
						is_female = yes
						is_married = yes
					}
				}
			}
		}
		modifier = {
			add = 1
			involved_activity.activity_host = {
				has_trait = lustful
			}
		}
		modifier = {
			add = 1
			involved_activity.activity_host = {
				has_trait = deviant
			}
		}
		modifier = {
			add = 1
			involved_activity.activity_host = {
				has_trait = seducer
			}
		}
		modifier = {
			add = 1
			root = { has_focus = intrigue_temptation_focus }
		}
		modifier = {
			add = 1
			root = { has_trait = rakish }
		}
		modifier = {
			add = 1
			root = { has_trait = lustful }
		}
		modifier = {
			add = 1
			root = { has_trait = seducer }
		}
		modifier = {
			add = 2
			involved_activity.activity_host = {
				has_trait = rakish
			}
		}
		modifier = {
			add = 2
			involved_activity.activity_host = {
				faith = { trait_is_virtue = lustful }
			}
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		#Save host and location
		scope:activity = {
			activity_location = { save_scope_as = location }
			activity_host = { save_scope_as = host }
		}
		#Female courtesans
		if = {
			limit = {
				AND = {
					is_attracted_to_women = yes
					scope:host = { is_attracted_to_women = yes }
				}
			}
			create_character = {
				location = root.location
				template = experienced_courtesan_character
				gender = female
				faith = scope:host.faith
				culture = scope:host.culture
				save_scope_as = experienced_courtesan
			}
			create_character = {
				location = root.location
				template = funny_courtesan_character
				gender = female
				faith = scope:host.faith
				culture = scope:host.culture
				mother = scope:experienced_courtesan
				save_scope_as = funny_courtesan_1
			}
			scope:funny_courtesan_1 = {
				add_to_list = courtesans
			}
			create_character = {
				location = root.location
				template = funny_courtesan_character
				gender = female
				faith = scope:host.faith
				culture = scope:host.culture
				mother = scope:experienced_courtesan
				save_scope_as = funny_courtesan_2
			}
			scope:funny_courtesan_2 = {
				add_to_list = courtesans
			}
			create_character = {
				location = root.location
				template = cunning_courtesan_character
				gender = female
				faith = root.location.faith
				culture = root.location.culture
				save_scope_as = cunning_courtesan
			}
			scope:cunning_courtesan = {
				add_to_list = courtesans
			}
			create_character = {
				location = root.location
				template = fearsome_courtesan_character
				gender = female
				faith = root.location.faith
				culture = root.location.culture
				save_scope_as = fearsome_courtesan
			}
			scope:fearsome_courtesan = {
				add_to_list = courtesans
			}
			scope:experienced_courtesan = {
				add_to_list = courtesans
			}
		}
		#Male courtesans
		else = {
			create_character = {
				location = root.location
				template = experienced_courtesan_character
				gender = male
				faith = scope:host.faith
				culture = scope:host.culture
				save_scope_as = experienced_courtesan
			}
			create_character = {
				location = root.location
				template = funny_courtesan_character
				gender = male
				father = scope:experienced_courtesan
				faith = scope:host.faith
				culture = scope:host.culture
				save_scope_as = funny_courtesan_1
			}
			scope:funny_courtesan_1 = {
				add_to_list = courtesans
			}
			create_character = {
				location = root.location
				template = funny_courtesan_character
				gender = male
				father = scope:experienced_courtesan
				faith = scope:host.faith
				culture = scope:host.culture
				save_scope_as = funny_courtesan_2
			}
			scope:funny_courtesan_2 = {
				add_to_list = courtesans
			}
			create_character = {
				location = root.location
				template = cunning_courtesan_character
				gender = male
				faith = scope:host.faith
				culture = scope:host.culture
				save_scope_as = cunning_courtesan
			}
			scope:cunning_courtesan = {
				add_to_list = courtesans
			}
			create_character = {
				location = root.location
				template = fearsome_courtesan_character
				gender = male
				faith = root.location.faith
				culture = root.location.culture
				save_scope_as = fearsome_courtesan
			}
			scope:fearsome_courtesan = {
				add_to_list = courtesans
			}
			scope:experienced_courtesan = {
				add_to_list = courtesans
			}
		}
		hidden_effect = {
			#Set sexuality
			every_in_list = {
				list = courtesans
				random_list = {
					10 = {
						set_sexuality = bisexual
					}
					5 = {
						trigger = {
							OR = {
								AND = {
									is_female = yes
									root = { is_female = yes }
								}
								AND = {
									is_male = yes
									root = { is_male = yes }
								}
							}
						}
						set_sexuality = homosexual
					}
					10 = {
						trigger = {
							OR = {
								AND = {
									is_female = no
									root = { is_female = yes }
								}
								AND = {
									is_male = no
									root = { is_male = yes }
								}
							}
						}
						set_sexuality = heterosexual
					}
				}
				add_character_flag = {
					flag = is_naked
					days = 30
				}
			}
			#Assign nicknames
			scope:experienced_courtesan = {
				assign_random_nickname_effect = yes
			}
			scope:fearsome_courtesan = {
				assign_random_nickname_effect = yes
			}
			scope:cunning_courtesan = {
				assign_random_nickname_effect = yes
			}
			if = {
				limit = {
					scope:host = {
						is_ai = yes
					}
				}
				every_in_list = {
					list = courtesans
					scope:host = {
						add_hook = {
							type = supporter_hook
							target = prev
						}
					}
				}
			}
		}
	}
	#The fearsome arm-wrestling warrior woman/man
	option = {
		name = coronation_events.6030.a
		flavor = {
			first_valid = {
				triggered_desc = {
					trigger = {
						scope:cunning_courtesan = {
							is_male = yes
						}
					}
					desc = coronation_events.6030.a_flavor
				}
				desc = coronation_events.6030.a_thighs
			}
		}

		add_prowess_skill = 1
		coronation_events_6030_choose_courtesan_effect = { COURTESAN = scope:fearsome_courtesan }

		stress_impact = {
			just = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 200
				OR = {
					OR = {
						has_education_martial_trigger = yes
						has_martial_lifestyle_trait_trigger = yes
					}
				}
			}
			modifier = {
				factor = 0
				has_trait = just
			}
		}
	}
	#The clever little minx
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							scope:cunning_courtesan = {
								is_male = yes
							}
						}
						desc = coronation_events.6030.b
					}
					desc = coronation_events.6030.b_minx
				}
			}
		}
		flavor = coronation_events.6030.b_flavor

		add_intrigue_lifestyle_xp = medium_lifestyle_xp
		coronation_events_6030_choose_courtesan_effect = { COURTESAN = scope:cunning_courtesan }

		stress_impact = {
			just = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 200
				OR = {
					OR = {
						has_education_intrigue_trigger = yes
						has_intrigue_lifestyle_trait_trigger = yes
					}
				}
			}
			modifier = {
				factor = 0
				has_trait = just
			}
		}
	}
	#The astute, experienced madame
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							scope:cunning_courtesan = {
								is_male = yes
							}
						}
						desc = coronation_events.6030.c
					}
					desc = coronation_events.6030.c_dame
				}
			}
		}
		flavor = coronation_events.6030.c_flavor

		add_stewardship_lifestyle_xp = medium_lifestyle_xp
		coronation_events_6030_choose_courtesan_effect = { COURTESAN = scope:experienced_courtesan }

		stress_impact = {
			just = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 200
				OR = {
					OR = {
						has_education_stewardship_trigger = yes
						has_stewardship_lifestyle_trait_trigger = yes
					}
				}
			}
			modifier = {
				factor = 0
				has_trait = just
			}
		}
	}
	#The sisters/brothers
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							scope:cunning_courtesan = {
								is_male = yes
							}
						}
						desc = coronation_events.6030.d
					}
					desc = coronation_events.6030.d_sisters
				}
			}
		}
		flavor = coronation_events.6030.d_flavor
		add_diplomacy_lifestyle_xp = medium_lifestyle_xp

		coronation_events_6030_choose_courtesan_effect = { COURTESAN = scope:funny_courtesan_1 }
		#Courtesan 2
		had_sex_with_effect = {
			CHARACTER = scope:funny_courtesan_2
			PREGNANCY_CHANCE = pregnancy_chance
		}
		#Add to court
		add_courtier = scope:funny_courtesan_2
		#Add progress to lover relation
		set_relation_lover = {
			reason = lover_coronation_courtesan
			target = scope:funny_courtesan_2
		}
		scope:funny_courtesan_2 = {
			add_character_flag = {
				flag = picked_courtesan
				days = 30
			}
		}

		create_character_memory = {
			type = had_a_threesome_memory
			participants = {
				partner_1 = scope:funny_courtesan_1
				partner_2 = scope:funny_courtesan_2
			}
		}

		stress_impact = {
			just = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 200
				OR = {
					OR = {
						has_education_diplomacy_trigger = yes
						has_diplomacy_lifestyle_trait_trigger = yes
					}
				}
			}
			modifier = {
				factor = 0
				has_trait = just
			}
		}
	}
	#Uh... nah maybe we can just have an intellectual conversation
	# SLASH FUCK YOU HOST
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							has_activity_intent = coronation_disrupt_loyalists
							scope:host = {
								is_ai = yes
								OR = {
									NOT = {
										faith = { trait_is_virtue = lustful }
									}
									AND = {
										is_male = yes
										scope:funny_courtesan_1 = {
											is_male = yes
										}
										faith = {
											has_doctrine = doctrine_homosexuality_crime
										}
									}
								}
							}
						}
						desc = coronation_events.6030.e_expose
					}
					desc = coronation_events.6030.e
				}
			}
		}
		#Needed for exposing option and opinion gain at end
		save_scope_as = exposer
		#I'm telling!
		if = {
			limit = {
				involved_activity = { has_activity_type = activity_coronation }
				has_activity_intent = coronation_disrupt_loyalists
				scope:host = {
					is_ai = yes
					OR = {
						NOT = {
							faith = { trait_is_virtue = lustful }
						}
						AND = {
							is_male = yes
							scope:funny_courtesan_1 = {
								is_male = yes
							}
							faith = {
								has_doctrine = doctrine_homosexuality_crime
							}
						}
					}
				}
			}
			if = {
				limit = {
					faith = { trait_is_sin = lustful }
				}
				add_piety = major_piety_gain
			}
			else_if = {
				limit = {
					NOT = {
						faith = { trait_is_virtue = lustful }
					}
				}
				add_piety = minor_piety_gain
			}
			scope:host = {
				#Piety loss based on how bad horny is
				if = {
					limit = {
						faith = { trait_is_sin = lustful }
					}
					add_piety = major_piety_loss
				}
				else_if = {
					limit = {
						NOT = {
							faith = { trait_is_virtue = lustful }
						}
					}
					add_piety = medium_piety_loss
				}
				#Is this you exposing them cheating?
				if = {
					limit = {
						is_married = yes
						OR = {
							AND = {
								is_male = yes
								NOT = {
									faith = {
										has_doctrine = doctrine_adultery_men_accepted
									}
								}
							}
							AND = {
								is_female = yes
								NOT = {
									faith = {
										has_doctrine = doctrine_adultery_women_accepted
									}
								}
							}
						}
					}
					save_scope_as = log_sent
					scope:activity = {
						add_activity_log_entry = {
							key = coronation_host_orgy_exposed_log
							character = scope:host
							target = scope:exposer
							score = 20
							show_in_conclusion = yes
							scope:host = {
								add_trait = adulterer
							}
						}
					}
					every_spouse = {
						custom = custom.every_consort
						add_opinion = {
							target = scope:host
							modifier = cheater_opinion
							opinion = -40
						}
					}
					add_opinion = {
						target = root
						opinion = -60
						modifier = betrayal_opinion
					}
				}
				else = {
					add_opinion = {
						target = root
						opinion = -40
						modifier = betrayal_opinion
					}
				}
				#Is this you exposing them being a sodomite?
				if = {
					limit = {
						is_male = yes
						scope:funny_courtesan_1 = {
							is_male = yes
						}
						faith = {
							has_doctrine = doctrine_homosexuality_crime
						}
					}
					#Send log if haven't already
					if = {
						limit = {
							NOT = { exists = scope:log_sent }
						}
						save_scope_as = log_sent
						scope:activity = {
							add_activity_log_entry = {
								key = coronation_host_orgy_exposed_log
								character = scope:host
								target = scope:exposer
								score = 20
								show_in_conclusion = yes
								scope:host = {
									add_trait = sodomite
								}
							}
						}
					}
					else = {
						add_trait = sodomite
					}
				}
			}
			custom_tooltip = improved_because_intent_tt
			#Send log if haven't already
			if = {
				limit = {
					NOT = { exists = scope:log_sent }
				}
				scope:activity = {
					add_activity_log_entry = {
						key = coronation_host_orgy_exposed_log
						character = scope:host
						target = scope:exposer
						score = 20
						show_in_conclusion = yes
					}
				}
			}
		}
		else = {
			scope:host = {
				add_opinion = {
					target = root
					opinion = -10
					modifier = disappointed_opinion
				}
			}
			add_learning_lifestyle_xp = minor_lifestyle_xp
		}
		stress_impact = {
			lustful = major_stress_impact_gain
			rakish = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_activity_intent = coronation_disrupt_loyalists
				add = 100
			}
			modifier = {
				OR = {
					has_trait = lustful
					has_trait = rakish
					might_cheat_on_every_partner_trigger = yes
				}
				factor = 0
			}
		}
	}
	after = {
		# For MP
		coronation_ready_effect = yes

		hidden_effect = {
			every_in_list = {
				list = courtesans
				remove_character_flag = is_naked
			}
			if = {
				limit = {
					scope:host = {
						is_ai = yes
					}
				}
				#Random unpicked courtesan might be picked by host
				random_in_list = {
					list = courtesans
					limit = {
						is_courtier = no
					}
					random = {
						chance = 50
						had_sex_with_effect = {
							CHARACTER = scope:host
							PREGNANCY_CHANCE = pregnancy_chance
						}
						add_character_flag = {
							flag = picked_courtesan
							days = 30
						}
						#Add to court
						scope:host = {
							add_courtier = prev
						}
					}
				}
			}
			every_in_list = {
				list = courtesans
				limit = {
					NOT = { has_character_flag = picked_courtesan }
				}
				silent_disappearance_effect = yes
			}
			every_in_list = {
				list = courtesans
				silent_disappearance_ai_effect = yes
			}
			#gain opinion of AI host if they accepted
			if = {
				limit = {
					NOT = {
						exists = scope:exposer
					}
					scope:host = {
						is_ai = yes
						intrigue > root.intrigue  
					}
				}
				add_opinion = {
					target = scope:host
					modifier = grateful_opinion
					opinion = 20
				}
			}
		}
	}
}

# CEREMONY-PHASE CROWNING EVENTS #

#HOST EVENTS
#Being crowned by someone else
coronation_events.6100 = {
	type = activity_event
	title = coronation_events.6100.t
	desc = {
		desc = coronation_events.6100.desc_intro
		#Host perspective
		first_valid = {
			triggered_desc = {
				trigger = {
					this = scope:host
				}
				desc = {
					#Middle is faith dependent
					first_valid = {
						triggered_desc = {	
							trigger = {
								scope:activity.var:activity_special_type_progression >= 25
								scope:host.faith.religion = {
									this = religion:christianity_religion
								}
								scope:host = {
									OR = {
										AND = {
											culture = {
												has_cultural_pillar = language_greek
												has_cultural_pillar = heritage_byzantine
											}
											highest_held_title_tier >= tier_empire
										}
										primary_title = title:e_byzantium
									}
									is_male = yes
								}
							}
							desc = coronation_events.6100.desc_byzantine
						}
						triggered_desc = {	
							trigger = {
								scope:activity.var:activity_special_type_progression >= 25
								scope:host.faith.religion = {
									this = religion:christianity_religion
								}
								scope:host = {
									OR = {
										AND = {
											culture = {
												has_cultural_pillar = language_greek
												has_cultural_pillar = heritage_byzantine
											}
											highest_held_title_tier >= tier_empire
										}
										primary_title = title:e_byzantium
									}
								}
							}
							desc = coronation_events.6100.desc_byzantine_femme
						}
						triggered_desc = {	
							trigger = {
								scope:activity.var:activity_special_type_progression >= 75
							}
							desc = coronation_events.6100.desc_high
						}
						triggered_desc = {	
							trigger = {
								scope:activity.var:activity_special_type_progression < 25
							}
							desc = coronation_events.6100.desc_low
						}
						triggered_desc = {	
							trigger = {
								scope:host.faith.religion = {
									this = religion:christianity_religion
								}
							}
							desc = coronation_events.6100.desc_christian
						}
						desc = coronation_events.6100.desc_generic
					}
					#Ending depends on faith and independence
					first_valid = {
						triggered_desc = {
							trigger = {
								scope:activity.var:activity_special_type_progression >= 25
								scope:host.faith.religion = {
									this = religion:christianity_religion
								}
								scope:host = {
									OR = {
										AND = {
											culture = {
												has_cultural_pillar = language_greek
												has_cultural_pillar = heritage_byzantine
											}
											highest_held_title_tier >= tier_empire
										}
										primary_title = title:e_byzantium
									}
									ai_zeal <= low_negative_ai_value
								}
							}
							desc = coronation_events.6100.desc_ending_byzantine_cynical
						}
						triggered_desc = {
							trigger = {
								scope:activity.var:activity_special_type_progression >= 25
								scope:host.faith.religion = {
									this = religion:christianity_religion
								}
								scope:host = {
									OR = {
										AND = {
											culture = {
												has_cultural_pillar = language_greek
												has_cultural_pillar = heritage_byzantine
											}
											highest_held_title_tier >= tier_empire
										}
										primary_title = title:e_byzantium
									}
								}
							}
							desc = coronation_events.6100.desc_ending_byzantine
						}
						triggered_desc = {
							trigger = {
								scope:host = {
									faith.religion = {
										NOT = { is_in_family = rf_abrahamic }
									}
									is_independent_ruler = no
								}
							}
							desc = coronation_events.6100.desc_ending_non_abrahamic_vassal
						}
						triggered_desc = {
							trigger = {
								scope:host = { is_independent_ruler = no }
							}
							desc = coronation_events.6100.desc_ending_vassal
						}
						triggered_desc = {
							trigger = {
								scope:host = {
									faith.religion = {
										NOT = { is_in_family = rf_abrahamic }
									}
								}
							}
							desc = coronation_events.6100.desc_ending_non_abrahamic
						}
						desc = coronation_events.6100.desc_ending
					}
				}
			}
			#Guest perspective
			desc = {
				#Middle is faith dependent
				first_valid = {
					triggered_desc = {	
							trigger = {
								scope:activity.var:activity_special_type_progression >= 25
								scope:host.faith.religion = {
									this = religion:christianity_religion
								}
								scope:host = {
									OR = {
										AND = {
											culture = {
												has_cultural_pillar = language_greek
												has_cultural_pillar = heritage_byzantine
											}
											highest_held_title_tier >= tier_empire
										}
										primary_title = title:e_byzantium
									}
									is_male = yes
								}
							}
							desc = coronation_events.6100.desc_byzantine_guest
						}
						triggered_desc = {	
							trigger = {
								scope:activity.var:activity_special_type_progression >= 25
								scope:host.faith.religion = {
									this = religion:christianity_religion
								}
								scope:host = {
									OR = {
										AND = {
											culture = {
												has_cultural_pillar = language_greek
												has_cultural_pillar = heritage_byzantine
											}
											highest_held_title_tier >= tier_empire
										}
										primary_title = title:e_byzantium
									}
								}
							}
							desc = coronation_events.6100.desc_byzantine_femme_guest
						}
					triggered_desc = {	
						trigger = {
							scope:activity.var:activity_special_type_progression >= 75
						}
						desc = coronation_events.6100.desc_high_guest
					}
					triggered_desc = {	
						trigger = {
							scope:activity.var:activity_special_type_progression < 25
						}
						desc = coronation_events.6100.desc_low_guest
					}
					triggered_desc = {	
						trigger = {
							scope:host.faith.religion = {
								this = religion:christianity_religion
							}
						}
						desc = coronation_events.6100.desc_christian_guest
					}
					desc = coronation_events.6100.desc_generic_guest
				}
				#Ending depends on faith and independence
				first_valid = {
					triggered_desc = {
						trigger = {
							scope:activity.var:activity_special_type_progression >= 25
							scope:host.faith.religion = {
								this = religion:christianity_religion
							}
							scope:host = {
								OR = {
									AND = {
										culture = {
											has_cultural_pillar = language_greek
											has_cultural_pillar = heritage_byzantine
										}
										highest_held_title_tier >= tier_empire
									}
									primary_title = title:e_byzantium
								}
							}
						}
						desc = coronation_events.6100.desc_ending_byzantine_guest
					}
					triggered_desc = {
						trigger = {
							scope:host = {
								faith.religion = {
									NOT = { is_in_family = rf_abrahamic }
								}
								is_independent_ruler = no
							}
						}
						desc = coronation_events.6100.desc_ending_non_abrahamic_vassal_guest
					}
					triggered_desc = {
						trigger = {
							scope:host = { is_independent_ruler = no }
						}
						desc = coronation_events.6100.desc_ending_vassal_guest
					}
					triggered_desc = {
						trigger = {
							scope:host = {
								faith.religion = {
									NOT = { is_in_family = rf_abrahamic }
								}
							}
						}
						desc = coronation_events.6100.desc_ending_non_abrahamic_guest
					}
					desc = coronation_events.6100.desc_ending_guest
				}
			}
		}
	}
	left_portrait = {
		character = scope:observer
		triggered_animation = {
			trigger = {
				scope:observer = {
					opinion = {
						target = scope:host
						value < -50
					}
				}
			}
			animation = disapproval
		}
		triggered_animation = {
			trigger = {
				scope:observer = {
					opinion = {
						target = scope:host
						value <= 30
					}
					ai_honor <= medium_negative_ai_value
					OR = {
						this = scope:host.primary_heir
						this = scope:host.diarch
					}
				}
			}
			animation = scheme
		}
		triggered_animation = {
			trigger = {
				scope:observer = {
					opinion = {
						target = scope:host
						value < 0
					}
				}
			}
			animation = personality_vengeful
		}
		triggered_animation = {
			trigger = {
				scope:observer = {
					opinion = {
						target = scope:host
						value >= 90
					}
					this = scope:host.primary_spouse
				}
			}
			animation = wedding_happy_cry
		}
		triggered_animation = {
			trigger = {
				scope:observer = {
					opinion = {
						target = scope:host
						value >= 0
					}
					ai_zeal >= low_positive_ai_value
					OR = { 
						faith.religion = religion:eastern_orthodox_religion 
						faith.religion = religion:catholic_religion 
						faith.religion = religion:protestant_religion 
					}
					OR = {
						this = scope:host.primary_heir
						this = scope:host.primary_spouse
					}
				}
			}
			animation = prayer
		}
		triggered_animation = {
			trigger = {
				scope:observer = {
					opinion = {
						target = scope:host
						value >= 60
					}
				}
			}
			animation = personality_compassionate
		}
		animation = chaplain
		camera = camera_event_left_crowning_observation
	}
	center_portrait = {
		character = scope:host
		animation = throne_room_kneel_1
		camera = camera_event_center_coronation_kneeling
	}
	right_portrait = {
		character = scope:crowner
		animation = crowning
		camera = camera_event_right_crowner_crowning
	}
	override_background = {
		trigger = {
			scope:host.capital_county = title:c_byzantion
		}
		reference = ep3_hagia_sophia
	}
	override_background = {
		trigger = {
			NOT = {
				scope:host.capital_county = title:c_byzantion
			}
		}
		reference = temple
	}
	artifact = {
		target = scope:crowning_artifact
		position = lower_right_portrait
	}
	override_effect_2d = {
		trigger = {
			scope:activity.var:activity_special_type_progression >= 75
		}
		reference = legend_glow	
	}
	override_effect_2d = {
		trigger = {
			scope:activity.var:activity_special_type_progression < 25
		}
		reference = flies	
	}

	theme = coronation_activity
	cooldown = { days = 20 }

	trigger = {
		coronation_being_crowned_trigger = yes
	}
	on_trigger_fail = {
		if = {
			limit = {
				coronation_self_crowning_trigger = yes
			}
			# Trigger the "there is no officiator" version
			trigger_event = {
				id = coronation_events.6101
				days = 1
			}
		}
		else = {
			#Skip to enthroning
			trigger_event = {
				id = coronation_events.6102
				days = 1
			}
		}
	}
	immediate = {
		# For MP
		coronation_busy_effect = yes

		remove_character_flag = need_military_outfit
		scope:activity.activity_host = {
			save_scope_as = host
		}
		scope:host = {
			#Pick appropriate music
			#Eastern Orthodox chanting
			if = {
				limit = {
					OR = {
						faith = faith:orthodox
						culture = { has_cultural_pillar = heritage_byzantine }
						culture = { has_cultural_pillar = language_greek }
					}
					scope:activity.var:activity_special_type_progression >= 25
				}
				play_music_cue = mep3_mood_06
			}
			#Iberian
			else_if = {
				limit = {
					OR = {
						culture = { has_building_gfx = iberian_building_gfx }
					}
					scope:activity.var:activity_special_type_progression >= 25
				}
				play_music_cue = "mx_Struggle_ending_compromise"
			}
			#Norse
			else_if = {
				limit = {
					culture = { has_graphical_norse_culture_group_trigger = yes }
					scope:activity.var:activity_special_type_progression >= 25
				}
				play_music_cue = mx_mood_fp1_thefeast
			}
			#Steppe
			else_if = {
				limit = {
					OR = {
						government_has_flag = government_is_nomadic
						government_has_flag = government_is_tribal
						has_trait = nomadic_philosophy
					}
					culture = { has_graphical_steppe_culture_group_trigger = yes }
				}
				play_music_cue = mx_cue_the_khans_glory
			}
			#MENA
			else_if = {
				limit = {
					OR = {
						culture = { has_graphical_mena_culture_group_trigger = yes }
						culture = { has_graphical_iranian_culture_group_trigger = yes }
					}
				}
				play_music_cue = struggleend_cue
			}
			else_if = {
				limit = {
					scope:activity.var:activity_special_type_progression < 25
				}
				play_music_cue = "mx_cue_succession"
			}
			else_if = {
				limit = {
					scope:activity.var:activity_special_type_progression >= 75
				}
				play_music_cue = "mx_cue_positive_effect"
			}
			else = {
				play_music_cue = "mx_cue_sacredrite"
			}
			if = {
				limit = {
					coronation_living_officiator_trigger = yes
				}
				involved_activity.var:officiator ?= {
					save_scope_as = crowner
				}
			}
			
			#Get wife to be next to you
			if = {
				limit = {
					exists = primary_spouse
					scope:activity = {
						any_attending_character = {
							this = scope:host.primary_spouse
						}
					}
				}
				primary_spouse = {
					save_scope_as = observer
				}
			}
			#Get heir to be next to you
			if = {
				limit = {
					NOT = {
						exists = scope:observer
					}
					primary_heir = {
						age >= 5
					}
					scope:activity = {
						any_attending_character = {
							this = scope:host.primary_heir
						}
					}
				}
				primary_heir = {
					save_scope_as = observer
				}
			}
			#Get your crown/regalia to equip it
			coronation_save_crowning_artifact_effect = { HOST = scope:host }
			if = {
				limit = {
					this = root
				}
				coronation_ceremony_opinion_effect = yes
			}
			else = {
				show_as_tooltip = {
					coronation_ceremony_opinion_effect = yes
				}
			}
		}
	}
	#Normal
	option = {
		name = {
			trigger = {
				scope:activity.var:activity_special_type_progression < 25
			}
			text = coronation_events.6100.a_guest_low
		}
		name = {
			trigger = {
				scope:activity.var:activity_special_type_progression >= 25
				NOT = {
					this = scope:host
				}
			}
			text = coronation_events.6100.a_guest
		}
		name = {
			trigger = {
				scope:activity.var:activity_special_type_progression >= 25
				this = scope:host
			}
			text = coronation_events.6100.a
		}
		flavor = {
			first_valid = {
				triggered_desc = {
					trigger = {
						this = scope:host
						scope:host = {
							has_trait = giant
						}
					}
					desc = coronation_events.6100.a_flavor_giant
				}
				triggered_desc = {
					trigger = {
						this = scope:host
						scope:host = {
							age <= 14
						}
					}
					desc = coronation_events.6100.a_flavor_adolescent
				}
				triggered_desc = {
					trigger = {
						scope:activity.var:activity_special_type_progression < 25
						NOT = {
							this = scope:host
						}
					}
					desc = coronation_events.6100.a_flavor_low_guest
				}
				triggered_desc = {
					trigger = {
						scope:activity.var:activity_special_type_progression < 25
					}
					desc = coronation_events.6100.a_flavor_low
				}
				desc = coronation_events.6100.a_flavor_decent
			}
		}
		if = {
			limit = {
				this = scope:host
				#Is only player at this coronation
				NOT = {
					scope:activity = {
						any_attending_character = {
							NOT = {
								this = scope:host
							}
							is_ai = no
						}
					}
				}
			}
			scope:host = {
				if = {
					limit = {
						exists = scope:crowning_artifact
						can_equip_artifact = scope:crowning_artifact
						scope:crowning_artifact = { is_equipped = no }
					}
					scope:crowning_artifact = { equip_artifact_to_owner = yes }
				}
				coronation_change_law_effect = yes
			}
		}
		else = {
			show_as_tooltip = {
				scope:host = {
					if = {
						limit = {
							exists = scope:crowning_artifact
							can_equip_artifact = scope:crowning_artifact
							scope:crowning_artifact = { is_equipped = no }
						}
						scope:crowning_artifact = { equip_artifact_to_owner = yes }
					}
					coronation_change_law_effect = yes
				}
			}
		}
		if = {
			limit = {
				this = scope:host
				scope:activity.var:activity_special_type_progression >= 25
			}
			stress_impact = {
				arrogant = massive_stress_impact_loss
				ambitious = medium_stress_impact_loss
				just = medium_stress_impact_loss
			}
		}
	}
	after = {
		# For MP
		coronation_ready_effect = yes

		# Spouse crowning
		trigger_event = {
			id = coronation_events.6140
			days = 2
		}
		#Need to equip crown after guests get this event
		if = {
			limit = {
				scope:activity = {
					any_attending_character = {
						NOT = {
							this = scope:host
						}
						is_ai = no
					}
				}
			}
			trigger_event = {
				id = coronation_events.6103
				days = 5
			}
		}
	}
}

scripted_effect coronation_events_6101_self_crowning_effect = {
	add_prestige = medium_prestige_gain
	if = {	
		limit = {
			scope:activity = {
				has_activity_option = {
					category = special_type
					option = coronation_type_anointment
				}
			}
		}
		faith.religious_head ?= {
			save_scope_as = judger
		}
	}
	else = {
		cp:councillor_court_chaplain ?= {
			save_scope_as = judger
		}
	}
	if = {
		limit = {
			scope:activity.var:activity_special_type_progression < 75
		}
		scope:judger ?= {
			add_opinion = {
				target = scope:host
				modifier = self_crowning_opinion
				opinion = -15
			}
		}
		every_vassal = {
			custom = custom.every_zealot_vassal
			limit = {
				has_vassal_stance = zealot
				NOT = {
					this = scope:judger
				}
			}
			add_opinion = {
				target = scope:host
				modifier = self_crowning_opinion
				opinion = -10
			}
		}
	}
	else_if = {
		limit = {
			scope:activity.var:activity_special_type_progression < 50
		}
		scope:judger ?= {
			add_opinion = {
				target = scope:host
				modifier = self_crowning_opinion
				opinion = -30
			}
		}
		every_vassal = {
			custom = custom.every_zealot_vassal
			limit = {
				has_vassal_stance = zealot
				NOT = {
					this = scope:judger
				}
			}
			add_opinion = {
				target = scope:host
				modifier = self_crowning_opinion
				opinion = -20
			}
		}
	}
	else_if = {
		limit = {
			scope:activity.var:activity_special_type_progression < 25
		}
		scope:judger ?= {
			add_opinion = {
				target = scope:host
				modifier = self_crowning_opinion
				opinion = -50
			}
		}
		every_vassal = {
			custom = custom.every_zealot_vassal
			limit = {
				has_vassal_stance = zealot
				NOT = {
					this = scope:judger
				}
			}
			add_opinion = {
				target = scope:host
				modifier = self_crowning_opinion
				opinion = -30
			}
		}
	}
}

#Host is crowning themselves
coronation_events.6101 = {
	type = activity_event
	title = coronation_events.6100.t
	desc = {
		#Is it guest or host perspective?
		first_valid = {
			triggered_desc = {
				trigger = {
					this = scope:host
				}
				desc = {
					first_valid = {
						triggered_desc = {
							trigger = {
								scope:host = {
									coronation_proper_artifact_crown_trigger = yes
								}
							}
							desc = coronation_events.6101.desc_crowning_intro
						}
						desc = coronation_events.6101.desc_no_being_crowned_intro
					}
					#Priests' dissent is leveled by magnificence
					first_valid = {
						triggered_desc = {
							trigger = {	
								scope:host = {
									coronation_proper_artifact_crown_trigger = yes
									OR = { 
										faith.religion = religion:eastern_orthodox_religion 
										faith.religion = religion:catholic_religion 
										faith.religion = religion:protestant_religion 
									}
									culture = {
										has_cultural_pillar = heritage_iberian
										has_cultural_pillar = language_iberian
									}
								}
								scope:activity.var:activity_special_type_progression >= 25
							}
							desc = coronation_events.6101.desc_crowning_priests_iberian
						}
						triggered_desc = {
							trigger = {	
								scope:activity.var:activity_special_type_progression >= 75
							}
							desc = coronation_events.6101.desc_crowning_priests_high
						}
						triggered_desc = {
							trigger = {	
								scope:activity.var:activity_special_type_progression < 25
							}
							desc = coronation_events.6101.desc_crowning_priests_low
						}
						desc = coronation_events.6101.desc_crowning_priests_mid
					}
					#Mid part is Christian or not
					first_valid = {
						triggered_desc = {
							trigger = {
								scope:host = {
									OR = { 
										faith.religion = religion:eastern_orthodox_religion 
										faith.religion = religion:catholic_religion 
										faith.religion = religion:protestant_religion 
									}
								}
							}
							desc = coronation_events.6101.desc_words_christian
						}
						desc = coronation_events.6101.desc_words_generic
					}
					#End is based on personality
					first_valid = {
						triggered_desc = {
							trigger = {
								scope:host = {
									OR = {
										has_trait = humble
										has_trait = patient
										has_trait = just
										has_trait = content
										has_trait = shy
										has_trait = craven
										has_trait = compassionate
										has_trait = peasant_leader
									}
									NOR = {
										has_trait = arrogant
										has_trait = ambitious
										has_trait = greedy
									}
								}
								
							}
							desc = coronation_events.6101.desc_ending_humble
						}
						desc = coronation_events.6101.desc_ending
					}
				}
			}
			desc = {
				first_valid = {
					triggered_desc = {
						trigger = {
							scope:host = {
								coronation_proper_artifact_crown_trigger = yes
							}
						}
						desc = coronation_events.6101.desc_crowning_intro
					}
					desc = coronation_events.6101.desc_no_being_crowned_intro
				}
				#Priests' dissent is leveled by magnificence
				first_valid = {
					triggered_desc = {
						trigger = {	
							scope:host = {
								coronation_proper_artifact_crown_trigger = yes
								OR = { 
									faith.religion = religion:eastern_orthodox_religion 
									faith.religion = religion:catholic_religion 
									faith.religion = religion:protestant_religion 
								}
								culture = {
									has_cultural_pillar = heritage_iberian
									has_cultural_pillar = language_iberian
								}
							}
							OR = { 
									faith.religion = religion:eastern_orthodox_religion 
									faith.religion = religion:catholic_religion 
									faith.religion = religion:protestant_religion 
							}
							culture = {
								has_cultural_pillar = heritage_iberian
								has_cultural_pillar = language_iberian
							}
							scope:activity.var:activity_special_type_progression >= 25
						}
						desc = coronation_events.6101.desc_crowning_priests_iberian
					}
					triggered_desc = {
						trigger = {	
							scope:activity.var:activity_special_type_progression >= 75
						}
						desc = coronation_events.6101.desc_crowning_priests_high_guest
					}
					triggered_desc = {
						trigger = {	
							scope:activity.var:activity_special_type_progression < 25
						}
						desc = coronation_events.6101.desc_crowning_priests_low_guest
					}
					desc = coronation_events.6101.desc_crowning_priests_mid_guest
				}
				#Mid part is Christian or not
				first_valid = {
					triggered_desc = {
						trigger = {
							scope:host = {
								OR = { 
									faith.religion = religion:eastern_orthodox_religion 
									faith.religion = religion:catholic_religion 
									faith.religion = religion:protestant_religion 
								}
							}
						}
						desc = coronation_events.6101.desc_words_christian_guest
					}
					desc = coronation_events.6101.desc_words_generic_guest
				}
				#End is based on personality
				first_valid = {
					triggered_desc = {
						trigger = {
							scope:host = {
								OR = {
									has_trait = humble
									has_trait = patient
									has_trait = just
									has_trait = content
									has_trait = shy
									has_trait = craven
									has_trait = compassionate
									has_trait = peasant_leader
								}
								NOR = {
									has_trait = arrogant
									has_trait = ambitious
									has_trait = greedy
								}
							}
						}
						desc = coronation_events.6101.desc_ending_humble_guest
					}
					desc = coronation_events.6101.desc_ending_guest
				}
			}
		}
	}

	left_portrait = {
		character = scope:observer
		triggered_animation = {
			trigger = {
				scope:activity.var:activity_special_type_progression >= 75
				OR = {
					has_activity_intent = coronation_offer_support
					opinion = {
						target = scope:host
						value > 0
					}
				}
			}
			animation = admiration
		}
		triggered_animation = {
			trigger = {
				scope:activity.var:activity_special_type_progression < 25
				OR = {
					has_activity_intent = coronation_disrupt_loyalists
					opinion = {
						target = scope:host
						value < 30
					}
				}
			}
			animation = personality_callous
		}
		animation = personality_zealous
		camera = camera_event_left_to_the_left
	}
	center_portrait = {
		character = scope:host
		triggered_animation = {
			trigger = {
				scope:host = {
					OR = {
						has_trait = humble
						has_trait = content
						has_trait = craven
					}
					NOR = {
						has_trait = arrogant
						has_trait = ambitious
						has_trait = greedy
					}
				}
			}
			animation = personality_coward
		}
		triggered_animation = {
			trigger = {
				NOT = {
					OR = { 
						scope:host.faith.religion = religion:eastern_orthodox_religion 
						scope:host.faith.religion = religion:catholic_religion 
						scope:host.faith.religion = religion:protestant_religion 
					}
				}
				OR = {
					has_trait = arrogant
					has_trait = ambitious
					has_trait = arbitrary
					has_trait = greedy
				}
			}
			animation = personality_honorable
		}
		triggered_animation = {
			trigger = {
				NOT = {
					OR = { 
						scope:host.faith.religion = religion:eastern_orthodox_religion 
						scope:host.faith.religion = religion:catholic_religion 
						scope:host.faith.religion = religion:protestant_religion 
					}
				}
			}
			animation = personality_honorable
		}
		animation = acknowledging
		camera = camera_event_center_pointing_slighty_left
	}
	right_portrait = {
		character = scope:anointer
		triggered_animation = {
			trigger = {
				scope:activity.var:activity_special_type_progression >= 75
				OR = {
					has_activity_intent = coronation_offer_support
					opinion = {
						target = scope:host
						value > 0
					}
				}
			}
			animation = prayer
		}
		triggered_animation = {
			trigger = {
				scope:activity.var:activity_special_type_progression < 25
				OR = {
					has_activity_intent = coronation_disrupt_loyalists
					opinion = {
						target = scope:host
						value < 30
					}
				}
			}
			animation = disapproval
		}
		animation = chaplain
		camera = camera_event_right_to_the_right
	}
	override_background = {
		reference = throne_room
	}
	artifact = {
		target = scope:crowning_artifact
		position = lower_right_portrait
	}
	override_effect_2d = {
		trigger = {
			scope:activity.var:activity_special_type_progression >= 75
		}
		reference = legend_glow	
	}
	override_effect_2d = {
		trigger = {
			scope:activity.var:activity_special_type_progression < 25
		}
		reference = flies	
	}

	theme = coronation_activity
	cooldown = { days = 20 }

	trigger = {
		coronation_self_crowning_trigger = yes
	}
	on_trigger_fail = {
		trigger_event = {
			id = coronation_events.6102
			days = 1
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		remove_character_flag = need_military_outfit
		involved_activity = {
			activity_location = { save_scope_as = location }
			activity_host = { save_scope_as = host }
		}
		scope:host = {
			#Pick appropriate music
			#Eastern Orthodox chanting
			if = {
				limit = {
					OR = {
						faith = faith:orthodox
						culture = { has_cultural_pillar = heritage_byzantine }
						culture = { has_cultural_pillar = language_greek }
					}
					scope:activity.var:activity_special_type_progression >= 25
				}
				play_music_cue = mep3_mood_06
			}
			#Iberian
			else_if = {
				limit = {
					OR = {
						culture = { has_building_gfx = iberian_building_gfx }
					}
					scope:activity.var:activity_special_type_progression >= 25
				}
				play_music_cue = "mx_Struggle_ending_compromise"
			}
			#Norse
			else_if = {
				limit = {
					culture = { has_graphical_norse_culture_group_trigger = yes }
					scope:activity.var:activity_special_type_progression >= 25
				}
				play_music_cue = mx_mood_fp1_thefeast
			}
			#Steppe
			else_if = {
				limit = {
					OR = {
						government_has_flag = government_is_nomadic
						government_has_flag = government_is_tribal
						has_trait = nomadic_philosophy
					}
					culture = { has_graphical_steppe_culture_group_trigger = yes }
				}
				play_music_cue = mx_cue_the_khans_glory
			}
			#MENA
			else_if = {
				limit = {
					OR = {
						culture = { has_graphical_mena_culture_group_trigger = yes }
						culture = { has_graphical_iranian_culture_group_trigger = yes }
					}
				}
				play_music_cue = struggleend_cue
			}
			else_if = {
				limit = {
					scope:activity.var:activity_special_type_progression < 25
				}
				play_music_cue = "mx_cue_succession"
			}
			else_if = {
				limit = {
					scope:activity.var:activity_special_type_progression >= 75
				}
				play_music_cue = "mx_cue_positive_effect"
			}
			else = {
				play_music_cue = "mx_cue_sacredrite"
			}
			#Save an anointer if you don't have one
			if = {
				limit = {
					OR = {
						NOT = { exists = scope:anointer }
						scope:anointer = {
							is_alive = no
						}
						scope:anointer = {
							is_imprisoned = yes
						}
					}
				}
				coronation_save_anointer_effect = yes
			}
			#Get councilor
			if = {
				limit = {
					NOT = {
						exists = scope:observer
					}
				}
				#Get a councillor to be next to you
				scope:activity = {
					ordered_attending_character = {
						order_by = "opinion(scope:host)" 
						limit = {
							is_councillor_of = scope:host
							trigger_if = {
								limit = {
									exists = scope:anointer
								}
								NOT = {
									this = scope:anointer
								}
							}
						}
						save_scope_as = observer
					}
				}
			}
			#Get vassal
			if = {
				limit = {
					NOT = {
						exists = scope:observer
					}
				}
				scope:activity = {
					ordered_attending_character = {
						order_by = "opinion(scope:host)" 
						limit = {
							is_vassal_of = scope:host
							trigger_if = {
								limit = {
									exists = scope:anointer
								}
								NOT = {
									this = scope:anointer
								}
							}
						}
						save_scope_as = observer
					}
				}
			}
			#Get your crown/regalia to equip it
			coronation_save_crowning_artifact_effect = { HOST = scope:host }
			if = {
				limit = {
					this = root
				}
				coronation_ceremony_opinion_effect = yes
				if = {
					limit = {
						exists = scope:crowning_artifact
						can_equip_artifact = scope:crowning_artifact
						scope:crowning_artifact = { is_equipped = no }
					}
					scope:crowning_artifact = { equip_artifact_to_owner = yes }
				}
				coronation_change_law_effect = yes
			}
			else = {
				show_as_tooltip = {
					coronation_ceremony_opinion_effect = yes
					if = {
						limit = {
							exists = scope:crowning_artifact
							can_equip_artifact = scope:crowning_artifact
							scope:crowning_artifact = { is_equipped = no }
						}
						scope:crowning_artifact = { equip_artifact_to_owner = yes }
					}
					coronation_change_law_effect = yes
				}
			}
		}
	}
	#Normal
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							NOT = { this = scope:host }
							OR = {
								has_activity_intent = coronation_disrupt_loyalists
								has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
								AND = {
									liege = scope:host
									is_a_faction_member = yes
								}
							}
						}
						desc = coronation_events.6101.a_guest_neg
					}
					triggered_desc = {
						trigger = {
							NOT = { this = scope:host }
							OR = {
								has_activity_intent = coronation_offer_support
								has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host }
								has_trait = trusting
							}
							NOT = {
								host = {
									has_trait = craven
								}
							}
						}
						desc = coronation_events.6101.a_guest_pos
					}
					triggered_desc = {
						trigger = {
							NOT = { this = scope:host }
						}
						desc = coronation_events.6101.a_guest
					}
					triggered_desc = {
						trigger = {
							this = scope:host
							scope:host = {
								OR = {
									has_trait = humble
									has_trait = content
									has_trait = craven
								}
								NOR = {
									has_trait = arrogant
									has_trait = ambitious
									has_trait = greedy
								}
							}
						}
						desc = coronation_events.6101.a_oh_noes
					}
					desc = coronation_events.6101.a
				}
			}
		}	
		scope:host = {
			#Prestige gain and possible cleric opinion loss from self crowning
			if = {
				limit = {
					this = root
					coronation_proper_artifact_crown_trigger = yes
					NAND = {
						exists = faith.religious_head
						this = faith.religious_head
					}
				}
				coronation_events_6101_self_crowning_effect = yes
			}
			else_if = {
				limit = {
					coronation_proper_artifact_crown_trigger = yes
					NAND = {
						exists = faith.religious_head
						this = faith.religious_head
					}
				}
				show_as_tooltip = {
					coronation_events_6101_self_crowning_effect = yes
				}
			}
		}
		if = {
			limit = {
				this = scope:host
				scope:activity.var:activity_special_type_progression >= 25
			}
			stress_impact = {
				arrogant = massive_stress_impact_loss
				ambitious = medium_stress_impact_loss
			}
		}
	}
	after = {
		# For MP
		coronation_ready_effect = yes

		#Ceremony is over
		#Spouse crowning
		trigger_event = {
			id = coronation_events.6140
			days = 2
		}
		if = {
			limit = {
				scope:anointer = {
					has_variable = anointer_destroy_me
				}
			}
			scope:anointer = {
				silent_disappearance_effect = yes
			}
		}
	}
}

#Host is being enthroned
coronation_events.6102 = {
	type = activity_event
	title =  coronation_events.6102.t
	#Mention Christian regalia (orb and scepter), etc
	desc = {
		#Is it guest or host perspective?
		first_valid = {
			triggered_desc = {
				trigger = {
					this = scope:host
				}
				desc = {
					#End of other event serves as beginning
					first_valid = {
						triggered_desc = {
							trigger = {
								scope:host = {
									OR = {
										has_trait = humble
										has_trait = patient
										has_trait = just
										has_trait = content
										has_trait = shy
										has_trait = craven
										has_trait = compassionate
										has_trait = peasant_leader
									}
									NOR = {
										has_trait = arrogant
										has_trait = ambitious
										has_trait = greedy
									}
								}
								
							}
							desc = coronation_events.6101.desc_ending_humble
						}
						desc = coronation_events.6101.desc_ending
					}
					desc = coronation_events.6102_middle
					first_valid = {
						triggered_desc = {
							trigger = {
								scope:host = {
									coronation_host_east_asian_steppe_admin_trigger = yes
								}
								scope:activity.var:activity_special_type_progression >= 75
								scope:host = {
									NOR = {
										has_trait = humble
										has_trait = cynical
										has_trait = depressed
										has_trait = calm
									}
								}
							}
							desc = {
								desc = coronation_events.6102.desc_high_east_asian
								first_valid = {
									triggered_desc = {
										trigger = {
											scope:host = {
												AND = {
													government_is_japanese_trigger = yes
													has_title = title:e_japan
													tgp_has_ceremonial_liege_title_trigger = yes
												}
											}
										}
										desc = coronation_events.6102.desc_high_east_asian_ending_japan
									}
									desc = coronation_events.6102.desc_high_east_asian_ending
								}
							}
						}
						triggered_desc = {
							trigger = {
								scope:host = {
									coronation_host_east_asian_steppe_admin_trigger = yes
								}
								scope:activity.var:activity_special_type_progression < 25
							}
							desc = {
								desc = coronation_events.6102.desc_low_east_asian
								first_valid = {
									triggered_desc = {
										trigger = {
											scope:host = {
												AND = {
													government_is_japanese_trigger = yes
													has_title = title:e_japan
													tgp_has_ceremonial_liege_title_trigger = yes
												}
											}
										}
										desc = coronation_events.6102.desc_low_east_asian_ending_japan
									}
									desc = coronation_events.6102.desc_low_east_asian_ending
								}
							}
						}
						triggered_desc = {
							trigger = {
								scope:host = {
									coronation_host_east_asian_steppe_admin_trigger = yes
								}
							}
							desc = {
								desc = coronation_events.6102.desc_mid_east_asian
								first_valid = {
									triggered_desc = {
										trigger = {
											scope:host = {
												AND = {
													government_is_japanese_trigger = yes
													has_title = title:e_japan
													tgp_has_ceremonial_liege_title_trigger = yes
												}
											}
										}
										desc = coronation_events.6102.desc_mid_east_asian_ending_japan
									}
									desc = coronation_events.6102.desc_mid_east_asian_ending
								}
							}
						}
						triggered_desc = {
							trigger = {
								scope:activity.var:activity_special_type_progression >= 75
								scope:host = {
									NOR = {
										has_trait = humble
										has_trait = cynical
										has_trait = depressed
										has_trait = calm
									}
								}
							}
							desc = coronation_events.6102.desc_high
						}
						triggered_desc = {
							trigger = {
								scope:activity.var:activity_special_type_progression < 25
							}
							desc = coronation_events.6102.desc_low
						}
						desc = coronation_events.6102.desc_mid
					}
				}
			}
			#Guest perspective
			desc = {
				#End of other event serves as beginning
				first_valid = {
					triggered_desc = {
						trigger = {
							scope:host = {
								OR = {
									has_trait = humble
									has_trait = patient
									has_trait = just
									has_trait = content
									has_trait = shy
									has_trait = craven
									has_trait = compassionate
									has_trait = peasant_leader
								}
								NOR = {
									has_trait = arrogant
									has_trait = ambitious
									has_trait = greedy
								}
							}
						}
						desc = coronation_events.6101.desc_ending_humble_guest
					}
					desc = coronation_events.6101.desc_ending_guest
				}
				desc = coronation_events.6102_middle_guest
				first_valid = {
					triggered_desc = {
						trigger = {
							scope:host = {
								coronation_host_east_asian_steppe_admin_trigger = yes
							}
							scope:activity.var:activity_special_type_progression >= 75
							scope:host = {
								NOR = {
									has_trait = humble
									has_trait = cynical
									has_trait = depressed
									has_trait = calm
								}
							}
						}
						desc = {
							desc = coronation_events.6102.desc_high_east_asian_guest
							first_valid = {
								triggered_desc = {
									trigger = {
										scope:host = {
											AND = {
												government_is_japanese_trigger = yes
												has_title = title:e_japan
												tgp_has_ceremonial_liege_title_trigger = yes
											}
										}
									}
									desc = coronation_events.6102.desc_high_east_asian_ending_japan_guest
								}
								desc = coronation_events.6102.desc_high_east_asian_ending_guest
							}
						}
					}
					triggered_desc = {
						trigger = {
							scope:host = {
								coronation_host_east_asian_steppe_admin_trigger = yes
							}
							scope:activity.var:activity_special_type_progression < 25
						}
						desc = {
							desc = coronation_events.6102.desc_low_east_asian_guest
							first_valid = {
								triggered_desc = {
									trigger = {
										scope:host = {
											AND = {
												government_is_japanese_trigger = yes
												has_title = title:e_japan
												tgp_has_ceremonial_liege_title_trigger = yes
											}
										}
									}
									desc = coronation_events.6102.desc_low_east_asian_ending_japan_guest
								}
								desc = coronation_events.6102.desc_low_east_asian_ending_guest
							}
						}
					}
					triggered_desc = {
						trigger = {
							scope:host = {
								coronation_host_east_asian_steppe_admin_trigger = yes
							}
						}
						desc = {
							desc = coronation_events.6102.desc_mid_east_asian_guest
							first_valid = {
								triggered_desc = {
									trigger = {
										scope:host = {
											AND = {
												government_is_japanese_trigger = yes
												has_title = title:e_japan
												tgp_has_ceremonial_liege_title_trigger = yes
											}
										}
									}
									desc = coronation_events.6102.desc_mid_east_asian_ending_japan_guest
								}
								desc = coronation_events.6102.desc_mid_east_asian_ending_guest
							}
						}
					}
					triggered_desc = {
						trigger = {
							scope:activity.var:activity_special_type_progression >= 75
							NOR = {
								has_activity_intent = coronation_disrupt_loyalists
								has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
								AND = {
									is_vassal_of = scope:host
									is_a_faction_member = yes
								}
								has_trait = cynical
								has_trait = calm
								has_trait = temperate
								has_trait = callous
							}
						}
						desc = coronation_events.6102.desc_high_guest
					}
					triggered_desc = {
						trigger = {
							OR = {
								AND = {
									scope:activity.var:activity_special_type_progression <= 50
									OR = {
										has_activity_intent = coronation_disrupt_loyalists
										has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
										AND = {
											is_vassal_of = scope:host
											is_a_faction_member = yes
										}
									}
								}
								scope:activity.var:activity_special_type_progression < 25
							}
						}
						desc = coronation_events.6102.desc_low_guest
					}
					desc = coronation_events.6102.desc_mid_guest
				}
			}
		}
	}

	left_portrait = {
		character = scope:observer
		animation = reception_groom_left
		camera = camera_event_left_to_the_left
	}
	center_portrait = {
		character = scope:host
		triggered_animation = {
			trigger = {
				scope:host = {
					coronation_host_east_asian_steppe_admin_trigger = yes
				}
				NOT = {
					OR = { 
						scope:host.faith.religion = religion:eastern_orthodox_religion 
						scope:host.faith.religion = religion:catholic_religion 
						scope:host.faith.religion = religion:protestant_religion 
					}
				}
			}
			animation = emperor
		}
		triggered_animation = {
			trigger = {
				NOT = {
					OR = { 
						scope:host.faith.religion = religion:eastern_orthodox_religion 
						scope:host.faith.religion = religion:catholic_religion 
						scope:host.faith.religion = religion:protestant_religion 
					}
				}
			}
			animation = personality_honorable
		}
		animation = scepter
		camera = camera_event_center_mostly_away_right
	}
	right_portrait = {
		character = scope:anointer
		animation = reception_bride_right
		camera = camera_event_right_to_the_right
	}
	override_background = {
		reference = throne_room
	}
	artifact = {
		trigger = {
			exists = scope:crowning_artifact
		}
		target = scope:crowning_artifact
		position = lower_right_portrait
	}
	override_effect_2d = {
		trigger = {
			scope:activity.var:activity_special_type_progression >= 75
		}
		reference = legend_glow	
	}
	override_effect_2d = {
		trigger = {
			scope:activity.var:activity_special_type_progression < 25
		}
		reference = flies	
	}

	theme = coronation_activity
	cooldown = { days = 20 }
	immediate = {
		# For MP
		coronation_busy_effect = yes

		remove_character_flag = need_military_outfit
		involved_activity = {
			activity_location = { save_scope_as = location }
			activity_host = { save_scope_as = host }
		}
		scope:host = {
			save_scope_as = bg_override_char
			#Pick appropriate music
			#Eastern Orthodox chanting
			if = {
				limit = {
					OR = {
						faith = faith:orthodox
						culture = { has_cultural_pillar = heritage_byzantine }
						culture = { has_cultural_pillar = language_greek }
					}
					scope:activity.var:activity_special_type_progression >= 25
				}
				play_music_cue = mep3_mood_06
			}
			#Iberian
			else_if = {
				limit = {
					OR = {
						culture = { has_building_gfx = iberian_building_gfx }
					}
					scope:activity.var:activity_special_type_progression >= 25
				}
				play_music_cue = "mx_Struggle_ending_compromise"
			}
			#Norse
			else_if = {
				limit = {
					culture = { has_graphical_norse_culture_group_trigger = yes }
					scope:activity.var:activity_special_type_progression >= 25
				}
				play_music_cue = mx_mood_fp1_thefeast
			}
			#Steppe
			else_if = {
				limit = {
					OR = {
						government_has_flag = government_is_nomadic
						government_has_flag = government_is_tribal
						has_trait = nomadic_philosophy
					}
					culture = { has_graphical_steppe_culture_group_trigger = yes }
				}
				play_music_cue = mx_cue_the_khans_glory
			}
			#MENA
			else_if = {
				limit = {
					OR = {
						culture = { has_graphical_mena_culture_group_trigger = yes }
						culture = { has_graphical_iranian_culture_group_trigger = yes }
					}
				}
				play_music_cue = struggleend_cue
			}
			else_if = {
				limit = {
					scope:activity.var:activity_special_type_progression < 25
				}
				play_music_cue = "mx_cue_succession"
			}
			else_if = {
				limit = {
					scope:activity.var:activity_special_type_progression >= 75
				}
				play_music_cue = "mx_cue_positive_effect"
			}
			else = {
				play_music_cue = "mx_cue_sacredrite"
			}
			#Save an anointer if you don't have one
			if = {
				limit = {
					OR = {
						NOT = { exists = scope:anointer }
						scope:anointer = {
							is_alive = no
						}
						scope:anointer = {
							is_imprisoned = yes
						}
					}
				}
				coronation_save_anointer_effect = yes
			}
			#Get councilor
			if = {
				limit = {
					NOT = {
						exists = scope:observer
					}
				}
				#Get a councillor to be next to you
				scope:activity = {
					ordered_attending_character = {
						order_by = "opinion(scope:host)" 
						limit = {
							is_councillor_of = scope:host
							#spouse might feel strange here idk
							trigger_if = {
								limit = {
									scope:host = {
										OR = {
											coronation_host_east_asian_trigger = yes
											government_has_flag = government_is_clan
										}
									}
								}
								NOT = {
									is_spouse_of = scope:host
								}
							}
							trigger_if = {
								limit = {
									exists = scope:anointer
								}
								NOT = {
									this = scope:anointer
								}
							}
						}
						save_scope_as = observer
					}
				}
			}
			#Get vassal
			if = {
				limit = {
					NOT = {
						exists = scope:observer
					}
				}
				scope:activity = {
					ordered_attending_character = {
						order_by = "opinion(scope:host)" 
						limit = {
							is_vassal_of = scope:host
							trigger_if = {
								limit = {
									exists = scope:anointer
								}
								NOT = {
									this = scope:anointer
								}
							}
						}
						save_scope_as = observer
					}
				}
			}
			#Get your crown/regalia to equip it
			coronation_save_crowning_artifact_effect = { HOST = scope:host }
			if = {
				limit = {
					this = root
				}
				coronation_ceremony_opinion_effect = yes
				if = {
					limit = {
						exists = scope:crowning_artifact
						scope:crowning_artifact = {
							is_equipped = no
						}
						can_equip_artifact = scope:crowning_artifact
					}
					scope:crowning_artifact = { equip_artifact_to_owner = yes }
				}
				coronation_change_law_effect = yes
			}
			else = {
				show_as_tooltip = {
					coronation_ceremony_opinion_effect = yes
					if = {
						limit = {
							exists = scope:crowning_artifact
							can_equip_artifact = scope:crowning_artifact
							scope:crowning_artifact = { is_equipped = no }
						}
						scope:crowning_artifact = { equip_artifact_to_owner = yes }
					}
					coronation_change_law_effect = yes
				}
			}
		}
	}
	#Normal
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							NOT = { this = scope:host }
							OR = {
								has_activity_intent = coronation_disrupt_loyalists
								has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
								AND = {
									liege = scope:host
									is_a_faction_member = yes
								}
							}
						}
						desc = coronation_events.6102.a_guest_neg
					}
					triggered_desc = {
						trigger = {
							OR = {
								has_activity_intent = coronation_offer_support
								has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host }
								has_trait = trusting
							}
							NOT = {
								host = {
									has_trait = craven
								}
							}
							NOT = { this = scope:host }
							scope:activity.var:activity_special_type_progression >= 25
						}
						desc = coronation_events.6102.a_guest_pos
					}
					triggered_desc = {
						trigger = {
							NOT = { this = scope:host }
						}
						desc = coronation_events.6102.a_guest
					}
					triggered_desc = {
						trigger = {
							this = scope:host
							scope:host = {
								OR = {
									has_trait = humble
									has_trait = content
									has_trait = craven
								}
								NOR = {
									has_trait = arrogant
									has_trait = ambitious
								}
							}
						}
						desc = coronation_events.6101.a_oh_noes
					}
					triggered_desc = {
						trigger = {
							this = scope:host
							scope:activity.var:activity_special_type_progression < 25
							NOR = {
								has_trait = humble
								has_trait = content
								has_trait = calm
							}
						}
						desc = coronation_events.6102.a_host_neg
					}
					desc = coronation_events.6101.a
				}
			}
		}
		if = {
			limit = {
				this = scope:host
				scope:activity.var:activity_special_type_progression >= 25
			}
			stress_impact = {
				arrogant = massive_stress_impact_loss
				ambitious = medium_stress_impact_loss
				just = medium_stress_impact_loss
			}
		}
	}
	after = {
		# For MP
		coronation_ready_effect = yes

		#Spouse crowning event
		trigger_event = {
			id = coronation_events.6140
			days = 2
		}
		if = {
			limit = {
				scope:anointer = {
					has_variable = anointer_destroy_me
				}
			}
			scope:anointer = {
				silent_disappearance_effect = yes
			}
		}
	}
}

coronation_events.6103 = {
	hidden = yes
	immediate = {
		scope:host = {
			coronation_change_law_effect = yes
		}
	}
}

scripted_effect coronation_events_6110_artifact_reward_effect = {
	save_scope_as = chosen_artifact
	#A TIERED BONUS BASED ON THE RARITY OF THE ARTIFACT
	if = {
		limit = {
			rarity = illustrious
		}
		root = {
			add_legitimacy = medium_legitimacy_gain
			custom_tooltip = coronation_tt_positive_medium
			scope:activity = { activity_special_type_progression_medium = yes }
			coronation_add_magnificence_log_effect = {
				VALUE = flag:positive_medium
				CHAR = root
			}
		}
	}
	else_if = {
		limit = {
			rarity = famed
		}
		root = {
			add_legitimacy = minor_legitimacy_gain
			custom_tooltip = coronation_tt_positive_tiny
			scope:activity = { activity_special_type_progression_tiny = yes }
			coronation_add_magnificence_log_effect = {
				VALUE = flag:positive_tiny
				CHAR = root
			}
		}
	}
	else_if = {
		limit = {
			rarity = masterwork
		}
		root = {
			add_legitimacy = miniscule_legitimacy_gain
			custom_tooltip = coronation_tt_positive_miniscule
			scope:activity = { activity_special_type_progression_miniscule = yes }
			coronation_add_magnificence_log_effect = {
				VALUE = flag:positive_miniscule
				CHAR = root
			}
		}
	}
	#BONUS IF YOU HAVE EXALT THE CROWN INTENT
	if = {
		limit = {
			NOT = {
				has_variable = coronation_title_crown_bonus
			}
			root = {
				has_activity_intent = coronation_exalt_crown
			}
		}
		save_scope_as = artifact_target
		scope:blesser = {
			save_scope_as = antiquarian_from_task
		}
		root = {
			save_scope_as = liege
			hidden_effect = {
				scope:artifact_target = {
					antiquarian_improve_artifact_effect = yes
				}
			}
			custom_tooltip = coronation_artifact_improved
		}
		set_variable = {
			name = coronation_title_crown_bonus
		}
	}
	#Add desc line
	set_artifact_description = crowning_artifact_desc

	scope:activity = {
		add_activity_log_entry = {
			key = coronation_title_artifact_log
			character = scope:host
			score = 20
			show_in_conclusion = yes
		}
	}
	
}

#Coronation artifact needs to become artifact OF TITLE
coronation_events.6110 = {
	type = activity_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					government_has_flag = government_is_nomadic
				}
				desc = coronation_events.6110.t_nomad
			}
			desc = coronation_events.6110.t
		}
	}
	desc = {
		desc = coronation_events.6110.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						exists = scope:old_title_artifact
						exists = scope:crowning_artifact_2
					}
				}
				desc = coronation_events.6110.desc_crowns
			}
			triggered_desc = {
				trigger = {
					coronation_proper_artifact_regalia_trigger = no
				}
				desc = coronation_events.6110.desc_crown
			}
			desc = coronation_events.6110.desc_regalia
		}
		desc = coronation_events.6110.desc_2
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
				}
				desc = coronation_events.6110.desc_st_peter
			}
			desc = coronation_events.6110.desc_generic
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:old_title_artifact
				}
				desc = coronation_events.6110.desc_old_artifact
			}
			triggered_desc = {
				trigger = {
					exists = scope:crowning_artifact_2
				}
				desc = coronation_events.6110.desc_no_old_artifact_plural
			}
			desc = coronation_events.6110.desc_no_old_artifact
		}
	}
	left_portrait = {
		character = root
		animation = prayer
		camera = camera_event_very_left
	}
	center_portrait = {
		character = scope:observer
		triggered_animation = {
			trigger = {
				root = { coronation_proper_artifact_regalia_trigger = yes }
			}
			animation = throne_room_messenger_3
		}
		triggered_animation = {
			trigger = {
				root = { coronation_proper_artifact_regalia_trigger = no }
			}
			animation = crowning
		}
		camera = camera_event_right_pointing_left
		hide_info = yes
	}
	right_portrait = {
		character = scope:blesser
		triggered_animation = {
			trigger = {
				root = {
					OR = {
						government_has_flag = government_is_tribal
						government_has_flag = government_is_nomadic
					}
				}
			}
			animation = reception_groom_left
		}
		triggered_animation = {
			trigger = {
				root = {
					coronation_proper_artifact_regalia_trigger = yes
					government_has_flag = government_is_tribal
					government_has_flag = government_is_nomadic
				}
			}
			animation = reading
		}
		triggered_animation = {
			trigger = {
				root = { coronation_proper_artifact_regalia_trigger = no }
			}
			animation = toast_goblet
		}
		camera = camera_event_right_fully_away
	}
	artifact = {
	    target = scope:crowning_artifact
	    position = lower_left_portrait
	}
	artifact = {
	    target = scope:crowning_artifact_2
	    position = lower_center_portrait
	}
	artifact = {
	    target = scope:crowning_artifact_3
	    position = lower_right_portrait
	}
	override_background = {
		trigger = {
			scope:host.capital_county = title:c_byzantion
		}
		reference = ep3_hagia_sophia
	}
	override_background = {
		trigger = {
			NOT = {
				scope:host.capital_county = title:c_byzantion
			}
		}
		reference = temple
	}

	theme = coronation_activity
	cooldown = { days = 20 }

	trigger = {
		coronation_has_proper_artifact_trigger = yes
		this = scope:activity.activity_host
		scope:activity = {
			NOT = {
				has_variable = had_coronation_events_6110
			}
			activity_host = {
				save_temporary_scope_as = host_temp
				#Save whether it needs to be helmet or nah
				trigger_if = {	
					limit = {
						coronation_proper_artifact_crown_trigger = yes
						coronation_proper_artifact_regalia_trigger = no
					}
					save_temporary_scope_as = needs_crown_temp
				}
				trigger_if = {
					limit = {
						coronation_proper_artifact_regalia_trigger = yes
						coronation_proper_artifact_crown_trigger = no
					}
					save_temporary_scope_as = needs_regalia_temp
				}

				OR = {
					#Doesn't have a crown tied to title
					NOT = {
						any_character_artifact = {
							trigger_if = {
								limit = {
									exists = scope:needs_crown_temp
								}
								artifact_slot_type = helmet
							}
							trigger_else_if = {
								limit = {
									exists = scope:needs_regalia_temp
								}
								artifact_slot_type = regalia
							}
							trigger_else = {
								OR = {
									artifact_slot_type = regalia
									artifact_slot_type = helmet
								}
							}
							has_variable = artifact_succession_title
							var:artifact_succession_title ?= {
								this = root.primary_title
							}
						}
					}
					#Has crown tied to title... and a better crown
					AND = {
						any_character_artifact = {
							trigger_if = {
								limit = {
									exists = scope:needs_crown_temp
								}
								artifact_slot_type = helmet
							}
							trigger_else_if = {
								limit = {
									exists = scope:needs_regalia_temp
								}
								artifact_slot_type = regalia
							}
							trigger_else = {
								OR = {
									artifact_slot_type = regalia
									artifact_slot_type = helmet
								}
							}
							has_variable = artifact_succession_title
							var:artifact_succession_title ?= {
								this = root.primary_title
							}
							save_temporary_scope_as = artifact_temp
						}
						any_character_artifact = {
							trigger_if = {
								limit = {
									exists = scope:needs_crown_temp
								}
								artifact_slot_type = helmet
							}
							trigger_else_if = {
								limit = {
									exists = scope:needs_regalia_temp
								}
								artifact_slot_type = regalia
							}
							trigger_else = {
								OR = {
									artifact_slot_type = regalia
									artifact_slot_type = helmet
								}
							}
							NOT = {
								has_variable = artifact_succession_title
								var:artifact_succession_title ?= {
									this = root.primary_title
								}
							}
							#Checking rarity is higher than title crown
							OR = {
								AND = {
									rarity = illustrious
									scope:artifact_temp = {
										NOT = {
											rarity = illustrious
										}
									}
								}
								AND = {
									rarity = famed
									scope:artifact_temp = {
										NOR = {
											rarity = illustrious
											rarity = famed
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	on_trigger_fail = {
		#Anointment event
		trigger_event = {
			id = coronation_events.6130
			days = 3
		}
	}
	immediate = {
		# For MP
		coronation_busy_effect = yes

		save_scope_value_as = {
			name = year
			value = current_year
		}
		scope:activity = {
			set_variable = {
				name = had_coronation_events_6110
			}
			activity_host = {
				save_scope_as = host
			}
		}
		#Save whether it needs to be helmet or nah
		if = {	
			limit = {
				scope:host = {
					coronation_proper_artifact_crown_trigger = yes
					coronation_proper_artifact_regalia_trigger = no
				}
			}
			save_scope_as = needs_crown
		}
		if = {
			limit = {
				scope:host = {
					coronation_proper_artifact_regalia_trigger = yes
					coronation_proper_artifact_crown_trigger = no
				}
			}
			save_scope_as = needs_regalia
		}
		#Save your title's regalia if it exists
		ordered_character_artifact = {
			order_by = artifact_rarity
			limit = {
				trigger_if = {	
					limit = {
						exists = scope:needs_crown
					}
					artifact_slot_type = helmet
				}
				trigger_else_if = {
					limit = {
						exists = scope:needs_regalia
					}
					artifact_slot_type = regalia
				}
				trigger_else = {
					OR = {
						artifact_slot_type = helmet
						artifact_slot_type = regalia
					}
				}
				
				has_variable = artifact_succession_title
				var:artifact_succession_title ?= root.primary_title
			}
			save_scope_as = old_title_artifact
		}

		#Save up to 5 crowns/regalia that aren't your title's crown/regalia
		ordered_character_artifact = {
			order_by = artifact_rarity
			limit = {
				trigger_if = {	
					limit = {
						exists = scope:needs_crown
					}
					artifact_slot_type = helmet
				}
				trigger_else_if = {
					limit = {
						exists = scope:needs_regalia
					}
					artifact_slot_type = regalia
				}
				trigger_else = {
					OR = {
						artifact_slot_type = helmet
						artifact_slot_type = regalia
					}
				}
				trigger_if = {
					limit = {
						has_variable = artifact_succession_title
					}
					NOT = {
						var:artifact_succession_title = root.primary_title
					}
				}
			}
			save_scope_as = crowning_artifact
		}
		if = {
			limit = {
				exists = scope:crowning_artifact
			}
			#Try to save second
			ordered_character_artifact = {
				order_by = artifact_rarity
				limit = {
					trigger_if = {	
						limit = {
							exists = scope:needs_crown
						}
						artifact_slot_type = helmet
					}
					trigger_else_if = {
						limit = {
							exists = scope:needs_regalia
						}
						artifact_slot_type = regalia
					}
					trigger_else = {
						OR = {
							artifact_slot_type = helmet
							artifact_slot_type = regalia
						}
					}
					NOT = {
						this = scope:crowning_artifact
					}
					trigger_if = {
						limit = {
							has_variable = artifact_succession_title
						}
						NOT = {
							var:artifact_succession_title = root.primary_title
						}
					}
				}
				save_scope_as = crowning_artifact_2
			}
		}
		if = {
			limit = {
				exists = scope:crowning_artifact_2
			}
			#try to save 3rd
			ordered_character_artifact = {
				order_by = artifact_rarity
				limit = {
					trigger_if = {	
						limit = {
							exists = scope:needs_crown
						}
						artifact_slot_type = helmet
					}
					trigger_else_if = {
						limit = {
							exists = scope:needs_regalia
						}
						artifact_slot_type = regalia
					}
					trigger_else = {
						OR = {
							artifact_slot_type = helmet
							artifact_slot_type = regalia
						}
					}
					NOR = {
						this = scope:crowning_artifact
						this = scope:crowning_artifact_2
					}
					trigger_if = {
						limit = {
							has_variable = artifact_succession_title
						}
						NOT = {
							var:artifact_succession_title = root.primary_title
						}
					}
				}
				save_scope_as = crowning_artifact_3
			}
		}
		if = {
			limit = {
				exists = scope:crowning_artifact_3
			}
			#Try to save 4th
			ordered_character_artifact = {
				order_by = artifact_rarity
				limit = {
					trigger_if = {	
						limit = {
							exists = scope:needs_crown
						}
						artifact_slot_type = helmet
					}
					trigger_else_if = {
						limit = {
							exists = scope:needs_regalia
						}
						artifact_slot_type = regalia
					}
					trigger_else = {
						OR = {
							artifact_slot_type = helmet
							artifact_slot_type = regalia
						}
					}
					NOR = {
						this = scope:crowning_artifact
						this = scope:crowning_artifact_2
						this = scope:crowning_artifact_3
					}
					trigger_if = {
						limit = {
							has_variable = artifact_succession_title
						}
						NOT = {
							var:artifact_succession_title = root.primary_title
						}
					}
				}
				save_scope_as = crowning_artifact_4
			}
		}

		if = {
			limit = {
				exists = scope:crowning_artifact_4
			}
			#Try to save 5th
			ordered_character_artifact = {
				order_by = artifact_rarity
				limit = {
					trigger_if = {	
						limit = {
							exists = scope:needs_crown
						}
						artifact_slot_type = helmet
					}
					trigger_else_if = {
						limit = {
							exists = scope:needs_regalia
						}
						artifact_slot_type = regalia
					}
					trigger_else = {
						OR = {
							artifact_slot_type = helmet
							artifact_slot_type = regalia
						}
					}
					NOR = {
						this = scope:crowning_artifact
						this = scope:crowning_artifact_2
						this = scope:crowning_artifact_3
						this = scope:crowning_artifact_4
					}
					trigger_if = {
						limit = {
							has_variable = artifact_succession_title
						}
						NOT = {
							var:artifact_succession_title = root.primary_title
						}
					}
				}
				save_scope_as = crowning_artifact_5
			}
		}

		#Save priest
		if = {
			limit = {
				exists = involved_activity.var:officiator
				involved_activity.var:officiator = {
					is_alive = yes
					is_imprisoned = no
				}
			}
			#Save characters for the scene
			involved_activity.var:officiator = {
				save_scope_as = blesser
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:blesser
				}
				cp:councillor_court_chaplain ?= {
					is_alive = yes
					is_imprisoned = no
					is_incapable = no
					has_contagious_deadly_disease_trigger = no
				}
			}
			#SAVE COURT CHAPLAIN
			cp:councillor_court_chaplain = {
				save_scope_as = blesser
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:blesser
				}
			}
			create_character = {
				template = priest_character_template
				location = root.location
				culture = root.location.culture
				faith = root.faith
				save_scope_as = blesser
			}
			scope:blesser = {
				add_character_flag = blesser_destroy_me
			}
		}

		#Save another priest
		if = {
			limit = {
				cp:councillor_court_chaplain ?= {
					NOT = {
						this = scope:blesser
					}
					is_alive = yes
					is_imprisoned = no
					is_incapable = no
					has_contagious_deadly_disease_trigger = no
				}
			}
			cp:councillor_court_chaplain = {
				save_scope_as = observer
			}
		}
		else = {
			create_character = {
				template = priest_character_template
				location = root.location
				culture = root.location.culture
				faith = root.faith
				save_scope_as = observer
			}
			scope:observer = {
				add_character_flag = blesser_destroy_me
			}
		}
	}

	#Artifact 1
	option = {
		name = coronation_events.6110.a
		custom_tooltip = coronation_titling_artifact_tt
		if = {
			limit = {
				exists = player_heir
				NOT = {
					primary_heir ?= player_heir
				}
			}
			custom_tooltip = coronation_titling_artifact_will_be_lost_tt
		}
		scope:crowning_artifact = {
			set_variable = {
				name = artifact_succession_title
				value = root.primary_title
			}
			coronation_events_6110_artifact_reward_effect = yes
		}
		if = {
			limit = {
				has_activity_intent = coronation_exalt_crown
			}
			custom_tooltip = improved_because_intent_tt
		}
		if = {
			limit = {
				scope:crowning_artifact = {
					OR = {
						rarity = famed
						rarity = illustrious
					}
				}
			}
			stress_impact = {
				greedy = minor_stress_impact_gain
			}
		}
	}
	#Artifact 2
	option = {
		trigger = {
			exists = scope:crowning_artifact_2
		}
		name = coronation_events.6110.b
		custom_tooltip = coronation_titling_artifact_2_tt
		if = {
			limit = {
				exists = player_heir
				NOT = {
					primary_heir ?= player_heir
				}
			}
			custom_tooltip = coronation_titling_artifact_will_be_lost_2_tt
		}
		scope:crowning_artifact_2 = {
			set_variable = {
				name = artifact_succession_title
				value = root.primary_title
			}
			coronation_events_6110_artifact_reward_effect = yes
		}
		if = {
			limit = {
				has_activity_intent = coronation_exalt_crown
			}
			custom_tooltip = improved_because_intent_tt
		}
		if = {
			limit = {
				scope:crowning_artifact_2 = {
					OR = {
						rarity = famed
						rarity = illustrious
					}
				}
			}
			stress_impact = {
				greedy = minor_stress_impact_gain
			}
		}
	}
	#Artifact 3
	option = {
		trigger = {
			exists = scope:crowning_artifact_3
		}
		name = coronation_events.6110.c
		custom_tooltip = coronation_titling_artifact_3_tt
		if = {
			limit = {
				exists = player_heir
				NOT = {
					primary_heir ?= player_heir
				}
			}
			custom_tooltip = coronation_titling_artifact_will_be_lost_3_tt
		}
		scope:crowning_artifact_3 = {
			set_variable = {
				name = artifact_succession_title
				value = root.primary_title
			}
			coronation_events_6110_artifact_reward_effect = yes
		}
		if = {
			limit = {
				has_activity_intent = coronation_exalt_crown
			}
			custom_tooltip = improved_because_intent_tt
		}
		if = {
			limit = {
				scope:crowning_artifact_3 = {
					OR = {
						rarity = famed
						rarity = illustrious
					}
				}
			}
			stress_impact = {
				greedy = minor_stress_impact_gain
			}
		}
	}
	#Artifact 4
	option = {
		trigger = {
			exists = scope:crowning_artifact_4
		}
		name = coronation_events.6110.d
		custom_tooltip = coronation_titling_artifact_4_tt
		if = {
			limit = {
				exists = player_heir
				NOT = {
					primary_heir ?= player_heir
				}
			}
			custom_tooltip = coronation_titling_artifact_will_be_lost_4_tt
		}
		scope:crowning_artifact_4 = {
			set_variable = {
				name = artifact_succession_title
				value = root.primary_title
			}
			coronation_events_6110_artifact_reward_effect = yes
		}
		if = {
			limit = {
				has_activity_intent = coronation_exalt_crown
			}
			custom_tooltip = improved_because_intent_tt
		}
		if = {
			limit = {
				scope:crowning_artifact_4 = {
					OR = {
						rarity = famed
						rarity = illustrious
					}
				}
			}
			stress_impact = {
				greedy = minor_stress_impact_gain
			}
		}
	}
	#Artifact 5
	option = {
		trigger = {
			exists = scope:crowning_artifact_5
		}
		name = coronation_events.6110.e
		custom_tooltip = coronation_titling_artifact_5_tt
		if = {
			limit = {
				exists = player_heir
				NOT = {
					primary_heir ?= player_heir
				}
			}
			custom_tooltip = coronation_titling_artifact_will_be_lost_5_tt
		}
		scope:crowning_artifact_5 = {
			set_variable = {
				name = artifact_succession_title
				value = root.primary_title
			}
			coronation_events_6110_artifact_reward_effect = yes
		}
		if = {
			limit = {
				has_activity_intent = coronation_exalt_crown
			}
			custom_tooltip = improved_because_intent_tt
		}
		if = {
			limit = {
				scope:crowning_artifact_5 = {
					OR = {
						rarity = famed
						rarity = illustrious
					}
				}
			}
			stress_impact = {
				greedy = minor_stress_impact_gain
			}
		}
	}
	#Title??? This is my family/other title's artifact, and always will be!
	option = {
		name = {
			trigger = {
				NOT = { exists = scope:old_title_artifact }
				exists = scope:crowning_artifact_2
			}
			text = coronation_events.6110.f_plural
		}
		name = {
			trigger = {
				NOT = { exists = scope:old_title_artifact }
			}
			text = coronation_events.6110.f
		}

		name = {
			trigger = {
				exists = scope:old_title_artifact
			}
			text = coronation_events.6110.f_replacing
		}
		
		custom_tooltip = coronation_artifact_unaltered_succession_tt
		if = {
			limit = {
				NOT = { exists = scope:old_title_artifact }
			}
			add_legitimacy = minor_legitimacy_loss
			custom_tooltip = coronation_tt_negative
			scope:activity = { activity_special_type_progression_negative = yes }
			coronation_add_magnificence_log_effect = {
				VALUE = flag:negative
				CHAR = root
			}
		}
		else = {
			custom_tooltip = old_title_artifact_remains_tt
			custom_tooltip = coronation_tt_negative_tiny
			scope:activity = { activity_special_type_progression_negative_tiny = yes }
			coronation_add_magnificence_log_effect = {
				VALUE = flag:negative_tiny
				CHAR = root
			}
		}

		stress_impact = {
			greedy = minor_stress_impact_loss
		}
		ai_chance = {
			base = 0
			modifier = {
				has_trait = greedy
				add = 1
			}
		}
	}
	after = {
		# For MP
		coronation_ready_effect = yes

		if = {
			limit = {
				is_ai = yes
				scope:blesser = {
					has_character_flag = blesser_destroy_me
				}
			}
			scope:blesser = {
				silent_disappearance_effect = yes
			}
		}
		if = {
			limit = {
				is_ai = yes
				scope:observer = {
					has_character_flag = blesser_destroy_me
				}
			}
			scope:observer = {
				silent_disappearance_effect = yes
			}
		}
		#Anointment event
		trigger_event = {
			id = coronation_events.6130
			days = 3
		}
	}
}

#Calling for the approval of the CLERGY
coronation_events.6120 = {
	type = activity_event
	title = coronation_events.6120.t
	desc = {
		#Triggered based on where you're going for rites
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = { 
						faith.religion = religion:eastern_orthodox_religion 
						faith.religion = religion:catholic_religion 
						faith.religion = religion:protestant_religion 
					}
					OR = {
						location.barony = title:b_constantinople
						AND = {
							location.barony = title:b_vaticano
							faith = faith:catholic
							scope:host.faith = faith:catholic
						}
						AND = {
							current_year >= 950
							location.barony = title:b_london
						}
						location.barony = title:b_reims
						location = {
							has_holding_type = church_holding
						}
					}
				}
				desc = coronation_events.6120.desc_cathedral
			}
			triggered_desc = {
				trigger = {
					exists = scope:activity.special_guest:priest
				}
				desc = coronation_events.6120.desc_holy_site
			}
			desc = coronation_events.6120.desc_generic_intro
		}
		#Triggered based on magnificence
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:activity.var:activity_special_type_progression < 25
				}
				desc = coronation_events.6120.desc_low_magnificence
			}
			triggered_desc = {
				trigger = {
					scope:activity.var:activity_special_type_progression >= 75
				}
				desc = coronation_events.6120.desc_high_magnificence
			}
			desc = coronation_events.6120.desc_generic_mid
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = coronation_type_anointment
						}
					}
				}
				desc = coronation_events.6120.desc_anointment
			}
			desc = coronation_events.6120.desc
		}
		#Clergy deliver their petition
		first_valid = {
			triggered_desc = {
				trigger = {
					coronation_clergy_approval_value < -1
				}
				desc = coronation_events.6120.desc_low_clergy
			}
			triggered_desc = {
				trigger = {
					coronation_clergy_approval_value >= 1
				}
				desc = coronation_events.6120.desc_high_clergy
			}
			desc = coronation_events.6120.desc_mid_clergy
		}
	}
	left_portrait = {
		character = scope:oather_1
		#Priests
		triggered_animation = {
			trigger = {
				root = { coronation_clergy_approval_value < -1 }
			}
			animation = personality_cynical
		}
		triggered_animation = {
			trigger = {
				root = { coronation_clergy_approval_value >= 1 }
			}
			animation = prayer
		}
		animation = personality_honorable
		camera = camera_event_very_left
	}
	center_portrait = {
		character = scope:host
		animation = wedding_priest
	}
	right_portrait = {
		character = scope:oather_2
		#Priests
		triggered_animation = {
			trigger = {
				root = { coronation_clergy_approval_value < -1 }
			}
			animation = eyeroll
		}
		triggered_animation = {
			trigger = {
				root = { coronation_clergy_approval_value >= 1 }
			}
			animation = admiration
		}
		animation = chaplain
		camera = camera_event_very_right
	}
	override_background = {
		reference = temple
	}
	override_effect_2d = {
		trigger = {
			scope:activity.var:activity_special_type_progression < 25
		}
		reference = flies	
	}

	theme = coronation_activity
	cooldown = { days = 20 }
	trigger = {
		this = involved_activity.activity_host
	}
	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity = {
			activity_host = { save_scope_as = host }
			activity_location = { save_scope_as = location }
		}
		if = {
			limit = {
				exists = faith.religious_head
			}
			faith = {
				religious_head = { save_scope_as = hof }
			}
		}
		
		#Save holy men
		if = {
			limit = {
				coronation_living_officiator_trigger = yes
			}
			scope:activity.var:officiator = {
				save_scope_as = oather_1
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:oather_1
				}
				cp:councillor_court_chaplain ?= {
					is_alive = yes
					is_imprisoned = no
					is_incapable = no
					has_contagious_deadly_disease_trigger = no
				}
			}
			#SAVE COURT CHAPLAIN
			cp:councillor_court_chaplain = {
				save_scope_as = oather_1
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:oather_1
				}
			}
			scope:activity = {
				ordered_attending_character = {
					order_by = max_military_strength
					limit = {
						government_has_flag = government_is_theocracy
					}
					save_scope_as = oather_1
				}
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:oather_1
				}
			}
			create_character = {
				template = priest_character_template
				location = scope:host.location
				culture = scope:host.location.culture
				faith = scope:host.faith
				save_scope_as = oather_1
			}
			scope:oather_1 = {
				add_character_flag = oather_1_destroy
			}
		}
		#Save second one
		if = {
			limit = {
				cp:councillor_court_chaplain ?= {
					NOT = {
						this = scope:oather_1
					}
					is_alive = yes
					is_imprisoned = no
					is_incapable = no
					has_contagious_deadly_disease_trigger = no
				}
			}
			#SAVE COURT CHAPLAIN
			cp:councillor_court_chaplain = {
				save_scope_as = oather_2
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:oather_2
				}
			}
			scope:activity = {
				ordered_attending_character = {
					order_by = max_military_strength
					limit = {
						government_has_flag = government_is_theocracy
						NOT = {
							this = scope:oather_1
						}
					}
					save_scope_as = oather_2
				}
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:oather_2
				}
			}
			create_character = {
				template = priest_character_template
				location = scope:host.location
				culture = scope:host.location.culture
				faith = scope:host.faith
				save_scope_as = oather_2
			}
			scope:oather_2 = {
				add_character_flag = oather_2_destroy
			}
		}
		coronation_ceremony_piety_effect = yes
	}
	#Unlocked I SWEAR REAL HARD TO GET THE HERETICS
	option = {
		trigger = {
			has_activity_intent = coronation_embrace_supporters
			OR = {
				faith = {
					NOT = {
						has_doctrine = doctrine_pluralism_pluralistic
					}
				}
				OR = {
					has_trait = paranoid
					has_trait = wrathful
					has_trait = vengeful
					has_trait = zealous
				}

			}
		}
		name = coronation_events.6120.a
		flavor = coronation_events.6120.a.flavor
		scope:activity = {
			add_activity_log_entry = {
				key = coronation_swore_heretic_persecute
				character = scope:host
				root = {
					add_character_modifier = {
						modifier = coronation_swore_persecution_modifier
						years = 20
					}
					if = {
						limit = {
							OR = {
								has_trait = paranoid
								has_trait = wrathful
								has_trait = vengeful
								has_trait = zealous
							}
							NOT = {
								has_trait = holy_warrior
							}
							martial > average_skill_rating
						}
						add_trait = holy_warrior
					}
				}
				
			}
		}
		stress_impact = {
			zealous = minor_stress_impact_loss
			forgiving = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
			cynical = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 2
			}

			modifier = {
				OR = {
					has_trait = paranoid
					has_trait = wrathful
					has_trait = vengeful
					has_trait = zealous
				}
				NOT = {
					has_trait = holy_warrior
				}
				martial > average_skill_rating
				add = 25
			}
			modifier = {
				NOT = {
					has_focus_martial = yes
				}
				add = -50
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = forgiving
					has_trait = cynical
				}
			}
		}
	}
	#I will affirm in a way that places my authority above the church's
	option = {
		trigger = {
			learning >= decent_skill_rating
			trigger_if = {
				limit = { has_trait = deceitful }
				has_trait = deceitful
			}
			trigger_else_if = {
				limit = { has_trait = cynical }
				has_trait = cynical
			}
			trigger_else_if = {
				limit = { has_trait = arbitrary }
				has_trait = arbitrary
			}
			trigger_else_if = {
				limit = { has_trait = fickle }
				has_trait = fickle
			}
			trigger_else_if = {
				limit = { has_trait = paranoid }
				has_trait = paranoid
			}
			trigger_else_if = {
				limit = { has_trait = arrogant }
				has_trait = arrogant
			}
			trigger_else_if = {
				limit = { has_trait = ambitious }
				has_trait = ambitious
			}
			trigger_else = {
				has_trait = greedy
			}
		}
		name = coronation_events.6120.b
		flavor = coronation_events.6120.b.flavor
		scope:activity = {
			add_activity_log_entry = {
				key = coronation_exploiting_church_log
				character = scope:host
				root = {
					add_character_modifier = {
						modifier = coronation_denying_clergy_modifier
						years = 20
					}
					add_piety = medium_piety_loss
				}
			}
		}

		stress_impact = {
			cynical = minor_stress_impact_loss
			greedy = minor_stress_impact_loss
			fickle = minor_stress_impact_loss
			arbitrary = minor_stress_impact_loss
			zealous = medium_stress_impact_gain
			generous = minor_stress_impact_gain
			just = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 2
			}

			modifier = {
				OR = {
					has_trait = paranoid
					has_trait = wrathful
					has_trait = vengeful
					has_trait = zealous
				}
				NOT = {
					has_trait = holy_warrior
				}
				martial > average_skill_rating
				add = 25
			}
			modifier = {
				NOT = {
					has_focus_martial = yes
				}
				add = -50
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = zealous
					has_trait = generous
					has_trait = just
				}
			}
		}
	}
	#Priests approve/disapprove
	option = {
		name = {
			trigger = {
				NOR = {
					ai_honor >= high_positive_ai_value
					ai_zeal >= medium_positive_ai_value
				}
				OR = {
					coronation_clergy_approval_value < -1
					has_trait = cynical
					has_trait = arbitrary
					has_trait = fickle
				}
			}
			text = coronation_events.6120.c_begrudging
		}
		name = {
			trigger = {
				OR = { 
						faith.religion = religion:eastern_orthodox_religion 
						faith.religion = religion:catholic_religion 
						faith.religion = religion:protestant_religion 
					}
				NOT = {
					NOR = {
						ai_honor >= high_positive_ai_value
						ai_zeal >= medium_positive_ai_value
					}
					OR = {
						coronation_clergy_approval_value < -1
						has_trait = cynical
						has_trait = arbitrary
						has_trait = fickle
					}
				}
			}
			text = coronation_events.6120.c_christian
		}
		name = {
			trigger = {
				NOT = { OR = { 
						faith.religion = religion:eastern_orthodox_religion 
						faith.religion = religion:catholic_religion 
						faith.religion = religion:protestant_religion 
					} }
				NOT = {
					NOR = {
						ai_honor >= high_positive_ai_value
						ai_zeal >= medium_positive_ai_value
					}
					OR = {
						coronation_clergy_approval_value < -1
						has_trait = cynical
						has_trait = arbitrary
						has_trait = fickle
					}
				}
				
			}
			text = coronation_events.6120.c
		}
		ai_chance = {
			base = 100
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
		if = {
			limit = {
				scope:oather_1 = {
					has_character_flag = oather_1_destroy
				}
			}
			scope:oather_1 = {
				silent_disappearance_effect = yes
			}
		}
		if = {
			limit = {
				scope:oather_2 = {
					has_character_flag = oather_2_destroy
				}
			}
			scope:oather_2 = {
				silent_disappearance_effect = yes
			}
		}
		#Approval of the nobles
		trigger_event = {
			id = coronation_events.6121
			days = 3
		}
	}
}

scripted_trigger coronation_events_6121_detractor_ally_trigger = {
	current_military_strength >= 300
	is_ai = yes
	highest_held_title_tier >= tier_county
	NOR = {
		is_vassal_or_below_of = root
		is_allied_to = root
		is_tributary_of_suzerain_or_above = root
		has_relation_blood_brother = prev
		government_has_flag = government_is_herder
		any_war_ally = {
			this = prev
		}
	}
}
scripted_trigger coronation_events_6121_minority_trigger = {
	is_participant_in_activity = scope:activity
	has_vassal_stance = minority
	NOR = {
		is_at_war_with = root
		government_has_flag = government_is_theocracy
		government_has_flag = government_is_herder
	}
	culture = {
		NOT = { this = root.culture }
		cultural_acceptance = {
			target = root.culture
			value <= 80
		}
	}
}
#Calling for the approval of the NOBILITY
coronation_events.6121 = {
	type = activity_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					culture = {
						OR = {
							has_cultural_pillar = heritage_mongolic
							has_cultural_pillar = heritage_turkic
							has_cultural_pillar = heritage_magyar
						}
					}
					OR = {
						government_has_flag = government_is_nomadic
						has_trait = nomadic_philosophy
						primary_title = title:e_mongol_empire
					}
				}
				desc = coronation_events.6121.t_kurultai
			}
			desc = coronation_events.6121.t
		}
	}
	desc = {
		#Regional flavor
		first_valid = {
			triggered_desc = {
				trigger = {
					culture = {
						OR = {
							has_cultural_pillar = heritage_mongolic
							has_cultural_pillar = heritage_turkic
							has_cultural_pillar = heritage_magyar
						}
					}
					OR = {
						government_has_flag = government_is_nomadic
						has_trait = nomadic_philosophy
						primary_title = title:e_mongol_empire
					}
				}
				desc = coronation_events.6121.desc_kurultai
			}
			triggered_desc = {
				trigger = {
					OR = {
						is_roman_emperor_primary_title_trigger = yes
						culture = {
							has_cultural_tradition = tradition_ep3_roman_ceremonies
						}
						culture = {
							has_cultural_tradition = tradition_roman_legacy
						}
					}
				}
				desc = coronation_events.6121.desc_byzantine
			}
			desc = coronation_events.6121.desc_generic_intro
		}
		#Are the nobles compliant?
		first_valid = {
			triggered_desc = {
				trigger = {
					coronation_vassals_approval_value < -1
				}
				desc = coronation_events.6121.desc_low_approval
			}
			triggered_desc = {
				trigger = {
					coronation_vassals_approval_value >= 1
				}
				desc = coronation_events.6121.desc_high_approval
			}
			desc = coronation_events.6121.desc_mid_approval
		}
	}
	left_portrait = {
		character = scope:vassal_1
		#Nobles
		triggered_animation = {
			trigger = {
				root = { coronation_vassals_approval_value < -1 }
			}
			animation = anger
		}
		triggered_animation = {
			trigger = {
				root = { coronation_vassals_approval_value >= 1 }
			}
			animation = throne_room_bow_3
		}
		animation = throne_room_bow_2
		camera = camera_event_very_left
	}
	center_portrait = {
		character = scope:host
		triggered_animation = {
			trigger = {
				root = { coronation_vassals_approval_value < -1 }
			}
			animation = worry
		}
		animation = wedding_groom_right
	}
	right_portrait = {
		character = scope:vassal_2
		#Nobles
		triggered_animation = {
			trigger = {
				root = { coronation_vassals_approval_value < -1 }
			}
			animation = hunting_knife_start
		}
		triggered_animation = {
			trigger = {
				root = { coronation_vassals_approval_value >= 1 }
			}
			animation = celebrate_sword
		}
		animation = wedding_objection_start
		camera = camera_event_very_right
	}
	lower_left_portrait = scope:detractor_ally_1
	lower_center_portrait = scope:detractor_ally_2
	override_background = {
		reference = temple
	}
	override_effect_2d = {
		trigger = {
			scope:activity.var:activity_special_type_progression < 25
		}
		reference = flies	
	}

	theme = coronation_activity
	cooldown = { days = 20 }

	trigger = {
		this = involved_activity.activity_host
		scope:activity = {
			any_attending_character = {
				count >= 2
				is_vassal_of = root
				NOR = {
					is_at_war_with = root
					government_has_flag = government_is_theocracy
					government_has_flag = government_is_herder
				}
			}
		}
	}
	on_trigger_fail = {
		#Skip to Approval of the people if you have too few vassals attending
		trigger_event = {
			id = coronation_events.6122
			days = 3
		}
	}
	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity = {
			activity_host = { save_scope_as = host }
			activity_location = { save_scope_as = location }
		}
		#Host is liked, choose supporters
		if = {
			limit = {
				coronation_vassals_approval_value >= -1
			}
			scope:activity = {
				ordered_guest_subset = {
					name = supporter
					order_by = max_military_strength
					limit = {
						is_vassal_of = root
						NOR = {
							is_at_war_with = root
							government_has_flag = government_is_theocracy
							government_has_flag = government_is_herder
						}
					}
					save_scope_as = vassal_1
				}
			}
			scope:activity = {
				ordered_guest_subset = {
					name = supporter
					order_by = max_military_strength
					limit = {
						is_vassal_of = root
						NAND = {
							exists = scope:vassal_1
							this = scope:vassal_1
						}
						NOR = {
							is_at_war_with = root
							government_has_flag = government_is_theocracy
							government_has_flag = government_is_herder
						}
					}
					save_scope_as = vassal_2
				}
			}
		}
		#Host is disliked, choose detractors
		else = {
			scope:activity = {
				ordered_guest_subset = {
					name = detractor
					order_by = max_military_strength
					limit = {
						is_vassal_of = root
						NOR = {
							is_at_war_with = root
							government_has_flag = government_is_theocracy
							government_has_flag = government_is_herder
						}
					}
					save_scope_as = vassal_1
				}
			}
			scope:activity = {
				ordered_guest_subset = {
					name = detractor
					order_by = max_military_strength
					limit = {
						is_vassal_of = root
						NAND = {
							exists = scope:vassal_1
							this = scope:vassal_1
						}
						NOR = {
							is_at_war_with = root
							government_has_flag = government_is_theocracy
							government_has_flag = government_is_herder
						}
					}
					save_scope_as = vassal_2
				}
			}
		}
		#Random vassal fallbacks
		if = {
			limit = {
				NOT = {
					exists = scope:vassal_1
				}
			}
			scope:activity = {
				ordered_attending_character = {
					order_by = max_military_strength
					limit = {
						is_vassal_of = root
						NOR = {
							is_at_war_with = root
							government_has_flag = government_is_theocracy
							government_has_flag = government_is_herder
						}
					}
					save_scope_as = vassal_1
				}
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:vassal_2
				}
			}
			scope:activity = {
				ordered_attending_character = {
					order_by = max_military_strength
					limit = {
						is_vassal_of = root
						NOT = {
							this = scope:vassal_1
						}
						NOR = {
							is_at_war_with = root
							government_has_flag = government_is_theocracy
							government_has_flag = government_is_herder
						}
					}
					save_scope_as = vassal_2
				}
			}
		}
		#Save detractors with foreign allies and foreign allies, if possible
		if = {
			limit = {
				coronation_vassals_approval_value < -1
				has_activity_intent = coronation_weaken_detractors
				intrigue >= high_skill_rating
				scope:activity = {
					any_guest_subset = {
						name = detractor
						NOR = {
							is_at_war_with = root
							government_has_flag = government_is_theocracy
							government_has_flag = government_is_herder
						}
						is_ai = yes
						is_vassal_of = root
						any_ally = {
							coronation_events_6121_detractor_ally_trigger = yes
						}
					}
				}
			}
			scope:activity = {
				every_guest_subset = {
					name = detractor
					limit = {
						NOR = {
							is_at_war_with = root
							government_has_flag = government_is_theocracy
							government_has_flag = government_is_herder
						}
						is_ai = yes
						is_vassal_of = root
						any_ally = {
							coronation_events_6121_detractor_ally_trigger = yes
						}
					}
					ordered_ally = {
						order_by = current_military_strength
						limit = {
							coronation_events_6121_detractor_ally_trigger = yes
						}
						add_to_list = detractor_allies
					}
				}
				ordered_in_list = {
					list = detractor_allies
					order_by = current_military_strength
					save_scope_as = detractor_ally_1
				}
				ordered_in_list = {
					list = detractor_allies
					order_by = current_military_strength 
					limit = {
						NOT = {
							this = scope:detractor_ally_1
						}
					}
					
					save_scope_as = detractor_ally_2
				}
				#Overwrite vassals we already saved, these are more relevant
				scope:detractor_ally_1 = {
					ordered_ally = {
						order_by = current_military_strength
						limit = {
							is_ai = yes
							is_vassal_of = root
							is_in_guest_subset = { name = detractor }
							NOR = {
								is_at_war_with = root
								government_has_flag = government_is_theocracy
								government_has_flag = government_is_herder
							}
						}
						save_scope_as = vassal_1
					}
				}

				scope:detractor_ally_2 = {
					ordered_ally = {
						order_by = current_military_strength
						limit = {
							is_ai = yes
							is_vassal_of = root
							is_in_guest_subset = { name = detractor }
							NOR = {
								is_at_war_with = root
								government_has_flag = government_is_theocracy
								government_has_flag = government_is_herder
							}
							NOT = {
								this = scope:vassal_1
							}
						}
						save_scope_as = vassal_2
					}
				}
			}
		}
		#Overwrite with minority vassals if that option is available
		if = {
			limit = {
				has_activity_intent = coronation_impress_attendees
				diplomacy >= decent_skill_rating
				any_vassal = {
					count >= 2
					coronation_events_6121_minority_trigger = yes
				}
			}
			ordered_vassal = {
				order_by = max_military_strength
				limit = {
					coronation_events_6121_minority_trigger = yes
					opinion = {
						target = root
						value >= -20
					}
				}
				alternative_limit = {
					coronation_events_6121_minority_trigger = yes
					opinion = {
						target = root
						value >= -60
					}
				}
				alternative_limit = {
					coronation_events_6121_minority_trigger = yes
				}
				save_scope_as = vassal_1
			}
			ordered_vassal = {
				order_by = max_military_strength
				limit = {
					coronation_events_6121_minority_trigger = yes
					NOT = {
						this = scope:vassal_1
					}
					opinion = {
						target = root
						value >= -20
					}
				}
				alternative_limit = {
					coronation_events_6121_minority_trigger = yes
					opinion = {
						target = root
						value >= -60
					}
					NOT = {
						this = scope:vassal_1
					}
				}
				alternative_limit = {
					coronation_events_6121_minority_trigger = yes
					NOT = {
						this = scope:vassal_1
					}
				}
				save_scope_as = vassal_2
			}
		}
		coronation_ceremony_prestige_effect = yes
	}
	#THESE VASSALS THAT DON'T LIKE ME ARE FOREIGN PUPPETS
	option = {
		trigger = {
			has_activity_intent = coronation_weaken_detractors
			intrigue >= high_skill_rating
			exists = scope:detractor_ally_1
		}
		name = coronation_events.6121.a
		flavor = coronation_events.6121.a.flavor
		scope:activity = {
			add_activity_log_entry = {
				key = coronation_foreign_enemies_log
				score = 50
				character = scope:vassal_1
				target = scope:vassal_2
				#Break alliance between vassal and foreign ruler
				scope:vassal_1 = {
					break_alliance = scope:detractor_ally_1
					if = {
						limit = {
							NOT = {
								has_relation_rival = root
							}
						}
						set_relation_rival = {
							target = root
							reason = rival_accused_of_foreign_collusion
						}
					}
					else = {
						set_relation_nemesis = {
							target = root
							reason = rival_accused_of_foreign_collusion
						}
					}
					coronation_move_towards_detractor_effect = { CHARACTER = scope:vassal_1 }
				}
				scope:vassal_2 = {
					if = {
						limit = {
							exists = scope:detractor_ally_2
						}
						break_alliance = scope:detractor_ally_2
					}
					if = {
						limit = {
							NOT = {
								has_relation_rival = root
							}
						}
						set_relation_rival = {
							target = root
							reason = rival_accused_of_foreign_collusion
						}
					}
					else = {
						set_relation_nemesis = {
							target = root
							reason = rival_accused_of_foreign_collusion
						}
					}
					coronation_move_towards_detractor_effect = { CHARACTER = scope:vassal_2 }
				}
			}
		}
		scope:vassal_1 = {
			if = {
				limit = {
					government_allows = administrative
				}
				change_influence = medium_influence_loss
			}
			else = {
				add_prestige = medium_prestige_loss
			}
		}
		scope:vassal_2 = {
			if = {
				limit = {
					government_allows = administrative
				}
				change_influence = medium_influence_loss
			}
			else = {
				add_prestige = medium_prestige_loss
			}
		}
		if = {
			limit = {
				scope:detractor_ally_1 = {
					is_confederation_member = yes
				}
			}
			scope:detractor_ally_1.confederation = {
				remove_confederation_member = scope:detractor_ally_1
			}
		}
		if = {
			limit = {
				scope:detractor_ally_2 = {
					is_confederation_member = yes
				}
			}
			scope:detractor_ally_2.confederation = {
				remove_confederation_member = scope:detractor_ally_2
			}
		}

		scope:detractor_ally_1 = {
			add_opinion = {
				target = root
				opinion = -50
				modifier = hate_opinion
			}
			if = {
				limit = {
					involved_activity ?= scope:activity
				}
				coronation_move_towards_detractor_effect = { CHARACTER = scope:detractor_ally_1 }
			}
		}
		if = {
			limit = {
				exists = scope:detractor_ally_2
			}
			scope:detractor_ally_2 = {
				add_opinion = {
					target = root
					opinion = -50
					modifier = hate_opinion
				}
			}
			if = {
				limit = {
					involved_activity ?= scope:activity
				}
				coronation_move_towards_detractor_effect = { CHARACTER = scope:detractor_ally_2 }
			}
		}
		

		stress_impact = {
			vengeful = miniscule_stress_impact_loss
			paranoid = minor_stress_impact_loss
			trusting = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
			just = miniscule_stress_impact_gain
			honest = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 150
			modifier = {
				add = 100
				OR = {
					has_trait = vengeful
					has_trait = paranoid
					has_trait = sadistic
					has_trait = deceitful
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = trusting
					has_trait = forgiving
					has_trait = just
					has_trait = honest
				}
			}
		}
	}
	#I should make a show of accepting loyalty from minorities
	option = {
		trigger = {
			has_activity_intent = coronation_impress_attendees
			stewardship >= decent_skill_rating
			any_vassal = {
				count >= 2
				coronation_events_6121_minority_trigger = yes
			}
		}
		name = coronation_events.6121.b
		flavor = coronation_events.6121.b_flavor
		scope:activity = {
			add_activity_log_entry = {
				key = coronation_honored_minorities_ceremony_log
				character = scope:vassal_1
				target = scope:vassal_2
				scope:vassal_1 = {
					#Become supporter if opinion is positive
					if = {
						limit = {
							OR = {
								is_in_guest_subset = { name = detractor }
								AND = {
									NOT = { is_in_guest_subset = { name = supporter } }
									opinion = {
										target = root
										value >= 0
									}
								}
							}
							is_ai = yes
						}
						coronation_move_towards_supporter_effect = { CHARACTER = scope:vassal_1 }
					}
					if = {
						limit = {
							culture = scope:vassal_2.culture
						}
						#Add cultural acceptance
						culture = {
							change_cultural_acceptance = {
								target = root.culture
								value = medium_cultural_acceptance_gain
								desc = cultural_acceptance_favored_during_oath
							}
						}
					}
					else = {
						#Add cultural acceptance
						culture = {
							change_cultural_acceptance = {
								target = root.culture
								value = minor_cultural_acceptance_gain
								desc = cultural_acceptance_favored_during_oath
							}
						}
					}
				}
				scope:vassal_2 = {
					#Become supporter if opinion is positive
					if = {
						limit = {
							OR = {
								is_in_guest_subset = { name = detractor }
								AND = {
									NOT = { is_in_guest_subset = { name = supporter } }
									opinion = {
										target = root
										value >= 0
									}
								}
							}
							is_ai = yes
						}
						coronation_move_towards_supporter_effect = { CHARACTER = scope:vassal_2 }
					}
					if = {
						limit = {
							NOT = {
								culture = scope:vassal_1.culture
							}
						}
						#Add cultural acceptance
						culture = {
							change_cultural_acceptance = {
								target = root.culture
								value = minor_cultural_acceptance_gain
								desc = cultural_acceptance_favored_during_oath
							}
						}
					}
				}
			}
		}
		scope:vassal_1 = {
			#Add opinion of root
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = 20
			}
		}
		scope:vassal_2 = {
			#Add opinion of root
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = 20
			}
		}
		stress_impact = {
			trusting = miniscule_stress_impact_loss
			compassionate = miniscule_stress_impact_loss
			humble = miniscule_stress_impact_loss
			paranoid = miniscule_stress_impact_gain
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 200
			modifier = {
				add = 100
				OR = {
					has_trait = compassionate
					has_trait = humble
					has_trait = trusting
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = callous
					has_trait = sadistic
					has_trait = arrogant
					has_trait = paranoid
				}
			}
		}
	}
	option = {
		trigger = {
			has_activity_intent = coronation_embrace_supporters
			diplomacy >= average_skill_rating
			scope:activity = {
				any_guest_subset = {
					count >= 2
					name = supporter
					is_vassal_of = root
				}
			}
		}
		name = coronation_events.6121.c

		if = {
			limit = {
				government_allows = administrative
			}
			change_influence = medium_influence_gain
		}
		else = {
			add_prestige = medium_prestige_gain
		}
		scope:activity = {
			every_guest_subset = {
				name = supporter
				custom = custom.every_vassal_supporter
				limit = {
					is_vassal_of = root
				}
				if = {
					limit = {
						government_allows = administrative
						top_liege = involved_activity.activity_host
					}
					change_influence = minor_influence_gain
				}
				else = {
					add_prestige = minor_prestige_gain
				}
				add_opinion = {
					target = root
					modifier = loyalty_opinion
					opinion = 15
				}
				hidden_effect = {
					reverse_add_opinion = {
						target = root
						modifier = loyalty_opinion
						opinion = 10
					}
				}
			}
		}
		ai_chance = {
			base = 200
		}
	}
	option = {
		trigger = {
			NOT = {
				government_allows = administrative
			}
			trigger_if = {
				limit = {
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
				}
				OR = {
					has_trait = lifestyle_blademaster
					has_trait = knight_errant
					AND = {
						has_trait = tourney_participant
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 30
						}
					}
					AND = {
						has_trait = gallowsbait
						has_trait_xp = {
							trait = gallowsbait
							track = marauder
							value >= 20
						}
					}
					AND = {
						has_trait = gallowsbait
						has_trait_xp = {
							trait = gallowsbait
							track = bandit
							value >= 20
						}
					}
					has_trait = aggressive_attacker
					has_trait = reckless
					has_trait = gallant
					has_trait = adventurer
					has_trait = viking
					has_trait = shieldmaiden
					#Normal personality_triggers
					has_trait = wrathful
					has_trait = vengeful
					has_trait = brave
					has_trait = fickle
					has_trait = arrogant
					has_trait = sadistic
				}
			}
			trigger_else = {
				#Just the warrior-type triggers
				OR = {
					has_trait = lifestyle_blademaster
					has_trait = knight_errant
					AND = {
						has_trait = tourney_participant
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 30
						}
					}
					AND = {
						has_trait = gallowsbait
						has_trait_xp = {
							trait = gallowsbait
							track = marauder
							value >= 20
						}
					}
					AND = {
						has_trait = gallowsbait
						has_trait_xp = {
							trait = gallowsbait
							track = bandit
							value >= 20
						}
					}
					has_trait = aggressive_attacker
					has_trait = reckless
					has_trait = gallant
					has_trait = adventurer
					has_trait = viking
					has_trait = shieldmaiden
				}
			}
			coronation_vassals_approval_value < -1
			scope:vassal_2 = {
				can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
				is_ai = yes
			}
		}
		name = coronation_events.6121.d
		flavor = coronation_events.6121.d_flavor
		add_internal_flag = dangerous
		scope:activity = {
			add_activity_log_entry = {
				key = coronation_noble_oath_duel_log
				score = 50
				show_in_conclusion = yes
				character = root
				target = scope:vassal_2
			}
		}
		
		
		custom_tooltip = coronation_events.6121_duel_tt
		configure_start_single_combat_effect = {
			SC_INITIATOR = root
			SC_ATTACKER = root
			SC_DEFENDER = scope:vassal_2
			FATALITY = always
			FIXED = no
			LOCALE = temple
			OUTPUT_EVENT = single_combat.1006
			INVALIDATION_EVENT = single_combat.1006
		}
		add_dread = major_dread_gain
		add_prestige = medium_prestige_gain
		if = {
			limit = {
				NOR = {
					government_has_flag = government_is_tribal
					government_has_flag = government_is_nomadic
				}
				culture = { has_cultural_era_or_later = culture_era_late_medieval }
			}
			add_tyranny = major_tyranny_gain
		}
		else_if = {
			limit = {
				NOR = {
					government_has_flag = government_is_tribal
					government_has_flag = government_is_nomadic
				}
			}
			add_tyranny = medium_tyranny_gain
		}
		scope:vassal_2 = {
			set_relation_rival = {
				target = root
				reason = rival_duel_attacked
			}
			if = {
				limit = {
					involved_activity ?= scope:activity
				}
				coronation_move_towards_detractor_effect = { CHARACTER = scope:vassal_2 }
			}
		}
		stress_impact = {
			wrathful = minor_stress_impact_loss
			vengeful = minor_stress_impact_loss
			craven = massive_stress_impact_gain
			humble = minor_stress_impact_gain
			forgiving = major_stress_impact_gain
			compassionate = medium_stress_impact_gain
			calm = minor_stress_impact_gain
		}
		ai_chance = {
			base = 0
			ai_value_modifier = {
				ai_vengefulness = 1
				ai_rationality = -1
			}
			modifier = {
				add = 100
				OR = {
					has_trait = wrathful
					has_trait = vengeful
				}
			}
			modifier = {
				add = 50
				OR = {
					has_trait = sadistic
					has_trait = arrogant
					has_trait = brave
					has_trait = fickle
				}
			}
			modifier = {
				add = 50
				prowess >= extremely_high_skill_rating
			}
			modifier = {
				add = -100
				prowess < scope:vassal_2.prowess
			}
			modifier = {
				factor = 0.5
				NOR = {
					government_has_flag = government_is_tribal
					government_has_flag = government_is_nomadic
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = craven
					has_trait = humble
					has_trait = forgiving
					has_trait = compassionate
					has_trait = calm
					prowess <= low_skill_rating
				}
			}
		}
	}
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							trigger_if = {
								limit = {
									coronation_vassals_approval_value >= -1
									coronation_vassals_approval_value < 1
								}
								OR = {
									has_trait = paranoid
									has_trait = depressed
									has_trait = vengeful
								}
							}
							trigger_else = {
								coronation_vassals_approval_value < -1
							}
						}
						desc = coronation_events.6121.e_low
					}
					triggered_desc = {
						trigger = {
							coronation_vassals_approval_value >= -1
							OR = {
								has_trait = arrogant
								has_trait = trusting
								has_trait = content
								has_trait = callous
								has_trait = sadistic
							}
							NOR = {
								has_trait = humble
								has_trait = compassionate
								has_trait = paranoid
								has_trait = generous
								has_trait = forgiving
							}
						}
						desc = coronation_events.6121.e_high
					}
					desc = coronation_events.6121.e_mid
				}
			}
		}
		ai_chance = {
			base = 100
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes

		#Approval of the people
		trigger_event = {
			id = coronation_events.6122
			days = 3
		}
	}
}

#The approval of the people event
coronation_events.6122 = {
	type = activity_event
	title = coronation_events.6122.t
	desc = {
		first_valid = {
			#Loc for anointment taking place outside realm
			triggered_desc = {
				trigger = {
					scope:location.county.holder = {
						NOT = { top_liege = root }
					}
				}
				desc = coronation_events.6122.desc_intro_foreign
			}
			desc = coronation_events.6122.desc_intro
		}
		#Are the people compliant?
		first_valid = {
			triggered_desc = {
				trigger = {
					coronation_popular_approval_value < -1
				}
				desc = coronation_events.6122.desc_low_approval
			}
			triggered_desc = {
				trigger = {
					coronation_popular_approval_value >= 1
					OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
					OR = {
						location.barony = title:b_vaticano
						location.barony = title:b_roma
						location.culture = {
							has_cultural_pillar = language_greek
						}
					}
				}
				desc = coronation_events.6122.desc_high_approval_christian
			}
			triggered_desc = {
				trigger = {
					coronation_popular_approval_value >= 1
				}
				desc = coronation_events.6122.desc_high_approval
			}
			desc = coronation_events.6122.desc_mid_approval
		}
	}
	left_portrait = {
		character = scope:host
		triggered_animation = {
			trigger = {
				root = { coronation_popular_approval_value < -1 }
			}
			animation = eyeroll
		}
		triggered_animation = {
			trigger = {
				root = { OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion } }
			}
			animation = acknowledging
		}
		triggered_animation = {
			trigger = {
				root = { coronation_popular_approval_value >= 1 }
			}
			animation = interested
		}
		animation = personality_rational
	}
	center_portrait = {
		character = scope:commoner_1
		#Nobles
		triggered_animation = {
			trigger = {
				root = { coronation_popular_approval_value < -1 }
			}
			animation = personality_coward
		}
		triggered_animation = {
			trigger = {
				root = { coronation_popular_approval_value >= 1 }
			}
			animation = throne_room_bow_3
		}
		animation = throne_room_bow_2
		camera = camera_event_very_right
		hide_info = yes
	}
	right_portrait = {
		character = scope:commoner_2
		#Nobles
		triggered_animation = {
			trigger = {
				root = { coronation_popular_approval_value < -1 }
			}
			animation = crying
		}
		triggered_animation = {
			trigger = {
				root = { coronation_popular_approval_value >= 1 }
			}
			animation = obsequious_bow
		}
		animation = throne_room_bow_1
		camera = camera_event_very_right
		hide_info = yes
	}
	lower_left_portrait = scope:detractor_ally_1
	lower_center_portrait = scope:detractor_ally_2
	override_background = {
		reference = temple
	}
	override_effect_2d = {
		trigger = {
			scope:activity.var:activity_special_type_progression < 25
		}
		reference = flies	
	}

	theme = coronation_activity
	cooldown = { days = 20 }
	on_trigger_fail = {
		#artifact blessing
		trigger_event = {
			id = coronation_events.6110
			days = 3
		}
	}
	immediate = {
		# For MP
		coronation_busy_effect = yes

		select_local_farm_animal_effect = yes
		scope:activity = {
			activity_host = { save_scope_as = host }
			activity_location = { save_scope_as = location }
		}
		capital_province = { save_scope_as = capital_p }
		create_character = {
			template = settlement_elder_character
			dynasty = none
			location = scope:activity.activity_location
			gender_female_chance = activity_location_faith_dominant_gender_female_chance
			faith = scope:activity.activity_location.faith
			culture = scope:activity.activity_location.culture
			save_scope_as = commoner_1
		}
		create_character = {
			template = settlement_elder_character
			dynasty = none
			location = scope:activity.activity_location
			gender_female_chance = activity_location_faith_dominant_gender_female_chance
			faith = scope:activity.activity_location.faith
			culture = scope:activity.activity_location.culture
			save_scope_as = commoner_2
		}
		coronation_ceremony_legitimacy_effect = yes
	}
	#Exalt the crown
	option = {
		trigger = {
			has_activity_intent = coronation_exalt_crown
			coronation_popular_approval_value >= 1
			location.county = {
				holder = root
				NOT = {
					has_county_modifier = coronation_loyal_to_the_crown_modifier
				}
			}
		}
		name = coronation_events.6122.a
		flavor = coronation_events.6122.a.flavor

		#Get a county modifier that is replaced with a negative one if the county gets taken by another primary title holder
		scope:activity = {
			add_activity_log_entry = {
				key = coronation_inspired_loyalty_crowd_log
				score = 20
				character = root
				scope:location.county = {
					add_county_modifier = {
						modifier = coronation_loyal_to_the_crown_modifier
						years = 20
					}
				}
			}
		}
		scope:location.county = {
			set_variable = {
				name = coronation_loyal_to_title
				value = scope:host.primary_title
			}
			custom_tooltip = coronation_modifier_removed_on_new_primary_tt
			custom_tooltip = coronation_modifier_negative_on_new_primary_tt
		}
		remove_short_term_gold = minor_gold_value
		stress_impact = {
			generous = minor_stress_impact_loss
			arrogant = medium_stress_impact_loss
			shy = minor_stress_impact_gain
			humble = minor_stress_impact_gain
			content = minor_stress_impact_gain
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 300
			modifier = {
				add = 200
				OR = {
					has_trait = arrogant
					has_trait = generous
				}
			}
			modifier = {
				factor = 0
				OR = {
					short_term_gold <= minor_gold_value
					has_trait = shy
					has_trait = humble
					has_trait = content
					has_trait = greedy
				}
			}
		}
	}
	#PUNISH THIS RABBLE
	option = {
		trigger = {
			martial >= medium_skill_rating
			coronation_popular_approval_value < -1
		}
		name = coronation_events.6122.b
		flavor = coronation_events.6122.b.flavor
		scope:activity = {
			add_activity_log_entry = {
				key = coronation_quelled_crowd_log
				score = 20
				character = root
				root = {
					add_character_modifier = {
						modifier = punishes_popular_dissent_modifier
						years = 20
					}
					scope:location.county = {
						add_county_modifier = {
							modifier = coronation_crowds_beaten_modifier
							years = 5
						}
					}
				}
			}
		}
		
		stress_impact = {
			sadistic = minor_stress_impact_loss
			compassionate = major_stress_impact_gain
			humble = major_stress_impact_gain
			forgiving = major_stress_impact_gain
			trusting = minor_stress_impact_gain
			generous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = -2
			}
			modifier = {
				add = {
					value = dread
					multiply = 2
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = generous
					has_trait = humble
					has_trait = forgiving
					has_trait = trusting
					has_trait = generous
				}
			}
		}
	}

	#Opt out
	option = {
		#Triggered names based on positivity of crowd and your arrogance
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							OR = {
								has_trait = humble
								has_trait = compassionate
								has_trait = calm
								has_trait = forgiving
							}
							coronation_popular_approval_value < -1
							NOR = {
								has_trait = arrogant
								has_trait = vengeful
								has_trait = sadistic
								has_trait = wrathful
							}
						}
						desc = coronation_events.6122.c_v_low_humble
					}
					triggered_desc = {
						trigger = {
							OR = {
								has_trait = wrathful
								has_trait = arrogant
								has_trait = sadistic
								has_trait = arbitrary
								has_trait = vengeful
								coronation_popular_approval_value < -1
							}
							coronation_popular_approval_value < 1
						}
						desc = coronation_events.6122.c_v_low
					}
					triggered_desc = {
						trigger = {
							trigger_if = {
								limit = {
									coronation_popular_approval_value >= -1
									coronation_popular_approval_value < 1
								}
								NOR = {
									has_trait = humble
									ai_compassion >= low_positive_ai_value
								}
							}
							trigger_else = {
								coronation_popular_approval_value < -1
							}
						}
						desc = coronation_events.6122.c_low
					}
					triggered_desc = {
						trigger = {
							coronation_popular_approval_value >= -1
							OR = {
								has_trait = arrogant
								has_trait = ambitious
								has_trait = trusting
								has_trait = eccentric
							}
						}
						desc = coronation_events.6122.c_high
					}
					desc = coronation_events.6122.c_mid
				}
			}
		}
		ai_chance = {
			base = 100
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes

		scope:commoner_1 = {
			silent_disappearance_effect = yes
		}
		scope:commoner_2 = {
			silent_disappearance_effect = yes
		}
		#artifact blessing
		trigger_event = {
			id = coronation_events.6110
			days = 3
		}
	}
}

scripted_trigger coronation_events_6123_crucial_vassal_trigger = {
	is_powerful_vassal_of = scope:host
	OR = {
		is_diarch_of_target = scope:host
		is_councillor_of = scope:host
		legitimacy_level >= 5
		prestige_level >= 4
	}
}

scripted_trigger coronation_events_6123_significant_vassal_trigger = {
	OR = {
		is_powerful_vassal_of = scope:host
		is_diarch_of_target = scope:host
		is_councillor_of = scope:host
		legitimacy_level >= 4
		prestige_level >= 3
	}
}

scripted_trigger coronation_events_6123_vengeful_supporter_trigger = {
	is_ai = yes
	NOR = {
		has_relation_nemesis = root
		has_trait = forgiving
	}
	OR = {
		is_councillor_of = scope:host
		is_close_family_of = scope:host
		highest_held_title_tier >= tier_county
	}
	OR = {
		opinion = {
			target = scope:host
			value >= 80
		}
		ai_vengefulness > low_positive_ai_value
		ai_honor > low_positive_ai_value
		opinion = {
			target = root
			value < -40
		}
	}
}

#Summary of approvals for guests
coronation_events.6123 = {
	type = activity_event
	title = coronation_events.6123.t
	desc = {
		desc = coronation_events.6123.desc_intro
		#Clergy response
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:host = { coronation_clergy_approval_value < -1 }
				}
				desc = coronation_events.6123.desc_low_clergy
			}
			triggered_desc = {
				trigger = {
					scope:host = { coronation_clergy_approval_value >= 1 }
				}
				desc = coronation_events.6123.desc_high_clergy
			}
			desc = coronation_events.6123.desc_mid_clergy
		}
		desc = coronation_events.6123.desc_then
		triggered_desc = {
			trigger = {
				scope:location.county.holder = {
					NOT = { top_liege = scope:host }
				}
			}
			desc = coronation_events.6123.desc_pop_foreign
		}
		#Popular approval response
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:host = { coronation_popular_approval_value < -1 }
				}
				desc = coronation_events.6123.desc_low_populace
			}
			triggered_desc = {
				trigger = {
					scope:host = { coronation_popular_approval_value >= 1 }
				}
				desc = coronation_events.6123.desc_high_populace
			}
			desc = coronation_events.6123.desc_mid_populace
		}
		#Are the nobles compliant?
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:host = { coronation_vassals_approval_value < -1 }
				}
				desc = coronation_events.6123.desc_low_vassals
			}
			triggered_desc = {
				trigger = {
					scope:host = { coronation_vassals_approval_value >= 1 }
				}
				desc = coronation_events.6123.desc_high_vassals
			}
			desc = coronation_events.6123.desc_mid_vassals
		}
		#Are the nobles compliant?
		first_valid = {
			triggered_desc = {
				trigger = {
					root = {
						is_vassal_of = scope:host
					}
				}
				desc = coronation_events.6123.desc_end_vassal
			}
			desc = coronation_events.6123.desc_end_spectator
		}
	}
	left_portrait = {
		character = scope:vassal
		triggered_animation = {
			trigger = {
				trigger_if = {
					limit = {
						scope:vassal = {
							this = root
						}
					}
					OR = {
						has_activity_intent = coronation_disrupt_loyalists
						has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
						has_trait = disloyal
						is_a_faction_member = yes
						scope:activity = {
							is_target_in_variable_list = {
								name = major_detractor
								target = scope:vassal
							}
						}
					}
					NOR = {
						has_trait = shy
						has_trait = humble
						has_trait = calm
						has_activity_intent = coronation_offer_support
						scope:activity = {
							is_target_in_variable_list = {
								name = major_supporter
								target = scope:vassal
							}
						}
						has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host }
					}
				}
				trigger_else = {
					scope:host = { coronation_vassals_approval_value < -1 }
				}
			}
			animation = anger
		}
		triggered_animation = {
			trigger = {
				trigger_if = {
					limit = {
						scope:vassal = {
							this = root
						}
					}
					OR = {
						has_activity_intent = coronation_offer_support
						has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host }
						has_trait = loyal
						has_trait = craven
						has_trait = humble
						scope:activity = {
							is_target_in_variable_list = {
								name = major_supporter
								target = scope:vassal
							}
						}
					}
					NOR = {
						has_trait = arrogant
						has_trait = brave
						has_trait = fickle
						has_activity_intent = coronation_disrupt_loyalists
						scope:activity = {
							is_target_in_variable_list = {
								name = major_detractor
								target = scope:vassal
							}
						}
						has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
					}
				}
				trigger_else = {
					scope:host = { coronation_vassals_approval_value < -1 }
				}
			}
			animation = throne_room_bow_3
		}
		animation = throne_room_bow_2
		camera = camera_event_very_left
	}
	center_portrait = {
		character = scope:host
		triggered_animation = {
			trigger = {
				scope:host = {
					coronation_clergy_approval_value < -1
					coronation_vassals_approval_value < -1
				}
			}
			animation = worry
		}
		animation = wedding_groom_right
	}
	right_portrait = {
		character = scope:priest
		triggered_animation = {
			trigger = {
				scope:host = { coronation_clergy_approval_value < -1 }
			}
			animation = eyeroll
		}
		triggered_animation = {
			trigger = {
				scope:host = { coronation_clergy_approval_value >= 1 }
			}
			animation = admiration
		}
		animation = chaplain
		camera = camera_event_very_right
	}
	lower_left_portrait = scope:major_supporter_1
	lower_center_portrait = scope:major_supporter_2
	lower_right_portrait = scope:major_supporter_3
	override_background = {
		reference = temple
	}
	override_effect_2d = {
		trigger = {
			scope:activity.var:activity_special_type_progression < 25
		}
		reference = flies	
	}

	theme = coronation_activity
	cooldown = { days = 20 }
	on_trigger_fail = {
		#artifact blessing
		trigger_event = {
			id = coronation_events.6110
			days = 3
		}
	}
	immediate = {
		# For MP
		coronation_busy_effect = yes

		involved_activity = {
			activity_location = { save_scope_as = location }
			activity_host = { save_scope_as = host }
		}
		scope:host = {
			show_as_tooltip = {
				coronation_ceremony_piety_effect = yes
				coronation_ceremony_legitimacy_effect = yes
				coronation_ceremony_prestige_effect = yes
			}
			save_scope_as = bg_override_char
		}
		#Save a vassal
		#Prefer root if they are a vassal
		if = {
			limit = {
				is_vassal_of = scope:host
				NOR = {
					is_at_war_with = scope:host
					government_has_flag = government_is_theocracy
					government_has_flag = government_is_herder
				}
			}
			save_scope_as = vassal
		}
		#Host is liked, choose supporters
		if = {
			limit = {
				NOT = {
					exists = scope:vassal
				}
				coronation_vassals_approval_value >= -1
			}
			scope:activity = {
				ordered_guest_subset = {
					name = supporter
					order_by = max_military_strength
					limit = {
						is_vassal_of = scope:host
						NOR = {
							is_at_war_with = scope:host
							government_has_flag = government_is_theocracy
							government_has_flag = government_is_herder
						}
					}
					save_scope_as = vassal
				}
			}
		}
		#Host is disliked, choose detractors
		else = {
			scope:activity = {
				ordered_guest_subset = {
					name = detractor
					order_by = max_military_strength
					limit = {
						is_vassal_of = scope:host
						NOR = {
							is_at_war_with = scope:host
							government_has_flag = government_is_theocracy
							government_has_flag = government_is_herder
						}
					}
					save_scope_as = vassal
				}
			}
		}
		#Random vassal fallbacks
		if = {
			limit = {
				NOT = {
					exists = scope:vassal
				}
			}
			scope:activity = {
				ordered_attending_character = {
					order_by = max_military_strength
					limit = {
						is_vassal_of = scope:host
						NOR = {
							is_at_war_with = scope:host
							government_has_flag = government_is_theocracy
							government_has_flag = government_is_herder
						}
					}
					save_scope_as = vassal
				}
			}
		}
		#Oops no vassals... grab capital county barons
		if = {
			limit = {
				NOT = {
					exists = scope:vassal
				}
			}
			scope:host.capital_county = {
				random_county_province = {
					limit = {
						barony = {
							exists = holder
							NOT = {
								holder = scope:host
							}
							holder = {
								is_vassal_of = scope:host
								basic_is_available_ai = yes
							}
						}
						OR = {
							has_holding_type = castle_holding
							has_holding_type = tribal_holding
							has_holding_type = nomad_holding
						}
					}
					barony.holder = {
						save_scope_as = vassal
					}
				}
			}
		}
		#Grab any baron???
		if = {
			limit = {
				NOT = {
					exists = scope:vassal
				}
			}
			scope:host = {
				random_held_title = {
					limit = {
						tier = tier_county	
						any_county_province = {
							barony = {
								exists = holder
								NOT = {
									holder = scope:host
								}
								holder = {
									is_vassal_of = scope:host
									basic_is_available_ai = yes
								}
							}
							OR = {
								has_holding_type = castle_holding
								has_holding_type = tribal_holding
								has_holding_type = nomad_holding
							}
						}
					}
					random_county_province = {
						limit = {
							barony = {
								exists = holder
								NOT = {
									holder = scope:host
								}
								holder = {
									is_vassal_of = scope:host
									basic_is_available_ai = yes
								}
							}
							OR = {
								has_holding_type = castle_holding
								has_holding_type = tribal_holding
								has_holding_type = nomad_holding
							}
						}
						barony.holder = {
							save_scope_as = vassal
						}
					}
				}
			}
		}
		#Grab non-attending vassal
		if = {
			limit = {
				NOT = {
					exists = scope:vassal
				}
			}
			scope:host = {
				random_vassal = {
					limit = {
						basic_is_available_ai = yes
						NOR = {
							is_at_war_with = scope:host
							government_has_flag = government_is_theocracy
							government_has_flag = government_is_herder
							this = root
						}
						age > 5
					}
					save_scope_as = vassal
				}
			}
		}
		#Just going to go with a courtier "vassal", out of options...
		if = {
			limit = {
				NOT = {
					exists = scope:vassal
				}
			}
			scope:host = {
				random_knight = {
					limit = {
						basic_is_available_ai = yes
						NOT = {
							is_consort_of = scope:host
						}
					}
					save_scope_as = vassal
				}
			}
		}
		#Save a priest to use in event
		#Save holy men
		if = {
			limit = {
				coronation_living_officiator_trigger = yes
			}
			scope:activity.var:officiator = {
				save_scope_as = priest
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:priest
				}
				cp:councillor_court_chaplain ?= {
					is_alive = yes
					is_imprisoned = no
					is_incapable = no
					has_contagious_deadly_disease_trigger = no
				}
			}
			#SAVE COURT CHAPLAIN
			cp:councillor_court_chaplain = {
				save_scope_as = priest
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:priest
				}
			}
			scope:activity = {
				ordered_attending_character = {
					order_by = max_military_strength
					limit = {
						government_has_flag = government_is_theocracy
					}
					save_scope_as = priest
				}
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:priest
				}
			}
			create_character = {
				template = priest_character_template
				location = scope:host.location
				culture = scope:host.location.culture
				faith = scope:host.faith
				save_scope_as = priest
			}
			scope:priest = {
				add_character_flag = oather_1_destroy
			}
		}
		#Save major supporters that might become rivals of detractor
		if = {
			limit = {
				has_activity_intent = coronation_disrupt_loyalists
				coronation_events_6123_crucial_vassal_trigger = yes
			}
			scope:activity = {
				ordered_in_list = {
				 	variable = major_supporter
				 	order_by = max_military_strength
				 	limit = {
				 		coronation_events_6123_vengeful_supporter_trigger = yes
				 	}
				 	save_scope_as = major_supporter_1
				}
				ordered_in_list = {
				 	variable = major_supporter
				 	order_by = max_military_strength
				 	limit = {
				 		exists = scope:major_supporter_1
				 		this != scope:major_supporter_1
				 		coronation_events_6123_vengeful_supporter_trigger = yes
				 	}
				 	save_scope_as = major_supporter_2
				}
				ordered_in_list = {
				 	variable = major_supporter
				 	order_by = max_military_strength
				 	limit = {
				 		exists = scope:major_supporter_1
				 		exists = scope:major_supporter_2
				 		this != scope:major_supporter_1
				 		this != scope:major_supporter_2
				 		coronation_events_6123_vengeful_supporter_trigger = yes
				 	}
				 	save_scope_as = major_supporter_3
				}
			}
		}
	}
	#WOO! I AM SO INTO YOU, MY LIEGE
	option = {
		trigger = {
			is_vassal_of = scope:host
			highest_held_title_tier > tier_barony
		}
		name = coronation_events.6123.a
		flavor = coronation_events.6123.a_flavor

		if = {
			limit = {
				is_ai = no
			}
			scope:host = {
				send_interface_toast = {
					type = event_toast_effect_good
					title = coronation_events.6123_vassal_feted_you
					left_icon = root
					#Increase magnificence (players only)
					#Host gains legitimacy and prestige (players only)
					if = {
						limit = {
							root = {
								coronation_events_6123_crucial_vassal_trigger = yes
							}
						}
						custom_tooltip = coronation_tt_positive_major
						scope:activity = { activity_special_type_progression_major = yes }
						coronation_add_magnificence_log_effect = {
							VALUE = flag:positive_major
							CHAR = root
						}
						if = {
							limit = {
								root = { has_activity_intent = coronation_offer_support }
							}
							add_legitimacy = minor_legitimacy_gain
						}
						
						if = {
							limit = {
								government_allows = administrative
							}
							change_influence = minor_influence_gain
						}
						else = {
							add_prestige = minor_prestige_gain
						}
						add_stress = minor_stress_impact_loss
					}
					else_if = {
						limit = {
							root = {
								coronation_events_6123_significant_vassal_trigger = yes
							}
						}
						custom_tooltip = coronation_tt_positive_medium
						scope:activity = { activity_special_type_progression_medium = yes }
						coronation_add_magnificence_log_effect = {
							VALUE = flag:positive_medium
							CHAR = root
						}
						if = {
							limit = {
								root = { has_activity_intent = coronation_offer_support }
							}
							add_legitimacy = miniscule_legitimacy_gain
						}
						if = {
							limit = {
								government_allows = administrative
							}
							change_influence = miniscule_influence_gain
						}
						else = {
							add_prestige = miniscule_prestige_gain
						}
						add_stress = miniscule_stress_impact_loss
					}
					else = {
						custom_tooltip = coronation_tt_positive_tiny
						scope:activity = { activity_special_type_progression_tiny = yes }
						coronation_add_magnificence_log_effect = {
							VALUE = flag:positive_tiny
							CHAR = root
						}
						if = {
							limit = {
								root = { has_activity_intent = coronation_offer_support }
							}
							add_legitimacy = {
								value = miniscule_legitimacy_gain
								multiply = 0.5
							}
						}
						if = {
							limit = {
								government_allows = administrative
							}
							change_influence = {
								value = miniscule_influence_gain
								multiply = 0.5
							}
						}
						else = {
							add_prestige = {
								value = miniscule_prestige_gain
								multiply = 0.5
							} 
						}
					}
				}
			}
		}
		#Major AI can fuck with magnificence a bit
		else = {
			if = {
				limit = {
					scope:activity = {
						is_target_in_variable_list = {
							name = major_supporter
							target = root
						}
					}
				}
				if = {
					limit = {
						has_activity_intent = coronation_offer_support
					}
					custom_tooltip = coronation_tt_positive_medium
					scope:activity = { activity_special_type_progression_medium = yes }
					coronation_add_magnificence_log_effect = {
						VALUE = flag:positive_medium
						CHAR = root
					}
				}
				else = {
					custom_tooltip = coronation_tt_positive_tiny
					scope:activity = { activity_special_type_progression_tiny = yes }
					coronation_add_magnificence_log_effect = {
						VALUE = flag:positive_tiny
						CHAR = root
					}
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = coronation_supporter_pledge_leader_log
				character = root
				score = 50
				show_in_conclusion = yes
				#Host and supporters lose opinion
				#Detractors gain opinion
				#Host and supporters gain opinion
				#Detractors lose opinion
				root = {
					if = {
						limit = {
							has_activity_intent = coronation_offer_support
						}
						#Bigger opinion gain if you're sticking your neck out for supporters
						if = {
							limit = {
								scope:activity = { 
									number_of_supporters_activity <= number_of_detractors_activity
								}
							}
							scope:host = {
								add_opinion = {
									target = root
									modifier = support_opinion
									opinion = 35
								}
							}
							scope:activity = {
								every_guest_subset = {
									name = supporter
									custom = every_supporter_activity
									limit = {
										NOT = {
											this = root
										}
									}
									add_opinion = {
										target = root
										modifier = fellow_supporter_opinion
										opinion = 35
									}
								}
							}
						}
						else = {
							scope:host = {
								add_opinion = {
									target = root
									modifier = support_opinion
									opinion = 25
								}
							}
							scope:activity = {
								every_guest_subset = {
									name = supporter
									custom = every_supporter_activity
									limit = {
										NOT = {
											this = root
										}
									}
									add_opinion = {
										target = root
										modifier = fellow_supporter_opinion
										opinion = 25
									}
								}
							}
						}
						scope:activity = {
							every_guest_subset = {
								name = detractor
								custom = every_detractor_activity
								limit = {
									NOT = {
										this = root
									}
								}
								add_opinion = {
									target = root
									modifier = rival_supporter_opinion
									opinion = -35
								}
							}
						}
					}
					else = {
						#Bigger opinion gain if you're sticking your neck out for supporters
						if = {
							limit = {
								scope:activity = { 
									number_of_supporters_activity <= number_of_detractors_activity
								}
							}
							scope:host = {
								add_opinion = {
									target = root
									modifier = support_opinion
									opinion = 25
								}
							}
							scope:activity = {
								every_guest_subset = {
									name = supporter
									custom = every_supporter_activity
									limit = {
										NOT = {
											this = root
										}
									}
									add_opinion = {
										target = root
										modifier = fellow_supporter_opinion
										opinion = 25
									}
								}
							}
						}
						else = {
							scope:host = {
								add_opinion = {
									target = root
									modifier = support_opinion
									opinion = 15
								}
							}
							scope:activity = {
								every_guest_subset = {
									name = supporter
									custom = every_supporter_activity
									limit = {
										NOT = {
											this = root
										}
									}
									add_opinion = {
										target = root
										modifier = fellow_supporter_opinion
										opinion = 15
									}
								}
							}
						}
						scope:activity = {
							every_guest_subset = {
								name = detractor
								custom = every_detractor_activity
								limit = {
									NOT = {
										this = root
									}
								}
								add_opinion = {
									target = root
									modifier = rival_supporter_opinion
									opinion = -30
								}
							}
						}
					}
				}
			}
		}
		if = {
			limit = {
				has_activity_intent = coronation_offer_support
			}
			custom_tooltip = improved_because_intent_tt
		}

		stress_impact = {
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_honor = 1
			}
			opinion_modifier = {
				who = root
				opinion_target = scope:host
				multiplier = 1
			}
			modifier = {
				add = 50
				has_trait = loyal
			}
			modifier = {
				add = 100
				has_any_moderate_good_relationship_with_character_trigger = { CHARACTER = scope:host }
			}
			modifier = {
				add = 50
				has_dread_level_towards = {
					target = scope:host
					level >= 2
				}
			}
			modifier = {
				add = -50
				is_powerful_vassal = no
			}
			modifier = {
				add = 100
				has_activity_intent = coronation_offer_support
			}
			modifier = {
				add = 100
				scope:activity = {
					is_target_in_variable_list = {
						name = major_supporter
						target = root
					}
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_activity_intent = coronation_disrupt_loyalists
					NOR = {
						is_in_guest_subset = { name = supporter }
						has_any_moderate_good_relationship_with_character_trigger = { 	CHARACTER = scope:host }
					}
				}
			}
		}
	}
	#I am going to really make this suck for my liege
	option = {
		trigger = {
			is_vassal_of = scope:host
			highest_held_title_tier > tier_barony
		}
		name = coronation_events.6123.b
		flavor = coronation_events.6123.b_flavor

		if = {
			limit = {
				is_ai = no
			}
			scope:host = {
				#message just for multiplayer coronations
				send_interface_toast = {
					type = event_toast_effect_bad
					title = coronation_events.6123_vassal_scorned_you
					left_icon = root
					#decrease magnificence (players only)
					#Host loses legitimacy and prestige (players only)
					if = {
						limit = {
							root = {
								coronation_events_6123_crucial_vassal_trigger = yes
							}
						}
						custom_tooltip = coronation_tt_negative_major
						scope:activity = { activity_special_type_progression_negative_major = yes }
						coronation_add_magnificence_log_effect = {
							VALUE = flag:negative_major
							CHAR = root
						}
						if = {
							limit = {
								root = { has_activity_intent = coronation_disrupt_loyalists }
							}
							add_legitimacy = minor_legitimacy_loss
							#Root gets some currency in exchange for rivalries
							if = {
								limit = {
									exists = scope:major_supporter_1
									root = {
										government_allows = administrative
									}
								}
								change_influence = major_influence_gain
							}
							else_if = {
								limit = {
									exists = scope:major_supporter_1
								}
								root = {
									add_prestige = major_prestige_gain
								}
							}
						}
						
						if = {
							limit = {
								government_allows = administrative
							}
							change_influence = minor_influence_loss
						}
						else = {
							add_prestige = minor_prestige_loss
						}
						add_stress = minor_stress_impact_gain
					}
					else_if = {
						limit = {
							root = {
								coronation_events_6123_significant_vassal_trigger = yes
							}
						}
						custom_tooltip = coronation_tt_negative
						scope:activity = { activity_special_type_progression_negative = yes }
						coronation_add_magnificence_log_effect = {
							VALUE = flag:negative
							CHAR = root
						}
						if = {
							limit = {
								root = { has_activity_intent = coronation_disrupt_loyalists }
							}
							add_legitimacy = miniscule_legitimacy_loss
						}
						if = {
							limit = {
								government_allows = administrative
							}
							change_influence = miniscule_influence_loss
						}
						else = {
							add_prestige = miniscule_prestige_loss
						}
						add_stress = miniscule_stress_impact_gain
					}
					else = {
						custom_tooltip = coronation_tt_negative_tiny
						scope:activity = { activity_special_type_progression_negative_tiny = yes }
						coronation_add_magnificence_log_effect = {
							VALUE = flag:negative_tiny
							CHAR = root
						}
						if = {
							limit = {
								root = { has_activity_intent = coronation_disrupt_loyalists }
							}
							add_legitimacy = {
								value = miniscule_legitimacy_loss
								multiply = 0.5
							}
						}
						if = {
							limit = {
								government_allows = administrative
							}
							change_influence = {
								value = miniscule_influence_loss
								multiply = 0.5
							}
						}
						else = {
							add_prestige = {
								value = miniscule_prestige_loss
								multiply = 0.5
							}
						}
					}
				}
			}
		}
		#Major AI can fuck with magnificence a bit
		else = {
			if = {
				limit = {
					scope:activity = {
						is_target_in_variable_list = {
							name = major_detractor
							target = root
						}
					}
				}
				if = {
					limit = {
						has_activity_intent = coronation_disrupt_loyalists
					}
					custom_tooltip = coronation_tt_negative
					scope:activity = { activity_special_type_progression_negative = yes }
					coronation_add_magnificence_log_effect = {
						VALUE = flag:negative
						CHAR = root
					}
				}
				else = {
					custom_tooltip = coronation_tt_negative_tiny
					scope:activity = { activity_special_type_progression_negative_tiny = yes }
					coronation_add_magnificence_log_effect = {
						VALUE = flag:negative_tiny
						CHAR = root
					}
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = coronation_detractor_pledge_insult_log
				character = root
				score = 50
				show_in_conclusion = no
				#Host and supporters lose opinion
				#Detractors gain opinion
				root = {
					if = {
						limit = {
							has_activity_intent = coronation_disrupt_loyalists
						}
						if = {
							limit = {
								coronation_events_6123_crucial_vassal_trigger = yes
							}
							if = {
								limit = {
									NOT = {
										has_relation_nemesis = scope:host
									}
									#Host is AI or both chars are players
									OR = {
										scope:host = {
											is_ai = yes
										}
										AND = {
											is_ai = no
											scope:host = {
												is_ai = no
											}
										}
									}
								}
								progress_towards_rival_effect = {
									REASON = rival_coronation_pledge_scandal
									CHARACTER = scope:host
									OPINION = 0
								}
							}
							if = {
								limit = {
									exists = scope:major_supporter_1
								}
								progress_towards_rival_effect = {
									REASON = rival_coronation_pledge_scandal
									CHARACTER = scope:major_supporter_1
									OPINION = 0
								}
							}
							if = {
								limit = {
									exists = scope:major_supporter_2
								}
								progress_towards_rival_effect = {
									REASON = rival_coronation_pledge_scandal
									CHARACTER = scope:major_supporter_2
									OPINION = 0
								}
							}
							if = {
								limit = {
									exists = scope:major_supporter_3
								}
								progress_towards_rival_effect = {
									REASON = rival_coronation_pledge_scandal
									CHARACTER = scope:major_supporter_3
									OPINION = 0
								}
							}
						}
						scope:host = {
							add_opinion = {
								target = root
								modifier = contempt_opinion
								opinion = -30
							}
						}
						scope:activity = {
							every_guest_subset = {
								name = supporter
								custom = every_supporter_activity
								limit = {
									NOT = {
										this = root
									}
								}
								add_opinion = {
									target = root
									modifier = rival_detractor_opinion
									opinion = -30
								}
							}
						}
						#Bigger opinion gain if you are sticking your neck out for detractors
						if = {
							limit = {
								scope:activity = { 
									number_of_detractors_activity <= number_of_supporters_activity
								}
							}
							scope:activity = {
								every_guest_subset = {
									name = detractor
									custom = every_detractor_activity
									limit = {
										NOT = {
											this = root
										}
									}
									add_opinion = {
										target = root
										modifier = fellow_detractor_opinion
										opinion = 45
									}
								}
							}
						}
						else = {
							scope:activity = {
								every_guest_subset = {
									name = detractor
									custom = every_detractor_activity
									limit = {
										NOT = {
											this = root
										}
									}
									add_opinion = {
										target = root
										modifier = fellow_detractor_opinion
										opinion = 35
									}
								}
							}
						}
					}
					else = {
						scope:host = {
							add_opinion = {
								target = root
								modifier = contempt_opinion
								opinion = -25
							}
						}
						scope:activity = {
							every_guest_subset = {
								name = supporter
								custom = every_supporter_activity
								limit = {
									NOT = {
										this = root
									}
								}
								add_opinion = {
									target = root
									modifier = rival_detractor_opinion
									opinion = -25
								}
							}
						}
						#Bigger opinion gain if you are sticking your neck out for detractors
						if = {
							limit = {
								scope:activity = { 
									number_of_detractors_activity <= number_of_supporters_activity
								}
							}
							scope:activity = {
								every_guest_subset = {
									name = detractor
									custom = every_detractor_activity
									limit = {
										NOT = {
											this = root
										}
									}
									add_opinion = {
										target = root
										modifier = fellow_detractor_opinion
										opinion = 35
									}
								}
							}
						}
						else = {
							scope:activity = {
								every_guest_subset = {
									name = detractor
									custom = every_detractor_activity
									limit = {
										NOT = {
											this = root
										}
									}
									add_opinion = {
										target = root
										modifier = fellow_detractor_opinion
										opinion = 20
									}
								}
							}
						}
					}
				}
			}
		}
		if = {
			limit = {
				has_activity_intent = coronation_disrupt_loyalists
			}
			custom_tooltip = improved_because_intent_tt
		}
		if = {
			limit = {
				is_ai = yes
			}
			coronation_move_towards_detractor_effect = { CHARACTER = root }
		}

		stress_impact = {
			humble = medium_stress_impact_gain
			craven = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
			shy = minor_stress_impact_gain
			trusting = minor_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -0.5
				ai_boldness = 0.5
			}
			opinion_modifier = {
				who = root
				opinion_target = scope:host
				multiplier = -1
			}
			modifier = {
				add = 50
				has_trait = disloyal
			}

			modifier = {
				add = 100
				has_any_moderate_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
			}

			modifier = {
				add = 50
				any_claim = {
					holder ?= scope:host
				}
			}
			modifier = {
				add = 100
				is_a_faction_member = yes
			}
			modifier = {
				add = 100
				has_activity_intent = coronation_disrupt_loyalists
			}
			modifier = {
				add = -50
				is_powerful_vassal = no
			}
			modifier = {
				add = 100
				scope:activity = {
					is_target_in_variable_list = {
						name = major_detractor
						target = root
					}
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = humble
					has_trait = craven
					has_trait = forgiving
					has_dread_level_towards = {
						target = scope:host
						level >= 1
					}
					has_activity_intent = coronation_offer_support
					NOR = {
						is_in_guest_subset = { name = detractor }
						has_any_moderate_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
					}
				}
			}
		}
	}

	#Whatever, the ceremony happens
	option = {
		#Triggered names based on attitude towards host
		name = {
			text = {
				first_valid = {
					#resentful vassal
					triggered_desc = {
						trigger = {
							is_vassal_of = scope:host
							OR = {
								has_activity_intent = coronation_disrupt_loyalists
								has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
								has_trait = disloyal
								has_trait = arrogant
								has_trait = ambitious
								is_a_faction_member = yes
							}
							NOR = {
								has_trait = shy
								has_trait = humble
								has_trait = content
								has_trait = loyal
								has_activity_intent = coronation_offer_support
								has_any_moderate_good_relationship_with_character_trigger = { CHARACTER = scope:host }
							}
						}
						desc = coronation_events.6123.c_vassal_resents
					}
					#happy vassal
					triggered_desc = {
						trigger = {
							is_vassal_of = scope:host
							OR = {
								has_activity_intent = coronation_offer_support
								has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host }
								has_trait = loyal
								has_trait = humble
								has_trait = compassionate
								has_trait = just
							}
							NOR = {
								has_trait = arrogant
								has_trait = ambitious
								has_trait = sadistic
								has_trait = callous
								has_activity_intent = coronation_disrupt_loyalists
								has_any_moderate_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
							}
						}
						desc = coronation_events.6123.c_vassal_pleased
					}
					#Neutral vassal
					triggered_desc = {
						trigger = {
							is_vassal_of = scope:host
						}
						desc = coronation_events.6123.c_vassal_neutral
					}
					#Like that vassals disrespect king
					triggered_desc = {
						trigger = {
							scope:host = {
								coronation_vassals_approval_value < -1
							}
							OR = {
								has_activity_intent = coronation_disrupt_loyalists
								has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
								has_trait = disloyal
								has_trait = arbitrary
								has_trait = fickle
								scope:activity = {
									is_target_in_variable_list = {
										name = major_detractor
										target = root
									}
								}
							}
							NOR = {
								has_activity_intent = coronation_offer_support
								scope:activity = {
									is_target_in_variable_list = {
										name = major_supporter
										target = root
									}
								}
								has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host }
								has_trait = just
							}
						}
						desc = coronation_events.6123.c_likes_disrespect
					}
					#Angered by disrespectful vassals
					triggered_desc = {
						trigger = {
							scope:host = {
								coronation_vassals_approval_value < -1
							}
							OR = {
								has_activity_intent = coronation_offer_support
								has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host }
								has_trait = loyal
								has_trait = just
								has_trait = humble
								has_trait = content
								has_trait = trusting
								scope:activity = {
									is_target_in_variable_list = {
										name = major_supporter
										target = root
									}
								}
							}
							NOR = {
								has_activity_intent = coronation_disrupt_loyalists
								scope:activity = {
									is_target_in_variable_list = {
										name = major_detractor
										target = root
									}
								}
								has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
							}
						}
						desc = coronation_events.6123.c_dislikes_disrespect
					}
					#Angered by loyal vassals
					triggered_desc = {
						trigger = {
							scope:host = {
								coronation_vassals_approval_value >= 1
							}
							OR = {
								has_activity_intent = coronation_disrupt_loyalists
								has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
								has_trait = disloyal
								has_trait = arbitrary
								has_trait = fickle
								scope:activity = {
									is_target_in_variable_list = {
										name = major_detractor
										target = root
									}
								}
							}
							NOR = {
								has_activity_intent = coronation_offer_support
								scope:activity = {
									is_target_in_variable_list = {
										name = major_supporter
										target = root
									}
								}
								has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host }
								has_trait = just
							}
						}
						desc = coronation_events.6123.c_dislikes_loyalty
					}
					#Like loyal vassals
					triggered_desc = {
						trigger = {
							scope:host = {
								coronation_vassals_approval_value >= 1
							}
							OR = {
								has_activity_intent = coronation_offer_support
								has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host }
								has_trait = loyal
								has_trait = just
								has_trait = humble
								has_trait = content
								has_trait = trusting
								scope:activity = {
									is_target_in_variable_list = {
										name = major_supporter
										target = root
									}
								}
							}
							NOR = {
								has_activity_intent = coronation_disrupt_loyalists
								scope:activity = {
									is_target_in_variable_list = {
										name = major_detractor
										target = root
									}
								}
								has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
							}
						}
						desc = coronation_events.6123.c_likes_loyalty
					}
					#Dislikes king
					triggered_desc = {
						trigger = {
							OR = {
								has_activity_intent = coronation_disrupt_loyalists
								has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
								scope:activity = {
									is_target_in_variable_list = {
										name = major_detractor
										target = root
									}
								}
							}
							NOR = {
								has_activity_intent = coronation_offer_support
								scope:activity = {
									is_target_in_variable_list = {
										name = major_supporter
										target = root
									}
								}
								has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host }
							}
						}
						desc = coronation_events.6123.c_dislikes_host
					}
					#Neutral
					desc = coronation_events.6123.c
				}
			}
		}
		#Stress when you are angry vassal
		if = {
			limit = {
				is_vassal_of = scope:host
				has_relation_rival = scope:host
			}
			stress_impact = {
				base = medium_stress_impact_gain
				arrogant = minor_stress_impact_gain
				vengeful = minor_stress_impact_gain
			}
		}
		#Stress when you are happy vassal
		else_if = {
			limit = {
				is_vassal_of = scope:host
			}
			stress_impact = {
				humble = miniscule_stress_impact_loss
				trusting = miniscule_stress_impact_loss
			}
		}
		#Generic vassal stress
		else = {
			limit = {
				is_vassal_of = scope:host
			}
			stress_impact = {
				arrogant = miniscule_stress_impact_gain
			}
		}
		ai_chance = {
			base = 100
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
		if = {
			limit = {
				scope:priest = {
					has_character_flag = oather_1_destroy
				}
			}
			scope:priest = {
				silent_disappearance_effect = yes
			}
		}
		#Anointment event
		trigger_event = {
			id = coronation_events.6130
			days = 3
		}
	}
}

scripted_trigger coronation_events_6130_dharmic_trigger = {
	faith.religion = {
		AND = {
			is_in_family = rf_eastern
			NOT = {
				this = religion:zoroastrianism_religion
			}
		}
	}
	root.involved_activity.activity_location = {
		OR = {
			geographical_region = world_india
			geographical_region = world_tibet
			geographical_region = world_burma
		}
	}
}
#Anointment, perhaps by the HoF in an actual anointment
coronation_events.6130 = {
	type = activity_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = coronation_type_anointment
						}
					}
				}
				desc = coronation_events.6130.t_anointment
			}
			triggered_desc = {
				trigger = {
					scope:host = {
						coronation_events_6130_dharmic_trigger = yes
					}
				}
				desc = coronation_events.6130.t_dharmic
			}
			desc = coronation_events.6130.t
		}
	}
	desc = {
		#Intro line
		desc = coronation_events.6130.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = coronation_type_anointment
						}
					}
					this = scope:host
					scope:host.faith.religion = {
						this = religion:christianity_religion
					}
				}
				desc = coronation_events.6130.papal_intro_host
			}
			triggered_desc = {
				trigger = {
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = coronation_type_anointment
						}
					}
					scope:host.faith.religion = {
						this = religion:christianity_religion
					}
				}
				desc = coronation_events.6130.papal_intro_guest
			}
			triggered_desc = {
				trigger = {
					this = scope:host
					scope:host.faith.religion = {
						OR = {
							this = religion:christianity_religion
							this = religion:judaism_religion
						}
					}
				}
				desc = coronation_events.6130.abrahamic_intro_host
			}
			triggered_desc = {
				trigger = {
					this = scope:host
					scope:host.faith.religion = {
						OR = {
							this = religion:christianity_religion
							this = religion:judaism_religion
						}
					}
				}
				desc = coronation_events.6130.abrahamic_intro_guest
			}
			triggered_desc = {
				trigger = {
					this = scope:host
					scope:host = {
						coronation_events_6130_dharmic_trigger = yes
					}
				}
				desc = coronation_events.6130.dharmic_intro_host
			}
			triggered_desc = {
				trigger = {
					scope:host = {
						coronation_events_6130_dharmic_trigger = yes
					}
				}
				desc = coronation_events.6130.dharmic_intro_guest
			}
			triggered_desc = {
				trigger = {
					this = scope:host
				}
				desc = coronation_events.6130.generic_intro_host
			}
			desc = coronation_events.6130.generic_intro_guest
		}
		#Little description of priest, whether hof or just some priest
		#Dharmic also work for generic here
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:anointer = {
						this = faith.religious_head
						opinion = {
							target = scope:host
							value < 0
						}
					}
				}
				desc = coronation_events.6130.faith_head_disapproves
			}
			triggered_desc = {
				trigger = {
					scope:anointer = {
						this = faith.religious_head
						opinion = {
							target = scope:host
							value >= 50
						}
						is_male = yes
					}
				}
				desc = coronation_events.6130.faith_head_likes
			}
			triggered_desc = {
				trigger = {
					scope:anointer = {
						this = faith.religious_head
					}
				}
				desc = coronation_events.6130.faith_head
			}
			triggered_desc = {
				trigger = {
					OR = {
					scope:host.faith.religion = religion:eastern_orthodox_religion scope:host.faith.religion = religion:catholic_religion scope:host.faith.religion = religion:protestant_religion 
					}
					scope:anointer = {
						NOT = {
							this = scope:host.cp:councillor_court_chaplain
						}
						is_landed = yes
					}
				}
				desc = coronation_events.6130.christian_non_hof_non_cc
			}
			triggered_desc = {
				trigger = {
					OR = {
					scope:host.faith.religion = religion:eastern_orthodox_religion scope:host.faith.religion = religion:catholic_religion scope:host.faith.religion = religion:protestant_religion 
					}
				}
				desc = coronation_events.6130.christian_non_hof
			}
			desc = coronation_events.6130.anointer_fallback
		}
		#Anointing with oil or water from sacred rivers?
		#Abrahamic also work for generic here
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:host = {
						coronation_events_6130_dharmic_trigger = no
					}
					this = scope:host
					OR = {
						has_trait = cynical
						has_trait = brave
						has_trait = callous
						has_trait = sadistic
						has_trait = calm
					}
					NOR = {
						has_trait = zealous
						has_trait = craven
						has_trait = shy
					}
				}
				desc = coronation_events.6130.anointing_abrahamic_host_disrespectful
			}
			triggered_desc = {
				trigger = {
					scope:host = {
						coronation_events_6130_dharmic_trigger = no
					}
					this = scope:host
				}
				desc = coronation_events.6130.anointing_abrahamic_host
			}
			triggered_desc = {
				trigger = {
					scope:host = {
						coronation_events_6130_dharmic_trigger = no
					}
				}
				desc = coronation_events.6130.anointing_abrahamic_guest
			}
			triggered_desc = {
				trigger = {
					this = scope:host
				}
				desc = coronation_events.6130.anointing_dharmic_host
			}
			desc = coronation_events.6130.anointing_dharmic_guest
		}
		#Credit it to church or god based on zeal
		#Abrahamic also work for generic here
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:host = {
						coronation_events_6130_dharmic_trigger = no
					}
					this = scope:host
					ai_zeal >= medium_negative_ai_value
				}
				desc = coronation_events.6130.ending_abrahamic_host_zealous
			}
			triggered_desc = {
				trigger = {
					scope:host = {
						coronation_events_6130_dharmic_trigger = no
					}
					this = scope:host
				}
				desc = coronation_events.6130.ending_abrahamic_host_cynical
			}
			triggered_desc = {
				trigger = {
					scope:host = {
						coronation_events_6130_dharmic_trigger = no
					}
					ai_zeal >= medium_negative_ai_value
				}
				desc = coronation_events.6130.ending_abrahamic_guest_zealous
			}
			triggered_desc = {
				trigger = {
					scope:host = {
						coronation_events_6130_dharmic_trigger = no
					}
				}
				desc = coronation_events.6130.ending_abrahamic_guest_cynical
			}
			triggered_desc = {
				trigger = {
					this = scope:host
				}
				desc = coronation_events.6130.ending_dharmic_host
			}
			desc = coronation_events.6130.ending_dharmic_guest
		}
	}
	
	center_portrait = {
		character = scope:host
		animation = throne_room_bow_3
		camera = camera_event_center_pointing_right
	}
	right_portrait = {
		character = scope:anointer
		triggered_animation = {
			trigger = {
				scope:host = {
					coronation_events_6130_dharmic_trigger = yes
				}
			}
			animation = toast_goblet
		}
		animation = wedding_priest
		camera = camera_event_very_right
	}
	
	override_background = {
		trigger = {
			scope:host.capital_county = title:c_byzantion
		}
		reference = ep3_hagia_sophia
	}
	override_background = {
		trigger = {
			NOT = {
				scope:host.capital_county = title:c_byzantion
			}
		}
		reference = temple
	}
	override_effect_2d = {
		trigger = {
			scope:activity.var:activity_special_type_progression >= 75
			scope:activity = {
				has_activity_option = {
					category = special_type
					option = coronation_type_anointment
				}
			}
		}
		reference = legend_glow	
	}
	override_effect_2d = {
		trigger = {
			scope:activity.var:activity_special_type_progression < 25
		}
		reference = flies	
	}
	cooldown = { days = 20 }

	theme = coronation_activity

	trigger = {
		involved_activity ?= {
			activity_host = {
				NAND = {
					exists = faith.religious_head
					this = faith.religious_head
				}
			}
			OR = {
				activity_host.faith.religion  = religion:christianity_religion
				activity_host.faith.religion  = religion:judaism_religion
				activity_host = {
					coronation_events_6130_dharmic_trigger = yes
				}
				has_activity_option = {
					category = special_type
					option = coronation_type_anointment
				}
			}
		}
	}
	on_trigger_fail = {
		if = {
			limit = {
				coronation_being_crowned_trigger = yes
			}
			#Skip to crowning
			trigger_event = {
				id = coronation_events.6100
				days = 3
			}
		}
		else_if = {
			limit = {
				coronation_self_crowning_trigger = yes
			}
			#Skip to crowning self
			trigger_event = {
				id = coronation_events.6101
				days = 3
			}
		}
		else = {
			#Skip to enthroning
			trigger_event = {
				id = coronation_events.6102
				days = 3
			}
		}
	}
	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity = {
			activity_host = { save_scope_as = host }
			activity_location = { save_scope_as = location }
		}
		coronation_save_anointer_effect = yes
		scope:host = {
			save_scope_as = bg_override_char
		}
		#Resource adjustments only for host
		if = {
			limit = {
				this = scope:host
			}
			#Reward, adjusted by fervor
			scope:host = {
				if = {
					limit = {
						faith = {
							fervor >= 90
						}
					}
					every_vassal = {
						custom = custom.every_same_faith_vassal
						limit = {
							faith = scope:host.faith
						}
						add_opinion = {
							target = scope:host
							modifier = holy_anointment_opinion
							opinion = 20
						}
					}
					#Might need to show reason tooltip
					if = {
						limit = {
							NOT = {
								scope:activity = {
									has_activity_option = {
										category = special_type
										option = coronation_type_anointment
									}
								}
							}
						}
						custom_tooltip = coronation_rewards_increased_fervor_tt
					}
				}
				else_if = {
					limit = {
						faith = {
							fervor >= 80
						}
					}
					every_vassal = {
						custom = custom.every_same_faith_vassal
						limit = {
							faith = scope:host.faith
						}
						add_opinion = {
							target = scope:host
							modifier = holy_anointment_opinion
							opinion = 15
						}
					}
					#Might need to show reason tooltip
					if = {
						limit = {
							NOT = {
								scope:activity = {
									has_activity_option = {
										category = special_type
										option = coronation_type_anointment
									}
								}
							}
						}
						custom_tooltip = coronation_rewards_increased_fervor_tt
					}
				}
				else_if = {
					limit = {
						faith = {
							fervor >= 70
						}
					}
					every_vassal = {
						custom = custom.every_same_faith_vassal
						limit = {
							faith = scope:host.faith
						}
						add_opinion = {
							target = scope:host
							modifier = holy_anointment_opinion
							opinion = 10
						}
					}
					#Might need to show reason tooltip
					if = {
						limit = {
							NOT = {
								scope:activity = {
									has_activity_option = {
										category = special_type
										option = coronation_type_anointment
									}
								}
							}
						}
						custom_tooltip = coronation_rewards_increased_fervor_tt
					}
				}
				else_if = {
					limit = {
						faith = {
							fervor >= 60
						}
					}
					every_vassal = {
						custom = custom.every_same_faith_vassal
						add_opinion = {
							target = scope:host
							modifier = holy_anointment_opinion
							opinion = 5
						}
					}
					#Might need to show reason tooltip
					if = {
						limit = {
							NOT = {
								scope:activity = {
									has_activity_option = {
										category = special_type
										option = coronation_type_anointment
									}
								}
							}
						}
						custom_tooltip = coronation_rewards_increased_fervor_tt
					}
				}
				else_if = {
					limit = {
						faith = {
							fervor < 30
						}
					}
					every_vassal = {
						custom = custom.every_different_faith_vassal
						limit = {
							NOT = { faith = scope:host.faith }
						}
						add_opinion = {
							target = scope:host
							modifier = heathen_anointment_opinion
							opinion = -5
						}
					}
					#Might need to show reason tooltip
					if = {
						limit = {
							NOT = {
								scope:activity = {
									has_activity_option = {
										category = special_type
										option = coronation_type_anointment
									}
								}
							}
						}
						custom_tooltip = coronation_rewards_reduced_fervor_tt
					}
				}
				else_if = {
					limit = {
						faith = {
							fervor < 20
						}
					}
					every_vassal = {
						custom = custom.every_different_faith_vassal
						limit = {
							NOT = { faith = scope:host.faith }
						}
						add_opinion = {
							target = scope:host
							modifier = heathen_anointment_opinion
							opinion = -10
						}
					}
					#Might need to show reason tooltip
					if = {
						limit = {
							NOT = {
								scope:activity = {
									has_activity_option = {
										category = special_type
										option = coronation_type_anointment
									}
								}
							}
						}
						custom_tooltip = coronation_rewards_reduced_fervor_tt
					}
				}
				else_if = {
					limit = {
						faith = {
							fervor < 10
						}
					}
					every_vassal = {
						custom = custom.every_different_faith_vassal
						limit = {
							NOT = { faith = scope:host.faith }
						}
						add_opinion = {
							target = scope:host
							modifier = heathen_anointment_opinion
							opinion = -15
						}
					}
					#Might need to show reason tooltip
					if = {
						limit = {
							NOT = {
								scope:activity = {
									has_activity_option = {
										category = special_type
										option = coronation_type_anointment
									}
								}
							}
						}
						custom_tooltip = coronation_rewards_reduced_fervor_tt
					}
				}
				#Anointment rewards if root is host
				if = {
					limit = {
						this = root
						scope:activity = {
							has_activity_option = {
								category = special_type
								option = coronation_type_anointment
							}
						}
					}
					#Scale rewards based on fervor
					if = {
						limit = {
							faith = {
								fervor >= 100
							}
						}
						every_vassal = {
							custom = custom.every_zealot_vassal
							add_opinion = {
								target = scope:host
								modifier = holy_anointment_opinion
								opinion = 30
							}
						}
						add_legitimacy = {
							value = medium_legitimacy_gain
							multiply = 2
						}
						add_piety = {
							value = major_piety_gain
							multiply = 2
						}
						custom_tooltip = coronation_rewards_increased_fervor_tt
					}
					else_if = {
						limit = {
							faith = {
								fervor >= 80
							}
						}
						every_vassal = {
							custom = custom.every_zealot_vassal
							add_opinion = {
								target = scope:host
								modifier = holy_anointment_opinion
								opinion = 28
							}
						}
						add_legitimacy = {
							value = medium_legitimacy_gain
							multiply = 1.8
						} 
						add_piety = {
							value = major_piety_gain
							multiply = 1.8
						}
						custom_tooltip = coronation_rewards_increased_fervor_tt
					}
					else_if = {
						limit = {
							faith = {
								fervor >= 60
							}
						}
						every_vassal = {
							custom = custom.every_zealot_vassal
							add_opinion = {
								target = scope:host
								modifier = holy_anointment_opinion
								opinion = 26
							}
						}
						add_legitimacy = {
							value = medium_legitimacy_gain
							multiply = 1.6
						} 
						add_piety = {
							value = major_piety_gain
							multiply = 1.6
						}
						custom_tooltip = coronation_rewards_increased_fervor_tt
					}
					else_if = {
						limit = {
							faith = {
								fervor >= 40
							}
						}
						every_vassal = {
							custom = custom.every_zealot_vassal
							add_opinion = {
								target = scope:host
								modifier = holy_anointment_opinion
								opinion = 24
							}
						}
						add_legitimacy = {
							value = medium_legitimacy_gain
							multiply = 1.4
						} 
						add_piety = {
							value = major_piety_gain
							multiply = 1.4
						}
						custom_tooltip = coronation_rewards_reduced_fervor_tt
					}
					else_if = {
						limit = {
							faith = {
								fervor >= 20
							}
						}
						every_vassal = {
							custom = custom.every_zealot_vassal
							add_opinion = {
								target = scope:host
								modifier = holy_anointment_opinion
								opinion = 22
							}
						}
						add_legitimacy = {
							value = medium_legitimacy_gain
							multiply = 1.2
						}
						add_piety = {
							value = major_piety_gain
							multiply = 1.2
						}
						custom_tooltip = coronation_rewards_reduced_fervor_tt
					}
					else = {
						every_vassal = {
							custom = custom.every_zealot_vassal
							add_opinion = {
								target = scope:host
								modifier = holy_anointment_opinion
								opinion = 20
							}
						}
						add_legitimacy = {
							value = medium_legitimacy_gain
							multiply = 1
						}
						add_piety = {
							value = major_piety_gain
							multiply = 1
						}
						custom_tooltip = coronation_rewards_reduced_fervor_tt
					}
				}
			}
		}
	}
	#I am sooo ready to fight for the faith
	option = {
		trigger = {
			this = scope:host
			NOT = {
				has_trait = faith_warrior
			}
			faith = {
				fervor >= 75
			}
			trigger_if = {
				limit = {
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = coronation_type_anointment
						}
					}
				}
				has_focus_martial = yes
			}
			trigger_else = {
				has_focus_martial = yes
				OR = {
					has_trait = education_martial_3
					has_trait = education_martial_4
					has_trait = education_martial_5
				}
			}
		}
		name = {
			trigger = {
				scope:host = {
					coronation_events_6130_dharmic_trigger = no
				}
			}
			text = coronation_events.6130.a
		}
		name = {
			trigger = {
				scope:host = {
					coronation_events_6130_dharmic_trigger = yes
				}
			}
			text = coronation_events.6130.a_dharmic
		}
		flavor = coronation_events.6130.a.flavor
		reason = lifestyle_focus

		#Kingdom tier holy war gives crusader trait
		custom_tooltip = crusader_from_k_holy_war_tt
		set_variable = {
			name = k_holy_war_crusader
		}
		stress_impact = {
			zealous = major_stress_impact_loss
			wrathful = miniscule_stress_impact_loss
			vengeful = minor_stress_impact_loss
			sadistic = miniscule_stress_impact_loss
			brave = miniscule_stress_impact_loss
			compassionate = minor_stress_impact_gain
			cynical = medium_stress_impact_gain
			craven = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 100
				OR = {
					has_trait = zealous
					has_trait = wrathful
					has_trait = vengeful
					has_trait = sadistic
					has_trait = brave
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = cynical
					has_trait = craven
				}
			}
		}
	}
	#It is now my duty to CONVERT
	option = {
		trigger = {
			this = scope:host
			trigger_if = {
				limit = {
					NOR = {
						has_trait = zealous
						has_trait = diligent
						has_trait = just
						has_trait = ambitious
						has_trait = arrogant
						has_trait = impatient
					}
				}
				learning >= decent_skill_rating
			}
			trigger_else = {
				OR = {
					has_trait = zealous
					has_trait = diligent
					has_trait = just
					has_trait = ambitious
					has_trait = arrogant
					has_trait = impatient
				}
			}
		}
		name = coronation_events.6130.b

		
		#conversion interactions acceptance bonus
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = coronation_type_anointment
					}
				}
			}
			custom_tooltip = conversion_acceptance_bonus_tt
			add_character_flag = conversion_acceptance_bonus
		}
		else = {
			custom_tooltip = conversion_acceptance_bonus_low_tt
			add_character_flag = conversion_acceptance_bonus_low
		}
		
		stress_impact = {
			zealous = major_stress_impact_loss
			content = minor_stress_impact_gain
			cynical = major_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 150
			modifier = {
				add = 100
				has_trait = zealous
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = humble
					has_trait = cynical
					has_trait = content
				}
			}
		}
	}
	#Express gratitude to the priest
	option = {
		trigger = {
			this = scope:host
			OR = {
				has_trait = gregarious
				has_trait = zealous
				has_trait = compassionate
				has_trait = humble
				has_trait = generous
				has_trait = trusting
			}
			#Not a temp character
			NOT = {
				scope:anointer = {
					has_character_flag = anointer_destroy_me
				}
			}
		}
		name = {
			trigger = {
				scope:host = {
					coronation_events_6130_dharmic_trigger = no
				}
			}
			text = coronation_events.6130.c
		}
		name = {
			trigger = {
				scope:host = {
					coronation_events_6130_dharmic_trigger = yes
				}
			}
			text = coronation_events.6130.c_dharmic
		}
		flavor = coronation_events.6130.c.flavor
		scope:anointer = {
			add_opinion = {
				target = scope:host
				modifier = pleased_opinion
				opinion = 20
			}
			hidden_effect = {
				reverse_add_opinion = {
					target = scope:host
					modifier = respect_opinion
					opinion = 25
				}
			}
			if = {
				limit = {
					involved_activity ?= scope:activity
				}
				coronation_move_towards_supporter_effect = { CHARACTER = scope:anointer }
			}
		}
		stress_impact = {
			zealous = medium_stress_impact_loss
			humble = miniscule_stress_impact_loss
			arrogant = minor_stress_impact_gain
			cynical = medium_stress_impact_gain
			fickle = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 50
				OR = {
					has_trait = humble
					has_trait = zealous
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = fickle
					has_trait = cynical
					has_trait = arrogant
				}
			}
		}	
	}
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							this = scope:host
							ai_zeal >= low_positive_ai_value
							scope:host = {
								coronation_events_6130_dharmic_trigger = no
							}
						}
						desc = coronation_events.6130.d.faithful_host
					}
					triggered_desc = {
						trigger = {
							this = scope:host
							ai_zeal >= low_positive_ai_value
							scope:host = {
								coronation_events_6130_dharmic_trigger = yes
							}
						}
						desc = coronation_events.6130.d.faithful_host_dharmic
					}
					triggered_desc = {
						trigger = {
							this = scope:host
						}
						desc = coronation_events.6130.d.cynical_host
					}
					triggered_desc = {
						trigger = {
							ai_zeal >= low_positive_ai_value
							scope:host = {
								coronation_events_6130_dharmic_trigger = yes
							}
							opinion = {
								target = scope:host
								value > 0
							}
						}
						desc = coronation_events.6130.d.faithful_guest_dharmic
					}
					triggered_desc = {
						trigger = {
							ai_zeal >= low_positive_ai_value
							opinion = {
								target = scope:host
								value > 0
							}
						}
						desc = coronation_events.6130.d.faithful_guest
					}
					desc = coronation_events.6130.d.cynical_guest
				}
			}
		}
		#Some piety for viewers
		if = {
			limit = {
				faith = scope:host.faith
				NOT = { this = scope:host }
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = coronation_type_anointment
					}
				}
			}
			add_piety = miniscule_piety_gain
		}
		#Faith gains fervor if this is anointment
		scope:host = {
			if = {
				limit = {
					this = root
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = coronation_type_anointment
						}
					}
				}
				add_piety = medium_piety_gain
				faith = {
					change_fervor = {
						value = 4
						desc = fervor_gain_anointment
					}
				}
				add_character_modifier = {
					modifier = coronation_anointed_imperial_modifier
					years = 10
				}
			}
			else_if = {
				limit = {
					this = root
				}
				add_piety = minor_piety_gain
				add_character_modifier = {
					modifier = coronation_anointed_modifier
					years = 10
				}
			}
			#To show audience
			else_if = {
				limit = {
					NOT = { this = root }
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = coronation_type_anointment
						}
					}
				}
				show_as_tooltip = {
					add_piety = medium_piety_gain
					add_character_modifier = {
						modifier = coronation_anointed_modifier
						years = 10
					}
					faith = {
						change_fervor = {
							value = 4
							desc = fervor_gain_anointment
						}
					}
				}
			}
			else_if = {
				limit = {
					NOT = { this = root }
				}
				show_as_tooltip = {
					add_piety = medium_piety_gain
					add_character_modifier = {
						modifier = coronation_anointed_modifier
						years = 10
					}
				}
			}
		}

		stress_impact = {
			zealous = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}
	after = {
		# For MP
		coronation_ready_effect = yes

		if = {
			limit = {
				coronation_being_crowned_trigger = yes
			}
			#crowning
			trigger_event = {
				id = coronation_events.6100
				days = 3
			}
		}
		else_if = {
			limit = {
				coronation_self_crowning_trigger = yes
			}
			#self-crowning
			trigger_event = {
				id = coronation_events.6101
				days = 3
			}
		}
		else = {
			#enthroning
			trigger_event = {
				id = coronation_events.6102
				days = 3
			}
		}
	}
}

scripted_effect coronation_events_6140_spouse_effects = {
	add_prestige = coronation_spouse_prestige_value
	if = {
		limit = {
			government_allows = administrative
			top_liege.primary_title = scope:host.top_liege.primary_title
		}
		change_influence = coronation_spouse_influence_value
	}
	if = {
		limit = {
			NOT = {
				this = root
			}
			is_ai = yes
			OR = {
				has_trait = arrogant
				has_trait = ambitious
				has_trait = greedy
				has_trait = diligent
				has_trait = impatient
				has_trait = gregarious
			}
			NOR = {
				has_trait = humble
				has_trait = content
				has_trait = shy
			}
		}
		add_stress = coronation_spouse_stress_value
	}
	if = {
		limit = {
			OR = {
				scope:activity.var:activity_special_type_progression >= 25
				AND = {
					scope:activity.var:activity_special_type_progression < 25
					scope:host.highest_held_title_tier >= tier_empire
				}
			}
		}
		scope:activity = {
			every_attending_character = {
				custom = custom.every_attending_character
				limit = {
					NOT = {
						this = scope:spouse
					}
				}
				add_opinion = {
					target = scope:spouse
					modifier = crowned_consort_opinion
					opinion = coronation_spouse_opinion_value
				}
			}
		}
	}
	custom_tooltip = coronation_magnificence_spouse_effects_tt
}

#Spouse's crowning/enthronement event
coronation_events.6140 = {
	type = activity_event
	title = coronation_events.6140.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					this = scope:spouse
				}
				desc = {
					first_valid = {
						triggered_desc = {
							trigger = {
								scope:host = {
									any_consort = {
										NOT = {
											this = scope:spouse
										}
									}
								}
							}
							desc = coronation_events.6140_desc_polygamous_spouse
						}
						desc = coronation_events.6140_desc_intro_spouse
					}
					desc = coronation_events.6140_desc_spouse
					first_valid = {
						triggered_desc = {
							trigger = {
								scope:spouse = {
									NOT = {
										knows_language_of_culture = scope:host.culture
									}
								}
								scope:host = {
									has_royal_court = no
								}
							}
							desc = coronation_events.6140_desc_foreign_wife_no_court_spouse
						}
						triggered_desc = {
							trigger = {
								scope:host = {
									has_royal_court = yes
								}
								scope:spouse = {
									NOR = {
										knows_court_language_of = scope:host
										culture = scope:host.culture
									}
								}
							}
							desc = coronation_events.6140_desc_foreign_wife_spouse
						}
						triggered_desc = {
							trigger = {
								scope:spouse = {
									OR = {
										is_lowborn = yes
										AND = {
											dynasty ?= {
												dynasty_prestige_level <= 1
											}
											NOR = {
												any_parent = {
													highest_held_title_tier >= tier_kingdom
												}
												any_sibling = {
													highest_held_title_tier >= tier_kingdom
												}
											}
											learning < high_skill_rating
										}
									}
								}
							}
							desc = coronation_events.6140_desc_lowly_wife_spouse
						}
						triggered_desc = {
							trigger = {
								scope:spouse = {
									dynasty ?= {
										dynasty_prestige_level >= 3
									}
									OR = {
										AND = {
											dynasty ?= {
												dynasty_prestige_level >= 7
											}
											house ?= {
												any_house_member = {
													highest_held_title_tier >= tier_kingdom
												}
											}
										}
										any_parent = {
											highest_held_title_tier >= tier_kingdom
										}
										any_sibling = {
											highest_held_title_tier >= tier_kingdom
										}
									}
									learning >= average_skill_rating
								}
							}
							desc = coronation_events.6140_desc_regal_wife_spouse
						}
						desc = coronation_events.6140_desc_mid_wife_spouse
					}
					first_valid = {
						triggered_desc = {
							trigger = {
								scope:host = {
									coronation_proper_artifact_regalia_trigger = no
								}
							}
							desc = coronation_events.6140_desc_crown_spouse
						}
						desc = coronation_events.6140_desc_neutral_spouse
					}
				}
			}
			desc = {
				first_valid = {
					triggered_desc = {
						trigger = {
							scope:host = {
								any_consort = {
									NOT = {
										this = scope:spouse
									}
								}
							}
						}
						desc = coronation_events.6140_desc_polygamous
					}
					desc = coronation_events.6140_desc
				}
				first_valid = {
					triggered_desc = {
						trigger = {
							NOR = {
								this = scope:host
								this = scope:spouse
							}
						}
						desc = coronation_events.6140_desc_guest
					}
					desc = coronation_events.6140_desc_host
				}
				first_valid = {
					triggered_desc = {
						trigger = {
							scope:spouse = {
								NOT = {
									knows_language_of_culture = scope:host.culture
								}
							}
							scope:host = {
								has_royal_court = no
							}
						}
						desc = coronation_events.6140_desc_foreign_wife_no_court
					}
					triggered_desc = {
						trigger = {
							scope:host = {
								has_royal_court = yes
							}
							scope:spouse = {
								NOR = {
									knows_court_language_of = scope:host
									culture = scope:host.culture
								}
							}
						}
						desc = coronation_events.6140_desc_foreign_wife
					}
					triggered_desc = {
						trigger = {
							scope:spouse = {
								OR = {
									is_lowborn = yes
									AND = {
										dynasty ?= {
											dynasty_prestige_level <= 1
										}
										NOR = {
											any_parent = {
												highest_held_title_tier >= tier_kingdom
											}
											any_sibling = {
												highest_held_title_tier >= tier_kingdom
											}
										}
										learning < high_skill_rating
									}
								}
							}
						}
						desc = coronation_events.6140_desc_lowly_wife
					}
					triggered_desc = {
						trigger = {
							scope:spouse = {
								dynasty ?= {
									dynasty_prestige_level >= 3
								}
								OR = {
									AND = {
										dynasty ?= {
											dynasty_prestige_level >= 7
										}
										house ?= {
											any_house_member = {
												highest_held_title_tier >= tier_kingdom
											}
										}
									}
									any_parent = {
										highest_held_title_tier >= tier_kingdom
									}
									any_sibling = {
										highest_held_title_tier >= tier_kingdom
									}
								}
								learning >= average_skill_rating
							}
						}
						desc = coronation_events.6140_desc_regal_wife
					}
					desc = coronation_events.6140_desc_mid_wife
				}
				first_valid = {
					triggered_desc = {
						trigger = {
							scope:host = {
								coronation_proper_artifact_regalia_trigger = no
							}
						}
						desc = coronation_events.6140_desc_crown
					}
					desc = coronation_events.6140_desc_neutral
				}
			}
		}
	}
	left_portrait = {
		character = scope:host
		triggered_animation = {
			trigger = {
				scope:host = {
					OR = {
						has_relation_lover = scope:spouse
						has_relation_crush = scope:spouse
						has_relation_soulmate = scope:spouse
					}
				}
			}
			animation = love
		}
		triggered_animation = {
			trigger = {
				scope:host = {
					OR = {
						has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:spouse }
						opinion = {
							target = scope:spouse
							value < -60
						}
					}
				}
			}
			animation = disapproval
		}
		triggered_animation = {
			trigger = {
				OR = {
					scope:host.religion = religion:eastern_orthodox_religion 
					scope:host.religion = religion:catholic_religion 
					scope:host.religion = religion:protestant_religion 
					scope:spouse.religion = religion:eastern_orthodox_religion 
					scope:spouse.religion = religion:catholic_religion 
					scope:spouse.religion = religion:protestant_religion 
				}
			}
			animation = scepter
		}
		triggered_animation = {
			trigger = {
				scope:host = {
					coronation_host_east_asian_trigger = yes
				}
			}
			animation = emperor
		}
		triggered_animation = {
			trigger = {
				scope:host = {
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:host }
				}
			}
			animation = marshal
		}
		animation = chaplain
		camera = camera_event_left_to_the_left_pointing_in
	}
	center_portrait = {
		character = scope:spouse
		triggered_animation = {
			trigger = {
				scope:host = {
					OR = {
						has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:spouse }
						opinion = {
							target = scope:spouse
							value < -60
						}
					}
				}
				scope:spouse = {
					OR = {
						ai_greed > medium_positive_ai_value
						ai_honor < medium_negative_ai_value
						ai_compassion < medium_negative_ai_value
					}
				}
			}
			animation = manic
		}
		triggered_animation = {
			trigger = {
				scope:spouse = {
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:host }
					ai_has_warlike_personality = yes
				}
			}
			animation = wedding_objection_start
		}
		triggered_animation = {
			trigger = {
				OR = {
					scope:host.religion = religion:eastern_orthodox_religion 
					scope:host.religion = religion:catholic_religion 
					scope:host.religion = religion:protestant_religion 
					scope:spouse.religion = religion:eastern_orthodox_religion 
					scope:spouse.religion = religion:catholic_religion 
					scope:spouse.religion = religion:protestant_religion 
				}
				ai_zeal < medium_positive_ai_value
			}
			animation = acknowledging
		}
		animation = prayer
		camera = camera_event_center
	}
	right_portrait = {
		character = scope:anointer
		triggered_animation = {
			trigger = {
				scope:anointer.faith = {
					has_doctrine_parameter = unreformed
				}
			}
			animation = throne_room_bow_2
		}
		animation = chancellor
		camera = camera_event_very_right
	}
	
	override_background = {
		trigger = {
			NOT = {
				scope:host.capital_county = title:c_byzantion
			}
			coronation_being_crowned_trigger = no
			coronation_self_crowning_trigger = no
		}
		reference = throne_room
	}
	override_background = {
		trigger = {
			scope:host.capital_county = title:c_byzantion
			OR = {
				coronation_being_crowned_trigger = yes
				coronation_self_crowning_trigger = yes
			}
		}
		reference = ep3_hagia_sophia
	}
	override_background = {
		trigger = {
			NOT = {
				scope:host.capital_county = title:c_byzantion
			}
			OR = {
				coronation_being_crowned_trigger = yes
				coronation_self_crowning_trigger = yes
			}
		}
		reference = temple
	}
	override_effect_2d = {
		trigger = {
			scope:activity.var:activity_special_type_progression >= 75
		}
		reference = legend_glow	
	}
	override_effect_2d = {
		trigger = {
			scope:activity.var:activity_special_type_progression < 25
		}
		reference = flies	
	}
	cooldown = { days = 20 }

	theme = coronation_activity

	trigger = {
		exists = involved_activity.activity_host.primary_spouse
		involved_activity = {
			any_attending_character = {
				this = involved_activity.activity_host.primary_spouse
				NOR = {
					has_contagious_deadly_disease_trigger = yes
					has_trait = incapable
					has_trait = wounded_3
					is_imprisoned = yes
				}
			}
		}
	}
	on_trigger_fail = {
		#Ceremony is over
		if = {
			limit = {
				this = involved_activity.activity_host
			}
			# Oath Events
			trigger_event = {
				id = coronation_events.0100
				days = 2
			}
		}
	}
	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity = {
			activity_host = { save_scope_as = host }
			activity_location = { save_scope_as = location }
		}
		scope:host = {
			save_scope_as = bg_override_char
			primary_spouse = {
				save_scope_as = spouse
			}
		}
		#Save an anointer if you don't have one
		if = {
			limit = {
				OR = {
					NOT = { exists = scope:anointer }
					scope:anointer = {
						is_alive = no
					}
					scope:anointer = {
						is_imprisoned = yes
					}
				}
			}
			scope:host = { coronation_save_anointer_effect = yes }
		}
		if = {
			limit = {
				OR = {
					AND = {
						this = scope:host
						scope:spouse = {
							is_ai = yes
						}
					}
					AND = {
						this = scope:spouse
						is_ai = no
					}
				}
			}
			scope:spouse = {
				coronation_events_6140_spouse_effects = yes
			}
		}
		else = {
			scope:spouse = {
				show_as_tooltip = {	coronation_events_6140_spouse_effects = yes }
			}
		}
		scope:spouse = {
			assign_quirk_effect = yes
		}
		assign_quirk_effect = yes
	}
	#Your spouse converts
	option = {
		trigger = {
			this = scope:host
			scope:spouse = {
				NOT = {
					faith = root.faith
				}
				is_ai = yes
			}
			scope:activity = {
				has_activity_option = {
					category = special_type
					option = coronation_type_anointment
				}
				var:activity_special_type_progression > 50
			}
		}
		name = coronation_events.6140.aa
		flavor = coronation_events.6140.aa.flavor

		duel = {
			skill = diplomacy
			target = scope:spouse
			#You convince her
			55 = {
				compare_modifier = {
					 value = scope:duel_value
					 multiplier = 3.5
					 min = -49
				}
				modifier = {
					add = 20
					scope:spouse = {
						opinion = {
							target = scope:host
							value >= 25
						}
					}
				}
				modifier = {
					add = 20
					scope:spouse = {
						opinion = {
							target = scope:host
							value >= 50
						}
					}
				}
				modifier = {
					add = 25
					scope:spouse = {
						opinion = {
							target = scope:host
							value >= 75
						}
					}
				}
				modifier = {
					add = 30
					scope:spouse = {
						opinion = {
							target = scope:host
							value >= 90
						}
					}
				}
				modifier = {
					add = 30
					scope:activity.var:activity_special_type_progression >= 75
				}
				modifier = {
					add = 20
					scope:spouse = {
						OR = {
							has_trait = trusting
							has_trait = fickle
						}
					}
				}

				desc = coronation_events.6140.aa_success
				send_interface_toast = {
					type = event_toast_effect_good
					title = coronation_events.6140.aa_success
					right_icon = scope:spouse 
				
					scope:spouse = {
						set_character_faith = scope:host.faith
					}
				}
			}	
			#She is not convinced
			45 	= {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				modifier = {
					add = 20
					scope:spouse = {
						opinion = {
							target = scope:host
							value <= -25
						}
					}
				}
				modifier = {
					add = 20
					scope:spouse = {
						opinion = {
							target = scope:host
							value <= -50
						}
					}
				}
				modifier = {
					add = 30
					scope:spouse = {
						opinion = {
							target = scope:host
							value <= -75
						}
					}
				}
				modifier = {
					add = 50
					scope:spouse = {
						opinion = {
							target = scope:host
							value <= -90
						}
					}
				}
				modifier = {
					add = 100
					scope:spouse = {
						OR = {
							has_trait = zealous
							has_trait = stubborn
						}
					}
				}
				modifier = {
					add = 20
					scope:spouse.faith = {
						faith_hostility_level = {
							target = scope:host.faith
							value >= faith_hostile_level
						}
					}
				}
				modifier = {
					add = 20
					scope:spouse.faith = {
						faith_hostility_level = {
							target = scope:host.faith
							value >= faith_evil_level
						}
					}
				}
				modifier = {
					add = 50
					scope:spouse = {
						highest_held_title_tier >= scope:host.highest_held_title_tier
					}
				}
				modifier = {
					add = 50
					scope:spouse = {
						highest_held_title_tier >= tier_county
					}
				}
				modifier = {
					add = 50
					scope:spouse = {
						highest_held_title_tier >= tier_county
						NOT = {
							is_vassal_of = scope:host
						}
					}
				}
				desc = coronation_events.6140.aa_fail
				send_interface_toast = {
					type = event_toast_effect_bad
					title = coronation_events.6140.aa_fail
					right_icon = scope:spouse 

					scope:spouse = {
						add_opinion = {
							modifier = annoyed_opinion
							target = scope:host
							opinion = -15
						}
						
					}
				}
			}
		}
		custom_tooltip = anointment_available_because_magnificence_tt
		stress_impact = {
			zealous = major_stress_impact_loss
			cynical = minor_stress_impact_gain
			forgiving = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 100
				scope:spouse = {
					highest_held_title_tier < tier_county
				}
			}
			modifier = {
				add = 300
				has_trait = zealous
			}
			modifier = {
				diplomacy > high_skill_rating
				add = 100
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = forgiving
					scope:spouse.highest_held_title_tier > root.highest_held_title_tier
					diplomacy <= low_skill_rating
				}
			}
		}
	}
	#I must get rid of this person...
	option = {
		trigger = {
			this = scope:host
			NOR = {
				has_relation_soulmate = scope:spouse
				has_relation_best_friend = scope:spouse
			}
		}
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							OR = {
								has_any_good_relationship_with_character_trigger = { CHARACTER = scope:spouse }
								opinion = {
									target = scope:spouse
									value >= 90
								}
							}
						}
						desc = coronation_events.6140.a_like
					}
					triggered_desc = {
						trigger = {
							OR = {
								has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:spouse }
								opinion = {
									target = scope:spouse
									value < -60
								}
							}
						}
						desc = coronation_events.6140.a_dislike
					}
					desc = coronation_events.6140.a
				}
			}
		}
		#Rivalry progress
		if = {
			limit = {
				OR = {
					scope:spouse = {
						is_ai = yes
					}
					AND = {
						is_ai = no
						scope:spouse = {
							is_ai = no
						}
					}
				}
			}
			progress_towards_rival_effect = {
				REASON = rival_despised_mutual_coronation
				CHARACTER = scope:spouse
				OPINION = 0
			}
		}
		#Bonus towards hostile schemes against spouse
		custom_tooltip = coronation_spouse_hostile_scheme_bonus_tt
		set_variable = {
			name = spouse_hostile_scheme_bonus
			value = scope:spouse
		}
		
		hidden_effect = {
			add_opinion = {
				target = scope:spouse
				modifier = hate_opinion
				opinion = -40
			}
		}
		if = {
			limit = {
				OR = {
					has_relation_friend = scope:spouse
					has_relation_lover = scope:spouse
				}
			}
			stress_impact = {
				base = medium_stress_impact_gain
				callous = medium_stress_impact_loss
				sadistic = medium_stress_impact_loss
				lustful = minor_stress_impact_loss
				arrogant = minor_stress_impact_loss
	
				compassionate = major_stress_impact_gain
				just = medium_stress_impact_gain
				forgiving = medium_stress_impact_gain
				honest = minor_stress_impact_gain
				humble = minor_stress_impact_gain
				content = minor_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				callous = medium_stress_impact_loss
				sadistic = medium_stress_impact_loss
				lustful = minor_stress_impact_loss
				arrogant = minor_stress_impact_loss
	
				compassionate = major_stress_impact_gain
				just = medium_stress_impact_gain
				forgiving = medium_stress_impact_gain
				honest = minor_stress_impact_gain
				humble = minor_stress_impact_gain
				content = minor_stress_impact_gain
			}
		}
		ai_chance = {
			base = -10
			ai_value_modifier = {
				ai_compassion = -0.5
			}
			opinion_modifier = {
				who = root
				opinion_target = scope:spouse
				multiplier = -1
			}
			modifier = {
				add = 500
				has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:spouse }
			}
			modifier = {
				add = -200
				scope:spouse = {
					OR = {
						house ?= {
							any_house_member = {
								is_allied_to = scope:host
							}
						}
						any_close_family_member = {
							is_allied_to = scope:host
						}
					}
					
				}
			}
			modifier = {
				add = 10
				scope:spouse = {
					is_lowborn = yes
				}
			}
			modifier = {
				add = 10
				scope:spouse = {
					fertility <= low_fertility
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = just
					has_trait = forgiving
					has_trait = honest
					has_trait = humble
					has_trait = content 
					has_any_good_relationship_with_character_trigger = { CHARACTER = scope:spouse }
				}
			}
		}
	}
	#Yay! MAI WIFE
	option = {
		trigger = {
			this = scope:host
		}
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							OR = {
								has_relation_lover = scope:spouse
								has_relation_soulmate = scope:spouse
								opinion = {
									target = scope:spouse
									value >= 90
								}
							}
						}
						desc = coronation_events.6140.b_like
					}
					triggered_desc = {
						trigger = {
							OR = {
								has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:spouse }
								opinion = {
									target = scope:spouse
									value < -60
								}
							}
						}
						desc = coronation_events.6140.b_dislike
					}
					desc = coronation_events.6140.b
				}
			}
		}
		reverse_add_opinion = {
			modifier = grateful_opinion
			target = scope:spouse
			opinion = 15
		}
		hidden_effect = {
			add_opinion = {
				modifier = grateful_opinion
				target = scope:spouse
				opinion = 5
			}
		}
		ai_chance = {
			base = 100
		}
	}
	#I am the spouse
	option = {
		trigger = {
			this = scope:spouse
		}
		name = coronation_events.6140.c
		flavor = coronation_events.6140.c_flavor
		if = {
			limit = {
				scope:activity.var:activity_special_type_progression >= 75
				scope:host.highest_held_title_tier >= tier_empire
				is_ai = no
			}
			stress_impact = {
				arrogant = massive_stress_impact_loss
				ambitious = massive_stress_impact_loss
				greedy = massive_stress_impact_loss
				diligent = massive_stress_impact_loss
				impatient = massive_stress_impact_loss
				gregarious = massive_stress_impact_loss
				humble = miniscule_stress_impact_gain
				content = miniscule_stress_impact_gain
				shy = miniscule_stress_impact_gain
			}
		}
		else_if = {
			limit = {
				OR = {
					scope:activity.var:activity_special_type_progression >= 75
					AND = {
						scope:activity.var:activity_special_type_progression >= 50
						scope:host.highest_held_title_tier >= tier_empire
					}
				}
				is_ai = no
			}
			stress_impact = {
				arrogant = major_stress_impact_loss
				ambitious = major_stress_impact_loss
				greedy = major_stress_impact_loss
				diligent = major_stress_impact_loss
				impatient = major_stress_impact_loss
				gregarious = major_stress_impact_loss
				humble = miniscule_stress_impact_gain
				content = miniscule_stress_impact_gain
				shy = miniscule_stress_impact_gain
			}
		}
		else_if = {
			limit = {
				OR = {
					scope:activity.var:activity_special_type_progression >= 50
					AND = {
						scope:activity.var:activity_special_type_progression >= 25
						scope:host.highest_held_title_tier >= tier_empire
					}
				}
				is_ai = no
			}
			stress_impact = {
				arrogant = medium_stress_impact_loss
				ambitious = medium_stress_impact_loss
				greedy = medium_stress_impact_loss
				diligent = medium_stress_impact_loss
				impatient = medium_stress_impact_loss
				gregarious = medium_stress_impact_loss
				humble = miniscule_stress_impact_gain
				content = miniscule_stress_impact_gain
				shy = miniscule_stress_impact_gain
			}
		}
		else_if = {
			limit = {
				is_ai = no
				OR = {
					scope:activity.var:activity_special_type_progression >= 25
					AND = {
						scope:activity.var:activity_special_type_progression < 25
						scope:host.highest_held_title_tier >= tier_empire
					}
				}
			}
			stress_impact = {
				arrogant = minor_stress_impact_loss
				ambitious = minor_stress_impact_loss
				greedy = minor_stress_impact_loss
				diligent = minor_stress_impact_loss
				impatient = minor_stress_impact_loss
				gregarious = minor_stress_impact_loss
				humble = miniscule_stress_impact_gain
				content = miniscule_stress_impact_gain
				shy = miniscule_stress_impact_gain
			}
		}
		else_if = {
			limit = {
				is_ai = no
			}
			stress_impact = {
				arrogant = miniscule_stress_impact_loss
				ambitious = miniscule_stress_impact_loss
				greedy = miniscule_stress_impact_loss
				diligent = miniscule_stress_impact_loss
				impatient = miniscule_stress_impact_loss
				gregarious = miniscule_stress_impact_loss
				humble = miniscule_stress_impact_gain
				content = miniscule_stress_impact_gain
				shy = miniscule_stress_impact_gain
			}
		}
	}
	#I am an observer
	option = {
		trigger = {
			NOR = {
				this = scope:spouse
				this = scope:host
			}
		}
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							OR = {
								AND = {
									exists = scope:spouse.house
									house = scope:spouse.house
								}
								has_any_good_relationship_with_character_trigger = { CHARACTER = scope:spouse }
							}
						}
						desc = coronation_events.6140.d_likes_spouse
					}
					triggered_desc = {
						trigger = {
							OR = {
								scope:spouse = {
									any_close_family_member = {
										OR = {
											is_at_war_with = root
											has_relation_rival = root
											AND = {
												is_a_faction_member = yes
												is_vassal_of = root
											}
											AND = {
												root = {
													is_a_faction_member = yes
													liege ?= prev
												}
											}
										}
									}
								}
								has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:spouse }
							}
						}
						desc = coronation_events.6140.d_dislikes_spouse
					}
					triggered_desc = {
						trigger = {
							OR = {
								has_activity_intent = coronation_disrupt_loyalists
								is_target_in_variable_list = {
									name = major_detractor
									target = prev
								}
								AND = {
									is_a_faction_member = yes
									is_vassal_of = scope:host
								}
								has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
							}
						}
						desc = coronation_events.6140.d_dislikes_host
					}
					triggered_desc = {
						trigger = {
							OR = {
								has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host }
								has_activity_intent = coronation_offer_support
								is_allied_to = scope:host
							}
						}
						desc = coronation_events.6140.d_likes_host
					}
					desc = coronation_events.6140.d
				}
			}
		}
	}
	after = {
		#Ceremony is over
		if = {
			limit = {
				this = scope:host
			}
			# Oath Events
			trigger_event = {
				id = coronation_events.0100
				days = 2
			}
		}
    	# For MP
		coronation_ready_effect = yes
		if = {
			limit = {
				scope:anointer = {
					has_character_flag = anointer_destroy_me
				}
			}
			scope:anointer = {
				silent_disappearance_effect = yes
			}
		}
	}
}

scripted_trigger coronation_events_6150_neighbor_trigger = {
	involved_activity ?= scope:activity
	basic_is_available_ai = yes
	NOT = { is_in_guest_subset = { name = detractor } }
	highest_held_title_tier <= root.highest_held_title_tier
	is_tributary = no
	is_at_war = no
	NOR = {
		has_trait = conqueror
		has_trait = greatest_of_khans
		has_trait = ambitious
		has_trait = arrogant
		has_trait = paranoid
	}
	opinion = {
		target = root
		value > -20
	}
	current_military_strength <= root.half_current_military_strength
}

scripted_trigger coronation_events_6150_vassal_trigger = {
	basic_is_available_ai = yes
	is_vassal_of = root
	NOT = { is_obedient_to = root }
	NOR = {
		scope:advisor ?= this
		is_in_guest_subset = { name = detractor }
		trigger_if = {
			limit = {
				is_powerful_vassal_of = root
			}
			is_a_faction_member = yes
		}
		is_at_war_with = root
	}
	opinion = {
		target = root
		value >= -25
	}
}

#RANDOM EVENTS
#Your chancellor wants to do some major politics
coronation_events.6150 = {
	type = activity_event
	title = coronation_events.6150.t
	desc = coronation_events.6150.desc
	left_portrait = {
		character = root
		animation = personality_rational
		camera = camera_event_very_left
	}
	center_portrait = {
		character = scope:advisor
		animation = throne_room_chancellor
		camera = camera_event_center_pointing_very_left
	}
	right_portrait = {
		character = scope:neighbor
		triggered_animation = {
			trigger = {
				scope:neighbor = {
					opinion = {
						target = root
						value <= 0
					}
				}
			}
			animation = personality_content
		}
		animation = admiration
		camera = camera_event_right_to_the_right_more_right
	}
	lower_center_portrait = scope:disobedient_vassal
	lower_right_portrait = scope:confederate
	theme = coronation_activity
	cooldown = { months = 6 }

	trigger = {
		is_landed = yes

		NOT = {
			involved_activity = {
				has_activity_option = {
					category = ceremony_size
					option = coronation_small_ceremony
				}
			}
		}
		any_councillor = {
			involved_activity ?= scope:activity
			is_alive = yes
			is_imprisoned = no
			is_ai = yes
			is_incapable = no
			has_contagious_deadly_disease_trigger = no
			NOT = { is_in_guest_subset = { name = detractor } }
			diplomacy >= medium_skill_rating
		}
		any_neighboring_top_liege_realm_owner = {
			coronation_events_6150_neighbor_trigger = yes
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = -0.5
			is_ai = yes
		}
		modifier = {
			add = 2
			has_activity_intent = coronation_weaken_detractors
			any_neighboring_top_liege_realm_owner = {
				involved_activity ?= scope:activity
				basic_is_available_ai = yes
				OR = {
					is_confederation_member = yes
					suzerain ?= {
						is_confederation_member = yes
						NOT = {
							this = root
						}
					}
				}
			}
		}
		modifier = {
			add = 1
			has_activity_intent = coronation_embrace_supporters
			any_neighboring_top_liege_realm_owner = {
				coronation_events_6150_neighbor_trigger = yes
				is_in_guest_subset = { name = supporter }
				faith = {
					faith_hostility_level = {
						target = root.faith
						value <= faith.faith_hostile_level
					}
				}
			}
		}
		modifier = {
			add = 1
			has_activity_intent = coronation_impress_attendees
			scope:activity = {
				any_attending_character = {
					coronation_events_6150_vassal_trigger = yes
				}
			}
		}
		modifier = {
			add = 1
			any_councillor = {
				has_council_position = councillor_chancellor
				involved_activity ?= scope:activity
				is_alive = yes
				is_imprisoned = no
				is_ai = yes
				is_incapable = no
				has_contagious_deadly_disease_trigger = no
				is_in_guest_subset = { name = supporter }
				diplomacy >= high_skill_rating
				NOT = {
					is_a_faction_member = yes
				}
			}
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		#Save host and location
		scope:activity = {
			activity_location = { save_scope_as = location }
			activity_host = { save_scope_as = host }
		}
		ordered_councillor = {
			order_by = diplomacy
			#Get chancellor
			limit = {
				has_council_position = councillor_chancellor
				involved_activity ?= scope:activity
				is_alive = yes
				is_imprisoned = no
				is_ai = yes
				is_incapable = no
				has_contagious_deadly_disease_trigger = no
				NOT = { is_in_guest_subset = { name = detractor } }
				diplomacy >= medium_skill_rating
				NOT = {
					is_a_faction_member = yes
				}
			}
			#Get decently talented spouse
			alternative_limit = {
				has_council_position = councillor_spouse
				diplomacy >= high_skill_rating
				involved_activity ?= scope:activity
				is_alive = yes
				is_imprisoned = no
				is_ai = yes
				is_incapable = no
				has_contagious_deadly_disease_trigger = no
				NOT = { is_in_guest_subset = { name = detractor } }
				NOT = {
					is_a_faction_member = yes
				}
			}
			alternative_limit = {
				involved_activity ?= scope:activity
				is_alive = yes
				is_imprisoned = no
				is_ai = yes
				is_incapable = no
				has_contagious_deadly_disease_trigger = no
				NOT = { is_in_guest_subset = { name = detractor } }
				diplomacy >= medium_skill_rating
				NOT = {
					is_a_faction_member = yes
				}
			}
			save_scope_as = advisor
		}
		if = {
			limit = {
				has_activity_intent = coronation_embrace_supporters
				any_neighboring_top_liege_realm_owner = {
					coronation_events_6150_neighbor_trigger = yes
					is_in_guest_subset = { name = supporter }
					faith = {
						faith_hostility_level = {
							target = root.faith
							value <= faith.faith_hostile_level
						}
					}
				}
			}
			ordered_neighboring_top_liege_realm_owner = {
				order_by = "opinion(scope:host)"
				limit = {
					coronation_events_6150_neighbor_trigger = yes
					is_in_guest_subset = { name = supporter }
					faith = {
						faith_hostility_level = {
							target = root.faith
							value <= faith.faith_hostile_level
						}
					}
				}
				save_scope_as = neighbor
				save_scope_as = neighbor_supporter
			}
		}
		else = {
			ordered_neighboring_top_liege_realm_owner = {
				order_by = "opinion(scope:host)"
				limit = {
					coronation_events_6150_neighbor_trigger = yes
				}
				save_scope_as = neighbor
			}
		}
		if = {
			limit = {
				has_activity_intent = coronation_impress_attendees
				government_has_flag = government_is_nomadic
			}
			scope:activity = {
				ordered_attending_character = {
					order_by = "opinion(scope:host)"
					limit = {
						coronation_events_6150_vassal_trigger = yes
						is_councillor_of = root
					}
					alternative_limit = {
						highest_held_title_tier = root.highest_held_title_tier_minus_one
						coronation_events_6150_vassal_trigger = yes
					}
					alternative_limit = {
						coronation_events_6150_vassal_trigger = yes
					}
					save_scope_as = disobedient_vassal
				}
			}
		}
		#Get confederation to break up
		if = {
			limit = {
				has_activity_intent = coronation_weaken_detractors
			}
			ordered_neighboring_top_liege_realm_owner = {
				order_by = ai_greed
				limit = {
					involved_activity ?= scope:activity
					basic_is_available_ai = yes
					confederation ?= { is_house_based = no } # any_confederation_member is not performant for house blocs
					NOR = {
						is_allied_to = root
						is_at_war_as_defender = yes
						this = scope:neighbor
					}
					OR = {
						AND = {
							ai_greed >= low_positive_ai_value
							ai_honor <= 0
						}
						AND = {
							ai_honor <= low_negative_ai_value
							ai_greed >= 0
						}
					}
				}
				save_scope_as = confederate
				add_to_list = confederation_members
				
				confederation = { save_scope_as = confederation }
			}
			scope:confederation = {
				ordered_confederation_member = {
					order_by = ai_greed
					max = 2
					limit = {
						basic_is_available_ai = yes
						NOR = {
							this = root
							this = scope:confederate
							is_allied_to = root
							is_at_war_as_defender = yes
						}
						OR = {
							AND = {
								ai_greed >= low_positive_ai_value
								ai_honor <= 0
							}
							AND = {
								ai_honor <= low_negative_ai_value
								ai_greed >= 0
							}
						}
					}
					add_to_list = confederation_members
				}
			}
		}
	}
	#Impress Attendees - make a vassal loyal
	option = {
		trigger = {
			has_activity_intent = coronation_impress_attendees
			exists = scope:disobedient_vassal
		}
		name = coronation_events.6150.a
		flavor = coronation_events.6150.a.flavor
		scope:disobedient_vassal = {
			add_opinion = {
				target = root
				modifier = obedience_opinion
			}
		}
		if = {
			limit = {
				dread >= 5
			}
			add_dread = minor_dread_loss
			add_piety = minor_piety_loss
		}
		else = {
			add_piety = medium_piety_loss
		}
		stress_impact = {
			arrogant = minor_stress_impact_gain
			vengeful = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
				ai_sociability = 1
			}
			modifier = {
				add = 100
				scope:disobedient_vassal = {
					is_powerful_vassal = yes
				}
			}
			modifier = {
				add = 50
				dread <= 0
			}
			modifier = {
				add = -50
				scope:disobedient_vassal = {
					current_military_strength < root.half_current_military_strength
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = arrogant
					has_trait = vengeful
				}
			}
		}
	}
	#Exalt the crown - take visiting rulers on a tour of activity_location
	option = {
		trigger = {
			has_activity_intent = coronation_exalt_crown
			scope:activity.activity_location.county.holder = {
				OR = {
					this = root
					top_liege = root
				}
			}
		}
		name = coronation_events.6150.b
		flavor = coronation_events.6150.b.flavor

		scope:activity.activity_location.county = {
			add_county_modifier = {
				modifier = coronation_tour_of_notables_modifier
				years = 20
			}
		}
		scope:advisor = {
			if = {
				limit = {
					is_ai = yes
				}
				add_diplomacy_lifestyle_xp = major_lifestyle_xp
			}
		}
		stress_impact = {
			arrogant = miniscule_stress_impact_loss
			paranoid = minor_stress_impact_gain
		}
		ai_chance = {
			base = 150
			ai_value_modifier = {
				ai_sociability = 1
			}
			modifier = {
				add = 100
				has_trait = arrogant
			}
			modifier = {
				factor = 0
				has_trait = paranoid
			}
		}

	}
	#Weaken detractors - remove members from a confederation
	option = {
		trigger = {
			has_activity_intent = coronation_weaken_detractors
			exists = scope:confederate
		}
		name = coronation_events.6150.c
		flavor = coronation_events.6150.c.flavor
		if = {
			limit = {
				primary_title = {
					has_title_law = confederation_elective_succession_law
				}
			}
			add_tyranny = minor_tyranny_gain
		}
		hidden_effect = {
			scope:neighbor.confederation = {
				every_confederation_member = {
					limit = {
						NOT = {
							this = scope:confederate
						}
					}
					send_interface_toast = {
						type = event_toast_effect_bad
						title = coronation_events.6150.d.confederation_alert
						left_icon = root
						right_icon = scope:confederate
						custom_tooltip = coronation_events.6150.d.confederation_alert_tt
					}
				}
			}
		}
		
		#Diplomacy duel
		scope:advisor = {
			duel = {
				skill = diplomacy
				value = high_skill_rating
				#Remove 3 confederation members!
				15 = {
					trigger = {
						any_in_list = {
							list = confederation_members
							count >= 3
						}
					}
					desc = coronation_events.6150.c.success_crit
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
						min = -14
					}
					root = {
						send_interface_toast = {
							type = event_toast_effect_good
							title = coronation_events.6150.c.success_crit
							left_icon = scope:advisor
							right_icon = scope:confederate
							every_in_list = {
								list = confederation_members
								confederation = {
									remove_confederation_member = prev
									set_variable = {
										name = left_confederation
										value = scope:neighbor.confederation
										years = 5
									}
								}
								root = {
									pay_short_term_gold = {
										target = prev
										gold = prev.medium_gold_value
									}
								}
							}
						}
					}
				}
				#remove 2 confederation member
				30 = {
					trigger = {
						any_in_list = {
							list = confederation_members
							count >= 3
						}
					}
					desc = coronation_events.6150.c.success
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
						min = -29
					}
					root = {
						send_interface_toast = {
							type = event_toast_effect_good
							title = coronation_events.6150.c.success
							left_icon = scope:advisor
							right_icon = scope:confederate
							scope:confederate = {
								confederation = {
									remove_confederation_member = scope:confederate
									set_variable = {
										name = left_confederation
										value = scope:neighbor.confederation
										years = 5
									}
								}
								root = {
									pay_short_term_gold = {
										target = prev
										gold = prev.medium_gold_value
									}
								}
							}
							ordered_in_list = {
								list = confederation_members
								order_by = ai_greed
								limit = {
									NOT = {
										this = scope:confederate
									}
								}
								confederation = {
									remove_confederation_member = prev
									set_variable = {
										name = left_confederation
										value = scope:neighbor.confederation
										years = 5
									}
								}
								root = {
									pay_short_term_gold = {
										target = prev
										gold = prev.medium_gold_value
									}
								}
							}
						}
					}
				}
				#remove 1 confederation member
				65 = {
					desc = coronation_events.6150.c.fail
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
						min = -64
					}
					root = {
						send_interface_toast = {
							type = event_toast_effect_bad
							title = coronation_events.6150.c.fail
							left_icon = scope:advisor
							right_icon = scope:confederate
							scope:confederate = {
								confederation = {
									remove_confederation_member = scope:confederate
									set_variable = {
										name = left_confederation
										value = scope:neighbor.confederation
										years = 5
									}
								}
								root = {
									pay_short_term_gold = {
										target = prev
										gold = prev.medium_gold_value
									}
								}
							}
						}
					}
				}
			}
		}
		stress_impact = {
			deceitful = minor_stress_impact_loss
			just = medium_stress_impact_gain
			greedy = minor_stress_impact_gain
			honest = medium_stress_impact_gain
			content = miniscule_stress_impact_gain
			compassionate = miniscule_stress_impact_gain
			trusting = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_honor = 1
				ai_greed = 1
			}
			modifier = {
				add = 25
				has_trait = deceitful
			}
			modifier = {
				add = 25
				scope:confederation = {
					any_confederation_member = {
						count > 5
					}
				}
			}
			modifier = {
				add = 100
				scope:confederation = {
					any_confederation_member = {
						count > 8
					}
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = just
					has_trait = honest
					has_trait = trusting
					short_term_gold <= scope:confederate.medium_gold_value_tripled
				}
			}
		}
	}
	#Embrace supporters - turn potential tributary into vassal
	option = {
		trigger = {
			has_activity_intent = coronation_embrace_supporters
			exists = scope:neighbor_supporter
		}
		name = coronation_events.6150.supp
		scope:advisor = {
			duel = {
				skill = diplomacy
				value = medium_skill_rating
				50 = {
					desc = coronation_events.6150.supp.success
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
						min = -49
					}
					modifier = {
						scope:neighbor = {
							opinion = {
								target = root
								value >= 90
							}
						}
						add = 50
					}
					modifier = {
						scope:neighbor = {
							opinion = {
								target = root
								value >= 70
							}
						}
						add = 50
					}
					modifier = {
						scope:neighbor = {
							opinion = {
								target = root
								value >= 50
							}
						}
						add = 30
					}
					modifier = {
						scope:neighbor = {
							opinion = {
								target = root
								value >= 20
							}
						}
						add = 20
					}
					modifier = {
						scope:neighbor = {
							has_dread_level_towards = {
								target = root
								level >= 1
							}
						}
						add = 40
					}
					modifier = {
						scope:neighbor = {
							has_dread_level_towards = {
								target = root
								level >= 2
							}
						}
						add = 40
					}
					modifier = {
						add = 100
						root = {
							OR = {
								has_trait = conqueror
								has_trait = greatest_of_khans
							}
						}
					}
					modifier = {
						add = 50
						root = {
							highest_held_title_tier_minus_one > scope:neighbor.highest_held_title_tier
						}
					}
					modifier = {
						add = 50
						root = {
							highest_held_title_tier > scope:neighbor.highest_held_title_tier
						}
					}
					root = {
						send_interface_toast = {
							type = event_toast_effect_good
							title = coronation_events.6150.supp.success
							left_icon = scope:advisor
							right_icon = scope:neighbor
							if = {
								limit = {
									scope:neighbor = {
										is_confederation_member = yes
									}
								}
								scope:neighbor.confederation = {
									remove_confederation_member = scope:neighbor
									set_variable = {
										name = left_confederation
										value = scope:neighbor.confederation
										years = 5
									}
								}
							}
							create_title_and_vassal_change = {
								type = swear_fealty
								save_scope_as = change
								add_claim_on_loss = no
							}
							scope:neighbor = {
								change_liege = {
									liege = root
									change = scope:change
								}
								resolve_title_and_vassal_change = scope:change
							}
							scope:advisor = {
								if = {
									limit = {
										is_ai = yes
									}
									add_diplomacy_lifestyle_xp = medium_lifestyle_xp
									add_prestige = medium_prestige_gain
								}
							}
						}
					}
				}
				50 = {
					desc = coronation_events.6150.supp.fail
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
						min = -49
					}
					modifier = {
						scope:neighbor = {
							opinion = {
								target = root
								value <= -90
							}
						}
						add = 50
					}
					modifier = {
						scope:neighbor = {
							opinion = {
								target = root
								value <= -70
							}
						}
						add = 50
					}
					modifier = {
						scope:neighbor = {
							opinion = {
								target = root
								value <= -50
							}
						}
						add = 30
					}
					modifier = {
						scope:neighbor = {
							opinion = {
								target = root
								value <= -20
							}
						}
						add = 30
					}
					modifier = {
						add = 20
						scope:neighbor.faith = {
							faith_hostility_level = {
								target = root.faith
								value >= faith_hostile_level
							}
						}
					}
					modifier = {
						add = 20
						scope:neighbor.faith = {
							faith_hostility_level = {
								target = root.faith
								value >= faith_evil_level
							}
						}
					}
					modifier = {
						add = 30
						scope:neighbor = {
							is_confederation_member = yes
						}
					}
					root = {
						send_interface_toast = {
							type = event_toast_effect_bad
							title = coronation_events.6150.supp.fail
							left_icon = scope:advisor
							right_icon = scope:neighbor
							scope:neighbor = {
								add_opinion = {
									target = root
									modifier = insult_opinion
									opinion = -20
								}
							}
						}
					}
				}
			}
		}
		stress_impact = {
			ambitious = miniscule_stress_impact_loss
			content = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 150
			ai_value_modifier = {
				ai_greed = 0.5
				ai_boldness = 0.5
			}
			opinion_modifier = {
				who = root
				opinion_target = scope:neighbor
				multiplier = 1
			}
			opinion_modifier = {
				who = scope:neighbor
				opinion_target = root
				multiplier = 1
			}
			modifier = {
				add = 100
				scope:advisor = {
					diplomacy >= extremely_high_skill_rating
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = content
					has_trait = humble
					scope:advisor = {
						diplomacy < high_skill_rating
					}
				}
			}
		}
	}
	#Get a tributary
	option = {
		name = coronation_events.6150.d
		if = {
			limit = {
				NOT = { exists = scope:neighbor_supporter }
			}
			scope:advisor = {
				duel = {
					skill = diplomacy
					value = medium_skill_rating
					50 = {
						desc = coronation_events.6150.d.success
						compare_modifier = {
							value = scope:duel_value
							multiplier = 3.5
							min = -49
						}
						modifier = {
							scope:neighbor = {
								opinion = {
									target = root
									value >= 90
								}
							}
							add = 50
						}
						modifier = {
							scope:neighbor = {
								opinion = {
									target = root
									value >= 70
								}
							}
							add = 50
						}
						modifier = {
							scope:neighbor = {
								opinion = {
									target = root
									value >= 50
								}
							}
							add = 30
						}
						modifier = {
							scope:neighbor = {
								opinion = {
									target = root
									value >= 20
								}
							}
							add = 20
						}
						modifier = {
							scope:neighbor = {
								has_dread_level_towards = {
									target = root
									level >= 1
								}
							}
							add = 40
						}
						modifier = {
							scope:neighbor = {
								has_dread_level_towards = {
									target = root
									level >= 2
								}
							}
							add = 40
						}
						modifier = {
							add = 100
							root = {
								OR = {
									has_trait = conqueror
									has_trait = greatest_of_khans
								}
							}
						}
						modifier = {
							add = 50
							root = {
								highest_held_title_tier_minus_one > scope:neighbor.highest_held_title_tier
							}
						}
						modifier = {
							add = 50
							root = {
								highest_held_title_tier > scope:neighbor.highest_held_title_tier
							}
						}
						root = {
							send_interface_toast = {
								type = event_toast_effect_good
								title = coronation_events.6150.d.success
								left_icon = scope:advisor
								right_icon = scope:neighbor
								if = {
									limit = {
										scope:neighbor = {
											is_confederation_member = yes
										}
									}
									scope:neighbor.confederation = {
										remove_confederation_member = scope:neighbor
										set_variable = {
											name = left_confederation
											value = scope:neighbor.confederation
											years = 5
										}
									}
								}
								start_tributary_interaction_effect = {
									TRIBUTARY = scope:neighbor
									SUZERAIN = root
								}
								scope:advisor = {
									if = {
										limit = {
											is_ai = yes
										}
										add_prestige = medium_prestige_gain
									}
								}
							}
						}
						
					}
					50 = {
						desc = coronation_events.6150.d.fail
						compare_modifier = {
							value = scope:duel_value
							multiplier = -3.5
							min = -49
						}
						modifier = {
							scope:neighbor = {
								opinion = {
									target = root
									value <= -90
								}
							}
							add = 50
						}
						modifier = {
							scope:neighbor = {
								opinion = {
									target = root
									value <= -70
								}
							}
							add = 50
						}
						modifier = {
							scope:neighbor = {
								opinion = {
									target = root
									value <= -50
								}
							}
							add = 30
						}
						modifier = {
							scope:neighbor = {
								opinion = {
									target = root
									value <= -20
								}
							}
							add = 30
						}
						modifier = {
							add = 20
							scope:neighbor.faith = {
								faith_hostility_level = {
									target = root.faith
									value >= faith_hostile_level
								}
							}
						}
						modifier = {
							add = 20
							scope:neighbor.faith = {
								faith_hostility_level = {
									target = root.faith
									value >= faith_evil_level
								}
							}
						}
						modifier = {
							add = 30
							scope:neighbor = {
								is_confederation_member = yes
							}
						}
						root = {
							send_interface_toast = {
								type = event_toast_effect_bad
								title = coronation_events.6150.d.fail
								left_icon = scope:advisor
								right_icon = scope:neighbor
								scope:neighbor = {
									add_opinion = {
										target = root
										modifier = insult_opinion
										opinion = -20
									}
								}
							}
						}
					}
				}
			}
		}
		else = {
			if = {
				limit = {
					scope:neighbor = {
						is_confederation_member = yes
					}
				}
				scope:neighbor.confederation = {
					remove_confederation_member = scope:neighbor
					set_variable = {
						name = left_confederation
						value = scope:neighbor.confederation
						years = 5
					}
				}
			}
			root = {
				start_tributary_interaction_effect = {
					TRIBUTARY = scope:neighbor
					SUZERAIN = root
				}
			}
			if = {
				limit = {
					scope:advisor = { is_ai = yes }
				}
				scope:advisor = { add_prestige = medium_prestige_gain }
			}
		}
		stress_impact = {
			greedy = miniscule_stress_impact_loss
			ambitious = miniscule_stress_impact_loss
			content = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_greed = 1
			}
			opinion_modifier = {
				who = root
				opinion_target = scope:neighbor
				multiplier = 0.5
			}
			opinion_modifier = {
				who = scope:neighbor
				opinion_target = root
				multiplier = 0.5
			}
			modifier = {
				add = 50
				scope:advisor = {
					diplomacy >= very_high_skill_rating
				}
			}
			modifier = {
				add = 25
				scope:neighbor.highest_held_title_tier < root.highest_held_title_tier_minus_one
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = content
					has_trait = humble
					scope:advisor = {
						diplomacy < decent_skill_rating
					}
				}
			}
		}
	}
	#Strengthen the unity of the council
	option = {
		name = coronation_events.6150.e
		every_councillor = {
			custom = custom.every_councillor
			if = {
				limit = {
					government_has_flag = government_is_nomadic
				}
				custom_tooltip = coronation_councillor_unity_tooltip_nomadic
				hidden_effect = {
					if = {
						limit = {
							highest_skill = diplomacy
						}
						add_character_modifier = {
							modifier = councillor_unity_modifier_diplomacy
							years = 5
						}
					}
					else_if = {
						limit = {
							highest_skill = stewardship
						}
						add_character_modifier = {
							modifier = councillor_unity_modifier_stewardship
							years = 5
						}
					}
					else_if = {
						limit = {
							highest_skill = intrigue
						}
						add_character_modifier = {
							modifier = councillor_unity_modifier_intrigue
							years = 5
						}
					}
					else_if = {
						limit = {
							highest_skill = learning
						}
						add_character_modifier = {
							modifier = councillor_unity_modifier_learning
							years = 5
						}
					}
					else = {
						add_character_modifier = {
							modifier = councillor_unity_modifier_martial
							years = 5
						}
					}
				}
			}
			custom_tooltip = coronation_councillor_unity_tooltip
			hidden_effect = {
				if = {
					limit = {
						has_council_position = councillor_chancellor
					}
					add_character_modifier = {
						modifier = councillor_unity_modifier_diplomacy
						years = 5
					}
				}
				else_if = {
					limit = {
						has_council_position = councillor_steward
					}
					add_character_modifier = {
						modifier = councillor_unity_modifier_stewardship
						years = 5
					}
				}
				else_if = {
					limit = {
						has_council_position = councillor_spymaster
					}
					add_character_modifier = {
						modifier = councillor_unity_modifier_intrigue
						years = 5
					}
				}
				else_if = {
					limit = {
						has_council_position = councillor_court_chaplain
					}
					add_character_modifier = {
						modifier = councillor_unity_modifier_learning
						years = 5
					}
				}
				else_if = {
					limit = {
						has_council_position = councillor_marshal
					}
					add_character_modifier = {
						modifier = councillor_unity_modifier_martial
						years = 5
					}
				}
				else = {
					#Add highest skill to spouse... and other council positions I don't know about I guess
					if = {
						limit = {
							highest_skill = diplomacy
						}
						add_character_modifier = {
							modifier = councillor_unity_modifier_diplomacy
							years = 5
						}
					}
					else_if = {
						limit = {
							highest_skill = stewardship
						}
						add_character_modifier = {
							modifier = councillor_unity_modifier_stewardship
							years = 5
						}
					}
					else_if = {
						limit = {
							highest_skill = intrigue
						}
						add_character_modifier = {
							modifier = councillor_unity_modifier_intrigue
							years = 5
						}
					}
					else_if = {
						limit = {
							highest_skill = learning
						}
						add_character_modifier = {
							modifier = councillor_unity_modifier_learning
							years = 5
						}
					}
					else = {
						add_character_modifier = {
							modifier = councillor_unity_modifier_martial
							years = 5
						}
					}
				}
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
			}
		}
	}
	after = {
		# For MP
		coronation_ready_effect = yes
	}
}
