﻿namespace = lmf_interaction

######################
# DEMAND INHERITANCE #
######################

scripted_effect remove_disinherited_effect = {
	$DISINHERITED$ = {
		remove_trait_force_tooltip = disinherited
		if = {
			limit = {
				has_opinion_modifier = {
					modifier = disinherited_opinion
					target = $DYNAST$
				}
			}
			remove_opinion = {
				modifier = disinherited_opinion
				target = $DYNAST$
			}
			house = {
				if = {
					limit = {
						NOT = {
							any_house_member = {
								this != $DISINHERITED$
								has_opinion_modifier = {
									modifier = disinherited_opinion
									target = $DYNAST$
								}
							}
						}
						any_house_member = {
							this != $DISINHERITED$
							this != $DYNAST$
							has_opinion_modifier = {
								modifier = disinherited_house_member_opinion
								target = $DYNAST$
							}
						}
					}
					every_house_member = {
						limit = {
							this != $DISINHERITED$
							this != $DYNAST$
						}
						hidden_effect = {
							remove_opinion = {
								modifier = disinherited_house_member_opinion
								target = $DYNAST$
								single = yes
							}
						}
					}
				}
			}
		}
		else = {
			if = {
				limit = {
					could_potentially_inherit_titles = { HEIR = $DISINHERITED$ }
				}
				if = {
					limit = { this != $DYNAST$ }
					add_opinion = {
						modifier = restored_inheritance_opinion
						target = $DYNAST$
					}
				}
				house = {
					every_house_member = {
						limit = {
							this != $DISINHERITED$
							this != $DYNAST$
						}
						hidden_effect = {
							add_opinion = {
								modifier = restored_house_member_inheritance_opinion
								target = scope:actor
							}
						}
					}
				}
			}
			else = {
				if = {
					limit = { this != $DYNAST$ }
					add_opinion = {
						modifier = removed_disinherited_opinion
						target = $DYNAST$
					}
				}
				house = {
					every_house_member = {
						limit = {
							this != $DISINHERITED$
							this != $DYNAST$
						}
						hidden_effect = {
							add_opinion = {
								modifier = removed_house_member_disinherited_opition
								target = scope:actor
							}
						}
					}
				}
			}
		}
		#Remove nithing status, if applicable.
		hidden_effect = {
			if = {
				limit = { has_character_modifier = nithing_fp1_modifier }
				remove_character_modifier = nithing_fp1_modifier
			}
		}
	}
}

scripted_effect accepted_inheritance_refusal_effect = {
	random_list = {
		30 = {
			modifier = {
				factor = 2
				has_trait = ambitious
			}
			modifier = {
				factor = 0
				NOT = { has_trait = ambitious }
				number_of_personality_traits > 3
			}
			trigger = {
				OR = {
					has_trait = ambitious
					NOR = {
						has_trait = ambitious
						has_trait = content
					}
				}
			}
			if = {
				limit = { has_trait = ambitious }
				show_as_tooltip = { remove_trait_force_tooltip = ambitious }
				trait:ambitious = { save_scope_as = trait_removed }
			}
			else = {
				show_as_tooltip = { add_trait_force_tooltip = content }
				trait:content = { save_scope_as = trait_added }
			}
		}
		30 = {
			modifier = {
				factor = 2
				has_trait = arrogant
			}
			modifier = {
				factor = 0
				NOT = { has_trait = arrogant }
				number_of_personality_traits > 3
			}
			trigger = {
				OR = {
					has_trait = arrogant
					NOR = {
						has_trait = arrogant
						has_trait = humble
					}
				}
			}
			if = {
				limit = { has_trait = arrogant }
				show_as_tooltip = { remove_trait_force_tooltip = arrogant }
				trait:arrogant = { save_scope_as = trait_removed }
			}
			else = {
				show_as_tooltip = { add_trait_force_tooltip = humble }
				trait:humble = { save_scope_as = trait_added }
			}
		}
		30 = {
			modifier = {
				factor = 2
				has_trait = impatient
			}
			modifier = {
				factor = 0
				NOT = { has_trait = impatient }
				number_of_personality_traits > 3
			}
			trigger = {
				OR = {
					has_trait = impatient
					NOR = {
						has_trait = impatient
						has_trait = patient
					}
				}
			}
			if = {
				limit = { has_trait = impatient }
				show_as_tooltip = { remove_trait_force_tooltip = impatient }
				trait:impatient = { save_scope_as = trait_removed }
			}
			else = {
				show_as_tooltip = { add_trait_force_tooltip = patient }
				trait:patient = { save_scope_as = trait_added }
			}
		}
		20 = {
			trigger = {
				NOR = {
					has_trait = depressed_1
					has_trait = depressed_genetic
				}
			}
			modifier = {
				factor = 2
				has_personality_submissive_trigger = yes
			}
			show_as_tooltip = { add_trait_force_tooltip = depressed_1 }
			trait:depressed_1 = { save_scope_as = trait_added }
		}
		10 = {
			modifier = {
				exists = scope:lesser_offer
				add = 40
			}
		}
	}
}

scripted_effect angered_inheritance_refusal_effect = {
	random_list = {
		30 = {
			modifier = {
				factor = 2
				has_trait = forgiving
			}
			modifier = {
				factor = 0
				NOT = { has_trait = forgiving }
				number_of_personality_traits > 3
			}
			trigger = {
				OR = {
					has_trait = forgiving
					NOR = {
						has_trait = forgiving
						has_trait = vengeful
					}
				}
			}
			if = {
				limit = { has_trait = forgiving }
				show_as_tooltip = { remove_trait_force_tooltip = forgiving }
				trait:forgiving = { save_scope_as = trait_removed }
			}
			else = {
				show_as_tooltip = { add_trait_force_tooltip = vengeful }
				trait:vengeful = { save_scope_as = trait_added }
			}
		}
		30 = {
			modifier = {
				factor = 2
				has_trait = calm
			}
			modifier = {
				factor = 0
				NOT = { has_trait = calm }
				number_of_personality_traits > 3
			}
			trigger = {
				OR = {
					has_trait = calm
					NOR = {
						has_trait = calm
						has_trait = wrathful
					}
				}
			}
			if = {
				limit = { has_trait = calm }
				show_as_tooltip = { remove_trait_force_tooltip = calm }
				trait:calm = { save_scope_as = trait_removed }
			}
			else = {
				show_as_tooltip = { add_trait_force_tooltip = wrathful }
				trait:wrathful = { save_scope_as = trait_added }
			}
		}
		20 = {
			modifier = {
				factor = 2
				has_trait = trusting
			}
			modifier = {
				factor = 0
				NOT = { has_trait = trusting }
				number_of_personality_traits > 3
			}
			trigger = {
				OR = {
					has_trait = trusting
					NOR = {
						has_trait = trusting
						has_trait = paranoid
					}
				}
			}
			if = {
				limit = { has_trait = trusting }
				show_as_tooltip = { remove_trait_force_tooltip = trusting }
				trait:trusting = { save_scope_as = trait_removed }
			}
			else = {
				show_as_tooltip = { add_trait_force_tooltip = paranoid }
				trait:paranoid = { save_scope_as = trait_added }
			}
		}
		20 = {
			modifier = {
				factor = 2
				has_trait = content
			}
			modifier = {
				factor = 0
				NOT = { has_trait = content }
				number_of_personality_traits > 3
			}
			trigger = {
				OR = {
					has_trait = content
					NOR = {
						has_trait = content
						has_trait = ambitious
					}
				}
			}
			if = {
				limit = { has_trait = content }
				show_as_tooltip = { remove_trait_force_tooltip = content }
				trait:content = { save_scope_as = trait_removed }
			}
			else = {
				show_as_tooltip = { add_trait_force_tooltip = ambitious }
				trait:ambitious = { save_scope_as = trait_added }
			}
		}
		10 = {}
	}
}

scripted_effect inheritance_rivalry_effect = {
	if = {
		limit = { is_allied_to = $CHARACTER$ }
		break_alliance = $CHARACTER$
		hidden_effect = {
			reverse_add_opinion = {
				modifier = refused_alliance_opinion
				target = $CHARACTER$
			}
		}
	}
	if = {
		limit = {
			has_relation_rival = $CHARACTER$
			can_set_relation_nemesis_trigger = { CHARACTER = $CHARACTER$ }
		}
		set_relation_nemesis = {
			reason = refused_to_restore_inheritance
			target = $CHARACTER$
		}
	}
	else_if = {
		limit = {
			NOT = { has_relation_rival = $CHARACTER$ }
			can_set_relation_rival_trigger = { CHARACTER = $CHARACTER$ }
		}
		set_relation_rival = {
			reason = refused_to_restore_inheritance
			target = $CHARACTER$
		}
	}
	else_if = {
		limit = {
			can_set_relation_potential_rival_trigger = { CHARACTER = $CHARACTER$ }
		}
		set_relation_potential_rival = $CHARACTER$
	}
	else_if = {
		limit = {
			has_relation_friend = $CHARACTER$
			NOT = { has_relation_best_friend = $CHARACTER$ }
		}
		remove_relation_friend = $CHARACTER$
		set_relation_potential_rival = $CHARACTER$
	}
	else_if = {
		limit = {
			has_relation_best_friend = $CHARACTER$
		}
		remove_relation_best_friend = $CHARACTER$
		set_relation_potential_rival = $CHARACTER$
	}
	hidden_effect = {
		add_opinion = {
			target = $CHARACTER$
			modifier = outraged_opinion
			opinion = -100
		}
	}
}

scripted_effect inheritance_lesser_rivalry_effect = {
	if = {
		limit = { is_allied_to = $CHARACTER$ }
		break_alliance = $CHARACTER$
		hidden_effect = {
			reverse_add_opinion = {
				modifier = refused_alliance_opinion
				target = $CHARACTER$
			}
		}
	}
	if = {
		limit = {
			has_relation_rival = $CHARACTER$
			can_set_relation_nemesis_trigger = { CHARACTER = $CHARACTER$ }
		}
		set_relation_nemesis = {
			reason = refused_to_restore_inheritance
			target = $CHARACTER$
		}
	}
	else_if = {
		limit = {
			has_relation_potential_rival = $CHARACTER$
			can_set_relation_rival_trigger = { CHARACTER = $CHARACTER$ }
		}
		set_relation_rival = {
			reason = refused_to_restore_inheritance
			target = $CHARACTER$
		}
	}
	else_if = {
		limit = {
			can_set_relation_potential_rival_trigger = { CHARACTER = $CHARACTER$ }
		}
		set_relation_potential_rival = $CHARACTER$
	}
	else_if = {
		limit = {
			has_relation_friend = $CHARACTER$
			NOT = { has_relation_best_friend = $CHARACTER$ }
		}
		remove_relation_friend = $CHARACTER$
	}
	else_if = {
		limit = {
			has_relation_best_friend = $CHARACTER$
		}
		remove_relation_best_friend = $CHARACTER$
	}
	hidden_effect = {
		add_opinion = {
			target = $CHARACTER$
			modifier = outraged_opinion
			opinion = -50
		}
	}
}

scripted_effect outraged_inheritance_effect = {
	if = {
		limit = {
			OR = {
				has_opinion_modifier = { modifier = disinherited_opinion target = scope:recipient }
				AND = {
					has_variable_list = disinherited_titles
					any_in_list = {
						variable = disinherited_titles
						holder ?= scope:recipient
					}
				}
				AND = {
					NOT = { has_variable_list = disinherited_titles }
					any_claim = {
						explicit = yes
						holder ?= scope:recipient
					}
				}
			}
		}
		inheritance_rivalry_effect = { CHARACTER = scope:recipient }
		every_close_or_extended_family_member = {
			limit = {
				save_temporary_scope_as = family
				OR = {
					this = scope:recipient.player_heir
					scope:actor = {
						has_variable_list = disinherited_titles
						any_in_list = {
							variable = disinherited_titles
							holder ?= scope:family
						}
					}
					scope:actor = {
						NOT = { has_variable_list = disinherited_titles }
						any_claim = {
							explicit = yes
							holder ?= scope:family
						}
					}
				}
				NOR = {
					has_relation_friend = scope:actor
					is_consort_of = scope:actor
					is_child_of = scope:actor
					is_grandchild_of = scope:actor
					this = scope:recipient
					is_player_heir_of = scope:recipient
				}
			}
			save_scope_as = jealous_family
			scope:actor = {
				inheritance_lesser_rivalry_effect = { CHARACTER = scope:jealous_family }
			}
		}
	}
	else = {
		scope:actor = {
			add_opinion = {
				target = scope:recipient
				modifier = outraged_opinion
				opinion = -50
			}
		}
		every_close_or_extended_family_member = {
			limit = {
				save_temporary_scope_as = family
				OR = {
					scope:actor = {
						has_variable_list = disinherited_titles
						any_in_list = {
							variable = disinherited_titles
							holder ?= scope:family
						}
					}
					scope:actor = {
						NOT = { has_variable_list = disinherited_titles }
						any_claim = {
							explicit = yes
							holder ?= scope:family
						}
					}
				}
				NOR = {
					is_consort_of = scope:actor
					is_child_of = scope:actor
					is_grandchild_of = scope:actor
					this = scope:recipient
				}
			}
			save_temporary_scope_as = jealous_family
			scope:actor = {
				inheritance_rivalry_effect = { CHARACTER = scope:jealous_family }
			}
		}
	}
}

# Disinherited dynasty member demands restoration of their inheritance
lmf_interaction.0001 = {
	type = character_event
	title = lmf_interaction.0001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:actor = { has_personality_submissive_trigger = yes }
				}
				desc = lmf_interaction.0001.opening.submissive
			}
			triggered_desc = {
				trigger = {
					scope:actor = {
						OR = {
							has_personality_dominant_trigger = yes
							is_hot_headed_trigger = yes
						}
					}
				}
				desc = lmf_interaction.0001.opening.dominant
			}
			desc = lmf_interaction.0001.opening
		}
		desc = lmf_interaction.0001.address
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						reverse_has_opinion_modifier = { modifier = disinherited_opinion target = scope:actor }
						AND = {
							exists = scope:disinheritor
							scope:disinheritor = scope:recipient
						}
					}
				}
				desc = lmf_interaction.0001.disinheritor
			}
			triggered_desc = {
				trigger = { exists = scope:disinheritor }
				desc = lmf_interaction.0001.formerdynast
			}
			desc = lmf_interaction.0001.dynast
		}
		desc = lmf_interaction.0001.main
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = {
						reverse_has_opinion_modifier = { modifier = disinherited_opinion target = scope:actor }
					}
				}
				desc = lmf_interaction.0001.ending.dynast
			}
			triggered_desc = {
				trigger = {
					scope:actor = { has_personality_submissive_trigger = yes }
				}
				desc = lmf_interaction.0001.ending.submissive
			}
			triggered_desc = {
				trigger = {
					scope:actor = {
						OR = {
							has_personality_dominant_trigger = yes
							is_hot_headed_trigger = yes
						}
					}
				}
				desc = lmf_interaction.0001.ending.dominant
			}
			desc = lmf_interaction.0001.ending
		}
		triggered_desc = {
			trigger = { is_close_or_extended_family_of = scope:actor }
			desc = lmf_interaction.0001.close.family
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = {
						reverse_has_opinion_modifier = { modifier = disinherited_opinion target = scope:actor }
					}
				}
				desc = lmf_interaction.0001.close.dynast
			}
			desc = lmf_interaction.0001.close
		}
	}
	theme = realm

	left_portrait = {
		character = scope:actor
		triggered_animation = {
			trigger = {
				scope:actor = { has_personality_submissive_trigger = yes }
			}
			animation = beg
		}
		triggered_animation = {
			trigger = {
				scope:actor = {
					OR = {
						has_personality_dominant_trigger = yes
						is_hot_headed_trigger = yes
					}
				}
			}
			animation = anger
		}
		animation = personality_bold
	}

	immediate = {
		hidden_effect = {
			scope:actor = { add_character_flag = made_disinherit_demand }
			if = {
				limit = { exists = scope:actor.var:disinheritor }
				scope:actor.var:disinheritor = { save_scope_as = disinheritor }
			}
			add_character_flag = {
				flag = recently_received_disinherit_demand
				days = 320
			}
		}
	}

	option = {
		name = lmf_interaction.0001.a #Agree
		if = {
			limit = {
				scope:actor = { has_strong_usable_hook = scope:recipient }
			}
			scope:actor = { use_hook = scope:recipient }
		}
		dynasty = { add_dynasty_prestige = minor_dynasty_prestige_loss }
		stress_impact = {
			vengeful = minor_stress_impact_gain
			stubborn = minor_stress_impact_gain
		}
		hidden_effect = {
			send_interface_message = {
				type = event_generic_neutral
				title = restore_inheritance_interaction_notification
				right_icon = scope:actor
				show_as_tooltip = {
					remove_disinherited_effect = { DYNAST = scope:recipient DISINHERITED = scope:actor }
				}
			}
		}
		scope:actor = {
			if = {
				limit = { is_ai = no }
				hidden_effect = {
					send_interface_message = {
						type = event_generic_neutral
						title = restore_inheritance_interaction_notification
						right_icon = scope:recipient
						show_as_tooltip = {
							remove_disinherited_effect = { DYNAST = scope:recipient DISINHERITED = scope:actor }
						}
					}
				}
			}
			remove_disinherited_effect = { DYNAST = scope:recipient DISINHERITED = scope:actor }
			remove_character_flag = made_disinherit_demand
		}
		ai_chance = {
			base = 30
			ai_value_modifier = {
				ai_compassion = 0.5
			}
			opinion_modifier = {
				who = scope:recipient
				opinion_target = scope:actor
				multiplier = 0.5
			}
			modifier = {
				add = 50
				has_relation_friend = scope:actor
			}
			modifier = {
				add = -50
				scope:actor = {
					OR = {
						has_trait = inbred
						has_trait = intellect_bad_3
						has_trait = incapable
						has_any_trait_disapproved_of_by = { CHARACTER = scope:recipient }
						AND = {
							has_character_modifier = known_non_believer
							scope:recipient.ai_zeal >= medium_positive_ai_value
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				scope:actor = {
					OR = {
						has_trait = legitimized_bastard
						has_trait = disputed_heritage
						any_secret = {
							secret_type = secret_disputed_heritage
							is_known_by = scope:recipient
						}
					}
				}
			}
			modifier = {
				factor = 0
				has_relation_rival = scope:actor
			}
			min = 0
		}
	}
	option = {
		name = lmf_interaction.0001.b #Refuse
		trigger = {
			NOT = { scope:actor = { has_strong_usable_hook = scope:recipient } }
		}
		show_as_unavailable = {
			scope:actor = { has_strong_usable_hook = scope:recipient }
		}
		stress_impact = {
			forgiving = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}
		reverse_add_opinion = {
			target = scope:actor
			modifier = refused_restore_inheritance_opinion
		}
		custom_tooltip = lmf_interaction.0001.b.tt
		scope:actor = {
			trigger_event = lmf_interaction.0002
		}
		ai_chance = {
			base = 70
			modifier = {
				factor = 2
				reverse_has_opinion_modifier = { modifier = disinherited_opinion target = scope:actor }
				player_heir ?= {
					sum_of_all_skills_value > scope:recipient.sum_of_all_skills_value
					reverse_opinion = { target = scope:recipient value > high_positive_opinion }
				}
			}
			ai_value_modifier = {
				ai_vengefulness = 1
			}
			modifier = {
				factor = 0.5
				has_relation_friend = scope:actor
			}
			min = 25
		}
	}
}

# Disinherited dynasty member is refused
lmf_interaction.0002 = {
	type = character_event
	title = lmf_interaction.0002.t
	desc = {
		desc = lmf_interaction.0002.begin
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:other_restitution }
				desc = lmf_interaction.0002.restitution
			}
			triggered_desc = {
				trigger = { exists = scope:clear_name }
				desc = lmf_interaction.0002.name
			}
			desc = lmf_interaction.0002.refuse
		}
	}
	theme = realm

	left_portrait = {
		character = scope:recipient
		animation = disapproval
	}
	
	immediate = {
		if = {
			limit = { exists = scope:other_restitution }
			remove_disinherited_effect = { DYNAST = scope:recipient DISINHERITED = scope:actor }
			scope:recipient = {
				pay_short_term_gold = {
					target = scope:actor
					gold = major_gold_value
				}
			}
			if = {
				limit = {
					can_add_hook = {
						type = indebted_hook
						target = scope:recipient
					}
				}
				add_hook = {
					type = indebted_hook
					target = scope:recipient
				}
			}
		}
		if = {
			limit = { exists = scope:clear_name }
			remove_disinherited_effect = { DYNAST = scope:recipient DISINHERITED = scope:actor }
		}
	}

	option = {
		name = {
			trigger = { exists = scope:other_restitution }
			text = lmf_interaction.0002.c
		}
		name = {
			trigger = { exists = scope:clear_name }
			text = lmf_interaction.0002.d
		}
		name = {
			trigger = {
				NOR = {
					exists = scope:other_restitution
					exists = scope:clear_name
				}
			}
			text = lmf_interaction.0002.a #This is an outrage!
		}
		stress_impact = {
			forgiving = major_stress_impact_gain
			humble = major_stress_impact_gain
			content = medium_stress_impact_gain
			calm = medium_stress_impact_gain
		}
		show_as_tooltip = { outraged_inheritance_effect = yes }
		angered_inheritance_refusal_effect = yes
		hidden_effect = {
			scope:recipient = {
				send_interface_message = {
					type = event_generic_bad
					title = lmf_interaction.0002.a.tt
					left_icon = scope:actor
					scope:actor = {
						outraged_inheritance_effect = yes
						if = {
							limit = { exists = scope:trait_added }
							add_trait_force_tooltip = scope:trait_added
						}
						if = {
							limit = { exists = scope:trait_removed }
							remove_trait_force_tooltip = scope:trait_removed
						}
					}
				}
			}
		}
		if = {
			limit = {
				is_ai = yes
				is_playable_character = no
				is_courtier_of = scope:recipient
			}
			random_list = {
				50 = {
					modifier = {
						factor = 2
						has_relation_rival = scope:recipient
					}
					ai_value_modifier = {
						ai_vengefulness = 0.5
						ai_boldness = 1
						min = -50
					}
					scope:recipient = {
						hidden_effect = {
							send_interface_message = {
								type = event_generic_bad
								title = lmf_interaction.0002.left_court.tt
								right_icon = scope:actor
								show_as_tooltip = {
									scope:recipient = {
										remove_courtier_or_guest = scope:actor
									}
								}
								if = {
									limit = { has_hook = scope:actor }
									remove_hook = { target = scope:actor }
								}

								#Remove them as guardian/ward for any courtier
								lose_guardians_and_wards_effect = { LIEGE = scope:recipient COURTIER = scope:actor }
							}
						}
					}
					scope:actor = {
						create_character_memory = {
							type = lmf_memory_left_court
							participants = { court = scope:recipient }
						}
						scope:new_memory = {
							set_variable = {
								name = liege_title
								value = scope:recipient.primary_title
							}
						}
						lmf_move_to_pool_effect = yes
						if = {
							limit = { is_child_of = scope:recipient }
							add_character_modifier = {
								modifier = lust_for_adventure
								years = 10
							}
						}
					}
					if = {
						limit = {
							exists = betrothed
							NOT = { has_character_flag = cannot_get_will_not_wed_trait }
						}
						if = {
							limit = { has_been_promised_grand_wedding = yes }
							break_grand_wedding_betrothal_effect = yes
						}
						else = {
							break_betrothal = betrothed
						}
					}
					if = {
						limit = {
							OR = {
								is_close_family_of = scope:recipient
								is_great_grandchild_of = scope:recipient
							}
							NOR = {
								has_trait = will_not_wed
								is_married = yes
								has_character_flag = cannot_get_will_not_wed_trait
							}
						}
						add_trait = will_not_wed
						hidden_effect = {
							create_story = {
								type = lmf_will_not_wed_story_cycle
							}
						}
					}
				}
				25 = {
					ai_value_modifier = {
						ai_rationality = 1
					}
					ai_value_modifier = {
						ai_energy = -0.5
						max = 0
					}
					modifier = {
						add = 75
						has_relation_friend = scope:recipient
					}
					modifier = {
						add = 25
						is_knight = yes
					}
					modifier = {
						add = 25
						is_councillor = yes
					}
					modifier = {
						add = 25
						any_child = {
							has_dynasty = yes
							dynasty = scope:actor.dynasty
							is_adult = no
						}
					}
					modifier = {
						add = 25
						OR = {
							is_married = yes
							is_betrothed = yes
						}
					}
					min = 1
				}
			}
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = 1
				ai_boldness = 0.5
				ai_greed = 1.0
			}
			modifier = {
				factor = 2
				OR = {
					has_personality_dominant_trigger = yes
					is_hot_headed_trigger = yes
				}
			}
			min = 0
		}
	}
	option = {
		name = lmf_interaction.0002.b #Accept my fate
		stress_impact = {
			vengeful = major_stress_impact_gain
			wrathful = major_stress_impact_gain
			ambitious = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		accepted_inheritance_refusal_effect = yes
		hidden_effect = {
			scope:recipient = {
				send_interface_message = {
					type = event_generic_good
					title = lmf_interaction.0002.b.tt
					left_icon = scope:actor
					scope:actor = {
						if = {
							limit = { exists = scope:trait_added }
							add_trait_force_tooltip = scope:trait_added
						}
						if = {
							limit = { exists = scope:trait_removed }
							remove_trait_force_tooltip = scope:trait_removed
						}
					}
				}
			}
		}
		if = {
			limit = {
				is_ai = yes
				is_playable_character = no
				is_courtier_of = scope:recipient
			}
			random_list = {
				50 = {
					trigger = {
						NOR = {
							has_trait = devoted
							has_trait = order_member
							any_heir_title = {}
							is_pregnant = yes
						}
						pool_character_can_go_to_holy_order = { CHARACTER = scope:actor }
					}
					modifier = {
						add = 20
						religion = { exists = var:variable_ghw_unlocked }
					}
					modifier = {
						add = 100
						faith = { exists = great_holy_war }
					}
					ai_value_modifier = {
						ai_zeal = 1
						ai_honor = 0.5
						ai_boldness = 0.5
					}
					modifier = {
						OR = {
							is_married = yes
							is_betrothed = yes
						}
						factor = 0.5
					}
					modifier = {
						is_councillor = yes
						factor = 0.5
					}
					modifier = {
						has_education_martial_trigger = no
						factor = 0.5
					}
					min = 0
					scope:actor = {
						create_character_memory = {
							type = lmf_memory_left_court
							participants = { court = scope:recipient }
						}
					}
					scope:new_memory = {
						set_variable = {
							name = liege_title
							value = scope:recipient.primary_title
						}
					}
					scope:recipient = {
						send_interface_message = {
							type = event_generic_bad
							title =  lmf_interaction.0002.holy_order.tt
							right_icon = scope:actor
							pool_character_join_holy_order = { CHARACTER = scope:actor }
						}
					}
					if = {
						limit = { is_child_of = scope:recipient }
						add_character_modifier = {
							modifier = lust_for_adventure
							years = 5
						}
					}
				}
				25 = {
					trigger = {
						NOR = {
							has_trait = devoted
							has_trait = order_member
							any_heir_title = {}
							is_pregnant = yes
						}
						pool_character_can_take_holy_vows = { CHARACTER = scope:actor }
					}
					ai_value_modifier = {
						ai_zeal = 1
					}
					modifier = {
						factor = 0.5
						pool_character_can_go_to_holy_order = { CHARACTER = scope:actor }
					}
					modifier = {
						OR = {
							is_married = yes
							is_betrothed = yes
						}
						factor = 0.5
					}
					modifier = {
						OR = {
							is_councillor = yes
							is_knight = yes
						}
						factor = 0.5
					}
					modifier = {
						has_education_learning_trigger = no
						factor = 0.5
					}
					min = 0
					scope:actor = {
						create_character_memory = {
							type = lmf_memory_left_court
							participants = { court = scope:recipient }
						}
					}
					scope:new_memory = {
						set_variable = {
							name = liege_title
							value = scope:recipient.primary_title
						}
					}
					scope:recipient = {
						send_interface_message = {
							type = event_generic_bad
							title =  lmf_interaction.0002.took_vows.tt
							right_icon = scope:actor
							pool_character_take_vows = { CHARACTER = scope:actor }
						}
					}
					if = {
						limit = { is_child_of = scope:recipient }
						add_character_modifier = {
							modifier = lust_for_adventure
							years = 5
						}
					}
				}
				25 = {
					trigger = {
						pool_character_can_join_dynasty_adventurer = { CHARACTER = scope:actor }
					}
					ai_value_modifier = {
						ai_boldness = 1
						ai_energy = 0.5
						ai_rationality = -0.5
					}
					modifier = {
						OR = {
							is_councillor = yes
							is_knight = yes
						}
						factor = 0.5
					}
					modifier = {
						factor = 0.5
						NOT = { can_be_warrior_trigger = { ARMY_OWNER = scope:actor } }
					}
					modifier = {
						factor = 0.5
						ai_zeal > 0
						pool_character_can_go_to_holy_order = { CHARACTER = scope:actor }
					}
					scope:actor = {
						create_character_memory = {
							type = lmf_memory_left_court
							participants = { court = scope:recipient }
						}
					}
					scope:new_memory = {
						set_variable = {
							name = liege_title
							value = scope:recipient.primary_title
						}
					}
					scope:recipient = {
						send_interface_message = {
							type = event_generic_bad
							title =  lmf_interaction.0002.joined_adventurer.tt
							right_icon = scope:actor
							pool_character_join_dynasty_adventurer = { CHARACTER = scope:actor }
						}
					}
					if = {
						limit = { is_child_of = scope:recipient }
						add_character_modifier = {
							modifier = lust_for_adventure
							years = 5
						}
					}
				}
				25 = {
					trigger = {
						pool_character_can_join_random_adventurer = { CHARACTER = scope:actor }
					}
					ai_value_modifier = {
						ai_boldness = 1
						ai_energy = 0.5
						ai_rationality = -0.5
					}
					modifier = {
						OR = {
							is_councillor = yes
							is_knight = yes
						}
						factor = 0.5
					}
					modifier = {
						factor = 0.5
						NOT = { can_be_warrior_trigger = { ARMY_OWNER = scope:actor } }
					}
					modifier = {
						factor = 0.5
						ai_zeal > 0
						pool_character_can_go_to_holy_order = { CHARACTER = scope:actor }
					}
					modifier = {
						dynasty = {
							any_dynasty_member = {
								NOR = {
									is_parent_of = scope:actor
									scope:actor.liege ?= this
									scope:actor.host ?= this
									scope:actor = this
								}
								OR = {
									AND = {
										is_physically_able_ai_adult = yes
										is_landless_adventurer = yes
										exists = domicile.domicile_location
										NOT = { has_relation_rival = scope:actor }
										any_courtier = { count < 10 }
									}
									AND = {
										is_courtier = yes
										liege = {
											is_physically_able_ai_adult = yes
											is_landless_adventurer = yes
											exists = domicile.domicile_location
											NOT = { has_relation_rival = scope:actor }
											any_courtier = { count < 10 }
										}
									}
								}
							}
						}
						factor = 0
					}
					min = 0
					scope:actor = {
						create_character_memory = {
							type = lmf_memory_left_court
							participants = { court = scope:recipient }
						}
					}
					scope:new_memory = {
						set_variable = {
							name = liege_title
							value = scope:recipient.primary_title
						}
					}
					scope:recipient = {
						send_interface_message = {
							type = event_generic_bad
							title =  lmf_interaction.0002.joined_adventurer.tt
							right_icon = scope:actor
							pool_character_join_random_adventurer = { CHARACTER = scope:actor }
						}
					}
					if = {
						limit = { is_child_of = scope:recipient }
						add_character_modifier = {
							modifier = lust_for_adventure
							years = 5
						}
					}
				}
				0 = {
					trigger = {
						has_ep3_dlc_trigger = yes
						ai_can_valid_to_create_laamp_trigger = yes
						is_valid_for_laampdom = yes
					}
					modifier = {
						always = yes
						add = ep3_laamp_chance_score_value
					}
					modifier = {
						OR = {
							is_councillor = yes
							is_knight = yes
						}
						factor = 0.5
					}
					min = 0
					create_landless_adventurer_title_effect = {
						REASON = flag:voluntary
						FLAVOR_CHAR = scope:actor
					}
					scope:recipient = {
						send_interface_message = {
							type = event_generic_bad
							title =  lmf_interaction.0002.became_adventurer.tt
							right_icon = scope:actor
						}
					}
					if = {
						limit = { is_child_of = scope:recipient }
						add_character_modifier = {
							modifier = lust_for_adventure
							years = 5
						}
					}
				}
				25 = {
					modifier = {
						add = 75
						has_relation_friend = scope:recipient
					}
					modifier = {
						add = 25
						is_knight = yes
					}
					modifier = {
						add = 25
						is_councillor = yes
					}
					modifier = {
						factor = 0
						has_relation_rival = scope:recipient
					}
					ai_value_modifier = {
						ai_energy = -0.5
						min = -24
					}
					modifier = {
						add = 25
						any_child = {
							has_dynasty = yes
							dynasty = scope:actor.dynasty
							is_adult = no
						}
					}
					modifier = {
						add = 25
						OR = {
							is_married = yes
							is_betrothed = yes
						}
					}
					modifier = {
						add = -25
						has_ep3_dlc_trigger = yes
						ai_can_valid_to_create_laamp_trigger = yes
						is_valid_for_laampdom = yes
					}
					min = 1
				}
			}
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 20
				exists = scope:clear_name
			}
			modifier = {
				add = 50
				exists = scope:other_restitution
			}
			modifier = {
				factor = 2
				has_personality_submissive_trigger = yes
			}
			ai_value_modifier = {
				ai_vengefulness = -1
				ai_boldness = -0.5
				ai_greed = -0.5
				ai_honor = 0.5
			}
			min = 1
		}
	}
}

# Hidden event for courtiers
lmf_interaction.0003 = {
	hidden = yes

	trigger = {
		has_trait = disinherited
		is_available_quick = {
			adult = yes
			advanced_ruler = no
		}
		has_dynasty = yes
		is_dynast = no
		NOR = {
			has_character_flag = made_disinherit_demand
			has_game_rule = lmf_no_disinheritance_change
			has_trait = devoted
			has_trait = order_member
			has_trait = bastard
			has_trait = bastard_founder
			has_trait = gallivanter
			has_trait = eunuch
		}
		trigger_if = {
			limit = {
				NOR = {
					is_child_of = dynasty.dynast
					is_grandchild_of = dynasty.dynast
					is_great_grandchild_of = dynasty.dynast
				}
			}
			top_liege = dynasty.dynast.top_liege
		}
		dynasty.dynast = {
			is_landed = yes
			faith = root.faith
			is_available_adult = yes
			NOT = { has_character_flag = recently_received_disinherit_demand }
		}
		dynasty = {
			dynasty_prestige >= minor_dynasty_prestige_value
		}
	}

	immediate = {
		random = {
			chance = 0
			opinion_modifier = {
				who = dynasty.dynast
				opinion_target = root
				multiplier = 0.5
			}
			ai_value_modifier = {
				ai_boldness = 1
				ai_greed = 0.5
			}
			modifier = {
				add = 100
				has_strong_usable_hook = dynasty.dynast
			}
			modifier = {
				add = 20
				has_trait = ambitious
			}
			modifier = {
				add = -20
				has_trait = content
			}
			modifier = {
				add = 10
				has_trait = arrogant
			}
			modifier = {
				add = -10
				has_trait = humble
			}
			modifier = {
				add = -20
				NOT = {
					has_opinion_modifier = {
						modifier = disinherited_opinion
						target = dynasty.dynast
					}
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_relation_rival = dynasty.dynast
					has_relation_nemesis = dynasty.dynast
					has_trait = inbred
					has_trait = intellect_bad_3
					has_trait = bastard
					has_trait = denounced
				}
			}
			min = 0
			max = 100
			save_scope_as = actor
			dynasty.dynast = {
				save_scope_as = recipient
				if = {
					limit = {
						could_potentially_inherit_titles = { HEIR = root }
					}
					trigger_event = lmf_interaction.0001
				}
				else = {
					trigger_event = lmf_interaction.0010
				}
			}
		}
	}
}

# Liege of betrothed is informed of a disinheritance
lmf_interaction.0004 = {
	type = character_event
	title = lmf_interaction.0001.t
	desc = lmf_interaction.0004.desc
	theme = realm

	left_portrait = {
		character = scope:disinherited_character
		animation = shame
	}
	right_portrait = {
		character = scope:disinherited_betrothed
		animation = shock
	}

	option = {
		name = lmf_interaction.0004.a #I'll consider that a violation of the betrothal
		show_as_tooltip = {
			add_opinion = {
				target = scope:disinheritor
				modifier = disinherited_betrothal_opinion
			}
			scope:disinherited_betrothed = {
				break_betrothal = scope:disinherited_character
			}
		}
		save_scope_as = betrothed_liege
		scope:disinheritor = { trigger_event = lmf_interaction.0005 }
		ai_chance = {
			base = 50
			modifier = {
				add = 50
				scope:disinherited_character = {
					any_heir_title = {}
				}
			}
			modifier = {
				add = 50
				tier_difference = {
					target = scope:disinheritor
					value <= -1
				}
			}
			modifier = {
				add = 100
				tier_difference = {
					target = scope:disinheritor
					value <= -2
				}
			}
			ai_value_modifier = {
				ai_vengefulness = 1
			}
		}
	}
	option = {
		name = lmf_interaction.0004.b #The betrothal will continue
		add_opinion = {
			target = scope:disinheritor
			modifier = insult_opinion
			opinion = -15
		}
		scope:disinherited_betrothed = {
			add_opinion = {
				target = scope:disinheritor
				modifier = disinherited_spouse_opinion
			}
			if = {
				limit = {
					NOR = {
						has_relation_rival = scope:disinheritor
						has_relation_potential_rival = scope:disinheritor
					}
				}
				set_relation_potential_rival = scope:disinheritor
			}
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 50
				scope:disinherited_character = { is_playable_character = yes }
			}
			modifier = {
				add = 50
				tier_difference = {
					target = scope:disinheritor
					value >= 1
				}
			}
			modifier = {
				add = 100
				tier_difference = {
					target = scope:disinheritor
					value >= 2
				}
			}
			modifier = {
				factor = 0
				NOT = {
					yields_alliance = {
						candidate = scope:disinherited_betrothed
						target = scope:disinheritor
						target_candidate = scope:disinherited_character
					}
				}
			}
		}
	}
}

# Liege of betrothed ends the betrothal
lmf_interaction.0005 = {
	type = letter_event
	opening = lmf_interaction.0005.opening
	desc = lmf_interaction.0005.desc
	sender = {
		character = scope:betrothed_liege
		animation = anger
	}

	option = {
		name = lmf_interaction.0005.a
		if = {
			limit = {
				exists = scope:betrothed_liege
				NOT = { scope:betrothed_liege = root }
			}
			reverse_add_opinion = {
				target = scope:betrothed_liege
				modifier = disinherited_betrothal_opinion
			}
		}
		scope:disinherited_betrothed = {
			break_betrothal = scope:disinherited_character
		}
	}
}

# Disinherited dynasty member demands restitution after the fact
lmf_interaction.0010 = {
	type = character_event
	title = lmf_interaction.0001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:actor = { has_personality_submissive_trigger = yes }
				}
				desc = lmf_interaction.0010.opening.submissive
			}
			triggered_desc = {
				trigger = {
					scope:actor = {
						OR = {
							has_personality_dominant_trigger = yes
							is_hot_headed_trigger = yes
						}
					}
				}
				desc = lmf_interaction.0010.opening.dominant
			}
			desc = lmf_interaction.0010.opening
		}
		desc = lmf_interaction.0001.address
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						reverse_has_opinion_modifier = { modifier = disinherited_opinion target = scope:actor }
						AND = {
							exists = scope:disinheritor
							scope:disinheritor = scope:recipient
						}
					}
				}
				desc = lmf_interaction.0010.disinheritor
			}
			triggered_desc = {
				trigger = { exists = scope:disinheritor }
				desc = lmf_interaction.0010.formerdynast
			}
			desc = lmf_interaction.0010.dynast
		}
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:has_primary_claim }
				desc = lmf_interaction.0010.primary
			}
			triggered_desc = {
				trigger = { exists = scope:best_offer }
				desc = lmf_interaction.0010.bestoffer
			}
			desc = lmf_interaction.0010.fallthrough
		}
		desc = lmf_interaction.0010.mid
		first_valid = {
			triggered_desc = {
				trigger = { scope:actor = { is_landed = yes } }
				desc = lmf_interaction.0010.landed
			}
			desc = lmf_interaction.0010.unlanded
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:actor = { has_personality_submissive_trigger = yes }
				}
				desc = lmf_interaction.0010.ending.submissive
			}
			triggered_desc = {
				trigger = {
					scope:actor = {
						OR = {
							has_personality_dominant_trigger = yes
							is_hot_headed_trigger = yes
						}
					}
				}
				desc = lmf_interaction.0010.ending.dominant
			}
			desc = lmf_interaction.0010.ending
		}
	}
	theme = realm
	
	left_portrait = {
		character = scope:actor
		triggered_animation = {
			trigger = {
				scope:actor = { has_personality_submissive_trigger = yes }
			}
			animation = beg
		}
		triggered_animation = {
			trigger = {
				scope:actor = {
					OR = {
						has_personality_dominant_trigger = yes
						is_hot_headed_trigger = yes
					}
				}
			}
			animation = anger
		}
		animation = personality_bold
		camera = camera_event_right
	}

	immediate = {
		hidden_effect = {
			scope:actor = { add_character_flag = made_disinherit_demand }
			add_character_flag = { flag = recently_received_disinherit_demand days = 320 }
			# grab the original disinheritor
			if = {
				limit = { exists = scope:actor.var:disinheritor }
				scope:actor.var:disinheritor = { save_scope_as = disinheritor }
			}
			# are they a claimant on the primary title?
			if = {
				limit = {
					scope:actor = {
						OR = {
							AND = {
								has_variable_list = disinherited_titles
								any_in_list = {
									variable = disinherited_titles
									this = root.primary_title
									scope:actor = { has_claim_on = prev }
								}
							}
							AND = {
								NOT = { has_variable_list = disinherited_titles }
								has_claim_on = root.primary_title
							}
						}
					}
				}
				save_scope_value_as = { name = has_primary_claim value = yes }
			}
			# what is the highest title they deserve?
			if = {
				limit = {
					highest_held_title_tier > tier_barony
					exists = capital_county
					scope:actor = {
						has_variable_list = disinherited_titles
						any_in_list = {
							variable = disinherited_titles
							is_contested = no
							holder ?= {
								OR = {
									this = root
									any_liege_or_above = { this = root }
								}
							}
							NOR = {
								root.primary_title = this
								root.capital_county = this
								any_in_de_jure_hierarchy = { this = root.capital_county }
								holder ?= scope:actor
							}
							trigger_if = {
								limit = {
									tier >= tier_duchy
									scope:actor = { is_landed = no }
								}
								any_in_de_jure_hierarchy = {
									tier = tier_county
									holder ?= {
										OR = {
											this = root
											any_liege_or_above = { this = root }
										}
									}
								}
							}
						}
					}
				}
				scope:actor = {
					ordered_in_list = {
						variable = disinherited_titles
						order_by = tier
						limit = {
							is_contested = no
							holder ?= {
								this = root
							}
							NOR = {
								root.primary_title = this
								root.capital_county = this
								any_in_de_jure_hierarchy = { this = root.capital_county }
								holder ?= scope:actor
							}
							trigger_if = {
								limit = {
									tier >= tier_duchy
									scope:actor = { is_landed = no }
								}
								any_in_de_jure_hierarchy = {
									tier = tier_county
									holder ?= {
										OR = {
											this = root
											any_liege_or_above = { this = root }
										}
									}
								}
							}
						}
						alternative_limit = {
							is_contested = no
							holder ?= {
								any_liege_or_above = { this = root }
							}
							NOR = {
								root.primary_title = this
								root.capital_county = this
								any_in_de_jure_hierarchy = { this = root.capital_county }
								holder ?= scope:actor
							}
							trigger_if = {
								limit = {
									tier >= tier_duchy
									scope:actor = { is_landed = no }
								}
								any_in_de_jure_hierarchy = {
									tier = tier_county
									holder ?= {
										OR = {
											this = root
											any_liege_or_above = { this = root }
										}
									}
								}
							}
						}
						position = 0
						save_scope_as = best_offer
					}
				}
			}
			else_if = {
				limit = {
					highest_held_title_tier > tier_barony
					exists = capital_county
					scope:actor = {
						NOT = { has_variable_list = disinherited_titles }
						any_claim = {
							explicit = yes
							is_contested = no
							holder ?= {
								OR = {
									this = root
									any_liege_or_above = { this = root }
								}
							}
							NOR = {
								root.primary_title = this
								root.capital_county = this
								any_in_de_jure_hierarchy = { this = root.capital_county }
								holder ?= scope:actor
							}
							trigger_if = {
								limit = {
									tier >= tier_duchy
									scope:actor = { is_landed = no }
								}
								any_in_de_jure_hierarchy = {
									tier = tier_county
									holder ?= {
										OR = {
											this = root
											any_liege_or_above = { this = root }
										}
									}
								}
							}
						}
					}
				}
				scope:actor = {
					ordered_claim = {
						explicit = yes
						order_by = tier
						limit = {
							is_contested = no
							holder ?= {
								this = root
							}
							NOR = {
								root.primary_title = this
								root.capital_county = this
								any_in_de_jure_hierarchy = { this = root.capital_county }
								holder ?= scope:actor
							}
							trigger_if = {
								limit = {
									tier >= tier_duchy
									scope:actor = { is_landed = no }
								}
								any_in_de_jure_hierarchy = {
									tier = tier_county
									holder ?= {
										OR = {
											this = root
											any_liege_or_above = { this = root }
										}
									}
								}
							}
						}
						alternative_limit = {
							is_contested = no
							holder ?= {
								any_liege_or_above = { this = root }
							}
							NOR = {
								root.primary_title = this
								root.capital_county = this
								any_in_de_jure_hierarchy = { this = root.capital_county }
								holder ?= scope:actor
							}
							trigger_if = {
								limit = {
									tier >= tier_duchy
									scope:actor = { is_landed = no }
								}
								any_in_de_jure_hierarchy = {
									tier = tier_county
									holder ?= {
										OR = {
											this = root
											any_liege_or_above = { this = root }
										}
									}
								}
							}
						}
						position = 0
						save_scope_as = best_offer
					}
				}
			}
			# is there a lower title that would suit?
			if = {
				limit = {
					exists = scope:best_offer
					scope:best_offer.tier > tier_county
					scope:actor = {
						has_variable_list = disinherited_titles
						any_in_list = {
							variable = disinherited_titles
							tier < scope:best_offer.tier
							is_contested = no
							holder ?= {
								OR = {
									this = root
									any_liege_or_above = { this = root }
								}
							}
							NOR = {
								root.primary_title = this
								root.capital_county = this
								any_in_de_jure_hierarchy = { this = root.capital_county }
								holder ?= scope:actor
							}
							trigger_if = {
								limit = {
									tier >= tier_duchy
									scope:actor = { is_landed = no }
								}
								any_in_de_jure_hierarchy = {
									tier = tier_county
									holder ?= {
										OR = {
											this = root
											any_liege_or_above = { this = root }
										}
									}
								}
							}
						}
					}
				}
				scope:actor = {
					every_in_list = {
						variable = disinherited_titles
						limit = {
							is_contested = no
							holder ?= {
								OR = {
									this = root
									any_liege_or_above = { this = root }
								}
							}
							tier < scope:best_offer.tier
							NOR = {
								root.primary_title = this
								root.capital_county = this
								any_in_de_jure_hierarchy = { this = root.capital_county }
								holder ?= scope:actor
							}
							trigger_if = {
								limit = {
									tier >= tier_duchy
									scope:actor = { is_landed = no }
								}
								any_in_de_jure_hierarchy = {
									tier = tier_county
									holder ?= {
										OR = {
											this = root
											any_liege_or_above = { this = root }
										}
									}
								}
							}
						}
						add_to_list = secondary_offers
					}
				}
			}
			else_if = {
				limit = {
					exists = scope:best_offer
					scope:best_offer.tier > tier_county
					scope:actor = {
						NOT = { has_variable_list = disinherited_titles }
						any_claim = {
							explicit = yes
							tier < scope:best_offer.tier
							is_contested = no
							holder ?= {
								OR = {
									this = root
									any_liege_or_above = { this = root }
								}
							}
							NOR = {
								root.primary_title = this
								root.capital_county = this
								any_in_de_jure_hierarchy = { this = root.capital_county }
								holder ?= scope:actor
							}
							trigger_if = {
								limit = {
									tier >= tier_duchy
									scope:actor = { is_landed = no }
								}
								any_in_de_jure_hierarchy = {
									tier = tier_county
									holder ?= {
										OR = {
											this = root
											any_liege_or_above = { this = root }
										}
									}
								}
							}
						}
					}
				}
				scope:actor = {
					every_claim = {
						explicit = yes
						limit = {
							is_contested = no
							holder ?= {
								OR = {
									this = root
									any_liege_or_above = { this = root }
								}
							}
							tier < scope:best_offer.tier
							NOR = {
								root.primary_title = this
								root.capital_county = this
								any_in_de_jure_hierarchy = { this = root.capital_county }
								holder ?= scope:actor
							}
							trigger_if = {
								limit = {
									tier >= tier_duchy
									scope:actor = { is_landed = no }
								}
								any_in_de_jure_hierarchy = {
									tier = tier_county
									holder ?= {
										OR = {
											this = root
											any_liege_or_above = { this = root }
										}
									}
								}
							}
						}
						add_to_list = secondary_offers
					}
				}
			}
			if = {
				limit = { list_size:secondary_offers > 0 }
				random_in_list = {
					list = secondary_offers
					limit = {
						scope:best_offer.tier = tier_empire
						tier = tier_kingdom
					}
					alternative_limit = {
						scope:best_offer.tier = tier_kingdom
						tier = tier_duchy
					}
					alternative_limit = {
						tier = tier_county
					}
					weight = {
						base = 1
						modifier = {
							add = 1000
							scope:actor = { is_landed = yes }
							any_in_de_jure_hierarchy = { holder ?= scope:actor }
						}
						modifier = {
							add = 100
							tier = tier_county
							scope:actor = { is_landed = yes }
							any_neighboring_county = {
								holder ?= {
									OR = {
										this = scope:actor
										any_liege_or_above = { this = scope:actor }
									}
								}
							}
						}
						modifier = {
							add = 100
							tier > tier_county
							scope:actor = { is_landed = yes }
							any_de_jure_county = {
								any_neighboring_county = {
									holder ?= {
										OR = {
											this = scope:actor
											any_liege_or_above = { this = scope:actor }
										}
									}
								}
							}
						}
						modifier = {
							add = 10
							scope:actor = { is_landed = no }
							NOT = {
								any_this_title_or_de_jure_above = {
									is_ruler_de_jure_liege_or_above = root
								}
							}
						}
						modifier = {
							add = 10
							scope:actor = { is_landed = no }
							tier = tier_county
							NOT = {
								any_neighboring_county = {
									holder = root
								}
							}
						}
						modifier = {
							add = 10
							scope:actor = { is_landed = no }
							tier = tier_county
							NOT = {
								any_de_jure_county = {
									any_neighboring_county = {
										holder = root
									}
								}
							}
						}
					}
					save_scope_as = secondary_offer
				}
			}		
		
			# make the lists of titles taken/vassalized
			if = {
				limit = { exists = scope:best_offer }
				scope:best_offer = {
					add_to_list = best_offer_titles_taken
					every_in_de_jure_hierarchy = {
						if = {
							limit = { holder ?= root }
							add_to_list = best_offer_titles_taken
						}
						if = {
							limit = {
								holder ?= {
									target_is_liege_or_above = root
									NOT = { this = scope:actor }
								}
								NOT = { is_in_list = best_offer_vassals_taken }
							}
							add_to_list = best_offer_vassals_taken
						}
					}
				}
				if = {
					limit = {
						scope:actor = { is_landed = no }
						scope:best_offer = {
							tier > tier_county
							NOT = {
								any_in_de_jure_hierarchy = {
									tier = tier_county
									is_contested = no
									holder ?= root
								}
							}
							any_in_de_jure_hierarchy = {
								tier = tier_county
								is_contested = no
								holder ?= {
									any_liege_or_above = { this = root }
									NOT = { this = scope:actor }
								}
							}
						}
					}
					scope:best_offer = {
						random_in_de_jure_hierarchy = {
							limit = {
								this = scope:best_offer.title_capital_county
								is_contested = no
								holder ?= {
									any_liege_or_above = { this = root }
									NOT = { this = scope:actor }
								}
							}
							alternative_limit = {
								tier = tier_county
								is_contested = no
								holder ?= {
									any_liege_or_above = { this = root }
									NOT = { this = scope:actor }
									any_held_title = {
										tier = tier_county
										count > 1
									}
								}
							}
							alternative_limit = {
								tier = tier_county
								is_contested = no
								holder ?= {
									any_liege_or_above = { this = root }
									NOT = { this = scope:actor }
								}
							}
							weight = {
								base = 1
								modifier = {
									add = 50
									duchy = scope:best_offer.title_capital_county.duchy
								}
								modifier = {
									add = 5
									has_coastal_province = yes
								}
							}
							add_to_list = best_offer_titles_taken
							if = {
								limit = {
									holder = {
										is_in_list = best_offer_vassals_taken
										highest_held_title_tier = tier_county
										any_held_title = {
											tier = tier_county
											count < 2
										}
									}
								}
								holder = { remove_from_list = best_offer_vassals_taken }
							}
						}
					}
				}
			}
			if = {
				limit = { exists = scope:secondary_offer }
				scope:secondary_offer = {
					add_to_list = secondary_offer_titles_taken
					every_in_de_jure_hierarchy = {
						if = {
							limit = { holder ?= root }
							add_to_list = secondary_offer_titles_taken
						}
						if = {
							limit = {
								holder ?= { target_is_liege_or_above = root }
								NOT = { is_in_list = best_offer_vassals_taken }
							}
							add_to_list = secondary_offer_vassals_taken
						}
					}
				}
				if = {
					limit = {
						scope:actor = { is_landed = no }
						scope:secondary_offer = {
							tier > tier_county
							NOT = {
								any_in_de_jure_hierarchy = {
									tier = tier_county
									is_contested = no
									holder ?= root
								}
							}
							any_in_de_jure_hierarchy = {
								tier = tier_county
								is_contested = no
								holder ?= {
									any_liege_or_above = { this = root }
								}
							}
						}
					}
					scope:secondary_offer = {
						random_in_de_jure_hierarchy = {
							limit = {
								this = scope:secondary_offer.title_capital_county
								is_contested = no
								holder ?= {
									any_liege_or_above = { this = root }
								}
							}
							alternative_limit = {
								tier = tier_county
								is_contested = no
								holder ?= {
									any_liege_or_above = { this = root }
									any_held_title = {
										tier = tier_county
										count > 1
									}
								}
							}
							alternative_limit = {
								tier = tier_county
								is_contested = no
								holder ?= {
									any_liege_or_above = { this = root }
								}
							}
							weight = {
								base = 1
								modifier = {
									add = 50
									duchy = scope:secondary_offer.title_capital_county.duchy
								}
								modifier = {
									add = 5
									has_coastal_province = yes
								}
							}
							add_to_list = secondary_offer_titles_taken
							if = {
								limit = {
									holder = {
										is_in_list = secondary_offer_vassals_taken
										highest_held_title_tier = tier_county
										any_held_title = {
											tier = tier_county
											count < 2
										}
									}
								}
								holder = { remove_from_list = secondary_offer_vassals_taken }
							}
						}
					}
				}
			}
		}
	}
	
	option = {
		name = lmf_interaction.0010.a # He's right. He shall have inheritance restored
		trigger = { exists = scope:best_offer }
		dynasty = { add_dynasty_prestige = minor_dynasty_prestige_loss }
		show_as_tooltip = {
			if = {
				limit = {
					scope:actor = { has_usable_hook = scope:recipient }
				}
				scope:actor = { use_hook = scope:recipient }
			}
			create_title_and_vassal_change = {
				type = granted
				save_scope_as = change
				add_claim_on_loss = no
			}
			every_in_list = {
				list = best_offer_titles_taken
				hidden_effect = {
					change_title_holder = {
						holder = scope:actor
						change = scope:change
						take_baronies = yes
					}
				}
			}
			every_in_list = {
				list = best_offer_vassals_taken
				change_liege = {
					liege = scope:actor
					change = scope:change
				}
			}
			resolve_title_and_vassal_change = scope:change
			remove_disinherited_effect = { DYNAST = scope:recipient DISINHERITED = scope:actor }
			scope:actor = { custom_tooltip = lmf_interaction.0010.a.tt }
		}
		scope:actor = { trigger_event = lmf_interaction.0011 }
		ai_chance = {
			base = 0
			ai_value_modifier = {
				ai_honor = 1.0
				ai_greed = -0.5
			}
			opinion_modifier = {
				who = scope:recipient
				opinion_target = scope:actor
				multiplier = 0.5
				max = 20
			}
			modifier = {
				add = -20
				scope:best_offer.holder = {
					NOR = {
						this = root
						has_relation_rival = root
					}
				}
			}
			modifier = {
				add = -50
				primary_title.tier = scope:best_offer.tier
			}
			modifier = {
				add = -50
				scope:actor = {
					OR = {
						has_trait = inbred
						has_trait = intellect_bad_3
						has_trait = incapable
						has_any_trait_disapproved_of_by = { CHARACTER = scope:recipient }
						AND = {
							has_character_modifier = known_non_believer
							scope:recipient.ai_zeal >= medium_positive_ai_value
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				scope:actor = {
					OR = {
						has_trait = legitimized_bastard
						has_trait = disputed_heritage
						any_secret = {
							secret_type = secret_disputed_heritage
							is_known_by = root
						}
					}
				}
			}
			modifier = {
				factor = 0
				has_relation_rival = scope:actor
			}
			min = 0
		}
	}
	option = {
		name = lmf_interaction.0010.b # Perhaps he would accept a lesser title?
		trigger = { exists = scope:secondary_offer }
		custom_tooltip = lmf_interaction.0010.muchless.tt
		dynasty = { add_dynasty_prestige = minor_dynasty_prestige_loss }
		reverse_add_opinion = { target = scope:actor modifier = refused_restore_inheritance_opinion }
		show_as_tooltip = {
			if = {
				limit = {
					scope:actor = { has_usable_hook = scope:recipient }
				}
				scope:actor = { use_hook = scope:recipient }
			}
			create_title_and_vassal_change = {
				type = granted
				save_scope_as = change
				add_claim_on_loss = no
			}
			every_in_list = {
				list = secondary_offer_titles_taken
				hidden_effect = {
					change_title_holder = {
						holder = scope:actor
						change = scope:change
						take_baronies = yes
					}
				}
			}
			every_in_list = {
				list = secondary_offer_vassals_taken
				change_liege = {
					liege = scope:actor
					change = scope:change
				}
			}
			resolve_title_and_vassal_change = scope:change
			remove_disinherited_effect = { DYNAST = scope:recipient DISINHERITED = scope:actor }
			scope:actor = { custom_tooltip = lmf_interaction.0010.b.tt }
		}
		scope:actor = { trigger_event = lmf_interaction.0012 }
		ai_chance = {
			base = 20
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_honor = 1.0
				ai_greed = -0.5
			}
			opinion_modifier = {
				who = scope:recipient
				opinion_target = scope:actor
				multiplier = 0.5
				max = 20
			}
			modifier = {
				add = -20
				scope:best_offer.holder = {
					NOR = {
						this = root
						has_relation_rival = root
					}
				}
			}
			modifier = {
				factor = 0.5
				scope:actor = {
					OR = {
						has_trait = legitimized_bastard
						has_trait = disputed_heritage
						any_secret = {
							secret_type = secret_disputed_heritage
							is_known_by = root
						}
					}
				}
			}
			modifier = {
				factor = 0
				has_relation_rival = scope:actor
			}
			min = 1
		}
	}
	option = {
		name = lmf_interaction.0010.c # I can only offer him other forms of restitution
		trigger = {
			exists = scope:secondary_offer
			NOT = { scope:actor = { has_strong_usable_hook = scope:recipient } }
		}
		show_as_unavailable = {
			exists = scope:secondary_offer
			scope:actor = { has_strong_usable_hook = scope:recipient }
		}
		custom_tooltip = lmf_interaction.0010.might.tt
		dynasty = { add_dynasty_prestige = minor_dynasty_prestige_loss }
		reverse_add_opinion = { target = scope:actor modifier = refused_restore_inheritance_opinion }
		show_as_tooltip = {
			pay_short_term_gold = {
				target = scope:actor
				gold = major_gold_value
			}
			scope:actor = {
				if = {
					limit = {
						can_add_hook = {
							type = indebted_hook
							target = scope:recipient
						}
					}
					add_hook = {
						type = indebted_hook
						target = scope:recipient
					}
				}
			}
			remove_disinherited_effect = { DYNAST = scope:recipient DISINHERITED = scope:actor }
		}
		save_scope_value_as = { name = other_restitution value = yes }
		scope:actor = { trigger_event = lmf_interaction.0002 }
		ai_chance = {
			base = 40
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_honor = 0.5
			}
			opinion_modifier = {
				who = scope:recipient
				opinion_target = scope:actor
				multiplier = 0.5
			}
			min = 0
		}
	}
	option = {
		name = lmf_interaction.0010.d # I will clear his name, no more
		trigger = {
			NOT = { scope:actor = { has_usable_hook = scope:recipient } }
		}
		show_as_unavailable = {
			scope:actor = { has_usable_hook = scope:recipient }
		}
		custom_tooltip = lmf_interaction.0010.likely.tt
		dynasty = { add_dynasty_prestige = minor_dynasty_prestige_loss }
		reverse_add_opinion = { target = scope:actor modifier = refused_restore_inheritance_opinion }
		show_as_tooltip = {
			remove_disinherited_effect = { DYNAST = scope:recipient DISINHERITED = scope:actor }
		}
		save_scope_value_as = { name = clear_name value = yes }
		scope:actor = { trigger_event = lmf_interaction.0002 }
		ai_chance = {
			base = 30
			ai_value_modifier = {
				ai_greed = 0.5
				ai_honor = -0.5
			}
			modifier = {
				factor = 0.5
				has_relation_friend = scope:actor
			}
			min = 0
		}
	}
	option = {
		name = lmf_interaction.0010.e # Explain my regrets, but there is nothing I can do.
		trigger = {
			NOT = { scope:actor = { has_usable_hook = scope:recipient } }
		}
		show_as_unavailable = {
			scope:actor = { has_usable_hook = scope:recipient }
		}
		custom_tooltip = lmf_interaction.0010.vlikely.tt
		reverse_add_opinion = { target = scope:actor modifier = refused_restore_inheritance_opinion }
		scope:actor = { trigger_event = lmf_interaction.0002 }
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_greed = 1.0
				ai_honor = -0.5
				ai_vengefulness = 0.5
			}
			opinion_modifier = {
				who = scope:recipient
				opinion_target = scope:actor
				multiplier = -0.5
			}
			modifier = {
				factor = 20
				scope:actor = {
					OR = {
						has_trait = legitimized_bastard
						has_trait = disputed_heritage
						any_secret = {
							secret_type = secret_disputed_heritage
							is_known_by = root
						}
					}
				}
			}
			modifier = {
				add = 20
				scope:actor = {
					OR = {
						has_trait = inbred
						has_trait = intellect_bad_3
						has_trait = incapable
						has_any_trait_disapproved_of_by = { CHARACTER = scope:recipient }
						AND = {
							has_character_modifier = known_non_believer
							scope:recipient.ai_zeal >= medium_positive_ai_value
						}
					}
				}
			}
			modifier = {
				factor = 0
				has_relation_friend = scope:actor
			}
			min = 1
		}
	}
}

# Disinherited dynasty member had full inheritance restored
lmf_interaction.0011 = {
	type = character_event
	title = lmf_interaction.0011.t
	desc = lmf_interaction.0011.desc
	theme = realm
	
	left_portrait = {
		character = scope:recipient
		animation = throne_room_conversation_3
	}
	
	immediate = {
		remove_disinherited_effect = { DYNAST = scope:recipient DISINHERITED = scope:actor }
		if = {
			limit = { has_usable_hook = scope:recipient }
			use_hook = scope:recipient
		}
	}
	
	option = {
		name = lmf_interaction.0011.a
		create_title_and_vassal_change = {
			type = granted
			save_scope_as = change
			add_claim_on_loss = no
		}
		every_in_list = {
			list = best_offer_titles_taken
			hidden_effect = {
				change_title_holder = {
					holder = scope:actor
					change = scope:change
					take_baronies = yes
				}
			}
		}
		every_in_list = {
			list = best_offer_vassals_taken
			change_liege = {
				liege = scope:actor
				change = scope:change
			}
		}
		resolve_title_and_vassal_change = scope:change
		scope:actor = { custom_tooltip = lmf_interaction.0010.a.tt }
	}
}

# Disinherited dynasty member received lesser title as peace offering
lmf_interaction.0012 = {
	type = character_event
	title = lmf_interaction.0012.t
	desc = lmf_interaction.0012.desc
	theme = realm
	
	left_portrait = {
		character = scope:recipient
		animation = throne_room_conversation_3
	}
	
	immediate = {
		remove_disinherited_effect = { DYNAST = scope:recipient DISINHERITED = scope:actor }
		if = {
			limit = { has_usable_hook = scope:recipient }
			use_hook = scope:recipient
		}
		create_title_and_vassal_change = {
			type = granted
			save_scope_as = change
			add_claim_on_loss = no
		}
		every_in_list = {
			list = secondary_offer_titles_taken
			hidden_effect = {
				change_title_holder = {
					holder = scope:actor
					change = scope:change
					take_baronies = yes
				}
			}
		}
		every_in_list = {
			list = secondary_offer_vassals_taken
			change_liege = {
				liege = scope:actor
				change = scope:change
			}
		}
		resolve_title_and_vassal_change = scope:change
		scope:actor = { custom_tooltip = lmf_interaction.0010.b.tt }
		save_scope_value_as = { name = lesser_offer value = yes }
	}
	
	option = {
		name = lmf_interaction.0012.a #This is still an outrage!
		stress_impact = {
			forgiving = medium_stress_impact_gain
			humble = medium_stress_impact_gain
			content = minor_stress_impact_gain
			calm = minor_stress_impact_gain
		}
		show_as_tooltip = { outraged_inheritance_effect = yes }
		angered_inheritance_refusal_effect = yes
		hidden_effect = {
			scope:recipient = {
				send_interface_message = {
					type = event_generic_bad
					title = lmf_interaction.0012.a.tt
					left_icon = scope:actor
					scope:actor = {
						outraged_inheritance_effect = yes
						if = {
							limit = { exists = scope:trait_added }
							add_trait_force_tooltip = scope:trait_added
						}
						if = {
							limit = { exists = scope:trait_removed }
							remove_trait_force_tooltip = scope:trait_removed
						}
					}
				}
			}
		}
		ai_chance = {
			base = 10
			modifier = {
				factor = 2
				is_hot_headed_trigger = yes
			}
			ai_value_modifier = {
				ai_vengefulness = 1
				ai_boldness = 0.5
				ai_greed = 1.0
			}
			min = 0
		}
	}
	option = {
		name = lmf_interaction.0012.b #This will have to suffice
		stress_impact = {
			vengeful = medium_stress_impact_gain
			wrathful = medium_stress_impact_gain
			ambitious = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		accepted_inheritance_refusal_effect = yes
		hidden_effect = {
			scope:recipient = {
				send_interface_message = {
					type = event_generic_good
					title = lmf_interaction.0012.b.tt
					left_icon = scope:actor
					scope:actor = {
						if = {
							limit = { exists = scope:trait_added }
							add_trait_force_tooltip = scope:trait_added
						}
						if = {
							limit = { exists = scope:trait_removed }
							remove_trait_force_tooltip = scope:trait_removed
						}
					}
				}
			}
		}
		ai_chance = {
			base = 80
			modifier = {
				factor = 2
				has_personality_submissive_trigger = yes
			}
			ai_value_modifier = {
				ai_vengefulness = -1
				ai_boldness = -0.5
				ai_greed = -0.5
				ai_honor = 0.5
			}
			min = 1
		}
	}
}


##################
# STARTUP EVENTS #
##################

# To warn AGOT users
lmf_interaction.1000 = {
	scope = none
	hidden = yes
	
	trigger = {
		exists = global_var:AGOT_is_loaded
	}
	
	immediate = {
		every_player = {
			trigger_event = { id = lmf_interaction.1001 days = 1 }
		}
	}
}	

lmf_interaction.1001 = {
	type = character_event
	title = lmf_interaction.1000.t
	desc = lmf_interaction.1000.desc
	theme = realm
	
	left_portrait = {
		character = root
		animation = thinking
	}
	
	trigger = {
		exists = global_var:AGOT_is_loaded
	}
	
	option = {
		name = lmf_interaction.1000.a
	}
	option = {
		name = lmf_interaction.1000.b
	}
}


#################################
# CONFRONTING FAMILY OVER LOVER #
#################################

scripted_effect show_auto_accept_reason_effect = {
	save_temporary_scope_as = check
	if = {
		limit = { root = { has_hook = scope:check } }
		custom_tooltip = lmfmod.demand.agree.hook.tt
	}
	else_if = {
		limit = { is_imprisoned_by = root }
		custom_tooltip = lmfmod.demand.agree.prisoner.tt
	}
	else = {
		custom_tooltip = lmfmod.demand.agree.courtier.tt
	}
}

scripted_effect demand_remove_hook_effect = {
	if = {
		limit = { has_hook = $TARGET$ }
		remove_hook = { target = $TARGET$ }
	}
	$TARGET$ = {
		if = {
			limit = { is_imprisoned_by = root }
			release_from_prison = yes
		}
		if = {
			limit = { target_is_liege_or_above = root }
			consume_all_criminal_reasons_effect = {
				LIEGE = root
				CRIMINAL = $TARGET$
			}
		}
	}
}

scripted_effect demand_end_relationship_effect = {
	if = {
		limit = {
			$TARGET$ = { has_relation_soulmate = $TARGET_LOVER$ }
		}
		$TARGET$ = {
			progress_towards_rival_effect = {
				CHARACTER = $DEMANDER$
				REASON = interfered_in_my_romance
				OPINION = -50
			}
		}
		$TARGET_LOVER$ = {
			worsen_relationship_effect = {
				TARGET = $DEMANDER$
				REASON = interfered_in_my_romance
			}
		}
	}
	else = {
		$TARGET$ = {
			worsen_relationship_effect = {
				TARGET = $DEMANDER$
				REASON = interfered_in_my_romance
			}
		}
	}
	lover_breakup_effect = {
		BREAKER = $TARGET$
		LOVER = $TARGET_LOVER$
	}
}

scripted_effect end_all_other_relationships_effect = {
	custom_tooltip = lmf_interaction.1208.tt
	hidden_effect = {
		scope:recipient = {
			every_relation = {
				type = lover
				limit = {
					NOT = { this = scope:family_lover }
				}
				save_temporary_scope_as = extra_lover
				lover_breakup_effect = {
					BREAKER = scope:recipient
					LOVER = scope:extra_lover
				}
			}
		}
		scope:family_lover = {
			every_relation = {
				type = lover
				limit = {
					NOT = { this = scope:recipient }
				}
				save_temporary_scope_as = extra_lover
				lover_breakup_effect = {
					BREAKER = scope:family_lover
					LOVER = scope:extra_lover
				}
			}
		}
	}
}

# Confronted family member has more than one lover
lmf_interaction.1200 = {
	type = character_event
	title = lmf_interaction.1200.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:lover_3 }
				desc = lmf_interaction.1200.desc.three
			}
			desc = lmf_interaction.1200.desc.two
		}
		desc = lmf_interaction.1200.desc.mid
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:lover_3 }
				desc = lmf_interaction.1200.desc.three.end
			}
			desc = lmf_interaction.1200.desc.two.end
		}
	}
	theme = family

	left_portrait = {
		character = scope:recipient
		animation = shame
	}

	immediate = {
		hidden_effect = {
			scope:recipient = {
				add_character_flag = {
					flag = recent_lover_demand
					months = 12
				}
				random_relation = {
					type = lover
					limit = {
						is_lover_known_to_character = { CHARACTER = scope:actor LOVER = scope:recipient }
					}
					save_scope_as = lover_1
				}
				random_relation = {
					type = lover
					limit = {
						is_lover_known_to_character = { CHARACTER = scope:actor LOVER = scope:recipient }
						NOT = { this = scope:lover_1 }
					}
					save_scope_as = lover_2
				}
				if = {
					limit = { num_of_relation_lover > 2 }
					random_relation = {
						type = lover
						limit = {
							is_lover_known_to_character = { CHARACTER = scope:actor LOVER = scope:recipient }
							NOT = { this = scope:lover_1 }
							NOT = { this = scope:lover_2 }
						}
						save_scope_as = lover_3
					}
				}
			}
			if = {
				limit = {
					scope:recipient = {
						OR = {
							is_courtier_of = root
							is_imprisoned_by = root
							root = { has_hook = scope:recipient }
						}
					}
				}
				save_scope_value_as = {
					name = recipient_auto_agree
					value = flag:yes
				}
			}
		}
	}

	option = {
		trigger = { exists = scope:lover_1 }
		name = lmf_interaction.1200.a # This is about lover #1
		scope:lover_1 = { save_scope_as = family_lover }
		trigger_event = lmf_interaction.1201
		ai_chance = {
			base = 0
			modifier = {
				add = 100
				has_relation_rival = scope:lover_1
			}
		}
	}
	option = {
		trigger = { exists = scope:lover_2 }
		name = lmf_interaction.1200.b # This is about lover #2
		scope:lover_2 = { save_scope_as = family_lover }
		trigger_event = lmf_interaction.1201
		ai_chance = {
			base = 0
			modifier = {
				add = 100
				has_relation_rival = scope:lover_2
			}
		}
	}
	option = {
		trigger = { exists = scope:lover_3 }
		name = lmf_interaction.1200.c # This is about lover #3
		scope:lover_3 = { save_scope_as = family_lover }
		trigger_event = lmf_interaction.1201
		ai_chance = {
			base = 0
			modifier = {
				add = 100
				has_relation_rival = scope:lover_3
			}
		}
	}
	option = {
		name = {
			trigger = { exists = scope:lover_3 }
			text = lmf_interaction.1200.d # This is about all of them!
		}
		name = {
			trigger = { NOT = { exists = scope:lover_3 } }
			text = lmf_interaction.1200.e # This is about both of them!
		}
		if = {
			limit = { exists = scope:recipient_auto_agree }
			scope:recipient = { show_auto_accept_reason_effect = yes }
			demand_remove_hook_effect = { TARGET = scope:recipient }

			if = {
				limit = {
					scope:recipient = {
						OR = {
							AND = {
								exists = scope:lover_1
								has_relation_soulmate = scope:lover_1
							}
							AND = {
								exists = scope:lover_2
								has_relation_soulmate = scope:lover_2
							}
							AND = {
								exists = scope:lover_3
								has_relation_soulmate = scope:lover_3
							}
						}
					}
				}
				scope:recipient = {
					progress_towards_rival_effect = {
						CHARACTER = root
						REASON = interfered_in_my_romance
						OPINION = -50
					}
				}
			}
			else = {
				scope:recipient = {
					worsen_relationship_effect = {
						TARGET = root
						REASON = interfered_in_my_romance
					}
				}
			}

			if = {
				limit = { exists = scope:lover_1 }
				scope:lover_1 = {
					worsen_relationship_effect = {
						TARGET = root
						REASON = interfered_in_my_romance
					}
				}
				lover_breakup_effect = {
					BREAKER = scope:recipient
					LOVER = scope:lover_1
				}
			}
			if = {
				limit = { exists = scope:lover_2 }
				scope:lover_2 = {
					worsen_relationship_effect = {
						TARGET = root
						REASON = interfered_in_my_romance
					}
				}
				lover_breakup_effect = {
					BREAKER = scope:recipient
					LOVER = scope:lover_2
				}
			}
			if = {
				limit = { exists = scope:lover_3 }
				scope:lover_3 = {
					worsen_relationship_effect = {
						TARGET = root
						REASON = interfered_in_my_romance
					}
				}
				lover_breakup_effect = {
					BREAKER = scope:recipient
					LOVER = scope:lover_3
				}
			}
		}
		else = {
			random_list = {
				10 = {
					modifier = {
						add = {
							value = root.diplomacy
							multiply = 3
						}
					}
					modifier = {
						add = {
							value = root.intrigue
							multiply = 2
						}
					}
					modifier = {
						add = 25
						OR = {
							has_relation_lover = scope:recipient
							has_relation_friend = scope:recipient
						}
					}
					modifier = {
						add = 10
						scope:recipient = { has_trait = humble }
					}
					modifier = {
						add = 10
						scope:recipient = { has_trait = craven }
					}
					modifier = {
						add = 10
						scope:recipient = { has_trait = trusting }
					}
					modifier = {
						add = 10
						scope:recipient = { has_trait = chaste }
					}
					ai_value_modifier = {
						who = scope:recipient
						ai_honor = 0.5
						ai_boldness = -0.5
					}
					opinion_modifier = {
						who = scope:recipient
						opinion_target = root
						multiplier = 0.5
					}
					min = 0
					custom_tooltip = lmf_interaction.1200.a.success.tt
					trigger_event = lmf_interaction.1206
				}
				75 = {
					modifier = {
						add = 25
						scope:recipient = {
							OR = {
								AND = {
									exists = scope:lover_1
									has_relation_soulmate = scope:lover_1
								}
								AND = {
									exists = scope:lover_2
									has_relation_soulmate = scope:lover_2
								}
								AND = {
									exists = scope:lover_3
									has_relation_soulmate = scope:lover_3
								}
							}
						}
					}
					modifier = {
						add = 25
						scope:recipient = { is_playable_character = yes }
					}
					modifier = {
						add = 25
						scope:recipient = {
							is_landed = yes
							is_powerful_vassal_of = root
						}
					}
					modifier = {
						add = 10
						scope:recipient = { has_trait = paranoid }
					}
					modifier = {
						add = 10
						scope:recipient = { has_trait = wrathful }
					}
					modifier = {
						add = 10
						scope:recipient = { has_trait = lustful }
					}
					min = 0
					custom_tooltip = lmf_interaction.1200.a.failure.tt
					trigger_event = lmf_interaction.1207
				}
			}
		}
		ai_chance = {
			base = 10
		}
	}
}

# What to do about the lover?
lmf_interaction.1201 = {
	type = character_event
	title = lmf_interaction.1201.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:is_secret_affair }
				desc = lmf_interaction.1201.desc.secret
			}
			desc = lmf_interaction.1201.desc.open
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:recipient = { is_playable_character = yes }
					scope:family_lover = { has_any_court_relationship_with = { CHARACTER = scope:recipient } }
				}
				desc = lmf_interaction.1201.desc.theirs
			}
			desc = lmf_interaction.1201.desc.default
		}
		desc = lmf_interaction.1201.desc.mid
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:is_secret_affair }
				desc = lmf_interaction.1201.desc.secret.end
			}
			desc = lmf_interaction.1201.desc.open.end
		}
	}
	theme = family

	right_portrait = {
		character = scope:recipient
		animation = shame
	}
	left_portrait = {
		character = root
		animation = disapproval
	}
	lower_right_portrait = scope:family_lover

	immediate = {
		hidden_effect = {
			scope:recipient = {
				add_character_flag = {
					flag = recent_lover_demand
					months = 12
				}
			}
			if = {
				limit = {
					scope:recipient = {
						any_secret = {
							secret_type = secret_lover
							is_known_by = root
							secret_target = scope:family_lover
						}
					}
				}
				save_scope_value_as = {
					name = is_secret_affair
					value = flag:yes
				}
			}
			if = {
				limit = {
					scope:family_lover = {
						can_marry_character_trigger = { CHARACTER = scope:recipient }
						OR = {
							is_playable_character = yes
							is_courtier = no
							is_courtier_of = root
							is_imprisoned_by = root
							root = { has_hook = scope:family_lover }
							AND = {
								is_courtier = yes
								exists = liege
								liege = {
									is_ai = yes
									NOT = { is_close_or_extended_family_of = scope:family_lover }
								}
							}
						}
					}
				}
				save_scope_value_as = {
					name = marriage_option
					value = flag:yes
				}
			}
			if = {
				limit = {
					scope:recipient = {
						OR = {
							is_courtier_of = root
							is_imprisoned_by = root
							root = { has_hook = scope:recipient }
						}
					}
				}
				save_scope_value_as = {
					name = recipient_auto_agree
					value = flag:yes
				}
			}
			if = {
				limit = {
					scope:family_lover = {
						OR = {
							is_courtier_of = root
							is_imprisoned_by = root
							root = { has_hook = scope:family_lover }
						}
					}
				}
				save_scope_value_as = {
					name = lover_auto_agree
					value = flag:yes
				}
			}
		}
	}

	option = {
		name = lmf_interaction.1201.a #They must end things
		if = {
			limit = { exists = scope:recipient_auto_agree }
			scope:recipient = { show_auto_accept_reason_effect = yes }
			demand_remove_hook_effect = { TARGET = scope:recipient }
			demand_end_relationship_effect = { TARGET = scope:recipient TARGET_LOVER = scope:family_lover DEMANDER = root }
		}
		else = {
			random_list = {
				10 = {
					ai_convince_family_end_relationship_modifier = yes
					min = 0
					custom_tooltip = lmf_interaction.1201.a.success.tt
					trigger_event = lmf_interaction.1202
				}
				50 = {
					ai_convince_family_end_relationship_neg_modifier = yes
					min = 0
					custom_tooltip = lmf_interaction.1201.a.failure.tt
					trigger_event = lmf_interaction.1203
				}
			}
		}
		ai_chance = {
			base = 50
		}
	}
	option = {
		name = lmf_interaction.1201.b #I will speak to the lover
		trigger = {
			NOT = {
				has_opinion_modifier = {
					target = scope:family_lover
					modifier = refused_my_lover_demand_opinion
				}
			}
			scope:family_lover = {
				OR = {
					target_is_liege_or_above = scope:actor
					in_diplomatic_range = root
				}
				is_ai = yes
				is_incapable = no
				has_contagious_deadly_disease_trigger = no
				OR = {
					is_imprisoned = no
					is_imprisoned_by = scope:actor
				}
				trigger_if = {
					limit = { is_playable_character = yes }
					NOT = { is_at_war_with = root }
				}
			}
		}
		if = {
			limit = { exists = scope:lover_auto_agree }
			scope:family_lover = { show_auto_accept_reason_effect = yes }
			demand_remove_hook_effect = { TARGET = scope:family_lover }
			demand_end_relationship_effect = { TARGET = scope:family_lover TARGET_LOVER = scope:recipient DEMANDER = root }
		}
		else = {
			random_list = {
				0 = {
					ai_convince_lover_end_relationship_modifier = yes
					min = 0
					custom_tooltip = lmf_interaction.1201.b.success.tt
					trigger_event = lmf_interaction.1204
				}
				50 = {
					ai_convince_lover_end_relationship_neg_modifier = yes
					min = 0
					custom_tooltip = lmf_interaction.1201.b.failure.tt
					trigger_event = lmf_interaction.1205
				}
			}
		}
		ai_chance = {
			base = 50
		}
	}
	option = {
		trigger = {
			exists = scope:marriage_option
			exists = scope:recipient_auto_agree
			exists = scope:lover_auto_agree
		}
		name = lmf_interaction.1201.c #They must get married at once
		scope:recipient = { show_auto_accept_reason_effect = yes }
		scope:family_lover = { show_auto_accept_reason_effect = yes }
		custom_tooltip = lmf_interaction.1201.c.tt
		trigger_event = lmf_interaction.1208
		ai_chance = {
			base = 0
		}
	}
	option = {
		trigger = {
			exists = scope:marriage_option
			exists = scope:recipient_auto_agree
			NOT = { exists = scope:lover_auto_agree }
			scope:family_lover = {
				OR = {
					target_is_liege_or_above = scope:actor
					in_diplomatic_range = root
				}
				is_ai = yes
				is_incapable = no
				has_contagious_deadly_disease_trigger = no
				is_imprisoned = no
				trigger_if = {
					limit = { is_playable_character = yes }
					NOT = { is_at_war_with = root }
				}
			}
		}
		name = lmf_interaction.1201.d #They must get married at once
		scope:recipient = { show_auto_accept_reason_effect = yes }
		random_list = {
			50 = {
				ai_convince_lover_marry_modifier = yes
				min = 0
				custom_tooltip = lmf_interaction.1201.d.success.tt
				trigger_event = lmf_interaction.1210
			}
			50 = {
				ai_convince_lover_marry_neg_modifier = yes
				min = 0
				custom_tooltip = lmf_interaction.1201.d.failure.tt
				trigger_event = lmf_interaction.1211
			}
		}
		ai_chance = {
			base = 0
		}
	}
	option = {
		trigger = {
			exists = scope:marriage_option
			NOT = { exists = scope:recipient_auto_agree }
			exists = scope:lover_auto_agree
		}
		name = lmf_interaction.1201.e #They must get married at once
		scope:family_lover = { show_auto_accept_reason_effect = yes }
		random_list = {
			50 = {
				ai_convince_family_marry_modifier = yes
				min = 0
				custom_tooltip = lmf_interaction.1201.e.success.tt
				trigger_event = lmf_interaction.1208
			}
			50 = {
				ai_convince_family_marry_neg_modifier = yes
				min = 0
				custom_tooltip = lmf_interaction.1201.e.failure.tt
				trigger_event = lmf_interaction.1209
			}
		}
		ai_chance = {
			base = 0
		}
	}
	option = {
		trigger = {
			exists = scope:marriage_option
			NOR = {
				exists = scope:recipient_auto_agree
				exists = scope:lover_auto_agree
			}
			scope:family_lover = {
				OR = {
					target_is_liege_or_above = scope:actor
					in_diplomatic_range = root
				}
				is_ai = yes
				is_incapable = no
				has_contagious_deadly_disease_trigger = no
				is_imprisoned = no
				trigger_if = {
					limit = { is_playable_character = yes }
					NOT = { is_at_war_with = root }
				}
			}
		}
		name = lmf_interaction.1201.f #They must get married at once
		custom_tooltip = lmf_interaction.1201.f.tt
		random_list = {
			50 = {
				ai_convince_family_marry_modifier = yes
				min = 0
				custom_tooltip = lmf_interaction.1201.f.success.tt
				trigger_event = lmf_interaction.1212
			}
			50 = {
				ai_convince_family_marry_neg_modifier = yes
				min = 0
				custom_tooltip = lmf_interaction.1201.f.failure.tt
				save_scope_value_as = {
					name = lover_needs_convincing
					value = flag:yes
				}
				trigger_event = lmf_interaction.1209
			}
		}
		ai_chance = {
			base = 0
		}
	}
	option = {
		name = lmf_interaction.1201.g #Perhaps I'm overreacting...
		scope:recipient = {
			remove_opinion = {
				target = root
				modifier = made_lover_demand_opinion
			}
		}
		ai_chance = {
			base = 0
		}
	}
}

# Family member agrees to end the relationship
lmf_interaction.1202 = {
	type = letter_event
	opening = lmf_interaction.1202.opening
	desc = {
		desc = lmf_interaction.1202.start
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_trait = adulterer
						has_trait = fornicator
						has_trait = deviant
						has_trait = sodomite
						has_trait = incestuous
					}
				}
				desc = lmf_interaction.1202.adulterer
			}
			triggered_desc = {
				trigger = {
					scope:recipient = { has_relation_soulmate = scope:family_lover }
				}
				desc = lmf_interaction.1202.soulmate
			}
			triggered_desc = {
				trigger = {
					scope:recipient = {
						OR = {
							has_personality_malicious_trigger = yes
							has_personality_emotional_trigger = yes
						}
					}
				}
				desc = lmf_interaction.1202.angry
			}
			triggered_desc = {
				trigger = {
					NOT = { exists = scope:is_secret_affair }
				}
				desc = lmf_interaction.1202.open
			}
			desc = lmf_interaction.1202.default
		}
		desc = lmf_interaction.1202.end
	}
	sender = scope:recipient

	option = {
		name = lmf_interaction.1202.a #Do it
		demand_end_relationship_effect = { TARGET = scope:recipient TARGET_LOVER = scope:family_lover DEMANDER = root }
	}
	option = {
		name = lmf_interaction.1202.b #Perhaps not...
		trigger = { is_ai = no }
		scope:recipient = {
			remove_opinion = {
				target = root
				modifier = made_lover_demand_opinion
			}
		}
	}
}

# Family member refuses to end the relationship
lmf_interaction.1203 = {
	type = letter_event
	opening = lmf_interaction.1202.opening
	desc = {
		desc = lmf_interaction.1203.start
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_trait = adulterer
						has_trait = fornicator
						has_trait = deviant
						has_trait = sodomite
						has_trait = incestuous
					}
				}
				desc = lmf_interaction.1203.adulterer
			}
			triggered_desc = {
				trigger = {
					scope:recipient = { has_relation_soulmate = scope:family_lover }
				}
				desc = lmf_interaction.1203.soulmate
			}
			triggered_desc = {
				trigger = {
					NOT = { exists = scope:is_secret_affair }
				}
				desc = lmf_interaction.1203.open
			}
			desc = lmf_interaction.1203.default
		}
		first_valid = {
			triggered_desc = {
				trigger = { has_relation_rival = scope:recipient }
				desc = lmf_interaction.1203.end.rival
			}
			triggered_desc = {
				trigger = {
					scope:recipient = { has_personality_malicious_trigger = yes }
				}
				desc = lmf_interaction.1203.end.malicious
			}
			triggered_desc = {
				trigger = {
					scope:recipient = { has_personality_dominant_trigger = yes }
				}
				desc = lmf_interaction.1203.end.dominant
			}
			triggered_desc = {
				trigger = {
					scope:recipient = { has_personality_submissive_trigger = yes }
				}
				desc = lmf_interaction.1203.end.submissive
			}
			desc = lmf_interaction.1203.end.default
		}
	}
	sender = scope:recipient

	immediate = {
		scope:recipient = { save_scope_as = target }
		scope:family_lover = { save_scope_as = target_lover }
	}

	option = {
		name = lmf_interaction.1203.a #Perhaps some presents would change your mind?
		trigger = {
			gold >= demand_end_lover_bribe_value
			custom_description = {
				text = not_greedy_enough_to_accept
				object = scope:recipient
				scope:recipient.ai_greed >= low_positive_greed
			}
		}
		show_as_unavailable = {
			OR = {
				gold < demand_end_lover_bribe_value
				scope:recipient.ai_greed < low_positive_greed
			}
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		pay_short_term_gold = {
			gold = demand_end_lover_bribe_value
			target = scope:recipient
		}
		demand_end_relationship_effect = { TARGET = scope:recipient TARGET_LOVER = scope:family_lover DEMANDER = root }
		ai_chance = {
			base = 0
		}
	}
	option = {
		name = lmf_interaction.1203.b #Then I will speak to the lover instead
		trigger = {
			NOT = {
				has_opinion_modifier = {
					target = scope:family_lover
					modifier = refused_my_lover_demand_opinion
				}
			}
			scope:family_lover = {
				target_is_liege_or_above = scope:actor
				is_ai = yes
				is_incapable = no
				has_contagious_deadly_disease_trigger = no
				OR = {
					is_imprisoned = no
					is_imprisoned_by = scope:actor
				}
				trigger_if = {
					limit = { is_playable_character = yes }
					NOT = { is_at_war_with = root }
				}
			}
		}
		hidden_effect = {
			add_opinion = {
				target = scope:recipient
				modifier = refused_my_lover_demand_opinion
			}
		}
		reverse_add_opinion = {
			target = scope:recipient
			modifier = insult_opinion
			opinion = -30
		}
		if = {
			limit = { exists = scope:lover_auto_agree }
			scope:family_lover = { show_auto_accept_reason_effect = yes }
			demand_remove_hook_effect = { TARGET = scope:family_lover }
			demand_end_relationship_effect = { TARGET = scope:family_lover TARGET_LOVER = scope:recipient DEMANDER = root }
		}
		else = {
			random_list = {
				0 = {
					ai_convince_lover_end_relationship_modifier = yes
					min = 0
					custom_tooltip = lmf_interaction.1201.b.success.tt
					trigger_event = lmf_interaction.1204
				}
				75 = {
					ai_convince_lover_end_relationship_neg_modifier = yes
					min = 0
					custom_tooltip = lmf_interaction.1201.b.failure.tt
					trigger_event = lmf_interaction.1205
				}
			}
		}
		ai_chance = {
			base = 100
		}
	}
	option = {
		name = lmf_interaction.1203.c #There are consequences for defying me!
		add_tyranny = 20
		add_dread = 20
		scope:recipient = {
			worsen_relationship_effect = {
				TARGET = root
				REASON = interfered_in_my_romance
			}
		}
		add_opinion = {
			target = scope:recipient
			modifier = refused_my_lover_demand_tyranny_opinion
		}
		hidden_effect = {
			add_opinion = {
				target = scope:recipient
				modifier = refused_my_lover_demand_opinion
			}
		}
		ai_chance = {
			base = 0
		}
	}
	option = {
		name = lmf_interaction.1203.d #I will let the matter drop
		hidden_effect = {
			add_opinion = {
				target = scope:recipient
				modifier = refused_my_lover_demand_opinion
			}
		}
		ai_chance = {
			base = 10
		}
	}
}

# Lover agrees to end the relationship
lmf_interaction.1204 = {
	type = letter_event
	opening = lmf_interaction.1204.opening
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:is_secret_affair }
				desc = lmf_interaction.1204.secret
			}
			desc = lmf_interaction.1204.open
		}
		desc = lmf_interaction.1204.end
	}
	sender = scope:family_lover

	option = {
		name = lmf_interaction.1202.a #Do it
		demand_end_relationship_effect = { TARGET = scope:family_lover TARGET_LOVER = scope:recipient DEMANDER = root }
	}
	option = {
		name = lmf_interaction.1202.b #Perhaps not...
		trigger = { is_ai = no }
		scope:recipient = {
			remove_opinion = {
				target = root
				modifier = made_lover_demand_opinion
			}
		}
	}
}

# Lover refuses to end the relationship
lmf_interaction.1205 = {
	type = letter_event
	opening = lmf_interaction.1205.opening
	desc = {
		desc = lmf_interaction.1205.start
		first_valid = {
			triggered_desc = {
				trigger = { has_relation_rival = scope:family_lover }
				desc = lmf_interaction.1205.end.rival
			}
			triggered_desc = {
				trigger = {
					scope:family_lover = { has_personality_submissive_trigger = yes }
				}
				desc = lmf_interaction.1205.end.submissive
			}
			triggered_desc = {
				trigger = {
					scope:family_lover = { has_personality_benevolent_trigger = yes }
				}
				desc = lmf_interaction.1205.end.benevolent
			}
			triggered_desc = {
				trigger = {
					scope:family_lover = { has_personality_dominant_trigger = yes }
				}
				desc = lmf_interaction.1205.end.dominant
			}
			triggered_desc = {
				trigger = {
					scope:family_lover = { has_personality_malicious_trigger = yes }
				}
				desc = lmf_interaction.1205.end.malicious
			}
			desc = lmf_interaction.1205.end.default
		}
	}
	sender = scope:family_lover

	immediate = {
		scope:family_lover = { save_scope_as = target }
		scope:recipient = { save_scope_as = target_lover }
	}

	option = {
		name = lmf_interaction.1205.a #What would it take to make you go away?
		trigger = {
			gold >= demand_end_lover_bribe_value
			custom_description = {
				text = not_greedy_enough_to_accept
				object = scope:family_lover
				scope:family_lover.ai_greed >= low_positive_greed
			}
		}
		show_as_unavailable = {
			OR = {
				gold < demand_end_lover_bribe_value
				scope:family_lover.ai_greed < low_positive_greed
			}
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		pay_short_term_gold = {
			gold = demand_end_lover_bribe_value
			target = scope:family_lover
		}
		demand_end_relationship_effect = { TARGET = scope:family_lover TARGET_LOVER = scope:recipient DEMANDER = root }
		ai_chance = {
			base = 0
		}
	}
	option = {
		name = lmf_interaction.1205.b #Then I must speak to them instead
		trigger = {
			NOT = {
				has_opinion_modifier = {
					target = scope:recipient
					modifier = refused_my_lover_demand_opinion
				}
			}
		}
		hidden_effect = {
			add_opinion = {
				target = scope:family_lover
				modifier = refused_my_lover_demand_opinion
			}
		}
		reverse_add_opinion = {
			target = scope:family_lover
			modifier = insult_opinion
			opinion = -30
		}
		if = {
			limit = { exists = scope:recipient_auto_agree }
			scope:recipient = { show_auto_accept_reason_effect = yes }
			demand_remove_hook_effect = { TARGET = scope:recipient }
			demand_end_relationship_effect = { TARGET = scope:recipient TARGET_LOVER = scope:family_lover DEMANDER = root }
		}
		else = {
			random_list = {
				10 = {
					ai_convince_family_end_relationship_modifier = yes
					min = 0
					custom_tooltip = lmf_interaction.1201.a.success.tt
					trigger_event = lmf_interaction.1202
				}
				75 = {
					ai_convince_family_end_relationship_neg_modifier = yes
					min = 0
					custom_tooltip = lmf_interaction.1201.a.failure.tt
					trigger_event = lmf_interaction.1203
				}
			}
		}
		ai_chance = {
			base = 100
		}
	}
	option = {
		name = lmf_interaction.1203.c #There are consequences for defying me!
		trigger = {
			custom_description = {
				text = not_part_of_realm_or_guest
				subject = root
				object = scope:family_lover
				scope:family_lover = {
					OR = {
						target_is_liege_or_above = root
						AND = {
							exists = host
							host = root
						}
					}
				}
			}
		}
		show_as_unavailable = {
			scope:family_lover = {
				NOR = {
					target_is_liege_or_above = root
					AND = {
						exists = host
						host = root
					}
				}
			}
		}
		add_tyranny = 20
		add_dread = 20
		scope:recipient = {
			worsen_relationship_effect = {
				TARGET = root
				REASON = interfered_in_my_romance
			}
		}
		scope:family_lover = {
			worsen_relationship_effect = {
				TARGET = root
				REASON = interfered_in_my_romance
			}
		}
		add_opinion = {
			target = scope:family_lover
			modifier = refused_my_lover_demand_tyranny_opinion
		}
		hidden_effect = {
			add_opinion = {
				target = scope:recipient
				modifier = refused_my_lover_demand_opinion
			}
			add_opinion = {
				target = scope:family_lover
				modifier = refused_my_lover_demand_opinion
			}
		}
		ai_chance = {
			base = 0
		}
	}
	option = {
		name = lmf_interaction.1203.d #I will let the matter drop
		hidden_effect = {
			add_opinion = {
				target = scope:recipient
				modifier = refused_my_lover_demand_opinion
			}
			add_opinion = {
				target = scope:family_lover
				modifier = refused_my_lover_demand_opinion
			}
		}
		ai_chance = {
			base = 10
		}
	}
}

# Family member agrees to end their relationships
lmf_interaction.1206 = {
	type = letter_event
	opening = lmf_interaction.1202.opening
	desc = {
		desc = lmf_interaction.1206.start
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_trait = adulterer
						has_trait = fornicator
						has_trait = deviant
						has_trait = sodomite
						has_trait = incestuous
					}
				}
				desc = lmf_interaction.1206.adulterer
			}
			triggered_desc = {
				trigger = {
					scope:recipient = {
						OR = {
							has_personality_malicious_trigger = yes
							has_personality_emotional_trigger = yes
						}
					}
				}
				desc = lmf_interaction.1206.angry
			}
			desc = lmf_interaction.1206.default
		}
		desc = lmf_interaction.1206.end
	}
	sender = scope:recipient

	option = {
		name = lmf_interaction.1202.a #Do it
		if = {
			limit = {
				scope:recipient = {
					OR = {
						AND = {
							exists = scope:lover_1
							has_relation_soulmate = scope:lover_1
						}
						AND = {
							exists = scope:lover_2
							has_relation_soulmate = scope:lover_2
						}
						AND = {
							exists = scope:lover_3
							has_relation_soulmate = scope:lover_3
						}
					}
				}
			}
			scope:recipient = {
				progress_towards_rival_effect = {
					CHARACTER = root
					REASON = interfered_in_my_romance
					OPINION = -50
				}
			}
		}
		else = {
			scope:recipient = {
				worsen_relationship_effect = {
					TARGET = root
					REASON = interfered_in_my_romance
				}
			}
		}

		if = {
			limit = { exists = scope:lover_1 }
			scope:lover_1 = {
				worsen_relationship_effect = {
					TARGET = root
					REASON = interfered_in_my_romance
				}
			}
			lover_breakup_effect = {
				BREAKER = scope:recipient
				LOVER = scope:lover_1
			}
		}
		if = {
			limit = { exists = scope:lover_2 }
			scope:lover_2 = {
				worsen_relationship_effect = {
					TARGET = root
					REASON = interfered_in_my_romance
				}
			}
			lover_breakup_effect = {
				BREAKER = scope:recipient
				LOVER = scope:lover_2
			}
		}
		if = {
			limit = { exists = scope:lover_3 }
			scope:lover_3 = {
				worsen_relationship_effect = {
					TARGET = root
					REASON = interfered_in_my_romance
				}
			}
			lover_breakup_effect = {
				BREAKER = scope:recipient
				LOVER = scope:lover_3
			}
		}
	}
	option = {
		name = lmf_interaction.1202.b #Perhaps not...
		trigger = { is_ai = no }
		scope:recipient = {
			remove_opinion = {
				target = root
				modifier = made_lover_demand_opinion
			}
		}
	}
}

# Family member refuses to end their relationships
lmf_interaction.1207 = {
	type = letter_event
	opening = lmf_interaction.1202.opening
	desc = {
		desc = lmf_interaction.1207.start
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_trait = adulterer
						has_trait = fornicator
						has_trait = deviant
						has_trait = sodomite
						has_trait = incestuous
					}
				}
				desc = lmf_interaction.1207.adulterer
			}
			desc = lmf_interaction.1207.default
		}
		first_valid = {
			triggered_desc = {
				trigger = { has_relation_rival = scope:recipient }
				desc = lmf_interaction.1207.end.rival
			}
			triggered_desc = {
				trigger = {
					scope:recipient = { has_personality_malicious_trigger = yes }
				}
				desc = lmf_interaction.1207.end.malicious
			}
			triggered_desc = {
				trigger = {
					scope:recipient = { has_personality_dominant_trigger = yes }
				}
				desc = lmf_interaction.1207.end.dominant
			}
			triggered_desc = {
				trigger = {
					scope:recipient = { has_personality_submissive_trigger = yes }
				}
				desc = lmf_interaction.1207.end.submissive
			}
			desc = lmf_interaction.1207.end.default
		}
	}
	sender = scope:recipient

	immediate = {
		scope:recipient = { save_scope_as = target }
	}

	option = {
		name = lmf_interaction.1203.a #Perhaps some presents would change your mind?
		trigger = {
			gold >= demand_end_lover_bribe_value
			custom_description = {
				text = not_greedy_enough_to_accept
				object = scope:recipient
				scope:recipient.ai_greed >= low_positive_greed
			}
		}
		show_as_unavailable = {
			OR = {
				gold < demand_end_lover_bribe_value
				scope:recipient.ai_greed < low_positive_greed
			}
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		pay_short_term_gold = {
			gold = demand_end_lover_bribe_value
			target = scope:recipient
		}
		if = {
			limit = {
				scope:recipient = {
					OR = {
						AND = {
							exists = scope:lover_1
							has_relation_soulmate = scope:lover_1
						}
						AND = {
							exists = scope:lover_2
							has_relation_soulmate = scope:lover_2
						}
						AND = {
							exists = scope:lover_3
							has_relation_soulmate = scope:lover_3
						}
					}
				}
			}
			scope:recipient = {
				progress_towards_rival_effect = {
					CHARACTER = root
					REASON = interfered_in_my_romance
					OPINION = -50
				}
			}
		}
		else = {
			scope:recipient = {
				worsen_relationship_effect = {
					TARGET = root
					REASON = interfered_in_my_romance
				}
			}
		}

		if = {
			limit = { exists = scope:lover_1 }
			scope:lover_1 = {
				worsen_relationship_effect = {
					TARGET = root
					REASON = interfered_in_my_romance
				}
			}
			lover_breakup_effect = {
				BREAKER = scope:recipient
				LOVER = scope:lover_1
			}
		}
		if = {
			limit = { exists = scope:lover_2 }
			scope:lover_2 = {
				worsen_relationship_effect = {
					TARGET = root
					REASON = interfered_in_my_romance
				}
			}
			lover_breakup_effect = {
				BREAKER = scope:recipient
				LOVER = scope:lover_2
			}
		}
		if = {
			limit = { exists = scope:lover_3 }
			scope:lover_3 = {
				worsen_relationship_effect = {
					TARGET = root
					REASON = interfered_in_my_romance
				}
			}
			lover_breakup_effect = {
				BREAKER = scope:recipient
				LOVER = scope:lover_3
			}
		}
		ai_chance = {
			base = 0
		}
	}
	option = {
		name = lmf_interaction.1203.c #There are consequences for defying me!
		add_tyranny = 20
		add_dread = 20
		scope:recipient = {
			worsen_relationship_effect = {
				TARGET = root
				REASON = interfered_in_my_romance
			}
		}
		add_opinion = {
			target = scope:recipient
			modifier = refused_my_lover_demand_tyranny_opinion
		}
		hidden_effect = {
			add_opinion = {
				target = scope:recipient
				modifier = refused_my_lover_demand_opinion
			}
		}
		ai_chance = {
			base = 0
		}
	}
	option = {
		name = lmf_interaction.1203.d #I will let the matter drop
		hidden_effect = {
			add_opinion = {
				target = scope:recipient
				modifier = refused_my_lover_demand_opinion
			}
		}
		ai_chance = {
			base = 10
		}
	}
}

# Family member agrees to the marriage
lmf_interaction.1208 = {
	type = letter_event
	opening = lmf_interaction.1202.opening
	desc = lmf_interaction.1208.desc
	sender = scope:recipient

	option = {
		name = {
			trigger = { scope:recipient = { is_male = yes } }
			text = lmf_interaction.1208.a # Favors family member
		}
		name = {
			trigger = { scope:family_lover = { is_male = yes } }
			text = lmf_interaction.1208.b # Favors lover
		}
		if = {
			limit = { exists = scope:recipient_auto_agree }
			demand_remove_hook_effect = { TARGET = scope:recipient }
		}
		else = {
			scope:recipient = {
				worsen_relationship_effect = {
					TARGET = root
					REASON = demanded_I_marry_lover
				}
			}
		}
		if = {
			limit = { exists = scope:lover_auto_agree }
			demand_remove_hook_effect = { TARGET = scope:family_lover }
		}
		else = {
			scope:family_lover = {
				worsen_relationship_effect = {
					TARGET = root
					REASON = demanded_I_marry_lover
				}
			}
		}
		end_all_other_relationships_effect = yes
		scope:recipient = { marry = scope:family_lover }
	}
	option = {
		name = {
			trigger = { scope:recipient = { is_female = yes } }
			text = lmf_interaction.1208.a # Favors family member
		}
		name = {
			trigger = { scope:family_lover = { is_female = yes } }
			text = lmf_interaction.1208.b # Favors lover
		}
		if = {
			limit = { exists = scope:recipient_auto_agree }
			demand_remove_hook_effect = { TARGET = scope:recipient }
		}
		else = {
			scope:recipient = {
				worsen_relationship_effect = {
					TARGET = root
					REASON = demanded_I_marry_lover
				}
			}
		}
		if = {
			limit = { exists = scope:lover_auto_agree }
			demand_remove_hook_effect = { TARGET = scope:family_lover }
		}
		else = {
			scope:family_lover = {
				worsen_relationship_effect = {
					TARGET = root
					REASON = demanded_I_marry_lover
				}
			}
		}
		end_all_other_relationships_effect = yes
		scope:recipient = { marry_matrilineal = scope:family_lover }
	}
	option = {
		name = lmf_interaction.1208.c #Never mind
		scope:recipient = {
			remove_opinion = {
				target = root
				modifier = made_lover_demand_opinion
			}
		}
	}
}

# Family member refuses the marriage
lmf_interaction.1209 = {
	type = letter_event
	opening = lmf_interaction.1202.opening
	desc = {
		desc = lmf_interaction.1209.start
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:is_secret_affair }
				desc = lmf_interaction.1209.secret
			}
			desc = lmf_interaction.1209.open
		}
		first_valid = {
			triggered_desc = {
				trigger = { has_relation_rival = scope:recipient }
				desc = lmf_interaction.1207.end.rival
			}
			triggered_desc = {
				trigger = {
					scope:recipient = { has_personality_malicious_trigger = yes }
				}
				desc = lmf_interaction.1207.end.malicious
			}
			triggered_desc = {
				trigger = {
					scope:recipient = { has_personality_dominant_trigger = yes }
				}
				desc = lmf_interaction.1207.end.dominant
			}
			triggered_desc = {
				trigger = {
					scope:recipient = { has_personality_submissive_trigger = yes }
				}
				desc = lmf_interaction.1207.end.submissive
			}
			desc = lmf_interaction.1207.end.default
		}
	}
	sender = {
		character = scope:recipient
		animation = dismissal
	}

	immediate = {
		scope:recipient = { save_scope_as = target }
		scope:family_lover = { save_scope_as = target_lover }
	}

	option = {
		name = lmf_interaction.1209.a #Then you must end the relationship now
		random_list = {
			10 = {
				ai_convince_family_end_relationship_modifier = yes
				min = 0
				custom_tooltip = lmf_interaction.1201.a.success.tt
				trigger_event = lmf_interaction.1202
			}
			50 = {
				ai_convince_family_end_relationship_neg_modifier = yes
				min = 0
				custom_tooltip = lmf_interaction.1201.a.failure.tt
				trigger_event = lmf_interaction.1203
			}
		}
	}
	option = {
		name = lmf_interaction.1203.a #Perhaps some presents would change your mind?
		trigger = {
			gold >= demand_end_lover_bribe_value
			custom_description = {
				text = not_greedy_enough_to_accept
				object = scope:recipient
				scope:recipient.ai_greed >= low_positive_greed
			}
		}
		show_as_unavailable = {
			OR = {
				gold < demand_end_lover_bribe_value
				scope:recipient.ai_greed < low_positive_greed
			}
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		pay_short_term_gold = {
			gold = demand_end_lover_bribe_value
			target = scope:recipient
		}
		if = {
			limit = { exists = scope:lover_needs_convincing }
			custom_tooltip = lmf_interaction.1203.a.lover.tt
			random_list = {
				50 = {
					ai_convince_lover_marry_modifier = yes
					min = 0
					custom_tooltip = lmf_interaction.1201.d.success.tt
					trigger_event = lmf_interaction.1210
				}
				50 = {
					ai_convince_lover_marry_neg_modifier = yes
					min = 0
					custom_tooltip = lmf_interaction.1201.d.failure.tt
					trigger_event = lmf_interaction.1211
				}
			}
		}
		else = {
			custom_tooltip = lmf_interaction.1201.c.tt
			trigger_event = lmf_interaction.1208
		}
	}
	option = {
		name = lmf_interaction.1203.c #There are consequences for defying me!
		add_tyranny = 20
		add_dread = 20
		scope:recipient = {
			worsen_relationship_effect = {
				TARGET = root
				REASON = interfered_in_my_romance
			}
		}
		add_opinion = {
			target = scope:recipient
			modifier = refused_my_lover_demand_tyranny_opinion
		}
		hidden_effect = {
			add_opinion = {
				target = scope:recipient
				modifier = refused_my_lover_demand_opinion
			}
		}
	}
	option = {
		name = lmf_interaction.1203.d #I will let the matter drop
		hidden_effect = {
			add_opinion = {
				target = scope:recipient
				modifier = refused_my_lover_demand_opinion
			}
		}
	}
}

# Lover agrees to the marriage
lmf_interaction.1210 = {
	type = letter_event
	opening = lmf_interaction.1204.opening
	desc = lmf_interaction.1210.desc
	sender = scope:recipient

	option = {
		name = {
			trigger = { scope:recipient = { is_male = yes } }
			text = lmf_interaction.1208.a # Favors family member
		}
		name = {
			trigger = { scope:family_lover = { is_male = yes } }
			text = lmf_interaction.1208.b # Favors lover
		}
		if = {
			limit = { exists = scope:recipient_auto_agree }
			demand_remove_hook_effect = { TARGET = scope:recipient }
		}
		else = {
			scope:recipient = {
				worsen_relationship_effect = {
					TARGET = root
					REASON = demanded_I_marry_lover
				}
			}
		}
		if = {
			limit = { exists = scope:lover_auto_agree }
			demand_remove_hook_effect = { TARGET = scope:family_lover }
		}
		else = {
			scope:family_lover = {
				worsen_relationship_effect = {
					TARGET = root
					REASON = demanded_I_marry_lover
				}
			}
		}
		end_all_other_relationships_effect = yes
		scope:family_lover = { marry = scope:recipient }
	}
	option = {
		name = {
			trigger = { scope:recipient = { is_female = yes } }
			text = lmf_interaction.1208.a # Favors family member
		}
		name = {
			trigger = { scope:family_lover = { is_female = yes } }
			text = lmf_interaction.1208.b # Favors lover
		}
		if = {
			limit = { exists = scope:recipient_auto_agree }
			demand_remove_hook_effect = { TARGET = scope:recipient }
		}
		else = {
			scope:recipient = {
				worsen_relationship_effect = {
					TARGET = root
					REASON = demanded_I_marry_lover
				}
			}
		}
		if = {
			limit = { exists = scope:lover_auto_agree }
			demand_remove_hook_effect = { TARGET = scope:family_lover }
		}
		else = {
			scope:family_lover = {
				worsen_relationship_effect = {
					TARGET = root
					REASON = demanded_I_marry_lover
				}
			}
		}
		end_all_other_relationships_effect = yes
		scope:family_lover = { marry_matrilineal = scope:recipient }
	}
	option = {
		name = lmf_interaction.1208.c #Never mind
		scope:recipient = {
			remove_opinion = {
				target = root
				modifier = made_lover_demand_opinion
			}
		}
	}
}

# Lover refuses the marriage
lmf_interaction.1211 = {
	type = letter_event
	opening = lmf_interaction.1205.opening
	desc = {
		desc = lmf_interaction.1211.start
		first_valid = {
			triggered_desc = {
				trigger = { has_relation_rival = scope:family_lover }
				desc = lmf_interaction.1211.end.rival
			}
			triggered_desc = {
				trigger = {
					scope:family_lover = { has_personality_malicious_trigger = yes }
				}
				desc = lmf_interaction.1211.end.malicious
			}
			triggered_desc = {
				trigger = {
					scope:family_lover = { has_personality_dominant_trigger = yes }
				}
				desc = lmf_interaction.1211.end.dominant
			}
			triggered_desc = {
				trigger = {
					scope:family_lover = { has_personality_submissive_trigger = yes }
				}
				desc = lmf_interaction.1211.end.submissive
			}
			desc = lmf_interaction.1211.end.default
		}
	}
	sender = {
		character = scope:family_lover
		animation = dismissal
	}

	immediate = {
		scope:family_lover = { save_scope_as = target }
		scope:recipient = { save_scope_as = target_lover }
	}

	option = {
		name = lmf_interaction.1209.a #Then you must end the relationship now
		random_list = {
			0 = {
				ai_convince_lover_end_relationship_modifier = yes
				min = 0
				custom_tooltip = lmf_interaction.1201.b.success.tt
				trigger_event = lmf_interaction.1204
			}
			50 = {
				ai_convince_lover_end_relationship_neg_modifier = yes
				min = 0
				custom_tooltip = lmf_interaction.1201.b.failure.tt
				trigger_event = lmf_interaction.1205
			}
		}
	}
	option = {
		name = lmf_interaction.1203.a #Perhaps some presents would change your mind?
		trigger = {
			gold >= demand_end_lover_bribe_value
			custom_description = {
				text = not_greedy_enough_to_accept
				object = scope:family_lover
				scope:family_lover.ai_greed >= low_positive_greed
			}
		}
		show_as_unavailable = {
			OR = {
				gold < demand_end_lover_bribe_value
				scope:family_lover.ai_greed < low_positive_greed
			}
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		pay_short_term_gold = {
			gold = demand_end_lover_bribe_value
			target = scope:family_lover
		}
		custom_tooltip = lmf_interaction.1201.c.tt
		trigger_event = lmf_interaction.1210
	}
	option = {
		name = lmf_interaction.1203.c #There are consequences for defying me!
		trigger = {
			custom_description = {
				text = not_part_of_realm_or_guest
				subject = root
				object = scope:family_lover
				scope:family_lover = {
					OR = {
						target_is_liege_or_above = root
						AND = {
							exists = host
							host = root
						}
					}
				}
			}
		}
		show_as_unavailable = {
			scope:family_lover = {
				NOR = {
					target_is_liege_or_above = root
					AND = {
						exists = host
						host = root
					}
				}
			}
		}
		add_tyranny = 20
		add_dread = 20
		scope:recipient = {
			worsen_relationship_effect = {
				TARGET = root
				REASON = interfered_in_my_romance
			}
		}
		scope:family_lover = {
			worsen_relationship_effect = {
				TARGET = root
				REASON = interfered_in_my_romance
			}
		}
		add_opinion = {
			target = scope:family_lover
			modifier = refused_my_lover_demand_tyranny_opinion
		}
		hidden_effect = {
			add_opinion = {
				target = scope:recipient
				modifier = refused_my_lover_demand_opinion
			}
			add_opinion = {
				target = scope:family_lover
				modifier = refused_my_lover_demand_opinion
			}
		}
	}
	option = {
		name = lmf_interaction.1203.d #I will let the matter drop
		hidden_effect = {
			add_opinion = {
				target = scope:recipient
				modifier = refused_my_lover_demand_opinion
			}
			add_opinion = {
				target = scope:family_lover
				modifier = refused_my_lover_demand_opinion
			}
		}
	}
}

# Family member agrees to the marriage, but lover still needs convincing
lmf_interaction.1212 = {
	type = letter_event
	opening = lmf_interaction.1204.opening
	desc = lmf_interaction.1212.desc
	sender = scope:recipient

	option = {
		name = lmf_interaction.1212.a
		random_list = {
			50 = {
				ai_convince_lover_marry_modifier = yes
				min = 0
				custom_tooltip = lmf_interaction.1201.d.success.tt
				trigger_event = lmf_interaction.1210
			}
			50 = {
				ai_convince_lover_marry_neg_modifier = yes
				min = 0
				custom_tooltip = lmf_interaction.1201.d.failure.tt
				trigger_event = lmf_interaction.1211
			}
		}
	}
}


################################
# MARRIAGE INTRODUCTION EVENTS #
################################

scripted_effect marriage_proposal_refused_effect = {
	scope:recipient = { remove_marriage_introduction_variables = yes }
	scope:secondary_recipient = {
		remove_marriage_introduction_variables = yes
		add_opinion = {
			target = scope:secondary_actor
			modifier = refused_marriage_proposal_opinion
		}
		if = {
			limit = {
				is_landed = yes
				exists = current_travel_plan
				current_travel_plan = { is_paused = yes }
			}
			current_travel_plan = { resume_travel_plan = yes }
		}
		else_if = {
			limit = {
				scope:recipient = { exists = capital_province }
				NOR = {
					is_in_the_same_court_as_or_guest = scope:actor
					this = scope:actor
					scope:recipient = scope:actor
					location = scope:recipient.capital_province
				}
			}
			start_travel_plan = {
				destination = scope:recipient.capital_province
				on_arrival_destinations = last
				return_trip = no # One way
			}
		}
	}
	scope:actor = { remove_marriage_introduction_variables = yes }
	scope:secondary_actor = {
		remove_marriage_introduction_variables = yes
		add_opinion = {
			target = scope:secondary_recipient
			modifier = refused_marriage_proposal_opinion
		}
	}
}

scripted_effect proceed_with_wedding_effect = {
	random_list = {
		100 = {
			# secondary_actor rebels
			trigger = {
				exists = scope:secondary_actor_might_rebel
				scope:secondary_actor = { is_playable_character = no }
			}
			ai_value_modifier = {
				who = scope:secondary_actor
				ai_honor = -1
				ai_boldness = 1
				ai_rationality = -0.5
			}
			modifier = {
				factor = 0.5
				scope:actor = { exists = player_heir }
				scope:secondary_actor = { is_player_heir_of = scope:actor }
			}
			scope:actor = {
				if = {
					limit = { has_variable = grand_wedding_promise_pending }
					remove_variable = grand_wedding_promise_pending
				}
			}

			# If we're a clan this interaction affects unity
			add_clan_unity_interaction_effect = {
				CHARACTER = scope:actor
				TARGET = scope:recipient
				VALUE = medium_unity_loss
				DESC = clan_unity_marry_off_decline.desc
				REVERSE_NON_HOUSE_TARGET = no
			}
			
			if = {
				limit = { exists = global_var:travel_the_distance_is_loaded }
				ttd_marriage_proposal_clean_up_effect = yes
			}
			
			marriage_proposal_refused_effect = yes
			scope:actor = { save_scope_as = rebel_liege }
			scope:secondary_recipient = { save_scope_as = intended_spouse }
			scope:secondary_actor = {
				save_scope_as = rebel
				trigger_event = lmf_interaction.1330
			}
		}
		100 = {
			# secondary_recipient rebels
			trigger = {
				exists = scope:secondary_recipient_might_rebel
				scope:secondary_recipient = { is_playable_character = no }
			}
			ai_value_modifier = {
				who = scope:secondary_recipient
				ai_honor = -1
				ai_boldness = 1
				ai_rationality = -0.5
			}
			modifier = {
				factor = 0.5
				scope:recipient = { exists = player_heir }
				scope:secondary_recipient = { is_player_heir_of = scope:recipient }
			}
			marriage_proposal_refused_effect = yes
			scope:recipient = { save_scope_as = rebel_liege }
			scope:secondary_actor = { save_scope_as = intended_spouse }
			scope:secondary_recipient = {
				save_scope_as = rebel
				trigger_event = lmf_interaction.1330
			}
		}
		100 = {
			# proceed with wedding
			scope:actor = { remove_marriage_introduction_variables = yes }
			scope:recipient = { remove_marriage_introduction_variables = yes }
			scope:secondary_actor = {
				if = {
					limit = {
						exists = scope:secondary_actor_is_charmed
						NOT = { this = scope:actor }
					}
					add_opinion = {
						target = scope:actor
						modifier = allowed_marry_for_love_opinion
					}
				}
				if = {
					limit = { has_trait = will_not_wed }
					remove_trait_force_tooltip = will_not_wed
					hidden_effect = {
						random_owned_story = {
							type = lmf_will_not_wed_story_cycle
							end_story = yes
						}
					}
				}
				remove_marriage_introduction_variables = yes
			}
			scope:secondary_recipient = {
				if = {
					limit = { has_trait = will_not_wed }
					remove_trait_force_tooltip = will_not_wed
					hidden_effect = {
						random_owned_story = {
							type = lmf_will_not_wed_story_cycle
							end_story = yes
						}
					}
				}
				remove_marriage_introduction_variables = yes
			}
			if = {
				limit = {
					exists = scope:secondary_actor_is_charmed
					exists = scope:secondary_recipient_is_charmed
				}
				add_marry_for_love_flag_effect = { PARTNER1 = scope:secondary_actor PARTNER2 = scope:secondary_recipient }
			}

			scope:secondary_actor = {
				if = {
					limit = {
						OR = {
							is_adult = no
							scope:secondary_recipient = { is_adult = no }
							scope:grand_wedding_promise = yes
						}
					}
					if = {
						limit = { scope:matrilineal = yes }
						create_betrothal_matrilineal = scope:secondary_recipient
					}
					else = {
						create_betrothal = scope:secondary_recipient
					}
				}
				else_if = {
					limit = { scope:matrilineal = yes }
					marry_matrilineal = scope:secondary_recipient
				}
				else = {
					marry = scope:secondary_recipient
				}
				check_alliance_set_up_effect = { PROPOSER_LIEGE = scope:actor TARGET_LIEGE = scope:recipient PROPOSER = scope:secondary_actor TARGET = scope:secondary_recipient }
			}

			marriage_interaction_on_accept_effect = yes
			add_clan_unity_interaction_effect = {
				CHARACTER = scope:actor
				TARGET = scope:recipient
				VALUE = medium_unity_gain
				DESC = clan_unity_marry_off.desc
				REVERSE_NON_HOUSE_TARGET = no
			}
			scope:actor = { remove_variable ?= grand_wedding_promise_pending }
			
			if = {
				limit = { exists = global_var:travel_the_distance_is_loaded }
				ttd_on_accept_marriage_effect = yes
			}
			
			scope:secondary_recipient = {
				if = {
					limit = {
						exists = current_travel_plan
						current_travel_plan = { is_paused = yes }
					}
					current_travel_plan = { resume_travel_plan = yes }
				}
				else_if = {
					limit = {
						exists = scope:recipient.capital_province
						NOR = {
							exists = current_travel_plan
							is_courtier_of = scope:actor
							scope:recipient = scope:actor
						}
					}
					start_travel_plan = {
						destination = scope:recipient.capital_province
						on_arrival_destinations = last
						return_trip = no # One way
					}
				}
			}

			hidden_effect = {
				if = {
					limit = {
						scope:secondary_recipient = { is_ai = yes }
						scope:secondary_actor = { is_ai = yes }
					}
					if = {
						limit = { exists = scope:can_become_lovers }
						scope:secondary_recipient = {
							set_relation_lover = { reason = attraction_at_introduction target = scope:secondary_actor }
						}
					}
					else_if = {
						limit = { exists = scope:can_become_friends }
						scope:secondary_recipient = {
							set_relation_friend = { reason = friends_at_introduction target = scope:secondary_actor }
						}
					}
				}
				if = {
					limit = { exists = scope:can_become_rivals }
					scope:secondary_recipient = {
						set_relation_rival = { reason = became_enemies_at_introduction target = scope:secondary_actor }
					}
				}
			}
		}
	}
}

scripted_effect change_intro_visit_score = {
	change_variable = {
		name = intro_visit_score
		add = {
			value = {
				integer_range = {
					min = $MIN_CHANGE$
					max = $MAX_CHANGE$
				}
			}
		}
	}
}

# Introduction request refused
lmf_interaction.1300 = {
	type = letter_event
	opening = {
		desc = char_interaction.0001.opening
	}
	desc = {
		desc = lmf_interaction.1300.start
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:secondary_actor = scope:actor
					scope:secondary_recipient = scope:recipient
				}
				desc = lmf_interaction.1300.youandi
			}
			triggered_desc = {
				trigger = {
					scope:secondary_actor = scope:actor
				}
				desc = lmf_interaction.1300.youandthem
			}
			triggered_desc = {
				trigger = {
					scope:secondary_recipient = scope:recipient
				}
				desc = lmf_interaction.1300.themandi
			}
			desc = lmf_interaction.1300.them
		}
	}

	sender = {
		character = scope:recipient
		animation = dismissal
	}

	option = {
		name = marriage_interaction.0011.a
		hidden_effect = {
			marriage_proposal_refused_effect = yes
		}
	}
}

# Secondary Actor reacts to your choice of suitor
lmf_interaction.1301 = {
	type = character_event
	title = lmf_interaction.1301.t
	desc = {
		desc = lmf_interaction.1301.desc.start
		first_valid = {
			triggered_desc = {
				trigger = { scope:secondary_actor = root }
				desc = lmf_interaction.1301.desc.actor
			}
			triggered_desc = {
				trigger = {
					exists = scope:secondary_actor_is_pleased
					scope:secondary_actor = { has_trait = will_not_wed }
				}
				desc = lmf_interaction.1301.desc.pleased.willnotwed
			}
			triggered_desc = {
				trigger = { exists = scope:secondary_actor_is_pleased }
				desc = lmf_interaction.1301.desc.pleased
			}
			desc = lmf_interaction.1301.desc.displeased
		}
	}
	theme = family

	left_portrait = {
		character = scope:secondary_actor
		triggered_animation = {
			trigger = { scope:secondary_actor = scope:actor }
			animation = thinking
		}
		triggered_animation = {
			trigger = { exists = scope:secondary_actor_is_pleased }
			animation = happiness
		}
		triggered_animation = {
			trigger = {
				scope:secondary_actor = {
					OR = {
						has_trait = wrathful
						has_trait = vengeful
						has_trait = stubborn
						has_trait = rowdy
					}
				}
			}
			animation = rage
		}
		triggered_animation = {
			trigger = {
				scope:secondary_actor = { has_trait = arrogant }
			}
			animation = dismissal
		}
		triggered_animation = {
			trigger = {
				scope:secondary_actor = {
					OR = {
						has_trait = sadistic
						has_trait = callous
						has_trait = paranoid
						has_trait = bossy
					}
				}
			}
			animation = disgust
		}
		triggered_animation = {
			trigger = {
				scope:secondary_actor = {
					OR = {
						has_trait = compassionate
						has_trait = just
					}
				}
			}
			animation = worry
		}
		triggered_animation = {
			trigger = {
				scope:secondary_actor = { has_trait = shy }
			}
			animation = shame
		}
		animation = thinking
	}
	lower_right_portrait = scope:secondary_recipient

	immediate = {
		scope:actor = {
			remove_marriage_introduction_variables = yes
			set_marriage_introduction_variables = yes
		}
		scope:secondary_actor = {
			remove_marriage_introduction_variables = yes
			set_marriage_introduction_variables = yes
		}
		if = {
			limit = {
				is_pleased_by_suitor_trigger = { CHARACTER = scope:secondary_actor SUITOR = scope:secondary_recipient THRESHOLD = 0 }
			}
			save_scope_value_as = {
				name = secondary_actor_is_pleased
				value = yes
			}
		}
	}

	option = {
		name = lmf_interaction.1301.a
	}
}

# Secondary Recipient reacts to coming visit
lmf_interaction.1302 = {
	type = character_event
	title = lmf_interaction.1302.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:secondary_recipient = root }
				desc = lmf_interaction.1302.desc.recipient
			}
			triggered_desc = {
				trigger = {
					exists = scope:secondary_recipient_is_pleased
					scope:secondary_recipient = { has_trait = will_not_wed }
				}
				desc = lmf_interaction.1302.desc.pleased.willnotwed
			}
			triggered_desc = {
				trigger = { exists = scope:secondary_recipient_is_pleased }
				desc = lmf_interaction.1302.desc.pleased
			}
			desc = lmf_interaction.1302.desc.displeased
		}
	}
	theme = family

	left_portrait = {
		character = scope:secondary_recipient
		triggered_animation = {
			trigger = { scope:secondary_recipient = scope:recipient }
			animation = thinking
		}
		triggered_animation = {
			trigger = { exists = scope:secondary_recipient_is_pleased }
			animation = happiness
		}
		triggered_animation = {
			trigger = {
				scope:secondary_recipient = {
					OR = {
						has_trait = wrathful
						has_trait = vengeful
						has_trait = stubborn
						has_trait = rowdy
					}
				}
			}
			animation = rage
		}
		triggered_animation = {
			trigger = {
				scope:secondary_recipient = { has_trait = arrogant }
			}
			animation = dismissal
		}
		triggered_animation = {
			trigger = {
				scope:secondary_recipient = {
					OR = {
						has_trait = sadistic
						has_trait = callous
						has_trait = paranoid
						has_trait = bossy
					}
				}
			}
			animation = disgust
		}
		triggered_animation = {
			trigger = {
				scope:secondary_recipient = {
					OR = {
						has_trait = compassionate
						has_trait = just
					}
				}
			}
			animation = worry
		}
		triggered_animation = {
			trigger = {
				scope:secondary_recipient = { has_trait = shy }
			}
			animation = shame
		}
		animation = thinking
	}
	lower_right_portrait = scope:secondary_actor

	immediate = {
		scope:recipient = {
			remove_marriage_introduction_variables = yes
			set_marriage_introduction_variables = yes
		}
		scope:secondary_recipient = {
			remove_marriage_introduction_variables = yes
			set_marriage_introduction_variables = yes
		}
		if = {
			limit = {
				is_pleased_by_suitor_trigger = { CHARACTER = scope:secondary_recipient SUITOR = scope:secondary_actor THRESHOLD = 0 }
			}
			save_scope_value_as = {
				name = secondary_recipient_is_pleased
				value = yes
			}
		}
	}

	option = {
		name = {
			trigger = { NOT = { scope:secondary_recipient = root } }
			text = lmf_interaction.1302.a
		}
		name = {
			trigger = { scope:secondary_recipient = root }
			text = lmf_interaction.1302.b
		}
		scope:secondary_recipient = {
			start_travel_plan = {
				destination = var:intro_location
				on_travel_planner_cancel_event = lmf_interaction.1303
				on_arrival_event = lmf_interaction.1310
				on_arrival_destinations = last
				return_trip = no
			}
		}
	}
}

# Removing introduction variables
lmf_interaction.1303 = {
	hidden = yes

	immediate = {
		# saving variables as scopes, since we'll be removing all variables shortly
		var:intro_actor ?= { save_scope_as = actor }
		var:intro_recipient ?= { save_scope_as = recipient }
		var:intro_secondary_actor ?= { save_scope_as = secondary_actor }
		var:intro_secondary_recipient ?= { save_scope_as = secondary_recipient }

		# NOW remove the variables
		scope:actor ?= { remove_marriage_introduction_variables = yes }
		scope:recipient ?= { remove_marriage_introduction_variables = yes }
		scope:secondary_actor ?= { remove_marriage_introduction_variables = yes }
		scope:secondary_recipient ?= { remove_marriage_introduction_variables = yes }
	}
}

# Does recipient recall secondary recipient if a war starts?
lmf_interaction.1304 = {
	type = character_event
	title = lmf_interaction.1304.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { is_at_war_with = scope:actor }
				desc = lmf_interaction.1304.desc.atwar.actor
			}
			triggered_desc = {
				trigger = {
					scope:attacker = root
					scope:recall_char = root
				}
				desc = lmf_interaction.1304.desc.atwar.self.rootattacker
			}
			triggered_desc = {
				trigger = { scope:attacker = root }
				desc = lmf_interaction.1304.desc.atwar.rootattacker
			}
			triggered_desc = {
				trigger = {
					scope:defender = root
					scope:recall_char = root
				}
				desc = lmf_interaction.1304.desc.atwar.self.rootdefender
			}
			triggered_desc = {
				trigger = { scope:defender = root }
				desc = lmf_interaction.1304.desc.atwar.rootdefender
			}
			triggered_desc = {
				trigger = { scope:recall_char = root }
				desc = lmf_interaction.1304.desc.atwar.self
			}
			desc = lmf_interaction.1304.desc.atwar
		}
	}
	theme = travel

	left_portrait = {
		character = scope:recall_char
		animation = worry
		outfit_tags = { travel_cloak }
	}

	trigger = {
		is_landed = yes
		exists = capital_province
		has_all_variables = {
			name = intro_secondary_recipient
			name = intro_actor
			name = intro_recipient
		}
		var:intro_recipient = root
		var:intro_secondary_recipient = {
			exists = current_travel_plan
			NOT = { has_variable = intro_visit_score }
		}
		exists = scope:war.primary_attacker
		exists = scope:war.primary_defender
	}

	immediate = {
		var:intro_secondary_recipient = { save_scope_as = recall_char }
		var:intro_secondary_actor = { save_scope_as = secondary_actor }
		var:intro_actor = { save_scope_as = actor }
		scope:war.primary_attacker = { save_scope_as = attacker }
		scope:war.primary_defender = { save_scope_as = defender }
	}

	option = {
		name = {
			trigger = { NOT = { scope:recall_char = root } }
			text = lmf_interaction.1304.a #Recall them at once
		}
		name = {
			trigger = { scope:recall_char = root }
			text = lmf_interaction.1304.b #I should head back
		}
		scope:recall_char = {
			current_travel_plan = { cancel_travel_plan = yes }
			start_travel_plan = {
				destination = root.capital_province
				on_arrival_destinations = last
				return_trip = no # One way
			}
			trigger_event = lmf_interaction.1303
		}
		scope:actor = {
			send_interface_message = {
				type = event_generic_bad_with_text
				title =  lmf_interaction.intro.cancelled.tt
				desc = {
					first_valid = {
						triggered_desc = {
							trigger = { scope:actor = { is_at_war_with = root } }
							desc = lmf_interaction.intro.cancelled.our.war
						}
						desc = lmf_interaction.intro.cancelled.recipient.war
					}
				}
				left_icon = scope:recall_char
			}
		}
		ai_chance = {
			factor = 20
			modifier = {
				factor = 0
				scope:recall_char = { is_knight = yes }
			}
			modifier = {
				factor = 0
				scope:recall_char = root
				OR = {
					prowess >= 15
					any_knight = {
						prowess < root.prowess
						count < 4
					}
				}
			}
		}
	}
	option = {
		trigger = {
			NOT = { is_at_war_with = scope:actor }
		}
		name = {
			trigger = { NOT = { scope:recall_char = root } }
			text = lmf_interaction.1304.c #They're fine where they are
		}
		name = {
			trigger = { scope:recall_char = root }
			text = lmf_interaction.1304.d #I'll continue on
		}
		ai_chance = {
			factor = 80
			modifier = {
				factor = 0.1
				has_trait = paranoid
			}
		}
	}
}

# Visit canceled automatically if anyone dies
lmf_interaction.1306 = {
	hidden = yes

	trigger = {
		has_all_variables = {
			name = intro_actor
			name = intro_recipient
			name = intro_secondary_recipient
			name = intro_secondary_actor
		}
	}

	immediate = {
		root = { save_scope_as = intro_death }
		var:intro_secondary_recipient = { save_scope_as = recall_char }
		var:intro_secondary_actor = { save_scope_as = secondary_actor }

		if = {
			limit = { scope:recall_char = root }
			var:intro_actor = {
				send_interface_message = {
					type = event_generic_bad_with_text
					title =  lmf_interaction.intro.cancelled.tt
					desc = lmf_interaction.intro.cancelled.death.visitor
					left_icon = scope:recall_char
					trigger_event = lmf_interaction.1303
				}
			}
			var:intro_recipient = {
				send_interface_message = {
					type = event_generic_bad_with_text
					title =  lmf_interaction.intro.cancelled.tt
					desc = lmf_interaction.intro.cancelled.death.visitor
					left_icon = scope:recall_char
				}
			}
		}
		else = {
			var:intro_actor = {
				if = {
					limit = { NOT = { this = scope:intro_death } }
					send_interface_message = {
						type = event_generic_bad_with_text
						title =  lmf_interaction.intro.cancelled.tt
						desc = lmf_interaction.intro.cancelled.death
						left_icon = scope:recall_char
						right_icon = scope:intro_death
					}
				}
			}
			var:intro_recipient = {
				if = {
					limit = { NOT = { this = scope:intro_death } }
					send_interface_message = {
						type = event_generic_bad_with_text
						title =  lmf_interaction.intro.cancelled.tt
						desc = lmf_interaction.intro.cancelled.death
						left_icon = scope:recall_char
						right_icon = scope:intro_death
					}
				}
			}
			scope:recall_char = {
				if = {
					limit = { exists = current_travel_plan }
					current_travel_plan = { cancel_travel_plan = yes }
				}
				if = {
					limit = {
						var:intro_recipient = { exists = capital_province }
					}
					start_travel_plan = {
						destination = var:intro_recipient.capital_province
						on_arrival_destinations = last
						return_trip = no # One way
					}
				}
				trigger_event = lmf_interaction.1303
			}
		}
	}
}

# Is the introduction still possible?
lmf_interaction.1310 = {
	hidden = yes
	
	trigger = {
		# adding this to prevent event from firing upon the recipient's return home
		NOR = {
			scope:secondary_actor ?= { has_character_flag = had_recent_introduction }
			scope:secondary_recipient ?= { has_character_flag = had_recent_introduction }
		}
	}

	immediate = {
		var:intro_secondary_actor ?= { save_scope_as = secondary_actor }
		var:intro_secondary_recipient ?= { save_scope_as = secondary_recipient }
		var:intro_recipient ?= { save_scope_as = recipient }
		var:intro_actor ?= { save_scope_as = actor }
		if = {
			limit = {
				has_all_variables = {
					name = is_in_marriage_introduction
					name = intro_recipient
				}
				var:intro_actor ?= {
					is_alive = yes
					is_landed_or_landless_administrative = yes
					is_incapable = no
					exists = capital_province
					NOT = {
						capital_province = {
							any_army_in_location = {
								army_owner = { is_at_war_with = root.var:intro_actor }
							}
						}
					}
				}
				var:intro_secondary_actor ?= {
					is_alive = yes
					is_travelling = no
					is_in_army = no
					is_imprisoned = no
					has_recoverable_disease_trigger = no
					is_incapable = no
				}
				var:intro_secondary_recipient ?= {
					is_alive = yes
					is_imprisoned = no
					has_recoverable_disease_trigger = no
					is_incapable = no
					OR = {
						this = var:intro_recipient
						var:intro_recipient = { is_playable_character = yes }
					}
				}
			}
			var:intro_secondary_actor = { save_scope_as = secondary_actor }
			var:intro_secondary_recipient = { save_scope_as = secondary_recipient }
			var:intro_recipient = { save_scope_as = recipient }
			if = {
				limit = { has_variable = intro_grand_wedding_promise }
				save_scope_value_as = {
					name = grand_wedding_promise
					value = yes
				}
			}
			else = {
				save_scope_value_as = {
					name = grand_wedding_promise
					value = no
				}
			}
			if = {
				limit = { has_variable = intro_matrilineal }
				save_scope_value_as = {
					name = matrilineal
					value = yes
				}
			}
			else = {
				save_scope_value_as = {
					name = matrilineal
					value = no
				}
			}
			var:intro_secondary_recipient = {
				if = {
					limit = { is_ai = no }
					trigger_event = lmf_interaction.1311
				}
			}
			var:intro_actor = {
				trigger_event = lmf_interaction.1311 #start the introduction
			}
		}
		else = {
			scope:actor ?= {
				if = {
					limit = { is_ai = no }
					send_interface_message = {
						type = event_generic_bad_with_text
						title =  lmf_interaction.intro.cancelled.tt
						desc = {
							first_valid = {
								triggered_desc = {
									trigger = {
										scope:actor = {
											exists = capital_province
											capital_province = {
												any_army_in_location = {
													army_owner = { is_at_war_with = scope:actor }
												}
											}
										}
									}
									desc = lmf_interaction.intro.cancelled.actor.besieged
								}
								triggered_desc = {
									trigger = {
										scope:actor = { is_landed_or_landless_administrative = no }
									}
									desc = lmf_interaction.intro.cancelled.actor.notruler
								}
								triggered_desc = {
									trigger = {
										NOR = {
											scope:secondary_recipient = scope:recipient
											scope:recipient = { is_playable_character = yes }
										}
									}
									desc = lmf_interaction.intro.cancelled.recipient.notruler
								}
								triggered_desc = {
									trigger = {
										scope:secondary_recipient = { has_recoverable_disease_trigger = yes }
									}
									desc = lmf_interaction.intro.cancelled.secrecp.ill
								}
								triggered_desc = {
									trigger = {
										scope:secondary_actor = { has_recoverable_disease_trigger = yes }
									}
									desc = lmf_interaction.intro.cancelled.secactor.ill
								}
								triggered_desc = {
									trigger = {
										scope:secondary_recipient = { is_imprisoned = yes }
									}
									desc = lmf_interaction.intro.cancelled.secrecp.imprisoned
								}
								triggered_desc = {
									trigger = {
										scope:secondary_recipient = { is_incapable = yes }
									}
									desc = lmf_interaction.intro.cancelled.secrecp.incapable
								}
								triggered_desc = {
									trigger = {
										scope:secondary_actor = {
											OR = {
												is_travelling = yes
												is_in_army = yes
												is_imprisoned = yes
												is_incapable = yes
											}
										}
									}
									desc = lmf_interaction.intro.cancelled.secactor.unavailable
								}
								triggered_desc = {
									trigger = {
										scope:actor = { is_imprisoned = yes }
									}
									desc = lmf_interaction.intro.cancelled.actor.imprisoned
								}
								triggered_desc = {
									trigger = {
										scope:actor = { is_incapable = yes }
									}
									desc = lmf_interaction.intro.cancelled.actor.incapable
								}
								desc = lmf_interaction.intro.cancelled.fallthrough
							}
						}
						left_icon = scope:secondary_recipient
						right_icon = scope:secondary_actor
					}
				}
			}
			scope:recipient ?= {
				if = {
					limit = { is_ai = no }
					send_interface_message = {
						type = event_generic_bad_with_text
						title =  lmf_interaction.intro.cancelled.tt
						desc = {
							first_valid = {
								triggered_desc = {
									trigger = {
										scope:actor = {
											exists = capital_province
											capital_province = {
												any_army_in_location = {
													army_owner = { is_at_war_with = scope:actor }
												}
											}
										}
									}
									desc = lmf_interaction.intro.cancelled.actor.besieged
								}
								triggered_desc = {
									trigger = {
										scope:actor = { is_landed_or_landless_administrative = no }
									}
									desc = lmf_interaction.intro.cancelled.actor.notruler
								}
								triggered_desc = {
									trigger = {
										NOR = {
											scope:secondary_recipient = scope:recipient
											scope:recipient = { is_playable_character = yes }
										}
									}
									desc = lmf_interaction.intro.cancelled.recipient.notruler
								}
								triggered_desc = {
									trigger = {
										scope:secondary_recipient = { has_recoverable_disease_trigger = yes }
									}
									desc = lmf_interaction.intro.cancelled.secrecp.ill
								}
								triggered_desc = {
									trigger = {
										scope:secondary_actor = { has_recoverable_disease_trigger = yes }
									}
									desc = lmf_interaction.intro.cancelled.secactor.ill
								}
								triggered_desc = {
									trigger = {
										scope:secondary_recipient = { is_imprisoned = yes }
									}
									desc = lmf_interaction.intro.cancelled.secrecp.imprisoned
								}
								triggered_desc = {
									trigger = {
										scope:secondary_recipient = { is_incapable = yes }
									}
									desc = lmf_interaction.intro.cancelled.secrecp.incapable
								}
								triggered_desc = {
									trigger = {
										scope:secondary_actor = {
											OR = {
												is_travelling = yes
												is_in_army = yes
												is_imprisoned = yes
												is_incapable = yes
											}
										}
									}
									desc = lmf_interaction.intro.cancelled.secactor.unavailable
								}
								triggered_desc = {
									trigger = {
										scope:actor = { is_imprisoned = yes }
									}
									desc = lmf_interaction.intro.cancelled.actor.imprisoned
								}
								triggered_desc = {
									trigger = {
										scope:actor = { is_incapable = yes }
									}
									desc = lmf_interaction.intro.cancelled.actor.incapable
								}
								desc = lmf_interaction.intro.cancelled.fallthrough
							}
						}
						left_icon = scope:secondary_recipient
						right_icon = scope:secondary_actor
					}
				}
			}
			scope:secondary_recipient ?= {
				if = {
					limit = {
						current_travel_plan ?= { can_cancel = yes }
					}
					current_travel_plan = { cancel_travel_plan = yes }
				}
				if = {
					limit = {
						scope:recipient = { exists = capital_province }
					}
					start_travel_plan = {
						destination = scope:recipient.capital_province
						on_arrival_destinations = last
						return_trip = no # One way
					}
				}
				trigger_event = lmf_interaction.1303
			}
		}
	}
}

# Secondary Recipient arrives
lmf_interaction.1311 = {
	type = character_event
	title = lmf_interaction.1311.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:secondary_recipient = root }
				desc = lmf_interaction.1311.initial.secrep
			}
			triggered_desc = {
				trigger = { scope:secondary_actor = root }
				desc = lmf_interaction.1311.initial.actor
			}
			desc = lmf_interaction.1311.initial
		}
		first_valid = {
			triggered_desc = {
				trigger = { scope:secondary_recipient = root }
				desc = {
					first_valid = {
						triggered_desc = {
							trigger = {
								scope:secondary_actor = scope:actor
								exists = scope:secondary_actor_is_pleased
							}
							desc = lmf_interaction.1311.act.pleased.secrep
						}
						triggered_desc = {
							trigger = {
								scope:secondary_actor = scope:actor
							}
							desc = lmf_interaction.1311.act.displeased.secrep
						}
						triggered_desc = {
							trigger = {
								exists = scope:secondary_actor_is_pleased
							}
							desc = lmf_interaction.1311.secact.pleased.secrep
						}
						desc = lmf_interaction.1311.secact.displeased.secrep
					}
				}
			}
			triggered_desc = {
				trigger = { scope:secondary_actor = root }
				desc = lmf_interaction.1311.act
			}
			triggered_desc = {
				trigger = {
					exists = scope:secondary_actor_is_pleased
				}
				desc = lmf_interaction.1311.secact.pleased
			}
			desc = lmf_interaction.1311.secact.displeased
		}
		first_valid = {
			triggered_desc = {
				trigger = { scope:secondary_recipient = root }
				desc = lmf_interaction.1311.reaction.secrep
			}
			triggered_desc = {
				trigger = {
					scope:secondary_actor = root
					exists = scope:secondary_recipient_is_pleased
				}
				desc = lmf_interaction.1311.reaction.actor.pleased
			}
			triggered_desc = {
				trigger = {
					exists = scope:secondary_recipient_is_pleased
				}
				desc = lmf_interaction.1311.reaction.pleased
			}
			triggered_desc = {
				trigger = {
					scope:secondary_actor = root
				}
				desc = lmf_interaction.1311.reaction.actor.displeased
			}
			desc = lmf_interaction.1311.reaction.displeased
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						scope:secondary_recipient = root
						scope:secondary_actor = root
					}
				}
				desc = lmf_interaction.1311.us.end
			}
			desc = lmf_interaction.1311.end
		}
	}
	theme = family

	left_portrait = {
		character = scope:secondary_actor
		animation = thinking
	}
	right_portrait = {
		character = scope:secondary_recipient
		animation = personality_honorable
		outfit_tags = { travel_cloak }
	}
	override_background = { reference = bp2_courtyard }

	immediate = {
		hidden_effect = {
			scope:secondary_recipient = {
				if = {
					limit = { is_playable_character = yes }
					current_travel_plan = { pause_travel_plan = yes }
				}
				add_character_flag = { flag = no_hat days = 5 }
				save_temporary_opinion_value_as = { name = match_opinion target = scope:secondary_actor }
				save_temporary_scope_as = match
				scope:secondary_actor = { save_temporary_scope_as = candidate }
				set_variable = {
					name = intro_visit_score
					value = scope:candidate.introduction_candidate_interest_value
					days = 10
				}
				if = {
					limit = {
						has_variable = intro_visit_score
						var:intro_visit_score > 0
					}
					save_scope_value_as = {
						name = secondary_recipient_is_pleased
						value = yes
					}
				}
			}
			scope:secondary_actor = {
				add_character_flag = { flag = no_hat days = 5 }
				save_temporary_opinion_value_as = { name = match_opinion target = scope:secondary_recipient }
				save_temporary_scope_as = match
				scope:secondary_recipient = { save_temporary_scope_as = candidate }
				set_variable = {
					name = intro_visit_score
					value = scope:candidate.introduction_candidate_interest_value
					days = 10
				}
				if = {
					limit = {
						has_variable = intro_visit_score
						var:intro_visit_score > 0
					}
					save_scope_value_as = {
						name = secondary_actor_is_pleased
						value = yes
					}
				}
			}
		}
	}

	option = {
		name = lmf_interaction.1311.a
		trigger = { scope:actor = root }
		hidden_effect = {
			if = {
				limit = { scope:secondary_actor = { is_ai = yes } }
				random_list = {
					50 = { # Secondary Recipient asks for Actor's support
						modifier = {
							add = 25
							scope:recipient.highest_held_title_tier_plus_one < scope:actor.highest_held_title_tier
						}
						modifier = {
							add = 25
							scope:secondary_recipient = {
								has_any_moderate_good_relationship_with_character_trigger = { CHARACTER = scope:actor }
							}
						}
						trigger = {
							exists = scope:secondary_recipient_is_pleased
							is_travelling = no
							is_in_army = no
							has_recoverable_disease_trigger = no
							scope:secondary_recipient = {
								is_adult = yes
								NOT = { has_relation_rival = scope:actor }
								OR = {
									has_trait = ambitious
									has_trait = brave
									has_trait = greedy
								}
								OR = {
									is_lowborn = yes
									has_trait = bastard
									has_trait = disinherited
									scope:recipient.highest_held_title_tier < scope:actor.highest_held_title_tier
									AND = {
										age > 25
										any_child = { count < 1 }
									}
								}
							}
						}
						trigger_event = { id = lmf_interaction.1312 days = 1 }
					}
					10 = { # Secondary Recipient misbehaves that evening
						trigger = {
							scope:secondary_recipient = {
								OR = {
									has_trait = lustful
									has_trait = lunatic
									has_trait = sadistic
								}
							}
						}
						trigger_event = { id = lmf_interaction.1313 days = 1 }
					}
					10 = { # Secondary Recipient misbehaves that evening - argues with courtier
						modifier = {
							add = 40
							any_courtier = { has_relation_rival = scope:secondary_recipient }
						}
						modifier = {
							add = 20
							scope:secondary_recipient = { ai_rationality <= high_negative_ai_value }
						}
						trigger = {
							scope:secondary_recipient = {
								ai_compassion <= 0
								OR = {
									has_trait = bossy
									has_trait = wrathful
									has_trait = irritable
									ai_vengefulness >= high_positive_vengefulness
								}
							}
							any_courtier = {
								age >= 12
								is_available_ai = yes
								NOT = { is_consort_of = root }
							}
						}
						trigger_event = { id = lmf_interaction.1314 days = 1 }
					}
					10 = { # Secondary Recipient is scarce
						modifier = {
							add = 10
							scope:secondary_recipient = { ai_sociability <= medium_negative_ai_value }
						}
						trigger = {
							scope:secondary_recipient = {
								ai_sociability <= 0
								OR = {
									has_trait = pensive
									has_trait = shy
									has_trait = depressed
									has_trait = reclusive
								}
							}
						}
						trigger_event = { id = lmf_interaction.1315 days = 1 }
					}
					10 = { # Secondary Recipient is unpleasant at dinner
						modifier = {
							add = 10
							scope:secondary_recipient = { has_trait = gluttonous }
						}
						modifier = {
							add = 10
							scope:secondary_recipient = { has_trait = paranoid }
						}
						modifier = {
							add = 10
							scope:secondary_recipient = { has_trait = lazy }
						}
						ai_value_modifier = {
							who = scope:secondary_recipient
							ai_sociability = -0.2
							ai_compassion = -0.2
							max = 20
							min = -20
						}
						min = 0
						trigger_event = { id = lmf_interaction.1316 days = 1 }
					}
					10 = { # Secondary Recipient impresses at dinner
						modifier = {
							add = 10
							scope:secondary_recipient = { has_trait = temperate }
						}
						modifier = {
							add = 10
							scope:secondary_recipient = { has_trait = gregarious }
						}
						modifier = {
							add = 10
							scope:secondary_recipient = { has_trait = diligent }
						}
						ai_value_modifier = {
							who = scope:secondary_recipient
							ai_sociability = 0.2
							ai_energy = 0.2
							max = 20
							min = -20
						}
						min = 0
						trigger_event = { id = lmf_interaction.1317 days = 1 }
					}
					10 = { # Secondary Recipient gets along well with Actor
						modifier = {
							add = 10
							opinion = { target = scope:secondary_recipient value >= 25 }
						}
						modifier = {
							add = 10
							reverse_opinion = { target = scope:secondary_recipient value >= 25 }
						}
						trigger = {
							opinion = { target = scope:secondary_recipient value >= 0 }
							reverse_opinion = { target = scope:secondary_recipient value >= 0 }
							scope:secondary_recipient = {
								is_adult = yes
								ai_sociability >= 0
							}
							is_travelling = no
							is_in_army = no
							has_recoverable_disease_trigger = no
							NOR = {
								has_relation_best_friend = scope:secondary_recipient
								has_relation_rival = scope:secondary_recipient
							}
						}
						trigger_event = { id = lmf_interaction.1318 days = 1 }
					}
					10 = { # Secondary Recipient hangs around with knights
						modifier = {
							add = 20
							scope:secondary_recipient = { is_knight = yes }
						}
						modifier = {
							add = 20
							scope:secondary_recipient = { ai_boldness >= high_positive_ai_value }
						}
						trigger = {
							scope:secondary_recipient = {
								is_adult = yes
								can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:secondary_recipient }
								has_education_martial_trigger = yes
								ai_sociability >= 0
								ai_boldness >= 0
							}
						}
						trigger_event = { id = lmf_interaction.1319 days = 1 }
					}
					30 = { # Secondary Recipient duels a knight
						trigger = {
							scope:secondary_recipient = {
								is_adult = yes
								can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:secondary_recipient }
								prowess >= 12
								ai_boldness >= medium_positive_ai_value
							}
							any_courtier = {
								is_knight_of = root
								is_available = yes
								has_recoverable_disease_trigger = no
								NOT = { has_trait = wounded }
							}
						}
						trigger_event = { id = lmf_interaction.1320 days = 1 }
					}
					10 = { # Secondary Recipient child misses home
						modifier = {
							add = 10
							scope:secondary_recipient = { has_trait = pensive }
						}
						modifier = {
							add = 20
							scope:secondary_recipient = { has_trait = shy }
						}
						trigger = {
							scope:secondary_recipient = {
								is_adult = no
								ai_sociability <= 0
							}
						}
						trigger_event = { id = lmf_interaction.1321 days = 1 }
					}
					10 = {}
				}
			}
			trigger_event = { id = lmf_interaction.1325 days = 2 } # Start the actual introduction
		}
	}
	option = {
		name = lmf_interaction.1311.a
		trigger = { scope:secondary_recipient = root }
	}
}

# Secondary Recipient asks for Actor's support
lmf_interaction.1312 = {
	type = character_event
	title = lmf_interaction.1312.t
	desc = {
		desc = lmf_interaction.1312.desc.start
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:secondary_recipient = {
						OR = {
							any_relation = { this = scope:secondary_actor }
							is_close_or_extended_family_of = scope:secondary_actor
							house ?= scope:secondary_actor.house
						}
					}
				}
				desc = lmf_interaction.1312.desc.name
			}
			desc = lmf_interaction.1312.desc.stranger
		}
		desc = lmf_interaction.1312.desc.end
	}
	theme = family

	left_portrait = {
		character = scope:secondary_recipient
		animation = beg
	}
	right_portrait = {
		character = root
		animation = thinking
	}
	lower_right_portrait = scope:secondary_actor

	trigger = {
		scope:secondary_actor = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:secondary_recipient = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:recipient = { is_alive = yes }
		scope:actor = { is_alive = yes }
	}

	option = {
		name = lmf_interaction.1312.a # I will quietly support his cause
		reverse_add_opinion = {
			target = scope:secondary_recipient
			modifier = grateful_opinion
			opinion = 20
		}
		custom_tooltip = lmf_interaction_intro_chance_pos_tt
		hidden_effect = {
			scope:secondary_actor = {
				change_intro_visit_score = { MIN_CHANGE = 20 MAX_CHANGE = 60 }
			}
			scope:secondary_recipient = {
				change_intro_visit_score = { MIN_CHANGE = 40 MAX_CHANGE = 80 }
			}
		}
	}
	option = {
		name = lmf_interaction.1312.b # He's on his own
		reverse_add_opinion = {
			target = scope:secondary_recipient
			modifier = disappointed_opinion
			opinion = -20
		}
	}
}

# Secondary Recipient misbehaves that evening
lmf_interaction.1313 = {
	type = character_event
	title = lmf_interaction.1313.t
	desc = {
		desc = lmf_interaction.1313.desc.start
		first_valid = {
			triggered_desc = {
				trigger = { scope:secondary_recipient = { has_trait = lunatic } }
				desc = lmf_interaction.1313.desc.lunatic
			}
			triggered_desc = {
				trigger = { scope:secondary_recipient = { has_trait = lustful } }
				desc = lmf_interaction.1313.desc.lustful
			}
			desc = lmf_interaction.1313.desc.sadistic
		}
		desc = lmf_interaction.1313.desc.end
	}
	lower_right_portrait = scope:secondary_actor
	theme = family

	left_portrait = {
		character = scope:secondary_recipient
		triggered_animation = {
			trigger = { scope:secondary_recipient = { has_trait = lunatic } }
			animation = laugh
		}
		triggered_animation = {
			trigger = { scope:secondary_recipient = { has_trait = lustful } }
			animation = flirtation
		}
		triggered_outfit = {
			trigger = { scope:secondary_recipient = { has_trait = lunatic } }
			outfit_tags = { no_clothes }
		}
		triggered_outfit = {
			trigger = { scope:secondary_recipient = { has_trait = lustful } }
			outfit_tags = { travel_cloak }
		}
		animation = disgust
	}
	override_background = {
		trigger = { scope:secondary_recipient = { has_trait = lunatic } }
		reference = corridor_night
	}
	override_background = {
		trigger = { scope:secondary_recipient = { has_trait = lustful } }
		reference = market
	}
	override_background = {
		trigger = { scope:secondary_recipient = { has_trait = sadistic } }
		reference = bedchamber
	}

	trigger = {
		scope:secondary_actor = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:secondary_recipient = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:recipient = { is_alive = yes }
		scope:actor = { is_alive = yes }
	}

	option = {
		name = lmf_interaction.1313.a
		custom_tooltip = lmf_interaction_intro_chance_neg_tt
		hidden_effect = {
			scope:secondary_actor = {
				change_intro_visit_score = { MIN_CHANGE = -60 MAX_CHANGE = -20 }
			}
			scope:secondary_recipient = {
				change_intro_visit_score = { MIN_CHANGE = -60 MAX_CHANGE = -20 }
			}
		}
	}
}

# Secondary Recipient misbehaves that evening - argues with courtier
lmf_interaction.1314 = {
	type = character_event
	title = lmf_interaction.1314.t
	desc = lmf_interaction.1314.desc
	theme = family

	left_portrait = {
		character = scope:your_courtier
		animation = shock
	}
	right_portrait = {
		character = scope:secondary_recipient
		animation = rage
	}
	lower_right_portrait = scope:secondary_actor
	override_background = { reference = feast }

	trigger = {
		scope:secondary_actor = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:secondary_recipient = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:recipient = { is_alive = yes }
		scope:actor = { is_alive = yes }
	}

	immediate = {
		random_courtier = {
			limit = {
				age >= 12
				is_available_ai = yes
				NOT = { is_consort_of = root }
			}
			weight = {
				base = 1
				modifier = {
					add = 50
					has_relation_rival = scope:secondary_recipient
				}
				modifier = {
					add = -5
					age > scope:secondary_recipient.age_plus_10
				}
				modifier = {
					add = 2
					age <= scope:secondary_recipient.age_plus_10
				}
				modifier = {
					add = 2
					age <= scope:secondary_recipient.age_plus_5
				}
				modifier = {
					add = 2
					age < scope:secondary_recipient.age_plus_3
				}
				modifier = {
					add = 2
					has_dynasty = yes
					NOT = { dynasty = root.dynasty }
				}
				modifier = {
					add = 2
					is_lowborn = yes
				}
				modifier = {
					add = 2
					sex_same_as = scope:recipient
				}
				modifier = {
					add = -2
					ai_boldness <= -25
				}
				modifier = {
					add = -3
					is_knight = yes
				}
				min = 1
			}
			save_scope_as = your_courtier
		}
	}

	option = {
		name = lmf_interaction.1314.a
		custom_tooltip = lmf_interaction_intro_chance_neg_tt
		scope:your_courtier = {
			if = {
				limit = {
					can_set_relation_rival_trigger = { CHARACTER = scope:secondary_recipient }
				}
				set_relation_rival = {
					target = scope:secondary_recipient
					reason = fought_during_introduction
				}
			}
			else = {
				add_opinion = {
					target = scope:secondary_recipient
					modifier = hate_opinion
					opinion = -50
				}
			}
		}
		hidden_effect = {
			scope:secondary_actor = {
				change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
			}
			scope:secondary_recipient = {
				change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
			}
		}
	}
}

# Secondary Recipient is scarce
lmf_interaction.1315 = {
	type = character_event
	title = lmf_interaction.1315.t
	desc = lmf_interaction.1315.desc
	theme = family

	left_portrait = {
		character = scope:secondary_recipient
		animation = shame
	}
	lower_right_portrait = scope:secondary_actor
	override_background = { reference = study }

	trigger = {
		scope:secondary_actor = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:secondary_recipient = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:recipient = { is_alive = yes }
		scope:actor = { is_alive = yes }
	}

	option = {
		name = lmf_interaction.1315.a
		scope:secondary_recipient = {
			stress_impact = {
				base = medium_stress_impact_gain
			}
		}
		custom_tooltip = lmf_interaction_intro_chance_neg_tt
		hidden_effect = {
			scope:secondary_actor = {
				change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
			}
			scope:secondary_recipient = {
				change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
			}
		}
	}
}

# Secondary Recipient is unpleasant at dinner
lmf_interaction.1316 = {
	type = character_event
	title = lmf_interaction.1316.t
	desc = {
		desc = lmf_interaction.1316.desc.start
		first_valid = {
			triggered_desc = {
				trigger = { scope:secondary_recipient = { has_trait = gluttonous } }
				desc = lmf_interaction.1316.desc.gluttonous
			}
			triggered_desc = {
				trigger = { scope:secondary_recipient = { has_trait = paranoid } }
				desc = lmf_interaction.1316.desc.paranoid
			}
			triggered_desc = {
				trigger = { scope:secondary_recipient = { has_trait = lazy } }
				desc = lmf_interaction.1316.desc.lazy
			}
			desc = lmf_interaction.1316.desc.fallthrough
		}
		desc = lmf_interaction.1316.desc.end
	}
	theme = family

	left_portrait = {
		character = scope:secondary_recipient
		triggered_animation = {
			trigger = { scope:secondary_recipient = { has_trait = gluttonous } }
			animation = drink_goblet
		}
		triggered_animation = {
			trigger = { scope:secondary_recipient = { has_trait = paranoid } }
			animation = paranoia
		}
		triggered_animation = {
			trigger = { scope:secondary_recipient = { has_trait = paranoid } }
			animation = boredom
		}
		animation = stress
	}
	lower_right_portrait = scope:secondary_actor
	override_background = { reference = feast }

	trigger = {
		scope:secondary_actor = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:secondary_recipient = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:recipient = { is_alive = yes }
		scope:actor = { is_alive = yes }
	}

	option = {
		name = lmf_interaction.1316.a
		custom_tooltip = lmf_interaction_intro_chance_neg_tt
		hidden_effect = {
			scope:secondary_actor = {
				change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
			}
			scope:secondary_recipient = {
				change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
			}
		}
	}
}

# Secondary Recipient impresses at dinner
lmf_interaction.1317 = {
	type = character_event
	title = lmf_interaction.1317.t
	desc = {
		desc = lmf_interaction.1317.desc.start
		first_valid = {
			triggered_desc = {
				trigger = { scope:secondary_recipient = { has_trait = gregarious } }
				desc = lmf_interaction.1317.desc.gregarious
			}
			triggered_desc = {
				trigger = { scope:secondary_recipient = { has_trait = diligent } }
				desc = lmf_interaction.1317.desc.diligent
			}
			triggered_desc = {
				trigger = { scope:secondary_recipient = { has_trait = temperate } }
				desc = lmf_interaction.1317.desc.temperate
			}
			desc = lmf_interaction.1317.desc.fallthrough
		}
		desc = lmf_interaction.1317.desc.end
	}
	theme = family

	left_portrait = {
		character = scope:secondary_recipient
		triggered_animation = {
			trigger = { scope:secondary_recipient = { has_trait = gregarious } }
			animation = laugh
		}
		triggered_animation = {
			trigger = { scope:secondary_recipient = { has_trait = diligent } }
			animation = personality_honorable
		}
		triggered_animation = {
			trigger = { scope:secondary_recipient = { has_trait = temperate } }
			animation = personality_content
		}
		animation = happiness
	}
	lower_right_portrait = scope:secondary_actor
	override_background = { reference = feast }

	trigger = {
		scope:secondary_actor = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:secondary_recipient = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:recipient = { is_alive = yes }
		scope:actor = { is_alive = yes }
	}

	option = {
		name = lmf_interaction.1317.a
		custom_tooltip = lmf_interaction_intro_chance_pos_tt
		hidden_effect = {
			scope:secondary_actor = {
				change_intro_visit_score = { MIN_CHANGE = 20 MAX_CHANGE = 60 }
			}
			scope:secondary_recipient = {
				change_intro_visit_score = { MIN_CHANGE = 20 MAX_CHANGE = 60 }
			}
		}
	}
}

# Secondary Recipient gets along well with Actor
lmf_interaction.1318 = {
	type = character_event
	title = lmf_interaction.1318.t
	desc = lmf_interaction.1318.desc
	theme = family

	left_portrait = {
		character = scope:actor
		animation = laugh
	}
	right_portrait = {
		character = scope:secondary_recipient
		animation = admiration
	}
	lower_right_portrait = scope:secondary_actor

	trigger = {
		scope:secondary_actor = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:secondary_recipient = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:recipient = { is_alive = yes }
		scope:actor = { is_alive = yes }
	}

	option = {
		name = lmf_interaction.1318.a
		improve_relationship_effect = {
			TARGET = scope:secondary_recipient
			REASON = got_along_at_introduction
		}
	}
}

# Secondary Recipient hangs around with knights
lmf_interaction.1319 = {
	type = character_event
	title = lmf_interaction.1319.t
	desc = {
		desc = lmf_interaction.1319.desc.start
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:secondary_actor_impressed }
				desc = lmf_interaction.1319.desc.impressed
			}
			desc = lmf_interaction.1319.desc.unimpressed
		}
	}
	theme = family

	left_portrait = {
		character = scope:secondary_actor
		triggered_animation = {
			trigger = { exists = scope:secondary_actor_impressed }
			animation = admiration
		}
		animation = dismissal
	}
	right_portrait = {
		character = scope:secondary_recipient
		animation = celebrate_sword
	}
	override_background = { reference = army_camp }

	trigger = {
		scope:secondary_actor = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:secondary_recipient = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:recipient = { is_alive = yes }
		scope:actor = { is_alive = yes }
	}

	immediate = {
		hidden_effect = {
			scope:secondary_recipient = {
				add_character_flag = wear_armor
			}
			scope:secondary_actor = {
				if = {
					limit = {
						OR = {
							is_knight = yes
							this = root.cp:councillor_marshal
							has_focus = education_martial
							has_education_martial_trigger = yes
							has_personality_dominant_trigger = yes
							ai_sociability >= high_positive_ai_value
						}
					}
					save_scope_value_as = {
						name = secondary_actor_impressed
						value = yes
					}
				}
			}
		}
	}

	option = {
		name = lmf_interaction.1319.a
		trigger = {
			exists = scope:secondary_actor_impressed
		}
		custom_tooltip = lmf_interaction_intro_chance_pos_tt
		hidden_effect = {
			scope:secondary_actor = {
				change_intro_visit_score = { MIN_CHANGE = 20 MAX_CHANGE = 40 }
			}
			scope:secondary_recipient = {
				change_intro_visit_score = { MIN_CHANGE = 20 MAX_CHANGE = 40 }
			}
		}
	}
	option = {
		name = lmf_interaction.1319.b
		trigger = {
			NOT = { exists = scope:secondary_actor_impressed }
		}
		custom_tooltip = lmf_interaction_intro_chance_neg_tt
		hidden_effect = {
			scope:secondary_actor = {
				change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
			}
			scope:secondary_recipient = {
				change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
			}
		}
	}

	after = {
		scope:secondary_recipient = { remove_character_flag = wear_armor }
	}
}

# Secondary Recipient duels a knight
lmf_interaction.1320 = {
	type = character_event
	title = lmf_interaction.1320.t
	desc = lmf_interaction.1320.desc
	theme = family

	left_portrait = {
		character = scope:your_courtier
		animation = aggressive_sword
	}
	right_portrait = {
		character = scope:secondary_recipient
		animation = anger
	}
	lower_right_portrait = scope:secondary_actor
	override_background = { reference = army_camp }

	trigger = {
		scope:secondary_actor = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:secondary_recipient = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:recipient = { is_alive = yes }
		scope:actor = { is_alive = yes }
	}

	immediate = {
		hidden_effect = {
			scope:secondary_recipient = { add_character_flag = wear_armor }
			random_courtier = {
				limit = {
					is_knight_of = root
					is_available = yes
					has_recoverable_disease_trigger = no
					NOT = { has_trait = wounded }
				}
				weight = {
					base = 1
					modifier = {
						add = 50
						has_relation_rival = scope:secondary_recipient
					}
					modifier = {
						add = -10
						has_relation_friend = scope:secondary_recipient
					}
					modifier = {
						add = -2
						age >= 50
					}
					modifier = {
						add = 2
						age <= scope:secondary_recipient.age_plus_10
						age >= scope:secondary_recipient.age_minus_10
					}
					modifier = {
						add = 2
						age <= scope:secondary_recipient.age_plus_5
						age >= scope:secondary_recipient.age_minus_5
					}
					modifier = {
						add = 2
						age < scope:secondary_recipient.age_plus_3
						age > scope:secondary_recipient.age_minus_3
					}
					modifier = {
						add = -2
						sex_opposite_of = scope:recipient
					}
					modifier = {
						add = -2
						is_lowborn = yes
					}
					modifier = {
						add = 2
						OR = {
							dynasty ?= root.dynasty
							is_close_or_extended_family_of = root
						}
					}
					modifier = {
						add = 2
						has_trait = wrathful
					}
					modifier = {
						add = 2
						ai_rationality <= high_negative_rationality
					}
					min = 1
				}
				save_scope_as = your_courtier
			}
		}
	}

	option = {
		name = lmf_interaction.1320.a
		scope:secondary_recipient = {
			duel = {
				skill = prowess
				target = scope:your_courtier
				10 = {
					desc = lmf_interaction.1320.a.win.tt
					compare_modifier = {
						value = scope:duel_value
						multiplier = 0.5
					}
					custom_tooltip = lmf_interaction_intro_chance_pos_tt
					hidden_effect = {
						scope:secondary_actor = {
							change_intro_visit_score = { MIN_CHANGE = 20 MAX_CHANGE = 40 }
						}
						change_intro_visit_score = { MIN_CHANGE = 20 MAX_CHANGE = 40 }
						scope:actor = {
							send_interface_message = {
								type = event_generic_good
								title =  lmf_interaction.1320.a.win.tt
								right_icon = scope:secondary_recipient
								custom_tooltip = lmf_interaction_intro_chance_pos_tt
								scope:secondary_recipient = { add_prestige = medium_prestige_value }
							}
						}
					}
				}
				8 = {
					desc = lmf_interaction.1320.a.lose.tt
					custom_tooltip = lmf_interaction_intro_chance_neg_tt
					show_as_tooltip = {
						increase_wounds_effect = { REASON = fight }
					}
					hidden_effect = {
						scope:secondary_actor = {
							change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
						}
						change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
						scope:actor = {
							send_interface_message = {
								type = event_generic_good
								title =  lmf_interaction.1320.a.lose.tt
								right_icon = scope:secondary_recipient
								custom_tooltip = lmf_interaction_intro_chance_neg_tt
								scope:secondary_recipient = {
									add_prestige = medium_prestige_loss
									increase_wounds_effect = { REASON = fight }
								}
							}
						}
					}
				}
			}
		}
	}

	after = {
		scope:secondary_recipient = { remove_character_flag = wear_armor }
	}
}

# Secondary Recipient child misses home
lmf_interaction.1321 = {
	type = character_event
	title = lmf_interaction.1321.t
	desc = lmf_interaction.1321.desc
	theme = family

	left_portrait = {
		character = scope:secondary_recipient
		animation = sadness
		triggered_outfit = {
			remove_default_outfit = no
			outfit_tags = { nightgown }
		}
	}
	override_background = { reference = bedchamber }

	trigger = {
		scope:secondary_actor = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:secondary_recipient = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:recipient = { is_alive = yes }
		scope:actor = { is_alive = yes }
	}

	option = {
		name = lmf_interaction.1321.a
		scope:secondary_recipient = {
			stress_impact = {
				base = medium_stress_impact_gain
			}
		}
	}
}

# Bounce event for a secondary recipient which is part of the actor's court
lmf_interaction.1322 = {
	hidden = yes

	immediate = {
		scope:actor = {
			remove_marriage_introduction_variables = yes
			set_marriage_introduction_variables = yes
		}
		scope:secondary_actor = {
			remove_marriage_introduction_variables = yes
			set_marriage_introduction_variables = yes
			add_character_flag = { flag = no_hat days = 5 }
			save_temporary_opinion_value_as = { name = match_opinion target = scope:secondary_recipient }
			save_temporary_scope_as = match
			scope:secondary_recipient = { save_temporary_scope_as = candidate }
			set_variable = {
				name = intro_visit_score
				value = scope:candidate.introduction_candidate_interest_value
				days = 10
			}
			if = {
				limit = { var:intro_visit_score > 0 }
				save_scope_value_as = {
					name = secondary_actor_is_pleased
					value = yes
				}
			}
		}
		scope:recipient ?= {
			remove_marriage_introduction_variables = yes
			set_marriage_introduction_variables = yes
		}
		scope:secondary_recipient = {
			remove_marriage_introduction_variables = yes
			set_marriage_introduction_variables = yes
			add_character_flag = { flag = no_hat days = 5 }
			save_temporary_opinion_value_as = { name = match_opinion target = scope:secondary_actor }
			save_temporary_scope_as = match
			scope:secondary_actor = { save_temporary_scope_as = candidate }
			set_variable = {
				name = intro_visit_score
				value = scope:candidate.introduction_candidate_interest_value
				days = 10
			}
			if = {
				limit = { var:intro_visit_score > 0 }
				save_scope_value_as = {
					name = secondary_recipient_is_pleased
					value = yes
				}
			}
		}

		scope:actor = { trigger_event = lmf_interaction.1325 }
	}
}

# The Next Day
lmf_interaction.1325 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:secondary_recipient = { resides_in_court_of_actor = yes }
				}
				desc = lmf_interaction.1325.t.same
			}
			desc = lmf_interaction.1325.t
		}
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:secondary_actor = root
					scope:secondary_recipient = { resides_in_court_of_actor = yes }
				}
				desc = {
					desc = lmf_interaction.1325.desc.same.actor.start
					first_valid = {
						triggered_desc = {
							trigger = { scope:secondary_recipient = { has_trait = will_not_wed } }
							desc = lmf_interaction.1325.desc.same.actor.willnotwed
						}
						desc = lmf_interaction.1325.desc.same.actor
					}
					desc = lmf_interaction.1325.desc.same.actor.end
				}
			}
			triggered_desc = {
				trigger = {
					scope:secondary_recipient = { resides_in_court_of_actor = yes }
				}
				desc = {
					desc = lmf_interaction.1325.desc.same.start
					first_valid = {
						triggered_desc = {
							trigger = {
								scope:secondary_actor = { has_trait = will_not_wed }
								scope:secondary_recipient = { has_trait = will_not_wed }
							}
							desc = lmf_interaction.1325.desc.same.both.willnotwed
						}
						triggered_desc = {
							trigger = {
								scope:secondary_recipient = { has_trait = will_not_wed }
							}
							desc = lmf_interaction.1325.desc.same.secrec.willnotwed
						}
						triggered_desc = {
							trigger = {
								scope:secondary_actor = { has_trait = will_not_wed }
							}
							desc = lmf_interaction.1325.desc.same.secact.willnotwed
						}
						desc = lmf_interaction.1325.desc.same
					}
					desc = lmf_interaction.1325.desc.same.end
				}
			}
			desc = {
				first_valid = {
					triggered_desc = {
						trigger = { scope:secondary_recipient = root }
						desc = lmf_interaction.1325.desc.secrec.start
					}
					desc = lmf_interaction.1325.desc.start
				}
				first_valid = {
					triggered_desc = {
						trigger = { scope:secondary_actor = root }
						desc = lmf_interaction.1325.desc.actor
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_visit_score > 0 }
						desc = lmf_interaction.1325.desc.secact
					}
					desc = lmf_interaction.1325.desc.secact.disapprove
				}
				desc = lmf_interaction.1325.desc.end
			}
		}
	}
	theme = family

	left_portrait = scope:secondary_actor
	right_portrait = scope:secondary_recipient
	override_background = { reference = throne_room }

	trigger = {
		exists = scope:secondary_actor
		exists = scope:secondary_recipient
		exists = scope:recipient
		exists = scope:actor
		scope:secondary_actor = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:secondary_recipient = {
			is_alive = yes
			has_variable = is_in_marriage_introduction
		}
		scope:recipient = { is_alive = yes }
		scope:actor = { is_alive = yes }
	}

	immediate = {
		hidden_effect = {
			scope:secondary_actor = {
				add_character_flag = { flag = had_recent_introduction months = 12 }

				# pick out the type of activity they're going to take the secondary_recipient on
				random_list = {
					20 = {
						modifier = {
							add = 10
							has_trait = lifestyle_hunter
						}
						ai_value_modifier = {
							ai_boldness = 0.3
						}
						min = 0
						trigger = {
							ai_energy >= 0
							OR = {
								has_trait = lifestyle_hunter
								has_trait = education_martial
							}
						}
						set_variable = { name = intro_activity value = flag:hunting days = 30 }
					}
					10 = {
						modifier = {
							add = 10
							has_trait = athletic
						}
						ai_value_modifier = {
							ai_energy = 0.3
						}
						min = 0
						trigger = {
							is_adult = yes
							OR = {
								has_trait = whole_of_body
								has_trait = athletic
								has_trait = lifestyle_wayfarer
								has_trait = lifestyle_voyager
								has_trait = lifestyle_surveyor
								ai_energy >= low_positive_ai_value
							}
						}
						set_variable = { name = intro_activity value = flag:hike days = 30 }
					}
					20 = {
						modifier = {
							add = 10
							has_trait = lifestyle_blademaster
						}
						ai_value_modifier = {
							ai_boldness = 0.3
						}
						min = 0
						trigger = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:actor }
							OR = {
								is_knight = yes
								has_trait = lifestyle_blademaster
								has_trait = education_martial
								has_focus = education_martial
							}
						}
						set_variable = { name = intro_activity value = flag:garrison days = 30 }
					}
					20 = {
						modifier = {
							add = 10
							has_trait = seducer
						}
						ai_value_modifier = {
							ai_honor = -0.3
						}
						min = 0
						trigger = {
							is_ai = yes
							scope:secondary_recipient = { is_ai = yes }
							is_attracted_to_gender_of = scope:secondary_recipient
							ai_boldness >= 0
							OR = {
								has_trait = rakish
								has_trait = seducer
								is_deviant_trigger = yes
								AND = {
									has_trait = lustful
									ai_honor <= low_negative_ai_value
								}
							}
						}
						set_variable = { name = intro_activity value = flag:seduction days = 30 }
					}
					10 = {
						modifier = {
							add = 20
							has_trait = lifestyle_poet
						}
						ai_value_modifier = {
							ai_honor = 0.3
						}
						trigger = {
							OR = {
								has_trait = lifestyle_poet
								has_trait = charming
								AND = {
									has_trait = education_diplomacy
									diplomacy >= 12
								}
							}
						}
						set_variable = { name = intro_activity value = flag:poetry days = 30 }
					}
					20 = {
						modifier = {
							add = 20
							has_trait = scholar
						}
						ai_value_modifier = {
							ai_sociability = -0.3
						}
						min = 0
						trigger = {
							OR = {
								has_trait = scholar
								has_trait = pensive
								has_trait = education_learning
								has_focus = education_learning
							}
						}
						set_variable = { name = intro_activity value = flag:library days = 30 }
					}
					10 = {
						modifier = {
							add = 10
							has_trait = zealous
						}
						ai_value_modifier = {
							ai_zeal = 0.3
						}
						min = 0
						trigger = {
							is_ai = yes
							ai_zeal >= 20
							faith = scope:actor.faith
							OR = {
								faith = scope:secondary_recipient.faith
								ai_compassion <= low_negative_ai_value
							}
						}
						set_variable = { name = intro_activity value = flag:church days = 30 }
					}
					30 = {
						modifier = {
							add = 10
							has_trait = lifestyle_reveler
						}
						ai_value_modifier = {
							ai_sociability = 0.3
						}
						min = 0
						trigger = {
							is_ai = yes
							is_adult = yes
							ai_sociability >= 0
							ai_rationality <= high_positive_ai_value
							scope:secondary_recipient = {
								is_adult = yes
								is_ai = yes
							}
							OR = {
								is_ruler = yes
								is_close_family_of = scope:actor
							}
							OR = {
								has_trait = lifestyle_reveler
								has_trait = drunkard
								ai_sociability >= low_positive_ai_value
							}
						}
						set_variable = { name = intro_activity value = flag:tavern days = 30 }
					}
					10 = {
						modifier = {
							add = 10
							has_trait = generous
						}
						ai_value_modifier = {
							ai_compassion = 0.3
						}
						min = 0
						trigger = {
							ai_sociability >= 0
							OR = {
								has_trait = improvident
								ai_compassion >= low_positive_ai_value
							}
						}
						set_variable = { name = intro_activity value = flag:poor days = 30 }
					}
					10 = {
						modifier = {
							add = 10
							OR = {
								has_focus = education_stewardship
								has_trait = education_stewardship
							}
						}
						ai_value_modifier = {
							ai_energy = 0.2
						}
						min = 1
						set_variable = { name = intro_activity value = flag:tour days = 30 }
					}
					10 = {
						modifier = {
							add = 10
							has_trait = lifestyle_gardener
						}
						modifier = {
							add = 10
							has_trait = lifestyle_herbalist
						}
						ai_value_modifier = {
							ai_honor = 0.2
						}
						min = 1
						set_variable = { name = intro_activity value = flag:garden days = 30 }
					}
				}
			}
			scope:secondary_recipient = {
				add_character_flag = { flag = had_recent_introduction months = 12 }
				if = {
					limit = { is_ai = yes }
					if = {
						limit = { scope:secondary_actor.var:intro_activity = flag:hunting }
						if = {
							limit = {
								ai_energy >= 0
								ai_boldness >= high_positive_ai_value
							}
							save_scope_value_as = { name = loved_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = 20 MAX_CHANGE = 40 }
							}
						}
						else_if = {
							limit = {
								OR = {
									ai_energy <= very_high_negative_ai_value
									ai_boldness <= very_high_negative_ai_value
								}
							}
							save_scope_value_as = { name = hated_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
							}
						}
					}
					if = {
						limit = { scope:secondary_actor.var:intro_activity = flag:hike }
						if = {
							limit = {
								ai_energy >= very_high_positive_ai_value
							}
							save_scope_value_as = { name = loved_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = 20 MAX_CHANGE = 40 }
							}
						}
						else_if = {
							limit = {
								ai_energy <= very_high_negative_ai_value
							}
							save_scope_value_as = { name = hated_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
							}
						}
					}
					if = {
						limit = { scope:secondary_actor.var:intro_activity = flag:garrison }
						if = {
							limit = {
								OR = {
									is_knight = yes
									has_trait = lifestyle_blademaster
									has_trait = education_martial
									has_focus = education_martial
								}
							}
							save_scope_value_as = { name = loved_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = 20 MAX_CHANGE = 40 }
							}
						}
						else_if = {
							limit = {
								OR = {
									NOT = { is_attracted_to_gender_of = scope:secondary_actor }
									ai_vengefulness >= high_positive_ai_value
									has_trait = impatient
								}
							}
							save_scope_value_as = { name = hated_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
							}
						}
					}
					if = {
						limit = { scope:secondary_actor.var:intro_activity = flag:seduction }
						if = {
							limit = {
								is_ai = yes
								is_attracted_to_gender_of = scope:secondary_actor
								ai_boldness >= 0
								likely_to_take_lover_trigger = yes
							}
							save_scope_value_as = { name = loved_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = 20 MAX_CHANGE = 40 }
							}
						}
						else_if = {
							limit = {
								is_ai = yes
								OR = {
									has_trait = chaste
									NOT = { is_attracted_to_gender_of = scope:secondary_actor }
									AND = {
										has_trait = zealous
										faith = { trait_is_virtue = chaste }
									}
								}
							}
							save_scope_value_as = { name = hated_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
							}
						}
					}
					if = {
						limit = { scope:secondary_actor.var:intro_activity = flag:poetry }
						if = {
							limit = {
								OR = {
									has_trait = lifestyle_poet
									has_trait = shy
									has_trait = chaste
									ai_honor >= high_positive_ai_value
								}
							}
							save_scope_value_as = { name = loved_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = 20 MAX_CHANGE = 40 }
							}
						}
						else_if = {
							limit = {
								OR = {
									ai_honor <= very_high_negative_ai_value
									ai_compassion <= very_high_negative_ai_value
								}
							}
							save_scope_value_as = { name = hated_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
							}
						}
					}
					if = {
						limit = { scope:secondary_actor.var:intro_activity = flag:library }
						if = {
							limit = {
								OR = {
									has_trait = scholar
									has_trait = pensive
									has_trait = education_learning
									has_focus = education_learning
								}
							}
							save_scope_value_as = { name = loved_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = 20 MAX_CHANGE = 40 }
							}
						}
						else_if = {
							limit = {
								OR = {
									ai_sociability >= very_high_positive_ai_value
									ai_energy >= very_high_positive_ai_value
									has_focus = education_martial
								}
							}
							save_scope_value_as = { name = hated_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
							}
						}
					}
					if = {
						limit = { scope:secondary_actor.var:intro_activity = flag:church }
						if = {
							limit = {
								is_ai = yes
								faith = scope:secondary_actor.faith
								ai_zeal >= high_positive_ai_value
							}
							save_scope_value_as = { name = loved_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = 20 MAX_CHANGE = 40 }
							}
						}
						else_if = {
							limit = {
								OR = {
									NOT = { faith = scope:secondary_actor.faith }
									ai_zeal <= low_negative_ai_value
								}
							}
							save_scope_value_as = { name = hated_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
							}
						}
					}
					if = {
						limit = { scope:secondary_actor.var:intro_activity = flag:tavern }
						if = {
							limit = {
								ai_sociability >= 0
								OR = {
									has_trait = lifestyle_reveler
									has_trait = drunkard
									ai_sociability >= very_high_positive_ai_value
								}
							}
							save_scope_value_as = { name = loved_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = 20 MAX_CHANGE = 40 }
							}
						}
						else_if = {
							limit = {
								OR = {
									has_trait = temperate
									ai_sociability <= low_negative_ai_value
								}
							}
							save_scope_value_as = { name = hated_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
							}
						}
					}
					if = {
						limit = { scope:secondary_actor.var:intro_activity = flag:poor }
						if = {
							limit = {
								ai_sociability >= 0
								faith = { trait_is_virtue = compassionate }
								ai_compassion >= high_positive_ai_value
							}
							save_scope_value_as = { name = loved_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = 20 MAX_CHANGE = 40 }
							}
						}
						else_if = {
							limit = {
								OR = {
									has_trait = greedy
									ai_compassion <= very_high_negative_ai_value
								}
							}
							save_scope_value_as = { name = hated_activity value = flag:yes }
							scope:secondary_actor = {
								change_intro_visit_score = { MIN_CHANGE = -40 MAX_CHANGE = -20 }
							}
						}
					}
				}
			}
		}
	}

	option = {
		name = lmf_interaction.1325.a
		custom_tooltip = lmf_interaction.1325.a.tt

		if = {
			limit = { scope:actor = root }
			# does the secondary actor charm the secondary recipient?
			scope:secondary_actor = {
				duel = {
					skill = diplomacy
					value = average_skill_rating
					50 = {
						desc = lmf_interaction.1325.a.secrec.charmed
						compare_modifier = {
							value = scope:duel_value
							multiplier = 3.5
						}
						modifier = {
							scope:secondary_actor.var:intro_visit_score >= 20
							add = {
								value = diplomacy
								multiply = 3
							}
						}
						modifier = {
							always = yes
							add = scope:secondary_recipient.var:intro_visit_score
						}
						min = 5
						save_scope_value_as = {
							name = secondary_recipient_is_charmed
							value = yes
						}
					}
					50 = {
						desc = lmf_interaction.1325.a.secrec.notcharmed
						compare_modifier = {
							value = scope:duel_value
							multiplier = -3.5
						}
						min = 5
						modifier = {
							scope:secondary_actor.var:intro_visit_score <= -20
							add = {
								value = intrigue
								multiply = 3
							}
						}
					}
				}
			}

			# does the secondary recipient charm the secondary actor?
			scope:secondary_recipient = {
				duel = {
					skill = diplomacy
					value = average_skill_rating
					50 = {
						desc = lmf_interaction.1325.a.secact.charmed
						compare_modifier = {
							value = scope:duel_value
							multiplier = 3.5
						}
						modifier = {
							scope:secondary_recipient.var:intro_visit_score >= 20
							add = {
								value = diplomacy
								multiply = 3
							}
						}
						modifier = {
							always = yes
							add = scope:secondary_actor.var:intro_visit_score
						}
						min = 5
						save_scope_value_as = {
							name = secondary_actor_is_charmed
							value = yes
						}
					}
					50 = {
						desc = lmf_interaction.1325.a.secact.notcharmed
						compare_modifier = {
							value = scope:duel_value
							multiplier = -3.5
						}
						min = 5
						modifier = {
							scope:secondary_recipient.var:intro_visit_score <= -20
							add = {
								value = intrigue
								multiply = 3
							}
						}
					}
				}
			}
		}
	}

	after = {
		if = {
			limit = {
				exists = scope:secondary_actor_is_charmed
				exists = scope:secondary_recipient_is_charmed
			}
			# become lovers?
			if = {
				limit = {
					scope:secondary_actor = {
						is_attracted_to_gender_of = scope:secondary_recipient
						can_set_relation_lover_trigger = { CHARACTER = scope:secondary_recipient }
						OR = {
							is_below_ai_lover_soft_cap_trigger = yes
							is_ai = no
							scope:secondary_recipient = { is_ai = no }
						}
						NOR = {
							has_trait = chaste
							has_trait = celibate
							is_unattractive_trigger = yes
							is_malformed_trigger = yes
						}
					}
					scope:secondary_recipient = {
						is_attracted_to_gender_of = scope:secondary_actor
						can_set_relation_lover_trigger = { CHARACTER = scope:secondary_actor }
						OR = {
							is_below_ai_lover_soft_cap_trigger = yes
							is_ai = no
							scope:secondary_actor = { is_ai = no }
						}
						NOR = {
							has_trait = chaste
							has_trait = celibate
							is_unattractive_trigger = yes
							is_malformed_trigger = yes
						}
					}
				}
				random = {
					chance = 25
					modifier = {
						add = 25
						scope:secondary_actor = { likely_to_take_lover_trigger = yes }
					}
					modifier = {
						add = 25
						scope:secondary_recipient = { likely_to_take_lover_trigger = yes }
					}
					modifier = {
						add = 25
						OR = {
							scope:secondary_actor = { is_attractive_trigger = yes }
							scope:secondary_recipient = { is_attractive_trigger = yes }
						}
					}
					save_scope_value_as = {
						name = can_become_lovers
						value = yes
					}
				}
			}
			# become friends?
			else_if = {
				limit = {
					scope:secondary_actor = {
						can_set_relation_friend_trigger = { CHARACTER = scope:secondary_recipient }
						OR = {
							num_of_relation_friend < 4
							is_ai = no
							scope:secondary_recipient = { is_ai = no }
						}
					}
					scope:secondary_recipient = {
						can_set_relation_friend_trigger = { CHARACTER = scope:secondary_actor }
						OR = {
							num_of_relation_friend < 4
							is_ai = no
							scope:secondary_actor = { is_ai = no }
						}
					}
				}
				random = {
					chance = 25
					ai_value_modifier = {
						who = scope:secondary_actor
						ai_sociability = 0.5
						max = 25
					}
					ai_value_modifier = {
						who = scope:secondary_recipient
						ai_sociability = 0.5
						max = 25
					}
					min = 0
					save_scope_value_as = {
						name = can_become_friends
						value = yes
					}
				}
			}
		}
		else_if = {
			limit = {
				NOR = {
					exists = scope:secondary_actor_is_charmed
					exists = scope:secondary_recipient_is_charmed
				}
			}
			# become rivals?
			if = {
				limit = {
					scope:secondary_actor = {
						OR = {
							can_set_relation_rival_trigger = { CHARACTER = scope:secondary_recipient }
							can_set_relation_potential_rival_trigger = { CHARACTER = scope:secondary_recipient }
						}
						OR = {
							num_of_relation_rival < 3
							is_ai = no
							scope:secondary_recipient = { is_ai = no }
						}
					}
					scope:secondary_recipient = {
						OR = {
							can_set_relation_rival_trigger = { CHARACTER = scope:secondary_actor }
							can_set_relation_potential_rival_trigger = { CHARACTER = scope:secondary_actor }
						}
						OR = {
							num_of_relation_rival < 3
							is_ai = no
							scope:secondary_actor = { is_ai = no }
						}
					}
				}
				random = {
					chance = 25
					ai_value_modifier = {
						who = scope:secondary_actor
						ai_rationality = -0.5
						max = 25
					}
					ai_value_modifier = {
						who = scope:secondary_recipient
						ai_rationality = -0.5
						max = 25
					}
					min = 0
					save_scope_value_as = {
						name = can_become_rivals
						value = yes
					}
				}
			}
		}

		scope:actor = {
			if = {
				limit = {
					exists = scope:secondary_actor_is_charmed
					exists = scope:secondary_recipient_is_charmed
				}
				trigger_event = lmf_interaction.1326
			}
			else = {
				trigger_event = lmf_interaction.1328
			}
		}
	}
}

# Introduction is successful on both sides - to Actor
lmf_interaction.1326 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_interaction.1326.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:secondary_actor = root }
				desc = {
					desc = lmf_interaction.1326.desc.start.actor
					first_valid = {
						triggered_desc = {
							trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
							desc = lmf_interaction.1326.desc.start.actor.hunting
						}
						triggered_desc = {
							trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
							desc = lmf_interaction.1326.desc.start.actor.hike
						}
						triggered_desc = {
							trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
							desc = lmf_interaction.1326.desc.start.actor.garrison
						}
						triggered_desc = {
							trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
							desc = lmf_interaction.1326.desc.start.actor.poetry
						}
						triggered_desc = {
							trigger = { scope:secondary_actor.var:intro_activity = flag:library }
							desc = lmf_interaction.1326.desc.start.actor.library
						}
						triggered_desc = {
							trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
							desc = lmf_interaction.1326.desc.start.actor.poor
						}
						triggered_desc = {
							trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
							desc = lmf_interaction.1326.desc.start.actor.tour
						}
						desc = lmf_interaction.1326.desc.start.actor.garden
					}
					first_valid = {
						triggered_desc = {
							trigger = { exists = scope:hated_activity }
							desc = lmf_interaction.1326.desc.start.actor.hated
						}
						triggered_desc = {
							trigger = { exists = scope:loved_activity }
							desc = lmf_interaction.1326.desc.start.actor.loved
						}
						desc = lmf_interaction.1326.desc.start.actor.neutral
					}
					desc = lmf_interaction.1326.desc.start.actor.mid
					triggered_desc = {
						trigger = { exists = scope:can_become_lovers }
						desc = lmf_interaction.1326.desc.actor.lover
					}
					triggered_desc = {
						trigger = { exists = scope:can_become_friends }
						desc = lmf_interaction.1326.desc.actor.friends
					}
					desc = lmf_interaction.1326.desc.actor.end
				}
			}
			desc = {
				desc = lmf_interaction.1326.desc.start
				first_valid = {
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
						desc = lmf_interaction.1326.desc.hunting
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
						desc = lmf_interaction.1326.desc.hike
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
						desc = lmf_interaction.1326.desc.garrison
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:seduction }
						desc = lmf_interaction.1326.desc.seduction
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
						desc = lmf_interaction.1326.desc.poetry
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:library }
						desc = lmf_interaction.1326.desc.library
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:church }
						desc = lmf_interaction.1326.desc.church
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:tavern }
						desc = lmf_interaction.1326.desc.tavern
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
						desc = lmf_interaction.1326.desc.poor
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
						desc = lmf_interaction.1326.desc.tour
					}
					desc = lmf_interaction.1326.desc.garden
				}
				first_valid = {
					triggered_desc = {
						trigger = { exists = scope:hated_activity }
						desc = lmf_interaction.1326.desc.hated
					}
					triggered_desc = {
						trigger = { exists = scope:loved_activity }
						desc = lmf_interaction.1326.desc.loved
					}
					desc = lmf_interaction.1326.desc.neutral
				}
				desc = lmf_interaction.1326.desc.mid
				first_valid = {
					triggered_desc = {
						trigger = {
							scope:secondary_recipient = { is_ai = no }
						}
						desc = lmf_interaction.1326.desc.secrec.player
					}
					desc = lmf_interaction.1326.desc.end
				}
			}
		}
	}
	theme = family

	left_portrait = {
		character = scope:proposer_target
		animation = happiness
		triggered_outfit = {
			trigger = {
				OR = {
					scope:secondary_actor.var:intro_activity = flag:hunting
					scope:secondary_actor.var:intro_activity = flag:hike
					scope:secondary_actor.var:intro_activity = flag:poor
					scope:secondary_actor.var:intro_activity = flag:tavern
				}
			}
			outfit_tags = { travel_cloak }
		}
	}
	right_portrait = {
		character = scope:proposer
		animation = flirtation_left
		triggered_outfit = {
			trigger = {
				OR = {
					scope:secondary_actor.var:intro_activity = flag:hunting
					scope:secondary_actor.var:intro_activity = flag:hike
					scope:secondary_actor.var:intro_activity = flag:poor
					scope:secondary_actor.var:intro_activity = flag:tavern
				}
			}
			outfit_tags = { travel_cloak }
		}
	}

	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
		reference = wilderness_forest
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
		reference = terrain_scope
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
		reference = armory
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:seduction }
		reference = corridor_day
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
		reference = garden
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:library }
		reference = study
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:church }
		reference = temple
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:tavern }
		reference = tavern
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
		reference = market
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
		reference = courtyard
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:garden }
		reference = garden
	}

	immediate = {
		# scopes for portrait animations
		capital_province = { save_scope_as = background_terrain_scope }
		if = {
			limit = {
				scope:secondary_recipient = { is_male = yes }
			}
			scope:secondary_recipient = { save_scope_as = proposer }
			scope:secondary_actor = { save_scope_as = proposer_target }
		}
		else = {
			scope:secondary_actor = { save_scope_as = proposer }
			scope:secondary_recipient = { save_scope_as = proposer_target }
		}
		if = {
			limit = { scope:secondary_actor.var:intro_activity = flag:garrison }
			scope:secondary_actor = { add_character_flag = wear_armor }
		}
		scope:secondary_actor = {
			add_opinion = {
				target = scope:secondary_recipient
				modifier = successful_marriage_introduction
			}
			reverse_add_opinion = {
				target = scope:secondary_recipient
				modifier = successful_marriage_introduction
			}
		}
	}

	option = {
		name = {
			trigger = {
				scope:secondary_actor = root
				NOR = {
					exists = scope:can_become_lovers
					exists = scope:can_become_friends
				}
			}
			text = lmf_interaction.1326.a #Yes, I have found my match
		}
		name = {
			trigger = {
				scope:secondary_actor = root
				exists = scope:can_become_lovers
			}
			text = lmf_interaction.1326.b #I have no need for another lover, only a wife
		}
		name = {
			trigger = {
				scope:secondary_actor = root
				exists = scope:can_become_friends
			}
			text = lmf_interaction.1326.c #We shall marry, but I do not need another friend
		}
		name = {
			trigger = {
				NOT = { scope:secondary_actor = root }
			}
			text = lmf_interaction.1326.d #Proceed with the marriage!
		}

		if = {
			limit = {
				scope:recipient ?= {
					is_ai = no
					NOT = { this = root }
				}
			}
			custom_tooltip = agree_to_marriage_intro_ask_rec.tt
			scope:recipient = { trigger_event = lmf_interaction.1327 }
		}
		else = {
			proceed_with_wedding_effect = yes
		}
		ai_chance = {
			base = 5
		}
	}
	option = {
		trigger = {
			scope:secondary_actor = root
			OR = {
				exists = scope:can_become_lovers
				exists = scope:can_become_friends
			}
		}
		name = {
			trigger = { exists = scope:can_become_lovers }
			text = lmf_interaction.1326.e # We shall marry and she shall be my lover
		}
		name = {
			trigger = { exists = scope:can_become_friends }
			text = lmf_interaction.1326.f # Yes, she shall be my wife and friend
		}

		if = {
			limit = {
				scope:recipient ?= {
					is_ai = no
					NOT = { this = root }
				}
			}
			custom_tooltip = agree_to_marriage_intro_ask_rec.tt
			if = {
				limit = { exists = scope:can_become_lovers }
				show_as_tooltip = {
					set_relation_lover = { reason = attraction_at_introduction target = scope:secondary_recipient }
				}
			}
			else = {
				show_as_tooltip = {
					set_relation_friend = { reason = friends_at_introduction target = scope:secondary_recipient }
				}
			}
			scope:recipient = { trigger_event = lmf_interaction.1327 }
		}
		else = {
			if = {
				limit = { exists = scope:can_become_lovers }
				set_relation_lover = { reason = attraction_at_introduction target = scope:secondary_recipient }
			}
			else = {
				set_relation_friend = { reason = friends_at_introduction target = scope:secondary_recipient }
			}
			proceed_with_wedding_effect = yes
		}

		ai_chance = {
			base = 100
		}
	}
	option = {
		name = lmf_interaction.1326.g # I've changed my mind. Call this off.
		if = {
			limit = {
				scope:recipient ?= {
					is_ai = no
					NOT = { this = root }
				}
			}
			custom_tooltip = refuse_marriage_intro_send_rec.tt
			scope:recipient = {
				send_interface_message = {
					type = event_generic_bad_with_text
					title = lmf_interaction_no_marriage.tt
					desc = lmf_interaction_no_marriage.success.actor.tt
					left_icon = scope:secondary_recipient
					right_icon = scope:secondary_actor
				}
			}
		}
		else = {
			custom_tooltip = refuse_marriage_intro.tt
		}

		scope:actor = {
			if = {
				limit = { has_variable = grand_wedding_promise_pending }
				remove_variable = grand_wedding_promise_pending
			}
		}

		# If we're a clan this interaction affects unity
		add_clan_unity_interaction_effect = {
			CHARACTER = scope:actor
			TARGET = scope:recipient
			VALUE = medium_unity_loss
			DESC = clan_unity_marry_off_decline.desc
			REVERSE_NON_HOUSE_TARGET = no
		}

		if = {
			limit = { exists = global_var:travel_the_distance_is_loaded }
			ttd_marriage_proposal_clean_up_effect = yes
		}

		hidden_effect = {
			marriage_proposal_refused_effect = yes
			# do they become lovers anyhow?
			if = {
				limit = {
					exists = scope:can_become_lovers
					scope:secondary_recipient = {
						is_ai = yes
						might_cheat_on_every_partner_trigger = yes
						willing_to_take_character_as_lover = { LOVER = scope:secondary_actor }
					}
					scope:secondary_actor = {
						is_ai = yes
						might_cheat_on_every_partner_trigger = yes
						willing_to_take_character_as_lover = { LOVER = scope:secondary_recipient }
					}
				}
				random = {
					chance = 50
					scope:secondary_recipient = {
						set_relation_lover = { reason = attraction_at_introduction target = scope:secondary_actor }
					}
				}
			}
			# or do they become friends anyhow?
			else_if = {
				limit = {
					exists = scope:can_become_friends
					scope:secondary_recipient = { is_ai = yes }
					scope:secondary_actor = { is_ai = yes }
				}
				random = {
					chance = 50
					scope:secondary_recipient = {
						set_relation_friend = { reason = friends_at_introduction target = scope:secondary_actor }
					}
				}
			}
		}

		ai_chance = {
			base = 0
		}
	}

	after = {
		scope:secondary_actor = {
			if = {
				limit = { has_character_flag = wear_armor }
				remove_character_flag = wear_armor
			}
		}
	}
}

# Introduction is successful on both sides - to Recipient
lmf_interaction.1327 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_interaction.1326.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:secondary_recipient = root }
				desc = {
					desc = lmf_interaction.1327.desc.start.secrec
					first_valid = {
						triggered_desc = {
							trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
							desc = lmf_interaction.1327.desc.hunting.secrec
						}
						triggered_desc = {
							trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
							desc = lmf_interaction.1327.desc.hike.secrec
						}
						triggered_desc = {
							trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
							desc = lmf_interaction.1327.desc.garrison.secrec
						}
						triggered_desc = {
							trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
							desc = lmf_interaction.1327.desc.poetry.secrec
						}
						triggered_desc = {
							trigger = { scope:secondary_actor.var:intro_activity = flag:library }
							desc = lmf_interaction.1327.desc.library.secrec
						}
						triggered_desc = {
							trigger = { scope:secondary_actor.var:intro_activity = flag:church }
							desc = lmf_interaction.1327.desc.church.secrec
						}
						triggered_desc = {
							trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
							desc = lmf_interaction.1327.desc.poor.secrec
						}
						triggered_desc = {
							trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
							desc = lmf_interaction.1327.desc.tour.secrec
						}
						desc = lmf_interaction.1327.desc.garden.secrec
					}
					desc = lmf_interaction.1327.desc.mid.secrec
					triggered_desc = {
						trigger = { exists = scope:can_become_lovers }
						desc = lmf_interaction.1327.desc.secrec.lover
					}
					triggered_desc = {
						trigger = { exists = scope:can_become_friends }
						desc = lmf_interaction.1327.desc.secrec.friends
					}
					desc = lmf_interaction.1327.desc.secrec.end
				}
			}
			desc = {
				desc = lmf_interaction.1327.desc.start
				first_valid = {
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
						desc = lmf_interaction.1327.desc.hunting
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
						desc = lmf_interaction.1327.desc.hike
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
						desc = lmf_interaction.1327.desc.garrison
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:seduction }
						desc = lmf_interaction.1327.desc.seduction
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
						desc = lmf_interaction.1327.desc.poetry
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:library }
						desc = lmf_interaction.1327.desc.library
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:church }
						desc = lmf_interaction.1327.desc.church
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:tavern }
						desc = lmf_interaction.1327.desc.tavern
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
						desc = lmf_interaction.1327.desc.poor
					}
					triggered_desc = {
						trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
						desc = lmf_interaction.1327.desc.tour
					}
					desc = lmf_interaction.1327.desc.garden
				}
				first_valid = {
					triggered_desc = {
						trigger = { exists = scope:hated_activity }
						desc = lmf_interaction.1327.desc.hated
					}
					triggered_desc = {
						trigger = { exists = scope:loved_activity }
						desc = lmf_interaction.1327.desc.loved
					}
					desc = lmf_interaction.1327.desc.neutral
				}
				desc = lmf_interaction.1327.desc.end
			}
		}
	}
	theme = family

	left_portrait = {
		character = scope:proposer_target
		animation = happiness
		triggered_outfit = {
			trigger = {
				OR = {
					scope:secondary_actor.var:intro_activity = flag:hunting
					scope:secondary_actor.var:intro_activity = flag:hike
					scope:secondary_actor.var:intro_activity = flag:poor
					scope:secondary_actor.var:intro_activity = flag:tavern
				}
			}
			outfit_tags = { travel_cloak }
		}
	}
	right_portrait = {
		character = scope:proposer
		animation = throne_room_bow_3
		triggered_outfit = {
			trigger = {
				OR = {
					scope:secondary_actor.var:intro_activity = flag:hunting
					scope:secondary_actor.var:intro_activity = flag:hike
					scope:secondary_actor.var:intro_activity = flag:poor
					scope:secondary_actor.var:intro_activity = flag:tavern
				}
			}
			outfit_tags = { travel_cloak }
		}
	}

	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
		reference = wilderness_forest
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
		reference = terrain_scope
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
		reference = army_camp
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:seduction }
		reference = corridor_day
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
		reference = garden
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:library }
		reference = study
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:church }
		reference = temple
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:tavern }
		reference = tavern
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
		reference = market
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
		reference = courtyard
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:garden }
		reference = garden
	}

	immediate = {
		scope:actor.capital_province = { save_scope_as = background_terrain_scope }
		scope:secondary_recipient = { save_scope_as = bg_override_char }
		if = {
			limit = { scope:secondary_actor.var:intro_activity = flag:garrison }
			scope:secondary_actor = { add_character_flag = wear_armor }
		}
	}

	option = {
		name = {
			trigger = {
				scope:secondary_recipient = root
				NOR = {
					exists = scope:can_become_lovers
					exists = scope:can_become_friends
				}
			}
			text = lmf_interaction.1326.a #Yes, I have found my match
		}
		name = {
			trigger = {
				scope:secondary_recipient = root
				exists = scope:can_become_lovers
			}
			text = lmf_interaction.1327.b #I have no need for another lover, only a wife
		}
		name = {
			trigger = {
				scope:secondary_recipient = root
				exists = scope:can_become_friends
			}
			text = lmf_interaction.1326.c #We shall marry, but I do not need another friend
		}
		name = {
			trigger = {
				NOT = { scope:secondary_recipient = root }
			}
			text = lmf_interaction.1326.d #Proceed with the marriage!
		}
		proceed_with_wedding_effect = yes
		ai_chance = {
			base = 5
		}
	}
	option = {
		trigger = {
			scope:secondary_recipient = root
			OR = {
				exists = scope:can_become_lovers
				exists = scope:can_become_friends
			}
		}
		name = {
			trigger = { exists = scope:can_become_lovers }
			text = lmf_interaction.1327.e # We shall marry and she shall be my lover
		}
		name = {
			trigger = { exists = scope:can_become_friends }
			text = lmf_interaction.1327.f # Yes, she shall be my wife and friend
		}

		if = {
			limit = { exists = scope:can_become_lovers }
			set_relation_lover = { reason = attraction_at_introduction target = scope:secondary_actor }
		}
		else = {
			set_relation_friend = { reason = friends_at_introduction target = scope:secondary_actor }
		}
		proceed_with_wedding_effect = yes
		ai_chance = {
			base = 100
		}
	}
	option = {
		name = lmf_interaction.1326.g # I've changed my mind. Call this off.
		if = {
			limit = {
				scope:actor = {
					is_ai = no
					NOT = { this = root }
				}
			}
			custom_tooltip = refuse_marriage_intro_send_act.tt
			scope:actor = {
				send_interface_message = {
					type = event_generic_bad_with_text
					title = lmf_interaction_no_marriage.tt
					desc = lmf_interaction_no_marriage.success.rec.tt
					left_icon = scope:secondary_recipient
					right_icon = scope:secondary_actor
				}
			}
		}
		else = {
			custom_tooltip = refuse_marriage_intro.tt
		}

		scope:actor = {
			if = {
				limit = { has_variable = grand_wedding_promise_pending }
				remove_variable = grand_wedding_promise_pending
			}
		}

		# If we're a clan this interaction affects unity
		add_clan_unity_interaction_effect = {
			CHARACTER = scope:actor
			TARGET = scope:recipient
			VALUE = medium_unity_loss
			DESC = clan_unity_marry_off_decline.desc
			REVERSE_NON_HOUSE_TARGET = no
		}

		if = {
			limit = { exists = global_var:travel_the_distance_is_loaded }
			ttd_marriage_proposal_clean_up_effect = yes
		}

		hidden_effect = {
			marriage_proposal_refused_effect = yes
			# do they become lovers anyhow?
			if = {
				limit = {
					exists = scope:can_become_lovers
					scope:secondary_recipient = {
						is_ai = yes
						might_cheat_on_every_partner_trigger = yes
						willing_to_take_character_as_lover = { LOVER = scope:secondary_actor }
					}
					scope:secondary_actor = {
						is_ai = yes
						might_cheat_on_every_partner_trigger = yes
						willing_to_take_character_as_lover = { LOVER = scope:secondary_recipient }
					}
				}
				random = {
					chance = 50
					scope:secondary_recipient = {
						set_relation_lover = { reason = attraction_at_introduction target = scope:secondary_actor }
					}
				}
			}
			# or do they become friends anyhow?
			else_if = {
				limit = {
					exists = scope:can_become_friends
					scope:secondary_recipient = { is_ai = yes }
					scope:secondary_actor = { is_ai = yes }
				}
				random = {
					chance = 50
					scope:secondary_recipient = {
						set_relation_friend = { reason = friends_at_introduction target = scope:secondary_actor }
					}
				}
			}
		}

		ai_chance = {
			base = 0
		}
	}

	after = {
		scope:secondary_actor = {
			if = {
				limit = { has_character_flag = wear_armor }
				remove_character_flag = wear_armor
			}
		}
	}
}

# Introduction is unsuccessful - to Actor
lmf_interaction.1328 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_interaction.1328.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:secondary_actor = root }
				desc = {
					desc = lmf_interaction.1328.desc.secact.actor.start
					first_valid = {
						triggered_desc = {
							trigger = { exists = scope:secondary_actor_is_charmed }
							desc = {
								first_valid = {
									triggered_desc = {
										trigger = { exists = scope:hated_activity }
										desc = lmf_interaction.1328.desc.secact.secact.hated
									}
									triggered_desc = {
										trigger = { exists = scope:loved_activity }
										desc = lmf_interaction.1328.desc.secact.secact.loved
									}
									desc = lmf_interaction.1328.desc.secact.secact.neutral
								}
								first_valid = {
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
										desc = lmf_interaction.1328.desc.secact.secact.hunting
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
										desc = lmf_interaction.1328.desc.secact.secact.hike
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
										desc = lmf_interaction.1328.desc.secact.secact.garrison
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
										desc = lmf_interaction.1328.desc.secact.secact.poetry
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:library }
										desc = lmf_interaction.1328.desc.secact.secact.library
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:church }
										desc = lmf_interaction.1328.desc.secact.secact.church
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
										desc = lmf_interaction.1328.desc.secact.secact.poor
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
										desc = lmf_interaction.1328.desc.secact.secact.tour
									}
									desc = lmf_interaction.1328.desc.secact.secact.garden
								}
								desc = lmf_interaction.1328.desc.secact.secact.mid
							}
						}
						triggered_desc = {
							trigger = { exists = scope:secondary_recipient_is_charmed }
							desc = {
								first_valid = {
									triggered_desc = {
										trigger = { exists = scope:hated_activity }
										desc = lmf_interaction.1328.desc.secact.secrec.hated
									}
									triggered_desc = {
										trigger = { exists = scope:loved_activity }
										desc = lmf_interaction.1328.desc.secact.secrec.loved
									}
									desc = lmf_interaction.1328.desc.secact.secrec.neutral
								}
								first_valid = {
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
										desc = lmf_interaction.1328.desc.secact.secrec.hunting
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
										desc = lmf_interaction.1328.desc.secact.secrec.hike
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
										desc = lmf_interaction.1328.desc.secact.secrec.garrison
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
										desc = lmf_interaction.1328.desc.secact.secrec.poetry
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:library }
										desc = lmf_interaction.1328.desc.secact.secrec.library
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:church }
										desc = lmf_interaction.1328.desc.secact.secrec.church
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
										desc = lmf_interaction.1328.desc.secact.secrec.poor
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
										desc = lmf_interaction.1328.desc.secact.secrec.tour
									}
									desc = lmf_interaction.1328.desc.secact.secrec.garden
								}
								desc = lmf_interaction.1328.desc.secact.secrec.mid
							}
						}
						desc = {
							first_valid = {
								triggered_desc = {
									trigger = { exists = scope:hated_activity }
									desc = lmf_interaction.1328.desc.secact.both.hated
								}
								triggered_desc = {
									trigger = { exists = scope:loved_activity }
									desc = lmf_interaction.1328.desc.secact.both.loved
								}
								desc = lmf_interaction.1328.desc.secact.both.neutral
							}
							first_valid = {
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
									desc = lmf_interaction.1328.desc.secact.both.hunting
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
									desc = lmf_interaction.1328.desc.secact.both.hike
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
									desc = lmf_interaction.1328.desc.secact.both.garrison
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
									desc = lmf_interaction.1328.desc.secact.both.poetry
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:library }
									desc = lmf_interaction.1328.desc.secact.both.library
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:church }
									desc = lmf_interaction.1328.desc.secact.both.church
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
									desc = lmf_interaction.1328.desc.secact.both.poor
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
									desc = lmf_interaction.1328.desc.secact.both.tour
								}
								desc = lmf_interaction.1328.desc.secact.both.garden
							}
							desc = lmf_interaction.1328.desc.secact.both.mid
						}
					}
					triggered_desc = {
						trigger = { exists = scope:can_become_rivals }
						desc = lmf_interaction.1328.desc.rival.actor
					}
					desc = lmf_interaction.1328.desc.end.actor
				}
			}
			desc = {
				desc = lmf_interaction.1328.desc.start
				first_valid = {
					triggered_desc = {
						trigger = { exists = scope:secondary_actor_is_charmed }
						desc = {
							desc = lmf_interaction.1328.desc.secrec.start
							first_valid = {
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
									desc = lmf_interaction.1328.desc.secrec.hunting
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
									desc = lmf_interaction.1328.desc.secrec.hike
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
									desc = lmf_interaction.1328.desc.secrec.garrison
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:seduction }
									desc = lmf_interaction.1328.desc.secrec.seduction
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
									desc = lmf_interaction.1328.desc.secrec.poetry
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:library }
									desc = lmf_interaction.1328.desc.secrec.library
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:church }
									desc = lmf_interaction.1328.desc.secrec.church
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:tavern }
									desc = lmf_interaction.1328.desc.secrec.tavern
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
									desc = lmf_interaction.1328.desc.secrec.poor
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
									desc = lmf_interaction.1328.desc.secrec.tour
								}
								desc = lmf_interaction.1328.desc.secrec.garden
							}
							first_valid = {
								triggered_desc = {
									trigger = { exists = scope:hated_activity }
									desc = lmf_interaction.1328.desc.secrec.hated
								}
								triggered_desc = {
									trigger = { exists = scope:loved_activity }
									desc = lmf_interaction.1328.desc.secrec.loved
								}
								desc = lmf_interaction.1328.desc.secrec.neutral
							}
						}
					}
					triggered_desc = {
						trigger = { exists = scope:secondary_recipient_is_charmed }
						desc = {
							desc = lmf_interaction.1328.desc.secact.start
							first_valid = {
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
									desc = lmf_interaction.1328.desc.secact.hunting
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
									desc = lmf_interaction.1328.desc.secact.hike
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
									desc = lmf_interaction.1328.desc.secact.garrison
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:seduction }
									desc = lmf_interaction.1328.desc.secact.seduction
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
									desc = lmf_interaction.1328.desc.secact.poetry
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:library }
									desc = lmf_interaction.1328.desc.secact.library
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:church }
									desc = lmf_interaction.1328.desc.secact.church
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:tavern }
									desc = lmf_interaction.1328.desc.secact.tavern
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
									desc = lmf_interaction.1328.desc.secact.poor
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
									desc = lmf_interaction.1328.desc.secact.tour
								}
								desc = lmf_interaction.1328.desc.secact.garden
							}
							first_valid = {
								triggered_desc = {
									trigger = { exists = scope:hated_activity }
									desc = lmf_interaction.1328.desc.secact.hated
								}
								triggered_desc = {
									trigger = { exists = scope:loved_activity }
									desc = lmf_interaction.1328.desc.secact.loved
								}
								desc = lmf_interaction.1328.desc.secact.neutral
							}
						}
					}
					desc = {
						desc = lmf_interaction.1328.desc.both.start
						first_valid = {
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
								desc = lmf_interaction.1328.desc.both.hunting
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
								desc = lmf_interaction.1328.desc.both.hike
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
								desc = lmf_interaction.1328.desc.both.garrison
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:seduction }
								desc = lmf_interaction.1328.desc.both.seduction
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
								desc = lmf_interaction.1328.desc.both.poetry
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:library }
								desc = lmf_interaction.1328.desc.both.library
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:church }
								desc = lmf_interaction.1328.desc.both.church
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:tavern }
								desc = lmf_interaction.1328.desc.both.tavern
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
								desc = lmf_interaction.1328.desc.both.poor
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
								desc = lmf_interaction.1328.desc.both.tour
							}
							desc = lmf_interaction.1328.desc.both.garden
						}
						desc = lmf_interaction.1328.desc.both.mid
					}
				}
				triggered_desc = {
					trigger = { exists = scope:can_become_rivals }
					desc = lmf_interaction.1328.desc.rival
				}
				desc = lmf_interaction.1328.desc.end
			}
		}
	}
	theme = family

	left_portrait = {
		character = scope:secondary_actor
		triggered_animation = {
			trigger = { exists = scope:secondary_actor_is_charmed }
			animation = shock
		}
		animation = eyeroll
		triggered_outfit = {
			trigger = {
				OR = {
					scope:secondary_actor.var:intro_activity = flag:hunting
					scope:secondary_actor.var:intro_activity = flag:hike
					scope:secondary_actor.var:intro_activity = flag:poor
					scope:secondary_actor.var:intro_activity = flag:tavern
				}
			}
			outfit_tags = { travel_cloak }
		}
	}
	right_portrait = {
		character = scope:secondary_recipient
		triggered_animation = {
			trigger = { exists = scope:secondary_recipient_is_charmed }
			animation = shock
		}
		animation = dismissal
		triggered_outfit = {
			trigger = {
				OR = {
					scope:secondary_actor.var:intro_activity = flag:hunting
					scope:secondary_actor.var:intro_activity = flag:hike
					scope:secondary_actor.var:intro_activity = flag:poor
					scope:secondary_actor.var:intro_activity = flag:tavern
				}
			}
			outfit_tags = { travel_cloak }
		}
	}

	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
		reference = wilderness_forest
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
		reference = terrain_scope
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
		reference = army_camp
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:seduction }
		reference = corridor_day
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
		reference = garden
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:library }
		reference = study
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:church }
		reference = temple
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:tavern }
		reference = tavern
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
		reference = market
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
		reference = courtyard
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:garden }
		reference = garden
	}

	immediate = {
		capital_province = { save_scope_as = background_terrain_scope }
		scope:secondary_actor = {
			add_opinion = {
				target = scope:secondary_recipient
				modifier = failed_marriage_introduction
			}
			reverse_add_opinion = {
				target = scope:secondary_recipient
				modifier = failed_marriage_introduction
			}
		}
		if = {
			limit = { scope:secondary_actor.var:intro_activity = flag:garrison }
			scope:secondary_actor = { add_character_flag = wear_armor }
		}
	}

	option = {
		name = lmf_interaction.1328.a #proceed anyhow
		trigger = {
			OR = {
				NOT = { scope:secondary_recipient = scope:recipient }
				exists = scope:secondary_recipient_is_charmed
			}
		}

		# check if you're overriding the secondary actor's will not wed trait
		if = {
			limit = {
				scope:secondary_actor = {
					has_trait = will_not_wed
					NOT = { this = root }
				}
			}
			custom_tooltip = lmf_secondary_actor_may_rebel_tt
			save_scope_value_as = {
				name = secondary_actor_might_rebel
				value = yes
			}
			scope:secondary_actor = {
				remove_trait_force_tooltip = will_not_wed
				hidden_effect = {
					random_owned_story = {
						type = lmf_will_not_wed_story_cycle
						end_story = yes
					}
				}
				if = {
					limit = {
						can_set_relation_rival_trigger = { CHARACTER = root }
					}
					set_relation_rival = {
						reason = overrode_marriage_wishes
						target = root
					}
				}
				add_opinion = {
					target = root
					modifier = hate_opinion
					opinion = -40
				}
				add_opinion = {
					target = root
					modifier = refused_marry_for_love_opinion
				}
				if = {
					limit = {
						has_opinion_modifier = { target = root modifier = allowed_marry_for_love_opinion }
					}
					remove_opinion = { target = root modifier = allowed_marry_for_love_opinion }
				}
			}
		}
		# then check if you're forcing them to marry someone they don't like
		else_if = {
			limit = {
				NOR = {
					exists = scope:secondary_actor_is_charmed
					scope:secondary_actor = root
				}
			}
			worsen_relationship_effect = {
				TARGET = scope:secondary_actor
				REASON = married_to_someone_I_dislike
			}
			reverse_add_opinion = {
				target = scope:secondary_actor
				modifier = angry_opinion
				opinion = -20
			}
			reverse_add_opinion = {
				target = scope:secondary_actor
				modifier = refused_marry_for_love_opinion
			}
		}

		# check if you're overriding the secondary recipient's will not wed trait
		if = {
			limit = {
				scope:secondary_recipient = {
					is_courtier_of = root
					has_trait = will_not_wed
					NOT = { this = root }
				}
			}
			custom_tooltip = lmf_secondary_recipient_may_rebel_tt
			save_scope_value_as = {
				name = secondary_recipient_might_rebel
				value = yes
			}
			scope:secondary_recipient = {
				remove_trait_force_tooltip = will_not_wed
				hidden_effect = {
					random_owned_story = {
						type = lmf_will_not_wed_story_cycle
						end_story = yes
					}
				}
				if = {
					limit = {
						can_set_relation_rival_trigger = { CHARACTER = root }
					}
					set_relation_rival = {
						reason = overrode_marriage_wishes
						target = root
					}
				}
				add_opinion = {
					target = root
					modifier = hate_opinion
					opinion = -40
				}
				add_opinion = {
					target = root
					modifier = refused_marry_for_love_opinion
				}
				if = {
					limit = {
						has_opinion_modifier = { target = root modifier = allowed_marry_for_love_opinion }
					}
					remove_opinion = { target = root modifier = allowed_marry_for_love_opinion }
				}
			}
		}
		# then check if you're forcing them to marry someone they don't like
		else_if = {
			limit = {
				scope:secondary_recipient = { is_courtier_of = root }
				NOR = {
					exists = scope:secondary_recipient_is_charmed
					scope:secondary_recipient = root
				}
			}
			worsen_relationship_effect = {
				TARGET = scope:secondary_recipient
				REASON = married_to_someone_I_dislike
			}
			reverse_add_opinion = {
				target = scope:secondary_recipient
				modifier = angry_opinion
				opinion = -20
			}
			reverse_add_opinion = {
				target = scope:secondary_actor
				modifier = refused_marry_for_love_opinion
			}
		}

		if = {
			limit = {
				exists = scope:recipient
				NOR = {
					scope:recipient = root
					scope:secondary_recipient = root
					scope:secondary_recipient = { is_courtier_of = root }
				}
			}
			custom_tooltip = force_marriage_intro_ask_rec.tt
			save_scope_value_as = { name = marry_anyhow value = yes }
			scope:recipient = { trigger_event = lmf_interaction.1329 }
		}
		else = {
			proceed_with_wedding_effect = yes
		}

		ai_chance = {
			base = 0
			modifier = {
				add = 100
				exists = scope:secondary_actor_is_charmed
				NOT = {
					scope:secondary_recipient = { is_courtier_of = root }
				}
				OR = {
					scope:secondary_recipient = { is_ai = no }
					scope:recipient ?= { is_ai = no }
				}
			}
		}
	}
	option = {
		name = {
			trigger = {
				OR = {
					NOT = { scope:secondary_recipient = scope:recipient }
					exists = scope:secondary_recipient_is_charmed
				}
			}
			text = lmf_interaction.1328.b #so much for that
		}
		name = {
			trigger = {
				scope:secondary_recipient = scope:recipient
				NOT = { exists = scope:secondary_recipient_is_charmed }
			}
			text = lmf_interaction.1328.c #they've put an end to it
		}
		if = {
			limit = {
				NOR = {
					scope:recipient = root
					scope:secondary_recipient = root
					scope:secondary_recipient = { is_courtier_of = root }
				}
			}
			if = {
				limit = {
					scope:secondary_recipient = scope:recipient
					NOT = { exists = scope:secondary_recipient_is_charmed }
				}
				custom_tooltip = refuse_marriage_intro_fail_rec.tt
			}
			else = {
				custom_tooltip = refuse_marriage_intro_send_rec.tt
			}
			scope:recipient = { trigger_event = lmf_interaction.1329 }
		}
		else = {
			custom_tooltip = refuse_marriage_intro.tt
		}

		scope:actor = {
			if = {
				limit = { has_variable = grand_wedding_promise_pending }
				remove_variable = grand_wedding_promise_pending
			}
		}

		# If we're a clan this interaction affects unity
		add_clan_unity_interaction_effect = {
			CHARACTER = scope:actor
			TARGET = scope:recipient
			VALUE = medium_unity_loss
			DESC = clan_unity_marry_off_decline.desc
			REVERSE_NON_HOUSE_TARGET = no
		}

		if = {
			limit = { exists = global_var:travel_the_distance_is_loaded }
			ttd_marriage_proposal_clean_up_effect = yes
		}

		hidden_effect = {
			marriage_proposal_refused_effect = yes
			# do they become rivals anyhow?
			if = {
				limit = {
					exists = scope:can_become_rivals
					scope:secondary_recipient = {
						is_ai = yes
						can_set_relation_rival_trigger = { CHARACTER = scope:secondary_actor }
					}
					scope:secondary_actor = {
						is_ai = yes
						can_set_relation_rival_trigger = { CHARACTER = scope:secondary_recipient }
					}
				}
				random = {
					chance = 25
					scope:secondary_recipient = {
						set_relation_rival = { reason = became_enemies_at_introduction target = scope:secondary_actor }
					}
				}
			}
		}

		ai_chance = {
			base = 100
			modifier = {
				add = -100
				exists = scope:secondary_actor_is_charmed
				NOT = {
					scope:secondary_recipient = { is_courtier_of = root }
				}
				OR = {
					scope:secondary_recipient = { is_ai = no }
					scope:recipient ?= { is_ai = no }
				}
			}
		}
	}

	after = {
		scope:secondary_actor = {
			if = {
				limit = { has_character_flag = wear_armor }
				remove_character_flag = wear_armor
			}
		}
	}
}

# Introduction is unsuccessful - to Recipient
lmf_interaction.1329 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_interaction.1328.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:secondary_recipient = root }
				desc = {
					desc = lmf_interaction.1329.desc.start.secrec
					first_valid = {
						triggered_desc = {
							trigger = { exists = scope:secondary_actor_is_charmed }
							desc = {
								desc = lmf_interaction.1329.desc.secrec.secact.start
								first_valid = {
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
										desc = lmf_interaction.1329.desc.secrec.secact.hunting
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
										desc = lmf_interaction.1329.desc.secrec.secact.hike
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
										desc = lmf_interaction.1329.desc.secrec.secact.garrison
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
										desc = lmf_interaction.1329.desc.secrec.secact.poetry
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:library }
										desc = lmf_interaction.1329.desc.secrec.secact.library
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:church }
										desc = lmf_interaction.1329.desc.secrec.secact.church
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
										desc = lmf_interaction.1329.desc.secrec.secact.poor
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
										desc = lmf_interaction.1329.desc.secrec.secact.tour
									}
									desc = lmf_interaction.1329.desc.secrec.secact.garden
								}
								desc = lmf_interaction.1329.desc.secrec.secact.mid
							}
						}
						triggered_desc = {
							trigger = { exists = scope:secondary_recipient_is_charmed }
							desc = {
								desc = lmf_interaction.1329.desc.secrec.secrec.start
								first_valid = {
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
										desc = lmf_interaction.1329.desc.secrec.secrec.hunting
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
										desc = lmf_interaction.1329.desc.secrec.secrec.hike
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
										desc = lmf_interaction.1329.desc.secrec.secrec.garrison
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
										desc = lmf_interaction.1329.desc.secrec.secrec.poetry
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:library }
										desc = lmf_interaction.1329.desc.secrec.secrec.library
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:church }
										desc = lmf_interaction.1329.desc.secrec.secrec.church
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
										desc = lmf_interaction.1329.desc.secrec.secrec.poor
									}
									triggered_desc = {
										trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
										desc = lmf_interaction.1329.desc.secrec.secrec.tour
									}
									desc = lmf_interaction.1329.desc.secrec.secrec.garden
								}
								desc = lmf_interaction.1329.desc.secrec.secrec.mid
							}
						}
						desc = {
							desc = lmf_interaction.1329.desc.secrec.both.start
							first_valid = {
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
									desc = lmf_interaction.1329.desc.secrec.both.hunting
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
									desc = lmf_interaction.1329.desc.secrec.both.hike
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
									desc = lmf_interaction.1329.desc.secrec.both.garrison
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
									desc = lmf_interaction.1329.desc.secrec.both.poetry
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:library }
									desc = lmf_interaction.1329.desc.secrec.both.library
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:church }
									desc = lmf_interaction.1329.desc.secrec.both.church
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
									desc = lmf_interaction.1329.desc.secrec.both.poor
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
									desc = lmf_interaction.1329.desc.secrec.both.tour
								}
								desc = lmf_interaction.1329.desc.secrec.both.garden
							}
							desc = lmf_interaction.1329.desc.secrec.both.mid
						}
					}
					triggered_desc = {
						trigger = { exists = scope:can_become_rivals }
						desc = lmf_interaction.1329.desc.rival.secrec
					}
					desc = lmf_interaction.1329.desc.end.secrec
					first_valid = {
						triggered_desc = {
							trigger = { exists = scope:marry_anyhow }
							desc = lmf_interaction.1329.desc.end.secrec.marry
						}
						desc = lmf_interaction.1329.desc.end.secrec.nomarry
					}
				}
			}
			desc = {
				desc = lmf_interaction.1329.desc.start
				first_valid = {
					triggered_desc = {
						trigger = { exists = scope:secondary_actor_is_charmed }
						desc = {
							desc = lmf_interaction.1329.desc.secact.start
							first_valid = {
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
									desc = lmf_interaction.1329.desc.secact.hunting
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
									desc = lmf_interaction.1329.desc.secact.hike
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
									desc = lmf_interaction.1329.desc.secact.garrison
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:seduction }
									desc = lmf_interaction.1329.desc.secrec.seduction
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
									desc = lmf_interaction.1329.desc.secact.poetry
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:library }
									desc = lmf_interaction.1329.desc.secact.library
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:church }
									desc = lmf_interaction.1329.desc.secact.church
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:tavern }
									desc = lmf_interaction.1329.desc.secact.tavern
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
									desc = lmf_interaction.1329.desc.secact.poor
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
									desc = lmf_interaction.1329.desc.secact.tour
								}
								desc = lmf_interaction.1329.desc.secact.garden
							}
							first_valid = {
								triggered_desc = {
									trigger = { exists = scope:hated_activity }
									desc = lmf_interaction.1329.desc.secact.hated
								}
								triggered_desc = {
									trigger = { exists = scope:loved_activity }
									desc = lmf_interaction.1329.desc.secact.loved
								}
								desc = lmf_interaction.1329.desc.secact.neutral
							}
						}
					}
					triggered_desc = {
						trigger = { exists = scope:secondary_recipient_is_charmed }
						desc = {
							desc = lmf_interaction.1329.desc.secrec.start
							first_valid = {
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
									desc = lmf_interaction.1329.desc.secrec.hunting
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
									desc = lmf_interaction.1329.desc.secrec.hike
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
									desc = lmf_interaction.1329.desc.secrec.garrison
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:seduction }
									desc = lmf_interaction.1329.desc.secrec.seduction
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
									desc = lmf_interaction.1329.desc.secrec.poetry
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:library }
									desc = lmf_interaction.1329.desc.secrec.library
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:church }
									desc = lmf_interaction.1329.desc.secrec.church
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:tavern }
									desc = lmf_interaction.1329.desc.secrec.tavern
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
									desc = lmf_interaction.1329.desc.secrec.poor
								}
								triggered_desc = {
									trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
									desc = lmf_interaction.1329.desc.secrec.tour
								}
								desc = lmf_interaction.1329.desc.secrec.garden
							}
							first_valid = {
								triggered_desc = {
									trigger = { exists = scope:hated_activity }
									desc = lmf_interaction.1329.desc.secrec.hated
								}
								triggered_desc = {
									trigger = { exists = scope:loved_activity }
									desc = lmf_interaction.1329.desc.secrec.loved
								}
								desc = lmf_interaction.1329.desc.secrec.neutral
							}
						}
					}
					desc = {
						first_valid = {
							triggered_desc = {
								trigger = { exists = scope:hated_activity }
								desc = lmf_interaction.1329.desc.both.hated
							}
							triggered_desc = {
								trigger = { exists = scope:loved_activity }
								desc = lmf_interaction.1329.desc.both.loved
							}
							desc = lmf_interaction.1329.desc.both.neutral
						}
						first_valid = {
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
								desc = lmf_interaction.1329.desc.both.hunting
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
								desc = lmf_interaction.1329.desc.both.hike
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
								desc = lmf_interaction.1329.desc.both.garrison
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:seduction }
								desc = lmf_interaction.1329.desc.both.seduction
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
								desc = lmf_interaction.1329.desc.both.poetry
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:library }
								desc = lmf_interaction.1329.desc.both.library
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:church }
								desc = lmf_interaction.1329.desc.both.church
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:tavern }
								desc = lmf_interaction.1329.desc.both.tavern
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
								desc = lmf_interaction.1329.desc.both.poor
							}
							triggered_desc = {
								trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
								desc = lmf_interaction.1329.desc.both.tour
							}
							desc = lmf_interaction.1329.desc.both.garden
						}
						desc = lmf_interaction.1329.desc.both.mid
					}
				}
				triggered_desc = {
					trigger = { exists = scope:can_become_rivals }
					desc = lmf_interaction.1329.desc.rival
				}
				first_valid = {
					triggered_desc = {
						trigger = { exists = scope:marry_anyhow }
						desc = lmf_interaction.1329.desc.end.marry
					}
					desc = lmf_interaction.1329.desc.end.nomarry
				}
			}
		}
	}
	theme = family

	left_portrait = {
		character = scope:secondary_actor
		triggered_animation = {
			trigger = { exists = scope:secondary_actor_is_charmed }
			animation = shock
		}
		animation = eyeroll
		triggered_outfit = {
			trigger = {
				OR = {
					scope:secondary_actor.var:intro_activity = flag:hunting
					scope:secondary_actor.var:intro_activity = flag:hike
					scope:secondary_actor.var:intro_activity = flag:poor
					scope:secondary_actor.var:intro_activity = flag:tavern
				}
			}
			outfit_tags = { travel_cloak }
		}
	}
	right_portrait = {
		character = scope:secondary_recipient
		triggered_animation = {
			trigger = { exists = scope:secondary_recipient_is_charmed }
			animation = shock
		}
		animation = dismissal
		triggered_outfit = {
			trigger = {
				OR = {
					scope:secondary_actor.var:intro_activity = flag:hunting
					scope:secondary_actor.var:intro_activity = flag:hike
					scope:secondary_actor.var:intro_activity = flag:poor
					scope:secondary_actor.var:intro_activity = flag:tavern
				}
			}
			outfit_tags = { travel_cloak }
		}
	}

	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:hunting }
		reference = wilderness_forest
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:hike }
		reference = terrain_scope
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:garrison }
		reference = army_camp
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:seduction }
		reference = corridor_day
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:poetry }
		reference = garden
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:library }
		reference = study
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:church }
		reference = temple
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:tavern }
		reference = tavern
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:poor }
		reference = market
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:tour }
		reference = courtyard
	}
	override_background = {
		trigger = { scope:secondary_actor.var:intro_activity = flag:garden }
		reference = garden
	}

	immediate = {
		scope:actor.capital_province = { save_scope_as = background_terrain_scope }
		scope:secondary_recipient = { save_scope_as = bg_override_char }
		if = {
			limit = { scope:secondary_actor.var:intro_activity = flag:garrison }
			scope:secondary_actor = { add_character_flag = wear_armor }
		}
	}

	option = {
		trigger = { exists = scope:marry_anyhow }
		name = {
			trigger = {
				scope:secondary_recipient = root
			}
			text = lmf_interaction.1329.a #I will marry her
		}
		name = {
			trigger = {
				NOT = { scope:secondary_recipient = root }
			}
			text = lmf_interaction.1329.b #I agree, he will marry her
		}

		# check if you're overriding the secondary recipient's will not wed trait
		if = {
			limit = {
				scope:secondary_recipient = {
					has_trait = will_not_wed
					NOT = { this = root }
				}
			}
			custom_tooltip = lmf_secondary_recipient_may_rebel_tt
			save_scope_value_as = {
				name = secondary_recipient_might_rebel
				value = yes
			}
			scope:secondary_recipient = {
				remove_trait_force_tooltip = will_not_wed
				hidden_effect = {
					random_owned_story = {
						type = lmf_will_not_wed_story_cycle
						end_story = yes
					}
				}
				if = {
					limit = {
						can_set_relation_rival_trigger = { CHARACTER = root }
					}
					set_relation_rival = {
						reason = overrode_marriage_wishes
						target = root
					}
				}
				add_opinion = {
					target = root
					modifier = hate_opinion
					opinion = -40
				}
				add_opinion = {
					target = root
					modifier = refused_marry_for_love_opinion
				}
				if = {
					limit = {
						has_opinion_modifier = { target = root modifier = allowed_marry_for_love_opinion }
					}
					remove_opinion = { target = root modifier = allowed_marry_for_love_opinion }
				}
			}
		}
		# then check if you're forcing them to marry someone they don't like
		else_if = {
			limit = {
				NOR = {
					exists = scope:secondary_recipient_is_charmed
					scope:secondary_recipient = root
				}
			}
			worsen_relationship_effect = {
				TARGET = scope:secondary_recipient
				REASON = married_to_someone_I_dislike
			}
			reverse_add_opinion = {
				target = scope:secondary_recipient
				modifier = angry_opinion
				opinion = -20
			}
			reverse_add_opinion = {
				target = scope:secondary_actor
				modifier = refused_marry_for_love_opinion
			}
		}
		proceed_with_wedding_effect = yes

		ai_chance = {
			base = 0
			modifier = {
				add = 100
				is_playable_character = no
			}
			modifier = {
				add = 50
				exists = scope:secondary_recipient_is_charmed
			}
			modifier = {
				add = 100
				ai_compassion <= -50
			}
		}
	}
	option = {
		name = {
			trigger = {
				exists = scope:marry_anyhow
			}
			text = lmf_interaction.1329.c #No. Call the marriage arrangements off.
		}
		name = {
			trigger = {
				NOT = { exists = scope:marry_anyhow }
			}
			text = lmf_interaction.1329.d #So much for that.
		}

		if = {
			limit = { exists = scope:marry_anyhow }
			custom_tooltip = refuse_marriage_intro_send_act.tt
			scope:actor = {
				send_interface_message = {
					type = event_generic_bad
					title =  lmf_interaction_no_marriage.tt
					desc = lmf_interaction_no_marriage.failure.rec.tt
					left_icon = scope:secondary_recipient
					right_icon = scope:secondary_actor
				}
			}

			scope:actor = {
				if = {
					limit = { has_variable = grand_wedding_promise_pending }
					remove_variable = grand_wedding_promise_pending
				}
			}

			# If we're a clan this interaction affects unity
			add_clan_unity_interaction_effect = {
				CHARACTER = scope:actor
				TARGET = scope:recipient
				VALUE = medium_unity_loss
				DESC = clan_unity_marry_off_decline.desc
				REVERSE_NON_HOUSE_TARGET = no
			}

			if = {
				limit = { exists = global_var:travel_the_distance_is_loaded }
				ttd_marriage_proposal_clean_up_effect = yes
			}

			hidden_effect = {
				marriage_proposal_refused_effect = yes
				# do they become rivals anyhow?
				if = {
					limit = {
						exists = scope:can_become_rivals
						scope:secondary_recipient = {
							is_ai = yes
							can_set_relation_rival_trigger = { CHARACTER = scope:secondary_actor }
						}
						scope:secondary_actor = {
							is_ai = yes
							can_set_relation_rival_trigger = { CHARACTER = scope:secondary_recipient }
						}
					}
					random = {
						chance = 25
						scope:secondary_recipient = {
							set_relation_rival = { reason = became_enemies_at_introduction target = scope:secondary_actor }
						}
					}
				}
			}
		}

		ai_chance = {
			base = 100
			modifier = {
				add = 100
				ai_compassion >= 50
			}
			modifier = {
				add = -100
				is_playable_character = no
			}
			modifier = {
				add = -50
				exists = scope:secondary_recipient_is_charmed
			}
			min = 0
		}
	}

	after = {
		scope:secondary_actor = {
			if = {
				limit = { has_character_flag = wear_armor }
				remove_character_flag = wear_armor
			}
		}
	}
}

# Wedding stopped because someone ran away
lmf_interaction.1330 = {
	type = character_event
	hidden = yes

	immediate = {
		random_list = {
			50 = {
				trigger = {
					NOR = {
						has_trait = devoted
						has_trait = order_member
						any_heir_title = {}
						is_pregnant = yes
					}
					pool_character_can_go_to_holy_order = { CHARACTER = root }
				}
				modifier = {
					add = 20
					religion = { exists = var:variable_ghw_unlocked }
				}
				modifier = {
					add = 100
					faith = { exists = great_holy_war }
				}
				ai_value_modifier = {
					ai_zeal = 1
					ai_honor = 0.5
					ai_boldness = 0.5
				}
				modifier = {
					any_heir_title = {}
					factor = 0.5
				}
				modifier = {
					has_education_martial_trigger = no
					factor = 0.5
				}
				min = 0
				faith = {
					random_faith_holy_order = {
						limit = {
							leader = {
								is_alive = yes
								NOT = { has_relation_rival = root }
							}
						}
						weight = {
							base = 1
							modifier = {
								add = 1
								root = { exists = liege }
								holy_order_patron = root.liege
							}
						}
						leader = { save_scope_as = grandmaster_1 }
						save_scope_as = holy_order_1
					}
				}
				create_character_memory = {
					type = lmf_memory_left_court
					participants = { court = root.liege }
				}
				scope:new_memory = {
					set_variable = {
						name = liege_title
						value = root.liege.primary_title
					}
				}
				pool_character_join_holy_order = { CHARACTER = root }
				add_character_modifier = {
					modifier = lust_for_adventure
					years = 10
				}
			}
			50 = {
				trigger = {
					NOR = {
						has_trait = devoted
						has_trait = order_member
						any_heir_title = {}
						is_pregnant = yes
					}
					pool_character_can_take_holy_vows = { CHARACTER = root }
				}
				ai_value_modifier = {
					ai_zeal = 1
				}
				modifier = {
					any_heir_title = {}
					factor = 0.5
				}
				modifier = {
					factor = 0.5
					pool_character_can_go_to_holy_order = { CHARACTER = root }
				}
				modifier = {
					has_education_learning_trigger = no
					factor = 0.5
				}
				min = 0
				liege = { save_scope_as = former_liege }
				create_character_memory = {
					type = lmf_memory_left_court
					participants = { court = root.liege }
				}
				scope:new_memory = {
					set_variable = {
						name = liege_title
						value = root.liege.primary_title
					}
				}
				pool_character_take_vows = { CHARACTER = root }
				add_character_modifier = {
					modifier = lust_for_adventure
					years = 5
				}
			}
			50 = {
				trigger = {
					pool_character_can_join_random_adventurer = { CHARACTER = root }
				}
				ai_value_modifier = {
					ai_boldness = 1
					ai_energy = 0.5
					ai_rationality = -0.5
				}
				modifier = {
					dynasty ?= {
						any_dynasty_member = {
							NOR = {
								is_parent_of = root
								root.liege ?= this
								root.host ?= this
								root = this
							}
							is_landless_adventurer = yes
							is_physically_able_ai_adult = yes
							exists = domicile.domicile_location
							NOT = { has_relation_rival = root }
							any_courtier = { count < 10 }
						}
					}
					factor = 0
				}
				modifier = {
					factor = 0.5
					NOT = { can_be_warrior_trigger = { ARMY_OWNER = root } }
				}
				modifier = {
					factor = 0.5
					ai_zeal > 0
					pool_character_can_go_to_holy_order = { CHARACTER = root }
				}
				min = 0
				create_character_memory = {
					type = lmf_memory_left_court
					participants = { court = root.liege }
				}
				scope:new_memory = {
					set_variable = {
						name = liege_title
						value = root.liege.primary_title
					}
				}
				pool_character_join_random_adventurer = { CHARACTER = root }
				add_character_flag = joined_adventurer
			}
			50 = {
				trigger = {
					pool_character_can_join_dynasty_adventurer = { CHARACTER = root }
				}
				ai_value_modifier = {
					ai_boldness = 1
					ai_energy = 0.5
					ai_rationality = -0.5
				}
				modifier = {
					factor = 0.5
					NOT = { can_be_warrior_trigger = { ARMY_OWNER = root } }
				}
				modifier = {
					factor = 0.5
					ai_zeal > 0
					pool_character_can_go_to_holy_order = { CHARACTER = root }
				}
				min = 0
				create_character_memory = {
					type = lmf_memory_left_court
					participants = { court = root.liege }
				}
				scope:new_memory = {
					set_variable = {
						name = liege_title
						value = root.liege.primary_title
					}
				}
				pool_character_join_dynasty_adventurer = { CHARACTER = root }
				add_character_flag = joined_adventurer
			}
			0 = {
				trigger = {
					is_adult = yes
					has_ep3_dlc_trigger = yes
					ai_can_valid_to_create_laamp_trigger = yes
					is_valid_for_laampdom = yes
				}
				modifier = {
					always = yes
					add = ep3_laamp_chance_score_value
				}
				modifier = {
					any_heir_title = {}
					factor = 0.5
				}
				min = 0
				create_landless_adventurer_title_effect = {
					REASON = flag:voluntary
					FLAVOR_CHAR = root
				}
				add_character_modifier = {
					modifier = lust_for_adventure
					years = 5
				}
			}
			50 = {
				ai_value_modifier = {
					ai_vengefulness = 0.5
				}
				modifier = {
					add = -25
					has_ep3_dlc_trigger = yes
					ai_can_valid_to_create_laamp_trigger = yes
					is_valid_for_laampdom = yes
				}
				min = 1
				if = {
					limit = { exists = liege }
					lose_guardians_and_wards_effect = { LIEGE = root.liege COURTIER = root }
				}
				add_trait = will_not_wed
				hidden_effect = {
					create_story = {
						type = lmf_will_not_wed_story_cycle
					}
				}
				add_character_modifier = {
					modifier = lust_for_adventure
					years = 10
				}
				create_character_memory = {
					type = lmf_memory_left_court
					participants = { court = root.liege }
				}
				scope:new_memory = {
					set_variable = {
						name = liege_title
						value = root.liege.primary_title
					}
				}
				lmf_move_to_pool_effect = yes
			}
		}
		scope:actor = { trigger_event = lmf_interaction.1331 }
		scope:recipient = {
			if = {
				limit = {
					NOR = {
						this = scope:actor
						this = root
					}
				}
				trigger_event = lmf_interaction.1331
			}
		}
	}
}

lmf_interaction.1331 = {
	type = character_event
	title = lmf_interaction.1331.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:intended_spouse }
				desc = lmf_interaction.1331.desc.reject
			}
			desc = lmf_interaction.1331.desc.start
		}
		desc = lmf_interaction.1331.desc.mid
		first_valid = {
			triggered_desc = {
				trigger = {
					is_courtier = yes
					liege = { has_government = landless_adventurer_government }
					has_character_flag = joined_adventurer
				}
				desc = lmf_interaction.133.desc.follower
			}
			triggered_desc = {
				trigger = {
					is_playable_character = yes
					has_government = landless_adventurer_government
				}
				desc = lmf_interaction.133.desc.adventurer
			}
			triggered_desc = {
				trigger = { scope:rebel = { has_trait = devoted } }
				desc = lmf_interaction.1331.desc.devoted
			}
			triggered_desc = {
				trigger = { scope:rebel = { has_trait = order_member } }
				desc = lmf_interaction.1331.desc.order
			}
			desc = lmf_interaction.1331.desc.ranoff
		}
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:intended_spouse }
				desc = lmf_interaction.1331.desc.end.reject
			}
			desc = lmf_interaction.1331.desc.end
		}
	}
	theme = family

	left_portrait = {
		character = scope:rebel
		triggered_animation = {
			trigger = { scope:rebel = { has_trait = devoted } }
			animation = prayer
		}
		triggered_animation = {
			trigger = { scope:rebel = { has_trait = order_member } }
			animation = personality_zealous
		}
		triggered_outfit = {
			trigger = { scope:rebel = { has_trait = will_not_wed } }
			outfit_tags = { travel_cloak }
		}
		animation = anger
	}
	lower_right_portrait = scope:intended_spouse
	override_background = {
		trigger = { scope:rebel = { has_trait = order_member } }
		reference = armory
	}
	override_background = {
		trigger = { scope:rebel = { has_trait = devoted } }
		reference = temple
	}
	override_background = {
		trigger = { scope:rebel = { has_trait = will_not_wed } }
		reference = terrain
	}

	immediate = {
		# to change the background to wherever they are
		scope:rebel = { save_scope_as = bg_override_char }
	}
	option = {
		name = lmf_interaction.1331.a
	}
}


#############################
# SPOUSE/LOVER VISIT EVENTS #
#############################

# Spouse/lover refuses the invitation
lmf_interaction.1500 = {
	type = letter_event
	opening = {
		first_valid = {
			triggered_desc = {
				trigger = {
					is_liege_or_above_of = scope:recipient
					is_spouse_of = scope:recipient
				}
				desc = lmf_interaction.1500.opening.spouseliege
			}
			triggered_desc = {
				trigger = { is_liege_or_above_of = scope:recipient }
				desc = lmf_interaction.1500.opening.liege
			}
			triggered_desc = {
				trigger = { has_relation_lover = scope:recipient }
				desc = lmf_interaction.1500.opening.love
			}
			desc = lmf_interaction.1500.opening.spouse
		}
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { has_relation_nemesis = scope:recipient }
				desc = lmf_interaction.1500.nemesis
			}
			triggered_desc = {
				trigger = { has_relation_rival = scope:recipient }
				desc = lmf_interaction.1500.rival
			}
			triggered_desc = {
				trigger = {
					scope:recipient = {
						hurt_by_marriage_betrayal_trigger = { CHARACTER = scope:actor }
					}
				}
				desc = lmf_interaction.1500.betray
			}
			triggered_desc = {
				trigger = { has_relation_lover = scope:recipient }
				desc = lmf_interaction.1500.lover
			}
			desc = lmf_interaction.1500.spouse
		}
	}

	sender = {
		character = scope:recipient
		animation = dismissal
	}

	option = {
		name = lmf_interaction.1500.a
		scope:recipient = {
			add_opinion = {
				target = scope:actor
				modifier = irritated_opinion
				opinion = -10
			}
		}
	}
}

# Spouse/lover agrees to the invitation
lmf_interaction.1501 = {
	type = letter_event
	opening = {
		first_valid = {
			triggered_desc = {
				trigger = {
					is_liege_or_above_of = scope:recipient
					is_spouse_of = scope:recipient
				}
				desc = lmf_interaction.1500.opening.spouseliege
			}
			triggered_desc = {
				trigger = { is_liege_or_above_of = scope:recipient }
				desc = lmf_interaction.1500.opening.liege
			}
			triggered_desc = {
				trigger = { has_relation_lover = scope:recipient }
				desc = lmf_interaction.1500.opening.love
			}
			desc = lmf_interaction.1500.opening.spouse
		}
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { has_relation_lover = scope:recipient }
				desc = lmf_interaction.1501.lover
			}
			desc = lmf_interaction.1501.spouse
		}
	}
	sender = {
		character = scope:recipient
		animation = love
	}

	option = {
		name = lmf_interaction.1501.a
		set_variable = { name = visited_by_target value = scope:recipient }
		scope:recipient = {
			add_opinion = {
				target = scope:actor
				modifier = pleased_opinion
				opinion = 10
			}
			hidden_effect = {
				create_story = {
					type = lmf_visit_invitation_story_cycle
					save_scope_as = story
				}
				scope:story ?= {
					set_variable = { name = visit_target value = scope:actor }
					set_variable = { name = visit_province value = scope:actor.capital_province }
					set_variable = { name = start_province value = scope:recipient.location }
				}
				if = {
					limit = { is_pool_character = yes }
					start_travel_plan = {
						destination = scope:story.var:visit_province
						on_travel_planner_cancel_event = lmf_interaction.1502
						on_arrival_event = lmf_interaction.1505
						on_arrival_destinations = all
						return_trip = no
					}
				}
				else = {
					start_travel_plan = {
						destination = scope:story.var:visit_province
						on_travel_planner_cancel_event = lmf_interaction.1502
						on_arrival_event = lmf_interaction.1505
						on_arrival_destinations = all_but_last
					}
				}
				if = {
					limit = { scope:cover_travel_expenses = yes }
					current_travel_plan = {
						add_travel_plan_modifier = travel_guide_modifier
					}
				}

				# notify liege of their departure
				if = {
					limit = { is_courtier = yes }
					if = {
						limit = { is_spouse_of = scope:actor }
						liege = {
							send_interface_toast = {
								type = send_interface_message
								title = lmf_scheme.1050.title
								right_icon = scope:actor
								left_icon = scope:recipient
								custom_tooltip = lmf_scheme.1050.tt
							}
						}
					}
					else_if = {
						limit = {
							any_secret = {
								secret_type = secret_lover
								secret_target = scope:actor
								NOT = { is_known_by = scope:recipient.liege }
							}
						}
						liege = {
							send_interface_toast = {
								type = send_interface_message
								title = lmf_scheme.1050.title
								left_icon = scope:recipient
								custom_tooltip = lmf_scheme.1050.unknown.tt
							}
						}
					}
					else = {
						liege = {
							send_interface_toast = {
								type = send_interface_message
								title = lmf_scheme.1050.title
								right_icon = scope:actor
								left_icon = scope:recipient
								custom_tooltip = lmf_scheme.1050.lover.tt
							}
						}
					}
				}
			}
		}
	}
}

# Travel plan becomes canceled
lmf_interaction.1502 = {
	type = character_event
	hidden = yes

	immediate = {
		random_owned_story = {
			type = lmf_visit_invitation_story_cycle
			end_story = yes
		}
	}
}

# Visiting spouse/lover has to cancel due to war
lmf_interaction.1503 = {
	type = character_event
	title = lmf_interaction.1503.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					is_ruler = yes
					scope:attacker = scope:actor
					scope:defender = root
				}
				desc = lmf_interaction.1503.desc.atwar.betrayed
			}
			triggered_desc = {
				trigger = {
					is_ruler = yes
					is_at_war_with = scope:actor
				}
				desc = lmf_interaction.1503.desc.atwar.betrayer
			}
			triggered_desc = {
				trigger = {
					is_ruler = yes
					scope:defender = root
				}
				desc = lmf_interaction.1503.desc.atwar.rootdefender
			}
			triggered_desc = {
				trigger = {
					is_ruler = yes
					scope:attacker = root
				}
				desc = lmf_interaction.1503.desc.atwar.rootattacker
			}
			triggered_desc = {
				trigger = {
					scope:attacker = scope:actor
				}
				desc = lmf_interaction.1503.desc.atwar.actorattacker
			}
			triggered_desc = {
				trigger = {
					scope:defender = scope:actor
				}
				desc = lmf_interaction.1503.desc.atwar.actordefender
			}
			triggered_desc = {
				trigger = {
					scope:actor = { is_at_war = yes }
				}
				desc = lmf_interaction.1503.desc.atwar.actor
			}
			desc = lmf_interaction.1503.desc.atwar
		}
	}
	theme = war

	left_portrait = {
		character = root
		animation = worry
	}
	override_background = { reference = terrain }

	trigger = {
		is_travelling = yes
		current_travel_plan = {
			travel_plan_owner = root
			can_cancel = yes
		}
		any_owned_story = { type = lmf_visit_invitation_story_cycle }
		exists = scope:war.primary_attacker
		exists = scope:war.primary_defender
	}

	immediate = {
		random_owned_story = {
			type = lmf_visit_invitation_story_cycle
			var:visit_target = { save_scope_as = actor }
			var:visit_province = { save_scope_as = destination }
			var:start_province = { save_scope_as = origin }
			save_scope_as = story
		}
		scope:war.primary_attacker = { save_scope_as = attacker }
		scope:war.primary_defender = { save_scope_as = defender }
	}

	option = {
		name = lmf_interaction.1503.a #Return home at once
		current_travel_plan ?= { cancel_travel_plan = yes }
		if = {
			limit = { exists = scope:story.var:spouse_visiting_from }
			remove_character_flag = temp_remove_from_council
			remove_variable = block_hire_councillor
			scope:story.var:spouse_visiting_from = {
				send_interface_message = {
					type = event_generic_bad_with_text
					title = lmf_interaction.1503.a.title
					desc = lmf_interaction.1503.a.desc
					left_icon = root
				}
			}
		}
		scope:actor = {
			send_interface_message = {
				type = event_generic_bad_with_text
				title = lmf_interaction.1503.a.title
				desc = lmf_interaction.1503.a.desc
				left_icon = root
				scope:actor = {
					hidden_effect = {
						remove_opinion = { target = root modifier = agreed_to_visit_opinion }
					}
				}
			}
		}
		scope:story = { end_story = yes }
		ai_chance = {
			factor = 20
			modifier = {
				add = 60
				is_knight = yes
			}
			modifier = {
				add = 200
				OR = {
					scope:war.primary_attacker = root
					scope:war.primary_defender = root
				}
			}
			modifier = {
				factor = 0
				NOR = {
					scope:war.primary_attacker = root
					scope:war.primary_defender = root
					scope:war.primary_attacker = scope:actor
					scope:war.primary_defender = scope:actor
				}
			}
		}
	}
	option = {
		name = lmf_interaction.1503.b #Continue on
		trigger = {
			NAND = {
				is_ruler = yes
				is_at_war_with = scope:actor
			}
		}
		ai_chance = {
			factor = 80
			modifier = {
				factor = 0.1
				has_trait = paranoid
			}
		}
	}
}

# Spouse/lover dies while en route
lmf_interaction.1504 = {
	type = character_event
	title = lmf_interaction.1504.t
	desc = lmf_interaction.1504.desc
	theme = death

	left_portrait = {
		character = root
		animation = sadness
	}
	override_background = { reference = terrain }

	immediate = {
		random_owned_story = {
			type = lmf_visit_invitation_story_cycle
			var:visit_target = { save_scope_as = actor }
			var:visit_province = { save_scope_as = destination }
			var:start_province = { save_scope_as = origin }
			save_scope_as = story
		}
	}

	option = {
		name = lmf_interaction.1504.a
		if = {
			limit = { exists = scope:story.var:spouse_visiting_from }
			remove_character_flag = temp_remove_from_council
			remove_variable = block_hire_councillor
			scope:story.var:spouse_visiting_from = {
				send_interface_message = {
					type = event_generic_bad_with_text
					title = lmf_interaction.1503.a.title
					desc = lmf_interaction.1504.tt
					left_icon = root
				}
			}
		}
		if = {
			limit = {
				is_travelling = yes
				current_travel_plan ={
					travel_plan_owner = root
					can_cancel = yes
				}
			}
			current_travel_plan = { cancel_travel_plan = yes }
		}
	}
}

# Reaching the destination
lmf_interaction.1505 = {
	type = character_event
	hidden = yes

	trigger = {
		any_owned_story = {
			type = lmf_visit_invitation_story_cycle
		}
	}

	immediate = {
		save_scope_as = recipient
		random_owned_story = {
			type = lmf_visit_invitation_story_cycle
			save_scope_as = story
			var:visit_target = { save_scope_as = actor }
			var:visit_province = { save_scope_as = destination }
			var:start_province = { save_scope_as = origin }
		}
		if = {
			limit = {
				exists = scope:story
				exists = scope:destination
				location = { this = scope:destination }
				is_alive = yes
				is_imprisoned = no
				is_incapable = no
				has_recoverable_disease_trigger = no
				OR = {
					is_spouse_of = scope:actor
					has_relation_lover = scope:actor
					exists = scope:story.var:spouse_visiting_from
				}
				trigger_if = {
					limit = {
						NOT = { exists = scope:story.var:spouse_visiting_from }
					}
					NOR = {
						has_trait = infirm
						has_trait = wounded_2
						has_trait = wounded_3
						has_trait = pregnant
					}
				}
				scope:actor = {
					OR = {
						is_playable_character = yes
						exists = scope:story.var:courtier_visit
					}
					is_alive = yes
					is_travelling = no
					is_imprisoned = no
					is_incapable = no
					OR = {
						has_recoverable_disease_trigger = no
						exists = scope:story.var:spouse_visiting_from
					}
					location = scope:destination
					trigger_if = {
						limit = {
							NOT = { exists = scope:story.var:spouse_visiting_from }
						}
						NOR = {
							has_trait = infirm
							has_trait = wounded_2
							has_trait = wounded_3
							has_trait = pregnant
						}
					}
				}
			}
			if = {
				limit = { exists = scope:story.var:spouse_visiting_from }
				trigger_event = lmf_spouse.1241
			}
			else = {
				trigger_event = lmf_interaction.1506
				scope:actor = { trigger_event = lmf_interaction.1506 }
			}
		}
		else = {
			if = {
				limit = {
					exists = scope:story.var:spouse_visiting_from
					scope:story.var:spouse_visiting_from = {
						is_married = yes
						is_ai = no
						primary_spouse = root
					}
				}
				remove_character_flag = temp_remove_from_council
				remove_variable = block_hire_councillor
				scope:story.var:spouse_visiting_from = {
					send_interface_message = {
						type = event_generic_bad_with_text
						title = lmf_interaction.1505.a.title
						left_icon = scope:actor
						right_icon = root
						desc = {
							desc = lmf_interaction.1505.desc.begin
							first_valid = {
								triggered_desc = {
									trigger = {
										NOR = {
											scope:destination = scope:actor.capital_province
											exists = scope:story.var:courtier_visit
										}
									}
									desc = lmf_interaction.1505.desc.notprovince
								}
								triggered_desc = {
									trigger = {
										NOT = { scope:actor.location = scope:destination }
									}
									desc = lmf_interaction.1505.desc.actorleft
								}
								triggered_desc = {
									trigger = {
										root = { has_recoverable_disease_trigger = yes }
									}
									desc = lmf_interaction.1505.desc.rootill
								}
								triggered_desc = {
									trigger = {
										scope:actor = { is_imprisoned = yes }
									}
									desc = lmf_interaction.1505.desc.actorimprison
								}
								triggered_desc = {
									trigger = {
										root = { is_imprisoned = yes }
									}
									desc = lmf_interaction.1505.desc.rootimprison
								}
								desc = lmf_interaction.1505.desc.default
							}
						}
					}
				}
			}
			scope:actor = {
				send_interface_message = {
					type = event_generic_bad_with_text
					title = lmf_interaction.1505.a.title
					left_icon = scope:actor
					right_icon = root
					desc = {
						desc = lmf_interaction.1505.desc.begin
						first_valid = {
							triggered_desc = {
								trigger = {
									NOT = { exists = scope:story.var:spouse_visiting_from }
									root = {
										NOR = {
											is_spouse_of = scope:actor
											has_relation_lover = scope:actor
										}
									}
								}
								desc = lmf_interaction.1505.desc.norelationship
							}
							triggered_desc = {
								trigger = {
									NOR = {
										scope:destination = scope:actor.capital_province
										exists = scope:story.var:courtier_visit
									}
								}
								desc = lmf_interaction.1505.desc.notprovince
							}
							triggered_desc = {
								trigger = {
									NOT = { scope:actor.location = scope:destination }
								}
								desc = lmf_interaction.1505.desc.actorleft
							}
							triggered_desc = {
								trigger = {
									scope:actor = { has_recoverable_disease_trigger = yes }
									NOT = { exists = scope:story.var:spouse_visiting_from }
								}
								desc = lmf_interaction.1505.desc.actorill
							}
							triggered_desc = {
								trigger = {
									root = { has_recoverable_disease_trigger = yes }
								}
								desc = lmf_interaction.1505.desc.rootill
							}
							triggered_desc = {
								trigger = {
									scope:actor = { is_imprisoned = yes }
								}
								desc = lmf_interaction.1505.desc.actorimprison
							}
							triggered_desc = {
								trigger = {
									root = { is_imprisoned = yes }
								}
								desc = lmf_interaction.1505.desc.rootimprison
							}
							triggered_desc = {
								trigger = {
									scope:actor = { has_trait = pregnant }
									NOT = { exists = scope:story.var:spouse_visiting_from }
								}
								desc = lmf_interaction.1505.desc.actorpregnant
							}
							triggered_desc = {
								trigger = {
									root = { has_trait = pregnant }
									NOT = { exists = scope:story.var:spouse_visiting_from }
								}
								desc = lmf_interaction.1505.desc.rootpregnant
							}
							triggered_desc = {
								trigger = {
									NOT = { exists = scope:story.var:spouse_visiting_from }
									scope:actor = {
										OR = {
											is_incapable = yes
											has_trait = infirm
											has_trait = wounded_2
											has_trait = wounded_3
										}
									}
								}
								desc = lmf_interaction.1505.desc.actorhealth
							}
							triggered_desc = {
								trigger = {
									NOT = { exists = scope:story.var:spouse_visiting_from }
									root = {
										OR = {
											is_incapable = yes
											has_trait = infirm
											has_trait = wounded_2
											has_trait = wounded_3
										}
									}
								}
								desc = lmf_interaction.1505.desc.roothealth
							}
							desc = lmf_interaction.1505.desc.default
						}
					}
					scope:actor = {
						hidden_effect = {
							remove_opinion = { target = root modifier = agreed_to_visit_opinion }
						}
					}
				}
			}
			send_interface_message = {
				type = event_generic_bad_with_text
				title = lmf_interaction.1505.a.title
				left_icon = scope:actor
				right_icon = root
				desc = {
					desc = lmf_interaction.1505.desc.begin
					first_valid = {
						triggered_desc = {
							trigger = {
								NOT = { exists = scope:story.var:spouse_visiting_from }
								root = {
									NOR = {
										is_spouse_of = scope:actor
										has_relation_lover = scope:actor
									}
								}
							}
							desc = lmf_interaction.1505.desc.norelationship
						}
						triggered_desc = {
							trigger = {
								NOR = {
									scope:destination = scope:actor.capital_province
									exists = scope:story.var:courtier_visit
								}
							}
							desc = lmf_interaction.1505.desc.notprovince
						}
						triggered_desc = {
							trigger = {
								NOT = { scope:actor.location = scope:destination }
							}
							desc = lmf_interaction.1505.desc.actorleft
						}
						triggered_desc = {
							trigger = {
								NOT = { exists = scope:story.var:spouse_visiting_from }
								scope:actor = { has_recoverable_disease_trigger = yes }
							}
							desc = lmf_interaction.1505.desc.actorill
						}
						triggered_desc = {
							trigger = {
								root = { has_recoverable_disease_trigger = yes }
							}
							desc = lmf_interaction.1505.desc.rootill
						}
						triggered_desc = {
							trigger = {
								scope:actor = { is_imprisoned = yes }
							}
							desc = lmf_interaction.1505.desc.actorimprison
						}
						triggered_desc = {
							trigger = {
								root = { is_imprisoned = yes }
							}
							desc = lmf_interaction.1505.desc.rootimprison
						}
						triggered_desc = {
							trigger = {
								NOT = { exists = scope:story.var:spouse_visiting_from }
								scope:actor = { has_trait = pregnant }
							}
							desc = lmf_interaction.1505.desc.actorpregnant
						}
						triggered_desc = {
							trigger = {
								NOT = { exists = scope:story.var:spouse_visiting_from }
								root = { has_trait = pregnant }
							}
							desc = lmf_interaction.1505.desc.rootpregnant
						}
						triggered_desc = {
							trigger = {
								NOT = { exists = scope:story.var:spouse_visiting_from }
								scope:actor = {
									OR = {
										is_incapable = yes
										has_trait = infirm
										has_trait = wounded_2
										has_trait = wounded_3
									}
								}
							}
							desc = lmf_interaction.1505.desc.actorhealth
						}
						triggered_desc = {
							trigger = {
								NOT = { exists = scope:story.var:spouse_visiting_from }
								root = {
									OR = {
										is_incapable = yes
										has_trait = infirm
										has_trait = wounded_2
										has_trait = wounded_3
									}
								}
							}
							desc = lmf_interaction.1505.desc.roothealth
						}
						desc = lmf_interaction.1505.desc.default
					}
				}
			}
			if = {
				limit = {
					is_pool_character = yes
					is_travelling = yes
					current_travel_plan ={
						travel_plan_owner = root
						can_cancel = yes
					}
				}
				current_travel_plan = { abort_travel_plan = yes }
			}
			if = {
				limit = { exists = scope:story }
				scope:story = { end_story = yes }
			}
		}
	}
}

# The visit takes place
lmf_interaction.1506 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:recipient = {
						this = root
						has_relation_lover = scope:actor
					}
				}
				desc = lmf_interaction.1506.t.reclove
			}
			triggered_desc = {
				trigger = {
					scope:recipient = root
				}
				desc = lmf_interaction.1506.t.rec
			}
			triggered_desc = {
				trigger = {
					scope:recipient = {
						has_relation_lover = scope:actor
					}
				}
				desc = lmf_interaction.1506.t.love
			}
			desc = lmf_interaction.1506.t
		}
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:recipient = {
						this = root
						has_relation_lover = scope:actor
						is_spouse_of = scope:actor
					}
				}
				desc = lmf_interaction.1506.desc.reclove.spouse
			}
			triggered_desc = {
				trigger = {
					scope:recipient = {
						this = root
						has_relation_lover = scope:actor
					}
				}
				desc = lmf_interaction.1506.desc.reclove.notspouse
			}
			triggered_desc = {
				trigger = {
					scope:recipient = { this = root }
				}
				desc = lmf_interaction.1506.desc.rec.spouse
			}
			triggered_desc = {
				trigger = {
					scope:recipient = {
						has_relation_lover = scope:actor
						is_spouse_of = scope:actor
					}
				}
				desc = lmf_interaction.1506.desc.love.spouse
			}
			triggered_desc = {
				trigger = {
					scope:recipient = {
						has_relation_lover = scope:actor
					}
				}
				desc = lmf_interaction.1506.desc.love.notspouse
			}
			desc = lmf_interaction.1506.desc.spouse
		}
	}
	theme = love

	right_portrait = {
		character = scope:actor
		animation = flirtation_left
	}
	left_portrait = {
		character = scope:recipient
		triggered_animation = {
			trigger = {
				scope:actor = { has_relation_lover = scope:recipient }
			}
			animation = love
		}
		animation = throne_room_conversation_4
	}
	override_background = { reference = bedchamber }

	option = {
		name = lmf_interaction.1506.a
		if = {
			limit = {
				scope:actor = { has_relation_soulmate = scope:recipient }
			}
			stress_impact = { base = massive_stress_loss }
		}
		else_if = {
			limit = {
				scope:actor = { has_relation_lover = scope:recipient }
			}
			stress_impact = { base = major_stress_loss }
		}
		else = {
			stress_impact = { base = medium_stress_loss }
		}
		if = {
			limit = { root = scope:actor }
			had_sex_with_effect = { CHARACTER = scope:recipient PREGNANCY_CHANCE = visit_pregnancy_chance }
		}
		else = {
			show_as_tooltip = {
				had_sex_with_effect = { CHARACTER = scope:actor PREGNANCY_CHANCE = visit_pregnancy_chance }
			}
			random_owned_story = {
				type = lmf_visit_invitation_story_cycle
				end_story = yes
			}
		}
	}
}


########################
# WIDOW/WIDOWER EVENTS #
########################

# Beloved spouse dies
lmf_interaction.1600 = {
	type = character_event
	title = lmf_interaction.1600.t
	desc = {
		desc = lmf_interaction.1600.start
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:lost_soulmate }
				desc = lmf_interaction.1600.soulmate
			}
			triggered_desc = {
				trigger = { exists = scope:lost_lover }
				desc = lmf_interaction.1600.lover
			}
			desc = lmf_interaction.1600.friend
		}
		desc = lmf_interaction.1600.end
	}
	theme = death
	
	left_portrait = {
		character = root
		animation = grief
	}
	lower_right_portrait = scope:lost_spouse
	override_background = { reference = ce1_catacombs }
	
	immediate = {
		add_trait = widowed
	}
	
	option = {
		name = lmf_interaction.1600.a
		custom_tooltip = lmf_interaction.1600.tt
		add_character_flag = { flag = lmf_mourning_period_base months = 4 }
		if = {
			limit = { exists = scope:lost_soulmate }
			add_character_flag = { flag = lmf_mourning_period months = 36 }
			trigger_event = { id = lmf_interaction.1601 months = { 24 36 } } # around two to three years
		}
		else_if = {
			limit = { exists = scope:lost_lover }
			add_character_flag = { flag = lmf_mourning_period months = 24 }
			trigger_event = { id = lmf_interaction.1601 months = { 12 24 } } # around a year to two years
		}
		else_if = {
			limit = {
				OR = {
					has_sexuality = heterosexual
					has_sexuality = bisexual
					has_relation_best_friend = scope:lost_spouse
				}
			}
			add_character_flag = { flag = lmf_mourning_period days = 400 }
			trigger_event = { id = lmf_interaction.1601 days = { 300 400 } } # around one year
		}
		else = {
			add_character_flag = { flag = lmf_mourning_period days = 200 }
			trigger_event = { id = lmf_interaction.1601 days = { 150 200 } } # around six months
		}
	}
	option = {
		name = lmf_interaction.1600.b # I cannot afford this kind of mourning period
		trigger = { is_ai = no }
		remove_trait_force_tooltip = widowed
		stress_impact = {
			base = major_stress_impact_gain
			compassionate = medium_stress_impact_gain
			stubborn = minor_stress_impact_gain
			callous = medium_stress_impact_loss
			fickle = minor_stress_impact_loss
		}
		if = {
			limit = { is_ruler = yes }
			add_prestige = medium_prestige_loss
			every_vassal = {
				limit = {
					has_vassal_stance = zealot
					ai_compassion <= 0
				}
				add_opinion = {
					target = root
					modifier = disappointed_opinion
					opinion = -10
				}
			}
		}
	}
}

# Is the mourning period over?
lmf_interaction.1601 = {
	type = character_event
	title = lmf_interaction.1601.t
	desc = lmf_interaction.1601.desc
	theme = death

	left_portrait = {
		character = root
		animation = sadness
	}
	lower_right_portrait = scope:lost_spouse
	
	trigger = {
		has_trait = widowed
	}
	
	immediate = {
		hidden_effect = {
			if = {
				limit = { has_character_flag = lmf_mourning_period }
				remove_character_flag = lmf_mourning_period
			}
		}
	}
	
	option = {
		name = lmf_interaction.1601.a # It's time for my mourning to end
		remove_trait_force_tooltip = widowed
		ai_chance = {
			base = 60
			modifier = {
				add = 60
				exists = scope:lost_lover
			}
			ai_value_modifier = {
				ai_rationality = 1.0
				ai_energy = 0.5
			}
			min = 1
		}
	}
	option = {
		name = lmf_interaction.1601.b # No, I'm not ready just yet...
		trigger = {
			OR = {
				exists = scope:lost_soulmate
				exists = scope:lost_lover
			}
		}
		stress_impact = {
			base = medium_stress_impact_loss
		}
		custom_tooltip = lmf_interaction.1600.tt
		if = {
			limit = { exists = scope:lost_soulmate }
			add_character_flag = { flag = lmf_mourning_period months = 36 }
			trigger_event = { id = lmf_interaction.1601 months = { 24 36 } } # around two to three years
		}
		else = {
			add_character_flag = { flag = lmf_mourning_period months = 24 }
			trigger_event = { id = lmf_interaction.1601 months = { 12 24 } } # around a year to two years
		}
		ai_chance = {
			base = 30
			ai_value_modifier = {
				ai_compassion = 1.0
			}
			modifier = {
				factor = 0.5
				age <= 30
			}
			modifier = {
				factor = 2
				is_old_age_or_not_have_children = yes
			}
			min = 0
		}
	}
	option = {
		name = lmf_interaction.1601.c # I've decided: I won't marry ever again
		trigger = {
			exists = scope:lost_soulmate
		}
		stress_impact = {
			base = major_stress_impact_loss
		}
		remove_trait_force_tooltip = widowed
		add_trait_force_tooltip = will_not_wed
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_compassion = 0.5
			}
			modifier = {
				factor = 0.5
				age <= 30
			}
			modifier = {
				factor = 2
				is_old_age_or_not_have_children = yes
			}
			min = 0
		}
	}
}

