# Events for handling the Hunt activity

namespace = hunt


############################
## Setup and maintenance events
## 0000-0999
## by Linnéa Thimrén
############################
#hunt.0002 - Create variables etc. (triggered at the same time as hunt.0010)
#hunt.0003 - To apply the effects of the hunt

############################
## Random event chains
## 1000-3999
## by Linnéa Thimrén and Petter Vilberg
############################
#hunt.1001 - Generic hunt, chase the animal!
#hunt.1011 - A vassal rival, or a vassal that doesn't like you, is being an ass
#hunt.1021 - Beautiful Peasant Chain: Meet a beautiful peasant in the forest
#hunt.1023 - You have a dog that helps you to fell an animal

############################
## Random pulse
## 4000-4999
## by Linnéa Thimrén and Petter Vilberg
############################
#hunt.4001 - Chance to fell a beautiful animal
#hunt.4001 - Hunt-guest is about to share a secret when they are interrupted
#hunt.4003 - Run into poachers
#hunt.4004 - You bring down a particularly large animal - I
#hunt.4005 - You bring down a particularly large animal - II
#hunt.4006 - Poor Peasants are foraging in the forest
#hunt.4007 - Run into a rampaging animal
#hunt.4008 - Hunt with your heir
#hunt.4009 - Someone has a murder/abduct scheme against you
#hunt.4010 - Someone has a murder/abduct scheme against a close family member
#hunt.4011 - Your lover has come with, sneak away together
#hunt.4012 - See glimpse of mystical animal
#hunt.4014 - A courtier is injured
#hunt.4015 - You walk in (out?) on lovers
#hunt.4016 - You fake a catch
#hunt.4017 - You get the mystical white animal!!
#hunt.4018 - You get another glimpse of the mystical white animal
#hunt.7001 - Meet local madman

############################
## End-events
## 9000-9999
## by Linnéa Thimrén
############################
#hunt.9001 - Hunt has ended


#Things to use in hunt-events:
	#Variables "good_hunt" and "bad_hunt" to affect the outcome of the hunt
	#The list "potential_hunt_participants" for good ai-characters to use in events
	#select_local_animal_effect or big_animal_effect to find animal



#####################################
#	SETUP AND MAINTENANCE EVENTS	#
#	0000 - 0999						#
#####################################


# Create variables etc. (triggered at the same time as hunt.0010)
hunt.0002 = {
	hidden = yes

	immediate = {
		set_variable = {
			name = hunt_outcome
			value = 0
			days = 400
		}
	}
}


#########################
#	RANDOM EVENT CHAINS	#
#	1000 - 3999			#
#########################

################
#	Generic hunt, chase the animal!
#	by Linnéa Thimrén
#	1001-1003
################
hunt.1001 = {
	type = character_event
	title = hunt.1001.t
	desc = hunt.1001.desc
	theme = hunt_activity
	left_portrait = scope:hunting_courtier_1

	trigger = {
		scope:activity = {
			has_variable_list = potential_hunt_participants
			any_in_list = {
					variable = potential_hunt_participants
					is_alive = yes
					count >= 1
			}
		}
	}

	immediate = {
		select_local_animal_effect = yes
		scope:activity = {
			random_in_list = {
				variable = potential_hunt_participants
				limit = {
					is_alive = yes
				}
				alternative_limit = {
					is_powerful_vassal = yes
				}
				save_scope_as = hunting_courtier_1
			}
			set_variable = {
				name = participant_to_use
				value = scope:hunting_courtier_1
				days = 300
			}
		}
		change_variable = {
			name = hunt_outcome
			add = 1
		}
	}

	option = {
		name = hunt.1001.a
		add_character_flag = {
			flag = dangerous_road
			days = 100
		}
		add_prestige = minor_prestige_gain
		stress_impact = {
			athletic = minor_stress_impact_loss
			patient = medium_stress_impact_gain
			craven = medium_stress_impact_gain
			lazy = medium_stress_impact_gain
			content = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 40
				OR = {
					has_trait = arrogant
					has_trait = brave
					has_trait = impatient
				}
			}
		}
	}

	option = {
		name = hunt.1001.b
		add_character_flag = {
			flag = safe_road
			days = 100
		}
		add_prestige = minor_prestige_loss
		stress_impact = {
			impatient = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
			brave = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 40
				OR = {
					has_trait = craven
					has_trait = lazy
					has_trait = patient
				}
			}
		}
	}
	after = {
		trigger_event = {
			id = hunt.1002
			days = { 10 12 }
		}
	}
}

#Hunt continues (wounded courtier?)
hunt.1002 = {
	type = character_event
	title = hunt.1001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = wounded_courtier
				}
				desc = hunt.1002.desc_wounded_courtier
			}
			desc = hunt.1002.desc
		}
	}
	theme = hunt_activity
	left_portrait = scope:hunting_courtier_1

	immediate = {
		scope:activity = {
			var:participant_to_use = {
				save_scope_as = hunting_courtier_1
			}
		}
		hidden_effect = {
			random_list = {
				50 = {
					modifier = {
						add = 50
						has_character_flag = dangerous_road
					}
					modifier = {
						add = -50
						has_character_flag = safe_road
					}
					add_character_flag = {
						flag = wounded_courtier
						days = 100
					}
					change_variable = {
						name = hunt_outcome
						add = -2
					}
				}
				50 = {
					modifier = {
						add = 10
						has_trait = athletic
					}
					modifier = {
						add = 20
						has_trait = lifestyle_hunter
					}
					compare_modifier = {
						value = prowess
						multiplier = 2
					}
					change_variable = {
						name = hunt_outcome
						add = 2
					}
				}
			}
		}
		if = {
			limit = {
				has_character_flag = wounded_courtier
				scope:hunting_courtier_1 = {
					has_trait_rank = {
						trait = wounded
						rank <= 2
					}
				}
			}
			scope:hunting_courtier_1 = {
				increase_wounds_effect = { REASON = hunting_accident }
			}
		}
	}

	option = { #We ride!
		name = hunt.1002.a
		add_prestige = minor_prestige_gain
		if = {
			limit = {
				scope:hunting_courtier_1 = { is_alive = yes }
				has_character_flag = wounded_courtier
			}
			scope:hunting_courtier_1 = {
				add_opinion = {
					modifier = respect_opinion
					target = root
					opinion = -10
				}
			}
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 40
				OR = {
					has_trait = impatient
					has_trait = callous
					has_trait = sadistic
					opinion = {
						target = scope:hunting_courtier_1
						value <= -10
					}
				}
			}
		}
	}

	option = { #Courtier needs time to recover
		name = hunt.1002.b
		trigger = {
			has_character_flag = wounded_courtier
		}
		scope:hunting_courtier_1 = {
			add_opinion = {
				modifier = helped_me_in_time_of_need
				target = root
			}
		}
		stress_impact = {
			callous = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
			impatient = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 50
				OR = {
					has_trait = compassionate
					opinion = {
						target = scope:hunting_courtier_1
						value >= 20
					}
				}
			}
		}
	}

	after = {
		trigger_event = {
			id = hunt.1003
			days = { hunt_event_delay_min hunt_event_delay_max }
		}
	}
}


#Did you bring the animal down?
hunt.1003 = {
	type = character_event
	title = hunt.1001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = caught_quarry
				}
				desc = hunt.1003.desc_caught
			}
			desc = {
				desc = hunt.1003.desc_not_caught
				first_valid = {
					triggered_desc = {
						trigger = {
							has_character_flag = wounded_courtier
						}
						desc = hunt.1003.desc_injured
					}
					desc = hunt.1003.desc_uninjured
				}
			}
		}
	}
	theme = hunt_activity
	left_portrait = scope:hunting_courtier_1

	immediate = {
		hidden_effect = {
			scope:activity = {
				var:participant_to_use = {
					save_scope_as = hunting_courtier_1
				}
			}
			random_list = {
				70 = {
					modifier = {
						add = 40
						has_character_flag = dangerous_road
					}
					change_variable = {
						name = hunt_outcome
						add = 1
					}
					add_character_flag = caught_quarry
				}
				30 = {
					modifier = {
						add = 40
						has_character_flag = wounded_courtier
					}
					compare_modifier = {
						value = prowess
						multiplier = -2
					}

					change_variable = {
						name = hunt_outcome
						add = -1
					}
				}
			}
		}
	}

	option = { #you got it
		name = hunt.1003.a
		flavor = hunt.1003.a.tt
		trigger = {
			has_character_flag = caught_quarry
		}
		change_variable = {
			name = hunt_outcome
			add = 2
		}
	}

	option = { #nope
		name = hunt.1003.b
		flavor = hunt.1003.b.tt
		trigger = {
			NOT = { has_character_flag = caught_quarry }
		}
		remove_variable = local_animal
	}

	after = {
		scope:activity = { remove_variable = participant_to_use }
		remove_character_flag = wounded_courtier
		remove_character_flag = dangerous_road
		remove_character_flag = safe_road
		remove_character_flag = caught_quarry
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}


#########################
#	A vassal rival, or a powerful vassal that doesn't like you, is being an ass
#	by Linnéa Thimrén
#	1011-1016
#########################
scripted_trigger hunt_1011_nasty_guest_trigger = {
	is_alive = yes
	OR = {
		is_powerful_vassal_of = root
		is_vassal_of = root
	}
	OR = {
		has_relation_rival = root
		has_relation_potential_rival = root
		is_a_faction_leader = yes
		opinion = {
			target = root
			value <= -30
		}
	}
}

scripted_trigger hunt_1011_nice_guest_trigger = {
	is_alive = yes
	NOT = { this = scope:hated_participant }
	NOR = {
		has_relation_friend = scope:hated_participant
		has_relation_lover = scope:hated_participant
	}
	OR = {
		is_spouse_of = root
		has_relation_lover = root
		has_relation_friend = root
		has_relation_potential_friend = root
		root = {
			opinion = {
				target = prev
				value >= 0
			}
		}
	}
}

hunt.1011 = {
	type = character_event
	title = hunt.1011.t
	desc = {
		random_valid = {
			desc = hunt.1011.desc_horse
			desc = hunt.1011.desc_talk
		}
	}
	theme = hunt_activity
	left_portrait = {
		character = scope:hated_participant
		animation = schadenfreude
	}
	right_portrait = {
		character = scope:nice_courtier
		animation = shame
	}
	
	trigger = {
		scope:activity = {
			any_in_list = {
				variable = potential_hunt_participants
				hunt_1011_nasty_guest_trigger = yes
				save_temporary_scope_as = hated_participant
			}
			any_in_list = {
				variable = potential_hunt_participants
				hunt_1011_nice_guest_trigger = yes
			}
		}
	}

	weight_multiplier = {
		base = 0.8
		modifier = { #More likely to fire if you have a rival joining
			add = 0.2
			scope:activity = {
				any_in_list = {
					variable = potential_hunt_participants
					is_alive = yes
					is_vassal_of = root
					OR = {
						has_relation_rival = root
						has_relation_potential_rival = root
					}
				}
			}
		}
		modifier = { #More likely to fire if you have a powerful vassal rival joining
			add = 0.3
			scope:activity = {
				any_in_list = {
					variable = potential_hunt_participants
					is_alive = yes
					is_powerful_vassal_of = root
					OR = {
						has_relation_rival = root
						has_relation_potential_rival = root
					}
				}
			}
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_hunt_1011
			days = 100
		}
		scope:activity = {
			random_in_list = {
				variable = potential_hunt_participants
				limit = {
					hunt_1011_nasty_guest_trigger = yes
				}
				save_scope_as = hated_participant
			}
			random_in_list = {
				variable = potential_hunt_participants
				limit = {
					hunt_1011_nice_guest_trigger = yes
				}
				save_scope_as = nice_courtier
			}
			set_variable = {
				name = participant_to_use_1011
				value = scope:hated_participant
				days = 300
			}
		}
	}

	option = { #call them out
		name = hunt.1011.a
		scope:hated_participant = {
			add_character_modifier = {
				modifier = hunt_tasted_the_belt_modifier
				years = 5
			}
		}
		reverse_add_opinion = {
			target = scope:hated_participant
			modifier = rude_opinion
		}
		stress_impact = {
			sadistic = minor_stress_impact_loss
			compassionate = medium_stress_impact_gain
			forgiving = minor_stress_impact_gain
			calm = medium_stress_impact_gain

		}
		ai_chance = {
			base = 50
			modifier = {
				add = 20
				OR = {
					has_trait = sadistic
					has_trait = callous
				}
			}
		}
	}

	option = { #Intervene!
		name = hunt.1011.b
		add_character_modifier = {
			modifier = hunt_mediated_fight_modifier
			years = 5
		}
		reverse_add_opinion = {
			target = scope:hated_participant
			modifier = rude_opinion
		}
		reverse_add_opinion = {
			target = scope:nice_courtier
			modifier = kindness_opinion
			opinion = 30
		}
		stress_impact = {
			shy = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
			callous = medium_stress_impact_gain
			craven = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 20
				OR = {
					has_trait = compassionate
					has_trait = just
					has_trait = wrathful
				}
			}
		}
	}

	option = { #Join in!
		name = hunt.1011.c
		reverse_add_opinion = {
			target = scope:hated_participant
			modifier = friendliness_opinion
			opinion = 20
		}
		reverse_add_opinion = {
			target = scope:nice_courtier
			modifier = rude_opinion
		}
		save_scope_value_as = { #Don't trigger the follow-up
			name = no_follow_up
			value = yes
		}
		stress_impact = {
			base = minor_stress_impact_gain
			callous = minor_stress_impact_loss
			sadistic = medium_stress_impact_loss
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 20
				OR = {
					has_trait = sadistic
					opinion = {
						target = scope:nice_courtier
						value <= 10
					}
				}
			}
		}
	}

	after = {
		change_variable = {
			name = hunt_outcome
			add = -1
		}
		hidden_effect = { #To make it a bit random whether the follow-up trigger or not
			if = {
				limit = {	
					NOT = { exists = scope:no_follow_up }
				}
				random_list = {
					80 = {
						modifier = {
							add = 20
							OR = {
								has_trait = vengeful
								has_trait = wrathful
								has_trait = sadistic
							}
						}
						trigger_event = {
							id = hunt.1012
							days = { 3 7 }
						}
					}
					20 = {
						modifier = {
							add = 10
							OR = {
								has_trait = compassionate
								has_trait = forgiving
								has_trait = calm
							}
						}
					}
				}
			}
			else = {
				if = {
					limit = {
						exists = var:participant_to_use_1011
					}
					remove_variable = participant_to_use_1011
				}
			}
		}
	}
}

#Do you shoot your bothersome hunting guest or not?
hunt.1012 = {
	type = character_event
	title = hunt.1011.t
	desc = hunt.1012.desc
	theme = hunt_activity
	left_portrait = scope:hated_participant
	
	trigger = { #Either a continuation from 1011 or someone you have a murder scheme against
		OR = {
			has_character_flag = had_event_hunt_1011
			scope:activity = {
				any_in_list = {
					variable = potential_hunt_participants
					is_alive = yes
					any_targeting_scheme = {
						scheme_type = murder
						scheme_owner = root
						scheme_progress > 70
					}
				}
			}
		}
	}

	immediate = {
		select_local_animal_effect = yes
		scope:activity = {
			if = {
				limit = {
					exists = var:participant_to_use_1011
				}
				var:participant_to_use_1011 = {
					save_scope_as = hated_participant
				}	
			}
			else = {
				random_in_list = {
					variable = potential_hunt_participants
					limit = {
						is_alive = yes
						any_targeting_scheme = {
							scheme_type = murder
							scheme_owner = root
							scheme_progress > 70
						}
					}
					save_scope_as = hated_participant
				}
				set_variable = {
					name = participant_to_use_1011
					value = scope:hated_participant
					days = 300
				}
			}
		}
	}

	option = { #Take the shot!
		name = hunt.1012.a
		flavor = hunt.1012.a.tt
		hidden_effect = {
			duel = {
				skill = prowess
				value = 12
				10 = { #Kill them
					compare_modifier = {
						value = scope:duel_value
						multiplier = 0.5
					}
					trigger_event = {
						id = hunt.1013
						days = { 10 20 }
					}
				}
				10 = { #Wound them (undiscovered)
					compare_modifier = {
						value = scope:duel_value
						multiplier = 0.5
					}
					trigger_event = {
						id = hunt.1014
						days = { 10 20 }
					}
				}
				10 = { #Wound them (discovered)
					trigger_event = {
						id = hunt.1015
						days = { 10 20 }
					}
				}
				10 = { #Miss!
					compare_modifier = {
						value = scope:duel_value
						multiplier = -0.5
					}
					trigger_event = {
						id = hunt.1016
						days = { 10 20 }
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					has_trait = sadistic
					has_trait = wrathful
					has_trait = vengeful
					has_trait = deceitful
					has_trait = callous
				}
			}
			change_variable = {
				name = hunt_outcome
				add = 2
			}
		}
		else = {
			change_variable = {
				name = hunt_outcome
				add = 1
			}
		}
		stress_impact = {
			compassionate = major_stress_impact_gain
			humble = medium_stress_impact_gain
			honest = medium_stress_impact_gain
			just = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
			vengeful = medium_stress_impact_loss
			sadistic = medium_stress_impact_loss
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = 0.5
				ai_energy = 0.5
				ai_boldness = 0.25
				ai_honor = -0.25
				ai_compassion = -0.25
			}
		}
	}

	option = { #Restrain yourself
		name = hunt.1012.b
		add_stress = medium_stress_gain
		if = {
			limit = {
				NOT = {
					faith = {
						has_doctrine_parameter = piety_gain_from_successful_intrigue_schemes
					}
				}
			}
			add_piety = medium_piety_gain
		}
		if = {
			limit = {
				OR = {
					has_trait = sadistic
					has_trait = wrathful
					has_trait = vengeful
					has_trait = deceitful
					has_trait = callous
				}
			}
			change_variable = {
				name = hunt_outcome
				add = -2
			}
		}
		else = {
			change_variable = {
				name = hunt_outcome
				add = 1
			}
		}
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
		stress_impact = {
			sadistic = medium_stress_impact_gain
			wrathful = minor_stress_impact_gain
			vengeful = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_honor = 0.75
				ai_rationality = 0.25
				ai_compassion = 0.25
				ai_vengefulness = -0.25
			}
		}
	}
}

#You shoot at your hunting guest and kill them!
hunt.1013 = {
	type = character_event
	title = hunt.1011.t
	desc = hunt.1013.desc
	theme = hunt_activity
	left_portrait = scope:hated_participant

	immediate = {
		play_music_cue = "mx_cue_stress"
		scope:activity = {
			var:participant_to_use_1011 = {
				save_scope_as = hated_participant
			}
		}
		unknown_murder_effect = {
			VICTIM = scope:hated_participant
			MURDERER = root
			REASON = death_hunting_accident
		}
		change_variable = {
			name = hunt_outcome
			add = 2
		}
	}

	option = {
		name = hunt.1013.a
		scope:activity = {
			every_in_list = {
				variable = potential_hunt_participants
				limit = {
					is_alive = yes
				}
				custom = all_hunt_participants
				add_opinion = {
					modifier = opinion_acting_strange
					target = root
				}
			}
		}
	}

	after = {
		scope:activity = {
			remove_variable = participant_to_use_1011
		}
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}

#You shoot at your hunting guest and wound them (undiscovered)
hunt.1014 = {
	type = character_event
	title = hunt.1011.t
	desc = hunt.1014.desc
	theme = hunt_activity
	left_portrait = {
		character = scope:hated_participant
		animation = anger
	}
	right_portrait = scope:participant_to_blame

	immediate = {
		scope:activity = {
			var:participant_to_use_1011 = {
				save_scope_as = hated_participant
			}
			if = {
				limit = {
					any_in_list = {
						variable = potential_hunt_participants
						is_alive = yes
						NOT = { this = root }
						NOT = { this = scope:hated_participant }
					}
				}
				random_in_list = {
					variable = potential_hunt_participants
					limit = { #Blame someone you don't like!
						is_alive = yes
						NOT = { this = root }
						NOT = { this = scope:hated_participant }
						OR = {
							has_relation_rival = root
							has_relation_potential_rival = root
							reverse_opinion = {
								target = root
								value <= -30
							}
						}
					}
					alternative_limit = {
						is_alive = yes
						NOT = { this = root }
						NOT = { this = scope:hated_participant }
						reverse_opinion = {
							target = root
							value <= -10
						}
					}
					alternative_limit = { #Just pick whomever at this stage
						is_alive = yes
						NOT = { this = root }
						NOT = { this = scope:hated_participant }
					}
					weight = {
						base = 10
						modifier = {
							add = -9
							OR = {
								has_relation_friend = root
								has_relation_potential_friend = root
								has_relation_lover = root
							}
						}
					}
					save_scope_as = participant_to_blame
				}
			}
		}
		scope:hated_participant = {
			increase_wounds_effect = { REASON = hunting_accident }
		}
		change_variable = {
			name = hunt_outcome
			add = 2
		}
	}

	option = { #It was I!
		name = hunt.1014.a
		scope:hated_participant = {
			add_opinion = {
				target = root
				modifier = cruelty_opinion
				opinion = -20
			}
		}
		scope:activity = { #All honorable participants lose opinion
			every_in_list = {
				variable = potential_hunt_participants
				limit = {
					is_alive = yes
					ai_honor >= high_positive_honor
				}
				custom = hunt.1014.all_honorable_hunt_participants
				add_opinion = {
					modifier = opinion_acting_strange
					target = root
				}
			}
		}
		scope:activity = { #All evil participants gain opinion
			every_in_list = {
				variable = potential_hunt_participants
				limit = {
					is_alive = yes
					OR = {
						has_trait = sadistic
						opinion = {
							target = scope:hated_participant
							value <= -30
						}
					}
				}
				custom = hunt.1014.all_who_dislike_or_are_evil
				add_opinion = {
					modifier = cruelty_opinion
					target = root
					opinion = 10
				}
			}
		}
	}

	option = { #It was them!!
		name = hunt.1014.b
		trigger = {
			exists = scope:participant_to_blame
		}
		scope:hated_participant = {
			add_opinion = {
				target = scope:participant_to_blame
				modifier = cruelty_opinion
				opinion = -20
			}
		}
		scope:participant_to_blame = {
			add_opinion = {
				target = root
				modifier = blamed_me_unjustly
			}
		}
	}

	option = { #You clumsy fool!
		name = hunt.1014.c
		scope:hated_participant = {
			add_opinion = {
				modifier = publicly_ridiculed
				target = root
			}
			add_dread = medium_dread_loss
			add_prestige = medium_prestige_loss
		}
	}

	after = {
		scope:activity = {
			remove_variable = participant_to_use_1011
		}
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}

#You shoot at your hunting guest and wound them (discovered)
hunt.1015 = {
	type = character_event
	title = hunt.1011.t
	desc = hunt.1015.desc
	theme = hunt_activity
	left_portrait = {
		character = scope:hated_participant
		animation = fear
	}

	immediate = {
		scope:activity = {
			var:participant_to_use_1011 = {
				save_scope_as = hated_participant
			}
		}
		scope:hated_participant = {
			increase_wounds_effect = { REASON = hunting_accident }
		}
		add_secret = {
			type = secret_murder_attempt
			target = scope:hated_participant
		}
	}

	option = { #Do nothing
		name = hunt.1015.a
		random_secret = { #They know that you tried killing them
			limit = {
				secret_type = secret_murder_attempt
				secret_target = scope:hated_participant
			}
			reveal_to = scope:hated_participant
		}
		change_variable = {
			name = hunt_outcome
			add = -2
		}
		stress_impact = {
			diligent = medium_stress_impact_gain
			gregarious = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 20
				OR = {
					has_trait = content
					has_trait = calm
					has_trait = lazy
					has_trait = honest
				}
			}
		}
	}

	option = { #Threaten
		name = hunt.1015.b
		trigger = {
			NOT = { has_usable_hook = scope:hated_participant }
		}
		random_secret = { #They know that you tried killing them
			limit = {
				secret_type = secret_murder_attempt
				secret_target = scope:hated_participant
			}
			reveal_to = scope:hated_participant
		}
		change_variable = {
			name = hunt_outcome
			add = -1
		}
		add_dread = medium_dread_gain
		stress_impact = {
			calm = medium_stress_impact_gain
			lazy = medium_stress_impact_gain
			craven = medium_stress_impact_gain
			honest = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 20
				OR = {
					has_trait = brave
					has_trait = wrathful
					has_trait = deceitful
					has_trait = callous
				}
			}
		}
	}

	option = { #Finish them!!
		name = hunt.1015.c
		trigger = {
			OR = {
				has_trait = sadistic
				has_trait = diligent
			}
		}
		trait = diligent
		trait = sadistic
		random_secret = { #Remove the secret
			limit = {
				secret_type = secret_murder_attempt
				secret_target = scope:hated_participant
			}
			remove_secret = yes
		}
		unknown_murder_effect = { #You kill them
			VICTIM = scope:hated_participant
			MURDERER = root
			REASON = death_hunting_accident
		}
		if = {
			limit = {
				OR = {
					has_trait = sadistic
					has_trait = diligent
					has_trait = wrathful
					has_trait = vengeful
					has_trait = callous
				}
			}
			change_variable = {
				name = hunt_outcome
				add = 2
			}
		}
		else = {
			change_variable = {
				name = hunt_outcome
				add = 1
			}
		}
		stress_impact = {
			calm = medium_stress_impact_gain
			lazy = medium_stress_impact_gain
			craven = medium_stress_impact_gain
			honest = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 40
				OR = {
					has_trait = sadistic
					has_trait = diligent
				}
			}
			modifier = {
				add = 20
				OR = {
					has_trait = wrathful
					has_trait = callous
				}
			}
		}
	}

	option = { #Talk yourself out of it
		name = hunt.1015.d
		trigger = {
			OR = {
				has_trait = gregarious
				learning >= high_skill_rating
				diplomacy >= high_skill_rating
			}
		}
		trait = gregarious
		skill = learning
		skill = diplomacy
		random_secret = { #Remove the secret
			limit = {
				secret_type = secret_murder_attempt
				secret_target = scope:hated_participant
			}
			remove_secret = yes
		}
		change_variable = {
			name = hunt_outcome
			add = 1
		}
		stress_impact = {
			sadistic = medium_stress_impact_gain
			wrathful = medium_stress_impact_gain
			shy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #You have a Hook on them?
		name = hunt.1015.e
		trigger = {
			has_usable_hook = scope:hated_participant
		}
		use_hook = scope:hated_participant
		random_secret = { #Remove the secret
			limit = {
				secret_type = secret_murder_attempt
				secret_target = scope:hated_participant
			}
			remove_secret = yes
		}
		change_variable = {
			name = hunt_outcome
			add = 1
		}
		stress_impact = {
			wrathful = medium_stress_impact_gain
			callous = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
			shy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	after = {
		scope:activity = {
			remove_variable = participant_to_use_1011
		}
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}

#You shoot at your hunting guest and miss!
hunt.1016 = {
	type = character_event
	title = hunt.1011.t
	desc = hunt.1016.desc
	theme = hunt_activity
	left_portrait = scope:hated_participant

	immediate = {
		scope:activity = {
			var:participant_to_use_1011 = {
				save_scope_as = hated_participant
			}
		}
		change_variable = {
			name = hunt_outcome
			add = -2
		}
	}

	option = {
		name = hunt.1016.a
		add_prestige = medium_prestige_loss
	}

	after = {
		scope:activity = {
			remove_variable = participant_to_use_1011
		}
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}


#######################
#	Beautiful Peasant Chain: Meet a beautiful peasant in the forest
#	by Petter Vilberg
#	1021-1022
#######################

hunt.1021 = {
	type = character_event
	title = hunt.1021.t
	desc = hunt.1021.desc
	theme = hunt_activity
 	left_portrait = {
 		character = scope:beautiful_peasant
 		animation = flirtation
 	}
	
	trigger = {
		NOT = { has_character_flag = ran_into_beautiful_peasant_in_forest }
		mgr_can_seduce = yes
		is_adult = yes
		NOR = {
			has_sexuality = asexual
			has_trait = celibate
		}
	}

	weight_multiplier = {
		base = 1
		modifier = { #Since it creates a GOOD character we don't want the ai to get it too often
			add = -0.9
			is_ai = yes
		}
		modifier = {
			add = 0.5
			is_ai = no
			has_trait = lustful
		}
		compare_modifier = { #Less likely to happen the older you are
			trigger = {
				age >= 30
			}
			value = age
			multiplier = -0.01
		}
	}

	immediate = {
		play_music_cue = "mx_cue_seduction"
		add_character_flag = {
			flag = ran_into_beautiful_peasant_in_forest
			days = 3650
		}
		hidden_effect = {
			create_character = {
				location = scope:activity.activity_province
				template = beautiful_peasant_character
				gender_female_chance = root_attraction_based_female_chance
				faith = scope:activity.activity_province.county.faith
				culture = scope:activity.activity_province.county.culture
				dynasty = none
				save_scope_as = beautiful_peasant
			}
			random_list = {
				25 = {
					trigger = {
						is_female = yes
						scope:beautiful_peasant = { is_female = yes }
					}
					scope:beautiful_peasant = { set_sexuality = homosexual }
				}
				100 = {
					trigger = {
						is_female = yes
						scope:beautiful_peasant = { is_male = yes }
					}
					scope:beautiful_peasant = { set_sexuality = heterosexual }
				}
				25 = {
					trigger = {
						is_male = yes
						scope:beautiful_peasant = { is_male = yes }
					}
					scope:beautiful_peasant = { set_sexuality = homosexual }
				}
				100 = {
					trigger = {
						is_male = yes
						scope:beautiful_peasant = { is_female = yes }
					}
					scope:beautiful_peasant = { set_sexuality = heterosexual }
				}
				50 = {
					scope:beautiful_peasant = { set_sexuality = bisexual }
				}
			}
		}
		change_variable = {
			name = hunt_outcome
			add = 2
		}
	}

	option = { #Oh, hello you
		name = hunt.1021.a
		trigger_event = {
			id = hunt.1022
			days = { 3 7 }
		}
		stress_impact = {
 			base = medium_stress_impact_loss
 			lustful = minor_stress_impact_loss
 			rakish = minor_stress_impact_loss
 			chaste = major_stress_impact_gain
 			shy = medium_stress_impact_gain
 			impatient = minor_stress_impact_gain
 		}
 		ai_chance = {
 			base = 100
 			ai_value_modifier = {
 				ai_boldness = 1
 				ai_greed = 0.25
 				ai_honor = -0.5
 			}
 			opinion_modifier = {
 				trigger = { is_married = yes }
 				multiplier = -0.5
 				opinion_target = primary_spouse
 			}
 		}
	}

	option = { #I have animals to hunt!
		name = {
			trigger = {
				OR = {
					has_trait = lifestyle_hunter
					has_trait = brave
				}
			}
			text = hunt.1021.b.thrill
		}
		name = {
			trigger = {
				OR = {
					has_trait = zealous
					piety_level >= high_piety_level
				}
			}
			text = hunt.1021.b.appropriate
		}
		name = {
			trigger = {
				OR = {
					has_trait = sadistic
					has_trait = callous
					has_trait = arrogant
				}
			}
			text = hunt.1021.b.cruel
		}
		name = hunt.1021.b.purpose
		if = {
			limit = {
				faith = {
					NOT = { has_doctrine = tenet_carnal_exaltation }
				}
			}
			add_character_modifier = {
				modifier = modifier_hunt_resisted_advances
				days = 1825
			}
			add_piety = minor_piety_gain
		}
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
		stress_impact = {
			lazy = minor_stress_impact_gain
			lustful = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 0.25
				ai_rationality = 0.5
			}
		}
	}
	
	option = { #Let me set you up at court
		name = hunt.1021.c
		trigger = {
			NOT = { has_trait = chaste }
		}
		remove_short_term_gold = minor_gold_value
		duel = {
			skill = diplomacy
			value = average_skill_rating
			10 = {
				compare_modifier = {
					value = scope:duel_value
				}
				desc = hunt.1021.c.success
				send_interface_toast = {
					title = hunt.1021.c.success
					left_icon = scope:beautiful_peasant
					add_courtier = scope:beautiful_peasant
				}
				set_relation_potential_lover = scope:beautiful_peasant
				change_variable = {
					name = hunt_outcome
					add = 1
				}
			}
			10 = {
				desc = hunt.1021.c.failure
				send_interface_toast = {
					title = hunt.1021.c.failure
					left_icon = scope:beautiful_peasant
					custom_tooltip = hunt.1021.c.failure_tt
				}
				change_variable = {
					name = hunt_outcome
					add = -1
				}
			}
		}
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
		stress_impact = {
			callous = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 0.5
			}
		}
	}
	
	option = { #You deserve a life at court
		name = hunt.1021.d
		trait = chaste
		trigger = {
			has_trait = chaste
		}
		remove_short_term_gold = minor_gold_value
		add_courtier = scope:beautiful_peasant
		set_relation_friend = scope:beautiful_peasant
		change_variable = {
			name = hunt_outcome
			add = 2
		}
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
		ai_chance = {
			base = 300
			ai_value_modifier = {
				ai_compassion = 0.5
			}
		}
	}
}


#You spent some time in their cabin

hunt.1022 = {
	type = character_event
	title = hunt.1022.t
	desc = hunt.1022.desc
	theme = hunt_activity
	left_portrait = {
		character = scope:beautiful_peasant
		animation = flirtation
	}

	immediate = {
		had_sex_with_effect = {
			CHARACTER = scope:beautiful_peasant
			PREGNANCY_CHANCE = pregnancy_chance
		}
	}

	option = { #Let's not meet again
		name = hunt.1022.a
		flavor = hunt.1022.a.tt
		hidden_effect = {
			scope:beautiful_peasant = {
				if = {
					limit = {
						is_female = yes
					}
					save_scope_as = peasant_woman
				}
			}
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #Let me set you up at court
		name = hunt.1022.b
		remove_short_term_gold = minor_gold_value
		add_courtier = scope:beautiful_peasant
		set_relation_lover = scope:beautiful_peasant
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_honor = 0.5
				ai_compassion = 0.5
			}
		}
	}
	after = {
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
 }


 #######################
#	You have a dog that helps you to fell an animal
#	by Linnéa Thimrén
#######################

hunt.1023 = {
	type = character_event
	title = hunt.1023.t
	desc = hunt.1023.desc
	theme = hunt_activity
	left_portrait = root

	trigger = {
		any_owned_story = {
			story_type = story_cycle_pet_dog
		}
	}

	weight_multiplier = {
		base = 0.5
		modifier = { #more likely to fire if no cool characters have joined
			add = 0.5
			scope:activity = {
				NOT = {
					any_in_list = {
						variable = potential_hunt_participants
						is_alive = yes
						is_available_ai_adult = yes
						is_powerful_vassal_of = root
					}
				}
			}
		}
	}

	immediate = {
		big_animal_effect = yes
		random_owned_story = {
			limit = {
				story_type = story_cycle_pet_dog
			}
			save_scope_as = story
		}
	}

	option = { #Sick the dog on the animal!
		name = hunt.1023.a
		add_character_modifier = {
			modifier = modifier_hunt_dog_trophy_modifier
			years = 10
		}
		random_list = {
			80 = {
				desc = hunt.1023.a.good
				modifier = {#How old is the dog?
					add = 20
					scope:story = {
						var:dog_age_variable > 2
						var:dog_age_variable < 7
					}
				}
				scope:activity = {
					every_in_list = {
						variable = potential_hunt_participants
						limit = { is_alive = yes }
						custom = all_hunt_participants
						add_opinion = {
							modifier = respect_opinion
							target = root
							opinion = 15
						}
					}
				}
				change_variable = {
					name = hunt_outcome
					add = 2
				}
			}
			20 = { #Dog dies
				desc = hunt.1023.a.bad
				modifier = { #How old is the dog?
					add = 20
					scope:story = {
						var:dog_age_variable > 10
					}
				}
				modifier = {#How old is the dog?
					add = 20
					scope:story = {
						var:dog_age_variable < 2
					}
				}
				modifier = {#What animal is it?
					add = 20
					var:local_animal = flag:bear
				}
				modifier = {#What animal is it?
					add = 20
					var:local_animal = flag:lion
				}
				modifier = {#What animal is it?
					add = 20
					var:local_animal = flag:tiger
				}
				modifier = {#What animal is it?
					add = 20
					var:local_animal = flag:dragon
				}
				show_as_tooltip = {
					remove_dog_story_modifiers_effect = yes
				}
				scope:story = {
					hidden_effect = { end_story = yes }
				}
				change_variable = {
					name = hunt_outcome
					add = -2
				}
			}
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_energy = 0.5
			}
		}
	}

	option = { #Nah
		name = hunt.1023.b
		add_character_modifier = {
			modifier = modifier_hunt_dog_fighting_modifier
			years = 5
		}
		change_variable = {
			name = hunt_outcome
			add = 1
		}
		stress_impact = {
			craven = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 0.75
				ai_energy = 0.5
			}
		}
	}
	
	after = {
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}


##########################
#	RANDOM PULSE EVENTS  #
#	4000 - 4999			 #
##########################

#######################
#	Chance to fell a beautiful animal
#	by Petter Vilberg
#######################
hunt.4001 = {
	type = character_event
	title = hunt.4001.t
	desc = {
		random_valid = {
			desc = hunt.4001.desc_1
			desc = hunt.4001.desc_2
		}
	}
	theme = hunt_activity
	left_portrait = scope:hunt_guest

	trigger = {
		scope:activity = {
			has_variable_list = potential_hunt_participants
			any_in_list = {
				variable = potential_hunt_participants
				is_alive = yes
			}
		}
	}

	immediate = {
		scope:activity = {
			hidden_effect = {
				random_list = {
					90 = {
						random_in_list = {
							variable = potential_hunt_participants
							limit = {
								is_alive = yes
								is_of_major_interest_trigger = {
									CHARACTER = root
								}
							}
							alternative_limit = {
								is_alive = yes
								is_of_minor_interest_trigger = {
									CHARACTER = root
								}
							}
							alternative_limit = { } #Any potential guests
							save_scope_as = hunt_guest
						}
					}
					10 = {
						random_in_list = { #Chance of prioritising characters of minor interest for variety's sake
							variable = potential_hunt_participants
							limit = {
								is_alive = yes
								is_of_minor_interest_trigger = {
									CHARACTER = root
								}
							}
							alternative_limit = {
								is_alive = yes
								is_of_major_interest_trigger = {
									CHARACTER = root
								}
							}
							alternative_limit = { } #Any potential guests
							save_scope_as = hunt_guest
						}
					}
				}
			}
		}
		select_local_animal_effect = yes
		change_variable = {
			name = hunt_outcome
			add = 1
		}
	}

	option = { #Take the shot
		name = hunt.4001.a
		add_prestige = medium_prestige_gain
		hidden_effect = {
			change_variable = {
				name = hunt_outcome
				add = 1
			}
		}
		stress_impact = {
			athletic = minor_stress_impact_loss
			craven = minor_stress_impact_gain
			generous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_energy = 0.25
			}
		}
	}

	option = { # hunt_guest gets to take the shot
		name = hunt.4001.b
		scope:hunt_guest = {
			add_opinion = {
				modifier = opinion_hunt_got_to_take_shot
				target = root
			}
		}
		stress_impact = {
			arrogant = medium_stress_impact_gain
			ambitious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
			}
		}
	}

	option = {
		name = hunt.4001.c
		skill = intrigue
		trigger = {
			intrigue > high_skill_rating
			opinion = {
				target = scope:hunt_guest
				value < 10
			}
		}
		if = {
			limit = {
				OR = {
					has_trait = sadistic
					opinion = {
						target = scope:hunt_guest
						value <= -0
					}
				}
			}
			change_variable = {
				name = hunt_outcome
				add = 1
			}
		}
		custom_tooltip = hunt.4001.c.tt
		scope:hunt_guest = {
			add_prestige = medium_prestige_loss
			add_opinion = {
				modifier = opinion_hunt_got_to_take_shot
				target = root
			}
		}
		stress_impact = {
			compassionate = minor_stress_impact_gain
			honest = minor_stress_impact_gain
			just = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = -1
				ai_vengefulness = 0.5
				ai_honor = -1
			}
		}
	}
	after = {
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}



#######################
#	A hunt guest is about to share a secret about someone when they are interrupted
#	by Petter Vilberg
#######################

scripted_trigger hunt_4002_secret_knower_trigger = {
	opinion = {
		target = root
		value > 0
	}
	any_known_secret = {
		NOR = {
			secret_owner = root
			is_known_by = root
			secret_owner = prev
		}
		secret_owner = {
			OR = {
				is_of_major_interest_trigger = {
					CHARACTER = root
				}
				is_of_minor_interest_trigger = {
					CHARACTER = root
				}
			}
		}
	}
}

hunt.4002 = {
	type = character_event
	title = hunt.4002.t
	desc = hunt.4002.desc
	theme = hunt_activity
	left_portrait = {
		character = scope:secret_sharer
		animation = paranoia
	}
	right_portrait = scope:secret_owner
	
	trigger = {
		scope:activity = {
			any_in_list = {
				variable = potential_hunt_participants
				is_alive = yes
				hunt_4002_secret_knower_trigger = yes
			}
		}
	}

	immediate = {
		scope:activity = {
			random_in_list = {
				variable = potential_hunt_participants
				limit = {
					is_alive = yes
					hunt_4002_secret_knower_trigger = yes
				}
				save_scope_as = secret_sharer
				random_known_secret = {
					limit = { #Prefer a secret about someone highly relevant to activity_owner
						NOR = {
							secret_owner = root
							is_known_by = root
							secret_owner = prev
						}
						secret_owner = {
							is_of_major_interest_trigger = {
								CHARACTER = root
							}
						}
					}
					alternative_limit = { #Fallback to minor interest characters
						NOR = {
							secret_owner = root
							is_known_by = root
							secret_owner = prev
						}
						secret_owner = {
							is_of_minor_interest_trigger = {
								CHARACTER = root
							}
						}
					}
					save_scope_as = secret_to_share
					secret_owner = {
						save_scope_as = secret_owner
					}
				}
			}
		}
		select_local_animal_effect = yes
	}

	option = { #Truly interesting, but get that animal!
		name = hunt.4002.a
		add_prestige = medium_prestige_gain
		change_variable = {
			name = hunt_outcome
			add = 1
		}
		stress_impact = {
			paranoid = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_compassion = -0.25
				ai_honor = 0.25
			}
		}
	}

	option = { #No wait, tell me!
		name = hunt.4002.b
		flavor = hunt.4002.b.tt
		custom_tooltip = hunt.4002.b.reveal
		add_prestige = minor_prestige_loss
		hidden_effect = {
			scope:secret_to_share = {
				reveal_to = root
			}
		}
		stress_impact = {
			arrogant = minor_stress_impact_gain
			impatient = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
				ai_greed = 0.25
			}
		}
	}
	after = {
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}



#######################
#	Run into poachers
#	by Petter Vilberg
#######################

hunt.4003 = {
	type = character_event
	title = hunt.4003.t
	desc = hunt.4003.desc
	theme = hunt_activity
	left_portrait = root

	trigger = {
		scope:activity.activity_province.county = {
			NOT = { has_county_modifier = hunt_punished_locals_modifier }
		}
	}

	immediate = {
		scope:activity = {
			activity_province = {
				county = {
					save_scope_as = county
					holder = {
						save_scope_as = land_owner
					}
				}
			}
		}
		select_local_animal_effect = yes
	}

	option = { #Punish them
		name = hunt.4003.a
		scope:county = {
			add_county_modifier = {
				modifier = hunt_punished_locals_modifier
				years = 10
			}
		}
		if = {
			limit = {
				OR = {
					has_trait = sadistic
					has_trait = wrathful
					has_trait = vengeful
					has_trait = just
				}
			}
			change_variable = {
				name = hunt_outcome
				add = 2
			}
		}
	}

	option = { #I will let you go if you teach me a thing or two
		name = hunt.4003.b
		trigger = {
			NOT = {
				has_trait_rank = {
					trait = lifestyle_hunter
					rank = 3
				}
			}
		}
		change_variable = {
			name = hunt_outcome
			add = 2
		}
		add_character_modifier = {
			modifier = hunt_poacher_training_modifier
			years = 10
		}
		hidden_effect = {
			hunter_progress_point_gain_effect = yes #Gives points towards ranking up the Hunter Lifestyle
		}
	}
	
	option = { #Claim the animals and a legal right to their lives
		name = hunt.4003.c
		duel = {
			skill = stewardship
			value = average_skill_rating
			8 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.25
				}
				desc = hunt.4003.c.tt_success
				send_interface_toast = {
					title = hunt.4003.c.tt_success
					add_gold = minor_gold_value
					add_prestige = medium_prestige_gain
				}
				change_variable = {
					name = hunt_outcome
					add = 2
				}
			}
			12 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.25
					min = -9
				}
				desc = hunt.4003.c.tt_failure
				send_interface_toast = {
					title = hunt.4003.c.tt_failure
					add_prestige = minor_prestige_loss
					scope:county = {
						add_county_modifier = {
							modifier = hunt_upset_hunting_county_modifier
							years = 10
						}
					}
				}
				change_variable = {
					name = hunt_outcome
					add = -2
				}
			}
		}
	}
	after = {
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}



#######################
#	You bring down a particularly large animal - I
#	by Petter Vilberg
#######################

hunt.4004 = {
	type = character_event
	title = hunt.4004.t
	desc = {
		desc = hunt.4004.desc
		triggered_desc = {
			trigger = { exists = scope:credit_receiver }
			desc = hunt.4004.credit_receiver
		}
	}
	theme = hunt_activity
	left_portrait = root
	right_portrait = {
		character = scope:credit_receiver
		animation = shock
	}

	immediate = {
		select_local_animal_effect = yes
		hidden_effect = {
			random_list = {
				50 = {
					trigger = {
						any_child = {
							reverse_opinion = {
								target = root
								value > 20
							}
						}
					}		
					random_child = {
						limit = {
							reverse_opinion = {
								target = root
								value > 20
							}
						}
						save_scope_as = trophy_recipient
					}
				}
				50 = {
					trigger = {
						any_sibling = {
							reverse_opinion = {
								target = root
								value > 20
							}
						}
					}		
					random_sibling = {
						limit = {
							reverse_opinion = {
								target = root
								value > 20
							}
						}
						save_scope_as = trophy_recipient
					}
				}
			}
			scope:activity = {
				if = {
					limit = {
						any_in_list = {
							variable = potential_hunt_participants
							is_alive = yes
							OR = {
								is_of_major_interest_trigger = {
									CHARACTER = root
								}
								is_of_minor_interest_trigger = {
									CHARACTER = root
								}
							}
						}
					}
					random_in_list = { #Find a potential credit receiver
						variable = potential_hunt_participants
						limit = {
							is_alive = yes
							is_of_major_interest_trigger = {
								CHARACTER = root
							}
						}
						alternative_limit = {
							is_alive = yes
							is_of_minor_interest_trigger = {
								CHARACTER = root
							}
						}
						random = { #Randomise whether one is available or not
							chance = 50
							save_scope_as = credit_receiver
						}
					}
				}
				if = {
					limit = {
						any_in_list = {
							variable = potential_hunt_participants
							is_alive = yes
							OR = {
								NOT = { exists = scope:credit_receiver }
								AND = {
									exists = scope:credit_receiver
									NOT = { this = scope:credit_receiver }
								}
							}
							count >= 3
						}
					}
				}

				#Find theoretical feast participants
				random_in_list = {
					variable = potential_hunt_participants
					limit = {
						is_alive = yes
						OR = {
							NOT = { exists = scope:credit_receiver }
							AND = {
								exists = scope:credit_receiver
								NOT = { this = scope:credit_receiver }
							}
						}
					}
					add_to_list = hunt_companions_right_now
				}
				random_in_list = {
					variable = potential_hunt_participants
					limit = {
						is_alive = yes
						OR = {
							NOT = { exists = scope:credit_receiver }
							AND = {
								exists = scope:credit_receiver
								NOT = { this = scope:credit_receiver }
							}
						}
					}
					add_to_list = hunt_companions_right_now
				}
				random_in_list = {
					variable = potential_hunt_participants
					limit = {
						is_alive = yes
						OR = {
							NOT = { exists = scope:credit_receiver }
							AND = {
								exists = scope:credit_receiver
								NOT = { this = scope:credit_receiver }
							}
						}
					}
					add_to_list = hunt_companions_right_now
				}
			}
			change_variable = {
				name = hunt_outcome
				add = 2
			}
		}
	}

	option = { #Hang it in the great hall
		name = hunt.4004.a
		add_character_modifier = {
			modifier = modifier_hunt_hunting_trophy
			days = 3650
		}
		stress_impact = {
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 0.5
			}
		}
	}

	option = { #A trophy for someone I care about
		name = hunt.4004.b
		trigger = {
			exists = scope:trophy_recipient
		}
		reverse_add_opinion = {
			target = scope:trophy_recipient
			modifier = gift_opinion
			opinion = 30
		}
		stress_impact = {
			callous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_greed = -0.5
			}
		}
	}
	
	option = { #Make a beautiful coat
		name = hunt.4004.c
		trait = arrogant
		trigger = { has_trait = arrogant }
		flavor = hunt.4004.c.tt
		every_vassal = {
			limit = { has_trait = arrogant }
			custom = hunt.4004.every_arrogant_vassal
			add_opinion = {
				modifier = envy_opinion
				target = root
				opinion = -10
			}
		}
		every_vassal = {
			limit = {
				OR = {
					has_trait = temperate
					has_trait = humble
				}
			}
			custom = hunt.4004.every_restrained_vassal
			add_opinion = {
				modifier = respect_opinion
				target = root
				opinion = -10
			}
		}
		every_vassal = {
			limit = {
				NOR = {
					has_trait = arrogant
					has_trait = humble
					has_trait = temperate
				}
			}
			custom = hunt.4004.every_other_vassal
			add_opinion = {
				modifier = respect_opinion
				target = root
				opinion = 15
			}
		}
		stress_impact = {
			craven = medium_stress_impact_gain
			content = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 1
				ai_rationality = -0.5
			}
		}
	}
	
	option = { #Someone else deserves the credit
		name = hunt.4004.d
		trigger = { exists = scope:credit_receiver }
		if = {
			limit = {
				can_add_hook = {
					target = scope:credit_receiver
					type = favor_hook
				}
			}
			add_hook = {
				type = favor_hook
				target = scope:credit_receiver
				days = default_favor_duration
			}
		}
		else = {
			scope:credit_receiver = {
				add_prestige = medium_prestige_gain
			}
		}
		reverse_add_opinion = {
			modifier = kindness_opinion
			target = scope:credit_receiver
			opinion = 15
		}
		stress_impact = {
			arrogant = major_stress_impact_gain
			ambitious = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 0.25
			}
			modifier = {
				factor = 1.5
				scope:credit_receiver = {
					is_powerful_vassal_of = root
				}
			}
		}
	}
	
	option = { #Let's eat it here and now!
		name = hunt.4004.e
		trait = gluttonous
		trigger = {
			has_trait = gluttonous
			any_in_list = {
				list = hunt_companions_right_now
				count >= 1
			}
		}
		every_in_list = {
			list = hunt_companions_right_now
			add_opinion = {
				modifier = opinion_hunt_forest_feast
				target = root
				days = 1825
			}
		}

		stress_impact = {
			gluttonous = minor_stress_impact_loss
			comfort_eater = minor_stress_impact_loss
		}
	}
	
	option = { #Its skull will make a fine crown
		name = hunt.4004.f
		trait = sadistic
		trigger = {
			OR = {
				has_trait = sadistic
				dread > 50
			}
		}
		add_dread = medium_dread_gain
	}
	after = {
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}


#######################
#	You bring down a particularly large animal - II
#	by Petter Vilberg
#######################

hunt.4005 = {
	type = character_event
	title = hunt.4005.t
	desc = hunt.4004.desc
	theme = hunt_activity
	left_portrait = root
	lower_left_portrait = {
		trigger = {
			exists = faith.religious_head
			NOT = { faith.religious_head = root }
		}
		character = faith.religious_head
	}
	# Vassal recieving trophy appears in the corner if they are imprisoned 
	right_portrait = {
		trigger = {
			NOT = { scope:trophy_recipient = { is_imprisoned = yes } }
		}
		character = scope:trophy_recipient
	}
	lower_right_portrait = {
		trigger = {
			scope:trophy_recipient = { is_imprisoned = yes } 
		}
		character = scope:trophy_recipient
	}
	

	immediate = {
		select_local_animal_effect = yes
		hidden_effect = {
			random_list = {
				50 = {
					trigger = {
						any_consort = {
							reverse_opinion = {
								target = root
								value > 20
							}
						}
					}		
					random_consort = {
						limit = {
							reverse_opinion = {
								target = root
								value > 20
							}
						}
						save_scope_as = trophy_recipient
					}
				}
				50 = {
					trigger = {
						any_relation = {
							type = lover
							reverse_opinion = {
								target = root
								value > 20
							}
						}
					}		
					random_relation = {
						type = lover
						limit = {
							reverse_opinion = {
								target = root
								value > 20
							}
						}
						save_scope_as = trophy_recipient
					}
				}
				50 = {
					trigger = {
						any_powerful_vassal = {
							always = yes
						}
					}		
					random_powerful_vassal = {
						save_scope_as = trophy_recipient
					}
				}
			}
		}
		if = {
			limit = {
				any_in_list = {
					variable = potential_hunt_participants
					is_alive = yes
					count >= 3
				}
			}
			scope:activity = {
				#Find theoretical feast participants
				random_in_list = {
					variable = potential_hunt_participants
					limit = {
						is_alive = yes
						is_available_adult = yes
					}
					add_to_list = hunt_companions_right_now
				}
				random_in_list = {
					variable = potential_hunt_participants
					limit = {
						is_alive = yes
						is_available_adult = yes
						NOT = { is_in_list = hunt_companions_right_now }
					}
					add_to_list = hunt_companions_right_now
				}
				random_in_list = {
					variable = potential_hunt_participants
					limit = {
						is_alive = yes
						is_available_adult = yes
						NOT = { is_in_list = hunt_companions_right_now }
					}
					add_to_list = hunt_companions_right_now
				}
			}
		}
		change_variable = {
			name = hunt_outcome
			add = 2
		}
	}

	option = { #Sell it off
		name = hunt.4005.a
		add_gold = medium_gold_value
		stress_impact = {
			generous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 0.5
			}
			compare_modifier = {
				value = stewardship
				multiplier = 3
			}
		}
	}

	option = { #A trophy for someone I care about
		name = hunt.4005.b
		trigger = {
			exists = scope:trophy_recipient
		}
		reverse_add_opinion = {
			target = scope:trophy_recipient
			modifier = gift_opinion
			opinion = 30
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_greed = -0.5
			}
		}
	}
	
	option = { #Send it to your religious head
		name = hunt.4005.c
		trigger = {
			exists = faith.religious_head
			NOT = { faith.religious_head = root }
		}
		faith.religious_head = {
			add_opinion = {
				target = root
				modifier = impressed_opinion
				opinion = 30
			}
		}
		stress_impact = {
			cynical = minor_stress_impact_gain
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
			}
			opinion_modifier = {
				who = faith.religious_head
				opinion_target = root
				multiplier = -0.5
			}
		}
	}
	
	option = { #Let's eat it here and now!
		name = hunt.4004.e
		trait = gluttonous
		trigger = {
			has_trait = gluttonous
			any_in_list = {
				list = hunt_companions_right_now
				count >= 1
			}
		}
		every_in_list = {
			list = hunt_companions_right_now
			add_opinion = {
				modifier = opinion_hunt_forest_feast
				target = root
				years = 5
			}
		}
		stress_impact = {
			base = minor_stress_impact_loss
			comfort_eater = minor_stress_impact_loss
		}
	}
	after = {
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}


#######################
#	Poor Peasants are foraging in the forest
#	by Petter Vilberg
#######################

hunt.4006 = {
	type = character_event
	title = hunt.4006.t
	desc = hunt.4006.desc
	theme = hunt_activity
	left_portrait = {
		character = root
		animation = personality_vengeful
	}

	immediate = {
		scope:activity.activity_province = {
			barony = {
				save_scope_as = activity_place
			}
			county = {
				save_scope_as = county
				holder = {
					save_scope_as = county_owner
				}
			}
		}
		select_local_animal_effect = yes
	}

	option = { #Drive them out!
		name = hunt.4006.a
		add_prestige = medium_prestige_gain
		scope:county = {
			add_county_modifier = {
				modifier = hunt_peasants_denied_forest_modifier
				years = 10
			}
		}
		ai_chance = {
			base = 30
		}
	}

	option = { #We came here to hunt, did we not?
		name = hunt.4006.b
		trait = sadistic
		trigger = {
			has_trait = sadistic
			NOT = { has_trait = cannibal }
		}
		add_dread = medium_dread_gain
		scope:county = {
			add_county_modifier = {
				modifier = hunt_peasants_hunted_modifier
				years = 10
			}
		}
		scope:county_owner = {
			if = {
				limit = {
					NOT = { this = root }
					ai_compassion < 0
				}
				add_opinion = {
					modifier = opinion_hunt_solved_poverty_problem
					target = root
					days = 3650
				}
				if = {
					limit = {
						OR = {
							has_trait = cannibal
							has_trait = sadistic
							any_secret = {
								secret_type = secret_cannibal
							}
						}
						root = {
							can_add_hook = {
								type = favor_hook
								target = scope:county_owner
							}
						}
					}
					root = {
						custom_tooltip = hunt.4006.special_interest
						add_hook = {
							type = favor_hook
							target = scope:county_owner
						}
					}
				}
			}
		}
		change_variable = {
			name = hunt_outcome
			add = 2
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #This will do just fine...
		name = hunt.4006.c
		trait = cannibal
		trigger = {
			has_trait = cannibal
		}
		add_dread = medium_dread_gain
		scope:county = {
			add_county_modifier = {
				modifier = hunt_peasants_hunted_modifier
				years = 10
			}
		}
		scope:county_owner = {
			if = {
				limit = {
						NOT = { this = root }
						ai_compassion < 0
					}
					add_opinion = {
						modifier = opinion_hunt_solved_poverty_problem
						target = root
						days = 3650
					}
				if = {
					limit = {
						OR = {
							has_trait = cannibal
							has_trait = sadistic
							any_secret = {
								secret_type = secret_cannibal
							}
						}
						root = {
							can_add_hook = {
								type = favor_hook
								target = scope:county_owner
							}
						}
					}
					root = {
						custom_tooltip = hunt.4006.special_interest
						add_hook = {
							type = favor_hook
							target = scope:county_owner
						}
					}
				}
			}
		}
		stress_impact = {
			base = medium_stress_impact_loss
			compassionate = medium_stress_impact_gain
		}
		change_variable = {
			name = hunt_outcome
			add = 2
		}
		ai_chance = {
			base = 100
		}
	}
	
	option = { #Offer a charitable donation
		name = hunt.4006.d
		remove_short_term_gold = minor_gold_value
		add_piety = medium_piety_gain
		scope:county = {
			add_county_modifier = {
				modifier = hunt_aided_peasants_modifier
				years = 10
			}
		}
		ai_chance = {
			base = 70
		}
	}
	after = {
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}



#######################
#	Run into a rampaging animal
#	by Linnéa Thimrén
#######################
hunt.4007 = {
	type = character_event
	title = hunt.4007.t
	desc = {
		first_valid = {
			random_valid = {
				triggered_desc = {
					trigger = {
						has_trait = lazy
					}
					desc = hunt.4007.desc_lazy
				}
				triggered_desc = {
					trigger = {
						has_trait = lustful
					}
					desc = hunt.4007.desc_lustful
				}
			}
			desc = hunt.4007.desc_fallback
		}
		desc = hunt.4007.desc_ending
	}
	theme = hunt_activity
	left_portrait = {
		character = scope:similar_participant
		animation = shock
	}
	
	trigger = {
		scope:activity = {
			any_in_list = {
				variable = potential_hunt_participants
				is_alive = yes
				is_available_adult = yes
				count >= 1
			}
		}
	}

	immediate = {
		big_animal_effect = yes
		scope:activity = {
			random_in_list = { #Find a suitable character for root to hang out with in the forest
				variable = potential_hunt_participants
				limit = { #Find someone lazy for root to hang out with
					is_alive = yes
					root = { has_trait = lazy }
					has_trait = lazy
				}
				alternative_limit = { #Find someone for root to be attracted to
					root = {
						possibly_interested_in_character_trigger = {
							CHARACTER = prev
						}
					}
					is_alive = yes
					root = { has_trait = lustful }
					has_trait = beauty_good
					NOT = {
						is_close_family_trigger = {
							CHARACTER = root
						}
					}
				}
				alternative_limit = { #Find someone. Anyone
					is_available_adult = yes
				}
				save_scope_as = similar_participant
			}
		}
		change_variable = {
			name = hunt_outcome
			add = -1
		}
	}

	option = { #Suplex the LocalAnimal with your Hunter skills
		name = hunt.4007.a
		trigger = {
			has_trait_rank = {
				trait = lifestyle_hunter
				rank >= 2
			}
		}
		trait = hunter_2
		trait = hunter_3
		duel = {
			skill = prowess
			value = 8 #easier challenge if you're a cool hunter!
			15 = {
				desc = hunt.4007.a.success
				compare_modifier = {
					value = scope:duel_value
				}
				send_interface_toast = {		
					title = hunt.4007.a.success			
					add_character_modifier = {
						modifier = modifier_hunt_hunting_trophy
						days = 3650
					}
				}
				change_variable = {
					name = hunt_outcome
					add = 2
				}
			}
			8 = {
				desc = hunt.4007.a.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
				send_interface_toast = {	
					title = hunt.4007.a.failure				
					increase_wounds_effect = { REASON = hunting_accident }
				}
				change_variable = {
					name = hunt_outcome
					add = -1
				}
			}
			1 = {
				desc = hunt.4007.a.critical_failure
				send_interface_toast = {
					title = hunt.4007.a.critical_failure				
					death = {
						death_reason = death_hunting_accident
					}
				}
			}
		}
	}

	option = { #Suplex the LocalAnimal
		name = hunt.4007.a
		trigger = {
			has_trait_rank = {
				trait = lifestyle_hunter
				rank < 2
			}
		}
		duel = {
			skill = prowess
			value = 12
			15 = {
				desc = hunt.4007.a.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
				send_interface_toast = {		
					title = hunt.4007.a.success			
					add_character_modifier = {
						modifier = modifier_hunt_hunting_trophy
						days = 3650
					}
				}
				change_variable = {
					name = hunt_outcome
					add = 2
				}
			}
			6 = {
				desc = hunt.4007.a.failure
				send_interface_toast = {	
					title = hunt.4007.a.failure				
					increase_wounds_effect = { REASON = hunting_accident }
				}
				change_variable = {
					name = hunt_outcome
					add = -1
				}
			}
			1 = {
				desc = hunt.4007.a.critical_failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.5
				}
				send_interface_toast = {	
					title = hunt.4007.a.critical_failure				
					death = {
						death_reason = death_hunting_accident
					}
				}
			}
		}
	}
	
	option = { #Scream for help!
		name = hunt.4007.b
		add_prestige = medium_prestige_loss
		scope:similar_participant = {
			if = {
				limit = {
					can_add_hook = {
						target = root
						type = favor_hook
					}
				}
				add_hook = {
					type = favor_hook
					target = root
				}
			}
			else = {
				add_prestige = medium_prestige_gain
			}
		}
		change_variable = {
			name = hunt_outcome
			add = -1
		}
		change_variable = {
			name = hunt_outcome
			add = 1
		}
	}

	option = { #Befriend the animal
		name = hunt.4007.c
		trigger = {
			diplomacy >= extremely_high_skill_rating
		}
		skill = diplomacy
		add_character_modifier = {
			modifier = modifier_hunt_friend_of_animal
			years = 20
		}
		change_variable = {
			name = hunt_outcome
			add = 2
		}
	}
	after = {
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}


#######################
#	Hunt with your heir
#	by Linnéa Thimrén
#######################
hunt.4008 = {
	type = character_event
	title = hunt.4008.t
	desc = hunt.4008.desc
	theme = hunt_activity
	left_portrait = {
		character = scope:heir_participant
		animation = worry
	}
	right_portrait = scope:peasant
	
	trigger = {
		scope:activity = {
			any_in_list = {
				variable = potential_hunt_participants
				is_alive = yes
				is_ai = yes
				this = root.player_heir
				reverse_opinion = {
					target = root
					value >= 0
				}
			}
		}
	}

	immediate = {
		play_music_cue = "mx_cue_murder"
		select_local_animal_effect = yes
		scope:activity.activity_province = {
			county = {
				save_scope_as = activity_place
			}
		}
		scope:activity = {
			random_in_list = { #Find the heir
				variable = potential_hunt_participants
				limit = {
					is_alive = yes
					is_ai = yes
					this = root.player_heir
					reverse_opinion = {
						target = root
						value >= 0
					}
				}
				save_scope_as = heir_participant
			}
		}
		#To create the peasant
		create_character = {
			age = { 20 35 }
			random_traits = yes
			random_traits_list = {
				count = 1
				hunter_2 = {}
				hunter_3 = {}
			}
			gender_female_chance = 50
			dynasty = none
			faith = this.faith
			culture = this.culture
			location = scope:activity.activity_province
			save_scope_as = peasant
		}
		unknown_murder_effect = {
			VICTIM = scope:peasant
			MURDERER = scope:heir_participant
			REASON = death_hunting_accident
		}
		#You know about the secret
		scope:heir_participant = {
			random_secret = {
				limit = {
					secret_type = secret_murder
					secret_target = scope:peasant
				}
				save_scope_as = secret
				reveal_to_without_events_effect = {
					CHARACTER = root
				}
			}
		}
	}

	option = { #Convince everyone that they tried to save the peasant
		name = hunt.4008.a
		duel = {
			skill = diplomacy
			value = 12
			20 = {
				desc = hunt.4008.a.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 2
				}
				send_interface_toast = {
					title = hunt.4008.a.success
					left_icon = scope:heir_participant
					scope:activity_place = {
						add_county_modifier = {
							modifier = hunt_protected_peasants_modifier
							years = 10
						}
					}
					scope:activity = {
						every_in_list = {
							variable = potential_hunt_participants
							limit = {
								is_alive = yes
							}
							custom = all_hunt_participants
							add_opinion = {
								modifier = respect_opinion
								target = scope:heir_participant
								opinion = 30
							}
						}
					}
				}
				root = {
					change_variable = {
						name = hunt_outcome
						add = 2
					}
				}
			}
			10 = {
				desc = hunt.4008.a.failure
				send_interface_toast = {
					title = hunt.4008.a.failure
					left_icon = scope:heir_participant
					scope:activity = {
						every_in_list = {
							variable = potential_hunt_participants
							limit = {
								is_alive = yes
							}
							custom = all_hunt_participants
							add_opinion = {
								modifier = respect_opinion
								target = root
								opinion = -15
							}
						}
						random_in_list = {
							variable = potential_hunt_participants
							limit = {
								NOT = { this = scope:heir_participant }
							}
							save_scope_as = participant
							scope:secret = {
								expose_secret = scope:participant
							}
						}
					}
					root = {
						change_variable = {
							name = hunt_outcome
							add = -2
						}
					}
				}
			}
		}
		stress_impact = {
			honest = medium_stress_impact_gain
			just = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 50
				OR = {
					has_trait = deceitful
					has_trait = callous
				}
			}
			modifier = {
				add = 50
				diplomacy > average_skill_rating
			}
		}
	}

	option = { #Cover it up
		name = hunt.4008.b
		duel = {
			skill = intrigue
			value = 10
			12 = {
				desc = hunt.4008.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
				send_interface_toast = {
					title = hunt.4008.b.success
					left_icon = scope:heir_participant
					custom_tooltip = hunt.4008.b.success_tt
					root = {
						change_variable = {
							name = hunt_outcome
							add = 1
						}
					}
				}
			}
			8 = {
				desc = hunt.4008.b.failure
				send_interface_toast = {
					title = hunt.4008.b.failure
					left_icon = scope:heir_participant
					scope:activity = {
						random_in_list = {
							variable = potential_hunt_participants
							limit = {
								NOT = { this = scope:heir_participant }
							}
							save_scope_as = participant
							scope:secret = {
								expose_secret = scope:participant
							}
						}
					}
					root = {
						change_variable = {
							name = hunt_outcome
							add = -2
						}
					}
				}
			}
		}
		stress_impact = {
			honest = medium_stress_impact_gain
			just = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 50
				OR = {
					has_trait = deceitful
					has_trait = callous
				}
			}
			modifier = {
				add = 50
				intrigue > average_skill_rating
			}
		}
	}
	
	option = { #Heir will pay for this
		name = hunt.4008.c
		scope:secret = {
			expose_secret = root
		}
		change_variable = {
			name = hunt_outcome
			add = -1
		}
		stress_impact = {
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 75
				OR = {
					has_trait = just
					has_trait = honest
				}
			}
		}
	}

	option = { #I'll kill them
		name = hunt.4008.d
		
		unknown_murder_effect = {
			VICTIM = scope:heir_participant
			MURDERER = root
			REASON = death_hunting_accident
		}

		change_variable = {
			name = hunt_outcome
			add = -2
		}
		stress_impact = {
			vengeful = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 50
				has_trait = sadistic
			}
			modifier = {
				add = 50
				opinion = {
					target = scope:heir_participant
					value <= -20
				}
			}
		}
	}

	after = {
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}



#######################
#	Someone has a murder/abduct scheme against you (or you heir dislikes you)
#	by Linnéa Thimrén
#######################

scripted_trigger hunt_4009_scheme_trigger = {
	OR = {
		scheme_type = murder
		scheme_type = abduct
	}
	scheme_target = root
}

scripted_trigger hunt_4009_scheming_character_trigger = {
	is_alive = yes
	is_available_ai_adult = yes
	OR = {
		any_scheme = {
			hunt_4009_scheme_trigger = yes
		}
		AND = {
			this = root.player_heir
			reverse_opinion = {
				target = root
				value <= -10
			}
			has_any_good_relationship_with_root_trigger = no
			can_start_scheme = {
				type = murder
				target = root
			}
		}
	}
}

hunt.4009 = {
	type = character_event
	title = hunt.4009.t
	desc = hunt.4009.desc
	theme = hunt_activity
	right_portrait = {
		character = scope:schemer
		animation = anger
	}
	lower_left_portrait = scope:saving_participant
	
	trigger = {
		scope:activity = {
			any_in_list = {
				variable = potential_hunt_participants
				hunt_4009_scheming_character_trigger = yes
			}
		}
	}

	immediate = {
		play_music_cue = "mx_cue_stress"
		select_local_animal_effect = yes
		scope:activity = { #Find a participant who schemes against you
			random_in_list = {
				variable = potential_hunt_participants
				limit = {
					hunt_4009_scheming_character_trigger = yes
				}
				weight = {
					base = 1
					modifier = {#More likely if they scheme against you
						add = 1
						any_scheme = {
							hunt_4009_scheme_trigger = yes
						}
					}
				}
				save_scope_as = schemer
			}
		}
		scope:schemer = { #To save the scheme
			if = {
				limit = {
					any_scheme = {
						hunt_4009_scheme_trigger = yes
					}
				}
				random_scheme = {
					limit = {
						hunt_4009_scheme_trigger = yes
					}
					save_scope_as = scheme
				}
			}
			else = { # Start a new scheme if none exists
				start_scheme = {
					type = murder
					target = root
				}
				random_scheme = {
					limit = {
						scheme_type = murder
						scheme_target = root
					}
					save_scope_as = scheme
				}
			}

			#Set a murder secret if it's a murder attempt
			if = {
				limit = {
					scope:scheme = {
						scheme_type = murder
					}
				}
				add_secret = {
					type = secret_murder_attempt
					target = root
				}
				random_secret = {
					limit = {
						secret_type = secret_murder_attempt
						secret_target = root
					}
					save_scope_as = murder_secret
				}
			}
		}
		scope:activity = { #Find a participant to help you!
			random_in_list = {
				variable = potential_hunt_participants
				limit = {
					is_alive = yes
					prowess > root.prowess
					opinion = {
						target = root
						value >= 0
					}
					NOR = {
						opinion = {
							target = scope:schemer
							value >= 40
						}
						scope:scheme = {
							scheme_is_character_agent = prev
						}
					}
				}
				weight = {
					base = 0
					modifier = {
						add = {
							value = prowess
							multiply = 0.5
						}
					}
					modifier = {
						add = 3
						has_trait = education_martial
					}
				}
				save_scope_as = saving_participant
			}
		}
		change_variable = {
			name = hunt_outcome
			add = -2
		}
	}

	option = { #Take them on: Murder
		name = hunt.4009.a
		trigger = {
			scope:scheme = {
				scheme_type = murder
			}
		}
		scope:murder_secret = {
			reveal_to = root
		}
		duel = {
			skill = prowess
			target = scope:schemer
			10 = { #Nothing happens but reveal
				desc = hunt.4009.a.success
				compare_modifier = {
					value = scope:duel_value
				}
				send_interface_toast = {
					title = hunt.4009.a.success
					left_icon = scope:schemer
				}
				change_variable = {
					name = hunt_outcome
					add = 1
				}
			}
			6 = { #They wound me
				desc = hunt.4009.a.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.5
				}
				send_interface_toast = {
					title = hunt.4009.a.failure
					left_icon = scope:schemer
					increase_wounds_effect = {
						REASON = fight
					}
					if = {
						limit = {
							NOT = {
								has_trait = wounded_3
							}
						}
						add_character_modifier = {
							modifier = watchful_modifier
							days = watchful_modifier_duration
						}
					}
				}
			}
			2 = { #Their scheme succeeds
				desc = hunt.4009.a.critical_failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.5
				}
				send_interface_toast = {
					title = hunt.4009.a.critical_failure
					left_icon = scope:schemer
					unknown_murder_effect = {
						VICTIM = root
						MURDERER = scope:schemer
						REASON = death_hunting_accident
					}
				}
			}
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 50
				prowess > scope:schemer.prowess
			}
		}
	}

	option = { #Take them on: Abduction
		name = hunt.4009.a
		trigger = {
			scope:scheme = {
				scheme_type = abduct
			}
		}
		duel = {
			skill = prowess
			target = scope:schemer
			10 = { #Nothing happens but reveal
				desc = hunt.4009.a.success
				compare_modifier = {
					value = scope:duel_value
				}
				send_interface_toast = {
					title = hunt.4009.a.success
					left_icon = scope:schemer

					add_opinion = {
						target = scope:schemer
						modifier = attempted_abduction_opinion
					}
					add_character_modifier = {
						modifier = watchful_modifier
						days = watchful_modifier_duration
					}
				}
				change_variable = {
					name = hunt_outcome
					add = 1
				}
			}
			6 = { #They wound me
				desc = hunt.4009.a.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.5
				}
				send_interface_toast = {
					title = hunt.4009.a.failure
					left_icon = scope:schemer
					increase_wounds_effect = {
						REASON = fight
					}
					if = {
						limit = {
							NOT = {
								has_trait = wounded_3
							}
						}
						add_opinion = {
							target = scope:schemer
							modifier = attempted_abduction_opinion
						}
						add_character_modifier = {
							modifier = watchful_modifier
							days = watchful_modifier_duration
						}
					}
				}
			}
			2 = { #Their scheme succeeds
				desc = hunt.4009.a.critical_failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.5
				}
				hard_imprison_character_effect = {
					TARGET = root
					IMPRISONER = scope:schemer
				}
				add_opinion = {
					target = scope:schemer
					modifier = abducted_me_opinion
				}
			}
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 50
				prowess > scope:schemer.prowess
			}
		}
	}

	option = { #Call for help: Murder
		name = hunt.4009.b
		trigger = {
			exists = scope:saving_participant
			scope:scheme = {
				scheme_type = murder
			}
		}
		scope:murder_secret = {
			reveal_to = root
		}
		scope:murder_secret = {
			reveal_to = scope:saving_participant
		}
		add_prestige = medium_prestige_loss
		scope:saving_participant = { #The rescuer does the rescuing
			duel = {
				skill = prowess
				target = scope:schemer
				10 = { #They become wounded
					desc = hunt.4009.b.critical_success
					compare_modifier = {
						value = scope:duel_value
					}
						
					root = {
						send_interface_toast = {
							title = hunt.4009.b.critical_success
							left_icon = scope:schemer
							add_character_modifier = {
								modifier = watchful_modifier
								days = watchful_modifier_duration
							}
							add_opinion = {
								target = scope:saving_participant
								modifier = grateful_opinion
								opinion = 40
							}

							scope:schemer = {
								increase_wounds_effect = {
									REASON = fight
								}
							}
						}
					}
					root = {
						change_variable = {
							name = hunt_outcome
							add = 1
						}
					}
				}
				6 = {
					desc = hunt.4009.b.failure
					compare_modifier = {
						value = scope:duel_value
						multiplier = -0.5
					}
					root = {
						send_interface_toast = {
							title = hunt.4009.b.failure
							left_icon = scope:schemer
							scope:saving_participant = {
								increase_wounds_effect = {
									REASON = fight
								}
							}
							add_character_modifier = {
								modifier = watchful_modifier
								days = watchful_modifier_duration
							}
						}
					}
				}
				2 = {
					desc = hunt.4009.b.critial_failure
					compare_modifier = {
						value = scope:duel_value
						multiplier = -0.5
					}
					root = {
						send_interface_toast = {
							left_icon = scope:schemer
							title = hunt.4009.b.critial_failure

							unknown_murder_effect = {
								VICTIM = root
								MURDERER = scope:schemer
								REASON = death_hunting_accident
							}
							unknown_murder_effect = {
								VICTIM = scope:saving_participant
								MURDERER = scope:schemer
								REASON = death_hunting_accident
							}
						}
					}
				}
			}
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 50
				prowess <= scope:schemer.prowess
			}
			modifier = {
				add = 25
				scope:saving_participant.prowess > scope:schemer.prowess
			}
		}
	}

	option = { #Call for help: Abduction
		name = hunt.4009.b
		trigger = {
			exists = scope:saving_participant
			scope:scheme = {
				scheme_type = abduct
			}
		}
		add_prestige = medium_prestige_loss
		scope:saving_participant = { #The rescuer does the rescuing
			duel = {
				skill = prowess
				target = scope:schemer
				10 = { #They become wounded
					desc = hunt.4009.b.critical_success
					compare_modifier = {
						value = scope:duel_value
					}
						
					root = {
						send_interface_toast = {
							title = hunt.4009.b.critical_success
							left_icon = scope:schemer

							add_opinion = {
								target = scope:schemer
								modifier = attempted_abduction_opinion
							}
							add_character_modifier = {
								modifier = watchful_modifier
								days = watchful_modifier_duration
							}

							scope:schemer = {
								increase_wounds_effect = {
									REASON = fight
								}
							}
						}
					}
					root = {
						change_variable = {
							name = hunt_outcome
							add = 1
						}
					}
				}
				6 = {
					desc = hunt.4009.b.failure
					compare_modifier = {
						value = scope:duel_value
						multiplier = -0.5
					}
					#Chance of the rescuer dying
					random = {
						chance = {
							value = 50
							subtract = scope:saving_participant.prowess
						}
						unknown_murder_effect = {
							VICTIM = scope:saving_participant
							MURDERER = scope:schemer
							REASON = death_hunting_accident
						}
					}
					root = {
						send_interface_toast = {
							title = hunt.4009.b.failure
							left_icon = scope:schemer
							increase_wounds_effect = {
								REASON = fight
							}
							add_opinion = {
								target = scope:schemer
								modifier = attempted_abduction_opinion
							}
							add_character_modifier = {
								modifier = watchful_modifier
								days = watchful_modifier_duration
							}
						}
					}
				}
				2 = {
					desc = hunt.4009.b.critial_failure
					compare_modifier = {
						value = scope:duel_value
						multiplier = -0.5
					}
					root = {
						send_interface_toast = {
							left_icon = scope:schemer
							title = hunt.4009.b.critial_failure


							hard_imprison_character_effect = {
								TARGET = root
								IMPRISONER = scope:schemer
							}
							add_opinion = {
								target = scope:schemer
								modifier = abducted_me_opinion
							}

							hard_imprison_character_effect = {
								TARGET = scope:schemer
								IMPRISONER = scope:schemer
							}
							scope:saving_participant = {
								add_opinion = {
									target = scope:schemer
									modifier = abducted_me_opinion
								}
							}
						}
					}
				}
			}
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 50
				prowess <= scope:schemer.prowess
			}
			modifier = {
				add = 25
				scope:saving_participant.prowess > scope:schemer.prowess
			}
		}
	}
	
	option = { #Run! - Murder
		name = hunt.4009.c
		trigger = {
			scope:scheme = {
				scheme_type = murder
			}
		}
		random_list = {
			80 = {
				desc = hunt.4009.a.success
				send_interface_toast = {
					title = hunt.4009.a.success
					left_icon = scope:schemer

					scope:murder_secret = {
						reveal_to = root
					}
					add_character_modifier = {
						modifier = watchful_modifier
						days = watchful_modifier_duration
					}
				}
				change_variable = {
					name = hunt_outcome
					add = 1
				}
			}
			20 = {
				desc = hunt.4009.c.failure
				send_interface_toast = {
					title = hunt.4009.c.failure
					left_icon = scope:schemer

					unknown_murder_effect = {
						VICTIM = root
						MURDERER = scope:schemer
						REASON = death_hunting_accident
					}
				}
			}
		}
		ai_chance = {
			base = 0
			#More likely the more scared I am of the schemer
			modifier = {
				add = 25
				dread_modified_ai_boldness = {
					dreaded_character = scope:schemer
					value <= -45
				}
			}
			modifier = {
				add = 50
				dread_modified_ai_boldness = {
					dreaded_character = scope:schemer
					value <= -75
				}
			}
		}
	}
	
	option = { #Run! - Abduction
		name = hunt.4009.c
		trigger = {
			scope:scheme = {
				scheme_type = abduct
			}
		}
		random_list = {
			80 = {
				desc = hunt.4009.a.success
				send_interface_toast = {
					title = hunt.4009.a.success
					left_icon = scope:schemer

					add_opinion = {
						target = scope:schemer
						modifier = attempted_abduction_opinion
					}
					add_character_modifier = {
						modifier = watchful_modifier
						days = watchful_modifier_duration
					}
				}
				change_variable = {
					name = hunt_outcome
					add = 1
				}
			}
			20 = {
				desc = hunt.4009.c.failure
				send_interface_toast = {
					title = hunt.4009.c.failure
					left_icon = scope:schemer

					hard_imprison_character_effect = {
						TARGET = root
						IMPRISONER = scope:schemer
					}
					add_opinion = {
						target = scope:schemer
						modifier = abducted_me_opinion
					}
				}
			}
		}
		ai_chance = {
			base = 0
			#More likely the more scared I am of the schemer
			modifier = {
				add = 25
				dread_modified_ai_boldness = {
					dreaded_character = scope:schemer
					value <= -45
				}
			}
			modifier = {
				add = 50
				dread_modified_ai_boldness = {
					dreaded_character = scope:schemer
					value <= -75
				}
			}
		}
	}

	after = {
		#Make sure the Scheme is removed, whatever else happens
		if = {
			limit = {
				exists = scope:scheme
			}
			scope:scheme = {
				end_scheme = yes
			}
		}
		#End the hunt, if still relevant
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}



#######################
#	Someone has a murder scheme against a close family member
#	by Linnéa Thimrén
#######################

scripted_trigger hunt_4010_scheme_trigger = {
	scheme_type = murder
	
	# Scheme target is a close relative/spouse.
	scheme_target = {
		is_available_ai_adult = yes
		is_close_family_or_spouse_trigger = {
			CHARACTER = root
		}
		save_temporary_scope_as = targeted_participant_check
	}
	# Scheme target must also be on the hunt with us.
	scope:activity = {
		any_in_list = {
			variable = potential_hunt_participants
			is_alive = yes
			this = scope:targeted_participant_check

		}
	}
}

scripted_trigger hunt_4010_scheming_character_trigger = {
	is_alive = yes
	is_available_ai_adult = yes
	any_scheme = {
		hunt_4010_scheme_trigger = yes
	}
}

scripted_trigger hunt_4010_targeted_participant_trigger = {
	is_alive = yes
	is_available_ai_adult = yes
	is_close_family_or_spouse_trigger = {
		CHARACTER = root
	}
	any_targeting_scheme = {
		scheme_type = murder
		scheme_owner = scope:schemer
	}
}

hunt.4010 = {
	type = character_event
	title = hunt.4009.t # Title shared between 4009 and 4010
	desc = hunt.4010.desc
	theme = hunt_activity
	left_portrait = {
		character = scope:targeted_participant
		animation = shock
	}
	right_portrait = {
		character = scope:schemer
		animation = anger
	}
	
	trigger = {
		scope:activity = {
			any_in_list = {
				variable = potential_hunt_participants
				hunt_4010_scheming_character_trigger = yes
			}
		}
	}

	immediate = {
		play_music_cue = "mx_cue_stress"
		select_local_animal_effect = yes
		scope:activity = {
			random_in_list = { #Find a participant who schemes against you
				variable = potential_hunt_participants
				limit = {
					hunt_4010_scheming_character_trigger = yes
				}
				save_scope_as = schemer
			}
			random_in_list = { #Find the target
				variable = potential_hunt_participants
				limit = {
					hunt_4010_targeted_participant_trigger = yes
				}
				save_scope_as = targeted_participant
			}
		}
		scope:schemer = {
			random_scheme = {
				limit = {
					hunt_4010_scheme_trigger = yes
				}
				save_scope_as = scheme
			}
		}
		#If it's a murder, create an attempted murder Secret
		if = {
			limit = {
				scope:scheme = {
					scheme_type = murder
				}
			}
			scope:schemer = {
				add_secret = {
					type = secret_murder_attempt
					target = scope:targeted_participant
				}
				random_secret = {
					limit = {
						secret_type = secret_murder_attempt
						secret_target = scope:targeted_participant
					}
					save_scope_as = murder_secret
				}
			}
			scope:murder_secret = {
				reveal_to_without_events_effect = {
					CHARACTER = root
				}
				hidden_effect = {
					reveal_to_without_events_effect = {
						CHARACTER = scope:targeted_participant
					}
				}
			}
		}
		change_variable = {
			name = hunt_outcome
			add = -2
		}
	}

	option = { #Take them on
		name = hunt.4010.a
		trigger = {
			scope:scheme = {
				scheme_type = murder
			}
		}
		
		duel = {
			skill = prowess
			target = scope:schemer
			12 = { #Wound them
				desc = hunt.4010.a.critical_success
				compare_modifier = {
					value = scope:duel_value
				}
				send_interface_toast = {
					title = hunt.4010.a.critical_success
					left_icon = scope:schemer
					right_icon = scope:targeted_participant

					add_prestige = medium_prestige_gain

					scope:schemer = {
						increase_wounds_effect = {
							REASON = fight
						}
					}

					scope:targeted_participant = {
						add_opinion = {
							target = root
							modifier = respect_opinion
							opinion = 20
						}
					}
				}
				change_variable = {
					name = hunt_outcome
					add = 1
				}
			}
			9 = {
				desc = hunt.4010.a.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.5
				}
				send_interface_toast = {
					title = hunt.4010.a.failure
					left_icon = scope:schemer
					right_icon = scope:targeted_participant

					increase_wounds_effect = {
						REASON = fight
					}

					save_scope_value_as = {
						name = murder_completed
						value = yes
					}
				}
			}
			3 = {
				desc = hunt.4010.a.critical_failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.25
				}
				send_interface_toast = {
					title = hunt.4010.a.critical_failure
					left_icon = scope:schemer
					right_icon = scope:targeted_participant

					unknown_murder_effect = {
						VICTIM = root
						MURDERER = scope:schemer
						REASON = death_hunting_accident
					}

					unknown_murder_effect = {
						VICTIM = scope:targeted_participant
						MURDERER = scope:schemer
						REASON = death_hunting_accident
					}
				}
			}
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 50
				prowess >= scope:schemer.prowess
			}
		}
	}

	option = { #Let your family member take them on
		name = hunt.4010.b
		trigger = {
			scope:scheme = {
				scheme_type = murder
			}
		}
		scope:targeted_participant = {
			duel = {
				skill = prowess
				target = scope:schemer
				12 = {
					desc = hunt.4010.b.critical_success
					compare_modifier = {
						value = scope:duel_value
					}
					root = {
						send_interface_toast = {
							title = hunt.4010.b.critical_success
							left_icon = scope:schemer
							right_icon = scope:targeted_participant

							scope:murder_secret = {
								expose_secret = scope:schemer
							}

							scope:schemer = {
								increase_wounds_effect = {
									REASON = fight
								}
							}
						}
					}
					root = {
						change_variable = {
							name = hunt_outcome
							add = 1
						}
					}
				}
				9 = {
					desc = hunt.4010.b.failure
					compare_modifier = {
						value = scope:duel_value
						multiplier = -0.5
					}
					root = {
						send_interface_toast = {
							title = hunt.4010.b.failure
							left_icon = scope:schemer
							right_icon = scope:targeted_participant

							scope:targeted_participant = {
								increase_wounds_effect = {
									REASON = fight
								}
							}
							save_scope_value_as = {
								name = murder_completed
								value = yes
							}
						}
					}
				}
				3 = {
					desc = hunt.4010.b.critical_failure
					compare_modifier = {
						value = scope:duel_value
						multiplier = 0.25
					}
					root = {
						send_interface_toast = {
							title = hunt.4010.b.critical_failure
							left_icon = scope:schemer
							right_icon = scope:targeted_participant

							unknown_murder_effect = {
								VICTIM = root
								MURDERER = scope:schemer
								REASON = death_hunting_accident
							}
							unknown_murder_effect = {
								VICTIM = scope:targeted_participant
								MURDERER = scope:schemer
								REASON = death_hunting_accident
							}
						}
					}
				}
			}
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 50
				prowess < scope:schemer.prowess
			}
			#More likely the more scared I am of the schemer
			modifier = {
				add = 25
				dread_modified_ai_boldness = {
					dreaded_character = scope:schemer
					value <= -45
				}
			}
			modifier = {
				add = 50
				dread_modified_ai_boldness = {
					dreaded_character = scope:schemer
					value <= -75
				}
			}
		}
	}

	option = { #Call for help
		name = hunt.4010.c

		add_prestige = medium_prestige_loss

		scope:murder_secret = {
			expose_secret = root
		}
		
		change_variable = {
			name = hunt_outcome
			add = 1
		}

		ai_chance = {
			base = 0
			modifier = {
				add = 50
				AND = {
					prowess < scope:schemer.prowess
					scope:targeted_participant.prowess < scope:schemer.prowess
				}
			}
			#More likely the more scared I am of the schemer
			modifier = {
				add = 25
				dread_modified_ai_boldness = {
					dreaded_character = scope:schemer
					value <= -45
				}
			}
			modifier = {
				add = 50
				dread_modified_ai_boldness = {
					dreaded_character = scope:schemer
					value <= -75
				}
			}
		}
	}
	
	option = { #Sacrifice yourself
		name = hunt.4010.d
		trigger = {
			ai_honor >= high_positive_honor
		}
		custom_tooltip = hunt.4010.d.tt
		
		increase_wounds_effect = {
			REASON = fight
		}
		scope:targeted_participant = {
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = 40
			}
		}

		scope:murder_secret = {
			expose_secret = root
		}
		ai_chance = {
			base = 50
		}
	}
	
	after = {
		#If the murder was accomplished, root learns the Secret
		if = {
			limit = {
				exists = scope:murder_completed
			}
			scope:schemer = {
				random_secret = {
					limit = {
						secret_type = secret_murder
						secret_target = scope:targeted_participant
					}
					reveal_to_without_events_effect = {
						CHARACTER = root
					}
				}
			}
		}

		#Make sure the scheme ends
		if = {
			limit = {
				exists = scope:scheme
			}
			scope:scheme = {
				end_scheme = yes
			}
		}

		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}



#######################
#	Your lover has come with, sneak away together
#	by Linnéa Thimrén
#######################
scripted_trigger hunt_4011_lover_trigger = {
	is_alive = yes
	is_available_ai_adult = yes
	has_relation_lover = root
}

hunt.4011 = {
	type = character_event
	title = hunt.4011.t
	desc = hunt.4011.desc
	theme = seduction
	override_background = {
		event_background = terrain_scope
	}
	right_portrait = {
		character = scope:lover_participant
		animation = flirtation
	}
	
	trigger = {
		scope:activity = {
			any_in_list = {
				variable = potential_hunt_participants
				hunt_4011_lover_trigger = yes
			}
		}
	}

	weight_multiplier = {
		base = 0.5
		modifier = { #more likely to fire if no cool characters have joined
			add = 0.5
			scope:activity = {
				NOT = {
					any_in_list = {
						variable = potential_hunt_participants
						is_available_ai_adult = yes
						is_powerful_vassal_of = root
					}
				}
			}
		}
	}

	immediate = {
		play_music_cue = "mx_cue_seduction"
		select_local_animal_effect = yes
		scope:activity.activity_province = { save_scope_as = background_terrain_scope }
		scope:activity = {
			random_in_list = { #Find your lover!
				variable = potential_hunt_participants
				limit = {
					hunt_4011_lover_trigger = yes
				}
				save_scope_as = lover_participant
			}
		}
		change_variable = {
			name = hunt_outcome
			add = 1
		}
	}

	option = { #Go for it
		name = hunt.4011.a
		flavor = hunt.4011.a.tt
		add_character_modifier = {
			modifier = hunt_fresh_air_and_exercise_modifier
			years = 5
		}
		scope:lover_participant = {
			add_opinion = {
				target = root
				modifier = love_opinion
				opinion = 20
			}
		}
		change_variable = {
			name = hunt_outcome
			add = 1
		}
		stress_impact = {
			rakish = medium_stress_impact_loss
			chaste = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 0.5
			}
		}
	}

	option = { #Nah
		name = hunt.4011.b
		add_prestige = minor_prestige_gain
		add_character_modifier = {
			modifier = hunt_focused_attention_modifier
			years = 5
		}
		change_variable = {
			name = hunt_outcome
			add = -1
		}
		stress_impact = {
			lustful = medium_stress_impact_gain
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 100
				has_trait = lifestyle_hunter
			}
			ai_value_modifier = {
				ai_honor = 0.25
			}
		}
	}
	
	after = {
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}


#######################
#	See glimpse of mystical animal
#	by Linnéa Thimrén
#######################

hunt.4012 = {
	type = character_event
	title = hunt.4012.t
	desc = hunt.4012.desc
	theme = hunt_activity
	left_portrait = root
	
	trigger = {
		NOR = {
			has_character_flag = hunt_saw_mystical_animal
			has_character_flag = had_mystical_animal_story
		}
	}

	weight_multiplier = {
		base = 0.5
	}

	immediate = {
		select_local_animal_effect = yes
	}

	option = { #Chase it
		name = hunt.4012.a
		flavor = hunt.4012.a.tt
		add_character_flag = hunt_saw_mystical_animal
		trigger_event = {
			id = hunt.4013
			days = { 3 7 }
		}
		change_variable = {
			name = hunt_outcome
			add = 2
		}
		ai_chance = {
			base = 80
		}
	}

	option = { #Don't chase it
		name = hunt.4012.b
		remove_variable = local_animal
		add_character_modifier = {
			modifier = hunt_focused_attention_modifier
			years = 5
		}
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_rationality = 0.75
			}
		}
	}
}

#######################
#	You do not find the animal
#	by Linnéa Thimrén
#######################

hunt.4013 = {
	type = character_event
	title = hunt.4012.t
	desc = hunt.4013.desc
	theme = hunt_activity
	left_portrait = root
	
	trigger = {
		has_character_flag = hunt_saw_mystical_animal
	}

	weight_multiplier = {
		base = 0.75
	}

	immediate = {
		change_variable = {
			name = hunt_outcome
			add = -1
		}
		scope:activity.activity_province = {
			county = {
				save_scope_as = activity_place
				holder = {
					save_scope_as = county_owner
				}
			}
		}
	}

	option = { #Hmm, did not find it... yet
		name = hunt.4013.a
		start_hunt_mystical_animal_story_cycle_effect = yes
		remove_variable = local_animal
		ai_chance = {
			base = 75
		}
	}

	option = { #Lie about what you were doing
		name = hunt.4013.b
		scope:activity = {
			every_in_list = {
				variable = potential_hunt_participants
				limit = {
					is_alive = yes
				}
				custom = all_hunt_participants
				add_opinion = {
					modifier = respect_opinion
					target = root
					opinion = 10
				}
			}
		}
		remove_variable = local_animal
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_rationality = 0.5
			}
		}
	}

	after = {
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}



#######################
#	A vassal is injured
#	by Linnéa Thimrén
#######################
scripted_trigger hunt_4014_vassal_trigger = {
	is_vassal_of = root
	is_ai = yes
	NOT = {
		has_trait_rank = {
			trait = wounded
			rank >= 2
		}
	}
}

hunt.4014 = {
	type = character_event
	title = hunt.4014.t
	desc = hunt.4014.desc
	theme = hunt_activity
	right_portrait = {
		character = scope:hunt_participant
		animation = pain
	}
	
	trigger = {
		scope:activity = {
			any_in_list = {
				variable = potential_hunt_participants
				hunt_4014_vassal_trigger = yes
			}
		}
	}

	weight_multiplier = {
		base = 0.5
		modifier = { #more likely to fire if a cool character has joined
			add = 0.5
			scope:activity = {
				any_in_list = {
					variable = potential_hunt_participants
					hunt_4014_vassal_trigger = yes
					is_powerful_vassal_of = root
				}
			}
		}
	}

	immediate = {
		select_local_animal_effect = yes
		scope:activity = {
			random_in_list = { #Find your vassal
				variable = potential_hunt_participants
				limit = {
					hunt_4014_vassal_trigger = yes
					is_powerful_vassal_of = root
				}
				alternative_limit = {
					hunt_4014_vassal_trigger = yes
				}
				save_scope_as = hunt_participant
				increase_wounds_effect = { REASON = hunting_accident }
			}
		}
	}

	option = { #Treat vassal
		name = hunt.4014.a
		trigger = {
			NOR = {
				AND = {
					has_focus = learning_medicine_focus
					learning >= medium_skill_rating
				}
				learning >= high_skill_rating
			}
		}
		scope:hunt_participant = {
			add_character_modifier = {
				modifier = hunt_treated_wound_modifier
				years = 5
			}
			add_opinion = {
				target = root
				modifier = kindness_opinion
				opinion = 20
			}
		}
		add_character_modifier = {
			modifier = hunt_treated_injury_modifier
			years = 10
		}
		if = {
			limit = {
				has_personality_benevolent_trigger = yes
			}
			change_variable = {
				name = hunt_outcome
				add = 2
			}
		}
		else = {
			change_variable = {
				name = hunt_outcome
				add = -2
			}
		}
		remove_variable = local_animal
		stress_impact = {
			sadistic = medium_stress_impact_gain
			callous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.75
			}
		}
	}

	option = { #Treat vassal - you know your stuff
		name = hunt.4014.b
		trigger = {
			OR = {
				AND = {
					has_focus = learning_medicine_focus
					learning >= medium_skill_rating
				}
				learning >= high_skill_rating
			}
		}
		skill = learning
		scope:hunt_participant = {
			add_opinion = {
				target = root
				modifier = kindness_opinion
				opinion = 20
			}
			change_trait_rank = {
				trait = wounded
				rank = -1
				max = 1
			}
		}
		add_character_modifier = {
			modifier = hunt_treated_injury_modifier
			years = 10
		}
		change_variable = {
			name = hunt_outcome
			add = 2
		}
		remove_variable = local_animal
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.75
			}
		}
	}

	option = { #Continue hunt
		name = hunt.4014.c
		add_prestige = medium_prestige_gain
		scope:hunt_participant = {
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = -15
			}
		}
		if = {
			limit = {
				has_personality_benevolent_trigger = yes
			}
			change_variable = {
				name = hunt_outcome
				add = -2
			}
		}
		else = {
			change_variable = {
				name = hunt_outcome
				add = 2
			}
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 30
				has_trait = lifestyle_hunter
			}
			ai_value_modifier = {
				ai_honor = 0.25
			}
		}
	}
	
	after = {
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}


#######################
#	You walk in (out?) on lovers
#	by Linnéa Thimrén
#######################

scripted_trigger hunt_4015_basic_check_trigger = {
	NOT = { this = root }
	is_adult = yes
	is_ai = yes
	mgr_can_seduce = yes
}

scripted_trigger hunt_4015_secret_trigger = {
	any_secret = {
		secret_type = secret_lover
		NOT = { is_known_by = root }
		secret_target = {
			hunt_4015_basic_check_trigger = yes
			save_temporary_scope_as = lover_check
			scope:activity = {
				is_target_in_variable_list = {
					name = potential_hunt_participants
					target = scope:lover_check
				}
			}
		}
	}
}

hunt.4015 = {
	type = character_event
	title = hunt.4015.t
	desc = hunt.4015.desc
	theme = hunt_activity
	left_portrait = {
		character = scope:lover_participant
		animation = flirtation
	}
	right_portrait = {
		character = scope:second_lover_participant
		animation = flirtation
	}
	
	trigger = {
		scope:activity = {
			OR = { #Either two that are already lovers, or a lustful one that can pick someone up
				any_in_list = {
					variable = potential_hunt_participants
					hunt_4015_basic_check_trigger = yes
					hunt_4015_secret_trigger = yes
				}
				any_in_list = {
					variable = potential_hunt_participants
					hunt_4015_basic_check_trigger = yes
					has_trait = lustful
					save_temporary_scope_as = lover_check
					scope:activity = {
						any_in_list = {
							variable = potential_hunt_participants
							hunt_4015_basic_check_trigger = yes
							NOT = { this = scope:lover_check }
							matching_gender_and_sexuality_trigger = { CHARACTER_1 = this CHARACTER_2 = scope:lover_check }
							can_set_relation_lover_trigger = { CHARACTER = scope:lover_check }
						}
					}
				}
			}
		}
	}


	weight_multiplier = {
		base = 0.75
		modifier = { #more likely to fire if two participants already are lovers
			add = 0.5
			scope:activity = {
				any_in_list = {
					variable = potential_hunt_participants
					hunt_4015_basic_check_trigger = yes
					hunt_4015_secret_trigger = yes
				}
			}
		}
	}

	immediate = {
		select_local_animal_effect = yes
		scope:activity = {
			random_in_list = { #Find your vassal
				variable = potential_hunt_participants
				limit = { #They are already lovers
					hunt_4015_basic_check_trigger = yes
					hunt_4015_secret_trigger = yes
				}
				alternative_limit = { #We make em lovers
					hunt_4015_basic_check_trigger = yes
					has_trait = lustful
					save_temporary_scope_as = lover_check
					scope:activity = {
						any_in_list = {
							variable = potential_hunt_participants
							hunt_4015_basic_check_trigger = yes
							NOT = { this = scope:lover_check }
							matching_gender_and_sexuality_trigger = { CHARACTER_1 = this CHARACTER_2 = scope:lover_check }
							can_set_relation_lover_trigger = { CHARACTER = scope:lover_check }
						}
					}
				}
				save_scope_as = lover_participant
			}
			random_in_list = {
				variable = potential_hunt_participants
				limit = { #They are already lovers
					hunt_4015_basic_check_trigger = yes
					NOT = { this = scope:lover_participant }
					any_secret = {
						secret_type = secret_lover
						NOT = { is_known_by = root }
						secret_target = {
							this = scope:lover_participant
						}
					}
				}
				alternative_limit = { #We make em lovers
					hunt_4015_basic_check_trigger = yes
					NOT = { this = scope:lover_participant }
					matching_gender_and_sexuality_trigger = { CHARACTER_1 = this CHARACTER_2 = scope:lover_participant }
					can_set_relation_lover_trigger = { CHARACTER = scope:lover_participant }
				}
				save_scope_as = second_lover_participant

				#If there's no secret we create one
				if = {
					limit = {
						NOT = {
							any_secret = {
								secret_type = secret_lover
								secret_target = {
									this = scope:lover_participant
								}
							}
						}
					}
					set_relation_lover = scope:lover_participant
				}
				#To save the secret's scope
				if = {
					limit = {
						any_secret = {
							secret_type = secret_lover
							secret_target = {
								this = scope:lover_participant
								hunt_4015_basic_check_trigger = yes
							}
							NOT = { is_known_by = root }
						}
					}
					random_secret = {
						limit = {
							secret_type = secret_lover
							secret_target = {
								this = scope:lover_participant
								hunt_4015_basic_check_trigger = yes
							}
							NOT = { is_known_by = root }
						}
						save_scope_as = secret
					}
				}
			}
		}
		scope:lover_participant = {
			if = {
				limit = {
					can_set_relation_lover_trigger = { CHARACTER = scope:second_lover_participant }
				}
				set_relation_lover = scope:second_lover_participant
				random_secret = {
					limit = {
						secret_type = secret_lover
						secret_target = {
							this = scope:second_lover_participant
							hunt_4015_basic_check_trigger = yes
						}
					}
					save_scope_as = secret
				}
			}
		}
		if = {
			limit = {
				exists = scope:secret
				scope:secret = {
					NOT = { is_known_by = root }
				}
			}
			scope:secret = {
				reveal_to_without_events_effect = {
					CHARACTER = root
				}
			}
		}
		if = {
			limit = {
				OR = {
					has_relation_lover = scope:lover_participant
					has_relation_lover = scope:second_lover_participant
				}
			}
			change_variable = {
				name = hunt_outcome
				add = -2
			}
		}
		else = {
			change_variable = {
				name = hunt_outcome
				add = 1
			}
		}
	}

	option = { #Keep the secret
		name = hunt.4015.a
		stress_impact = {
			honest = minor_stress_impact_gain
			contrite = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.5
			}
			modifier = {
				add = 20
				OR = {
					has_relation_lover = scope:lover_participant
					has_relation_lover = scope:second_lover_participant
				}
			}
		}
	}

	option = { #Expose the secret
		name = hunt.4015.b
		scope:secret = {
			expose_secret = root
		}
		stress_impact = {
			contrite = minor_stress_impact_loss
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 30
				OR = {
					has_trait = just
					has_trait = zealous
					has_trait = celibate
				}
			}
			ai_value_modifier = {
				ai_honor = 0.25
				ai_vengefulness = 0.25
			}
		}
	}

	option = { #Join in - relationship or seducer trait
		name = {
			trigger = {
				has_relation_lover = scope:lover_participant
			}
			text = hunt.4015.c_1
		}
		name = {
			trigger = {
				has_relation_lover = scope:second_lover_participant
			}
			text = hunt.4015.c_2
		}
		name = {
			trigger = {
				NOR = {
					has_relation_lover = scope:lover_participant
					has_relation_lover = scope:second_lover_participant
				}
			}
			text = hunt.4015.c_3
		}
		trigger = {
			OR = {
				AND = { #you only feel ok about it if you're lustful
					OR = {
						has_relation_lover = scope:lover_participant
						has_relation_lover = scope:second_lover_participant
					}
					has_trait = lustful
				}
				has_trait = seducer
			}
		}
		trait = seducer
		if = {
			limit = {
				has_relation_potential_lover = scope:lover_participant
				can_set_relation_lover_trigger = { CHARACTER = scope:lover_participant }
			}
			set_relation_lover = scope:lover_participant
		}
		else_if = {
			limit = {
				has_relation_lover = scope:lover_participant
			}
			scope:lover_participant = {
				add_opinion = {
					modifier = pleased_opinion
					target = root
					opinion = 20
				}
			}
		}
		else = {
			set_relation_potential_lover = scope:lover_participant
		}
		if = {
			limit = {
				has_relation_potential_lover = scope:second_lover_participant
				can_set_relation_potential_lover_trigger = { CHARACTER = scope:second_lover_participant }
			}
			set_relation_lover = scope:second_lover_participant
		}
		else_if = {
			limit = {
				has_relation_lover = scope:second_lover_participant
			}
			scope:second_lover_participant = {
				add_opinion = {
					modifier = pleased_opinion
					target = root
					opinion = 20
				}
			}
		}
		else = {
			set_relation_potential_lover = scope:second_lover_participant
		}
		change_variable = {
			name = hunt_outcome
			add = 2
		}
		stress_impact = {
			rakish = minor_stress_impact_loss
			lustful = minor_stress_impact_loss
		}
		ai_chance = {
			base = 75
			modifier = {
				add = 30
				has_trait = lustful
			}
		}
	}

	option = { #Betrayed!!
		name = hunt.4015.d
		trigger = { #Either you are soulmates, or you like them very much
			OR = {
				OR = {
					AND = {
						has_relation_lover = scope:lover_participant
						opinion = {
							target = scope:lover_participant
							value >= 70
						}
						NOT = { has_trait = lustful }
					}
					has_relation_soulmate = scope:lover_participant
				}
				OR = {
					AND = {
						has_relation_lover = scope:second_lover_participant
						opinion = {
							target = scope:second_lover_participant
							value >= 70
						}
						NOT = { has_trait = lustful }
					}
					has_relation_soulmate = scope:second_lover_participant
				}
			}
		}

		if = {
			limit = {
				OR = {
					AND = {
						has_relation_lover = scope:lover_participant
						opinion = {
							target = scope:lover_participant
							value >= 70
						}
						NOT = { has_trait = lustful }
					}
					has_relation_soulmate = scope:lover_participant
				}
			}
			scope:lover_participant = { save_scope_as = betraying_lover }
		}
		else = {
			scope:second_lover_participant = { save_scope_as = betraying_lover }
		}
		remove_relation_lover = scope:betraying_lover
		change_variable = {
			name = hunt_outcome
			add = -2
		}
		ai_chance = {
			base = 100
		}
	}
	
	after = {
		remove_variable = local_animal
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}



#######################
#	You fake a catch
#	by Linnéa Thimrén
#######################

hunt.4016 = {
	type = character_event
	title = hunt.4016.t
	desc = hunt.4016.desc
	theme = hunt_activity
	left_portrait = root

	weight_multiplier = {
		base = 0.25
		modifier = { #more likely to fire if you're sneaky or lazy
			add = 0.75
			OR = {
				has_trait = deceitful
				has_focus = intrigue_skulduggery_focus
				has_trait = schemer
				intrigue >= high_skill_rating
				has_trait = lazy
			}
		}
	}

	immediate = {
		select_local_animal_effect = yes
		change_variable = {
			name = hunt_outcome
			add = 1
		}
	}

	option = { #Buy a catch and fake it - Guaranteed success if you're good
		name = hunt.4016.a
		trigger = {
			OR = {
				has_trait = schemer
				intrigue >= high_skill_rating
			}
			short_term_gold >= minor_gold_value
		}
		trait = schemer
		skill = intrigue
		show_as_unavailable = {
			OR = {
				has_trait = schemer
				intrigue >= high_skill_rating
			}
			short_term_gold < medium_gold_value
		}
		remove_short_term_gold = minor_gold_value

		add_prestige = medium_prestige_gain
		add_character_modifier = {
			modifier = modifier_hunt_hunting_trophy
			years = 5
		}

		stress_impact = {
			honest = medium_stress_impact_gain
		}
		
		ai_chance = {
			base = 50
			modifier = {
				add = 30
				OR = {
					has_trait = deceitful
					has_focus = intrigue_skulduggery_focus
					has_trait = schemer
					intrigue >= high_skill_rating
					has_trait = lazy
				}
			}
			ai_value_modifier = {
				ai_energy = -0.5
			}
		}
	}

	option = { #Buy a catch and fake it
		name = hunt.4016.a
		trigger = {
			NOR = {
				has_trait = schemer
				intrigue >= high_skill_rating
			}
			short_term_gold >= minor_gold_value
		}
		show_as_unavailable = {
			NOR = {
				has_trait = schemer
				intrigue >= high_skill_rating
			}
			short_term_gold < medium_gold_value
		}
		remove_short_term_gold = minor_gold_value

		duel = {
			skill = intrigue
			value = 10
			35 = {
				desc = hunt.4016.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
				send_interface_toast = {
					title = hunt.4016.b.success
					left_icon = root
					add_prestige = medium_prestige_gain
					add_character_modifier = {
						modifier = modifier_hunt_hunting_trophy
						years = 5
					}
				}
				change_variable = {
					name = hunt_outcome
					add = 2
				}
			}
			10 = {
				desc = hunt.4016.b.failure
				send_interface_toast = {
					title = hunt.4016.b.failure
					left_icon = root
					add_prestige = medium_prestige_loss
				}
				change_variable = {
					name = hunt_outcome
					add = -1
				}
			}
		}

		stress_impact = {
			honest = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50
			modifier = {
				add = 30
				OR = {
					has_trait = deceitful
					has_focus = intrigue_skulduggery_focus
					has_trait = schemer
					intrigue >= high_skill_rating
					has_trait = lazy
				}
			}
			ai_value_modifier = {
				ai_energy = -0.5
			}
		}
	}

	option = { #Nah
		name = hunt.4016.c
		add_character_modifier = {
			modifier = hunt_chose_truth_modifier
			years = 5
		}
		
		change_variable = {
			name = hunt_outcome
			add = -1
		}

		stress_impact = {
			honest = medium_stress_impact_loss
			arrogant = minor_stress_impact_gain
			deceitful = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_honor = 0.5
			}
		}
	}
	
	after = {
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}


#######################
#	You get the mystical white animal!!
#	by Linnéa Thimrén
#######################

hunt.4017 = {
	type = character_event
	title = hunt.4012.t
	desc = hunt.4017.desc
	theme = hunt_activity
	left_portrait = root
	
	trigger = {
		any_owned_story = {
			story_type = story_cycle_hunt_mystical_animal
			exists = var:encounters
			var:encounters >= 3
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 1
			any_owned_story = {
				story_type = story_cycle_hunt_mystical_animal
				exists = var:encounters
				var:encounters >= 4
				NOT = { exists = var:killing_animal }
			}
		}
	}

	immediate = {
		play_music_cue = "mx_cue_touching_moment"
		change_variable = {
			name = hunt_outcome
			add = 4
		}
		random_owned_story = {
			limit = {
				story_type = story_cycle_hunt_mystical_animal
				exists = var:encounters
				var:encounters >= 3
			}
			save_scope_as = story
			set_variable = { #To safeguard against events from the story cycle itself triggering at the same time as this goes down
				name = killing_animal
				value = yes
			}
		}
		set_variable = { #To save the correct animal
			name = local_animal
			value = scope:story.var:local_animal
		}
	}

	option = { #I GOT IT! TAKE THAT, AHAB!!
		name = hunt.4017.a
		flavor = hunt.4017.a.tt
		end_hunt_mystical_animal_story_cycle_effect = yes
	}

	after = {
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}


#######################
#	You get another glimpse of the mystical white animal
#	by Linnéa Thimrén
#######################

hunt.4018 = {
	type = character_event
	title = hunt.4012.t
	desc = hunt.4018.desc
	theme = hunt_activity
	left_portrait = root
	
	trigger = {
		any_owned_story = {
			story_type = story_cycle_hunt_mystical_animal
		}
	}

	immediate = {
		change_variable = {
			name = hunt_outcome
			add = 2
		}
		random_owned_story = {
			limit = {
				story_type = story_cycle_hunt_mystical_animal
				exists = var:encounters
			}
			save_scope_as = story
			change_variable = { #You had yet another encounter
				name = encounters
				add = 1
			}
		}
		set_variable = { #To save the correct animal
			name = local_animal
			value = scope:story.var:local_animal
		}
	}

	option = { #Scour the area for it!
		name = hunt.4018.a
		flavor = hunt.4018.a.tt
		add_character_modifier = {
			modifier = hunt_disturbed_locals_modifier
			years = 5
		}
		hidden_effect = {
			random_list = {
				3 = { #You actually find it!
					modifier = {
						add = 2
						scope:story = {
							var:encounters >= 3
						}
					}
					modifier = {
						add = 2
						scope:story = {
							var:encounters >= 5
						}
					}
					trigger_event = {
						id = hunt.4017
						days = { 3 5 }
					}
				}
				75 = { #you find another animal
					trigger_event = {
						id = hunt.4019
						days = { 3 5 }
					}
				}
				25 = { #you find nothing
					send_interface_toast = {
						title = hunt.4018.a.failure
						left_icon = root
					}
					change_variable = {
						name = hunt_outcome
						add = -1
					}
				}
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 0.5
			}
		}
	}

	option = { #Whatever
		name = hunt.4018.b
		add_character_modifier = {
			modifier = hunt_focused_effort_modifier
			years = 5
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_rationality = 0.5
			}
		}
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}

#######################
#	You get another animal
#	by Linnéa Thimrén
#######################

hunt.4019 = {
	type = character_event
	title = hunt.4012.t
	desc = hunt.4019.desc
	theme = hunt_activity
	right_portrait = scope:hunting_courtier

	immediate = {
		change_variable = {
			name = hunt_outcome
			add = 1
		}

		if = {
			limit = {
				scope:activity = {
					any_in_list = {
						variable = potential_hunt_participants
						is_alive = yes
					}
				}
			}
			scope:activity = {
				random_in_list = {
					variable = potential_hunt_participants
					limit = { is_powerful_vassal = yes }
					alternative_limit = { is_alive = yes }
					save_scope_as = hunting_courtier
				}
			}
		}
		else = {
			random_courtier_or_guest = {
				save_scope_as = hunting_courtier
			}
		}
	}

	option = { #Well... We got another animal
		name = hunt.4019.a
		flavor = hunt.4019.a.tt
		add_prestige = medium_prestige_gain
	}

	after = {
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}


#######################
#	Meet local madman
#	by Linnéa Thimrén
#######################
hunt.7001 = {
	type = character_event
	title = hunt.7001.t
	desc = hunt.7001.desc
	theme = hunt_activity
	left_portrait = {
		character = scope:peasant
		animation = anger
	}
	
	trigger = {
		scope:activity.activity_province = {
			NOR = {
				terrain = plains
				terrain = steppe
				terrain = desert
			}
		}
	}

	immediate = {
		scope:activity.activity_province = {
			county = {
				save_scope_as = activity_place
				holder = {
					save_scope_as = county_owner
				}
			}
		}
		#To create Shrek
		create_character = {
			age = { 20 35 }
			trait = giant
			trait = cynical
			trait = brave
			random_traits = yes
			gender_female_chance = 0
			dynasty = none
			faith = this.faith
			culture = this.culture
			location = scope:activity.activity_province
			save_scope_as = peasant
		}
	}

	option = { #Pls give us the tour
		name = hunt.7001.a
		add_character_modifier = {
			modifier = hunt_guide_local_madman_modifier
			years = 10
		}
		add_stewardship_lifestyle_xp = 500
		
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
			}
		}
	}

	option = { #I'll convince him
		name = hunt.7001.b
		duel = {
			skill = diplomacy
			target = scope:peasant
			10 = {
				desc = hunt.7001.b_success
				compare_modifier = {
					value = scope:duel_value
				}
				send_interface_toast = {
					title = hunt.7001.b_success
					left_icon = scope:activity_place
					scope:activity_place = {
						add_county_modifier = {
							modifier = hunt_talked_to_madman_modifier
							days = 1825
						}
					}
				}
				change_variable = {
					name = hunt_outcome
					add = 1
				}
			}
			10 = {
				desc = hunt.7001.b_failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.25
				}
				send_interface_toast = {
					title = hunt.7001.b_failure
					left_icon = scope:activity_place
					add_prestige = minor_prestige_loss
				}
				change_variable = {
					name = hunt_outcome
					add = -1
				}
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 0.5
			}
		}
	}

	option = { #Here's something to hunt!
		name = hunt.7001.c
		if = {
			limit = {
				has_trait = sadistic
			}
			change_variable = {
				name = hunt_outcome
				add = 2
			}
		}
		add_dread = medium_dread_gain
		scope:peasant = {
			death = {
				death_reason = death_hunting_accident
			}
		}
		scope:activity_place = {
			add_county_modifier = {
				modifier = hunt_killed_local_madman_modifier
				days = 1825
			}
		}
		stress_impact = {
			sadistic = medium_stress_impact_loss
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 25
			modifier = {
				add = 100
				has_trait = sadistic
			}
			ai_value_modifier = {
				ai_vengefulness = 0.5
			}
		}
	}
	
	after = {
		trigger_event = {
			id = hunt.9001 #To complete the activity
			days = { 14 20 }
		}
	}
}



##################
#	END EVENTS 	 #
#	9001 - 9999	 #
##################

#######################
#	Hunt has ended
#	by Linnéa Thimrén
#######################
hunt.9001 = {
	type = character_event
	title = hunt.9001.t
	desc = {
		desc = hunt.9001.desc_opening
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = var:local_animal
				}
				desc = hunt.9001.desc_opening_animal
			}
			desc = hunt.9001.desc_opening_no_animal
		}
		first_valid = {
			triggered_desc = { #Loc for lvl your hunter trait!
				trigger = {
					OR = {
						has_character_flag = hunter_1
						has_character_flag = hunter_2
						has_character_flag = hunter_3
					}
				}
				desc = {
					triggered_desc = {
						trigger = {
							has_character_flag = hunter_1
						}
						desc = hunt.9001.desc_hunter_1
					}
					triggered_desc = {
						trigger = {
							has_character_flag = hunter_2
						}
						desc = hunt.9001.desc_hunter_2
					}
					triggered_desc = {
						trigger = {
							has_character_flag = hunter_3
						}
						desc = hunt.9001.desc_hunter_3
					}
				}
			}
			triggered_desc = {
				trigger = {
					var:hunt_outcome = 0
				}
				desc = hunt.9001.desc_same
			}
			triggered_desc = {
				trigger = {
					var:hunt_outcome > 0
				}
				desc = {
					first_valid = {
						triggered_desc = {
							trigger = {
								var:hunt_outcome <= 2
							}
							desc = hunt.9001.desc_good_bad
						}
						desc = hunt.9001.desc_good
					}
				}
			}
			triggered_desc = {
				trigger = {
					var:hunt_outcome < 0
				}
				desc = {
					first_valid = {
						triggered_desc = {
							trigger = {
								var:hunt_outcome >= -2
							}
							desc = hunt.9001.desc_bad_good
						}
						desc = hunt.9001.desc_bad
					}
				}
			}
			desc = hunt.9001.desc_fallback
		}
	}
	left_portrait = root
	theme = hunt_activity

	immediate = {
		hidden_effect = {
			#To give point towards hunter trait
			hunter_progress_point_gain_effect = yes
		}

		if = {
			limit = {
				has_character_flag = hunter_1
			}
			set_variable = {
				name = hunter_lifestyle_progress
				value = 0
			}
			add_trait = hunter_1
		}
		if = {
			limit = {
				has_character_flag = hunter_2
			}
			set_variable = {
				name = hunter_lifestyle_progress
				value = 0
			}
			change_trait_rank = {
				trait = lifestyle_hunter
				rank = 1
			}
		}
		if = {
			limit = {
				has_character_flag = hunter_3
			}
			remove_variable = hunter_lifestyle_progress
			change_trait_rank = {
				trait = lifestyle_hunter
				rank = 1
			}
		}
	}

	option = {
		name = hunt.9001.a
		trigger = {
			var:hunt_outcome > 0
		}
	}

	option = {
		name = hunt.9001.b
		trigger = {
			var:hunt_outcome < 0
			NOR = {
				has_character_flag = hunter_1
				has_character_flag = hunter_2
				has_character_flag = hunter_3
			}
		}
	}

	option = {
		name = hunt.9001.c
		trigger = {
			var:hunt_outcome = 0
		}
	}

	after = {
		add_prestige = medium_prestige_gain

		#End the activity
		if = {
			limit = {
				exists = scope:activity
			}
			scope:activity = {
				complete_activity = yes
			}
		}
	}
}