#Interactions relating to hostages

### Offer hostage - unilateral
# actor = offerer
# recipient = receiver
# secondary_actor = hostage
offer_hostage_interaction = {
	category = interaction_category_diplomacy
	common_interaction = no
	interface_priority = 11
	ai_min_reply_days = 4
	ai_max_reply_days = 9
	popup_on_receive = yes
	pause_on_receive = yes
	icon = icon_hostage

	populate_actor_list = {
		scope:actor = {
			every_close_family_member = {
				limit = {
					# Unlanded, at sender's court, child/sibling/nibling/grandchild
					bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:actor }
				}
				add_to_list = characters
			}
		}
	}

	desc = offer_hostage_interaction_desc

	prompt = OFFER_HOSTAGE_SELECT_HOSTAGE_TO_TRANSFER

	notification_text = OFFER_HOSTAGE_PROPOSAL

	cooldown_against_recipient = { years = 3 }

	is_shown = {
		scope:recipient != scope:actor
		# Cannot exchange hostages with a herder
		# Only significant rulers use hostages
		scope:recipient.highest_held_title_tier > tier_barony
		# Laamps can't do anything with hostages but return/recall them.
		scope:recipient = {
			NOR = {
				government_has_flag = government_is_landless_adventurer
				government_has_flag = government_is_true_herder
			}
		}
		#Inside a merit realm vassals won't offer hostages except to your top liege.
		trigger_if = {
			limit = {
				scope:actor.top_liege = { government_has_flag = government_has_merit }
				scope:actor.top_liege != scope:actor
				scope:recipient != scope:actor.top_liege
			}
			NAND = {
				scope:actor = { government_has_flag = government_has_merit }
				scope:recipient = { government_has_flag = government_has_merit }
			}
		}
	}

	is_valid_showing_failures_only = {
		NOR = {
			# Must be at peace
			scope:recipient = { is_at_war_with = scope:actor }
			# Allies don't need hostages
			scope:recipient = { is_allied_to = scope:actor }
			# Only family oriented governments use hostages
			scope:actor = {
				government_has_flag = government_is_theocracy
			}
			scope:recipient = {
				government_has_flag = government_is_theocracy
			}
			# 1 hostage per home court
			custom_tooltip = {
				text = "already_has_your_hostage_tt"
				scope:recipient = {
					any_warden_hostage = { home_court ?= scope:actor }
				}
			}
			custom_description = {
				text = hostage_already_travelling_tt
				subject = scope:actor
				object = scope:recipient
				scope:actor = {
					any_close_family_member = {
						exists = var:hostage_travelling_to_warden
						var:hostage_travelling_to_warden = scope:recipient
					}
				}
			}
		}
		scope:actor = {
			OR = {
				is_landless_ruler = no
				is_landless_administrative = yes
			}
		}
		scope:recipient = {
			OR = {
				is_landless_ruler = no
				is_landless_administrative = yes
			}
		}
		# Stop AI spamming hostage offers
		trigger_if = {
			limit = {
				scope:actor = { is_ai = yes }
				exists = scope:secondary_actor
			}
			NOT = {
				scope:secondary_actor = { has_character_flag = ai_should_not_offer_hostage }
			}
		}
		# Tooltip for players in case of no valid hostages to offer
		trigger_else = {
			scope:actor = {
				custom_description = {
					text = "basic_valid_hostage_to_offer"
					object = scope:recipient
					any_close_family_member = {
						# Unlanded, at sender's court, child/sibling/nibling/grandchild
						bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:actor }
					}
				}
			}
		}
		# Hostages still valid
		trigger_if = {
			limit = {
				exists = scope:secondary_actor
				exists = scope:actor
			}
			scope:secondary_actor = {
				bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:actor }
			}
		}
		tgp_blocked_action_against_tenno_trigger = {
			ACTOR = scope:actor
			TARGET = scope:recipient
		}
	}

	can_be_picked = {
		# Unlanded, at sender's court, child/sibling/nibling/grandchild
		bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:actor }
		# Under offer
		custom_tooltip = {
			text = hostage_already_offered_awaiting_response_tt
			NOT = { has_character_flag = under_offer_as_hostage_flag }
		}
		# Already offered
		custom_tooltip = {
			text = hostage_already_offered_awaiting_response_tt
			NOT = { exists = var:hostage_travelling_to_warden }
		}
	}

	can_send = {
		scope:actor = { # AI only offer to more powerful neighbors
			trigger_if = {
				limit = { is_ai = yes }
				bp2_valid_to_offer_hostage_ai_trigger = yes
				# AI should not offer close family of players without their consent
				NOR = {
					scope:secondary_actor = {
						any_close_family_member = {
							is_ai = no
							OR = {
								is_parent_of = scope:secondary_actor
								is_grandparent_of = scope:secondary_actor
							}
							this != scope:actor
						}
					}
					# A hostage died on their watch
					var:hostage_died ?= scope:recipient
				}
			}
		}
		scope:recipient = {
			trigger_if = {
				limit = { is_ai = no }
				NOT = {
					scope:secondary_actor = { has_character_flag = ai_should_not_offer_hostage }
				}
			}
		}
		# Adult hostages must be loyal enough to go along with it
		scope:secondary_actor = {
			trigger_if = {
				limit = { is_adult = yes }
				OR = {
					AND = {
						custom_tooltip = {
							text = hostage_opinion_too_low_tt
							opinion = {
								target = scope:actor
								value >= -25
							}
						}
						NOT = { has_trait = disloyal }
					}
					has_trait = loyal
				}
			}
			# Under offer
			custom_tooltip = {
				text = hostage_already_offered_awaiting_response_tt
				NOT = { has_character_flag = under_offer_as_hostage_flag }
			}
		}
	}

	cost = {}

	on_send = {
		scope:secondary_actor = {
			add_character_flag = {
				flag = under_offer_as_hostage_flag
				months = 1
			}
		}
		if = {
			limit = {
				scope:recipient = { is_ai = no }
			}
			hidden_effect = {
				scope:secondary_actor = {
					add_character_flag = {
						flag = ai_should_not_offer_hostage
						years = 3
					}
				}
			}
		}
	}

	on_accept = {
		# Save scopes for clarity
		scope:actor = { save_scope_as = hostage_sender }
		scope:secondary_actor = { save_scope_as = hostage }
		scope:recipient = { save_scope_as = hostage_taker }
		custom_description_no_bullet = { text = hostage_pacts_on_arrival_tt }
		custom_description_no_bullet = { text = hostage_execution_warning_tt }
		custom_description_no_bullet = { text = hostage_attack_warning_tt }
		hostage_depart_effect = {
			HOSTAGE = scope:hostage
			WARDEN = scope:hostage_taker
			HOME_COURT = scope:hostage_sender
		}
		scope:actor = { trigger_event = char_interaction.0330 }
		# If we're of the same clan this interaction affects unity
		if = {
			limit = {
				scope:actor = { government_has_flag = government_is_clan }
				scope:actor.house = scope:recipient.house
			}
			add_clan_unity_interaction_effect = {
				CHARACTER = scope:actor
				TARGET = scope:recipient
				VALUE = medium_unity_loss
				DESC = clan_unity_hostage.desc
				REVERSE_NON_HOUSE_TARGET = no
			}
		}
	}

	on_decline = {
		scope:actor = {
			trigger_event = char_interaction.0300
		}
		scope:secondary_actor = { remove_character_flag = under_offer_as_hostage_flag }
	}

	auto_accept = {
		trigger_if = {
			limit = {
				scope:hook ?= yes
				scope:actor = { has_strong_hook = scope:recipient }
			}
			custom_description = {
				text = "spending_hook"
				subject = scope:actor
				object = scope:recipient
				scope:hook ?= yes
				scope:actor = { has_strong_hook = scope:recipient }
			}
		}
		trigger_else = { always = no }
	}

	can_be_blocked = {
		custom_description = { #Hook from Recipient can counteract, but only if Actor is not forcing the action via Strong Hook.
			text = "spending_hook"
			subject = scope:recipient
			object = scope:actor
			scope:recipient = { has_hook = scope:actor }
			NAND = {
				scope:hook = yes
				scope:actor = { has_strong_hook = scope:recipient }
			}
		}
	}

	on_blocked_effect = {
		scope:recipient = {
			remove_hook = { target = scope:actor }
		}
	}

	#Use hook
	send_option = {
		is_valid = {
			scope:actor = { has_usable_hook = scope:recipient }
		}
		flag = hook
		localization = SCHEME_HOOK
	}
	should_use_extra_icon = {
		scope:actor = { has_usable_hook = scope:recipient }
	}
	extra_icon = "gfx/interface/icons/character_interactions/hook_icon.dds"

	send_options_exclusive = no

	# AI
	ai_accept = {
		base = 0 # Try to make it 0 for most interactions

		######### PERSONALITY

		bp2_hostage_offer_personality_modifier = yes

		######### OPINION

		opinion_modifier = { # Opinion Factor
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 0.5
			desc = AI_OPINION_REASON
		}

		######### RELATIONS

		bp2_hostage_relation_modifier = yes

		######### DREAD

		bp2_hostage_dread_modifier = yes

		######### HOSTAGE IMPORTANCE

		# Hostages
		modifier = {
			exists = scope:secondary_actor
			add = interaction_actor_hostage_value
			desc = HOSTAGE_VALUE_ACTOR_REASON
		}

		######### RELATIVE POWER

		bp2_hostage_tier_neighbor_modifier = {
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_claims_casus_bellis_modifier = {
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_vassals_lieges_modifier = { # Political situation
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_relative_strength_modifier = { # Relative military strength
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}

		######### CULTURAL DIFFERENCES

		bp2_hostage_culture_faith_modifier = {
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}

		######### CULTURAL TRADITIONS

		modifier = {
			scope:recipient.culture = { has_cultural_tradition = tradition_equitable }
			add = 25
			desc = HOSTAGE_EQUITABLE_TRADITION_REASON
		}
		modifier = {
			scope:recipient.culture = { has_cultural_tradition = tradition_esteemed_hospitality }
			add = 25
			desc = HOSTAGE_ESTEEMED_HOSPITALITY_TRADITION_REASON
		}
		modifier = {
			scope:recipient = {
				is_vassal_of = scope:actor
				culture = { has_cultural_tradition = tradition_loyal_soldiers }
			}
			add = 25
			desc = HOSTAGE_LOYAL_SUBJECTS_TRADITION_REASON
		}

		######### OTHER

		modifier = { # Already have a truce
			scope:recipient ?= { has_truce = scope:actor }
			desc = HOSTAGE_RECIPIENT_EXISTING_TRUCE_REASON
			add = -20
		}
		modifier = { # Already fighting a war
			scope:recipient ?= { is_at_war = yes }
			desc = HOSTAGE_AT_WAR_REASON
			add = 15
		}
		modifier = { # Already have their hostage
			scope:actor = {
				any_warden_hostage = { home_court ?= scope:recipient }
			}
			desc = HOSTAGE_ALREADY_DEMANDED_REASON
			add = 50
		}
		modifier = {
			add = -50
			scope:actor = { has_character_modifier = attacked_warden }
			desc = attacked_warden
		}
		modifier = { # Conqueror
			scope:recipient ?= {
				has_variable = conqueror
			}
			desc = NO_FRIVOLOUS_ACTIVITIES_REASON
			add = -1000
		}
	}

	ai_targets = {
		ai_recipients = neighboring_rulers
		ai_recipients = peer_vassals
		ai_recipients = vassals
		max = 10
	}

	ai_targets = {
		ai_recipients = liege
	}

	ai_frequency_by_tier = {
		barony = 0
		county = 120
		duchy = 120
		kingdom = 360
		empire = 0
		hegemony = 0
	}

	is_available = {
		trigger_if = {
			limit = {
				is_ai = yes
			}
			NOT = { has_variable = conqueror }
		}
		NOT = {
			government_has_flag = government_is_landless_adventurer
		}
	}

	ai_will_do = {
		base = 0
		opinion_modifier = { # Opinion Factor
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 0.5
			desc = AI_OPINION_REASON
		}
		opinion_modifier = { # Opinion Factor
			who = scope:actor
			opinion_target = scope:secondary_actor
			multiplier = -0.1
			desc = AI_OPINION_REASON
		}
		bp2_hostage_tier_neighbor_modifier = {
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_claims_casus_bellis_modifier = {
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_vassals_lieges_modifier = { # Political situation
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_relative_strength_modifier = { # Relative military strength
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_culture_faith_modifier = {
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		modifier = { # The AI will only use a Hook if they couldn't otherwise do this
			scope:hook = yes
			add = -1
		}
		modifier = { # Attacked a hostage's home court
			add = -50
			scope:recipient = { has_character_modifier = attacked_home_court }
			desc = attacked_home_court
		}
		modifier = { # Hostage died on their watch
			exists = scope:actor.var:hostage_died
			scope:recipient = {
				NOR = {
					var:let_my_hostage_die ?= scope:actor
					has_opinion_modifier = {
						target = scope:actor
						modifier = killed_hostage_opinion
					}
				}
			}
			desc = HOSTAGE_PREVIOUSLY_DIED_REASON
			add = -25
		}
		modifier = { # MY Hostage died on their watch
			scope:recipient = {
				var:let_my_hostage_die ?= scope:actor
				NOT = {
					has_opinion_modifier = {
						target = scope:actor
						modifier = killed_hostage_opinion
					}
				}
			}
			desc = HOSTAGE_PREVIOUSLY_DIED_HOME_COURT_REASON
			add = -100
		}
		modifier = { # Killed my hostage!!!
			scope:recipient = {
				has_opinion_modifier = {
					target = scope:actor
					modifier = killed_hostage_opinion
				}
			}
			desc = HOSTAGE_KILLED_REASON
			add = -200
		}
		modifier = { # Not neighboring
			NOR = {
				scope:recipient = {
					character_is_land_realm_neighbor = scope:actor
					top_liege = scope:actor.top_liege
				}
			}
			add = -50
		}
		modifier = {
			scope:recipient = { has_character_flag = halved_hostage_prestige_income }
			desc = HOSTAGE_RETAINED_ADULTHOOD_REASON
			add = -25
		}
		# Cultural traditions
		modifier = {
			scope:actor.culture = { has_cultural_tradition = tradition_equitable }
			add = 25
		}
		modifier = {
			scope:actor.culture = { has_cultural_tradition = tradition_esteemed_hospitality }
			add = 25
		}
		modifier = {
			scope:actor = {
				is_vassal_of = scope:recipient
				culture = { has_cultural_tradition = tradition_loyal_soldiers }
			}
			add = 25
			desc = HOSTAGE_CULTURAL_TRADITION_REASON
		}
	}
}

### Demand hostage - unilateral
# actor = receiver
# recipient = offerer
# secondary_recipient = hostage
demand_hostage_interaction = {
	category = interaction_category_diplomacy
	common_interaction = no
	ai_min_reply_days = 4
	ai_max_reply_days = 9
	popup_on_receive = yes
	pause_on_receive = yes
	icon = icon_hostage
	interface_priority = 13

	desc = demand_hostage_interaction_desc

	prompt = DEMAND_HOSTAGE_SELECT_HOSTAGE_TO_OFFER

	notification_text = DEMAND_HOSTAGE_PROPOSAL

	populate_recipient_list = {
		scope:recipient = {
			every_close_family_member = {
				limit = {
					# Unlanded, at sender's court, child/sibling/nibling/grandchild
					bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:recipient }
				}
				add_to_list = characters
			}
		}
	}

	cooldown_against_recipient = { years = 3 }

	is_shown = {
		# Cannot exchange hostages with self
		scope:recipient != scope:actor
		# Cannot exchange hostages with a herder
		NOT = { scope:recipient = { government_has_flag = government_is_true_herder } }
		# Only significant rulers use hostages
		scope:actor.highest_held_title_tier > tier_barony
		OR = {
			scope:recipient.highest_held_title_tier > tier_barony
			scope:recipient.liege ?= {
				highest_held_title_tier > tier_barony
				any_close_family_member = {
					this = scope:recipient
					# Unlanded, at sender's court, child/sibling/nibling/grandchild
					bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:recipient.liege }
				}
			}
		}
		# Laamps can't do anything with hostages but return/recall them.
		NOR = {
			scope:actor = { government_has_flag = government_is_landless_adventurer }
			scope:recipient = { government_has_flag = government_is_landless_adventurer }
		}
		#Inside a merit realm vassals won't demand hostages.
		trigger_if = {
			limit = {
				scope:actor.top_liege = { government_has_flag = government_has_merit }
				scope:actor.top_liege != scope:actor
			}
			NAND = {
				scope:actor = { government_has_flag = government_has_merit }
				scope:recipient = { government_has_flag = government_has_merit }
			}
			NOT = { scope:recipient = scope:actor.top_liege }
		}
	}

	redirect = {
		if = {
			limit = {
				scope:recipient ?= {
					is_playable_character = no
					is_landless_ruler = no
				}
			}
			scope:recipient ?= { save_scope_as = secondary_recipient }
			scope:secondary_recipient.liege ?= { save_scope_as = recipient }
		}
	}

	is_valid_showing_failures_only = {
		# Must be approachable
		scope:recipient = {
			NOT = { has_strong_hook = scope:actor }
		}
		scope:actor = {
			OR = {
				is_landless_ruler = no
				is_landless_administrative = yes
			}
		}
		scope:recipient = {
			OR = {
				is_landless_ruler = no
				is_landless_administrative = yes
			}
		}
		NOR = {
			# Must be at peace
			scope:recipient = { is_at_war_with = scope:actor }
			# Allies don't need hostages
			scope:recipient = { is_allied_to = scope:actor }
			# Only family oriented governments use hostages
			scope:actor = {
				government_has_flag = government_is_theocracy
			}
			scope:recipient = {
				government_has_flag = government_is_theocracy
			}
			# 1 hostage per court
			custom_tooltip = {
				text = "already_have_their_hostage_tt"
				scope:actor = {
					any_warden_hostage = { home_court ?= scope:recipient }
				}
			}
			custom_description = {
				text = "hostage_already_travelling_tt"
				subject = scope:actor
				object = scope:recipient
				scope:actor = {
					any_close_family_member = {
						exists = var:hostage_travelling_to_warden
						var:hostage_travelling_to_warden = scope:recipient
					}
				}
			}
		}
		# Stop AI spamming hostage offers
		trigger_if = {
			limit = {
				scope:recipient = { is_ai = yes }
				exists = scope:secondary_recipient
			}
			NOT = {
				scope:secondary_recipient = { has_character_flag = ai_should_not_demand_hostage }
			}
		}
		# Tooltip for players in case of no valid hostages to demand
		# Make sure this exactly matches "can_be_picked" section below
		trigger_else = {
			scope:recipient = {
				custom_description = {
					text = "basic_valid_hostage_to_demand"
					subject = scope:actor
					object = scope:recipient
					any_close_family_member = {
						# Unlanded, at sender's court, child/sibling/nibling/grandchild
						bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:recipient }
					}
				}
			}
		}
		# Hostages still valid
		trigger_if = {
			limit = {
				exists = scope:secondary_recipient
				exists = scope:recipient
			}
			scope:secondary_recipient = {
				bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:recipient }
			}
		}
		tgp_blocked_action_against_tenno_trigger = {
			ACTOR = scope:actor
			TARGET = scope:recipient
		}
	}

	can_send = {
		scope:actor = {
			custom_description = {
				text = "character_interactions_hostile_actions_disabled_delay"
				NOT = { has_character_flag = flag_hostile_actions_disabled_delay }
			}
			trigger_if = { # AI only demand from less powerful neighbors
				limit = { is_ai = yes }
				bp2_valid_to_demand_hostage_ai_trigger = yes
				NOR = {
					scope:secondary_recipient ?= { has_character_flag = ai_should_not_demand_hostage }
					# AI should not demand close family of players without their consent
					scope:secondary_recipient = {
						any_close_family_member = {
							is_ai = no
							OR = {
								is_parent_of = scope:secondary_recipient
								is_grandparent_of = scope:secondary_recipient
							}
							this != scope:recipient
						}
					}
					# A hostage died on their watch
					var:hostage_died ?= scope:recipient
				}
			}
		}
		# Adult hostages must be loyal enough to go along with it
		scope:secondary_recipient = {
			trigger_if = {
				limit = { is_adult = yes }
				OR = {
					AND = {
						custom_tooltip = {
							text = hostage_opinion_too_low_tt
							opinion = {
								target = scope:recipient
								value >= -25
							}
							NOT = { has_trait = disloyal }
						}
					}
					has_trait = loyal
				}
			}
			custom_tooltip = {
				text = hostage_already_offered_awaiting_response_tt
				NOT = { has_character_flag = under_offer_as_hostage_flag }
			}
		}
	}

	can_be_picked = {
		# Unlanded, at sender's court, child/sibling/nibling/grandchild
		bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:recipient }
		# Already offered
		custom_tooltip = {
			text = hostage_already_offered_awaiting_response_tt
			NOT = { has_character_flag = under_offer_as_hostage_flag }
		}
		# Already offered
		custom_tooltip = {
			text = hostage_already_offered_awaiting_response_tt
			NOT = { exists = var:hostage_travelling_to_warden }
		}
	}

	cost = {}

	on_send = {
		scope:secondary_recipient = {
			add_character_flag = {
				flag = under_offer_as_hostage_flag
				months = 1
			}
		}
		scope:actor = {
			add_character_flag = {
				flag = flag_hostile_actions_disabled_delay
				days = 10
			}
		}
		if = {
			limit = {
				scope:recipient = { is_ai = no }
			}
			scope:secondary_recipient = {
				add_character_flag = {
					flag = ai_should_not_demand_hostage
					years = 3
				}
			}
		}
	}

	on_accept = {
		# Save scopes for clarity
		scope:actor = { save_scope_as = hostage_taker }
		scope:recipient = { save_scope_as = hostage_sender }
		scope:secondary_recipient = { save_scope_as = hostage }
		custom_description_no_bullet = { text = hostage_pacts_on_arrival_tt }
		custom_description_no_bullet = { text = hostage_execution_warning_tt }
		custom_description_no_bullet = { text = hostage_attack_warning_tt }
		hostage_depart_effect = {
			HOSTAGE = scope:hostage
			WARDEN = scope:hostage_taker
			HOME_COURT = scope:hostage_sender
		}
		show_as_tooltip = {
			if = {
				limit = {
					scope:recipient = { is_vassal_of = scope:actor }
				}
				scope:recipient = {
					if = {
						limit = { is_ai = yes }
						add_opinion = {
							modifier = liege_demanded_hostage_opinion
							target = scope:actor
						}
					}
				}
				scope:actor = {
					# Tyranny for demanding from vassals
					add_tyranny = minor_tyranny_gain
				}
			}
		}
		scope:actor = { trigger_event = char_interaction.0331 }
		# If we're of the same clan this interaction affects unity
		if = {
			limit = {
				scope:actor = { government_has_flag = government_is_clan }
				scope:actor.house = scope:recipient.house
			}
			add_clan_unity_interaction_effect = {
				CHARACTER = scope:actor
				TARGET = scope:recipient
				VALUE = minor_unity_loss
				DESC = clan_unity_hostage.desc
				REVERSE_NON_HOUSE_TARGET = no
			}
		}
	}

	on_decline = {
		show_as_tooltip = {
			if = { # Effects for refusing demand from liege
				limit = {
					scope:recipient = { is_vassal_of = scope:actor }
				}
				scope:recipient = {
					if = {
						limit = { is_ai = yes }
						add_opinion = {
							modifier = liege_demanded_hostage_opinion
							target = scope:actor
						}
					}
				}
				scope:actor = {
					# Tyranny for demanding from vassals
					add_tyranny = minor_tyranny_gain
					if = {
						limit = { is_ai = yes }
						add_opinion = {
							modifier = vassal_refused_hostage_demand_opinion
							target = scope:recipient
						}
					}
				}
			}
		}
		scope:actor = {
			trigger_event = char_interaction.0301
		}
		scope:secondary_recipient = { remove_character_flag = under_offer_as_hostage_flag }
	}

	auto_accept = {
		trigger_if = {
			limit = {
				scope:hook ?= yes
				scope:actor = { has_strong_hook = scope:recipient }
			}
			custom_description = {
				text = "spending_hook"
				subject = scope:actor
				object = scope:recipient
				scope:hook ?= yes
				scope:actor = { has_strong_hook = scope:recipient }
			}
		}
		trigger_else = { always = no }
	}

	can_be_blocked = {
		custom_description = { #Hook from Recipient can counteract, but only if Actor is not forcing the action via Strong Hook.
			text = "spending_hook"
			subject = scope:recipient
			object = scope:actor
			scope:recipient = { has_hook = scope:actor }
			NAND = {
				scope:hook = yes
				scope:actor = { has_strong_hook = scope:recipient }
			}
		}
	}

	on_blocked_effect = {
		scope:recipient = {
			remove_hook = { target = scope:actor }
		}
	}

	send_option = {
		is_valid = {
			scope:actor = { has_usable_hook = scope:recipient }
		}
		flag = hook
		localization = SCHEME_HOOK
	}
	should_use_extra_icon = {
		scope:actor = { has_usable_hook = scope:recipient }
	}
	extra_icon = "gfx/interface/icons/character_interactions/hook_icon.dds"

	send_options_exclusive = no

	# AI
	ai_accept = {
		base = 0

		######### PERSONALITY

		bp2_hostage_demand_personality_modifier = yes

		######### OPINION

		opinion_modifier = { # Opinion Factor
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 0.5
			desc = AI_OPINION_REASON
		}
		opinion_modifier = { # Opinion Factor
			who = scope:recipient
			opinion_target = scope:secondary_recipient
			multiplier = -0.1
			desc = AI_OPINION_REASON
		}

		######### RELATIONS

		bp2_hostage_relation_modifier = yes

		######### DREAD

		modifier = {
			add = intimidated_halved_reason_value
			scope:recipient = {
				has_dread_level_towards = {
					target = scope:actor
					level = 1
				}
			}
			desc = INTIMIDATED_REASON
		}
		modifier = {
			add = cowed_halved_reason_value
			scope:recipient = {
				has_dread_level_towards = {
					target = scope:actor
					level = 2
				}
			}
			desc = COWED_REASON
		}

		######### HOSTAGE IMPORTANCE

		modifier = {
			exists = scope:secondary_recipient
			add = interaction_recipient_hostage_value
			desc = HOSTAGE_VALUE_RECIPIENT_REASON
		}

		######### RELATIVE POWER

		bp2_hostage_tier_neighbor_modifier = { # Realm relative position
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_claims_casus_bellis_modifier = { # Desire for land/war
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_vassals_lieges_modifier = { # Political situation
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_relative_strength_modifier = { # Relative military strength
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		modifier = {
			desc = HOSTAGE_IMMINENT_THREAT_REASON
			scope:actor = { has_any_cb_on = scope:recipient }
			scope:actor.current_strength_with_allies_fifty_percent_value > scope:recipient.current_strength_with_allies_value
			add = 25
		}

		######### CULTURAL DIFFERENCES

		bp2_hostage_culture_faith_modifier = {
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}

		######### CULTURAL TRADITIONS

		modifier = {
			scope:recipient.culture = { has_cultural_tradition = tradition_equitable }
			add = 25
			desc = HOSTAGE_EQUITABLE_TRADITION_REASON
		}
		modifier = {
			scope:recipient.culture = { has_cultural_tradition = tradition_esteemed_hospitality }
			add = 25
			desc = HOSTAGE_ESTEEMED_HOSPITALITY_TRADITION_REASON
		}
		modifier = {
			scope:recipient = {
				is_vassal_of = scope:actor
				culture = { has_cultural_tradition = tradition_loyal_soldiers }
			}
			add = 25
			desc = HOSTAGE_LOYAL_SUBJECTS_TRADITION_REASON
		}

		######### OTHER

		modifier = { # Hostage died on their watch
			exists = scope:actor.var:hostage_died
			scope:recipient = {
				NOR = {
					var:let_my_hostage_die ?= scope:actor
					has_opinion_modifier = {
						target = scope:actor
						modifier = killed_hostage_opinion
					}
				}
			}
			desc = HOSTAGE_PREVIOUSLY_DIED_REASON
			add = -25
		}
		modifier = { # MY Hostage died on their watch
			scope:recipient = {
				var:let_my_hostage_die ?= scope:actor
				NOT = {
					has_opinion_modifier = {
						target = scope:actor
						modifier = killed_hostage_opinion
					}
				}
			}
			desc = HOSTAGE_PREVIOUSLY_DIED_HOME_COURT_REASON
			add = -100
		}
		modifier = { # Killed my hostage!!!
			scope:recipient = {
				has_opinion_modifier = {
					target = scope:actor
					modifier = killed_hostage_opinion
				}
			}
			desc = HOSTAGE_KILLED_REASON
			add = -200
		}
		modifier = { # Already have a truce
			scope:actor ?= { has_truce = scope:recipient }
			desc = HOSTAGE_ACTOR_EXISTING_TRUCE_REASON
			add = -20
		}
		modifier = { # Already fighting a war
			scope:recipient ?= { is_at_war = yes }
			desc = HOSTAGE_AT_WAR_REASON
			add = 15
		}
		modifier = { # Already have your hostage
			scope:recipient = {
				any_warden_hostage = { home_court ?= scope:actor }
			}
			desc = HOSTAGE_ALREADY_OFFERED_REASON
			add = 50
		}
		modifier = { # Attacked a hostage's home court
			add = -50
			scope:actor = { has_character_modifier = attacked_home_court }
			desc = attacked_home_court
		}
		modifier = {
			scope:hook = yes
			add = 40
			desc = SCHEME_WEAK_HOOK_USED
		}
		modifier = {
			scope:secondary_recipient ?= { is_adult = no }
			scope:actor = { has_character_flag = halved_hostage_prestige_income }
			desc = HOSTAGE_RETAINED_ADULTHOOD_REASON
			add = -25
		}
		modifier = { # Conqueror
			scope:recipient ?= {
				has_variable = conqueror
			}
			desc = NO_FRIVOLOUS_ACTIVITIES_REASON
			add = -1000
		}
	}

	ai_targets = {
		ai_recipients = neighboring_rulers
		ai_recipients = peer_vassals
		ai_recipients = vassals
		max = 10
	}

	ai_targets = {
		ai_recipients = liege
	}

	ai_frequency_by_tier = {
		barony = 0
		county = 0
		duchy = 0
		kingdom = 36
		empire = 36
		hegemony = 36
	}

	ai_potential = {
		highest_held_title_tier >= tier_county
		NOT = { has_variable = conqueror }
	}

	ai_will_do = {
		base = 0
		opinion_modifier = { # Opinion Factor
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 0.5
			desc = AI_OPINION_REASON
		}
		bp2_hostage_tier_neighbor_modifier = {
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_claims_casus_bellis_modifier = {
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_vassals_lieges_modifier = { # Political situation
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_relative_strength_modifier = { # Relative military strength
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_culture_faith_modifier = {
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		modifier = {
			add = -50
			scope:recipient = { has_character_modifier = attacked_warden }
			desc = attacked_warden
		}
		modifier = { # The AI will only use a Hook if they couldn't otherwise do this
			scope:hook = yes
			add = -1
		}
		modifier = { # Not neighboring
			NOR = {
				scope:recipient = {
					character_is_land_realm_neighbor = scope:actor
					top_liege = scope:actor.top_liege
				}
			}
			add = -50
		}
		# Cultural traditions
		modifier = {
			scope:actor.culture = { has_cultural_tradition = tradition_equitable }
			add = 25
		}
		modifier = {
			scope:actor.culture = { has_cultural_tradition = tradition_esteemed_hospitality }
			add = 25
		}
		modifier = {
			scope:actor = {
				is_vassal_of = scope:recipient
				culture = { has_cultural_tradition = tradition_loyal_soldiers }
			}
			add = 25
			desc = HOSTAGE_CULTURAL_TRADITION_REASON
		}
	}
}

### Exchange hostages - bilateral
# actor = receiver
# recipient = offerer
# secondary_actor = hostage
# secondary_recipient = hostage
exchange_hostage_interaction = {
	category = interaction_category_diplomacy
	common_interaction = no
	ai_min_reply_days = 4
	ai_max_reply_days = 9
	popup_on_receive = yes
	pause_on_receive = yes
	icon = icon_hostage
	interface_priority = 12

	desc = exchange_hostage_interaction_desc

	prompt = EXCHANGE_HOSTAGE_SELECT_HOSTAGE_TO_OFFER

	notification_text = EXCHANGE_HOSTAGE_PROPOSAL

	populate_actor_list = {
		scope:actor = {
			every_close_family_member = {
				limit = {
					# Unlanded, at sender's court, child/sibling/nibling/grandchild
					bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:actor }
				}
				add_to_list = characters
			}
		}
	}

	populate_recipient_list = {
		scope:recipient = {
			every_close_family_member = {
				limit = {
					# Unlanded, at sender's court, child/sibling/nibling/grandchild
					bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:recipient }
				}
				add_to_list = characters
			}
		}
	}

	cost = {}

	cooldown_against_recipient = { years = 3 }

	is_shown = {
		# Cannot exchange hostages with self
		scope:recipient != scope:actor
		# Cannot exchange hostages with a herder
		NOT = { scope:recipient = { government_has_flag = government_is_true_herder } }
		# Only significant rulers use hostages
		scope:actor.highest_held_title_tier > tier_barony
		OR = {
			scope:recipient.highest_held_title_tier > tier_barony
			scope:recipient.liege ?= {
				highest_held_title_tier > tier_barony
				any_close_family_member = {
					this = scope:recipient
					# Unlanded, at sender's court, child/sibling/nibling/grandchild
					bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:recipient.liege }
				}
			}
		}
		# Laamps can't do anything with hostages but return/recall them.
		NOR = {
			scope:actor = { government_has_flag = government_is_landless_adventurer }
			scope:recipient = { government_has_flag = government_is_landless_adventurer }
		}
		#Inside a merit realm vassals won't exchange hostages.
		trigger_if = {
			limit = {
				scope:actor.top_liege = { government_has_flag = government_has_merit }
				scope:actor.top_liege != scope:actor
			}
			NAND = {
				scope:actor = { government_has_flag = government_has_merit }
				scope:recipient = { government_has_flag = government_has_merit }
			}
			NOT = { scope:recipient = scope:actor.top_liege }
		}
	}

	redirect = {
		if = {
			limit = {
				scope:recipient ?= {
					is_playable_character = no
					is_landless_ruler = no
				}
			}
			scope:recipient ?= { save_scope_as = secondary_recipient }
			scope:secondary_recipient.liege ?= { save_scope_as = recipient }
		}
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			NOR = {
				# Must be at peace
				is_at_war_with = scope:recipient
				# Allies don't need hostages
				is_allied_to = scope:recipient
				# Only family oriented governments use hostages
				government_has_flag = government_is_theocracy
				scope:recipient = {
					government_has_flag = government_is_theocracy
				}
				# 1 hostage per court
				custom_tooltip = {
					text = "already_has_your_hostage_tt"
					scope:recipient = {
						any_warden_hostage = { home_court ?= scope:actor }
					}
				}
				custom_tooltip = {
					text = "already_have_their_hostage_tt"
					any_warden_hostage = { home_court ?= scope:recipient }
				}
				custom_description = {
					text = "hostage_already_travelling_tt"
					subject = scope:recipient
					object = scope:actor
					any_close_family_member = {
						exists = var:hostage_travelling_to_warden
						var:hostage_travelling_to_warden = scope:recipient
					}
				}
				custom_description = {
					text = "hostage_already_travelling_tt"
					subject = scope:actor
					object = scope:recipient
					scope:recipient = {
						any_close_family_member = {
							exists = var:hostage_travelling_to_warden
							var:hostage_travelling_to_warden = scope:actor
						}
					}
				}
			}
			OR = {
				is_landless_ruler = no
				is_landless_administrative = yes
			}
			# Stop AI spamming hostage offers
			trigger_if = {
				limit = {
					is_ai = yes
					exists = scope:secondary_actor
				}
				NOT = {
					scope:secondary_actor = { has_character_flag = ai_should_not_demand_hostage }
				}
			}
			# Tooltip for players in case of no valid hostages to demand
			# Make sure this exactly matches "can_be_picked" section below
			trigger_else = {
				scope:recipient = {
					custom_description = {
						text = "basic_valid_hostage_to_demand"
						subject = scope:actor
						object = scope:recipient
						any_close_family_member = {
							# Unlanded, at sender's court, child/sibling/nibling/grandchild
							bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:recipient }
						}
					}
				}
			}
			# Stop AI spamming hostage offers
			trigger_if = {
				limit = {
					is_ai = yes
					exists = scope:secondary_actor
				}
				NOT = {
					scope:secondary_actor = { has_character_flag = ai_should_not_offer_hostage }
				}
			}
			# Tooltip for players in case of no valid hostages to offer
			trigger_else = {
				custom_description = {
					text = "basic_valid_hostage_to_offer"
					object = scope:recipient
					subject = scope:actor
					any_close_family_member = {
						# Unlanded, at sender's court, child/sibling/nibling/grandchild
						bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:actor }
					}
				}
			}
		}
		scope:recipient = {
			OR = {
				is_landless_ruler = no
				is_landless_administrative = yes
			}
		}
		# Hostages still valid
		trigger_if = {
			limit = {
				exists = scope:secondary_recipient
				exists = scope:recipient
			}
			scope:secondary_recipient = {
				bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:recipient }
			}
		}
		trigger_if = {
			limit = {
				exists = scope:secondary_actor
				exists = scope:actor
			}
			scope:secondary_actor = {
				bp2_valid_to_offer_as_hostage_trigger = { SENDER = scope:actor }
			}
		}
		tgp_blocked_action_against_tenno_trigger = {
			ACTOR = scope:actor
			TARGET = scope:recipient
		}
	}

	on_send = {
		scope:secondary_actor = {
			add_character_flag = {
				flag = under_offer_as_hostage_flag
				months = 1
			}
		}
		scope:secondary_recipient = {
			add_character_flag = {
				flag = under_offer_as_hostage_flag
				months = 1
			}
		}
	}

	can_send = {
		scope:actor = {
			trigger_if = {
				limit = { is_ai = yes }
				bp2_valid_to_exchange_hostage_ai_trigger = yes
				# AI should not demand close family of players without their consent
				NOR = {
					scope:secondary_actor = {
						any_close_family_member = {
							is_ai = no
							OR = {
								is_parent_of = scope:secondary_actor
								is_grandparent_of = scope:secondary_actor
							}
							this != scope:actor
						}
					}
					scope:secondary_recipient = {
						any_close_family_member = {
							is_ai = no
							OR = {
								is_parent_of = scope:secondary_recipient
								is_grandparent_of = scope:secondary_recipient
							}
							this != scope:recipient
						}
					}
					# A hostage died on their watch
					var:hostage_died ?= scope:recipient
				}
			}
		}
		scope:secondary_actor = {
			# Already offered
			custom_tooltip = {
				text = hostage_already_offered_awaiting_response_tt
				NOT = { has_character_flag = under_offer_as_hostage_flag }
			}
			# Adult hostages must be loyal enough to go along with it
			trigger_if = {
				limit = { is_adult = yes }
				OR = {
					AND = {
						custom_tooltip = {
							text = hostage_opinion_too_low_tt
							opinion = {
								target = scope:actor
								value >= -25
							}
							NOT = { has_trait = disloyal }
						}
					}
					has_trait = loyal
				}
			}
		}
		scope:secondary_recipient = {
			# Already offered
			custom_tooltip = {
				text = hostage_already_offered_awaiting_response_tt
				NOT = { has_character_flag = under_offer_as_hostage_flag }
			}
			# Adult hostages must be loyal enough to go along with it
			trigger_if = {
				limit = { is_adult = yes }
				OR = {
					AND = {
						custom_tooltip = {
							text = hostage_opinion_too_low_tt
							opinion = {
								target = scope:recipient
								value >= -25
							}
							NOT = { has_trait = disloyal }
						}
					}
					has_trait = loyal
				}
			}
		}
	}

	# whether a character can be picked for the interaction, interface only (e.g. picking the first character in the marriage interaction)
	# in character scope, actor and recipient event targets can be used, but not the secondary characters (because none exist yet)
	can_be_picked = {
		# Already offered
		custom_tooltip = {
			text = hostage_already_offered_awaiting_response_tt
			NOT = { has_character_flag = under_offer_as_hostage_flag }
		}
		# Already offered
		custom_tooltip = {
			text = hostage_already_offered_awaiting_response_tt
			NOT = { exists = var:hostage_travelling_to_warden }
		}
	}

	on_accept = {
		# Save scopes for clarity
		scope:actor = { save_scope_as = hostage_sender_1 }
		scope:secondary_actor = { save_scope_as = hostage_1 }
		scope:recipient = { save_scope_as = hostage_sender_2 }
		scope:secondary_recipient = { save_scope_as = hostage_2 }
		custom_description_no_bullet = { text = hostage_pacts_on_arrival_tt }
		custom_description_no_bullet = { text = hostage_execution_warning_tt }
		custom_description_no_bullet = { text = hostage_attack_warning_tt }
		hostage_depart_effect = {
			HOSTAGE = scope:hostage_1
			WARDEN = scope:hostage_sender_2
			HOME_COURT = scope:hostage_sender_1
		}
		hostage_depart_effect = {
			HOSTAGE = scope:hostage_2
			WARDEN = scope:hostage_sender_1
			HOME_COURT = scope:hostage_sender_2
		}
		scope:actor = { trigger_event = char_interaction.0332 }
		# If we're of the same clan this interaction affects unity
		if = {
			limit = {
				scope:actor = { government_has_flag = government_is_clan }
				scope:actor.house = scope:recipient.house
			}
			add_clan_unity_interaction_effect = {
				CHARACTER = scope:actor
				TARGET = scope:recipient
				VALUE = medium_unity_loss
				DESC = clan_unity_hostage.desc
				REVERSE_NON_HOUSE_TARGET = no
			}
		}
		scope:actor.house = {
			change_house_relation_effect = {
				HOUSE = scope:recipient.house
				VALUE = house_relation_improve_medium_value
				REASON = hostage_exchange
				CHAR = scope:actor
				TARGET_CHAR = scope:recipient
				TITLE = scope:dummy_gender
			}
		}
	}

	on_decline = {
		scope:actor = {
			trigger_event = char_interaction.0311
		}
		scope:secondary_actor = { remove_character_flag = under_offer_as_hostage_flag }
		scope:secondary_recipient = { remove_character_flag = under_offer_as_hostage_flag }
	}

	# AI
	ai_accept = {
		base = -25

		######## PERSONALITY

		bp2_hostage_exchange_personality_modifier = yes

		######### OPINION

		opinion_modifier = { # Opinion Factor
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 0.5
			desc = AI_OPINION_REASON
		}
		opinion_modifier = { # Opinion Factor
			who = scope:recipient
			opinion_target = scope:secondary_recipient
			multiplier = -0.1
			desc = AI_OPINION_REASON
		}

		######### RELATIONS

		bp2_hostage_relation_modifier = yes


		######### DREAD

		modifier = {
			add = intimidated_halved_reason_value
			scope:recipient = {
				has_dread_level_towards = {
					target = scope:actor
					level = 1
				}
			}
			desc = INTIMIDATED_REASON
		}
		modifier = {
			add = cowed_halved_reason_value
			scope:recipient = {
				has_dread_level_towards = {
					target = scope:actor
					level = 2
				}
			}
			desc = COWED_REASON
		}

		######### HOSTAGE IMPORTANCE


		modifier = {
			exists = scope:secondary_actor
			NOT = { exists = scope:secondary_recipient }
			add = interaction_actor_hostage_value
			desc = HOSTAGE_VALUE_ACTOR_REASON
		}
		modifier = {
			NOT = { exists = scope:secondary_actor }
			exists = scope:secondary_recipient
			add = interaction_recipient_hostage_value # already negative
			desc = HOSTAGE_VALUE_RECIPIENT_REASON
		}

		######### RELATIVE POWER

		bp2_hostage_tier_neighbor_modifier = { # Realm relative position
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_claims_casus_bellis_modifier = { # Desire for land/war
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_vassals_lieges_modifier = { # Political situation
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_relative_strength_modifier = { # Relative military strength
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		modifier = {
			desc = HOSTAGE_IMMINENT_THREAT_REASON
			scope:actor = { has_any_cb_on = scope:recipient }
			scope:actor.current_strength_with_allies_fifty_percent_value > scope:recipient.current_strength_with_allies_value
			add = 25
		}

		######### CULTURAL DIFFERENCES

		bp2_hostage_culture_faith_modifier = {
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}

		######### CULTURAL TRADITIONS

		modifier = {
			scope:recipient.culture = { has_cultural_tradition = tradition_equitable }
			add = 25
			desc = HOSTAGE_EQUITABLE_TRADITION_REASON
		}
		modifier = {
			scope:recipient.culture = { has_cultural_tradition = tradition_esteemed_hospitality }
			add = 25
			desc = HOSTAGE_ESTEEMED_HOSPITALITY_TRADITION_REASON
		}
		modifier = {
			scope:recipient = {
				is_vassal_of = scope:actor
				culture = { has_cultural_tradition = tradition_loyal_soldiers }
			}
			add = 25
			desc = HOSTAGE_LOYAL_SUBJECTS_TRADITION_REASON
		}

		######### OTHER

		modifier = { # Hostage died on their watch
			exists = scope:actor.var:hostage_died
			scope:recipient = {
				NOR = {
					var:let_my_hostage_die ?= scope:actor
					has_opinion_modifier = {
						target = scope:actor
						modifier = killed_hostage_opinion
					}
				}
			}
			desc = HOSTAGE_PREVIOUSLY_DIED_REASON
			add = -25
		}
		modifier = { # MY Hostage died on their watch
			scope:recipient = {
				var:let_my_hostage_die ?= scope:actor
				NOT = {
					has_opinion_modifier = {
						target = scope:actor
						modifier = killed_hostage_opinion
					}
				}
			}
			desc = HOSTAGE_PREVIOUSLY_DIED_HOME_COURT_REASON
			add = -100
		}
		modifier = { # Killed my hostage!!!
			scope:recipient = {
				has_opinion_modifier = {
					target = scope:actor
					modifier = killed_hostage_opinion
				}
			}
			desc = HOSTAGE_KILLED_REASON
			add = -200
		}
		modifier = { # Already have a truce
			scope:actor ?= { has_truce = scope:recipient }
			desc = HOSTAGE_ACTOR_EXISTING_TRUCE_REASON
			add = -20
		}
		modifier = { # Already fighting a war
			scope:recipient ?= { is_at_war = yes }
			desc = HOSTAGE_AT_WAR_REASON
			add = 15
		}
		modifier = { # Already have your hostage
			scope:recipient = {
				any_warden_hostage = { home_court ?= scope:actor }
			}
			desc = HOSTAGE_ALREADY_OFFERED_REASON
			add = 50
		}
		modifier = {
			add = -50
			scope:actor = { has_character_modifier = attacked_warden }
			desc = attacked_warden
		}
		modifier = { # Attacked a hostage's home court
			add = -50
			scope:actor = { has_character_modifier = attacked_home_court }
			desc = attacked_home_court
		}
		modifier = {
			scope:hook = yes
			add = 40
			desc = SCHEME_WEAK_HOOK_USED
		}
		modifier = {
			scope:secondary_recipient ?= { is_adult = no }
			scope:actor = { has_character_flag = halved_hostage_prestige_income }
			desc = HOSTAGE_RETAINED_ADULTHOOD_REASON
			add = -25
		}
		modifier = { # Conqueror
			scope:recipient ?= {
				has_variable = conqueror
			}
			desc = NO_FRIVOLOUS_ACTIVITIES_REASON
			add = -1000
		}
	}

	ai_targets = {
		ai_recipients = neighboring_rulers
		ai_recipients = peer_vassals
		ai_recipients = vassals
		max = 10
	}

	ai_targets = {
		ai_recipients = liege
	}

	ai_target_quick_trigger = {
		adult = yes
	}

	ai_frequency_by_tier = {
		barony = 0
		county = 0
		duchy = 360
		kingdom = 120
		empire = 36
		hegemony = 36
	}

	ai_potential = {
		is_adult = yes
		highest_held_title_tier >= tier_county
		NOT = { has_variable = conqueror }
	}

	ai_will_do = {
		base = 0
		opinion_modifier = { # Opinion Factor
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 0.5
			desc = AI_OPINION_REASON
		}
		opinion_modifier = { # Opinion Factor
			who = scope:actor
			opinion_target = scope:secondary_actor
			multiplier = -0.1
			desc = AI_OPINION_REASON
		}
		bp2_hostage_tier_neighbor_modifier = {
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_claims_casus_bellis_modifier = {
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_vassals_lieges_modifier = { # Political situation
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_relative_strength_modifier = { # Relative military strength
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_culture_faith_modifier = {
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		modifier = { # The AI will only use a Hook if they couldn't otherwise do this
			scope:hook = yes
			add = -1
		}
		modifier = { # Attacked a hostage's warden
			add = -50
			scope:recipient = { has_character_modifier = attacked_warden }
			desc = attacked_warden
		}
		modifier = { # Attacked a hostage's home court
			add = -50
			scope:recipient = { has_character_modifier = attacked_home_court }
			desc = attacked_home_court
		}
		modifier = { # Hostage died on their watch
			exists = scope:actor.var:hostage_died
			scope:recipient = {
				NOR = {
					var:let_my_hostage_die ?= scope:actor
					has_opinion_modifier = {
						target = scope:actor
						modifier = killed_hostage_opinion
					}
				}
			}
			desc = HOSTAGE_PREVIOUSLY_DIED_REASON
			add = -25
		}
		modifier = { # MY Hostage died on their watch
			scope:recipient = {
				var:let_my_hostage_die ?= scope:actor
				NOT = {
					has_opinion_modifier = {
						target = scope:actor
						modifier = killed_hostage_opinion
					}
				}
			}
			desc = HOSTAGE_PREVIOUSLY_DIED_HOME_COURT_REASON
			add = -100
		}
		modifier = { # Killed my hostage!!!
			scope:recipient = {
				has_opinion_modifier = {
					target = scope:actor
					modifier = killed_hostage_opinion
				}
			}
			desc = HOSTAGE_KILLED_REASON
			add = -200
		}
		modifier = { # Not neighboring
			NOR = {
				scope:recipient = {
					character_is_land_realm_neighbor = scope:actor
					top_liege = scope:actor.top_liege
				}
			}
			add = -50
		}
		modifier = {
			scope:recipient = { has_character_flag = halved_hostage_prestige_income }
			desc = HOSTAGE_RETAINED_ADULTHOOD_REASON
			add = -25
		}
		# Cultural traditions
		modifier = {
			scope:actor.culture = { has_cultural_tradition = tradition_equitable }
			add = 25
		}
		modifier = {
			scope:actor.culture = { has_cultural_tradition = tradition_esteemed_hospitality }
			add = 25
		}
		modifier = {
			scope:actor = {
				is_vassal_of = scope:recipient
				culture = { has_cultural_tradition = tradition_loyal_soldiers }
			}
			add = 25
			desc = HOSTAGE_CULTURAL_TRADITION_REASON
		}
	}

	#Use hook
	send_option = {
		is_valid = {
			scope:actor = { has_usable_hook = scope:recipient }
		}
		flag = hook
		localization = SCHEME_HOOK
	}
	should_use_extra_icon = {
		scope:actor = { has_usable_hook = scope:recipient }
	}
	extra_icon = "gfx/interface/icons/character_interactions/hook_icon.dds"
	send_options_exclusive = no
	greeting = positive
}

### Return hostage - unilateral
# actor = warden
# recipient = home_court
# secondary_actor = hostage
return_hostage_interaction = {
	category = interaction_category_diplomacy
	common_interaction = no
	popup_on_receive = yes
	pause_on_receive = yes
	icon = icon_hostage

	desc = return_hostage_interaction_desc

	populate_recipient_list = {
		scope:actor = {
			every_warden_hostage = {
				limit = { home_court ?= scope:recipient }
				add_to_list = characters
			}
		}
	}

	cost = {}

	is_shown = {
		# Cannot return hostages to self
		scope:recipient != scope:actor
		# Must have a hostage
		OR = {
			scope:actor = {
				any_warden_hostage = { home_court ?= scope:recipient }
			}
			scope:recipient.warden ?= scope:actor
		}
	}

	redirect = {
		if = {
			limit = {
				scope:recipient.warden ?= scope:actor
			}
			scope:recipient = { save_scope_as = secondary_recipient }
			scope:recipient.home_court = { save_scope_as = recipient }
		}
	}

	is_valid_showing_failures_only = {
		NOR = {
			# Must be at peace
			scope:recipient = { is_at_war_with = scope:actor }
			# Only family oriented governments use hostages
			scope:actor = {
				OR = {
					government_has_flag = government_is_theocracy
					government_has_flag = government_is_landless_adventurer
				}
			}
			scope:recipient = {
				OR = {
					government_has_flag = government_is_theocracy
					government_has_flag = government_is_landless_adventurer
				}
			}
		}
	}

	# whether a character can be picked for the interaction, interface only (e.g. picking the first character in the marriage interaction)
	# in character scope, actor and recipient event targets can be used, but not the secondary characters (because none exist yet)
	can_be_picked = {}

	can_send = {
		NOT = {
			scope:actor = { is_at_war_with = scope:recipient }
		}
	}

	on_send = {}

	auto_accept = yes

	on_accept = {
		# Save scopes for clarity
		scope:actor = { save_scope_as = warden }
		scope:recipient = { save_scope_as = home_court }
		scope:secondary_recipient = { save_scope_as = hostage }
		# Send toast informing sender of acceptance
		scope:home_court = {
			hidden_effect = {
				send_interface_toast = {
					type = event_toast_effect_good
					title = return_hostage_interaction_notification
					left_icon = scope:hostage
					right_icon = scope:warden
					show_as_tooltip = {
						bp2_return_hostage_effect = { HOSTAGE = scope:hostage }
					}
				}
			}
		}
		scope:warden = {
			send_interface_toast = {
				type = event_toast_effect_neutral
				title = return_hostage_interaction_notification
				left_icon = scope:hostage
				right_icon = scope:home_court
				show_as_tooltip = {
					bp2_return_hostage_effect = { HOSTAGE = scope:hostage }
				}
			}
			if = {
				limit = { has_character_flag = flag_hostile_actions_disabled_delay }
				remove_character_flag = flag_hostile_actions_disabled_delay
			}
		}
		# Notify home court with letter event
		scope:home_court = {
			trigger_event = { id = char_interaction.0320 }
		}
	}

	ai_targets = {
		ai_recipients = neighboring_rulers
		ai_recipients = peer_vassals
		ai_recipients = vassals
		ai_recipients = liege
		ai_recipients = family # Redirects
	}

	ai_frequency_by_tier = {
		barony = 0
		county = 60
		duchy = 36
		kingdom = 36
		empire = 36
		hegemony = 36
	}

	ai_will_do = {
		base = 0
		modifier = {
			NOR = {
				# Alliances
				is_allied_to = scope:recipient
				is_spouse_of = scope:recipient
				# Protected by liege
				AND = {
					OR = {
						top_liege != this
						scope:recipient = { top_liege != this }
					}
					top_liege != scope:recipient.top_liege
				}
				# Adult hostage been here awhile and we are not in immiment danger
				AND = {
					any_warden_hostage = {
						age >= 20
						hostage_duration = { years >= 5 }
					}
					NOT = {
						scope:recipient = {
							has_any_cb_on = scope:actor
							scope:recipient.current_strength_with_allies_fifty_percent_value > scope:actor.current_strength_with_allies_value
						}
					}
				}
			}
			factor = 0
		}
		opinion_modifier = { # Opinion Factor
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 0.5
			desc = AI_OPINION_REASON
		}
		modifier = {
			add = 25
			scope:actor = {
				has_any_cb_on = scope:recipient
				scope:actor.current_strength_with_allies_fifty_percent_value > scope:recipient.current_strength_with_allies_value
			}
		}
		modifier = {
			scope:recipient = {
				OR = {
					is_allied_to = scope:actor
					is_spouse_of = scope:recipient
				}
			}
			add = 50
		}
		modifier = {
			scope:recipient = {
				has_any_cb_on = scope:actor
				scope:recipient.current_strength_with_allies_fifty_percent_value > scope:actor.current_strength_with_allies_value
			}
			add = -50
		}
		bp2_hostage_return_personality_modifier = {
			WARDEN = scope:actor
			HOME_COURT = scope:recipient
		}
		# Cultural traditions
		modifier = {
			scope:actor.culture = { has_cultural_tradition = tradition_equitable }
			add = 25
		}
		modifier = {
			scope:actor.culture = { has_cultural_tradition = tradition_esteemed_hospitality }
			add = 25
		}
		modifier = {
			scope:actor = {
				is_vassal_of = scope:recipient
				culture = { has_cultural_tradition = tradition_loyal_soldiers }
			}
			add = 25
			desc = HOSTAGE_CULTURAL_TRADITION_REASON
		}
		#DO NOT SEND BACK FRANKOKRATIA CLAIMANT
		modifier = {
			scope:hostage ?= {
				has_character_flag = byz_claimant_flag
			}
			exists = global_var:byz_claimant_champion
			factor = 0
		}
	}

	send_options_exclusive = no

	show_effects_in_notification = no
	greeting = positive

	notification_text = {
	}
}

### Recall hostage - bilateral
# actor = home_court
# recipient = warden
# secondary_recipient = hostage
recall_hostage_interaction = {
	category = interaction_category_diplomacy
	common_interaction = no
	popup_on_receive = yes
	pause_on_receive = yes
	icon = icon_hostage

	desc = recall_hostage_interaction_desc

	populate_recipient_list = {
		scope:actor = {
			every_home_court_hostage = {
				limit = { warden ?= scope:recipient }
				add_to_list = characters
			}
		}
	}

	cost = {}

	is_shown = {
		# AI don't use this interaction at all
		scope:actor = { is_ai = no }
		# Cannot recall hostages from self
		scope:recipient != scope:actor
		# Must have a hostage
		OR = {
			scope:actor = {
				any_home_court_hostage = { warden ?= scope:recipient }
			}
			scope:recipient.home_court ?= scope:actor
		}
	}

	redirect = {
		if = {
			limit = {
				scope:recipient.home_court ?= scope:actor
			}
			scope:recipient = { save_scope_as = secondary_recipient }
			scope:recipient.warden = { save_scope_as = recipient }
		}
	}

	is_valid_showing_failures_only = {
		NOR = {
			# Must be at peace
			scope:recipient = { is_at_war_with = scope:actor }
			# Only family oriented governments use hostages
			scope:actor = { government_has_flag = government_is_theocracy }
			scope:recipient = { government_has_flag = government_is_theocracy }
		}
	}

	# whether a character can be picked for the interaction, interface only (e.g. picking the first character in the marriage interaction)
	# in character scope, actor and recipient event targets can be used, but not the secondary characters (because none exist yet)
	can_be_picked = {}

	can_send = {
		NOT = {
			scope:actor = { is_at_war_with = scope:recipient }
		}
	}

	on_send = {}

	on_accept = {
		# Save scopes for clarity
		scope:actor = { save_scope_as = home_court }
		scope:recipient = { save_scope_as = warden }
		scope:secondary_recipient = { save_scope_as = hostage }
		# Send toast informing sender of acceptance
		scope:warden = {
			hidden_effect = {
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = recall_hostage_interaction_notification
					left_icon = scope:hostage
					right_icon = scope:home_court
					show_as_tooltip = {
						bp2_return_hostage_effect = { HOSTAGE = scope:hostage }
					}
				}
			}
		}
		scope:home_court = {
			send_interface_toast = {
				type = event_toast_effect_good
				title = recall_hostage_interaction_notification
				left_icon = scope:hostage
				right_icon = scope:warden
				show_as_tooltip = {
					bp2_return_hostage_effect = { HOSTAGE = scope:hostage }
				}
			}
			if = {
				limit = { has_character_flag = flag_hostile_actions_disabled_delay }
				remove_character_flag = flag_hostile_actions_disabled_delay
			}
		}
		# Notify home court with letter event
		scope:home_court = { trigger_event = char_interaction.0340 }
	}

	on_decline = {
		scope:actor = {
			trigger_event = char_interaction.0341
		}
	}

	ai_accept = {
		base = 0

		######### PERSONALITY

		bp2_hostage_return_personality_modifier = {
			HOME_COURT = scope:actor
			WARDEN = scope:recipient
		}

		######### OPINION

		opinion_modifier = { # Opinion Factor
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 0.5
			desc = AI_OPINION_REASON
		}
		opinion_modifier = { # Opinion Factor
			who = scope:recipient
			opinion_target = scope:secondary_recipient
			multiplier = -0.1
			desc = AI_OPINION_REASON
		}

		######### RELATIONS

		bp2_hostage_relation_modifier = yes

		######### DREAD

		modifier = {
			add = intimidated_halved_reason_value
			scope:recipient = {
				has_dread_level_towards = {
					target = scope:actor
					level = 1
				}
			}
			desc = INTIMIDATED_REASON
		}
		modifier = {
			add = cowed_halved_reason_value
			scope:recipient = {
				has_dread_level_towards = {
					target = scope:actor
					level = 2
				}
			}
			desc = COWED_REASON
		}

		######### HOSTAGE IMPORTANCE

		modifier = {
			exists = scope:secondary_recipient
			add = interaction_recipient_hostage_value
			desc = HOSTAGE_VALUE_RECIPIENT_REASON
		}

		######### HOSTAGE TIME

		modifier = { # Hostage is grown up
			add = 25
			scope:secondary_recipient = { is_adult = yes }
			desc = HOSTAGE_ADULT_REASON
		}
		modifier = { # Time as a hostage
			add = -25
			scope:secondary_recipient = {
				hostage_duration = { years < 1 }
			}
			desc = HOSTAGE_MINIMUM_STAY_REASON
		}
		modifier = { # Time as a hostage
			add = {
				value = 10
				scope:secondary_recipient = {
					if = {
						limit = {
							hostage_duration = { years >= 3 }
						}
						add = 10
					}
					if = {
						limit = {
							hostage_duration = { years >= 4 }
						}
						add = 10
					}
					if = {
						limit = {
							hostage_duration = { years >= 5 }
						}
						add = 10
					}
					if = {
						limit = {
							hostage_duration = { years >= 6 }
						}
						add = 10
					}
					if = {
						limit = {
							hostage_duration = { years >= 7 }
						}
						add = 10
					}
					if = {
						limit = {
							hostage_duration = { years >= 8 }
						}
						add = 10
					}
					if = {
						limit = {
							hostage_duration = { years >= 9 }
						}
						add = 10
					}
					if = {
						limit = {
							hostage_duration = { years >= 10 }
						}
						add = 10
					}
				}
			}
			scope:secondary_recipient = {
				hostage_duration = { years >= 2 }
			}
			desc = HOSTAGE_DURATION_REASON
		}

		######### RELATIVE POWER

		bp2_hostage_recall_tier_neighbor_modifier = { # Realm relative position
			RECALLER = scope:actor
			WARDEN = scope:recipient
		}
		bp2_hostage_claims_casus_bellis_modifier = { # Desire for land/war
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}
		bp2_hostage_recall_vassals_lieges_modifier = { # Political situation
			RECALLER = scope:actor
			WARDEN = scope:recipient
		}
		bp2_hostage_relative_strength_modifier = { # Relative military strength
			SENDER = scope:recipient
			RECEIVER = scope:actor
		}
		modifier = {
			desc = HOSTAGE_IMMINENT_THREAT_REASON
			scope:actor = { has_any_cb_on = scope:recipient }
			scope:actor.current_strength_with_allies_fifty_percent_value > scope:recipient.current_strength_with_allies_value
			add = -25
		}

		######### CULTURAL DIFFERENCES

		bp2_hostage_culture_faith_modifier = {
			SENDER = scope:actor
			RECEIVER = scope:recipient
		}

		######### CULTURAL TRADITIONS

		modifier = {
			scope:recipient = {
				culture = { has_cultural_tradition = tradition_equitable }
				NOT = {
					any_home_court_hostage = { warden = scope:actor }
				}
			}
			scope:secondary_recipient = {
				hostage_duration = { years >= 2 }
			}
			add = 25
			desc = HOSTAGE_EQUITABLE_TRADITION_REASON
		}
		modifier = {
			scope:recipient = {
				culture = { has_cultural_tradition = tradition_esteemed_hospitality }
				NOT = {
					any_home_court_hostage = { warden = scope:actor }
				}
			}
			scope:secondary_recipient = {
				hostage_duration = { years >= 2 }
			}
			add = 25
			desc = HOSTAGE_ESTEEMED_HOSPITALITY_TRADITION_REASON
		}
		modifier = {
			scope:recipient = {
				is_vassal_of = scope:actor
				culture = { has_cultural_tradition = tradition_loyal_soldiers }
			}
			scope:secondary_recipient = {
				hostage_duration = { years >= 2 }
			}
			add = 25
			desc = HOSTAGE_LOYAL_SUBJECTS_TRADITION_REASON
		}

		######### OTHER

		modifier = { # Hostage died on their watch
			exists = scope:actor.var:hostage_died
			scope:recipient = {
				NOR = {
					var:let_my_hostage_die ?= scope:actor
					has_opinion_modifier = {
						target = scope:actor
						modifier = killed_hostage_opinion
					}
				}
			}
			desc = HOSTAGE_PREVIOUSLY_DIED_REASON
			add = -25
		}
		modifier = { # MY Hostage died on their watch
			scope:recipient = {
				var:let_my_hostage_die ?= scope:actor
				NOT = {
					has_opinion_modifier = {
						target = scope:actor
						modifier = killed_hostage_opinion
					}
				}
			}
			desc = HOSTAGE_PREVIOUSLY_DIED_HOME_COURT_REASON
			add = -100
		}
		modifier = { # Killed my hostage!!!
			scope:recipient = {
				has_opinion_modifier = {
					target = scope:actor
					modifier = killed_hostage_opinion
				}
			}
			desc = HOSTAGE_KILLED_REASON
			add = -200
		}
		modifier = { # Already have a truce
			scope:actor ?= { has_truce = scope:recipient }
			desc = HOSTAGE_ACTOR_EXISTING_TRUCE_REASON
			add = 20
		}
		modifier = { # Already fighting a war
			scope:recipient ?= { is_at_war = yes }
			desc = HOSTAGE_AT_WAR_REASON
			add = -25
		}
		modifier = { # Attacked a hostage's home court
			add = -50
			scope:actor = { has_character_modifier = attacked_home_court }
			desc = attacked_home_court
		}
		modifier = {
			scope:hook = yes
			add = 40
			desc = SCHEME_WEAK_HOOK_USED
		}
		modifier = { # Has my hostage
			add = -50
			scope:recipient = {
				any_home_court_hostage = { warden = scope:actor }
			}
			desc = HOSTAGE_HAS_MINE_REASON
		}
		#DO NOT SEND BACK FRANKOKRATIA CLAIMANT
		modifier = {
			desc = crusading_claim_cb_reason
			scope:hostage = {
				has_character_flag = byz_claimant_flag
			}
			exists = global_var:byz_claimant_champion
			add = -5000
		}
	}

	auto_accept = {
		trigger_if = {
			limit = {
				scope:hook ?= yes
				scope:actor = { has_strong_hook = scope:recipient }
			}
			custom_description = {
				text = "spending_hook"
				subject = scope:actor
				object = scope:recipient
				scope:hook ?= yes
				scope:actor = { has_strong_hook = scope:recipient }
			}
		}
		trigger_else = { always = no }
	}

	can_be_blocked = {
		custom_description = { #Hook from Recipient can counteract, but only if Actor is not forcing the action via Strong Hook.
			text = "spending_hook"
			subject = scope:recipient
			object = scope:actor
			scope:recipient = { has_hook = scope:actor }
			NAND = {
				scope:hook = yes
				scope:actor = { has_strong_hook = scope:recipient }
			}
		}
	}

	on_blocked_effect = {
		scope:recipient = {
			remove_hook = { target = scope:actor }
		}
	}

	send_option = {
		is_valid = {
			scope:actor = { has_usable_hook = scope:recipient }
		}
		flag = hook
		localization = SCHEME_HOOK
	}
	should_use_extra_icon = {
		scope:actor = { has_usable_hook = scope:recipient }
	}
	extra_icon = "gfx/interface/icons/character_interactions/hook_icon.dds"

	send_options_exclusive = no

	show_effects_in_notification = yes
	greeting = positive

	notification_text = RECALL_HOSTAGE_PROPOSAL
}

### Trait interaction for guardians
# actor = guardian
# recipient = ward/hostage
# This has to be update every time a new trait is added to the game, otherwise you won't be able to pass it down
influence_child_personality_interaction = {
	category = interaction_category_friendly
	common_interaction = yes
	interface_priority = 60
	icon = child
	ai_maybe = yes
	ai_min_reply_days = 4
	ai_max_reply_days = 9
	can_send_despite_rejection = yes
	popup_on_receive = yes
	pause_on_receive = yes

	pre_answer_maybe_key = ANSWER_MIGHT_SUCCEED
	pre_answer_no_key = ANSWER_CANT_SUCCEED
	pre_answer_yes_key = ANSWER_WILL_SUCCEED
	pre_answer_maybe_breakdown_key = ANSWER_SUM_CHANCE

	desc = influence_child_personality_interaction_desc

	is_shown = { #any  ai ward/hostage
		has_bp2_dlc_trigger = yes
		scope:recipient = {
			is_ai = yes
			is_adult = no
			OR = {
				scope:actor = { has_relation_ward = scope:recipient }
				is_hostage_of = scope:actor
			}
		}
	}

	is_valid_showing_failures_only = {
		scope:recipient = { #be old enough to talk and have some room for new personlaity traits
			age >= 4
			custom_description = {
				text = influence_child_personality_interaction_trait_limit
				number_of_personality_traits < 4
			}
			#checking all trait individually through the set scope in order to catch if all of your traits are either the same or opposite
			custom_description = {
				text = influence_child_personality_interaction_all_same_traits
				switch = {
					trigger = yes
					scope:lustful = {
						scope:recipient = { NOT = { has_trait = lustful } }
					}
					scope:chaste = {
						scope:recipient = { NOT = { has_trait = chaste } }
					}
					scope:gluttonous = {
						scope:recipient = { NOT = { has_trait = gluttonous } }
					}
					scope:temperate = {
						scope:recipient = { NOT = { has_trait = temperate } }
					}
					scope:greedy = {
						scope:recipient = { NOT = { has_trait = greedy } }
					}
					scope:generous = {
						scope:recipient = { NOT = { has_trait = generous } }
					}
					scope:lazy = {
						scope:recipient = { NOT = { has_trait = lazy } }
					}
					scope:diligent = {
						scope:recipient = { NOT = { has_trait = diligent } }
					}
					scope:wrathful = {
						scope:recipient = { NOT = { has_trait = wrathful } }
					}
					scope:calm = {
						scope:recipient = { NOT = { has_trait = calm } }
					}
					scope:patient = {
						scope:recipient = { NOT = { has_trait = patient } }
					}
					scope:impatient = {
						scope:recipient = { NOT = { has_trait = impatient } }
					}
					scope:arrogant = {
						scope:recipient = { NOT = { has_trait = arrogant } }
					}
					scope:humble = {
						scope:recipient = { NOT = { has_trait = humble } }
					}
					scope:deceitful = {
						scope:recipient = { NOT = { has_trait = deceitful } }
					}
					scope:honest = {
						scope:recipient = { NOT = { has_trait = honest } }
					}
					scope:craven = {
						scope:recipient = { NOT = { has_trait = craven } }
					}
					scope:brave = {
						scope:recipient = { NOT = { has_trait = brave } }
					}
					scope:shy = {
						scope:recipient = { NOT = { has_trait = shy } }
					}
					scope:gregarious = {
						scope:recipient = { NOT = { has_trait = gregarious } }
					}
					scope:ambitious = {
						scope:recipient = { NOT = { has_trait = ambitious } }
					}
					scope:content = {
						scope:recipient = { NOT = { has_trait = content } }
					}
					scope:arbitrary = {
						scope:recipient = { NOT = { has_trait = arbitrary } }
					}
					scope:just = {
						scope:recipient = { NOT = { has_trait = just } }
					}
					scope:cynical = {
						scope:recipient = { NOT = { has_trait = cynical } }
					}
					scope:zealous = {
						scope:recipient = { NOT = { has_trait = zealous } }
					}
					scope:paranoid = {
						scope:recipient = { NOT = { has_trait = paranoid } }
					}
					scope:trusting = {
						scope:recipient = { NOT = { has_trait = trusting } }
					}
					scope:compassionate = {
						scope:recipient = { NOT = { has_trait = compassionate } }
					}
					scope:callous = {
						scope:recipient = { NOT = { has_trait = callous } }
					}
					scope:sadistic = {
						scope:recipient = { NOT = { has_trait = sadistic } }
					}
					scope:stubborn = {
						scope:recipient = { NOT = { has_trait = stubborn } }
					}
					scope:fickle = {
						scope:recipient = { NOT = { has_trait = fickle } }
					}
					scope:eccentric = {
						scope:recipient = { NOT = { has_trait = eccentric } }
					}
					scope:vengeful = {
						scope:recipient = { NOT = { has_trait = vengeful } }
					}
					scope:forgiving = {
						scope:recipient = { NOT = { has_trait = forgiving } }
					}
				}
			}
		}
		scope:actor = {
			is_adult = yes
			number_of_personality_traits >= 1 #just in case you have to have at least some personality
		}
	}

	cooldown_against_recipient = { years = 3 }

	can_send = {
	}
	#each option is shown if the actor has the corresponding trait and valid if recipient don't have it yet or don't have an opposite trait
	send_option = {
		is_shown = {
			scope:actor = { has_trait = lustful }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = lustful
					trait:lustful = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
					has_sexuality = none
					has_sexuality = asexual
				}
			}
		}
		flag = lustful
		localization = trait_lustful
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = chaste }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = chaste
					trait:chaste = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
					has_sexuality = none
					has_sexuality = asexual
				}
			}
		}
		flag = chaste
		localization = trait_chaste
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = gluttonous }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = gluttonous
					trait:gluttonous = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = gluttonous
		localization = trait_gluttonous
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = temperate }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = temperate
					trait:temperate = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = temperate
		localization = trait_temperate
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = greedy }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = greedy
					trait:greedy = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = greedy
		localization = trait_greedy
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = generous }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = generous
					trait:generous = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = generous
		localization = trait_generous
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = lazy }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = lazy
					trait:lazy = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = lazy
		localization = trait_lazy
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = diligent }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = diligent
					trait:diligent = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = diligent
		localization = trait_diligent
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = wrathful }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = wrathful
					trait:wrathful = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = wrathful
		localization = trait_wrathful
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = calm }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = calm
					trait:calm = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = calm
		localization = trait_calm
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = patient }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = patient
					trait:patient = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = patient
		localization = trait_patient
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = impatient }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = impatient
					trait:impatient = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = impatient
		localization = trait_impatient
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = arrogant }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = arrogant
					trait:arrogant = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = arrogant
		localization = trait_arrogant
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = humble }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = humble
					trait:humble = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = humble
		localization = trait_humble
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = deceitful }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = deceitful
					trait:deceitful = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = deceitful
		localization = trait_deceitful
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = honest }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = honest
					trait:honest = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = honest
		localization = trait_honest
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = craven }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = craven
					trait:craven = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = craven
		localization = trait_craven
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = brave }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = brave
					trait:brave = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = brave
		localization = trait_brave
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = shy }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = shy
					trait:shy = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = shy
		localization = trait_shy
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = gregarious }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = gregarious
					trait:gregarious = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = gregarious
		localization = trait_gregarious
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = ambitious }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = ambitious
					trait:ambitious = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = ambitious
		localization = trait_ambitious
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = content }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = content
					trait:content = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = content
		localization = trait_content
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = arbitrary }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = arbitrary
					trait:arbitrary = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = arbitrary
		localization = trait_arbitrary
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = just }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = just
					trait:just = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = just
		localization = trait_just
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = cynical }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = cynical
					trait:cynical = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = cynical
		localization = trait_cynical
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = zealous }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = zealous
					trait:zealous = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = zealous
		localization = trait_zealous
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = paranoid }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = paranoid
					trait:paranoid = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = paranoid
		localization = trait_paranoid
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = trusting }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = trusting
					trait:trusting = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = trusting
		localization = trait_trusting
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = compassionate }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = compassionate
					trait:compassionate = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = compassionate
		localization = trait_compassionate
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = callous }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = callous
					trait:callous = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = callous
		localization = trait_callous
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = sadistic }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = sadistic
					trait:sadistic = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = sadistic
		localization = trait_sadistic
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = stubborn }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = stubborn
					trait:stubborn = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = stubborn
		localization = trait_stubborn
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = fickle }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = fickle
					trait:fickle = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = fickle
		localization = trait_fickle
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = eccentric }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = eccentric
					trait:eccentric = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = eccentric
		localization = trait_eccentric
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = vengeful }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = vengeful
					trait:vengeful = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = vengeful
		localization = trait_vengeful
	}
	send_option = {
		is_shown = {
			scope:actor = { has_trait = forgiving }
		}
		is_valid = {
			scope:recipient = {
				NOR = {
					has_trait = forgiving
					trait:forgiving = {
						any_opposite_trait = {
							scope:recipient = { has_trait = prev }
						}
					}
				}
			}
		}
		flag = forgiving
		localization = trait_forgiving
	}

	send_options_exclusive = yes

	on_send = {
		switch = {#save which trait was chosen as scope:target_trait
			trigger = yes
			scope:lustful = {
				trait:lustful = { save_scope_as = target_trait }
			}
			scope:chaste = {
				trait:chaste = { save_scope_as = target_trait }
			}
			scope:gluttonous = {
				trait:gluttonous = { save_scope_as = target_trait }
			}
			scope:temperate = {
				trait:temperate = { save_scope_as = target_trait }
			}
			scope:greedy = {
				trait:greedy = { save_scope_as = target_trait }
			}
			scope:generous = {
				trait:generous = { save_scope_as = target_trait }
			}
			scope:lazy = {
				trait:lazy = { save_scope_as = target_trait }
			}
			scope:diligent = {
				trait:diligent = { save_scope_as = target_trait }
			}
			scope:wrathful = {
				trait:wrathful = { save_scope_as = target_trait }
			}
			scope:calm = {
				trait:calm = { save_scope_as = target_trait }
			}
			scope:patient = {
				trait:patient = { save_scope_as = target_trait }
			}
			scope:impatient = {
				trait:impatient = { save_scope_as = target_trait }
			}
			scope:arrogant = {
				trait:arrogant = { save_scope_as = target_trait }
			}
			scope:humble = {
				trait:humble = { save_scope_as = target_trait }
			}
			scope:deceitful = {
				trait:deceitful = { save_scope_as = target_trait }
			}
			scope:honest = {
				trait:honest = { save_scope_as = target_trait }
			}
			scope:craven = {
				trait:craven = { save_scope_as = target_trait }
			}
			scope:brave = {
				trait:brave = { save_scope_as = target_trait }
			}
			scope:shy = {
				trait:shy = { save_scope_as = target_trait }
			}
			scope:gregarious = {
				trait:gregarious = { save_scope_as = target_trait }
			}
			scope:ambitious = {
				trait:ambitious = { save_scope_as = target_trait }
			}
			scope:content = {
				trait:content = { save_scope_as = target_trait }
			}
			scope:arbitrary = {
				trait:arbitrary = { save_scope_as = target_trait }
			}
			scope:just = {
				trait:just = { save_scope_as = target_trait }
			}
			scope:cynical = {
				trait:cynical = { save_scope_as = target_trait }
			}
			scope:zealous = {
				trait:zealous = { save_scope_as = target_trait }
			}
			scope:paranoid = {
				trait:paranoid = { save_scope_as = target_trait }
			}
			scope:trusting = {
				trait:trusting = { save_scope_as = target_trait }
			}
			scope:compassionate = {
				trait:compassionate = { save_scope_as = target_trait }
			}
			scope:callous = {
				trait:callous = { save_scope_as = target_trait }
			}
			scope:sadistic = {
				trait:sadistic = { save_scope_as = target_trait }
			}
			scope:stubborn = {
				trait:stubborn = { save_scope_as = target_trait }
			}
			scope:fickle = {
				trait:fickle = { save_scope_as = target_trait }
			}
			scope:eccentric = {
				trait:eccentric = { save_scope_as = target_trait }
			}
			scope:vengeful = {
				trait:vengeful = { save_scope_as = target_trait }
			}
			scope:forgiving = {
				trait:forgiving = { save_scope_as = target_trait }
			}
			fallback = {
				scope:actor = {
					random_character_trait = {
						limit = { has_trait_category = personality }
						save_scope_as = target_trait
					}
				}
			}
		}
	}

	on_accept = {
		scope:actor = {
			# Trait you're trying to make your ward gained is saved as scope:target_trait
			trigger_event = bp2_character_interaction.1001
			show_as_tooltip = {
				add_prestige = minor_prestige_loss
				add_stress = minor_stress_gain
				add_opinion = {
					target = scope:recipient
					modifier = pleased_opinion
					opinion = 20
				}
			}
		}
		scope:recipient = {
			show_as_tooltip = {
				switch = {#save which trait was chosen as scope:target_trait
					trigger = yes
					scope:lustful = {
						trait:lustful = { save_scope_as = target_trait }
					}
					scope:chaste = {
						trait:chaste = { save_scope_as = target_trait }
					}
					scope:gluttonous = {
						trait:gluttonous = { save_scope_as = target_trait }
					}
					scope:temperate = {
						trait:temperate = { save_scope_as = target_trait }
					}
					scope:greedy = {
						trait:greedy = { save_scope_as = target_trait }
					}
					scope:generous = {
						trait:generous = { save_scope_as = target_trait }
					}
					scope:lazy = {
						trait:lazy = { save_scope_as = target_trait }
					}
					scope:diligent = {
						trait:diligent = { save_scope_as = target_trait }
					}
					scope:wrathful = {
						trait:wrathful = { save_scope_as = target_trait }
					}
					scope:calm = {
						trait:calm = { save_scope_as = target_trait }
					}
					scope:patient = {
						trait:patient = { save_scope_as = target_trait }
					}
					scope:impatient = {
						trait:impatient = { save_scope_as = target_trait }
					}
					scope:arrogant = {
						trait:arrogant = { save_scope_as = target_trait }
					}
					scope:humble = {
						trait:humble = { save_scope_as = target_trait }
					}
					scope:deceitful = {
						trait:deceitful = { save_scope_as = target_trait }
					}
					scope:honest = {
						trait:honest = { save_scope_as = target_trait }
					}
					scope:craven = {
						trait:craven = { save_scope_as = target_trait }
					}
					scope:brave = {
						trait:brave = { save_scope_as = target_trait }
					}
					scope:shy = {
						trait:shy = { save_scope_as = target_trait }
					}
					scope:gregarious = {
						trait:gregarious = { save_scope_as = target_trait }
					}
					scope:ambitious = {
						trait:ambitious = { save_scope_as = target_trait }
					}
					scope:content = {
						trait:content = { save_scope_as = target_trait }
					}
					scope:arbitrary = {
						trait:arbitrary = { save_scope_as = target_trait }
					}
					scope:just = {
						trait:just = { save_scope_as = target_trait }
					}
					scope:cynical = {
						trait:cynical = { save_scope_as = target_trait }
					}
					scope:zealous = {
						trait:zealous = { save_scope_as = target_trait }
					}
					scope:paranoid = {
						trait:paranoid = { save_scope_as = target_trait }
					}
					scope:trusting = {
						trait:trusting = { save_scope_as = target_trait }
					}
					scope:compassionate = {
						trait:compassionate = { save_scope_as = target_trait }
					}
					scope:callous = {
						trait:callous = { save_scope_as = target_trait }
					}
					scope:sadistic = {
						trait:sadistic = { save_scope_as = target_trait }
					}
					scope:stubborn = {
						trait:stubborn = { save_scope_as = target_trait }
					}
					scope:fickle = {
						trait:fickle = { save_scope_as = target_trait }
					}
					scope:eccentric = {
						trait:eccentric = { save_scope_as = target_trait }
					}
					scope:vengeful = {
						trait:vengeful = { save_scope_as = target_trait }
					}
					scope:forgiving = {
						trait:forgiving = { save_scope_as = target_trait }
					}
				}
				if = {
					limit = { exists = scope:target_trait }
					add_trait = scope:target_trait
				}
				add_opinion = {
					target = scope:actor
					modifier = admiration_opinion
					opinion = 20
				}
			}
		}
	}

	on_decline = {
		scope:actor = {
			# Trait you're trying to make your ward gained is saved as scope:target_trait
			trigger_event = bp2_character_interaction.1002
			show_as_tooltip = {
				add_prestige = minor_prestige_loss
				add_stress = medium_stress_gain
				add_opinion = {
					target = scope:recipient
					modifier = disappointed_opinion
					opinion = -20
				}
			}
		}
		scope:recipient = {
			show_as_tooltip = {
				add_opinion = {
					target = scope:actor
					modifier = confused_opinion
					opinion = -20
				}
			}
		}
	}

	auto_accept = no

	ai_accept = {
		base = 0 # Try to make it 0 for most interactions
		opinion_modifier = { # Opinion Factor
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 0.5
			desc = AI_OPINION_REASON
		}

		modifier = { # Perk boost
			desc = influence_children_groomed_to_rule_perk_tt
			trigger = {
				scope:actor = { has_perk = groomed_to_rule_perk }
			}
			add = groomed_to_rule_value
		}

		modifier = { #more likely if you already have something in common
			add = {
				value = 5
				if = {
					limit = {
						number_of_personality_traits_in_common = {
							target = scope:recipient
							value = 2
						}
					}
					multiply = 2
				}
				else_if = {
					limit = {
						number_of_personality_traits_in_common = {
							target = scope:recipient
							value = 3
						}
					}
					multiply = 3
				}
			}
			number_of_personality_traits_in_common = {
				target = scope:recipient
				value >= 1
			}
			desc = we_are_alike_tt
		}

		modifier = { #less likely if you already have opposite traits
			add = {
				value = -5
				if = {
					limit = {
						scope:recipient = {
							number_of_opposing_personality_traits = {
								target = scope:actor
								value = 2
							}
						}
					}
					multiply = 2
				}
				else_if = {
					limit = {
						scope:recipient = {
							number_of_opposing_personality_traits = {
								target = scope:actor
								value = 3
							}
						}
					}
					multiply = 3
				}
			}
			scope:recipient = {
				number_of_opposing_personality_traits = {
					target = scope:actor
					value >= 1
				}
			}
			desc = we_are_NOT_alike_tt
		}

		modifier = { #adding your knowledge
			add = {
				value = scope:actor.learning
				multiply = 0.5
			}
			desc = HAS_LEARNING_SKILL_REASON
		}

		modifier = { #adding your oratory skills
			add = {
				value = scope:actor.diplomacy
				multiply = 0.5
			}
			desc = HAS_DIPLOMACY_SKILL_REASON
		}

		modifier = { #more likely with a Wet Nurse employed
			exists = scope:actor.court_position:wet_nurse_court_position
			add = 10
			desc = HAS_WET_NURSE_REASON
		}

		modifier = { #more likely if chosen trait is a virtue in recipients faith
			add = 10
			switch = {
				trigger = yes
				scope:sadistic = {
					scope:recipient.faith = {
						trait_is_virtue = trait:sadistic
					}
				}
				scope:lustful = {
					scope:recipient.faith = {
						trait_is_virtue = trait:lustful
					}
				}
				scope:chaste = {
					scope:recipient.faith = {
						trait_is_virtue = trait:chaste
					}
				}
				scope:gluttonous = {
					scope:recipient.faith = {
						trait_is_virtue = trait:gluttonous
					}
				}
				scope:temperate = {
					scope:recipient.faith = {
						trait_is_virtue = trait:temperate
					}
				}
				scope:greedy = {
					scope:recipient.faith = {
						trait_is_virtue = trait:greedy
					}
				}
				scope:generous = {
					scope:recipient.faith = {
						trait_is_virtue = trait:generous
					}
				}
				scope:lazy = {
					scope:recipient.faith = {
						trait_is_virtue = trait:lazy
					}
				}
				scope:diligent = {
					scope:recipient.faith = {
						trait_is_virtue = trait:diligent
					}
				}
				scope:wrathful = {
					scope:recipient.faith = {
						trait_is_virtue = trait:wrathful
					}
				}
				scope:calm = {
					scope:recipient.faith = {
						trait_is_virtue = trait:calm
					}
				}
				scope:patient = {
					scope:recipient.faith = {
						trait_is_virtue = trait:patient
					}
				}
				scope:impatient = {
					scope:recipient.faith = {
						trait_is_virtue = trait:impatient
					}
				}
				scope:arrogant = {
					scope:recipient.faith = {
						trait_is_virtue = trait:arrogant
					}
				}
				scope:humble = {
					scope:recipient.faith = {
						trait_is_virtue = trait:humble
					}
				}
				scope:deceitful = {
					scope:recipient.faith = {
						trait_is_virtue = trait:deceitful
					}
				}
				scope:honest = {
					scope:recipient.faith = {
						trait_is_virtue = trait:honest
					}
				}
				scope:craven = {
					scope:recipient.faith = {
						trait_is_virtue = trait:craven
					}
				}
				scope:brave = {
					scope:recipient.faith = {
						trait_is_virtue = trait:brave
					}
				}
				scope:shy = {
					scope:recipient.faith = {
						trait_is_virtue = trait:shy
					}
				}
				scope:gregarious = {
					scope:recipient.faith = {
						trait_is_virtue = trait:gregarious
					}
				}
				scope:ambitious = {
					scope:recipient.faith = {
						trait_is_virtue = trait:ambitious
					}
				}
				scope:content = {
					scope:recipient.faith = {
						trait_is_virtue = trait:content
					}
				}
				scope:arbitrary = {
					scope:recipient.faith = {
						trait_is_virtue = trait:arbitrary
					}
				}
				scope:just = {
					scope:recipient.faith = {
						trait_is_virtue = trait:just
					}
				}
				scope:cynical = {
					scope:recipient.faith = {
						trait_is_virtue = trait:cynical
					}
				}
				scope:zealous = {
					scope:recipient.faith = {
						trait_is_virtue = trait:zealous
					}
				}
				scope:paranoid = {
					scope:recipient.faith = {
						trait_is_virtue = trait:paranoid
					}
				}
				scope:trusting = {
					scope:recipient.faith = {
						trait_is_virtue = trait:trusting
					}
				}
				scope:compassionate = {
					scope:recipient.faith = {
						trait_is_virtue = trait:compassionate
					}
				}
				scope:callous = {
					scope:recipient.faith = {
						trait_is_virtue = trait:callous
					}
				}
				scope:stubborn = {
					scope:recipient.faith = {
						trait_is_virtue = trait:stubborn
					}
				}
				scope:fickle = {
					scope:recipient.faith = {
						trait_is_virtue = trait:fickle
					}
				}
				scope:eccentric = {
					scope:recipient.faith = {
						trait_is_virtue = trait:eccentric
					}
				}
				scope:vengeful = {
					scope:recipient.faith = {
						trait_is_virtue = trait:vengeful
					}
				}
				scope:forgiving = {
					scope:recipient.faith = {
						trait_is_virtue = trait:forgiving
					}
				}
			}
			desc = selected_virtuous_trait_tt
		}

		modifier = { #more likely if chosen trait is compatible with recipients childhood personality
			add = 15
			switch = {
				trigger = yes
				scope:sadistic = {
					scope:recipient = {
						OR = {
							has_trait = curious
							has_trait = rowdy
						}
					}
				}
				scope:lustful = {
					scope:recipient = {
						OR = {
							has_trait = curious
							has_trait = rowdy
						}
					}
				}
				scope:chaste = {
					scope:recipient = {
						has_trait = pensive
					}
				}
				scope:gluttonous = {
					scope:recipient = {
						OR = {
							has_trait = curious
							has_trait = rowdy
						}
					}
				}
				scope:temperate = {
					scope:recipient = {
						OR = {
							has_trait = pensive
							has_trait = charming
						}
					}
				}
				scope:greedy = {
					scope:recipient = {
						OR = {
							has_trait = bossy
							has_trait = rowdy
						}
					}
				}
				scope:generous = {
					scope:recipient = {
						OR = {
							has_trait = charming
							has_trait = curious
						}
					}
				}
				scope:lazy = {
					scope:recipient = {
						has_trait = rowdy
					}
				}
				scope:diligent = {
					scope:recipient = {
						OR = {
							has_trait = pensive
							has_trait = curious
						}
					}
				}
				scope:wrathful = {
					scope:recipient = {
						OR = {
							has_trait = bossy
							has_trait = rowdy
						}
					}
				}
				scope:calm = {
					scope:recipient = {
						has_trait = pensive
					}
				}
				scope:patient = {
					scope:recipient = {
						has_trait = pensive
					}
				}
				scope:impatient = {
					scope:recipient = {
						OR = {
							has_trait = bossy
							has_trait = rowdy
						}
					}
				}
				scope:arrogant = {
					scope:recipient = {
						OR = {
							has_trait = bossy
							has_trait = rowdy
						}
					}
				}
				scope:humble = {
					scope:recipient = {
						has_trait = pensive
					}
				}
				scope:deceitful = {
					scope:recipient = {
						OR = {
							has_trait = bossy
							has_trait = charming
						}
					}
				}
				scope:honest = {
					scope:recipient = {
						OR = {
							has_trait = pensive
							has_trait = rowdy
						}
					}
				}
				scope:craven = {
					scope:recipient = {
						has_trait = pensive
					}
				}
				scope:brave = {
					scope:recipient = {
						OR = {
							has_trait = curious
							has_trait = rowdy
						}
					}
				}
				scope:shy = {
					scope:recipient = {
						has_trait = pensive
					}
				}
				scope:gregarious = {
					scope:recipient = {
						OR = {
							has_trait = charming
							has_trait = curious
						}
					}
				}
				scope:ambitious = {
					scope:recipient = {
						OR = {
							has_trait = bossy
							has_trait = curious
						}
					}
				}
				scope:content = {
					scope:recipient = {
						OR = {
							has_trait = pensive
							has_trait = charming
						}
					}
				}
				scope:arbitrary = {
					scope:recipient = {
						OR = {
							has_trait = bossy
							has_trait = rowdy
						}
					}
				}
				scope:just = {
					scope:recipient = {
						OR = {
							has_trait = pensive
							has_trait = charming
						}
					}
				}
				scope:cynical = {
					scope:recipient = {
						OR = {
							has_trait = bossy
							has_trait = pensive
						}
					}
				}
				scope:zealous = {
					scope:recipient = {
						OR = {
							has_trait = charming
							has_trait = curious
						}
					}
				}
				scope:paranoid = {
					scope:recipient = {
						OR = {
							has_trait = pensive
							has_trait = rowdy
						}
					}
				}
				scope:trusting = {
					scope:recipient = {
						OR = {
							has_trait = charming
							has_trait = curious
						}
					}
				}
				scope:compassionate = {
					scope:recipient = {
						OR = {
							has_trait = charming
							has_trait = pensive
						}
					}
				}
				scope:callous = {
					scope:recipient = {
						OR = {
							has_trait = bossy
							has_trait = rowdy
						}
					}
				}
				scope:stubborn = {
					scope:recipient = {
						OR = {
							has_trait = bossy
							has_trait = curious
						}
					}
				}
				scope:fickle = {
					scope:recipient = {
						OR = {
							has_trait = curious
							has_trait = rowdy
						}
					}
				}
				scope:eccentric = {
					scope:recipient = {
						OR = {
							has_trait = bossy
							has_trait = charming
							has_trait = curious
						}
					}
				}
				scope:vengeful = {
					scope:recipient = {
						OR = {
							has_trait = bossy
							has_trait = rowdy
						}
					}
				}
				scope:forgiving = {
					scope:recipient = {
						OR = {
							has_trait = charming
							has_trait = curious
						}
					}
				}
			}
			desc = has_compatible_personality_tt
		}

		modifier = { #less likely if chosen trait is incompatible with recipients childhood personality
			add = -15
			switch = {
				trigger = yes
				scope:sadistic = {
					scope:recipient = {
						NOR = {
							has_trait = curious
							has_trait = rowdy
						}
					}
				}
				scope:lustful = {
					scope:recipient = {
						NOR = {
							has_trait = curious
							has_trait = rowdy
						}
					}
				}
				scope:chaste = {
					scope:recipient = {
						NOT = { has_trait = pensive }
					}
				}
				scope:gluttonous = {
					scope:recipient = {
						NOR = {
							has_trait = curious
							has_trait = rowdy
						}
					}
				}
				scope:temperate = {
					scope:recipient = {
						NOR = {
							has_trait = pensive
							has_trait = charming
						}
					}
				}
				scope:greedy = {
					scope:recipient = {
						NOR = {
							has_trait = bossy
							has_trait = rowdy
						}
					}
				}
				scope:generous = {
					scope:recipient = {
						NOR = {
							has_trait = charming
							has_trait = curious
						}
					}
				}
				scope:lazy = {
					scope:recipient = {
						NOT = { has_trait = rowdy }
					}
				}
				scope:diligent = {
					scope:recipient = {
						NOR = {
							has_trait = pensive
							has_trait = curious
						}
					}
				}
				scope:wrathful = {
					scope:recipient = {
						NOR = {
							has_trait = bossy
							has_trait = rowdy
						}
					}
				}
				scope:calm = {
					scope:recipient = {
						NOT = { has_trait = pensive }
					}
				}
				scope:patient = {
					scope:recipient = {
						NOT = { has_trait = pensive }
					}
				}
				scope:impatient = {
					scope:recipient = {
						NOR = {
							has_trait = bossy
							has_trait = rowdy
						}
					}
				}
				scope:arrogant = {
					scope:recipient = {
						NOR = {
							has_trait = bossy
							has_trait = rowdy
						}
					}
				}
				scope:humble = {
					scope:recipient = {
						NOT = { has_trait = pensive }
					}
				}
				scope:deceitful = {
					scope:recipient = {
						NOR = {
							has_trait = bossy
							has_trait = charming
						}
					}
				}
				scope:honest = {
					scope:recipient = {
						NOR = {
							has_trait = pensive
							has_trait = rowdy
						}
					}
				}
				scope:craven = {
					scope:recipient = {
						NOT = { has_trait = pensive }
					}
				}
				scope:brave = {
					scope:recipient = {
						NOR = {
							has_trait = curious
							has_trait = rowdy
						}
					}
				}
				scope:shy = {
					scope:recipient = {
						NOT = { has_trait = pensive }
					}
				}
				scope:gregarious = {
					scope:recipient = {
						NOR = {
							has_trait = charming
							has_trait = curious
						}
					}
				}
				scope:ambitious = {
					scope:recipient = {
						NOR = {
							has_trait = bossy
							has_trait = curious
						}
					}
				}
				scope:content = {
					scope:recipient = {
						NOR = {
							has_trait = pensive
							has_trait = charming
						}
					}
				}
				scope:arbitrary = {
					scope:recipient = {
						NOR = {
							has_trait = bossy
							has_trait = rowdy
						}
					}
				}
				scope:just = {
					scope:recipient = {
						NOR = {
							has_trait = pensive
							has_trait = charming
						}
					}
				}
				scope:cynical = {
					scope:recipient = {
						NOR = {
							has_trait = bossy
							has_trait = pensive
						}
					}
				}
				scope:zealous = {
					scope:recipient = {
						NOR = {
							has_trait = charming
							has_trait = curious
						}
					}
				}
				scope:paranoid = {
					scope:recipient = {
						NOR = {
							has_trait = pensive
							has_trait = rowdy
						}
					}
				}
				scope:trusting = {
					scope:recipient = {
						NOR = {
							has_trait = charming
							has_trait = curious
						}
					}
				}
				scope:compassionate = {
					scope:recipient = {
						NOR = {
							has_trait = charming
							has_trait = pensive
						}
					}
				}
				scope:callous = {
					scope:recipient = {
						NOR = {
							has_trait = bossy
							has_trait = rowdy
						}
					}
				}
				scope:stubborn = {
					scope:recipient = {
						NOR = {
							has_trait = bossy
							has_trait = curious
						}
					}
				}
				scope:fickle = {
					scope:recipient = {
						NOR = {
							has_trait = curious
							has_trait = rowdy
						}
					}
				}
				scope:eccentric = {
					scope:recipient = {
						NOR = {
							has_trait = bossy
							has_trait = charming
							has_trait = curious
						}
					}
				}
				scope:vengeful = {
					scope:recipient = {
						NOR = {
							has_trait = bossy
							has_trait = rowdy
						}
					}
				}
				scope:forgiving = {
					scope:recipient = {
						NOR = {
							has_trait = charming
							has_trait = curious
						}
					}
				}
			}
			desc = has_incompatible_personality_tt
		}

		modifier = { #less likely if chosen trait is a sin in recipients faith
			add = -10
			switch = {
				trigger = yes
				scope:sadistic = {
					scope:recipient.faith = {
						trait_is_sin = trait:sadistic
					}
				}
				scope:lustful = {
					scope:recipient.faith = {
						trait_is_sin = trait:lustful
					}
				}
				scope:chaste = {
					scope:recipient.faith = {
						trait_is_sin = trait:chaste
					}
				}
				scope:gluttonous = {
					scope:recipient.faith = {
						trait_is_sin = trait:gluttonous
					}
				}
				scope:temperate = {
					scope:recipient.faith = {
						trait_is_sin = trait:temperate
					}
				}
				scope:greedy = {
					scope:recipient.faith = {
						trait_is_sin = trait:greedy
					}
				}
				scope:generous = {
					scope:recipient.faith = {
						trait_is_sin = trait:generous
					}
				}
				scope:lazy = {
					scope:recipient.faith = {
						trait_is_sin = trait:lazy
					}
				}
				scope:diligent = {
					scope:recipient.faith = {
						trait_is_sin = trait:diligent
					}
				}
				scope:wrathful = {
					scope:recipient.faith = {
						trait_is_sin = trait:wrathful
					}
				}
				scope:calm = {
					scope:recipient.faith = {
						trait_is_sin = trait:calm
					}
				}
				scope:patient = {
					scope:recipient.faith = {
						trait_is_sin = trait:patient
					}
				}
				scope:impatient = {
					scope:recipient.faith = {
						trait_is_sin = trait:impatient
					}
				}
				scope:arrogant = {
					scope:recipient.faith = {
						trait_is_sin = trait:arrogant
					}
				}
				scope:humble = {
					scope:recipient.faith = {
						trait_is_sin = trait:humble
					}
				}
				scope:deceitful = {
					scope:recipient.faith = {
						trait_is_sin = trait:deceitful
					}
				}
				scope:honest = {
					scope:recipient.faith = {
						trait_is_sin = trait:honest
					}
				}
				scope:craven = {
					scope:recipient.faith = {
						trait_is_sin = trait:craven
					}
				}
				scope:brave = {
					scope:recipient.faith = {
						trait_is_sin = trait:brave
					}
				}
				scope:shy = {
					scope:recipient.faith = {
						trait_is_sin = trait:shy
					}
				}
				scope:gregarious = {
					scope:recipient.faith = {
						trait_is_sin = trait:gregarious
					}
				}
				scope:ambitious = {
					scope:recipient.faith = {
						trait_is_sin = trait:ambitious
					}
				}
				scope:content = {
					scope:recipient.faith = {
						trait_is_sin = trait:content
					}
				}
				scope:arbitrary = {
					scope:recipient.faith = {
						trait_is_sin = trait:arbitrary
					}
				}
				scope:just = {
					scope:recipient.faith = {
						trait_is_sin = trait:just
					}
				}
				scope:cynical = {
					scope:recipient.faith = {
						trait_is_sin = trait:cynical
					}
				}
				scope:zealous = {
					scope:recipient.faith = {
						trait_is_sin = trait:zealous
					}
				}
				scope:paranoid = {
					scope:recipient.faith = {
						trait_is_sin = trait:paranoid
					}
				}
				scope:trusting = {
					scope:recipient.faith = {
						trait_is_sin = trait:trusting
					}
				}
				scope:compassionate = {
					scope:recipient.faith = {
						trait_is_sin = trait:compassionate
					}
				}
				scope:callous = {
					scope:recipient.faith = {
						trait_is_sin = trait:callous
					}
				}
				scope:stubborn = {
					scope:recipient.faith = {
						trait_is_sin = trait:stubborn
					}
				}
				scope:fickle = {
					scope:recipient.faith = {
						trait_is_sin = trait:fickle
					}
				}
				scope:eccentric = {
					scope:recipient.faith = {
						trait_is_sin = trait:eccentric
					}
				}
				scope:vengeful = {
					scope:recipient.faith = {
						trait_is_sin = trait:vengeful
					}
				}
				scope:forgiving = {
					scope:recipient.faith = {
						trait_is_sin = trait:forgiving
					}
				}
			}
			desc = selected_sinful_trait_tt
		}

		modifier = { #more likely if actor is afraid of you
			add = intimidated_halved_reason_value
			scope:recipient = {
				target_is_liege_or_above = scope:actor
				has_dread_level_towards = {
					target = scope:actor
					level = 1
				}
			}
			desc = INTIMIDATED_REASON
		}
		modifier = { #more likely if actor is afraid of you
			add = cowed_halved_reason_value
			scope:recipient = {
				target_is_liege_or_above = scope:actor
				has_dread_level_towards = {
					target = scope:actor
					level = 2
				}
			}
			desc = COWED_REASON
		}
		modifier = { #less likely if actor already has 3 personality traits
			add = -50
			scope:recipient = {
				number_of_personality_traits = 3
			}
			desc = has_three_traits_already
		}
	}

	# AI
	ai_potential = {
		any_relation = { type = ward }
	}
	ai_frequency_by_tier = {
		barony = 0
		county = 36
		duchy = 12
		kingdom = 12
		empire = 12
		hegemony = 12
	}
	ai_targets = {
		ai_recipients = courtiers
	}
	ai_will_do = {
		base = -100
		modifier = { # If the recipient is a player, do not bother sending
			factor = 0
			scope:recipient = {
				is_ai = no
			}
		}
		modifier = { #we don't want characters running around with 4 traits
			add = -100
			scope:recipient = {
				number_of_personality_traits = 3
			}
		}
		modifier = {
			add = 50
			ai_honor > 0
		}
		modifier = {
			add = 50
			ai_compassion > 0
		}
		modifier = {
			add = 50
			ai_sociability > 0
		}
		modifier = {
			add = 50
			ai_boldness > 0
		}
		modifier = {
			add = 50
			scope:paranoid = yes
		}
	}
}

