@ep3_laamp_flavour_ewan_event_cooldown = 10
@ep3_laamp_flavour_ewan_event_cooldown_shorter = 2
@ep3_laamp_flavour_ewan_event_cooldown_short = 5
@ep3_laamp_flavour_ewan_event_cooldown_long = 20
@ep3_laamp_flavour_ewan_event_cooldown_longer = 35
@ep3_laamp_flavour_ewan_event_cooldown_longest = 70

@ep3_laamp_flavour_ewan_baggage_train_has_significant_armed_force = 2000
@ep3_laamp_flavour_ewan_baggage_train_has_very_significant_armed_force = 4000

@ep3_laamp_flavour_ewan_1001_dynasty_prestige_level = 3
@ep3_laamp_flavour_ewan_1041_years_since_rule = 5
@ep3_laamp_flavour_ewan_1103_age_threshold_young = 6
@ep3_laamp_flavour_ewan_1103_age_threshold_older = 12
@ep3_laamp_flavour_ewan_4000_min_provisions_worth_attacking = 75
@ep3_laamp_flavour_ewan_4051_minimum_provisions_count = 150

namespace = ep3_laamp_flavour_ewan

##################################################
# #SIMPLE JOYS
# 0001 - 0010	Pinkish Hues - Watching the sunrise/sunset.
# 0011 - 0020	Fire & Friends - Larks at the campfire.
# 0021 - 0030	A Little Follower - Happy cat or dog follows you.
# 0031 - 0040	Tumbling Down - Stooge falls down hill.
# 0041 - 0050	Travails of a Cook - Recipes on the road.
# 0051 - 0060	A Friendly Clamour - A pleasant evening buzz as the camp settles down.
# 0061 - 0070	An Unexpected Faire - Locals react with impromptu faire.
# 0071 - 0080	Pounding Hooves - Riding with a hangover-stricken friend.
#
# #CHILDREARING
# 1001 - 1010	Friends in Low Places - Highborn befriends a lowborn.
# 1011 - 1020	Learning from Example - Learning from officer.
# 1021 - 1030	Love at First Camp - Crush on a local girl/boy.
# 1031 - 1040	Nurture - Taking after camp purpose.
# 1041 - 1050	The Old Country - Child too young to remember asks what old home was like.
# 1051 - 1060	It Isn't Fair - Child unhappy with life on the road.
# 1061 - 1070	Quick Study - Child picks up local language quickly.
# 1071 - 1080	At the Edge of Camp - Children playing in local terrain.
# 1081 - 1090	Growing Up - Child demands own tent.
# 1091 - 1100	Every Parent's Duty - Teaching a youngling how to ride.
# 1101 - 1110	Helping Out - Child helps with packing.
# 1111 - 1120	A Nose for Trouble - Child adopts puppy.
#
# #PERSONAL TENSIONS
# 2001 - 2010	Plenty in Common - Friendship blooms over shared traits.
# 2011 - 2020	Camp Gossip - Someone shagged someone else's spouse.
# 2021 - 2030	Bound Together - Marriage/concubinage at camp.
# 2031 - 2040	Through with You - Someone who hates you up and leaves.
# 2041 - 2050	Closer Quarters - Lover developing from various sources.
# 2051 - 2060	What's the Point? - Someone abandons bathing.
# 2061 - 2070	My Spot - Fight at dinner over tent pitch location.
# 2071 - 2080	Second-in-Command - People scrabble for empty/ineffectual SiC position.
# 2081 - 2090	A Well-Oiled Machine - Helping each other out at pitch time.
# 2091 - 2100	Crimes of Passion - Followers attack each other.
#
# #CAMP PURPOSE
# 3001 - 3010	Heard of You - Brigands attract cool local criminals, scaled to prestige level.
# 3011 - 3020	Arguing the Toss - Scholars debate a learned follower.
# 3021 - 3030	Over the Horizon - Explorer gets a passion for stories of a distant land, populating contracts there & learning the local language.
# 3031 - 3040	Mine by Right - Legitimist broods & extends their claims.
# 3041 - 3050	People from a Better Time - Old loyalists join legitimist.
# 3051 - 3060	Map Painting - Explorer writes/draws map of local area.
# 3061 - 3070	A Guide to ... - Scholar writes book on local subject.
# 3071 - 3080	The Law in Location.GetNameNoTier - Law attacks criminal gang.
# 3081 - 3090	Wrestle for It - Merc challenged to a wrastlin'.
#
# #TRAVEL DANGER / SUPPLIES
# 4001 - 4010	Bandits! - Bandit raid.
# 4011 - 4020	A Land of Milk & Honey - Bountiful hunting/foraging.
# 4021 - 4030	Parched - Difficulty finding water.
# 4031 - 4040	Sickness in the Herd - Pack animals are sick or wounded.
# 4041 - 4050	Fortuna's Tithe - Bad weather destroys wagons or pack animals.
# 4051 - 4060	Supplies Unaccounted For - Supplies go missing in large armies.
# 4061 - 4070	Eyes in the Night - local predator picking off people each evening.
# 4071 - 4080	Slavers - bastards try to kidnap people from the edges of your train.
# 4081 - 4090	Born of Desperation - hungry locals swarm at you, searching for food.
# 4091 - 4100	Night Attack - unknown group assaults your camp one evening.
#
# #MISC MINOR EVENTS
# 9501 - 9510	Core Tombola - Takes care of returning to camp after a period away.
# 9511 - 9520	Follower Returned - follower comes back to you, mostly the same.
# 9521 - 9530	Not As I Remember You - follower comes back to you, having taken on a local culture/faith.
# 9531 - 9540	Missing Follower - follower fails to come back after a loan.
# 9541 - 9550	Camp Activity Feed Message - something minor happens at camp.
#
# #MAINTENANCE
# 9801 - 9810	General Maintenance - Reserved for w/e turns up.
##################################################










##################################################
# MISC SCRIPTED TRIGGERS & EFFECTS

scripted_trigger ep3_laamp_flavour_ewan_available_courtier_trigger = {
	is_adult = yes
	is_courtier_of = root
	location = root.location
	is_available_allow_travelling = yes
}

scripted_trigger ep3_laamp_flavour_ewan_available_child_trigger = {
	child_can_have_full_conversations_trigger = yes
	is_courtier_of = root
	location = root.location
	is_available_allow_travelling = yes
}

scripted_trigger ep3_laamp_flavour_ewan_available_anybody_trigger = {
	OR = {
		is_adult = yes
		child_can_have_full_conversations_trigger = yes
	}
	is_courtier_of = root
	location = root.location
	is_available_allow_travelling = yes
}

scripted_trigger ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = {
	is_adult = yes
	location = root.location
}

scripted_trigger ep3_laamp_flavour_ewan_no_dog_trigger = {
	NOR = {
		any_owned_story = { type = story_cycle_pet_dog }
		has_character_modifier = dog_story_modifier
	}
}

scripted_trigger ep3_laamp_flavour_ewan_no_cat_trigger = {
	NOR = {
		any_owned_story = { type = story_cycle_pet_cat }
		has_character_modifier = cat_story_modifier
	}
}

scripted_effect ep3_laamp_flavour_ewan_clean_up_excess_childhood_traits_effect = {
	if = {
		limit = { number_of_personality_traits >= 3 }
		remove_trait = rowdy
		remove_trait = charming
		remove_trait = curious
		remove_trait = pensive
		remove_trait = bossy
	}
}

scripted_effect ep3_laamp_flavour_ewan_register_terrain_effect = {
	location = {
		switch = {
			trigger = terrain
			plains = {
				save_scope_value_as = {
					name = terrain_type
					value = flag:plains
				}
			}
			farmlands = {
				save_scope_value_as = {
					name = terrain_type
					value = flag:farmlands
				}
			}
			hills = {
				save_scope_value_as = {
					name = terrain_type
					value = flag:hills
				}
			}
			mountains = {
				save_scope_value_as = {
					name = terrain_type
					value = flag:mountains
				}
			}
			desert = {
				save_scope_value_as = {
					name = terrain_type
					value = flag:desert
				}
			}
			desert_mountains = {
				save_scope_value_as = {
					name = terrain_type
					value = flag:desert_mountains
				}
			}
			oasis = {
				save_scope_value_as = {
					name = terrain_type
					value = flag:oasis
				}
			}
			jungle = {
				save_scope_value_as = {
					name = terrain_type
					value = flag:jungle
				}
			}
			forest = {
				save_scope_value_as = {
					name = terrain_type
					value = flag:forest
				}
			}
			taiga = {
				save_scope_value_as = {
					name = terrain_type
					value = flag:taiga
				}
			}
			wetlands = {
				save_scope_value_as = {
					name = terrain_type
					value = flag:wetlands
				}
			}
			steppe = {
				save_scope_value_as = {
					name = terrain_type
					value = flag:steppe
				}
			}
			floodplains = {
				save_scope_value_as = {
					name = terrain_type
					value = flag:floodplains
				}
			}
			drylands = {
				save_scope_value_as = {
					name = terrain_type
					value = flag:drylands
				}
			}
		}
	}
}











##################################################
# SIMPLE JOYS

##################################################
# Pinkish Hues
# by Ewan Cowhig Croft
# 0001 - 0010
##################################################

scripted_trigger ep3_laamp_flavour_ewan_0001_watch_partner_trigger = {
	ep3_laamp_flavour_ewan_available_$CONFIG$_trigger = yes
	NOT = { has_trait = blind }
	opinion = {
		target = root
		value >= 40
	}
	trigger_if = {
		limit = {
			root = { is_ai = yes }
		}
		reverse_opinion = {
			target = root
			value >= 40
		}
	}
}

scripted_trigger ep3_laamp_flavour_ewan_0002_watch_partner_trigger = {
	ep3_laamp_flavour_ewan_0001_watch_partner_trigger = { CONFIG = courtier }
	NOR = {
		is_close_family_of = root
		is_consort_of = root
		trigger_if = {
			limit = { exists = scope:watch_partner_1 }
			this = scope:watch_partner_1
		}
	}
}

#	Watching the sunset.
ep3_laamp_flavour_ewan.0001 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.0001.t
	desc = {
		desc = ep3_laamp_flavour_ewan.0001.desc.intro.preamble
		first_valid = {
			triggered_desc = {
				trigger = { has_trait = lazy }
				desc = ep3_laamp_flavour_ewan.0001.desc.intro.lazy
			}
			triggered_desc = {
				trigger = { has_trait = diligent }
				desc = ep3_laamp_flavour_ewan.0001.desc.intro.diligent
			}
			desc = ep3_laamp_flavour_ewan.0001.desc.intro.fallback
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						scope:terrain_type = flag:plains
						scope:terrain_type = flag:farmlands
						scope:terrain_type = flag:hills
					}
				}
				desc = ep3_laamp_flavour_ewan.0001.desc.midtro.small_hill
			}
			triggered_desc = {
				trigger = {
					OR = {
						scope:terrain_type = flag:jungle
						scope:terrain_type = flag:forest
						scope:terrain_type = flag:taiga
					}
				}
				desc = ep3_laamp_flavour_ewan.0001.desc.midtro.tree_covered_hill
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:mountains }
				desc = ep3_laamp_flavour_ewan.0001.desc.midtro.small_ridge
			}
			triggered_desc = {
				trigger = {
					OR = {
						scope:terrain_type = flag:desert
						scope:terrain_type = flag:oasis
					}
				}
				desc = ep3_laamp_flavour_ewan.0001.desc.midtro.small_dune
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:desert_mountains }
				desc = ep3_laamp_flavour_ewan.0001.desc.midtro.dusty_ridge
			}
			triggered_desc = {
				trigger = {
					OR = {
						scope:terrain_type = flag:wetlands
						scope:terrain_type = flag:floodplains
						scope:terrain_type = flag:steppe
					}
				}
				desc = ep3_laamp_flavour_ewan.0001.desc.midtro.stubby_hillock
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:drylands }
				desc = ep3_laamp_flavour_ewan.0001.desc.midtro.dusty_hill
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = { scope:terrain_type = flag:plains }
				desc = ep3_laamp_flavour_ewan.0001.desc.plains
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:farmlands }
				desc = ep3_laamp_flavour_ewan.0001.desc.farmlands
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:hills }
				desc = ep3_laamp_flavour_ewan.0001.desc.hills
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:mountains }
				desc = ep3_laamp_flavour_ewan.0001.desc.mountains
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:desert }
				desc = ep3_laamp_flavour_ewan.0001.desc.desert
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:desert_mountains }
				desc = ep3_laamp_flavour_ewan.0001.desc.desert_mountains
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:oasis }
				desc = ep3_laamp_flavour_ewan.0001.desc.oasis
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:jungle }
				desc = ep3_laamp_flavour_ewan.0001.desc.jungle
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:forest }
				desc = ep3_laamp_flavour_ewan.0001.desc.forest
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:taiga }
				desc = ep3_laamp_flavour_ewan.0001.desc.taiga
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:wetlands }
				desc = ep3_laamp_flavour_ewan.0001.desc.wetlands
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:steppe }
				desc = ep3_laamp_flavour_ewan.0001.desc.steppe
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:floodplains }
				desc = ep3_laamp_flavour_ewan.0001.desc.floodplains
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:drylands }
				desc = ep3_laamp_flavour_ewan.0001.desc.drylands
			}
		}
		desc = ep3_laamp_flavour_ewan.0001.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = admiration
	}
	lower_center_portrait = scope:watch_partner_2
	lower_right_portrait = scope:watch_partner_1
	override_background = { reference = wilderness }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_0001 }
			# And check that we've had this title for a decent amount of time, so that we don't get this immediately every time.
			title_held_years >= 10
		}
		# And uhhh. Unfortunately.
		NOT = { has_trait = blind }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_0001
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_0001
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_longest
			}
		}
		# Grab our terrain.
		ep3_laamp_flavour_ewan_register_terrain_effect = yes
		# Flag a consort or child to watch it with.
		## Consorts.
		every_consort = {
			limit = {
				ep3_laamp_flavour_ewan_0001_watch_partner_trigger = { CONFIG = courtier }
			}
			add_to_list = possible_watch_partner_1_list
		}
		## Children.
		every_child = {
			limit = {
				ep3_laamp_flavour_ewan_0001_watch_partner_trigger = { CONFIG = child }
			}
			add_to_list = possible_watch_partner_1_list
		}
		## Now, sort through them to find our best candidate.
		ordered_in_list = {
			list = possible_watch_partner_1_list
			order_by = {
				value = "opinion(root)"
				# If we're already friends/lovers, lower the score, as this should be for making new ones.
				if = {
					limit = {
						has_any_moderate_good_relationship_with_character_trigger = { CHARACTER = root }
					}
					multiply = 0.5
				}
			}
			save_scope_as = watch_partner_1
		}
		# Flag a potential friend or friend to watch it with.
		## Potential friends.
		every_relation = {
			type = potential_friend
			limit = { ep3_laamp_flavour_ewan_0002_watch_partner_trigger = yes }
			add_to_list = possible_watch_partner_2_list
		}
		## Friends & best friends.
		every_relation = {
			type = friend
			limit = { ep3_laamp_flavour_ewan_0002_watch_partner_trigger = yes }
			add_to_list = possible_watch_partner_2_list
		}
		## Now, sort through them to find our best candidate.
		ordered_in_list = {
			list = possible_watch_partner_2_list
			order_by = "opinion(root)"
			save_scope_as = watch_partner_2
		}
	}

	# Appreciate the solitude.
	option = {
		name = ep3_laamp_flavour_ewan.0001.a

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_0001_the_little_things_modifier
			years = 10
		}

		stress_impact = {
			base = medium_stress_loss
			shy = medium_stress_impact_loss
			gregarious = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = -1 }
		}
	}

	# Call up consort or child.
	option = {
		name = ep3_laamp_flavour_ewan.0001.b
		trigger = { exists = scope:watch_partner_1 }

		progress_towards_friend_effect = {
			REASON = friend_adventurer_watched_sunset
			CHARACTER = scope:watch_partner_1
			OPINION = 30
		}

		stress_impact = { gregarious = miniscule_stress_impact_loss }
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = 1 }
			opinion_modifier = { opinion_target = scope:watch_partner_1 }
		}
	}

	# Call up friend/potential friend.
	option = {
		name = ep3_laamp_flavour_ewan.0001.c
		trigger = { exists = scope:watch_partner_2 }

		progress_towards_friend_effect = {
			REASON = friend_adventurer_watched_sunset
			CHARACTER = scope:watch_partner_2
			OPINION = 40
		}

		stress_impact = { gregarious = miniscule_stress_impact_loss }
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = 1 }
			opinion_modifier = { opinion_target = scope:watch_partner_2 }
		}
	}

	# Get on with the evening/morning's work.
	option = {
		name = ep3_laamp_flavour_ewan.0001.d

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_0001_all_business_modifier
			years = 10
		}

		stress_impact = {
			diligent = miniscule_stress_impact_loss
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = 2 }
		}
	}
}

##################################################
# Fire & Friends
# by Ewan Cowhig Croft
# 0011 - 0020
##################################################

scripted_trigger ep3_laamp_flavour_ewan_0011_mocker_trigger = {
	has_trait = gregarious
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
}

scripted_trigger ep3_laamp_flavour_ewan_0011_mockee_trigger = {
	NOT = { has_trait = gregarious }
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
	# Filter out anyone that most folks'd be _reluctant_ to criticise.
	NOR = {
		is_close_or_extended_family_of = root
		is_consort_of = root
		has_any_moderate_good_relationship_with_character_trigger = { CHARACTER = root }
	}
}

#	Larks at the campfire.
ep3_laamp_flavour_ewan.0011 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.0011.t
	desc = {
		desc = ep3_laamp_flavour_ewan.0011.desc.intro
		random_valid = {
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = lustful }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.lustful
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = chaste }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.chaste
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = gluttonous }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.gluttonous
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = temperate }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.temperate
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = greedy }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.greedy
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = generous }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.generous
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = lazy }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.lazy
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = diligent }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.diligent
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = wrathful }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.wrathful
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = calm }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.calm
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = patient }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.patient
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = impatient }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.impatient
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = arrogant }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.arrogant
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = humble }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.humble
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = deceitful }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.deceitful
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = honest }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.honest
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = craven }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.craven
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = brave }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.brave
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = shy }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.shy
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = gregarious }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.gregarious
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = ambitious }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.ambitious
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = content }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.content
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = arbitrary }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.arbitrary
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = just }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.just
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = cynical }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.cynical
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = zealous }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.zealous
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = paranoid }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.paranoid
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = trusting }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.trusting
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = compassionate }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.compassionate
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = callous }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.callous
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = sadistic }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.sadistic
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = stubborn }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.stubborn
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = fickle }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.fickle
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = vengeful }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.vengeful
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = forgiving }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.forgiving
			}
			triggered_desc = {
				trigger = {
					scope:mockee = { has_trait = eccentric }
				}
				desc = ep3_laamp_flavour_ewan.0011.desc.eccentric
			}
		}
		desc = ep3_laamp_flavour_ewan.0011.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = scope:mocker
		animation = laugh
	}
	right_portrait = {
		character = scope:mockee
		animation = disapproval
	}
	override_background = { reference = ep3_campfire }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_0011 }
		}
		# Make sure we've got at least one mocker & one mockee.
		any_courtier = { ep3_laamp_flavour_ewan_0011_mocker_trigger = yes }
		any_courtier = { ep3_laamp_flavour_ewan_0011_mockee_trigger = yes }
	}

	weight_multiplier = {
		modifier = {
			add = -0.5
			has_trait = shy
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_0011
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_0011
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Grab our courtiers.
		random_courtier = {
			limit = { ep3_laamp_flavour_ewan_0011_mocker_trigger = yes }
			save_scope_as = mocker
		}
		random_courtier = {
			limit = { ep3_laamp_flavour_ewan_0011_mockee_trigger = yes }
			save_scope_as = mockee
		}
		# Save our county for loc.
		location.county = { save_scope_as = current_county }
	}

	# Join in the ribbing of scope:mockee.
	option = {
		name = ep3_laamp_flavour_ewan.0011.a

		duel = {
			skill = diplomacy
			target = scope:mockee
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.0011.a.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.0011.a.tt.success
					left_icon = scope:mockee
					every_courtier = {
						limit = { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
						custom = custom.every_adult_follower
						add_opinion = {
							target = root
							modifier = proper_jokes_opinion
							opinion = 20
						}
					}
				}
			}
			# Defeat!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.0011.a.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.0011.a.tt.failure
					left_icon = scope:mockee
					scope:mockee = {
						reverse_add_opinion = {
							target = root
							modifier = humiliated_opinion
							opinion = -30
						}
					}
				}
			}
		}

		stress_impact = {
			gregarious = miniscule_stress_impact_loss
			shy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -0.25 }
			opinion_modifier = {
				opinion_target = scope:mockee
				multiplier = -1
			}
		}
	}

	# Turn the tables on scope:mocker.
	option = {
		name = ep3_laamp_flavour_ewan.0011.b

		duel = {
			skill = diplomacy
			target = scope:mocker
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.0011.b.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.0011.b.tt.success
					left_icon = scope:mocker
					every_courtier = {
						limit = { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
						custom = custom.every_adult_follower
						add_opinion = {
							target = root
							modifier = proper_jokes_opinion
							opinion = 20
						}
					}
				}
			}
			# Defeat!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.0011.b.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.0011.b.tt.failure
					left_icon = scope:mocker
					scope:mocker = {
						reverse_add_opinion = {
							target = root
							modifier = humiliated_opinion
							opinion = -30
						}
					}
				}
			}
		}

		stress_impact = {
			gregarious = miniscule_stress_impact_loss
			shy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 0.5 }
			opinion_modifier = { opinion_target = scope:mocker }
		}
	}

	# Tell a joke of your own.
	option = {
		name = ep3_laamp_flavour_ewan.0011.c

		duel = {
			skill = diplomacy
			value = high_skill_rating
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.0011.c.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.0011.c.tt.success
					every_courtier = {
						limit = { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
						custom = custom.every_adult_follower
						add_opinion = {
							target = root
							modifier = proper_jokes_opinion
							opinion = 20
						}
					}
				}
			}
			# Defeat!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.0011.c.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.0011.c.tt.failure
					add_prestige = medium_prestige_loss
				}
			}
		}

		stress_impact = {
			gregarious = miniscule_stress_impact_loss
			shy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 0.5 }
		}
	}

	# Soak it all in.
	option = {
		name = ep3_laamp_flavour_ewan.0011.d

		# Main effect is stress loss.
		stress_impact = {
			base = medium_stress_loss
			shy = miniscule_stress_impact_loss
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = -1 }
		}
	}
}

##################################################
# A Little Follower
# by Ewan Cowhig Croft
# 0021 - 0030
##################################################

#	Happy cat or dog follows you.
ep3_laamp_flavour_ewan.0021 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.0021.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:animal_type = flag:cat }
				desc = ep3_laamp_flavour_ewan.0021.desc.intro.cat
			}
			triggered_desc = {
				trigger = { scope:animal_type = flag:dog }
				desc = ep3_laamp_flavour_ewan.0021.desc.intro.dog
			}
		}
		random_valid = {
			triggered_desc = {
				trigger = { scope:animal_type = flag:cat }
				desc = ep3_laamp_flavour_ewan.0021.desc.cat.1
			}
			triggered_desc = {
				trigger = { scope:animal_type = flag:cat }
				desc = ep3_laamp_flavour_ewan.0021.desc.cat.2
			}
			triggered_desc = {
				trigger = { scope:animal_type = flag:cat }
				desc = ep3_laamp_flavour_ewan.0021.desc.cat.3
			}
			triggered_desc = {
				trigger = { scope:animal_type = flag:cat }
				desc = ep3_laamp_flavour_ewan.0021.desc.cat.4
			}
			triggered_desc = {
				trigger = { scope:animal_type = flag:cat }
				desc = ep3_laamp_flavour_ewan.0021.desc.cat.5
			}
			triggered_desc = {
				trigger = { scope:animal_type = flag:dog }
				desc = ep3_laamp_flavour_ewan.0021.desc.dog.1
			}
			triggered_desc = {
				trigger = { scope:animal_type = flag:dog }
				desc = ep3_laamp_flavour_ewan.0021.desc.dog.2
			}
			triggered_desc = {
				trigger = { scope:animal_type = flag:dog }
				desc = ep3_laamp_flavour_ewan.0021.desc.dog.3
			}
			triggered_desc = {
				trigger = { scope:animal_type = flag:dog }
				desc = ep3_laamp_flavour_ewan.0021.desc.dog.4
			}
			triggered_desc = {
				trigger = { scope:animal_type = flag:dog }
				desc = ep3_laamp_flavour_ewan.0021.desc.dog.5
			}
		}
		desc = ep3_laamp_flavour_ewan.0021.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = admiration
	}
	override_background = { reference = corridor_day }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_0021 }
		}
		# This one won't make sense if you could just get a dog at any point, so rule that out.
		NOT = {
			domicile = { has_domicile_building = baggage_train_kennel }
		}
		# Plus make sure that we don't _already_ have both dog & cat.
		OR = {
			ep3_laamp_flavour_ewan_no_dog_trigger = no
			ep3_laamp_flavour_ewan_no_cat_trigger = no
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_0021
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_0021
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_long
			}
		}
		# Pick whether this'll be a cat or a dog.
		random_list = {
			# Prefer cats over dogs because:
			#	A) You can get dogs via the kennels.
			#	B) They are innately superior.
			50 = {
				trigger = { ep3_laamp_flavour_ewan_no_dog_trigger = yes }
				save_scope_value_as = {
					name = animal_type
					value = flag:dog
				}
			}
			150 = {
				trigger = { ep3_laamp_flavour_ewan_no_cat_trigger = yes }
				save_scope_value_as = {
					name = animal_type
					value = flag:cat
				}
			}
		}
	}

	# Adopt the animal.
	option = {
		name = ep3_laamp_flavour_ewan.0021.a

		if = {
			limit = { scope:animal_type = flag:cat }
			start_cat_story_cycle_effect = yes
		}
		else = { start_dog_story_cycle_effect = yes }

		# Everyone likes a pet.
		add_stress = medium_stress_impact_loss
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
		}
	}

	# Low on provisions: that's... a meal...
	option = {
		name = ep3_laamp_flavour_ewan.0021.b
		trigger = { domicile.provisions <= provisions_privation_threshold_start }

		domicile = { change_provisions = microscopic_provisions_gain }

		stress_impact = {
			gluttonous = minor_stress_impact_loss
			callous = minor_stress_impact_loss
			compassionate = miniscule_stress_impact_gain
			temperate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 2 }
		}
	}

	# Sadistic: kick the animal.
	option = {
		name = ep3_laamp_flavour_ewan.0021.c
		trigger = { has_trait = sadistic }
		trait = sadistic

		# Remember that time
		random = {
			chance = 1
			increase_wounds_effect = { REASON = wild_animal }
		}

		# Main effect is the stress loss.
		stress_impact = { sadistic = major_stress_impact_loss }
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -3 }
		}
	}

	# It's just a fellow traveller, leave it be.
	option = {
		name = ep3_laamp_flavour_ewan.0021.d

		if = {
			limit = { scope:animal_type = flag:cat }
			add_character_modifier = {
				modifier = ep3_laamp_flavour_ewan_0021_respected_cat_modifier
				years = 10
			}
		}
		else = {
			add_character_modifier = {
				modifier = ep3_laamp_flavour_ewan_0021_respected_dog_modifier
				years = 10
			}
		}

		stress_impact = { shy = minor_stress_impact_loss }
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = -1 }
		}
	}
}

##################################################
# Tumbling Down
# by Ewan Cowhig Croft
# 0031 - 0040
##################################################

#	Stooge falls down hill.
ep3_laamp_flavour_ewan.0031 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.0031.t
	desc = {
		desc = ep3_laamp_flavour_ewan.0031.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { scope:terrain_type = flag:plains }
				desc = ep3_laamp_flavour_ewan.0031.desc.plains
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:farmlands }
				desc = ep3_laamp_flavour_ewan.0031.desc.farmlands
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:hills }
				desc = ep3_laamp_flavour_ewan.0031.desc.hills
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:mountains }
				desc = ep3_laamp_flavour_ewan.0031.desc.mountains
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:desert }
				desc = ep3_laamp_flavour_ewan.0031.desc.desert
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:desert_mountains }
				desc = ep3_laamp_flavour_ewan.0031.desc.desert_mountains
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:oasis }
				desc = ep3_laamp_flavour_ewan.0031.desc.oasis
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:jungle }
				desc = ep3_laamp_flavour_ewan.0031.desc.jungle
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:forest }
				desc = ep3_laamp_flavour_ewan.0031.desc.forest
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:taiga }
				desc = ep3_laamp_flavour_ewan.0031.desc.taiga
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:wetlands }
				desc = ep3_laamp_flavour_ewan.0031.desc.wetlands
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:steppe }
				desc = ep3_laamp_flavour_ewan.0031.desc.steppe
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:floodplains }
				desc = ep3_laamp_flavour_ewan.0031.desc.floodplains
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:drylands }
				desc = ep3_laamp_flavour_ewan.0031.desc.drylands
			}
		}
		desc = ep3_laamp_flavour_ewan.0031.desc.midtro
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:stooge = { is_alive = no }
				}
				desc = ep3_laamp_flavour_ewan.0031.desc.outro.dead
			}
			desc = ep3_laamp_flavour_ewan.0031.desc.outro.fallback
		}
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = schadenfreude
	}
	right_portrait = {
		character = scope:stooge
		animation = fear
	}
	override_background = { reference = wilderness }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_0031 }
		}
		# This event'll be pointless if we don't have some stress, so make sure we're a little tense.
		stress >= 25
		# Make sure we've got a stooge.
		court_position:stooge_camp_officer ?= { is_available_allow_travelling = yes }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_0031
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_0031
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_long
			}
		}
		# Grab our stooge.
		court_position:stooge_camp_officer = { save_scope_as = stooge }
		# Grab our terrain.
		ep3_laamp_flavour_ewan_register_terrain_effect = yes
		## Plus, this means injury.
		scope:stooge = {
			increase_wounds_effect = { REASON = fell_wilderness }
		}
		# Save our county for loc.
		location.county = { save_scope_as = current_county }
	}

	# Laugh.
	option = {
		name = ep3_laamp_flavour_ewan.0031.a

		scope:stooge = {
			if = {
				limit = { is_alive = yes }
				add_opinion = {
					target = root
					modifier = cruelty_opinion
					opinion = -40
				}
			}
			# Acknowledge that this is a wee bit ghoulish if they've died.
			else = {
				root = {
					add_character_modifier = {
						modifier = ep3_laamp_flavour_ewan_0031_grisly_modifier
						years = 5
					}
				}
			}
		}

		# Main effect comes from stress loss.
		stress_impact = {
			base = major_stress_loss
			sadistic = minor_stress_impact_loss
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -1 }
		}
	}

	# Snicker, but leave it at that.
	option = {
		name = ep3_laamp_flavour_ewan.0031.b

		scope:stooge = {
			if = {
				limit = { is_alive = yes }
				add_opinion = {
					target = root
					modifier = cruelty_opinion
					opinion = -20
				}
			}
			# Acknowledge that this is a wee bit ghoulish if they've died.
			else = {
				root = {
					add_character_modifier = {
						modifier = ep3_laamp_flavour_ewan_0031_macabre_modifier
						years = 5
					}
				}
			}
		}

		# Main effect comes from stress loss.
		stress_impact = {
			base = medium_stress_loss
			sadistic = miniscule_stress_impact_loss
			compassionate = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_compassion = -0.5
				ai_sociability = 0.5
			}
		}
	}

	# Move on, this is beneath you.
	option = {
		name = ep3_laamp_flavour_ewan.0031.c

		add_prestige = miniscule_prestige_gain

		stress_impact = { arrogant = miniscule_stress_impact_loss }
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
		}
	}
}

##################################################
# Travails of a Cook
# by Ewan Cowhig Croft
# 0041 - 0050
##################################################

scripted_trigger ep3_laamp_flavour_ewan_0041_access_high_provision_options_trigger = {
	domicile.provisions >= domicile.max_provisions
	ep3_laamp_flavour_ewan_0041_access_sahara_provision_options_trigger = no
}

scripted_trigger ep3_laamp_flavour_ewan_0041_access_medium_provision_options_trigger = {
	domicile.provisions < domicile.max_provisions
	domicile.provisions > provisions_privation_threshold_start
	ep3_laamp_flavour_ewan_0041_access_sahara_provision_options_trigger = no
}

scripted_trigger ep3_laamp_flavour_ewan_0041_access_low_provision_options_trigger = {
	domicile.provisions <= provisions_privation_threshold_start
	ep3_laamp_flavour_ewan_0041_access_sahara_provision_options_trigger = no
}

scripted_trigger ep3_laamp_flavour_ewan_0041_access_sahara_provision_options_trigger = {
	location = {
		geographical_region = custom_sahara_proper
		# If we're in an oasis, we should act like it.
		NOT = { terrain = oasis }
	}
}

#	Recipes on the road.
ep3_laamp_flavour_ewan.0041 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.0041.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:camp_cook }
				desc = ep3_laamp_flavour_ewan.0041.desc.has_cook
			}
			desc = ep3_laamp_flavour_ewan.0041.desc.nameless_cook
		}
		first_valid = {
			triggered_desc = {
				trigger = { scope:terrain_type = flag:plains }
				desc = ep3_laamp_flavour_ewan.0041.desc.plains
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:farmlands }
				desc = ep3_laamp_flavour_ewan.0041.desc.farmlands
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:hills }
				desc = ep3_laamp_flavour_ewan.0041.desc.hills
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:mountains }
				desc = ep3_laamp_flavour_ewan.0041.desc.mountains
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:desert }
				desc = ep3_laamp_flavour_ewan.0041.desc.desert
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:desert_mountains }
				desc = ep3_laamp_flavour_ewan.0041.desc.desert_mountains
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:oasis }
				desc = ep3_laamp_flavour_ewan.0041.desc.oasis
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:jungle }
				desc = ep3_laamp_flavour_ewan.0041.desc.jungle
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:forest }
				desc = ep3_laamp_flavour_ewan.0041.desc.forest
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:taiga }
				desc = ep3_laamp_flavour_ewan.0041.desc.taiga
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:wetlands }
				desc = ep3_laamp_flavour_ewan.0041.desc.wetlands
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:steppe }
				desc = ep3_laamp_flavour_ewan.0041.desc.steppe
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:floodplains }
				desc = ep3_laamp_flavour_ewan.0041.desc.floodplains
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:drylands }
				desc = ep3_laamp_flavour_ewan.0041.desc.drylands
			}
		}
		desc = ep3_laamp_flavour_ewan.0041.desc.outro
		first_valid = {
			triggered_desc = {
				trigger = { ep3_laamp_flavour_ewan_0041_access_high_provision_options_trigger = yes }
				desc = ep3_laamp_flavour_ewan.0041.desc.provisions.high
			}
			triggered_desc = {
				trigger = { ep3_laamp_flavour_ewan_0041_access_medium_provision_options_trigger = yes }
				desc = ep3_laamp_flavour_ewan.0041.desc.provisions.medium
			}
			triggered_desc = {
				trigger = { ep3_laamp_flavour_ewan_0041_access_low_provision_options_trigger = yes }
				desc = ep3_laamp_flavour_ewan.0041.desc.provisions.low
			}
			triggered_desc = {
				trigger = { ep3_laamp_flavour_ewan_0041_access_sahara_provision_options_trigger = yes }
				desc = ep3_laamp_flavour_ewan.0041.desc.provisions.sahara
			}
		}
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = stress
	}
	right_portrait = {
		character = scope:camp_cook
		animation = anger
	}
	override_background = { reference = corridor_day }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_0041 }
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 1
			ep3_laamp_flavour_ewan_0041_access_sahara_provision_options_trigger = yes
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_0041
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_0041
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Grab our terrain.
		ep3_laamp_flavour_ewan_register_terrain_effect = yes
		# If we've got a camp cook, nab them.
		court_position:camp_cook_camp_officer ?= {
			if = {
				limit = { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
				save_scope_as = camp_cook
			}
		}
	}

	# High prov: what're you even complaining about?
	option = {
		name = ep3_laamp_flavour_ewan.0041.a
		trigger = { ep3_laamp_flavour_ewan_0041_access_high_provision_options_trigger = yes }

		scope:camp_cook ?= {
			add_opinion = {
				target = root
				modifier = piqued_opinion
				opinion = -25
			}
		}
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_0041_well_provided_camp_modifier
			years = 10
		}

		stress_impact = {
			temperate = minor_stress_impact_loss
			gluttonous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 1 }
		}
	}

	# High prov: fine, we can restock.
	option = {
		name = ep3_laamp_flavour_ewan.0041.b
		trigger = { ep3_laamp_flavour_ewan_0041_access_high_provision_options_trigger = yes }

		duel = {
			skill = stewardship
			value = high_skill_rating
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.0041.b.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.0041.b.tt.success
					left_icon = scope:camp_cook
					remove_short_term_gold = minor_gold_laamps_value
					domicile = { change_provisions = medium_provisions_gain }
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.0041.b.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.0041.b.tt.failure
					left_icon = scope:camp_cook
					remove_short_term_gold = minor_gold_laamps_value
					domicile = { change_provisions = miniscule_provisions_gain }
				}
			}
		}
		if = {
			limit = { exists = scope:camp_cook }
			scope:camp_cook ?= {
				add_opinion = {
					target = root
					modifier = grateful_opinion
					opinion = 25
				}
			}
			add_favour_hook_if_possible_simple_effect = { TARGET = scope:camp_cook }
		}

		stress_impact = {
			gluttonous = minor_stress_impact_loss
			temperate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
			modifier = {
				factor = 0
				gold <= major_gold_laamps_value
			}
		}
	}

	# High prov: absolutely not, work with what you've got.
	option = {
		name = ep3_laamp_flavour_ewan.0041.c
		trigger = { ep3_laamp_flavour_ewan_0041_access_high_provision_options_trigger = yes }

		scope:camp_cook ?= {
			add_opinion = {
				target = root
				modifier = frustrated_opinion
				opinion = -40
			}
		}
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_0041_stern_camp_modifier
			years = 10
		}

		stress_impact = {
			temperate = minor_stress_impact_loss
			gluttonous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_greed = -1 }
		}
	}

	# mess_tent_cooks: I'm sure you can come up with something between you.
	option = {
		name = ep3_laamp_flavour_ewan.0041.d
		trigger = {
			ep3_laamp_flavour_ewan_0041_access_high_provision_options_trigger = yes
			domicile = { has_domicile_building = mess_tent_cooks }
		}
		reason = has_building_mess_tent_cooks

		if = {
			limit = { exists = scope:camp_cook }
			reverse_add_opinion = {
				target = scope:camp_cook
				modifier = flattered_opinion
				opinion = 30
			}
		}
		add_prestige = medium_prestige_gain

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = 1 }
		}
	}

	# Med prov: we can probably find something.
	option = {
		name = ep3_laamp_flavour_ewan.0041.e
		trigger = { ep3_laamp_flavour_ewan_0041_access_medium_provision_options_trigger = yes }

		duel = {
			skill = learning
			value = high_skill_rating
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.0041.e.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.0041.e.tt.success
					left_icon = scope:camp_cook
					domicile = { change_provisions = medium_provisions_gain }
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.0041.e.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.0041.e.tt.failure
					left_icon = scope:camp_cook
					domicile = { change_provisions = miniscule_provisions_gain }
				}
			}
		}

		stress_impact = {
			gluttonous = miniscule_stress_impact_loss
			temperate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 1 }
		}
	}

	# Med prov: restocking would be a good idea anyway, let's make some deals.
	option = {
		name = ep3_laamp_flavour_ewan.0041.f
		trigger = { ep3_laamp_flavour_ewan_0041_access_medium_provision_options_trigger = yes }

		duel = {
			skill = stewardship
			value = very_high_skill_rating
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.0041.f.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.0041.f.tt.success
					left_icon = scope:camp_cook
					remove_short_term_gold = medium_gold_laamps_value
					domicile = { change_provisions = major_provisions_gain }
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.0041.f.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.0041.f.tt.failure
					left_icon = scope:camp_cook
					remove_short_term_gold = medium_gold_laamps_value
					domicile = { change_provisions = medium_provisions_gain }
				}
			}
		}
		if = {
			limit = { exists = scope:camp_cook }
			scope:camp_cook ?= {
				add_opinion = {
					target = root
					modifier = grateful_opinion
					opinion = 25
				}
			}
			add_favour_hook_if_possible_simple_effect = { TARGET = scope:camp_cook }
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
			modifier = {
				factor = 0
				gold <= massive_gold_laamps_value
			}
		}
	}

	# Med prov: it's not in the budget.
	option = {
		name = ep3_laamp_flavour_ewan.0041.g
		trigger = { ep3_laamp_flavour_ewan_0041_access_medium_provision_options_trigger = yes }

		scope:camp_cook ?= {
			add_opinion = {
				target = root
				modifier = frustrated_opinion
				opinion = -40
			}
		}
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_0041_quite_stern_camp_modifier
			years = 10
		}

		stress_impact = {
			greedy = miniscule_stress_impact_loss
			generous = minor_stress_impact_gain
			gluttonous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_greed = 1 }
		}
	}

	# mess_tent_brewers: just double the beer rations and call it a day.
	option = {
		name = ep3_laamp_flavour_ewan.0041.h
		trigger = {
			ep3_laamp_flavour_ewan_0041_access_medium_provision_options_trigger = yes
			domicile = { has_domicile_building = mess_tent_brewers }
		}
		reason = has_building_mess_tent_brewers

		scope:camp_cook ?= {
			add_opinion = {
				target = root
				modifier = piqued_opinion
				opinion = -20
			}
		}
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_0041_doubled_beer_rations_camp_modifier
			years = 10
		}

		stress_impact = {
			gluttonous = minor_stress_impact_loss
			gregarious = miniscule_stress_impact_loss
			temperate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = 1 }
		}
	}

	# Low prov: we can stop to forage.
	option = {
		name = ep3_laamp_flavour_ewan.0041.i
		trigger = { ep3_laamp_flavour_ewan_0041_access_low_provision_options_trigger = yes }

		current_travel_plan = {
			delay_travel_plan = { months = 1 }
		}
		duel = {
			skill = learning
			value = very_high_skill_rating
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.0041.i.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.0041.i.tt.success
					left_icon = scope:camp_cook
					domicile = { change_provisions = major_provisions_gain }
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.0041.i.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.0041.i.tt.failure
					left_icon = scope:camp_cook
					domicile = { change_provisions = medium_provisions_gain }
				}
			}
		}

		# No stress — regardless of your opinions on food, you're at a stage where you recognise what's necessary.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 1 }
		}
	}

	# Low prov: we'll buy what extra provisions we can...
	option = {
		name = ep3_laamp_flavour_ewan.0041.j
		trigger = { ep3_laamp_flavour_ewan_0041_access_low_provision_options_trigger = yes }

		duel = {
			skill = stewardship
			value = extremely_high_skill_rating
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.0041.j.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.0041.j.tt.success
					left_icon = scope:camp_cook
					remove_short_term_gold = medium_gold_laamps_value
					domicile = { change_provisions = major_provisions_gain }
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.0041.j.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.0041.j.tt.failure
					left_icon = scope:camp_cook
					remove_short_term_gold = medium_gold_laamps_value
					domicile = { change_provisions = medium_provisions_gain }
				}
			}
		}
		if = {
			limit = { exists = scope:camp_cook }
			scope:camp_cook ?= {
				add_opinion = {
					target = root
					modifier = grateful_opinion
					opinion = 25
				}
			}
			add_favour_hook_if_possible_simple_effect = { TARGET = scope:camp_cook }
		}

		# No stress — regardless of your opinions on food, you're at a stage where you recognise what's necessary.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
			modifier = {
				factor = 0
				gold <= massive_gold_laamps_value
			}
		}
	}

	# Low prov: we _have_ to push on.
	option = {
		name = ep3_laamp_flavour_ewan.0041.k
		trigger = { ep3_laamp_flavour_ewan_0041_access_low_provision_options_trigger = yes }

		scope:camp_cook ?= {
			add_opinion = {
				target = root
				modifier = frustrated_opinion
				opinion = -40
			}
		}
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_0041_very_stern_camp_modifier
			years = 10
		}

		# No stress — regardless of your opinions on food, you're at a stage where you recognise what's necessary.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = 1 }
		}
	}

	# supply_tent_reserve_provisions: hmm, we might have _something_ reserved.
	option = {
		name = ep3_laamp_flavour_ewan.0041.l
		trigger = {
			ep3_laamp_flavour_ewan_0041_access_low_provision_options_trigger = yes
			domicile = { has_domicile_building = supply_tent_reserve_provisions }
		}
		reason = has_building_supply_tent_reserve_provisions

		if = {
			limit = { exists = scope:camp_cook }
			reverse_add_opinion = {
				target = scope:camp_cook
				modifier = grateful_opinion
				opinion = 20
			}
		}
		add_prestige = medium_prestige_gain

		stress_impact = { gluttonous = miniscule_stress_impact_loss }
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_greed = -1 }
		}
	}

	# Sahara: do you _see_ anywhere to buy provisions you idiot?
	option = {
		name = ep3_laamp_flavour_ewan.0041.m
		trigger = { ep3_laamp_flavour_ewan_0041_access_sahara_provision_options_trigger = yes }

		if = {
			limit = { exists = scope:camp_cook }
			reverse_add_opinion = {
				target = scope:camp_cook
				modifier = frustrated_opinion
				opinion = -40
			}
		}
		else = { add_prestige = minor_prestige_loss }

		stress_impact = {
			base = medium_stress_gain
			temperate = minor_stress_impact_loss
			gluttonous = medium_stress_impact_gain
		}
		ai_chance = {
			# This'll generally be your only option, so we don't care about modifiers.
			base = 1
		}
	}

	# Sahara + supply_tent_reserve_water: I don't care if we're eating gruel till we're through this.
	option = {
		name = ep3_laamp_flavour_ewan.0041.n
		trigger = {
			ep3_laamp_flavour_ewan_0041_access_sahara_provision_options_trigger = yes
			domicile = { has_domicile_building = supply_tent_reserve_water }
		}
		reason = has_building_supply_tent_reserve_water

		if = {
			limit = { exists = scope:camp_cook }
			reverse_add_opinion = {
				target = scope:camp_cook
				modifier = frustrated_opinion
				opinion = -20
			}
		}
		add_prestige = medium_prestige_gain

		# No stress gain here — narratively appropriate but we don't want you to feel like you're punished for planning ahead.
		ai_chance = {
			# If you've got this, take it.
			base = 1000
		}
	}
}

##################################################
# A Friendly Clamour
# by Ewan Cowhig Croft
# 0051 - 0060
##################################################

scripted_trigger ep3_laamp_flavour_ewan_0051_camp_has_food_to_burn_trigger = {
	provisions >= max_provisions
}

scripted_effect ep3_laamp_flavour_ewan_0051_roll_camp_visit_locations_effect = {
	random_list = {
		# Supply Tent
		100 = {
			trigger = {
				domicile = { has_domicile_building_or_higher = supply_tent_01 }
				NOT = { exists = scope:supply_tent }
			}
			save_scope_value_as = {
				name = supply_tent
				value = yes
			}
		}
		# Barber Tent
		100 = {
			trigger = {
				domicile = { has_domicile_building_or_higher = barber_tent_01 }
				NOT = { exists = scope:barber_tent }
			}
			save_scope_value_as = {
				name = barber_tent
				value = yes
			}
		}
		# Baggage Train
		100 = {
			trigger = {
				domicile = { has_domicile_building_or_higher = baggage_train_01 }
				NOT = { exists = scope:baggage_train }
			}
			save_scope_value_as = {
				name = baggage_train
				value = yes
			}
		}
		# Mess Tent
		100 = {
			trigger = {
				domicile = { has_domicile_building_or_higher = mess_tent_01 }
				NOT = { exists = scope:mess_tent }
			}
			save_scope_value_as = {
				name = mess_tent
				value = yes
			}
		}
		# Camp Fire
		100 = {
			trigger = {
				domicile = { has_domicile_building_or_higher = camp_fire_01 }
				NOT = { exists = scope:camp_fire }
			}
			save_scope_value_as = {
				name = camp_fire
				value = yes
			}
		}
		# Proving Grounds
		100 = {
			trigger = {
				domicile = { has_domicile_building_or_higher = proving_grounds_01 }
				NOT = { exists = scope:proving_grounds }
			}
			save_scope_value_as = {
				name = proving_grounds
				value = yes
			}
		}
		# Camp Perimeter
		100 = {
			trigger = {
				domicile = { has_domicile_building_or_higher = camp_perimeter_01 }
				NOT = { exists = scope:camp_perimeter }
			}
			save_scope_value_as = {
				name = camp_perimeter
				value = yes
			}
		}
	}
}

#	A pleasant evening buzz as the camp settles down.
ep3_laamp_flavour_ewan.0051 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.0051.t
	desc = {
		desc = ep3_laamp_flavour_ewan.0051.desc.intro
		# Purpose.
		random_valid = {
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_wanderers }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.wanderers.1
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_wanderers }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.wanderers.2
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_wanderers }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.wanderers.3
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_mercenaries }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.mercenaries.1
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_mercenaries }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.mercenaries.2
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_mercenaries }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.mercenaries.3
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_scholars }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.scholars.1
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_scholars }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.scholars.2
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_scholars }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.scholars.3
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_explorers }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.explorers.1
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_explorers }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.explorers.2
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_explorers }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.explorers.3
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_brigands }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.brigands.1
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_brigands }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.brigands.2
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_brigands }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.brigands.3
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_legitimists }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.legitimists.1
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_legitimists }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.legitimists.2
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_legitimists }
				desc = ep3_laamp_flavour_ewan.0051.desc.purpose.legitimists.3
			}
		}
		# Buildings.
		random_valid = {
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building_or_higher = supply_tent_01 }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.supply_tent_01
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = supply_tent_sutler }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.supply_tent_sutler
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = supply_tent_smithy }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.supply_tent_smithy
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = supply_tent_arsenal }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.supply_tent_arsenal
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building_or_higher = barber_tent_01 }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.barber_tent_01
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = barber_tent_surgeons_tools }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.barber_tent_surgeons_tools
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = barber_tent_dentists_tools }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.barber_tent_dentists_tools
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = barber_tent_torturers_tools }
					any_prisoner = { }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.barber_tent_torturers_tools
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building_or_higher = baggage_train_01 }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.baggage_train_01
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = baggage_train_ample_steeds }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.baggage_train_ample_steeds
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = baggage_train_porters }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.baggage_train_porters
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = baggage_train_trackers }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.baggage_train_trackers
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = baggage_train_kennel }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.baggage_train_kennel
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = baggage_train_siege_engineers }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.baggage_train_siege_engineers
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = baggage_train_shrine }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.baggage_train_shrine
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = baggage_train_scribes }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.baggage_train_scribes
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = baggage_train_bartering_grounds }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.baggage_train_bartering_grounds
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = baggage_train_ransom_cages }
					any_prisoner = { }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.baggage_train_ransom_cages
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = baggage_train_pleasure_tents }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.baggage_train_pleasure_tents
			}
			triggered_desc = {
				trigger = {
					domicile = {
						has_domicile_building_or_higher = mess_tent_01
						ep3_laamp_flavour_ewan_0051_camp_has_food_to_burn_trigger = yes
					}
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.mess_tent_01
			}
			triggered_desc = {
				trigger = {
					domicile = {
						has_domicile_building = mess_tent_herbalists
						ep3_laamp_flavour_ewan_0051_camp_has_food_to_burn_trigger = yes
					}
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.mess_tent_herbalists
			}
			triggered_desc = {
				trigger = {
					domicile = {
						has_domicile_building = mess_tent_brewers
						ep3_laamp_flavour_ewan_0051_camp_has_food_to_burn_trigger = yes
					}
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.mess_tent_brewers
			}
			triggered_desc = {
				trigger = {
					domicile = {
						has_domicile_building = mess_tent_bakers
						ep3_laamp_flavour_ewan_0051_camp_has_food_to_burn_trigger = yes
					}
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.mess_tent_bakers
			}
			triggered_desc = {
				trigger = {
					domicile = {
						has_domicile_building = mess_tent_cooks
						ep3_laamp_flavour_ewan_0051_camp_has_food_to_burn_trigger = yes
					}
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.mess_tent_cooks
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building_or_higher = camp_fire_01 }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.camp_fire_01
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = camp_fire_trailing_musicians }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.camp_fire_trailing_musicians
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = camp_fire_wandering_poets }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.camp_fire_wandering_poets
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = camp_fire_capering_fools }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.camp_fire_capering_fools
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = camp_fire_local_hangers_on }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.camp_fire_local_hangers_on
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = camp_fire_juicy_rumors }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.camp_fire_juicy_rumors
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building_or_higher = proving_grounds_01 }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.proving_grounds_01
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = proving_grounds_horse_run }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.proving_grounds_horse_run
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = proving_grounds_camel_run }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.proving_grounds_camel_run
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = proving_grounds_elephantry_reserve }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.proving_grounds_elephantry_reserve
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = proving_grounds_nightly_barding_drills }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.proving_grounds_nightly_barding_drills
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = proving_grounds_the_stump }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.proving_grounds_the_stump
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = proving_grounds_personal_bouts }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.proving_grounds_personal_bouts
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = proving_grounds_training_circle }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.proving_grounds_training_circle
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = proving_grounds_mock_battle_drills }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.proving_grounds_mock_battle_drills
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = proving_grounds_the_stick_game }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.proving_grounds_the_stick_game
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = proving_grounds_bodyguard_drills }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.proving_grounds_bodyguard_drills
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building_or_higher = camp_perimeter_01 }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.camp_perimeter_01
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = camp_perimeter_fixed_layout }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.camp_perimeter_fixed_layout
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = camp_perimeter_palisade }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.camp_perimeter_palisade
			}
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = camp_perimeter_ditch }
				}
				desc = ep3_laamp_flavour_ewan.0051.desc.buildings.camp_perimeter_ditch
			}
			desc = ep3_laamp_flavour_ewan.0051.desc.buildings.fallback
		}
		desc = ep3_laamp_flavour_ewan.0051.desc.followers.connector
		# Courtiers.
		random_valid = {
			# Their relations.
			triggered_desc = {
				trigger = {
					OR = {
						exists = scope:courtier_friend_1
						exists = scope:courtier_best_friend_1
						exists = scope:courtier_rival_1
						exists = scope:courtier_nemesis_1
						exists = scope:courtier_lover_1
						exists = scope:courtier_soulmate_1
					}
				}
				desc = {
					random_valid = {
						triggered_desc = {
							trigger = { exists = scope:courtier_friend_1 }
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.courtier_relations.friends
						}
						triggered_desc = {
							trigger = { exists = scope:courtier_best_friend_1 }
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.courtier_relations.best_friends
						}
						triggered_desc = {
							trigger = { exists = scope:courtier_rival_1 }
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.courtier_relations.rivals
						}
						triggered_desc = {
							trigger = { exists = scope:courtier_nemesis_1 }
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.courtier_relations.nemeses
						}
						triggered_desc = {
							trigger = { exists = scope:courtier_lover_1 }
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.courtier_relations.lovers
						}
						triggered_desc = {
							trigger = { exists = scope:courtier_soulmate_1 }
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.courtier_relations.soulmates
						}
					}
				}
			}
			# How many you have of different kinds.
			triggered_desc = {
				trigger = {
					OR = {
						exists = scope:leading_child
						exists = scope:leading_knight
						exists = scope:culture_1
						exists = scope:faith_1
					}
				}
				desc = {
					random_valid = {
						triggered_desc = {
							trigger = { exists = scope:leading_child }
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.courtier_count.many_children
						}
						triggered_desc = {
							trigger = { exists = scope:leading_knight }
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.courtier_count.many_knights
						}
						triggered_desc = {
							trigger = { exists = scope:culture_1 }
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.courtier_count.many_languages
						}
						triggered_desc = {
							trigger = { exists = scope:faith_1 }
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.courtier_count.many_faiths
						}
					}
				}
			}
			# Notable characters.
			triggered_desc = {
				trigger = { exists = scope:notable_char }
				desc = {
					random_valid = {
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = lustful }
								# Rule this out if it might be narratively upsetting, as we don't want to deal with that headache.
								OR = {
									NOR = {
										is_consort_of = root
										has_relation_lover = root
									}
									accepts_adultery_without_penalty_trigger = yes
								}
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.lustful
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = gluttonous }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.gluttonous
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = temperate }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.temperate
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = greedy }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.greedy
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = generous }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.generous
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = lazy }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.lazy
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = diligent }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.diligent
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = wrathful }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.wrathful
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = calm }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.calm
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = patient }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.patient
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = impatient }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.impatient
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = arrogant }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.arrogant
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = humble }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.humble
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = deceitful }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.deceitful
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = honest }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.honest
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = gregarious }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.gregarious
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = arbitrary }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.arbitrary
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = just }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.just
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = cynical }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.cynical
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = zealous }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.zealous
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = paranoid }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.paranoid
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = trusting }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.trusting
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = compassionate }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.compassionate
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = callous }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.callous
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = sadistic }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.sadistic
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = stubborn }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.stubborn
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = fickle }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.fickle
						}
						triggered_desc = {
							trigger = {
								scope:notable_char = { has_trait = vengeful }
							}
							desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.vengeful
						}
						desc = ep3_laamp_flavour_ewan.0051.desc.followers.notable_char.fallback
					}
				}
			}
			# Fallbacks.
			## Wrap these up so that their weighting doesn't get all weird.
			desc = {
				random_valid = {
					desc = ep3_laamp_flavour_ewan.0051.desc.followers.fallback.1
					desc = ep3_laamp_flavour_ewan.0051.desc.followers.fallback.2
					desc = ep3_laamp_flavour_ewan.0051.desc.followers.fallback.3
				}
			}
		}
		desc = ep3_laamp_flavour_ewan.0051.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = happiness
	}
	override_background = { reference = corridor_night }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_0051 }
		}
		# Make sure that we've got at least one mainline building built outside of our pavillion, so that our options aren't totally boring.
		domicile = {
			OR = {
				has_domicile_building_or_higher = supply_tent_01
				has_domicile_building_or_higher = barber_tent_01
				has_domicile_building_or_higher = baggage_train_01
				has_domicile_building_or_higher = mess_tent_01
				has_domicile_building_or_higher = camp_fire_01
				has_domicile_building_or_higher = proving_grounds_01
				has_domicile_building_or_higher = camp_perimeter_01
			}
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_0051
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_0051
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_long
			}
		}
		# Roll which camp options we want to show.
		ep3_laamp_flavour_ewan_0051_roll_camp_visit_locations_effect = yes
		ep3_laamp_flavour_ewan_0051_roll_camp_visit_locations_effect = yes
		ep3_laamp_flavour_ewan_0051_roll_camp_visit_locations_effect = yes
		# If we're a player, grab our courtier desc.
		## Camp relations.
		### Friends.
		random_courtier = {
			limit = {
				ep3_laamp_flavour_ewan_available_courtier_trigger = yes
				any_relation = {
					type = friend
					ep3_laamp_flavour_ewan_available_courtier_trigger = yes
					NOT = { has_relation_best_friend = prev }
				}
			}
			save_scope_as = courtier_friend_1
			random_relation = {
				type = friend
				limit = {
					ep3_laamp_flavour_ewan_available_courtier_trigger = yes
					NOT = { has_relation_best_friend = prev }
				}
				save_scope_as = courtier_friend_2
			}
		}
		### Best friends.
		random_courtier = {
			limit = {
				ep3_laamp_flavour_ewan_available_courtier_trigger = yes
				any_relation = {
					type = best_friend
					ep3_laamp_flavour_ewan_available_courtier_trigger = yes
				}
			}
			save_scope_as = courtier_best_friend_1
			random_relation = {
				type = best_friend
				limit = { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
				save_scope_as = courtier_best_friend_2
			}
		}
		### Rivals.
		random_courtier = {
			limit = {
				ep3_laamp_flavour_ewan_available_courtier_trigger = yes
				any_relation = {
					type = rival
					ep3_laamp_flavour_ewan_available_courtier_trigger = yes
					NOT = { has_relation_nemesis = prev }
				}
			}
			save_scope_as = courtier_rival_1
			random_relation = {
				type = rival
				limit = {
					ep3_laamp_flavour_ewan_available_courtier_trigger = yes
					NOT = { has_relation_nemesis = prev }
				}
				save_scope_as = courtier_rival_2
			}
		}
		### Nemeses.
		random_courtier = {
			limit = {
				ep3_laamp_flavour_ewan_available_courtier_trigger = yes
				any_relation = {
					type = nemesis
					ep3_laamp_flavour_ewan_available_courtier_trigger = yes
				}
			}
			save_scope_as = courtier_nemesis_1
			random_relation = {
				type = nemesis
				limit = { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
				save_scope_as = courtier_nemesis_2
			}
		}
		### Lovers.
		random_courtier = {
			limit = {
				ep3_laamp_flavour_ewan_available_courtier_trigger = yes
				any_relation = {
					type = lover
					ep3_laamp_flavour_ewan_available_courtier_trigger = yes
					NOT = { has_relation_soulmate = prev }
				}
			}
			save_scope_as = courtier_lover_1
			random_relation = {
				type = lover
				limit = {
					ep3_laamp_flavour_ewan_available_courtier_trigger = yes
					NOT = { has_relation_soulmate = prev }
				}
				save_scope_as = courtier_lover_2
			}
		}
		### Soulmates.
		random_courtier = {
			limit = {
				ep3_laamp_flavour_ewan_available_courtier_trigger = yes
				any_relation = {
					type = soulmate
					ep3_laamp_flavour_ewan_available_courtier_trigger = yes
				}
			}
			save_scope_as = courtier_soulmate_1
			random_relation = {
				type = soulmate
				limit = { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
				save_scope_as = courtier_soulmate_2
			}
		}
		## Follower states.
		### Lots of children.
		if = {
			limit = {
				any_courtier = {
					count >= 8
					ep3_laamp_flavour_ewan_available_child_trigger = yes
				}
			}
			# Nab a suitable child to be leading play.
			ordered_courtier = {
				limit = { ep3_laamp_flavour_ewan_available_child_trigger = yes }
				order_by = {
					value = age
					if = {
						limit = { has_trait = rowdy }
						add = 3
					}
					if = {
						limit = { has_trait = charming }
						add = 2
					}
					if = {
						limit = { has_trait = pensive }
						add = -5
					}
					if = {
						limit = { has_trait = bossy }
						add = 5
					}
				}
				save_scope_as = leading_child
			}
		}
		### Lots of knights.
		if = {
			limit = {
				any_knight = {
					count >= 10
					ep3_laamp_flavour_ewan_available_courtier_trigger = yes
				}
			}
			ordered_knight = {
				limit = { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
				order_by = prowess
				save_scope_as = leading_knight
			}
		}
		### Lots of different languages being spoken.
		#### First, assemble our list.
		culture = { add_to_list = cultures_with_unique_languages_list }
		every_courtier = {
			limit = { ep3_laamp_flavour_ewan_available_anybody_trigger = yes }
			culture = {
				save_scope_as = culture_temp
				if = {
					limit = {
						NOT = {
							any_in_list = {
								list = cultures_with_unique_languages_list
								has_same_culture_language = scope:culture_temp
							}
						}
					}
					add_to_list = cultures_with_unique_languages_list
				}
			}
		}
		#### Then, check how long it is.
		if = {
			limit = { "list_size(cultures_with_unique_languages_list)" >= 8 }
			random_in_list = {
				list = cultures_with_unique_languages_list
				limit = {
					this != root.culture
				}
				save_scope_as = culture_1
			}
			random_in_list = {
				list = cultures_with_unique_languages_list
				limit = {
					NOR = {
						this = root.culture
						this = scope:culture_1
					}
				}
				save_scope_as = culture_2
			}
			random_in_list = {
				list = cultures_with_unique_languages_list
				limit = {
					NOR = {
						this = root.culture
						this = scope:culture_1
						this = scope:culture_2
					}
				}
				save_scope_as = culture_3
			}
		}
		### Lots of different faiths around.
		#### First, assemble our list.
		faith = { add_to_list = unique_faiths_list }
		every_courtier = {
			limit = { ep3_laamp_flavour_ewan_available_anybody_trigger = yes }
			faith = { add_to_list = unique_faiths_list }
		}
		#### Then, check how long it is.
		if = {
			limit = { "list_size(unique_faiths_list)" >= 5 }
			random_in_list = {
				list = unique_faiths_list
				limit = {
					this != root.faith
				}
				save_scope_as = faith_1
			}
			random_in_list = {
				list = unique_faiths_list
				limit = {
					NOR = {
						this = root.faith
						this = scope:faith_1
					}
				}
				save_scope_as = faith_2
			}
			random_in_list = {
				list = unique_faiths_list
				limit = {
					NOR = {
						this = root.faith
						this = scope:faith_1
						this = scope:faith_2
					}
				}
				save_scope_as = faith_3
			}
		}
		## Notable character traits.
		random_courtier = {
			limit = {
				ep3_laamp_flavour_ewan_available_courtier_trigger = yes
				OR = {
					is_close_family_of = root
					is_consort_of = root
					has_any_moderate_good_relationship_with_character_trigger = { CHARACTER = root }
					has_any_court_position = yes
				}
			}
			save_scope_as = notable_char
		}
	}

	# camp_main_01: retire to my own tent.
	option = {
		name = ep3_laamp_flavour_ewan.0051.a

		# Consolation prestige.
		add_prestige = minor_prestige_gain

		stress_impact = {
			base = medium_stress_loss
			shy = miniscule_stress_impact_loss
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = -1 }
		}
	}

	# supply_tent_01: visit the supply tent, check the stores.
	option = {
		name = ep3_laamp_flavour_ewan.0051.b
		trigger = { exists = scope:supply_tent }
		reason = has_building_supply_tent_01_or_higher

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_0051_check_building_supply_tent_modifier
			years = 10
		}

		stress_impact = {
			diligent = miniscule_stress_impact_loss
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_greed = 1 }
		}
	}

	# barber_tent_01: go for a check-up and a shave/trim at the barbers
	option = {
		name = {
			text = {
				first_valid = {
					# Bald woman.
					triggered_desc = {
						trigger = {
							is_female = yes
							is_bald_trigger = yes
						}
						desc = ep3_laamp_flavour_ewan.0051.c.bald.female
					}
					# Bald man.
					triggered_desc = {
						trigger = {
							is_male = yes
							is_bald_trigger = yes
						}
						desc = ep3_laamp_flavour_ewan.0051.c.bald.male
					}
					# Non-bald man.
					triggered_desc = {
						trigger = { is_male = yes }
						desc = ep3_laamp_flavour_ewan.0051.c.hairy.male
					}
					# Non-bald woman.
					desc = ep3_laamp_flavour_ewan.0051.c.fallback
				}
			}
		}
		trigger = { exists = scope:barber_tent }
		reason = has_building_barber_tent_01_or_higher

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_0051_check_building_barber_tent_modifier
			years = 10
		}

		stress_impact = { arrogant = miniscule_stress_impact_loss }
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = 1 }
		}
	}

	# baggage_train_01: organise the chaos of the baggage train.
	option = {
		name = ep3_laamp_flavour_ewan.0051.d
		trigger = { exists = scope:baggage_train }
		reason = has_building_baggage_train_01_or_higher

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_0051_check_building_baggage_train_modifier
			years = 10
		}

		stress_impact = {
			diligent = miniscule_stress_impact_loss
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = 1 }
		}
	}

	# mess_tent_01: get some grub before a line forms.
	option = {
		name = ep3_laamp_flavour_ewan.0051.e
		trigger = { exists = scope:mess_tent }
		reason = has_building_mess_tent_01_or_higher

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_0051_check_building_mess_tent_modifier
			years = 10
		}

		stress_impact = {
			gluttonous = miniscule_stress_impact_loss
			temperate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			# Anyone who's ever worked in a field knows that this is the only logical thing to do AQAP.
			ai_value_modifier = { ai_rationality = 5 }
		}
	}

	# camp_fire_01: nab a good seat at the fire.
	option = {
		name = ep3_laamp_flavour_ewan.0051.f
		trigger = { exists = scope:camp_fire }
		reason = has_building_camp_fire_01_or_higher

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_0051_check_building_camp_fire_modifier
			years = 10
		}

		stress_impact = {
			lazy = miniscule_stress_impact_loss
			gregarious = miniscule_stress_impact_loss
			# Don't bully the shies here, they can enjoy a nice fire too.
			diligent = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_sociability = 1
				ai_energy = -0.5
			}
		}
	}

	# proving_grounds_01: check the soldiery are being diligent.
	option = {
		name = ep3_laamp_flavour_ewan.0051.g
		trigger = { exists = scope:proving_grounds }
		reason = has_building_proving_grounds_01_or_higher

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_0051_check_building_proving_grounds_modifier
			years = 10
		}

		stress_impact = {
			diligent = miniscule_stress_impact_loss
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = 1 }
		}
	}

	# camp_perimeter_01: walk the perimeter, check we're being vigilant.
	option = {
		name = ep3_laamp_flavour_ewan.0051.h
		trigger = { exists = scope:camp_perimeter }
		reason = has_building_camp_perimeter_01_or_higher

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_0051_check_building_camp_perimeter_modifier
			years = 10
		}

		stress_impact = {
			paranoid = miniscule_stress_impact_loss
			trusting = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = 1 }
		}
	}
}

##################################################
# An Unexpected Faire
# by Ewan Cowhig Croft
# 0061 - 0070
##################################################

scripted_trigger ep3_laamp_flavour_ewan_0061_sahara_trigger = {
	geographical_region = custom_sahara_proper
	# If we're in an oasis, we should act like it.
	NOT = { terrain = oasis }
}

scripted_trigger ep3_laamp_flavour_ewan_0061_steppe_trigger = {
	geographical_region = world_steppe
	# We only lack cities on the steppe _proper_.
	terrain = steppe
}

#	Locals react with impromptu faire.
ep3_laamp_flavour_ewan.0061 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.0061.t
	desc = ep3_laamp_flavour_ewan.0061.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:local_merchant
		animation = admiration
	}
	override_background = { reference = market_scope }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_0061 }
		}
		# No one likes brigands.
		NOT = { has_realm_law = camp_purpose_brigands }
		# Make sure the location is suitable for there to be a fair.
		location = {
			# Gotta have somewhere hosting us.
			has_holding = yes
			# And some infrastructure.
			county = {
				# We should have some level of urbanisation.
				development_level >= 20
				# And be fully secure.
				county_control >= 100
			}
			# Plus no plagues.
			any_province_epidemic = { count <= 0 }
			# Finally, no major regional blockers.
			ep3_laamp_flavour_ewan_0061_sahara_trigger = no
			ep3_laamp_flavour_ewan_0061_steppe_trigger = no
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_0061
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_0061
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Everyone's a little happier whatever we do.
		every_courtier = {
			limit = { ep3_laamp_flavour_ewan_available_anybody_trigger = yes }
			custom = ep3_laamp_flavour_ewan.0061.tt.everyone_loves_faires
			add_opinion = {
				target = root
				modifier = spirits_lifted_opinion
				opinion = 20
			}
			add_stress = massive_stress_loss
		}
		# Generate our local dude.
		create_character = {
			template = merchant_template
			location = root.location
			culture = root.location.culture
			faith = root.location.faith
			save_scope_as = local_merchant
		}
		## Plus give 'em a nickname.
		hidden_effect = {
			scope:local_merchant = { assign_random_nickname_effect = yes }
		}
		# Save our county for loc.
		location.county = { save_scope_as = current_county }
		# And our location for our background.
		location = { save_scope_as = background_market_scope }
	}

	# What a welcome surprise!
	option = {
		name = ep3_laamp_flavour_ewan.0061.a

		add_prestige = medium_prestige_gain

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = 1 }
		}
	}

	# Enroll a talented local.
	option = {
		name = ep3_laamp_flavour_ewan.0061.b

		add_courtier = scope:local_merchant
		reverse_add_opinion = {
			target = scope:local_merchant
			modifier = grateful_opinion
			opinion = 80
		}

		stress_impact = {
			gregarious = miniscule_stress_impact_loss
			shy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = 1 }
		}
	}

	# Pick up some provisions.
	option = {
		name = ep3_laamp_flavour_ewan.0061.c

		remove_short_term_gold = minor_gold_laamps_value
		domicile = { change_provisions = medium_provisions_gain }

		stress_impact = {
			gluttonous = miniscule_stress_impact_loss
			temperate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 1 }
			modifier = {
				factor = 0
				gold <= medium_gold_laamps_value
			}
		}
	}

	# Stay at camp.
	option = {
		name = ep3_laamp_flavour_ewan.0061.d

		# Mostly just stress loss.
		stress_impact = {
			base = medium_stress_loss
			shy = miniscule_stress_impact_loss
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = -1 }
		}
	}

	after = {
		# Clean up our local if we're not a player.
		if = {
			limit = {
				is_ai = yes
				this != scope:local_merchant.liege
			}
			scope:local_merchant = {
				death = { death_reason = death_vanished }
			}
		}
	}
}

##################################################
# Pounding Hooves
# by Ewan Cowhig Croft
# 0071 - 0080
##################################################

scripted_trigger ep3_laamp_flavour_ewan_0071_drinking_follower_trigger = {
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
	drinks_alcohol_trigger = yes
	NOR = {
		has_trait = temperate
		has_trait = shy
	}
}

#	Riding with a hangover-stricken friend.
ep3_laamp_flavour_ewan.0071 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.0071.t
	desc = ep3_laamp_flavour_ewan.0071.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:hanger
		animation = stress
	}
	override_background = { reference = wilderness }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_0071 }
		}
		# And we've got a suitable follower.
		any_courtier = { ep3_laamp_flavour_ewan_0071_drinking_follower_trigger = yes }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_0071
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_0071
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Try to nab our most party-prone follower.
		ordered_courtier = {
			limit = { ep3_laamp_flavour_ewan_0071_drinking_follower_trigger = yes }
			order_by = {
				value = diplomacy
				if = {
					limit = { has_trait = drunkard }
					add = 50
				}
				if = {
					limit = { has_trait = gluttonous }
					add = 20
				}
				if = {
					limit = { has_trait = gregarious }
					add = 10
				}
			}
			save_scope_as = hanger
			add_character_modifier = {
				modifier = legend_hangover_modifier
				months = 3
			}
		}
	}

	# Slow down for herhim.
	option = {
		name = ep3_laamp_flavour_ewan.0071.a

		reverse_add_opinion = {
			target = scope:hanger
			modifier = grateful_opinion
			opinion = 30
		}

		stress_impact = {
			compassionate = miniscule_stress_impact_loss
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 2 }
		}
	}

	# Laugh at herhis predicament.
	option = {
		name = ep3_laamp_flavour_ewan.0071.b

		reverse_add_opinion = {
			target = scope:hanger
			modifier = annoyed_opinion
			opinion = -15
		}

		# Plus stress loss.
		stress_impact = {
			base = medium_stress_loss
			sadistic = miniscule_stress_impact_loss
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -1 }
		}
	}

	# Kick herhis horse into gear.
	option = {
		name = ep3_laamp_flavour_ewan.0071.c

		reverse_add_opinion = {
			target = scope:hanger
			modifier = angry_opinion
			opinion = -30
		}
		every_courtier = {
			limit = {
				ep3_laamp_flavour_ewan_available_courtier_trigger = yes
				this != scope:hanger
			}
			custom = custom.every_adult_follower
			add_opinion = {
				target = root
				modifier = proper_jokes_opinion
				opinion = 20
			}
		}

		stress_impact = {
			sadistic = major_stress_impact_loss
			compassionate = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_compassion = -0.5
				ai_vengefulness = -0.5
			}
		}
	}

	# Speed up and leave herhim to his misery.
	option = {
		name = ep3_laamp_flavour_ewan.0071.d

		reverse_add_opinion = {
			target = scope:hanger
			modifier = hurt_opinion
			opinion = -10
		}

		stress_impact = {
			callous = miniscule_stress_impact_loss
			compassionate = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = -1 }
		}
	}
}












##################################################
# CHILDREARING

##################################################
# Friends in Low Places
# by Ewan Cowhig Croft
# 1001 - 1010
##################################################

scripted_trigger ep3_laamp_flavour_ewan_1001_valid_other_child_trigger = {
	age >= scope:lower_age_bound_temp
	age <= scope:upper_age_bound_temp
	ep3_laamp_flavour_ewan_available_child_trigger = yes
	OR = {
		is_lowborn = yes
		dynasty.dynasty_prestige_level < @ep3_laamp_flavour_ewan_1001_dynasty_prestige_level
	}
	NOR = {
		has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:char_temp }
		has_any_moderate_good_relationship_with_character_trigger = { CHARACTER = scope:char_temp }
	}
}

scripted_trigger ep3_laamp_flavour_ewan_1001_valid_own_child_trigger = {
	ep3_laamp_flavour_ewan_available_child_trigger = yes
	num_of_relation_friend <= 1
	# Your child must also be suitably posh (since bastards'n'diff-house children exist).
	dynasty ?= { dynasty_prestige_level >= @ep3_laamp_flavour_ewan_1001_dynasty_prestige_level }
	save_temporary_scope_as = char_temp
	save_temporary_scope_value_as = {
		name = lower_age_bound_temp
		value = {
			add = age
			add = -3
		}
	}
	save_temporary_scope_value_as = {
		name = upper_age_bound_temp
		value = {
			add = age
			add = 3
		}
	}
	root = {
		any_courtier = { ep3_laamp_flavour_ewan_1001_valid_other_child_trigger = yes }
	}
}

scripted_trigger ep3_laamp_flavour_ewan_1001_parent_is_important_at_camp_trigger = {
	liege = root
	OR = {
		has_any_court_position = yes
		has_important_relationship_with_character_trigger = { CHARACTER = root }
	}
}

#	Highborn befriends a lowborn.
ep3_laamp_flavour_ewan.1001 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.1001.t
	desc = ep3_laamp_flavour_ewan.1001.desc
	theme = laamp
	left_portrait = {
		character = scope:own_child
		animation = admiration
	}
	right_portrait = {
		character = scope:other_child
		animation = happiness
	}
	override_background = { reference = corridor_day }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_1001 }
		}
		# You've gotta be suitably posh.
		dynasty ?= { dynasty_prestige_level >= @ep3_laamp_flavour_ewan_1001_dynasty_prestige_level }
		# You have at least one valid child.
		## This includes checking for a partner child.
		any_child = { ep3_laamp_flavour_ewan_1001_valid_own_child_trigger = yes }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_1001
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_1001
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Grab a random child of ours who fits the criteria.
		random_child = {
			limit = { ep3_laamp_flavour_ewan_1001_valid_own_child_trigger = yes }
			save_scope_as = own_child
		}
		# Ok, now let's sort a partner child.
		ordered_courtier = {
			limit = { ep3_laamp_flavour_ewan_1001_valid_other_child_trigger = yes }
			order_by = {
				value = diplomacy
				# Boost lowborns.
				if = {
					limit = { is_lowborn = yes }
					add = 1000
				}
				# And anyone who isn't the spawn of someone important.
				if = {
					limit = {
						NOR = {
							mother ?= { ep3_laamp_flavour_ewan_1001_parent_is_important_at_camp_trigger = yes }
							father ?= { ep3_laamp_flavour_ewan_1001_parent_is_important_at_camp_trigger = yes }
						}
					}
					add = 100
				}
			}
			save_scope_as = other_child
		}
	}

	# Run along then, you two.
	option = {
		name = ep3_laamp_flavour_ewan.1001.a

		random_list = {
			50 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1001.set_friendship
					left_icon = scope:own_child
					right_icon = scope:other_child
					scope:own_child = {
						set_relation_friend = {
							reason = friend_children_grew_up_in_same_camp
							target = scope:other_child
						}
						add_opinion = {
							target = scope:other_child
							modifier = friendliness_opinion
							opinion = 50
						}
						reverse_add_opinion = {
							target = scope:other_child
							modifier = friendliness_opinion
							opinion = 50
						}
					}
				}
			}
			50 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1001.set_hidden_potential_friendship
					left_icon = scope:own_child
					right_icon = scope:other_child
					scope:own_child = {
						add_opinion = {
							target = scope:other_child
							modifier = friendliness_opinion
							opinion = 25
						}
						reverse_add_opinion = {
							target = scope:other_child
							modifier = friendliness_opinion
							opinion = 25
						}
						hidden_effect = { set_relation_potential_friend = scope:other_child }
					}
				}
			}
		}

		stress_impact = {
			humble = miniscule_stress_impact_loss
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
		}
	}

	# I think you've made a friend for life there, my DaughterSon.
	option = {
		name = ep3_laamp_flavour_ewan.1001.b
		trigger = {
			scope:own_child = { num_of_relation_best_friend <= 0 }
		}

		random_list = {
			70 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1001.set_best_friendship
					left_icon = scope:own_child
					right_icon = scope:other_child
					scope:own_child = {
						set_relation_best_friend = {
							reason = friend_children_grew_up_in_same_camp
							target = scope:other_child
						}
						add_mutual_gendered_blood_sibling_hook_effect = { TARGET = scope:other_child }
					}
				}
				scope:own_child = {
					add_opinion = {
						target = scope:other_child
						modifier = friendliness_opinion
						opinion = 50
					}
					reverse_add_opinion = {
						target = scope:other_child
						modifier = friendliness_opinion
						opinion = 50
					}
				}
			}
			20 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1001.set_friendship
					left_icon = scope:own_child
					right_icon = scope:other_child
					scope:own_child = {
						set_relation_friend = {
							reason = friend_children_grew_up_in_same_camp
							target = scope:other_child
						}
						add_opinion = {
							target = scope:other_child
							modifier = friendliness_opinion
							opinion = 50
						}
						reverse_add_opinion = {
							target = scope:other_child
							modifier = friendliness_opinion
							opinion = 50
						}
					}
				}
			}
			10 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1001.friendship_fizzles
					left_icon = scope:own_child
					right_icon = scope:other_child
					scope:own_child = {
						add_opinion = {
							target = scope:other_child
							modifier = friendliness_opinion
							opinion = 10
						}
						reverse_add_opinion = {
							target = scope:other_child
							modifier = friendliness_opinion
							opinion = 10
						}
					}
				}
			}
		}

		stress_impact = {
			humble = miniscule_stress_impact_loss
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
		}
	}

	# Child.GetFirstName, GetSheHe's beneath you.
	option = {
		name = ep3_laamp_flavour_ewan.1001.c

		scope:own_child = {
			add_opinion = {
				target = scope:other_child
				modifier = estranged_opinion
				opinion = -25
			}
			reverse_add_opinion = {
				target = scope:other_child
				modifier = hurt_opinion
				opinion = -50
			}
			hidden_effect = { set_relation_potential_rival = scope:other_child }
		}
		hidden_effect = {
			# Scope:other_child will remember this.
			reverse_add_opinion = {
				target = scope:other_child
				modifier = respect_opinion
				opinion = -50
			}
		}

		stress_impact = {
			arrogant = medium_stress_impact_loss
			humble = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -1 }
		}
	}
}

##################################################
# Learning from Example
# by Ewan Cowhig Croft
# 1011 - 1020
##################################################

scripted_effect ep3_laamp_flavour_ewan_1011_random_skill_gain_effect = {
	# This'll give us a range of 1:2:3 for 1-2:3-4:5 aptitudes.
	$OFFICER_CHAR$ = {
		save_scope_value_as = {
			name = aptitude_gain
			value = {
				if = {
					limit = { has_court_position = second_camp_officer }
					add = "aptitude(second_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = quartermaster_camp_officer }
					add = "aptitude(quartermaster_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = armorer_camp_officer }
					add = "aptitude(armorer_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = chief_forager_camp_officer }
					add = "aptitude(chief_forager_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = master_thief_camp_officer }
					add = "aptitude(master_thief_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = head_porter_camp_officer }
					add = "aptitude(head_porter_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = head_groom_camp_officer }
					add = "aptitude(head_groom_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = huntperson_camp_officer }
					add = "aptitude(huntperson_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = kennelperson_camp_officer }
					add = "aptitude(kennelperson_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = chief_engineer_camp_officer }
					add = "aptitude(chief_engineer_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = witness_camp_officer }
					add = "aptitude(witness_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = person_haggler_camp_officer }
					add = "aptitude(person_haggler_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = camp_cook_camp_officer }
					add = "aptitude(camp_cook_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = master_bard_camp_officer }
					add = "aptitude(master_bard_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = master_of_arms_camp_officer }
					add = "aptitude(master_of_arms_camp_officer)"
				}
				multiply = 0.5
				ceiling = yes
				min = 1
			}
		}
	}
	# Log which skills we want to adjust.
	save_scope_value_as = {
		name = add_diplomacy
		value = $DIPLOMACY$
	}
	save_scope_value_as = {
		name = add_martial
		value = $MARTIAL$
	}
	save_scope_value_as = {
		name = add_stewardship
		value = $STEWARDSHIP$
	}
	save_scope_value_as = {
		name = add_intrigue
		value = $INTRIGUE$
	}
	save_scope_value_as = {
		name = add_learning
		value = $LEARNING$
	}
	save_scope_value_as = {
		name = add_prowess
		value = $PROWESS$
	}
	# Finally, increment the appropriate skills.
	scope:child = {
		if = {
			limit = { scope:add_diplomacy = yes }
			add_diplomacy_skill = scope:aptitude_gain
		}
		if = {
			limit = { scope:add_martial = yes }
			add_martial_skill = scope:aptitude_gain
		}
		if = {
			limit = { scope:add_stewardship = yes }
			add_stewardship_skill = scope:aptitude_gain
		}
		if = {
			limit = { scope:add_intrigue = yes }
			add_intrigue_skill = scope:aptitude_gain
		}
		if = {
			limit = { scope:add_learning = yes }
			add_learning_skill = scope:aptitude_gain
		}
		if = {
			limit = { scope:add_prowess = yes }
			add_prowess_skill = scope:aptitude_gain
		}
	}
}

scripted_effect ep3_laamp_flavour_ewan_1011_nab_court_position_effect = {
	court_position:$POSITION$_camp_officer ?= {
		if = {
			limit = { is_available_allow_travelling = yes }
			save_scope_as = $POSITION$
			add_to_list = prospective_positions_list
		}
	}
}

scripted_effect ep3_laamp_flavour_ewan_1011_apply_little_helper_opinion_effect = {
	add_opinion = {
		target = scope:child
		modifier = little_helper_opinion
		opinion = 50
	}
	reverse_add_opinion = {
		target = scope:child
		modifier = respect_opinion
		opinion = 30
	}
}

#	Learning from officer.
ep3_laamp_flavour_ewan.1011 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.1011.t
	desc = ep3_laamp_flavour_ewan.1011.desc
	theme = laamp
	left_portrait = {
		character = scope:child
		animation = admiration
	}
	lower_left_portrait = scope:portrait_1
	lower_center_portrait = scope:portrait_2
	lower_right_portrait = scope:portrait_3
	override_background = { reference = army_camp }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_1011 }
		}
		any_child = { ep3_laamp_flavour_ewan_available_child_trigger = yes }
		OR = {
			court_position:second_camp_officer ?= { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
			court_position:quartermaster_camp_officer ?= { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
			court_position:armorer_camp_officer ?= { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
			court_position:chief_forager_camp_officer ?= { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
			court_position:master_thief_camp_officer ?= { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
			court_position:head_porter_camp_officer ?= { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
			court_position:head_groom_camp_officer ?= { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
			court_position:huntperson_camp_officer ?= { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
			court_position:kennelperson_camp_officer ?= { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
			court_position:chief_engineer_camp_officer ?= { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
			court_position:witness_camp_officer ?= { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
			court_position:person_haggler_camp_officer ?= { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
			court_position:camp_cook_camp_officer ?= { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
			court_position:master_bard_camp_officer ?= { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
			court_position:master_of_arms_camp_officer ?= { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_1011
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_1011
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Pick a suitable child.
		ordered_child = {
			limit = { ep3_laamp_flavour_ewan_available_child_trigger = yes }
			order_by = age
			save_scope_as = child
		}
		# Now process our available court positions.
		ep3_laamp_flavour_ewan_1011_nab_court_position_effect = { POSITION = second }
		ep3_laamp_flavour_ewan_1011_nab_court_position_effect = { POSITION = quartermaster }
		ep3_laamp_flavour_ewan_1011_nab_court_position_effect = { POSITION = armorer }
		ep3_laamp_flavour_ewan_1011_nab_court_position_effect = { POSITION = chief_forager }
		ep3_laamp_flavour_ewan_1011_nab_court_position_effect = { POSITION = master_thief }
		ep3_laamp_flavour_ewan_1011_nab_court_position_effect = { POSITION = head_porter }
		ep3_laamp_flavour_ewan_1011_nab_court_position_effect = { POSITION = head_groom }
		ep3_laamp_flavour_ewan_1011_nab_court_position_effect = { POSITION = huntperson }
		ep3_laamp_flavour_ewan_1011_nab_court_position_effect = { POSITION = kennelperson }
		ep3_laamp_flavour_ewan_1011_nab_court_position_effect = { POSITION = chief_engineer }
		ep3_laamp_flavour_ewan_1011_nab_court_position_effect = { POSITION = witness }
		ep3_laamp_flavour_ewan_1011_nab_court_position_effect = { POSITION = person_haggler }
		ep3_laamp_flavour_ewan_1011_nab_court_position_effect = { POSITION = camp_cook }
		ep3_laamp_flavour_ewan_1011_nab_court_position_effect = { POSITION = master_bard }
		ep3_laamp_flavour_ewan_1011_nab_court_position_effect = { POSITION = master_of_arms }
		ep3_laamp_flavour_ewan_1011_nab_court_position_effect = { POSITION = master_of_spoils }
		## Ok, now that we've got them, go over the list and check who's best at their job.
		ordered_in_list = {
			list = prospective_positions_list
			order_by = {
				if = {
					limit = { has_court_position = second_camp_officer }
					add = "aptitude(second_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = quartermaster_camp_officer }
					add = "aptitude(quartermaster_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = armorer_camp_officer }
					add = "aptitude(armorer_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = chief_forager_camp_officer }
					add = "aptitude(chief_forager_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = master_thief_camp_officer }
					add = "aptitude(master_thief_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = head_porter_camp_officer }
					add = "aptitude(head_porter_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = head_groom_camp_officer }
					add = "aptitude(head_groom_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = huntperson_camp_officer }
					add = "aptitude(huntperson_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = kennelperson_camp_officer }
					add = "aptitude(kennelperson_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = chief_engineer_camp_officer }
					add = "aptitude(chief_engineer_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = witness_camp_officer }
					add = "aptitude(witness_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = person_haggler_camp_officer }
					add = "aptitude(person_haggler_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = camp_cook_camp_officer }
					add = "aptitude(camp_cook_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = master_bard_camp_officer }
					add = "aptitude(master_bard_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = master_of_arms_camp_officer }
					add = "aptitude(master_of_arms_camp_officer)"
				}
				else_if = {
					limit = { has_court_position = master_of_spoils_camp_officer }
					add = "aptitude(master_of_spoils_camp_officer)"
				}
			}
			max = 3
			check_range_bounds = no
			if = {
				limit = {
					NOT = { is_in_list = best_positions_list }
				}
				add_to_list = best_positions_list
			}
		}
		# Plus sort our portraits.
		random_in_list = {
			list = best_positions_list
			save_scope_as = portrait_1
		}
		random_in_list = {
			list = best_positions_list
			limit = {
				this != scope:portrait_1
			}
			save_scope_as = portrait_2
		}
		random_in_list = {
			list = best_positions_list
			limit = {
				NOR = {
					this = scope:portrait_1
					this = scope:portrait_2
				}
			}
			save_scope_as = portrait_3
		}
	}

	# second: picks up diplo + a little of everything.
	option = {
		name = ep3_laamp_flavour_ewan.1011.a
		trigger = {
			scope:second ?= { is_in_list = best_positions_list }
		}
		reason = have_second

		ep3_laamp_flavour_ewan_1011_random_skill_gain_effect = {
			OFFICER_CHAR = scope:second
			DIPLOMACY = yes
			MARTIAL = yes
			STEWARDSHIP = no
			INTRIGUE = no
			LEARNING = no
			PROWESS = no
		}
		scope:second = { ep3_laamp_flavour_ewan_1011_apply_little_helper_opinion_effect = yes }

		# No stress here.
		ai_chance = {
			# Pick an option at random, they're all good.
			base = 1
		}
	}

	# quartermaster: picks up stewardship.
	option = {
		name = ep3_laamp_flavour_ewan.1011.b
		trigger = {
			scope:quartermaster ?= { is_in_list = best_positions_list }
		}
		reason = have_quartermaster

		ep3_laamp_flavour_ewan_1011_random_skill_gain_effect = {
			OFFICER_CHAR = scope:quartermaster
			DIPLOMACY = no
			MARTIAL = no
			STEWARDSHIP = yes
			INTRIGUE = no
			LEARNING = no
			PROWESS = no
		}
		scope:quartermaster = { ep3_laamp_flavour_ewan_1011_apply_little_helper_opinion_effect = yes }

		# No stress here.
		ai_chance = {
			# Pick an option at random, they're all good.
			base = 1
		}
	}

	# armorer: picks up stewardship & learning.
	option = {
		name = ep3_laamp_flavour_ewan.1011.c
		trigger = {
			scope:armorer ?= { is_in_list = best_positions_list }
		}
		reason = have_armorer

		ep3_laamp_flavour_ewan_1011_random_skill_gain_effect = {
			OFFICER_CHAR = scope:armorer
			DIPLOMACY = no
			MARTIAL = no
			STEWARDSHIP = yes
			INTRIGUE = no
			LEARNING = yes
			PROWESS = no
		}
		scope:armorer = { ep3_laamp_flavour_ewan_1011_apply_little_helper_opinion_effect = yes }

		# No stress here.
		ai_chance = {
			# Pick an option at random, they're all good.
			base = 1
		}
	}

	# chief_forager: picks up prowess & learning.
	option = {
		name = ep3_laamp_flavour_ewan.1011.d
		trigger = {
			scope:chief_forager ?= { is_in_list = best_positions_list }
		}
		reason = have_chief_forager

		ep3_laamp_flavour_ewan_1011_random_skill_gain_effect = {
			OFFICER_CHAR = scope:chief_forager
			DIPLOMACY = no
			MARTIAL = no
			STEWARDSHIP = no
			INTRIGUE = no
			LEARNING = yes
			PROWESS = yes
		}
		scope:chief_forager = { ep3_laamp_flavour_ewan_1011_apply_little_helper_opinion_effect = yes }

		# No stress here.
		ai_chance = {
			# Pick an option at random, they're all good.
			base = 1
		}
	}

	# master_thief: picks up intrigue & prowess.
	option = {
		name = ep3_laamp_flavour_ewan.1011.e
		trigger = {
			scope:master_thief ?= { is_in_list = best_positions_list }
		}
		reason = have_master_thief

		ep3_laamp_flavour_ewan_1011_random_skill_gain_effect = {
			OFFICER_CHAR = scope:master_thief
			DIPLOMACY = no
			MARTIAL = no
			STEWARDSHIP = no
			INTRIGUE = yes
			LEARNING = no
			PROWESS = yes
		}
		scope:master_thief = { ep3_laamp_flavour_ewan_1011_apply_little_helper_opinion_effect = yes }

		# No stress here.
		ai_chance = {
			# Pick an option at random, they're all good.
			base = 1
		}
	}

	# head_porter: picks up martial & stewardship.
	option = {
		name = ep3_laamp_flavour_ewan.1011.f
		trigger = {
			scope:head_porter ?= { is_in_list = best_positions_list }
		}
		reason = have_head_porter

		ep3_laamp_flavour_ewan_1011_random_skill_gain_effect = {
			OFFICER_CHAR = scope:head_porter
			DIPLOMACY = no
			MARTIAL = yes
			STEWARDSHIP = yes
			INTRIGUE = no
			LEARNING = no
			PROWESS = no
		}
		scope:head_porter = { ep3_laamp_flavour_ewan_1011_apply_little_helper_opinion_effect = yes }

		# No stress here.
		ai_chance = {
			# Pick an option at random, they're all good.
			base = 1
		}
	}

	# head_groom: picks up learning & stewardship.
	option = {
		name = ep3_laamp_flavour_ewan.1011.g
		trigger = {
			scope:head_groom ?= { is_in_list = best_positions_list }
		}
		reason = have_head_groom

		ep3_laamp_flavour_ewan_1011_random_skill_gain_effect = {
			OFFICER_CHAR = scope:head_groom
			DIPLOMACY = no
			MARTIAL = no
			STEWARDSHIP = yes
			INTRIGUE = no
			LEARNING = yes
			PROWESS = no
		}
		scope:head_groom = { ep3_laamp_flavour_ewan_1011_apply_little_helper_opinion_effect = yes }

		# No stress here.
		ai_chance = {
			# Pick an option at random, they're all good.
			base = 1
		}
	}

	# huntperson: picks up prowess & learning.
	option = {
		name = ep3_laamp_flavour_ewan.1011.h
		trigger = {
			scope:huntperson ?= { is_in_list = best_positions_list }
		}
		reason = have_huntperson

		ep3_laamp_flavour_ewan_1011_random_skill_gain_effect = {
			OFFICER_CHAR = scope:huntperson
			DIPLOMACY = no
			MARTIAL = no
			STEWARDSHIP = no
			INTRIGUE = no
			LEARNING = yes
			PROWESS = yes
		}
		scope:huntperson = { ep3_laamp_flavour_ewan_1011_apply_little_helper_opinion_effect = yes }

		# No stress here.
		ai_chance = {
			# Pick an option at random, they're all good.
			base = 1
		}
	}

	# kennelperson: picks up martial & prowess.
	option = {
		name = ep3_laamp_flavour_ewan.1011.i
		trigger = {
			scope:kennelperson ?= { is_in_list = best_positions_list }
		}
		reason = have_kennelperson

		ep3_laamp_flavour_ewan_1011_random_skill_gain_effect = {
			OFFICER_CHAR = scope:kennelperson
			DIPLOMACY = no
			MARTIAL = yes
			STEWARDSHIP = no
			INTRIGUE = no
			LEARNING = no
			PROWESS = yes
		}
		scope:kennelperson = { ep3_laamp_flavour_ewan_1011_apply_little_helper_opinion_effect = yes }

		# No stress here.
		ai_chance = {
			# Pick an option at random, they're all good.
			base = 1
		}
	}

	# chief_engineer: picks up learning & martial.
	option = {
		name = ep3_laamp_flavour_ewan.1011.j
		trigger = {
			scope:chief_engineer ?= { is_in_list = best_positions_list }
		}
		reason = have_chief_engineer

		ep3_laamp_flavour_ewan_1011_random_skill_gain_effect = {
			OFFICER_CHAR = scope:chief_engineer
			DIPLOMACY = no
			MARTIAL = yes
			STEWARDSHIP = no
			INTRIGUE = no
			LEARNING = yes
			PROWESS = no
		}
		scope:chief_engineer = { ep3_laamp_flavour_ewan_1011_apply_little_helper_opinion_effect = yes }

		# No stress here.
		ai_chance = {
			# Pick an option at random, they're all good.
			base = 1
		}
	}

	# witness: picks up diplomacy.
	option = {
		name = ep3_laamp_flavour_ewan.1011.k
		trigger = {
			scope:witness ?= { is_in_list = best_positions_list }
		}
		reason = have_witness

		ep3_laamp_flavour_ewan_1011_random_skill_gain_effect = {
			OFFICER_CHAR = scope:witness
			DIPLOMACY = yes
			MARTIAL = no
			STEWARDSHIP = no
			INTRIGUE = no
			LEARNING = no
			PROWESS = no
		}
		scope:witness = { ep3_laamp_flavour_ewan_1011_apply_little_helper_opinion_effect = yes }

		# No stress here.
		ai_chance = {
			# Pick an option at random, they're all good.
			base = 1
		}
	}

	# person_haggler: picks up diplomacy, plus a little intrigue + stewardship.
	option = {
		name = ep3_laamp_flavour_ewan.1011.l
		trigger = {
			scope:person_haggler ?= { is_in_list = best_positions_list }
		}
		reason = have_person_haggler

		ep3_laamp_flavour_ewan_1011_random_skill_gain_effect = {
			OFFICER_CHAR = scope:person_haggler
			DIPLOMACY = yes
			MARTIAL = no
			STEWARDSHIP = yes
			INTRIGUE = yes
			LEARNING = no
			PROWESS = no
		}
		scope:person_haggler = { ep3_laamp_flavour_ewan_1011_apply_little_helper_opinion_effect = yes }

		# No stress here.
		ai_chance = {
			# Pick an option at random, they're all good.
			base = 1
		}
	}

	# camp_cook: picks up intrigue.
	option = {
		name = ep3_laamp_flavour_ewan.1011.m
		trigger = {
			scope:camp_cook ?= { is_in_list = best_positions_list }
		}
		reason = have_camp_cook

		ep3_laamp_flavour_ewan_1011_random_skill_gain_effect = {
			OFFICER_CHAR = scope:camp_cook
			DIPLOMACY = no
			MARTIAL = no
			STEWARDSHIP = no
			INTRIGUE = yes
			LEARNING = no
			PROWESS = no
		}
		scope:camp_cook = { ep3_laamp_flavour_ewan_1011_apply_little_helper_opinion_effect = yes }

		# No stress here.
		ai_chance = {
			# Pick an option at random, they're all good.
			base = 1
		}
	}

	# master_bard: picks up diplomacy + learning.
	option = {
		name = ep3_laamp_flavour_ewan.1011.n
		trigger = {
			scope:master_bard ?= { is_in_list = best_positions_list }
		}
		reason = have_master_bard

		ep3_laamp_flavour_ewan_1011_random_skill_gain_effect = {
			OFFICER_CHAR = scope:master_bard
			DIPLOMACY = yes
			MARTIAL = no
			STEWARDSHIP = no
			INTRIGUE = no
			LEARNING = yes
			PROWESS = no
		}
		scope:master_bard = { ep3_laamp_flavour_ewan_1011_apply_little_helper_opinion_effect = yes }

		# No stress here.
		ai_chance = {
			# Pick an option at random, they're all good.
			base = 1
		}
	}

	# master_of_arms: picks up martial + prowess.
	option = {
		name = ep3_laamp_flavour_ewan.1011.o
		trigger = {
			scope:master_of_arms ?= { is_in_list = best_positions_list }
		}
		reason = have_master_of_arms

		ep3_laamp_flavour_ewan_1011_random_skill_gain_effect = {
			OFFICER_CHAR = scope:master_of_arms
			DIPLOMACY = no
			MARTIAL = yes
			STEWARDSHIP = no
			INTRIGUE = no
			LEARNING = no
			PROWESS = yes
		}
		scope:master_of_arms = { ep3_laamp_flavour_ewan_1011_apply_little_helper_opinion_effect = yes }

		# No stress here.
		ai_chance = {
			# Pick an option at random, they're all good.
			base = 1
		}
	}

	# master_of_spoils: picks up martial + prowess.
	option = {
		name = ep3_laamp_flavour_ewan.1011.o
		trigger = {
			scope:master_of_spoils ?= { is_in_list = best_positions_list }
		}
		reason = have_master_of_spoils

		ep3_laamp_flavour_ewan_1011_random_skill_gain_effect = {
			OFFICER_CHAR = scope:master_of_spoils
			DIPLOMACY = no
			MARTIAL = yes
			STEWARDSHIP = yes
			INTRIGUE = no
			LEARNING = no
			PROWESS = yes
		}
		scope:master_of_spoils = { ep3_laamp_flavour_ewan_1011_apply_little_helper_opinion_effect = yes }

		# No stress here.
		ai_chance = {
			# Pick an option at random, they're all good.
			base = 1
		}
	}
}

##################################################
# Love at First Camp
# by Ewan Cowhig Croft
# 1021 - 1030
##################################################

scripted_trigger ep3_laamp_flavour_ewan_1021_valid_child_trigger = {
	ep3_laamp_flavour_ewan_available_child_trigger = yes
	num_of_relation_crush <= 0
	NOR = {
		has_sexuality = none
		# Not that you can't have a crush as a young asexual, we're just not really equipped to deal well with that complexity here.
		has_sexuality = asexual
	}
}

#	Crush on a local girl/boy.
ep3_laamp_flavour_ewan.1021 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.1021.t
	desc = ep3_laamp_flavour_ewan.1021.desc
	theme = laamp
	left_portrait = {
		character = scope:child
		animation = flirtation_left
	}
	right_portrait = {
		character = scope:crush_child
		animation = admiration
	}
	lower_center_portrait = scope:crush_mother
	lower_right_portrait = scope:crush_father

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_1021 }
		}
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Make sure we have suitable children.
		any_child = { ep3_laamp_flavour_ewan_1021_valid_child_trigger = yes }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_1021
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_1021
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_longer
			}
		}
		# Now let's grab a suitable child.
		ordered_child = {
			limit = { ep3_laamp_flavour_ewan_1021_valid_child_trigger = yes }
			order_by = {
				value = age
				if = {
					limit = { has_trait = lustful }
					add = 10
				}
				else_if = {
					limit = { has_trait = chaste }
					add = -10
				}
			}
			save_scope_as = child
			# For determining crush gender.
			save_scope_as = attraction_check
		}
		# And create a suitable local family.
		## Mother.
		create_character = {
			template = generic_peasant_character
			age = 35
			location = root.location
			culture = root.location.culture
			faith = root.location.faith
			gender_female_chance = 100
			save_scope_as = crush_mother
			after_creation = {
				save_scope_value_as = {
					name = crush_parents_age_diff
					value = {
						value = age
						add = {
							integer_range = {
								min = -5
								max = 5
							}
						}
					}
				}
			}
		}
		## Father.
		create_character = {
			template = generic_peasant_character
			age = scope:crush_parents_age_diff
			location = root.location
			culture = root.location.culture
			faith = root.location.faith
			gender_female_chance = 0
			save_scope_as = crush_father
		}
		## Marry these two up — we can't be having children out of wedlock, after all. The very idea!
		hidden_effect = {
			scope:crush_mother = {
				if = {
					limit = {
						faith = { has_doctrine = doctrine_gender_female_dominated }
					}
					marry_matrilineal = scope:crush_father
				}
				else = { marry = scope:crush_father }
			}
		}
		## Child.
		create_character = {
			location = root.location
			age = {
				value = scope:child.age
				add = 1
			}
			culture = root.location.culture
			faith = root.location.faith
			gender_female_chance = scope_attraction_based_female_chance
			mother = scope:crush_mother
			father = scope:crush_father
			dynasty = none
			# Try to duplicate scope:child's personality.
			random_traits_list = {
				count = 3
				lustful = {
					trigger = {
						scope:child = { has_trait = lustful }
					}
				}
				chaste = {
					trigger = {
						scope:child = { has_trait = chaste }
					}
				}
				gluttonous = {
					trigger = {
						scope:child = { has_trait = gluttonous }
					}
				}
				temperate = {
					trigger = {
						scope:child = { has_trait = temperate }
					}
				}
				greedy = {
					trigger = {
						scope:child = { has_trait = greedy }
					}
				}
				generous = {
					trigger = {
						scope:child = { has_trait = generous }
					}
				}
				lazy = {
					trigger = {
						scope:child = { has_trait = lazy }
					}
				}
				diligent = {
					trigger = {
						scope:child = { has_trait = diligent }
					}
				}
				wrathful = {
					trigger = {
						scope:child = { has_trait = wrathful }
					}
				}
				calm = {
					trigger = {
						scope:child = { has_trait = calm }
					}
				}
				patient = {
					trigger = {
						scope:child = { has_trait = patient }
					}
				}
				impatient = {
					trigger = {
						scope:child = { has_trait = impatient }
					}
				}
				arrogant = {
					trigger = {
						scope:child = { has_trait = arrogant }
					}
				}
				humble = {
					trigger = {
						scope:child = { has_trait = humble }
					}
				}
				deceitful = {
					trigger = {
						scope:child = { has_trait = deceitful }
					}
				}
				honest = {
					trigger = {
						scope:child = { has_trait = honest }
					}
				}
				craven = {
					trigger = {
						scope:child = { has_trait = craven }
					}
				}
				brave = {
					trigger = {
						scope:child = { has_trait = brave }
					}
				}
				shy = {
					trigger = {
						scope:child = { has_trait = shy }
					}
				}
				gregarious = {
					trigger = {
						scope:child = { has_trait = gregarious }
					}
				}
				ambitious = {
					trigger = {
						scope:child = { has_trait = ambitious }
					}
				}
				content = {
					trigger = {
						scope:child = { has_trait = content }
					}
				}
				arbitrary = {
					trigger = {
						scope:child = { has_trait = arbitrary }
					}
				}
				just = {
					trigger = {
						scope:child = { has_trait = just }
					}
				}
				cynical = {
					trigger = {
						scope:child = { has_trait = cynical }
					}
				}
				zealous = {
					trigger = {
						scope:child = { has_trait = zealous }
					}
				}
				paranoid = {
					trigger = {
						scope:child = { has_trait = paranoid }
					}
				}
				trusting = {
					trigger = {
						scope:child = { has_trait = trusting }
					}
				}
				compassionate = {
					trigger = {
						scope:child = { has_trait = compassionate }
					}
				}
				callous = {
					trigger = {
						scope:child = { has_trait = callous }
					}
				}
				sadistic = {
					trigger = {
						scope:child = { has_trait = sadistic }
					}
				}
				stubborn = {
					trigger = {
						scope:child = { has_trait = stubborn }
					}
				}
				fickle = {
					trigger = {
						scope:child = { has_trait = fickle }
					}
				}
				vengeful = {
					trigger = {
						scope:child = { has_trait = vengeful }
					}
				}
				forgiving = {
					trigger = {
						scope:child = { has_trait = forgiving }
					}
				}
				eccentric = {
					trigger = {
						scope:child = { has_trait = eccentric }
					}
				}
			}
			# Including childhood traits, if necessary.
			random_traits_list = {
				count = 1
				rowdy = {
					trigger = {
						number_of_personality_traits < 3
						scope:child = { has_trait = rowdy }
					}
				}
				charming = {
					trigger = {
						number_of_personality_traits < 3
						scope:child = { has_trait = charming }
					}
				}
				curious = {
					trigger = {
						number_of_personality_traits < 3
						scope:child = { has_trait = curious }
					}
				}
				pensive = {
					trigger = {
						number_of_personality_traits < 3
						scope:child = { has_trait = pensive }
					}
				}
				bossy = {
					trigger = {
						number_of_personality_traits < 3
						scope:child = { has_trait = bossy }
					}
				}
			}
			# And then, for good measure, we apply a fallback.
			random_traits = yes
			martial = {
				min_template_medium_skill
				max_template_medium_skill
			}
			stewardship = {
				min_template_medium_skill
				max_template_medium_skill
			}
			diplomacy = {
				min_template_medium_skill
				max_template_medium_skill
			}
			intrigue = {
				min_template_medium_skill
				max_template_medium_skill
			}
			learning = {
				min_template_medium_skill
				max_template_medium_skill
			}
			prowess = {
				min_template_medium_skill
				max_template_medium_skill
			}
			save_scope_as = crush_child
			after_creation = {
				random_list = {
					200 = {
						# Character is of average weight, nothing happens
					}
					25 = { change_current_weight = -25 }
					25 = { change_current_weight = -75 }
					25 = { change_current_weight = 25 }
					25 = { change_current_weight = 75 }
				}
				add_character_flag = peasant_outfit
			}
		}
		# Tooltips are borked and can't be fixed without loc (even if we launder the event's immediate so that the spawned chars don't screw things up, it looks dodgy), so we hide the actual crush effect.
		hidden_effect = {
			scope:child = {
				set_relation_crush = scope:crush_child
				add_relation_flag = {
					relation = crush
					target = scope:crush_child
					flag = auto_progress_to_lover
				}
			}
			scope:crush_child = {
				if = {
					limit = { is_adult = no }
					set_relation_crush = scope:child
				}
				else = {
					add_opinion = {
						target = scope:child
						modifier = compliment_opinion
						opinion = 20
					}
				}
			}
		}
	}

	# I suppose we could accommodate another family.
	option = {
		name = ep3_laamp_flavour_ewan.1021.a

		domicile = { change_provisions = major_provisions_loss }

		scope:child = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 50
			}
			add_opinion = {
				target = scope:crush_child
				modifier = childhood_crush
				opinion = 100
			}
			reverse_add_opinion = {
				target = scope:crush_child
				modifier = childhood_crush
				opinion = 100
			}
		}
		add_courtier = scope:crush_child
		add_courtier = scope:crush_mother
		reverse_add_opinion = {
			target = scope:crush_mother
			modifier = grateful_opinion
			opinion = 20
		}
		add_courtier = scope:crush_father
		reverse_add_opinion = {
			target = scope:crush_father
			modifier = grateful_opinion
			opinion = 20
		}

		stress_impact = {
			gregarious = miniscule_stress_impact_loss
			compassionate = miniscule_stress_impact_loss
			callous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
		}
	}

	# You will stop seeing them this instant!
	option = {
		name = ep3_laamp_flavour_ewan.1021.b

		scope:child = {
			remove_relation_crush = scope:crush_child
			add_opinion = {
				target = root
				modifier = overreaction_opinion
				opinion = -40
			}
		}

		stress_impact = {
			callous = miniscule_stress_impact_loss
			sadistic = miniscule_stress_impact_loss
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -1 }
		}
	}

	# Surely just a GetSeason fling.
	option = {
		name = ep3_laamp_flavour_ewan.1021.c

		random_list = {
			100 = {
				desc = ep3_laamp_flavour_ewan.1021.c.crush_endures
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1021.c.crush_endures
					left_icon = scope:child
					right_icon = scope:crush_child
					scope:child = {
						add_opinion = {
							target = scope:crush_child
							modifier = childhood_crush
							opinion = 50
						}
						reverse_add_opinion = {
							target = scope:crush_child
							modifier = childhood_crush
							opinion = 50
						}
					}
				}
			}
			100 = {
				desc = ep3_laamp_flavour_ewan.1021.c.crush_fades
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1021.c.crush_fades
					left_icon = scope:child
					right_icon = scope:crush_child
					scope:child = { remove_relation_crush = scope:crush_child }
				}
			}
		}

		# No stress here, you just don't involve yourself.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -1 }
		}
	}

	after = {
		# If we've no connexion left, dispose of our peasants.
		if = {
			limit = {
				scope:child = {
					NOT = { has_relation_crush = scope:crush_child }
				}
			}
			scope:crush_mother = {
				death = { death_reason = death_vanished }
			}
			scope:crush_father = {
				death = { death_reason = death_vanished }
			}
			scope:crush_child = {
				death = { death_reason = death_vanished }
			}
		}
	}
}

##################################################
# Nurture
# by Ewan Cowhig Croft
# 1031 - 1040
##################################################

scripted_effect ep3_laamp_flavour_ewan_1031_apply_changes_effect = {
	# Gain a certain childhood personality trait.
	scope:child = {
		if = {
			limit = {
				number_of_personality_traits < 3
				NOR = {
					has_trait = rowdy
					has_trait = charming
					has_trait = curious
					has_trait = pensive
					has_trait = bossy
				}
			}
			add_trait = $CHILDHOOD_TRAIT$
		}
		# Else, gain a certain trait.
		else_if = {
			limit = {
				number_of_personality_traits < 3
				NOR = {
					has_trait = $TRAIT_1$
					has_trait = $TRAIT_2$
					has_trait = $TRAIT_3$
					has_trait = $TRAIT_4$
					has_trait = $TRAIT_5$
				}
			}
			random_list = {
				100 = {
					trigger = {
						NOT = { has_trait = $TRAIT_1$ }
					}
					root = {
						send_interface_toast = {
							title = ep3_laamp_flavour_ewan.1031.tt.trait_adopted
							left_icon = scope:child
							scope:child = { add_trait = $TRAIT_1$ }
						}
					}
				}
				100 = {
					trigger = {
						NOT = { has_trait = $TRAIT_2$ }
					}
					root = {
						send_interface_toast = {
							title = ep3_laamp_flavour_ewan.1031.tt.trait_adopted
							left_icon = scope:child
							scope:child = { add_trait = $TRAIT_2$ }
						}
					}
				}
				100 = {
					trigger = {
						NOT = { has_trait = $TRAIT_3$ }
					}
					root = {
						send_interface_toast = {
							title = ep3_laamp_flavour_ewan.1031.tt.trait_adopted
							left_icon = scope:child
							scope:child = { add_trait = $TRAIT_3$ }
						}
					}
				}
				100 = {
					trigger = {
						NOT = { has_trait = $TRAIT_4$ }
					}
					root = {
						send_interface_toast = {
							title = ep3_laamp_flavour_ewan.1031.tt.trait_adopted
							left_icon = scope:child
							scope:child = { add_trait = $TRAIT_4$ }
						}
					}
				}
				100 = {
					trigger = {
						NOT = { has_trait = $TRAIT_5$ }
					}
					root = {
						send_interface_toast = {
							title = ep3_laamp_flavour_ewan.1031.tt.trait_adopted
							left_icon = scope:child
							scope:child = { add_trait = $TRAIT_5$ }
						}
					}
				}
			}
			# Clean up our childhood traits if we've just capped out.
			hidden_effect = { ep3_laamp_flavour_ewan_clean_up_excess_childhood_traits_effect = yes }
		}
		# Else, gain skill points.
		else = {
			root = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1031.tt.skill_gain
					left_icon = scope:child
					scope:child = { add_$SKILL$_skill = scope:fallback_skill_gain }
				}
			}
		}
	}
}

scripted_effect ep3_laamp_flavour_ewan_1031_roll_duel_effect = {
	duel = {
		skill = $EDUCATION$
		value = high_skill_rating
		# Victory!
		50 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = 3.5
				min = -49
			}
			min = 5
			desc = ep3_laamp_flavour_ewan.1031.g.tt.success
			send_interface_toast = {
				title = ep3_laamp_flavour_ewan.1031.g.tt.success
				left_icon = scope:child
				scope:child = { add_$EDUCATION$_skill = 2 }
			}
		}
		# Defeat!
		50 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = -3.5
				min = -49
			}
			min = 5
			desc = ep3_laamp_flavour_ewan.1031.g.tt.failure
			send_interface_toast = {
				title = ep3_laamp_flavour_ewan.1031.g.tt.failure
				left_icon = scope:child
				scope:child = { add_$EDUCATION$_skill = -1 }
			}
		}
	}
}

#	Taking after camp purpose.
ep3_laamp_flavour_ewan.1031 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.1031.t
	desc = {
		desc = ep3_laamp_flavour_ewan.1031.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_wanderers }
				desc = ep3_laamp_flavour_ewan.1031.desc.purpose.wanderers
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_mercenaries }
				desc = ep3_laamp_flavour_ewan.1031.desc.purpose.mercenaries
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_scholars }
				desc = ep3_laamp_flavour_ewan.1031.desc.purpose.scholars
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_explorers }
				desc = ep3_laamp_flavour_ewan.1031.desc.purpose.explorers
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_brigands }
				desc = ep3_laamp_flavour_ewan.1031.desc.purpose.brigands
			}
			triggered_desc = {
				trigger = { has_realm_law = camp_purpose_legitimists }
				desc = ep3_laamp_flavour_ewan.1031.desc.purpose.legitimists
			}
		}
		desc = ep3_laamp_flavour_ewan.1031.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:child
		triggered_animation = {
			trigger = {
				root = {
					OR = {
						has_realm_law = camp_purpose_mercenaries
						has_realm_law = camp_purpose_brigands
					}
				}
			}
			animation = marshal_wooden_sword
		}
		animation = personality_bold
	}
	override_background = { reference = army_camp }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_1031 }
		}
		# Must have a suitable child.
		any_child = { ep3_laamp_flavour_ewan_available_child_trigger = yes }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_1031
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_1031
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_short
			}
		}
		random_child = {
			limit = { ep3_laamp_flavour_ewan_available_child_trigger = yes }
			weight = {
				modifier = {
					add = age
					always = yes
				}
				modifier = {
					add = 10
					has_trait = diligent
				}
				modifier = {
					add = -10
					has_trait = lazy
				}
			}
			save_scope_as = child
		}
		# Roll our fallback skill gain, so that it's set for the final tooltip.
		save_scope_value_as = {
			name = fallback_skill_gain
			value = {
				integer_range = {
					min = 1
					max = 3
				}
			}
		}
	}

	# Wanderers: Ahhh, the wanderlust has got 'er'im.
	option = {
		name = ep3_laamp_flavour_ewan.1031.a
		trigger = { has_realm_law = camp_purpose_wanderers }
		reason = purpose_wanderers

		ep3_laamp_flavour_ewan_1031_apply_changes_effect = {
			CHILDHOOD_TRAIT = curious
			TRAIT_1 = diligent
			TRAIT_2 = calm
			TRAIT_3 = humble
			TRAIT_4 = brave
			TRAIT_5 = eccentric
			SKILL = diplomacy
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 2 }
		}
	}

	# Mercenaries: SheHe'll be a warrior some day.
	option = {
		name = ep3_laamp_flavour_ewan.1031.b
		trigger = { has_realm_law = camp_purpose_mercenaries }
		reason = purpose_mercenaries

		if = {
			limit = { has_trait = education_martial }
			ep3_laamp_flavour_ewan_1031_apply_changes_effect = {
				CHILDHOOD_TRAIT = rowdy
				TRAIT_1 = brave
				TRAIT_2 = wrathful
				TRAIT_3 = content
				TRAIT_4 = callous
				TRAIT_5 = gregarious
				SKILL = prowess
			}
		}
		else = {
			ep3_laamp_flavour_ewan_1031_apply_changes_effect = {
				CHILDHOOD_TRAIT = rowdy
				TRAIT_1 = brave
				TRAIT_2 = wrathful
				TRAIT_3 = content
				TRAIT_4 = callous
				TRAIT_5 = gregarious
				SKILL = martial
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 2 }
		}
	}

	# Scholars: such enthusiasm in one so young!
	option = {
		name = ep3_laamp_flavour_ewan.1031.c
		trigger = { has_realm_law = camp_purpose_scholars }
		reason = purpose_scholars

		if = {
			limit = { has_trait = education_learning }
			ep3_laamp_flavour_ewan_1031_apply_changes_effect = {
				CHILDHOOD_TRAIT = pensive
				TRAIT_1 = temperate
				TRAIT_2 = patient
				TRAIT_3 = calm
				TRAIT_4 = shy
				TRAIT_5 = stubborn
				SKILL = diplomacy
			}
		}
		else = {
			ep3_laamp_flavour_ewan_1031_apply_changes_effect = {
				CHILDHOOD_TRAIT = pensive
				TRAIT_1 = temperate
				TRAIT_2 = patient
				TRAIT_3 = calm
				TRAIT_4 = shy
				TRAIT_5 = stubborn
				SKILL = learning
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 2 }
		}
	}

	# Explorers: I wonder what sights SheHe'll see...
	option = {
		name = ep3_laamp_flavour_ewan.1031.d
		trigger = { has_realm_law = camp_purpose_explorers }
		reason = purpose_explorers

		if = {
			limit = { has_trait = education_diplomacy }
			ep3_laamp_flavour_ewan_1031_apply_changes_effect = {
				CHILDHOOD_TRAIT = charming
				TRAIT_1 = gregarious
				TRAIT_2 = brave
				TRAIT_3 = ambitious
				TRAIT_4 = fickle
				TRAIT_5 = eccentric
				SKILL = stewardship
			}
		}
		else = {
			ep3_laamp_flavour_ewan_1031_apply_changes_effect = {
				CHILDHOOD_TRAIT = charming
				TRAIT_1 = gregarious
				TRAIT_2 = brave
				TRAIT_3 = ambitious
				TRAIT_4 = fickle
				TRAIT_5 = eccentric
				SKILL = diplomacy
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 2 }
		}
	}

	# Brigands: it'll serve HerHim well.
	option = {
		name = ep3_laamp_flavour_ewan.1031.e
		trigger = { has_realm_law = camp_purpose_brigands }
		reason = purpose_brigands

		if = {
			limit = { has_trait = education_intrigue }
			ep3_laamp_flavour_ewan_1031_apply_changes_effect = {
				CHILDHOOD_TRAIT = rowdy
				TRAIT_1 = deceitful
				TRAIT_2 = arbitrary
				TRAIT_3 = callous
				TRAIT_4 = sadistic
				TRAIT_5 = paranoid
				SKILL = prowess
			}
		}
		else = {
			ep3_laamp_flavour_ewan_1031_apply_changes_effect = {
				CHILDHOOD_TRAIT = rowdy
				TRAIT_1 = deceitful
				TRAIT_2 = arbitrary
				TRAIT_3 = callous
				TRAIT_4 = sadistic
				TRAIT_5 = paranoid
				SKILL = intrigue
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 2 }
		}
	}

	# Legitimists: such ambition is only natural.
	option = {
		name = ep3_laamp_flavour_ewan.1031.f
		trigger = { has_realm_law = camp_purpose_legitimists }
		reason = purpose_legitimists

		if = {
			limit = { has_trait = education_diplomacy }
			ep3_laamp_flavour_ewan_1031_apply_changes_effect = {
				CHILDHOOD_TRAIT = bossy
				TRAIT_1 = ambitious
				TRAIT_2 = arrogant
				TRAIT_3 = diligent
				TRAIT_4 = patient
				TRAIT_5 = vengeful
				SKILL = prowess
			}
		}
		else = {
			ep3_laamp_flavour_ewan_1031_apply_changes_effect = {
				CHILDHOOD_TRAIT = bossy
				TRAIT_1 = ambitious
				TRAIT_2 = arrogant
				TRAIT_3 = diligent
				TRAIT_4 = patient
				TRAIT_5 = vengeful
				SKILL = diplomacy
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 2 }
		}
	}

	# Perhaps we could consider another path?
	option = {
		name = ep3_laamp_flavour_ewan.1031.g
		trait = education_diplomacy_1
		trait = education_diplomacy_2
		trait = education_diplomacy_3
		trait = education_diplomacy_4
		trait = education_diplomacy_5
		trait = education_martial_1
		trait = education_martial_2
		trait = education_martial_3
		trait = education_martial_4
		trait = education_martial_5
		trait = education_stewardship_1
		trait = education_stewardship_2
		trait = education_stewardship_3
		trait = education_stewardship_4
		trait = education_stewardship_5
		trait = education_intrigue_1
		trait = education_intrigue_2
		trait = education_intrigue_3
		trait = education_intrigue_4
		trait = education_intrigue_5
		trait = education_learning_1
		trait = education_learning_2
		trait = education_learning_3
		trait = education_learning_4
		trait = education_learning_5

		# Roll a different duel depending on our education.
		switch = {
			trigger = has_trait
			education_diplomacy = {
				ep3_laamp_flavour_ewan_1031_roll_duel_effect = { EDUCATION = diplomacy }
			}
			education_martial = {
				ep3_laamp_flavour_ewan_1031_roll_duel_effect = { EDUCATION = martial }
			}
			education_stewardship = {
				ep3_laamp_flavour_ewan_1031_roll_duel_effect = { EDUCATION = stewardship }
			}
			education_intrigue = {
				ep3_laamp_flavour_ewan_1031_roll_duel_effect = { EDUCATION = intrigue }
			}
			education_learning = {
				ep3_laamp_flavour_ewan_1031_roll_duel_effect = { EDUCATION = learning }
			}
		}

		stress_impact = {
			diligent = miniscule_stress_impact_loss
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = 2 }
		}
	}

	# *sigh* Stop that, GirlBoy.
	option = {
		name = ep3_laamp_flavour_ewan.1031.h

		scope:child = { add_stress = medium_stress_gain }
		add_prestige = minor_prestige_gain

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -0.5 }
		}
	}
}

##################################################
# The Old Country
# by Ewan Cowhig Croft
# 1041 - 1050
##################################################

scripted_trigger ep3_laamp_flavour_ewan_1041_valid_memory_trigger = {
	has_memory_type = became_landless_adventurer_memory
	memory_age_years >= {
		value = @ep3_laamp_flavour_ewan_1041_years_since_rule
		add = $CHILD$.age
	}
}

#	Child too young to remember asks what old home was like.
ep3_laamp_flavour_ewan.1041 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.1041.t
	desc = ep3_laamp_flavour_ewan.1041.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:child
		animation = admiration
	}

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_1041 }
		}
		# We must've actually ruled somewhere — if we're a player. The AI won't care for this verisimilitude.
		trigger_if = {
			limit = { is_ai = no }
			any_claim = {
				any_past_holder_reversed = { this = root }
			}
		}
		# And have a suitable child available.
		## This _should_ go in order of available children by the trigger, so it _should_ be ordered by age already.
		any_child = {
			ep3_laamp_flavour_ewan_available_child_trigger = yes
			save_temporary_scope_as = child_temp
		}
		# Finally, check that enough time has passed that the child might not remember the Old Country.
		any_memory = {
			ep3_laamp_flavour_ewan_1041_valid_memory_trigger = { CHILD = scope:child_temp }
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_1041
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_1041
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Grab our child.
		ordered_child = {
			limit = { ep3_laamp_flavour_ewan_available_child_trigger = yes }
			order_by = age
			save_scope_as = child
		}
		# Grab our memory.
		random_memory = {
			limit = {
				ep3_laamp_flavour_ewan_1041_valid_memory_trigger = { CHILD = scope:child }
			}
			save_scope_as = memory
		}
	}

	# It was beautiful, little one.
	option = {
		name = ep3_laamp_flavour_ewan.1041.a

		random_list = {
			100 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1041.a.tt.diplomacy
					left_icon = scope:child
					scope:child = {
						add_character_modifier = {
							modifier = ep3_laamp_flavour_ewan_1041_beautiful_home_diplomacy_modifier
							years = 10
						}
					}
				}
			}
			100 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1041.a.tt.stewardship
					left_icon = scope:child
					scope:child = {
						add_character_modifier = {
							modifier = ep3_laamp_flavour_ewan_1041_beautiful_home_stewardship_modifier
							years = 10
						}
					}
				}
			}
			100 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1041.a.tt.learning
					left_icon = scope:child
					scope:child = {
						add_character_modifier = {
							modifier = ep3_laamp_flavour_ewan_1041_beautiful_home_learning_modifier
							years = 10
						}
					}
				}
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = 2 }
		}
	}

	# A horrid place that spurned us.
	option = {
		name = ep3_laamp_flavour_ewan.1041.b

		random_list = {
			100 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1041.b.tt.martial
					left_icon = scope:child
					scope:child = {
						add_character_modifier = {
							modifier = ep3_laamp_flavour_ewan_1041_horrible_home_martial_modifier
							years = 10
						}
					}
				}
			}
			100 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1041.b.tt.intrigue
					left_icon = scope:child
					scope:child = {
						add_character_modifier = {
							modifier = ep3_laamp_flavour_ewan_1041_horrible_home_intrigue_modifier
							years = 10
						}
					}
				}
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = -2 }
		}
	}

	# legitimists: some day, you'll know it for yourself.
	option = {
		name = ep3_laamp_flavour_ewan.1041.c
		trigger = { has_realm_law = camp_purpose_legitimists }
		reason = purpose_legitimists

		scope:child = {
			# Try to give them the ambitious trait.
			if = {
				limit = {
					number_of_personality_traits <= 3
					NOT = { has_trait = ambitious }
				}
				add_trait = ambitious
				hidden_effect = { ep3_laamp_flavour_ewan_clean_up_excess_childhood_traits_effect = yes }
			}
			# Else, give them a nice modifier.
			else = {
				add_character_modifier = {
					modifier = ep3_laamp_flavour_ewan_1041_rightful_home_modifier
					years = 10
				}
			}
			add_opinion = {
				target = root
				modifier = stories_of_righteous_return_opinion
				opinion = 30
			}
		}

		stress_impact = {
			base = minor_stress_loss
			ambitious = medium_stress_impact_loss
			arrogant = minor_stress_impact_loss
			humble = minor_stress_impact_gain
			content = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 2 }
		}
	}

	# not legitimists: maybe we'll return some day. Ask me then.
	option = {
		name = ep3_laamp_flavour_ewan.1041.d
		trigger = {
			NOT = { has_realm_law = camp_purpose_legitimists }
		}

		reverse_add_opinion = {
			target = scope:child
			modifier = stories_of_righteous_return_opinion
			opinion = 30
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 1 }
		}
	}

	# I won't speak of it.
	option = {
		name = ep3_laamp_flavour_ewan.1041.e

		reverse_add_opinion = {
			target = scope:child
			modifier = disappointed_opinion
			opinion = -10
		}

		# Most of the effect here is in the stress loss.
		stress_impact = {
			base = medium_stress_loss
			shy = miniscule_stress_impact_loss
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = -2 }
		}
	}
}

##################################################
# It Isn't Fair
# by Ewan Cowhig Croft
# 1051 - 1060
##################################################

scripted_trigger ep3_laamp_flavour_ewan_1051_valid_memory_trigger = {
	has_memory_type = became_landless_adventurer_memory
	memory_age_years >= 5
}

scripted_trigger ep3_laamp_flavour_ewan_1051_valid_child_trigger = {
	ep3_laamp_flavour_ewan_available_child_trigger = yes
	NOR = {
		has_trait = humble
		has_trait = content
	}
}

scripted_effect ep3_laamp_flavour_ewan_1051_roll_duel_effect = {
	save_scope_value_as = {
		name = duel_diff
		value = {
			value = scope:child.$SKILL$
			add = 7
			max = very_high_skill_rating
		}
	}
	duel = {
		skill = $SKILL$
		value = scope:duel_diff
		# Victory!
		50 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = 3.5
				min = -49
			}
			min = 5
			desc = ep3_laamp_flavour_ewan.1051.tt.success
			send_interface_toast = {
				title = ep3_laamp_flavour_ewan.1051.tt.success
				left_icon = scope:child
				scope:child = {
					add_$SKILL$_lifestyle_perk_points = 1
					add_opinion = {
						target = root
						modifier = respect_opinion
						opinion = 20
					}
					add_stress = major_stress_loss
				}
			}
		}
		# Defeat.
		50 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = -3.5
				min = -49
			}
			min = 5
			desc = ep3_laamp_flavour_ewan.1051.tt.failure
			send_interface_toast = {
				title = ep3_laamp_flavour_ewan.1051.tt.failure
				left_icon = scope:child
				reverse_add_opinion = {
					target = scope:child
					modifier = hate_opinion
					opinion = -30
				}
				random = {
					chance = 35
					add_trait = depressed_1
				}
			}
		}
	}
}

#	Child unhappy with life on the road.
ep3_laamp_flavour_ewan.1051 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.1051.t
	desc = ep3_laamp_flavour_ewan.1051.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:child
		animation = rage
	}
	override_background = { reference = corridor_night }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_1051 }
		}
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Valid child.
		any_child = { ep3_laamp_flavour_ewan_1051_valid_child_trigger = yes }
		# Valid memory.
		any_memory = { ep3_laamp_flavour_ewan_1051_valid_memory_trigger = yes }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_1051
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_1051
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Grab our best child.
		random_child = {
			limit = { ep3_laamp_flavour_ewan_1051_valid_child_trigger = yes }
			weight = {
				modifier = {
					add = 10
					has_trait = arrogant
				}
				modifier = {
					add = 10
					has_trait = ambitious
				}
				modifier = {
					add = 10
					has_trait = lazy
				}
				modifier = {
					add = 10
					has_trait = impatient
				}
				modifier = {
					add = 10
					has_trait = wrathful
				}
				modifier = {
					add = -10
					has_trait = diligent
				}
				modifier = {
					add = -10
					has_trait = patient
				}
				modifier = {
					add = -10
					has_trait = calm
				}
			}
			save_scope_as = child
			add_stress = major_stress_gain
		}
		# And our memory.
		random_memory = {
			limit = { ep3_laamp_flavour_ewan_1051_valid_memory_trigger = yes }
			save_scope_as = memory
		}
	}

	# Come here, my GirlBoy.
	option = {
		name = ep3_laamp_flavour_ewan.1051.a

		ep3_laamp_flavour_ewan_1051_roll_duel_effect = { SKILL = diplomacy }

		stress_impact = {
			compassionate = miniscule_stress_impact_loss
			callous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 2 }
		}
	}

	# Fair? You're a House.GetName! Stand up straight!
	option = {
		name = ep3_laamp_flavour_ewan.1051.b

		ep3_laamp_flavour_ewan_1051_roll_duel_effect = { SKILL = martial }

		stress_impact = {
			arrogant = minor_stress_impact_loss
			callous = miniscule_stress_impact_loss
			compassionate = minor_stress_impact_gain
			humble = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_compassion = -1
				ai_vengefulness = 1
			}
		}
	}

	# I know, but it is what it is.
	option = {
		name = ep3_laamp_flavour_ewan.1051.c

		ep3_laamp_flavour_ewan_1051_roll_duel_effect = { SKILL = learning }

		stress_impact = {
			content = minor_stress_impact_loss
			ambitious = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -2 }
		}
	}

	# Leave HerHim to tantrum.
	option = {
		name = ep3_laamp_flavour_ewan.1051.d

		random_list = {
			100 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1051.d.tt.annoyance_fades
					left_icon = scope:child
					scope:child = { add_stress = major_stress_loss }
				}
			}
			100 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1051.d.tt.grudge_held
					left_icon = scope:child
					reverse_add_opinion = {
						target = scope:child
						modifier = grudge_opinion
						opinion = -35
					}
					random = {
						chance = 50
						add_trait = depressed_1
					}
				}
			}
		}

		stress_impact = {
			callous = minor_stress_impact_loss
			lazy = miniscule_stress_impact_loss
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			opinion_modifier = {
				opinion_target = scope:child
				multiplier = -1
			}
		}
	}
}

##################################################
# Quick Study
# by Ewan Cowhig Croft
# 1061 - 1070
##################################################

scripted_trigger ep3_laamp_flavour_ewan_1061_valid_child_trigger = {
	ep3_laamp_flavour_ewan_available_child_trigger = yes
	NOT = { knows_language_of_culture = root.location.culture }
	current_extra_languages < language_soft_cap
}

#	Child picks up local language quickly.
ep3_laamp_flavour_ewan.1061 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.1061.t
	desc = ep3_laamp_flavour_ewan.1061.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:child
		animation = personality_bold
	}
	override_background = { reference = ep3_campfire }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_1061 }
		}
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Must have a suitable child.
		any_child = { ep3_laamp_flavour_ewan_1061_valid_child_trigger = yes }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_1061
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_1061
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_short
			}
		}
		# Grab a suitable child.
		random_child = {
			limit = { ep3_laamp_flavour_ewan_1061_valid_child_trigger = yes }
			weight = {
				modifier = {
					add = learning
					always = yes
				}
			}
			save_scope_as = child
		}
		# Teach them the language.
		scope:child = { learn_language_of_culture = root.location.culture }
		# Save our county for loc.
		location.county = { save_scope_as = current_county }
	}

	# Hmm, smart GirlBoy.
	option = {
		name = ep3_laamp_flavour_ewan.1061.a

		add_prestige = minor_prestige_gain
		scope:child = { add_prestige = medium_prestige_gain }

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -1 }
		}
	}

	# Maybe they could teach me...
	option = {
		name = ep3_laamp_flavour_ewan.1061.b
		trigger = {
			NOT = { knows_language_of_culture = root.location.culture }
			current_extra_languages < language_soft_cap
		}

		duel = {
			skill = learning
			value = high_skill_rating
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.1061.b.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1061.b.tt.success
					left_icon = scope:child
					learn_language_of_culture = root.location.culture
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.1061.b.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1061.b.tt.failure
					left_icon = scope:child
					add_stress = medium_stress_gain
				}
			}
		}

		stress_impact = {
			diligent = miniscule_stress_impact_loss
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = 1 }
		}
	}

	# Get that foreign muck out of your mouth!
	option = {
		name = ep3_laamp_flavour_ewan.1061.c
		trigger = {
			NOT = {
				root.culture = { has_same_culture_language = root.location.culture }
			}
		}

		scope:child = {
			unlearn_language_of_culture = root.location.culture
			add_opinion = {
				target = root
				modifier = kindness_opinion
				opinion = -10
			}
		}

		stress_impact = {
			arrogant = minor_stress_impact_loss
			humble = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = {
				add = {
					value = "culture.cultural_acceptance(root.location.culture)"
					multiply = -2
				}
				always = yes
			}
		}
	}
}

##################################################
# At the Edge of Camp
# by Ewan Cowhig Croft
# 1071 - 1080
##################################################

#	Children playing in local terrain.
ep3_laamp_flavour_ewan.1071 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.1071.t
	desc = {
		desc = ep3_laamp_flavour_ewan.1071.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { scope:terrain_type = flag:plains }
				desc = ep3_laamp_flavour_ewan.1071.desc.plains
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:farmlands }
				desc = ep3_laamp_flavour_ewan.1071.desc.farmlands
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:hills }
				desc = ep3_laamp_flavour_ewan.1071.desc.hills
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:mountains }
				desc = ep3_laamp_flavour_ewan.1071.desc.mountains
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:desert }
				desc = ep3_laamp_flavour_ewan.1071.desc.desert
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:desert_mountains }
				desc = ep3_laamp_flavour_ewan.1071.desc.desert_mountains
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:oasis }
				desc = ep3_laamp_flavour_ewan.1071.desc.oasis
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:jungle }
				desc = ep3_laamp_flavour_ewan.1071.desc.jungle
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:forest }
				desc = ep3_laamp_flavour_ewan.1071.desc.forest
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:taiga }
				desc = ep3_laamp_flavour_ewan.1071.desc.taiga
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:wetlands }
				desc = ep3_laamp_flavour_ewan.1071.desc.wetlands
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:steppe }
				desc = ep3_laamp_flavour_ewan.1071.desc.steppe
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:floodplains }
				desc = ep3_laamp_flavour_ewan.1071.desc.floodplains
			}
			triggered_desc = {
				trigger = { scope:terrain_type = flag:drylands }
				desc = ep3_laamp_flavour_ewan.1071.desc.drylands
			}
		}
		desc = ep3_laamp_flavour_ewan.1071.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = dismissal
	}
	right_portrait = {
		character = scope:own_child
		animation = happiness
	}
	lower_left_portrait = scope:extra_child_3
	lower_center_portrait = scope:extra_child_2
	lower_right_portrait = scope:extra_child_1
	override_background = { reference = wilderness }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_1071 }
		}
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Don't let the children out to play during a plague.
		location = {
			any_province_epidemic = { count <= 0 }
		}
		# And have a suitable named child of our own.
		any_child = { ep3_laamp_flavour_ewan_available_child_trigger = yes }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_1071
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_1071
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Grab our terrain.
		ep3_laamp_flavour_ewan_register_terrain_effect = yes
		# Sort our child scopes.
		random_child = {
			limit = { ep3_laamp_flavour_ewan_available_child_trigger = yes }
			save_scope_as = own_child
			add_to_list = playing_children_list
			add_stress = major_stress_loss
		}
		ordered_courtier = {
			limit = {
				ep3_laamp_flavour_ewan_available_child_trigger = yes
				this != scope:own_child
			}
			# Grab the children closest in age to our chosen child.
			order_by = {
				value = 100
				if = {
					limit = { age > scope:own_child.age }
					add = {
						value = scope:own_child.age
						subtract = age
					}
				}
				else_if = {
					limit = { age < scope:own_child.age }
					add = {
						value = scope:own_child.age
						subtract = age
						multiply = -1
					}
				}
			}
			max = 3
			check_range_bounds = no
			if = {
				limit = {
					NOT = { exists = scope:extra_child_1 }
				}
				save_scope_as = extra_child_1
				add_to_list = playing_children_list
				add_stress = major_stress_loss
			}
			else_if = {
				limit = {
					NOT = {
						this = scope:extra_child_1
						exists = scope:extra_child_2
					}
				}
				save_scope_as = extra_child_2
				add_to_list = playing_children_list
				add_stress = major_stress_loss
			}
			else_if = {
				limit = {
					NOT = {
						this = scope:extra_child_1
						this = scope:extra_child_2
						exists = scope:extra_child_3
					}
				}
				save_scope_as = extra_child_3
				add_to_list = playing_children_list
				add_stress = major_stress_loss
			}
			# Set up future friendships.
			hidden_effect = {
				every_in_list = {
					list = playing_children_list
					save_scope_as = char_temp
					every_in_list = {
						list = playing_children_list
						if = {
							limit = {
								this != scope:char_temp
								can_set_relation_potential_friend_trigger = { CHARACTER = scope:char_temp }
							}
							set_relation_potential_friend = scope:char_temp
						}
					}
				}
			}
		}
	}

	# Stay within sight!
	option = {
		name = ep3_laamp_flavour_ewan.1071.a

		random_list = {
			100 = {
				every_in_list = {
					list = playing_children_list
					custom = ep3_laamp_flavour_ewan.1071.tt.every_playing_child
					add_diplomacy_lifestyle_perk_points = 1
				}
			}
			100 = {
				every_in_list = {
					list = playing_children_list
					custom = ep3_laamp_flavour_ewan.1071.tt.every_playing_child
					add_stewardship_lifestyle_perk_points = 1
				}
			}
			100 = {
				every_in_list = {
					list = playing_children_list
					custom = ep3_laamp_flavour_ewan.1071.tt.every_playing_child
					add_intrigue_lifestyle_perk_points = 1
				}
			}
		}

		stress_impact = {
			paranoid = medium_stress_impact_loss
			trusting = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 1 }
		}
	}

	# Go on, explore.
	option = {
		name = ep3_laamp_flavour_ewan.1071.b

		random_list = {
			100 = {
				every_in_list = {
					list = playing_children_list
					custom = ep3_laamp_flavour_ewan.1071.tt.every_playing_child
					add_martial_lifestyle_perk_points = 1
				}
			}
			100 = {
				every_in_list = {
					list = playing_children_list
					custom = ep3_laamp_flavour_ewan.1071.tt.every_playing_child
					add_learning_lifestyle_perk_points = 1
				}
			}
		}

		stress_impact = {
			trusting = miniscule_stress_impact_loss
			paranoid = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 1 }
		}
	}

	# Children, excited for the simplest things...
	option = {
		name = ep3_laamp_flavour_ewan.1071.c

		# Major effect is stress loss.
		add_stress = major_stress_loss

		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -0.5 }
		}
	}
}

##################################################
# Growing Up
# by Ewan Cowhig Croft
# 1081 - 1090
##################################################

scripted_trigger ep3_laamp_flavour_ewan_1081_valid_child_trigger = {
	ep3_laamp_flavour_ewan_available_child_trigger = yes
	age <= 12
	NOT = { has_character_flag = demanded_own_tent }
	OR = {
		has_trait = bossy
		has_trait = rowdy
		has_trait = greedy
		has_trait = diligent
		has_trait = impatient
		has_trait = arrogant
		has_trait = shy
		has_trait = ambitious
		has_trait = paranoid
		has_trait = stubborn
		has_trait = eccentric
	}
}

scripted_effect ep3_laamp_flavour_ewan_1081_roll_duel_effect = {
	scope:child = {
		duel = {
			skill = $EDUCATION$
			value = medium_skill_rating
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.1081.b.tt.success
				root = {
					send_interface_toast = {
						title = ep3_laamp_flavour_ewan.1081.b.tt.success
						left_icon = scope:child
						scope:child = {
							add_opinion = {
								target = root
								modifier = respect_opinion
								opinion = 40
							}
							add_prestige = medium_prestige_gain
						}
					}
				}
			}
			# Defeat!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.1081.b.tt.failure
				root = {
					send_interface_toast = {
						title = ep3_laamp_flavour_ewan.1081.b.tt.failure
						left_icon = scope:child
						scope:child = {
							add_opinion = {
								target = root
								modifier = frustrated_opinion
								opinion = -40
							}
							add_stress = major_stress_gain
						}
					}
				}
			}
		}
	}
}

#	Child demands own tent.
ep3_laamp_flavour_ewan.1081 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.1081.t
	desc = ep3_laamp_flavour_ewan.1081.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:child
		animation = anger
	}
	override_background = { reference = corridor_night }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_1081 }
		}
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# And that we've got a suitable child.
		any_child = { ep3_laamp_flavour_ewan_1081_valid_child_trigger = yes }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_1081
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_1081
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Grab a suitable child.
		ordered_child = {
			limit = { ep3_laamp_flavour_ewan_1081_valid_child_trigger = yes }
			order_by = age
			save_scope_as = child
			add_character_flag = {
				flag = demanded_own_tent
				# Let the flag clean itself up some time after we become an adult, as it'll no longer be relevant.
				years = 16
			}
		}
	}

	# Hmm, okay. You're a WomanMan now.
	option = {
		name = ep3_laamp_flavour_ewan.1081.a

		add_prestige = minor_prestige_loss
		scope:child = {
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = 25
			}
			add_prestige = minor_prestige_gain
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = -2 }
		}
	}

	# You want it? Earn it.
	option = {
		name = ep3_laamp_flavour_ewan.1081.b
		flavor = ep3_laamp_flavour_ewan.1081.b.f
		trait = education_diplomacy_1
		trait = education_diplomacy_2
		trait = education_diplomacy_3
		trait = education_diplomacy_4
		trait = education_diplomacy_5
		trait = education_martial_1
		trait = education_martial_2
		trait = education_martial_3
		trait = education_martial_4
		trait = education_martial_5
		trait = education_stewardship_1
		trait = education_stewardship_2
		trait = education_stewardship_3
		trait = education_stewardship_4
		trait = education_stewardship_5
		trait = education_intrigue_1
		trait = education_intrigue_2
		trait = education_intrigue_3
		trait = education_intrigue_4
		trait = education_intrigue_5
		trait = education_learning_1
		trait = education_learning_2
		trait = education_learning_3
		trait = education_learning_4
		trait = education_learning_5

		# Roll a different duel depending on our education.
		switch = {
			trigger = has_trait
			education_diplomacy = {
				ep3_laamp_flavour_ewan_1081_roll_duel_effect = { EDUCATION = diplomacy }
			}
			education_martial = {
				ep3_laamp_flavour_ewan_1081_roll_duel_effect = { EDUCATION = martial }
			}
			education_stewardship = {
				ep3_laamp_flavour_ewan_1081_roll_duel_effect = { EDUCATION = stewardship }
			}
			education_intrigue = {
				ep3_laamp_flavour_ewan_1081_roll_duel_effect = { EDUCATION = intrigue }
			}
			education_learning = {
				ep3_laamp_flavour_ewan_1081_roll_duel_effect = { EDUCATION = learning }
			}
		}

		stress_impact = {
			diligent = miniscule_stress_impact_loss
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 1 }
		}
	}

	# Bah, you're a child till I say otherwise.
	option = {
		name = ep3_laamp_flavour_ewan.1081.c

		add_prestige = minor_prestige_gain
		reverse_add_opinion = {
			target = scope:child
			modifier = frustrated_opinion
			opinion = -20
		}

		stress_impact = {
			arrogant = miniscule_stress_impact_loss
			callous = miniscule_stress_impact_loss
			compassionate = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -0.5 }
		}
	}
}

##################################################
# Every Parent's Duty
# by Ewan Cowhig Croft
# 1091 - 1100
##################################################

scripted_trigger ep3_laamp_flavour_ewan_1091_valid_child_trigger = {
	ep3_laamp_flavour_ewan_available_child_trigger = yes
	NOT = { has_character_flag = taught_to_ride }
	# If you have Horse Lords, this _has_ to be taught much earlier.
	trigger_if = {
		limit = {
			root = {
				OR = {
					culture = { culture_has_archer_cavalry_maa = yes }
					mpo_can_recruit_nomad_maa_trigger = yes
				}
			}
		}
		age <= 8
	}
}

scripted_effect ep3_laamp_flavour_ewan_1091_roll_duel_effect = {
	duel = {
		skill = $SKILL$
		value = high_skill_rating
		# Victory!
		50 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = 3.5
				min = -49
			}
			min = 5
			desc = ep3_laamp_flavour_ewan.1091.tt.success
			root = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1091.tt.success
					left_icon = scope:child
					scope:child = {
						add_opinion = {
							target = root
							modifier = amazed_opinion
							opinion = 40
						}
						add_character_modifier = {
							modifier = ep3_laamp_flavour_ewan_1091_confidence_gained_modifier
							years = 10
						}
					}
				}
			}
		}
		# Defeat!
		50 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = -3.5
				min = -49
			}
			min = 5
			desc = ep3_laamp_flavour_ewan.1091.tt.failure
			root = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1091.tt.failure
					left_icon = scope:child
					scope:child = {
						increase_wounds_no_death_effect = { REASON = horse_riding_accident }
						add_opinion = {
							target = root
							modifier = let_me_down_opinion
							opinion = -20
						}
					}
				}
			}
		}
	}
}

#	Teaching a youngling how to ride.
ep3_laamp_flavour_ewan.1091 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.1091.t
	desc = ep3_laamp_flavour_ewan.1091.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:child
		animation = worry
	}
	override_background = { reference = army_camp }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_1091 }
		}
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# And have a suitable child
		any_child = { ep3_laamp_flavour_ewan_1091_valid_child_trigger = yes }
	}

	weight_multiplier = {
		# Weight up for Horse Lords, for whom this is especially vital (yes, over and above western knights).
		modifier = {
			add = 2
			culture = { culture_has_archer_cavalry_maa = yes }
		}
		
		modifier = {
			add = 2
			has_trait = nomadic_philosophy
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_1091
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_1091
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Grab a suitable child.
		ordered_child = {
			limit = { ep3_laamp_flavour_ewan_1091_valid_child_trigger = yes }
			order_by = age
			save_scope_as = child
			add_character_flag = {
				flag = taught_to_ride
				# Let the flag clean itself up some time after we become an adult, as it'll no longer be relevant.
				years = 16
			}
		}
	}

	# Diplo duel: remember, be firm, but respectful.
	option = {
		name = ep3_laamp_flavour_ewan.1091.a

		ep3_laamp_flavour_ewan_1091_roll_duel_effect = { SKILL = diplomacy }

		stress_impact = {
			compassionate = miniscule_stress_impact_loss
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
		}
	}

	# Martial duel: don't be afraid to crack the whip!
	option = {
		name = ep3_laamp_flavour_ewan.1091.b

		ep3_laamp_flavour_ewan_1091_roll_duel_effect = { SKILL = martial }

		stress_impact = {
			wrathful = miniscule_stress_impact_loss
			impatient = miniscule_stress_impact_loss
			callous = miniscule_stress_impact_loss
			sadistic = miniscule_stress_impact_loss
			patient = minor_stress_impact_gain
			calm = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 1 }
		}
	}

	# Prowess duel: master the horse or it'll toss you.
	option = {
		name = ep3_laamp_flavour_ewan.1091.c

		ep3_laamp_flavour_ewan_1091_roll_duel_effect = { SKILL = prowess }

		stress_impact = {
			calm = miniscule_stress_impact_loss
			patient = miniscule_stress_impact_loss
			impatient = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_vengefulness = 1 }
		}
	}

	# Say nothing.
	option = {
		name = ep3_laamp_flavour_ewan.1091.d

		random_list = {
			100 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1091.d.tt.success
					left_icon = scope:child
					scope:child = {
						add_opinion = {
							target = root
							modifier = amazed_opinion
							opinion = 20
						}
						add_character_modifier = {
							modifier = ep3_laamp_flavour_ewan_1091_confidence_gained_modifier
							years = 10
						}
					}
				}
			}
			100 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.1091.d.tt.failure
					left_icon = scope:child
					scope:child = {
						increase_wounds_no_death_effect = { REASON = horse_riding_accident }
						add_opinion = {
							target = root
							modifier = let_me_down_opinion
							opinion = -10
						}
					}
				}
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -0.5 }
		}
	}
}

##################################################
# Helping Out
# by Ewan Cowhig Croft
# 1101 - 1110
##################################################

scripted_trigger ep3_laamp_flavour_ewan_1101_valid_starting_child_trigger = {
	child_is_infant_trigger = yes
	is_courtier_of = root
	location = root.location
	is_available_allow_travelling = yes
}

scripted_effect ep3_laamp_flavour_ewan_1101_increment_affection_effect = {
	reverse_add_opinion = {
		target = scope:child
		modifier = love_opinion
		opinion = 20
	}
	hidden_effect = {
		add_opinion = {
			target = scope:child
			modifier = love_opinion
			opinion = 20
		}
	}
}

#	Child helps with packing.
ep3_laamp_flavour_ewan.1101 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.1101.t
	desc = ep3_laamp_flavour_ewan.1101.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = boredom
	}
	right_portrait = {
		character = scope:child
		animation = admiration
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_1101
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_1101
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_longest
			}
		}
		# Nab a suitable child.
		random_child = {
			limit = { ep3_laamp_flavour_ewan_1101_valid_starting_child_trigger = yes }
			save_scope_as = child
		}
	}

	# What're you doing there, little LassLad?
	option = {
		name = ep3_laamp_flavour_ewan.1101.a

		ep3_laamp_flavour_ewan_1101_increment_affection_effect = yes
		# Set us up for our future events.
		set_variable = {
			name = packing_assistant
			value = scope:child
		}
		# Account for how many times we've helped.
		increment_variable_effect = {
			VAR = helped_packing
			VAL = 1
		}

		stress_impact = {
			compassionate = miniscule_stress_impact_loss
			callous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
		}
	}

	# Shoo, you menace!
	option = {
		name = ep3_laamp_flavour_ewan.1101.b

		add_prestige = minor_prestige_gain
		reverse_add_opinion = {
			target = scope:child
			modifier = hurt_opinion
			opinion = -10
		}

		stress_impact = {
			callous = miniscule_stress_impact_loss
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -1 }
		}
	}
}

#	Pre-filter event, so that we can keep the spamminess down.
ep3_laamp_flavour_ewan.1102 = {
	hidden = yes

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Only valid for Laamps
		has_government = landless_adventurer_government
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_1101 }
		}
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Plus that we haven't started this chain once already.
		NOT = { has_variable = packing_assistant }
		# And that we have a suitable child.
		any_child = { ep3_laamp_flavour_ewan_1101_valid_starting_child_trigger = yes }
	}

	immediate = {
		# We keep this _quite_ low, as it's otherwise able to trigger any time you start a travel.
		random = {
			chance = 1
			random = {
				chance = 75
				trigger_event = ep3_laamp_flavour_ewan.1101
			}
		}
	}
}

scripted_trigger ep3_laamp_flavour_ewan_1103_child_younger_trigger = {
	age <= @ep3_laamp_flavour_ewan_1103_age_threshold_young
	root = {
		NOT = { has_character_flag = had_packing_assistant_chain_stage_younger }
	}
}

scripted_trigger ep3_laamp_flavour_ewan_1103_child_older_trigger = {
	age > @ep3_laamp_flavour_ewan_1103_age_threshold_young
	age <= @ep3_laamp_flavour_ewan_1103_age_threshold_older
	root = {
		NOT = { has_character_flag = had_packing_assistant_chain_stage_older }
	}
}

scripted_trigger ep3_laamp_flavour_ewan_1103_child_teen_trigger = {
	age > @ep3_laamp_flavour_ewan_1103_age_threshold_older
	is_adult = no
	root = {
		NOT = { has_character_flag = had_packing_assistant_chain_stage_teen }
	}
}

scripted_trigger ep3_laamp_flavour_ewan_1103_child_adult_trigger = {
	is_adult = yes
	root = {
		NOT = { has_character_flag = had_packing_assistant_chain_stage_adult }
		# And they have to done it several times.
		var:helped_packing >= 3
	}
}

scripted_trigger ep3_laamp_flavour_ewan_1103_proceed_to_failure_event_trigger = {
	OR = {
		is_alive = no
		has_relation_rival = root
		opinion = {
			target = root
			value <= -75
		}
	}
}

#	Child helps with packing.
ep3_laamp_flavour_ewan.1103 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.1103.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					var:packing_assistant = {
						ep3_laamp_flavour_ewan_1103_child_younger_trigger = yes
					}
				}
				desc = ep3_laamp_flavour_ewan.1103.desc.child_younger
			}
			triggered_desc = {
				trigger = {
					var:packing_assistant = {
						ep3_laamp_flavour_ewan_1103_child_older_trigger = yes
					}
				}
				desc = ep3_laamp_flavour_ewan.1103.desc.child_older
			}
			triggered_desc = {
				trigger = {
					var:packing_assistant = {
						ep3_laamp_flavour_ewan_1103_child_teen_trigger = yes
					}
				}
				desc = ep3_laamp_flavour_ewan.1103.desc.child_teen
			}
			triggered_desc = {
				trigger = {
					var:packing_assistant = {
						ep3_laamp_flavour_ewan_1103_child_adult_trigger = yes
					}
				}
				desc = ep3_laamp_flavour_ewan.1103.desc.child_adult
			}
		}
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:child
		animation = admiration
	}

	trigger = {
		has_variable = packing_assistant
		NOR = {
			has_character_flag = aborted_packing_chain
			has_variable = had_ep3_laamp_flavour_ewan_1104
		}
		is_available_allow_travelling = yes
		var:packing_assistant = {
			is_courtier_of = root
			location = root.location
			is_available_allow_travelling = yes
			OR = {
				ep3_laamp_flavour_ewan_1103_child_younger_trigger = yes
				ep3_laamp_flavour_ewan_1103_child_older_trigger = yes
				ep3_laamp_flavour_ewan_1103_child_teen_trigger = yes
				ep3_laamp_flavour_ewan_1103_child_adult_trigger = yes
			}
			ep3_laamp_flavour_ewan_1103_proceed_to_failure_event_trigger = no
		}
	}

	on_trigger_fail = { trigger_event = ep3_laamp_flavour_ewan.1104 }

	immediate = {
		# Nab our assistant for ease of reference.
		var:packing_assistant = { save_scope_as = child }
	}

	# Very young child helps a little.
	option = {
		name = ep3_laamp_flavour_ewan.1103.a
		trigger = {
			scope:child = { ep3_laamp_flavour_ewan_1103_child_younger_trigger = yes }
		}

		ep3_laamp_flavour_ewan_1101_increment_affection_effect = yes
		# Account for how many times we've helped.
		increment_variable_effect = {
			VAR = helped_packing
			VAL = 1
		}

		add_stress = miniscule_stress_loss
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 3 }
		}
	}

	# Older child is quite helpful.
	option = {
		name = ep3_laamp_flavour_ewan.1103.b
		trigger = {
			scope:child = { ep3_laamp_flavour_ewan_1103_child_older_trigger = yes }
		}

		ep3_laamp_flavour_ewan_1101_increment_affection_effect = yes
		# Account for how many times we've helped.
		increment_variable_effect = {
			VAR = helped_packing
			VAL = 1
		}

		add_stress = minor_stress_loss
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 3 }
		}
	}

	# Teen is very helpful.
	option = {
		name = ep3_laamp_flavour_ewan.1103.c
		trigger = {
			scope:child = { ep3_laamp_flavour_ewan_1103_child_teen_trigger = yes }
		}

		ep3_laamp_flavour_ewan_1101_increment_affection_effect = yes
		# Account for how many times we've helped.
		increment_variable_effect = {
			VAR = helped_packing
			VAL = 1
		}

		add_stress = medium_stress_loss
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 3 }
		}
	}

	# Adult might become your best friend over this simple activity.
	option = {
		name = ep3_laamp_flavour_ewan.1103.d
		trigger = {
			scope:child = { ep3_laamp_flavour_ewan_1103_child_adult_trigger = yes }
		}

		# Best friends, if possible.
		if = {
			limit = {
				can_set_relation_best_friend_trigger = { CHARACTER = scope:child }
			}
			set_relation_best_friend = {
				reason = best_friend_childhood_ritual
				target = scope:child
			}
		}
		# Loyalty hook, if possible.
		if = {
			limit = {
				can_add_hook = {
					target = scope:child
					type = loyalty_hook
				}
			}
			add_hook = {
				target = scope:child
				type = loyalty_hook
			}
		}
		# Oodles of opinion.
		reverse_add_opinion = {
			target = scope:child
			modifier = love_opinion
			opinion = 50
		}

		add_stress = major_stress_loss
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 3 }
		}
	}

	# I can do it myself, scope:child.
	option = {
		name = ep3_laamp_flavour_ewan.1103.e

		add_prestige = minor_prestige_gain
		reverse_add_opinion = {
			target = scope:child
			modifier = hurt_opinion
			opinion = {
				value = -10
				multiply = var:helped_packing
			}
		}
		add_character_flag = aborted_packing_chain

		stress_impact = {
			callous = minor_stress_impact_loss
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -1 }
		}
	}

	after = {
		if = {
			limit = {
				scope:child = { ep3_laamp_flavour_ewan_1103_child_younger_trigger = yes }
			}
			add_character_flag = had_packing_assistant_chain_stage_younger
		}
		if = {
			limit = {
				scope:child = { ep3_laamp_flavour_ewan_1103_child_older_trigger = yes }
			}
			add_character_flag = had_packing_assistant_chain_stage_older
		}
		if = {
			limit = {
				scope:child = { ep3_laamp_flavour_ewan_1103_child_teen_trigger = yes }
			}
			add_character_flag = had_packing_assistant_chain_stage_teen
		}
		if = {
			limit = {
				scope:child = { ep3_laamp_flavour_ewan_1103_child_adult_trigger = yes }
			}
			add_character_flag = had_packing_assistant_chain_stage_adult
		}
	}
}

#	Child will no longer help with packing — for one reason or another.
ep3_laamp_flavour_ewan.1104 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.1104.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:child = { is_alive = no }
				}
				desc = ep3_laamp_flavour_ewan.1104.desc.child_dead
			}
			desc = ep3_laamp_flavour_ewan.1104.desc.child_rival
		}
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = worry
	}
	right_portrait = {
		character = scope:child
		triggered_animation = {
			animation = map_fear
			trigger = {
				scope:child = { is_alive = no }
			}
		}
		triggered_animation = {
			animation = dismissal
			trigger = {
				scope:child = { is_alive = yes }
			}
		}
	}

	trigger = {
		has_variable = packing_assistant
		NOT = { has_variable = had_ep3_laamp_flavour_ewan_1104 }
		# Must've had at least one instance of the follow-up event, so that there's a pattern.
		var:helped_packing >= 2
		# Aaaand make sure we should actually be firing _this_ event.
		var:packing_assistant = { ep3_laamp_flavour_ewan_1103_proceed_to_failure_event_trigger = yes }
	}

	immediate = {
		# Limit this event to firing once.
		set_variable = {
			name = had_ep3_laamp_flavour_ewan_1104
			value = yes
		}
		# Nab our (former) assistant for ease of reference.
		var:packing_assistant = { save_scope_as = child }
	}

	# Dead: you killed them.
	option = {
		name = ep3_laamp_flavour_ewan.1104.a
		trigger = { scope:child.killer ?= root }

		# Most of the effect is in the stress impact.
		stress_impact = {
			base = major_stress_gain
			compassionate = minor_stress_impact_gain
			# We don't account for callous here, because they get a special option.
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
		}
	}

	# Dead: you do know who killed them and it wasn't you.
	option = {
		name = ep3_laamp_flavour_ewan.1104.b
		trigger = {
			scope:child = {
				killer ?= {
					is_alive = yes
					this != root
				}
			}
		}

		progress_towards_rival_effect = {
			REASON = rival_killed_heir
			CHARACTER = scope:child.killer
			OPINION = default_rival_opinion
		}

		stress_impact = {
			vengeful = major_stress_impact_loss
			forgiving = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
		}
	}

	# Callous: _eh_.
	option = {
		name = ep3_laamp_flavour_ewan.1104.c
		trigger = { has_trait = callous }
		trait = callous

		# Entire effect is in the stress impact.
		stress_impact = { callous = massive_stress_impact_loss }
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -2 }
		}
	}

	# Try to move on.
	option = {
		name = ep3_laamp_flavour_ewan.1104.d
		trigger = {
			NOT = { exists = scope:child.killer }
		}

		# Most of the effect is in the stress impact.
		stress_impact = {
			base = major_stress_gain
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 1 }
		}
	}
}

##################################################
# A Nose for Trouble
# by Ewan Cowhig Croft
# 1111 - 1120
##################################################

scripted_trigger ep3_laamp_flavour_ewan_1111_valid_child_trigger = {
	ep3_laamp_flavour_ewan_available_child_trigger = yes
	ep3_laamp_flavour_ewan_no_dog_trigger = yes
}

#	Child adopts puppy.
ep3_laamp_flavour_ewan.1111 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.1111.t
	desc = {
		desc = ep3_laamp_flavour_ewan.1111.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					domicile = { has_domicile_building = baggage_train_kennel }
				}
				desc = ep3_laamp_flavour_ewan.1111.desc.has_kennels
			}
			desc = ep3_laamp_flavour_ewan.1111.desc.no_kennels
		}
		desc = ep3_laamp_flavour_ewan.1111.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = laugh
	}
	right_portrait = {
		character = scope:child
		animation = happiness
	}
	override_background = { reference = corridor_day }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_1111 }
		}
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# And have a suitable child.
		any_child = { ep3_laamp_flavour_ewan_1111_valid_child_trigger = yes }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_1111
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_1111
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_long
			}
		}
		random_child = {
			limit = { ep3_laamp_flavour_ewan_1111_valid_child_trigger = yes }
			save_scope_as = child
		}
	}

	# A GirlBoy and HerHis dog.
	option = {
		name = ep3_laamp_flavour_ewan.1111.a

		scope:child = {
			start_dog_story_cycle_effect = yes
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 50
			}
			add_stress = massive_stress_loss
		}

		# Everyone loves pets!
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
		}
	}

	# Sadistic: drown the dog.
	option = {
		name = ep3_laamp_flavour_ewan.1111.b
		trigger = { has_trait = sadistic }
		trait = sadistic

		scope:child = {
			set_relation_rival = {
				reason = rival_drowned_dog
				target = root
			}
		}

		# Mostly stress loss for the positives here.
		stress_impact = { sadistic = 200 }
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -3 }
		}
	}

	# Low on provisions: My, what a fat hound. Good find, LassLad!
	option = {
		name = ep3_laamp_flavour_ewan.1111.c
		trigger = { domicile.provisions <= provisions_privation_threshold_start }

		domicile = { change_provisions = microscopic_provisions_gain }
		scope:child = {
			progress_towards_rival_effect = {
				REASON = rival_ate_dog
				CHARACTER = root
				OPINION = default_rival_opinion
			}
		}

		stress_impact = {
			callous = miniscule_stress_impact_loss
			gluttonous = miniscule_stress_impact_loss
			temperate = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 2 }
		}
	}

	# Scope:child! Stop playing with that filthy mutt!
	option = {
		name = ep3_laamp_flavour_ewan.1111.d

		add_prestige = minor_prestige_gain
		reverse_add_opinion = {
			target = scope:child
			modifier = hurt_opinion
			opinion = -25
		}

		stress_impact = {
			arrogant = miniscule_stress_impact_loss
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			opinion_modifier = {
				opinion_target = scope:child
				multiplier = -1
			}
		}
	}
}











##################################################
# PERSONAL TENSIONS

##################################################
# Plenty in Common
# by Ewan Cowhig Croft
# # 2001 - 2010
##################################################

scripted_trigger ep3_laamp_flavour_ewan_2001_courtier_1_trigger = {
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
}

scripted_trigger ep3_laamp_flavour_ewan_2001_courtier_2_trigger = {
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
	NOT = { this = $TARGET$ }
	OR = {
		number_of_personality_traits_in_common = {
			target = $TARGET$
			value >= 2
		}
		AND = {
			number_of_personality_traits_in_common = {
				target = $TARGET$
				value >= 1
			}
			opinion = {
				target = $TARGET$
				value >= 1
			}
		}
	}
	number_of_opposing_personality_traits = {
		target = $TARGET$
		value <= 0
	}
	opinion = {
		target = $TARGET$
		value >= -40
	}
	NOR = {
		has_any_moderate_good_relationship_with_character_trigger = { CHARACTER = $TARGET$ }
		has_any_moderate_bad_relationship_with_character_trigger = { CHARACTER = $TARGET$ }
	}
	can_set_relation_friend_trigger = { CHARACTER = $TARGET$ }
}

scripted_effect ep3_laamp_flavour_ewan_2001_make_friends_or_best_friends_effect = {
	scope:follower_1 = {
		# If the stars align, become best friends.
		if = {
			limit = {
				can_set_relation_best_friend_trigger = { CHARACTER = scope:follower_2 }
				opinion = {
					target = scope:follower_2
					value >= 100
				}
				reverse_opinion = {
					target = scope:follower_2
					value >= 100
				}
			}
			set_relation_best_friend = {
				reason = friend_mutual_traits
				target = scope:follower_2
			}
		}
		# Otherwise, regular friends will do.
		else = {
			set_relation_friend = {
				reason = friend_mutual_traits
				target = scope:follower_2
			}
		}
	}
}

#	Friendship blooms over shared traits.
ep3_laamp_flavour_ewan.2001 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.2001.t
	desc = {
		desc = ep3_laamp_flavour_ewan.2001.desc.intro
		random_valid = {
			# Lustful
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = lustful }
					scope:follower_2 = { has_trait = lustful }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.lustful
			}
			# Chaste
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = chaste }
					scope:follower_2 = { has_trait = chaste }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.chaste
			}
			# Gluttonous
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = gluttonous }
					scope:follower_2 = { has_trait = gluttonous }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.gluttonous
			}
			# Temperate
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = temperate }
					scope:follower_2 = { has_trait = temperate }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.temperate
			}
			# Greedy
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = greedy }
					scope:follower_2 = { has_trait = greedy }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.greedy
			}
			# Generous
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = generous }
					scope:follower_2 = { has_trait = generous }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.generous
			}
			# Lazy
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = lazy }
					scope:follower_2 = { has_trait = lazy }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.lazy
			}
			# Diligent
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = diligent }
					scope:follower_2 = { has_trait = diligent }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.diligent
			}
			# Wrathful
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = wrathful }
					scope:follower_2 = { has_trait = wrathful }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.wrathful
			}
			# Calm
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = calm }
					scope:follower_2 = { has_trait = calm }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.calm
			}
			# Patient
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = patient }
					scope:follower_2 = { has_trait = patient }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.patient
			}
			# Impatient
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = impatient }
					scope:follower_2 = { has_trait = impatient }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.impatient
			}
			# Arrogant
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = arrogant }
					scope:follower_2 = { has_trait = arrogant }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.arrogant
			}
			# Humble
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = humble }
					scope:follower_2 = { has_trait = humble }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.humble
			}
			# Deceitful
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = deceitful }
					scope:follower_2 = { has_trait = deceitful }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.deceitful
			}
			# Honest
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = honest }
					scope:follower_2 = { has_trait = honest }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.honest
			}
			# Craven
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = craven }
					scope:follower_2 = { has_trait = craven }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.craven
			}
			# Brave
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = brave }
					scope:follower_2 = { has_trait = brave }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.brave
			}
			# Shy
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = shy }
					scope:follower_2 = { has_trait = shy }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.shy
			}
			# Gregarious
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = gregarious }
					scope:follower_2 = { has_trait = gregarious }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.gregarious
			}
			# Ambitious
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = ambitious }
					scope:follower_2 = { has_trait = ambitious }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.ambitious
			}
			# Content
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = content }
					scope:follower_2 = { has_trait = content }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.content
			}
			# Arbitrary
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = arbitrary }
					scope:follower_2 = { has_trait = arbitrary }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.arbitrary
			}
			# Just
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = just }
					scope:follower_2 = { has_trait = just }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.just
			}
			# Cynical
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = cynical }
					scope:follower_2 = { has_trait = cynical }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.cynical
			}
			# Zealous
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = zealous }
					scope:follower_2 = { has_trait = zealous }
					# Just for ease of loc.
					scope:follower_1.faith = scope:follower_2.faith
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.zealous
			}
			# Paranoid
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = paranoid }
					scope:follower_2 = { has_trait = paranoid }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.paranoid
			}
			# Trusting
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = trusting }
					scope:follower_2 = { has_trait = trusting }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.trusting
			}
			# Compassionate
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = compassionate }
					scope:follower_2 = { has_trait = compassionate }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.compassionate
			}
			# Callous
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = callous }
					scope:follower_2 = { has_trait = callous }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.callous
			}
			# Sadistic
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = sadistic }
					scope:follower_2 = { has_trait = sadistic }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.sadistic
			}
			# Stubborn
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = stubborn }
					scope:follower_2 = { has_trait = stubborn }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.stubborn
			}
			# Fickle
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = fickle }
					scope:follower_2 = { has_trait = fickle }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.fickle
			}
			# Vengeful
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = vengeful }
					scope:follower_2 = { has_trait = vengeful }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.vengeful
			}
			# Forgiving
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = forgiving }
					scope:follower_2 = { has_trait = forgiving }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.forgiving
			}
			# Eccentric
			triggered_desc = {
				trigger = {
					scope:follower_1 = { has_trait = eccentric }
					scope:follower_2 = { has_trait = eccentric }
				}
				desc = ep3_laamp_flavour_ewan.2001.desc.eccentric
			}
		}
		desc = ep3_laamp_flavour_ewan.2001.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = scope:follower_1
		animation = admiration
	}
	right_portrait = {
		character = scope:follower_2
		animation = happiness
	}
	override_background = { reference = ep3_campfire }

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_2001
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_2001
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_short
			}
		}
		# Now, let's make them like each other a bit more.
		scope:follower_1 = {
			add_opinion = {
				target = scope:follower_2
				modifier = friendliness_opinion
				opinion = 80
			}
			reverse_add_opinion = {
				target = scope:follower_2
				modifier = friendliness_opinion
				opinion = 80
			}
		}
	}

	# Encourage the friendship.
	option = {
		name = ep3_laamp_flavour_ewan.2001.a

		ep3_laamp_flavour_ewan_2001_make_friends_or_best_friends_effect = yes
		duel = {
			skill = diplomacy
			value = high_skill_rating
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.2001.a.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.2001.a.tt.success
					left_icon = scope:follower_1
					right_icon = scope:follower_2
					reverse_add_opinion = {
						target = scope:follower_1
						modifier = respect_opinion
						opinion = 40
					}
					reverse_add_opinion = {
						target = scope:follower_2
						modifier = respect_opinion
						opinion = 40
					}
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.2001.a.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.2001.a.tt.failure
					left_icon = scope:follower_1
					right_icon = scope:follower_2
					reverse_add_opinion = {
						target = scope:follower_1
						modifier = annoyed_opinion
						opinion = -20
					}
					reverse_add_opinion = {
						target = scope:follower_2
						modifier = annoyed_opinion
						opinion = -20
					}
				}
			}
		}

		stress_impact = {
			gregarious = miniscule_stress_impact_loss
			shy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
		}
	}

	# Try to break up that friendship.
	option = {
		name = ep3_laamp_flavour_ewan.2001.b

		duel = {
			skill = diplomacy
			value = high_skill_rating
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.2001.b.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.2001.b.tt.success
					left_icon = scope:follower_1
					right_icon = scope:follower_2
					reverse_add_opinion = {
						target = scope:follower_1
						modifier = respect_opinion
						opinion = 20
					}
					reverse_add_opinion = {
						target = scope:follower_2
						modifier = respect_opinion
						opinion = 20
					}
				}
				scope:follower_1 = {
					remove_opinion = {
						target = scope:follower_2
						modifier = friendliness_opinion
					}
				}
				scope:follower_2 = {
					remove_opinion = {
						target = scope:follower_1
						modifier = friendliness_opinion
					}
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.2001.b.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.2001.b.tt.failure
					left_icon = scope:follower_1
					right_icon = scope:follower_2
					ep3_laamp_flavour_ewan_2001_make_friends_or_best_friends_effect = yes
					reverse_add_opinion = {
						target = scope:follower_1
						modifier = annoyed_opinion
						opinion = -30
					}
					reverse_add_opinion = {
						target = scope:follower_2
						modifier = annoyed_opinion
						opinion = -30
					}
				}
			}
		}

		stress_impact = {
			callous = miniscule_stress_impact_loss
			sadistic = miniscule_stress_impact_loss
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -1 }
		}
	}

	# Good for them.
	option = {
		name = ep3_laamp_flavour_ewan.2001.c

		ep3_laamp_flavour_ewan_2001_make_friends_or_best_friends_effect = yes

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -1 }
		}
	}
}

#	Pre-filtering event to set up scopes.
ep3_laamp_flavour_ewan.2002 = {
	hidden = yes

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_2001 }
		}
		# Make sure we have suitable courtiers.
		any_courtier = {
			ep3_laamp_flavour_ewan_2001_courtier_1_trigger = yes
			save_temporary_scope_as = char_temp
			root = {
				any_courtier = {
					ep3_laamp_flavour_ewan_2001_courtier_2_trigger = { TARGET = scope:char_temp }
				}
			}
		}
	}

	immediate = {
		while = {
			count = 10
			limit = {
				NOT = { exists = scope:follower_2 }
			}
			# Sort our courtiers.
			## First, get our scope:follower_1 candidate.
			random_courtier = {
				limit = {
					ep3_laamp_flavour_ewan_2001_courtier_1_trigger = yes
					NOT = { is_in_list = checked_courtier_1_candidates_list }
				}
				save_scope_as = follower_1
				add_to_list = checked_courtier_1_candidates_list
			}
			## Now, find a scope:follower_2 from their opinion of the scope:follower_1 candidates.
			if = {
				limit = { exists = scope:follower_1 }
				ordered_courtier = {
					limit = {
						ep3_laamp_flavour_ewan_2001_courtier_2_trigger = { TARGET = scope:follower_1 }
					}
					order_by = "opinion(scope:follower_1)"
					save_scope_as = follower_2
				}
				# And, wipe our checks so we can iterate the loop if required.
				if = {
					limit = {
						NOT = { exists = scope:follower_2 }
					}
					clear_saved_scope = follower_1
				}
			}
		}
		# If we've actually got our dudes, proceed to the event.
		if = {
			limit = {
				exists = scope:follower_1
				exists = scope:follower_2
			}
			trigger_event = ep3_laamp_flavour_ewan.2001
		}
	}
}

##################################################
# Camp Gossip
# by Ewan Cowhig Croft
# # 2011 - 2020
##################################################

scripted_trigger ep3_laamp_flavour_ewan_2011_valid_courtier_for_gossip_trigger = {
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
	# Filter out anyone who matters to us, we want petty people.
	## This is partially for tone, partially so we can be less rigorous with checks'n'effects.
	NOR = {
		is_consort_of = root
		is_close_family_of = root
		has_any_moderate_good_relationship_with_character_trigger = { CHARACTER = root }
		has_any_moderate_bad_relationship_with_character_trigger = { CHARACTER = root }
	}
}

scripted_trigger ep3_laamp_flavour_ewan_2011_secret_lover_would_be_affair_trigger = {
	is_married = yes
	NOT = {
		trait_is_shunned_or_criminal_in_faith_trigger = {
			FAITH = faith
			TRAIT = adulterer
			GENDER_CHARACTER = root
		}
	}
	accepts_adultery_without_penalty_trigger = no
}

scripted_trigger ep3_laamp_flavour_ewan_2011_might_steal_trigger = {
	OR = {
		has_trait = greedy
		has_trait = arbitrary
		has_trait_xp = {
			trait = gallowsbait
			track = thief
			value >= 50
		}
		calc_true_if = {
			amount >= 2
			has_trait = eccentric
			has_trait = cynical
			has_trait = impatient
		}
	}
	NOR = {
		has_trait = generous
		has_trait = just
	}
}

scripted_trigger ep3_laamp_flavour_ewan_2011_might_prank_trigger = {
	OR = {
		has_trait = gregarious
		has_trait = arbitrary
		has_trait = deceitful
		has_trait = eccentric
	}
	NOR = {
		has_trait = honest
		has_trait = just
	}
}

scripted_trigger ep3_laamp_flavour_ewan_2011_might_rumourmonger_trigger = {
	OR = {
		has_trait = gregarious
		has_trait = arbitrary
		has_trait = deceitful
		has_trait = eccentric
	}
	NOR = {
		has_trait = honest
		has_trait = shy
		has_trait = just
	}
}

scripted_trigger ep3_laamp_flavour_ewan_2011_might_feud_trigger = {
	OR = {
		has_trait = wrathful
		has_trait = vengeful
		has_trait = diligent
		calc_true_if = {
			amount >= 2
			has_trait = patient
			has_trait = arrogant
			has_trait = ambitious
		}
	}
	NOR = {
		has_trait = forgiving
		has_trait = lazy
	}
}

# It's only one line, but these are held in different events hundreds of lines of script apart, so good hygiene demands it.
scripted_effect ep3_laamp_flavour_ewan_2011_duel_loss_effect = {
	add_prestige = minor_prestige_loss
}

#	Someone shagged someone else's spouse/petty theft/series of cruel pranks/nasty rumours spread.
ep3_laamp_flavour_ewan.2011 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.2011.t
	desc = {
		desc = ep3_laamp_flavour_ewan.2011.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { scope:gossip_type = flag:affair }
				desc = ep3_laamp_flavour_ewan.2011.desc.affair
			}
			triggered_desc = {
				trigger = { scope:gossip_type = flag:petty_theft }
				desc = ep3_laamp_flavour_ewan.2011.desc.petty_theft
			}
			triggered_desc = {
				trigger = { scope:gossip_type = flag:cruel_pranks }
				desc = ep3_laamp_flavour_ewan.2011.desc.cruel_pranks
			}
			triggered_desc = {
				trigger = { scope:gossip_type = flag:nasty_rumours }
				desc = ep3_laamp_flavour_ewan.2011.desc.nasty_rumours
			}
			triggered_desc = {
				trigger = { scope:gossip_type = flag:hidden_feud }
				desc = ep3_laamp_flavour_ewan.2011.desc.hidden_feud
			}
		}
		desc = ep3_laamp_flavour_ewan.2011.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:victim
		animation = stress
	}
	override_background = { reference = ep3_campfire }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_2011 }
		}
		# Must have enough courtiers for this to be a possibility.
		any_courtier = {
			count >= 5
			ep3_laamp_flavour_ewan_2011_valid_courtier_for_gossip_trigger = yes
			OR = {
				ep3_laamp_flavour_ewan_2011_secret_lover_would_be_affair_trigger = yes
				ep3_laamp_flavour_ewan_2011_might_steal_trigger = yes
				ep3_laamp_flavour_ewan_2011_might_prank_trigger = yes
				ep3_laamp_flavour_ewan_2011_might_rumourmonger_trigger = yes
				ep3_laamp_flavour_ewan_2011_might_feud_trigger = yes
			}
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_2011
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_2011
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Alright, which gossip will we be going with?
		random_list = {
			# Affair.
			100 = {
				# Register our result.
				save_scope_value_as = {
					name = gossip_type
					value = flag:affair
				}
				# Try to find a suitable candidate to make this true.
				## First by sorting everyone for whom it'd be shocking to have an affair into a list.
				every_courtier = {
					limit = {
						ep3_laamp_flavour_ewan_2011_valid_courtier_for_gossip_trigger = yes
						ep3_laamp_flavour_ewan_2011_secret_lover_would_be_affair_trigger = yes
					}
					add_to_list = possible_affair_candidates_list
				}
				## Then nabbing any valid pair.
				random_courtier = {
					limit = {
						ep3_laamp_flavour_ewan_2011_valid_courtier_for_gossip_trigger = yes
						ep3_laamp_flavour_ewan_2011_secret_lover_would_be_affair_trigger = yes
						save_temporary_scope_as = char_temp
						any_in_list = {
							list = possible_affair_candidates_list
							this != scope:char_temp
							has_secret_relation_lover = scope:char_temp
							save_temporary_scope_as = root_secret_check_temp
							root = {
								NOR = {
									any_known_secret = {
										secret_type = secret_lover
										secret_owner = scope:root_secret_check_temp
										secret_target = scope:char_temp
									}
									any_known_secret = {
										secret_type = secret_lover
										secret_owner = scope:char_temp
										secret_target = scope:root_secret_check_temp
									}
								}
							}
							save_temporary_scope_as = lover_temp
						}
					}
					# Grab our scopes.
					save_scope_as = lover_1
					scope:lover_temp = { save_scope_as = lover_2 }
					# And note that the story was true.
					save_scope_value_as = {
						name = gossip_veracity
						value = flag:true
					}
				}
				# If we don't have any lovers yet, see if we've got anyone we could nudge.
				random_courtier = {
					limit = {
						ep3_laamp_flavour_ewan_2011_valid_courtier_for_gossip_trigger = yes
						ep3_laamp_flavour_ewan_2011_secret_lover_would_be_affair_trigger = yes
						might_cheat_on_every_partner_trigger = yes
						save_temporary_scope_as = char_temp
						any_in_list = {
							list = possible_affair_candidates_list
							this != scope:char_temp
							has_relation_potential_lover = scope:char_temp
							opinion = {
								target = scope:char_temp
								value >= 60
							}
							reverse_opinion = {
								target = scope:char_temp
								value >= 60
							}
							might_cheat_on_every_partner_trigger = yes
							can_set_relation_lover_trigger = { CHARACTER = scope:char_temp }
							save_temporary_scope_as = lover_temp
						}
					}
					# Grab our scopes.
					save_scope_as = lover_1
					scope:lover_temp = { save_scope_as = lover_2 }
					# Now, randomise whether the story was true or false.
					random = {
						chance = 50
						# Ok, exacerbate our love story.
						hidden_effect = {
							scope:lover_1 = {
								add_secret = {
									target = scope:lover_2
									type = secret_lover
								}
							}
						}
						# And note that the story was true.
						save_scope_value_as = {
							name = gossip_veracity
							value = flag:true
						}
					}
				}
				# Otherwise, we register it as false.
				if = {
					limit = {
						NOT = { exists = scope:gossip_veracity }
					}
					save_scope_value_as = {
						name = gossip_veracity
						value = flag:false
					}
				}
			}
			# Petty theft.
			100 = {
				# Register our result.
				save_scope_value_as = {
					name = gossip_type
					value = flag:petty_theft
				}
				# Try to find a suitable candidate to make this true.
				## First, grab anyone/everyone who'd steal.
				every_courtier = {
					limit = {
						ep3_laamp_flavour_ewan_2011_valid_courtier_for_gossip_trigger = yes
						ep3_laamp_flavour_ewan_2011_might_steal_trigger = yes
					}
					add_to_list = possible_thieves_list
				}
				## Then try to find anyone they'd steal from.
				random_courtier = {
					limit = {
						ep3_laamp_flavour_ewan_2011_valid_courtier_for_gossip_trigger = yes
						save_temporary_scope_as = char_temp
						any_in_list = {
							list = possible_thieves_list
							this != scope:char_temp
							opinion = {
								target = scope:char_temp
								value <= -50
							}
							save_temporary_scope_as = thief_temp
						}
					}
					# Grab our scopes.
					save_scope_as = victim
					scope:thief_temp = { save_scope_as = thief }
					# And note that the story was true.
					save_scope_value_as = {
						name = gossip_veracity
						value = flag:true
					}
				}
				# Otherwise, we register it as false.
				if = {
					limit = {
						NOT = { exists = scope:gossip_veracity }
					}
					save_scope_value_as = {
						name = gossip_veracity
						value = flag:false
					}
				}
			}
			# Series of cruel pranks.
			100 = {
				trigger = {
					any_courtier = {
						count >= 2
						ep3_laamp_flavour_ewan_2011_valid_courtier_for_gossip_trigger = yes
						ep3_laamp_flavour_ewan_2011_might_prank_trigger = yes
					}
				}
				# Register our result.
				save_scope_value_as = {
					name = gossip_type
					value = flag:cruel_pranks
				}
				# Try to find a suitable candidate to make this true.
				## First, grab anyone/everyone who'd play harsh jokes.
				every_courtier = {
					limit = {
						ep3_laamp_flavour_ewan_2011_valid_courtier_for_gossip_trigger = yes
						ep3_laamp_flavour_ewan_2011_might_prank_trigger = yes
					}
					add_to_list = possible_pranksters_list
				}
				## Then try to find anyone they'd be cruel to.
				random_courtier = {
					limit = {
						ep3_laamp_flavour_ewan_2011_valid_courtier_for_gossip_trigger = yes
						save_temporary_scope_as = char_temp
						any_in_list = {
							list = possible_pranksters_list
							this != scope:char_temp
							opinion = {
								target = scope:char_temp
								value <= -50
							}
							save_temporary_scope_as = prankster_temp
						}
					}
					# Grab our scopes.
					save_scope_as = victim
					scope:prankster_temp = { save_scope_as = prankster }
					# And note that the story was true.
					save_scope_value_as = {
						name = gossip_veracity
						value = flag:true
					}
				}
				# Otherwise, we register it as false.
				if = {
					limit = {
						NOT = { exists = scope:gossip_veracity }
					}
					save_scope_value_as = {
						name = gossip_veracity
						value = flag:false
					}
					# If we don't have a scope:victim by now, create one.
					random_courtier = {
						limit = { ep3_laamp_flavour_ewan_2011_valid_courtier_for_gossip_trigger = yes }
						save_scope_as = victim
					}
				}
				# Plus stress out our victim a little.
				scope:victim = { add_stress = medium_stress_gain }
			}
			# Nasty rumours.
			100 = {
				trigger = {
					any_courtier = {
						count >= 2
						ep3_laamp_flavour_ewan_2011_valid_courtier_for_gossip_trigger = yes
						ep3_laamp_flavour_ewan_2011_might_rumourmonger_trigger = yes
					}
				}
				# Register our result.
				save_scope_value_as = {
					name = gossip_type
					value = flag:nasty_rumours
				}
				# Try to find a suitable candidate to make this true.
				## First, grab anyone/everyone who'd spread evil rumours.
				every_courtier = {
					limit = {
						ep3_laamp_flavour_ewan_2011_valid_courtier_for_gossip_trigger = yes
						ep3_laamp_flavour_ewan_2011_might_rumourmonger_trigger = yes
					}
					add_to_list = possible_rumourmongers_list
				}
				## Then try to find anyone they'd lie about.
				random_courtier = {
					limit = {
						ep3_laamp_flavour_ewan_2011_valid_courtier_for_gossip_trigger = yes
						save_temporary_scope_as = char_temp
						any_in_list = {
							list = possible_rumourmongers_list
							this != scope:char_temp
							opinion = {
								target = scope:char_temp
								value <= -50
							}
							save_temporary_scope_as = rumourmonger_temp
						}
					}
					# Grab our scopes.
					save_scope_as = victim
					scope:rumourmonger_temp = { save_scope_as = rumourmonger }
					# And note that the story was true.
					save_scope_value_as = {
						name = gossip_veracity
						value = flag:true
					}
				}
				# Otherwise, we register it as false.
				if = {
					limit = {
						NOT = { exists = scope:gossip_veracity }
					}
					save_scope_value_as = {
						name = gossip_veracity
						value = flag:false
					}
					# If we don't have a scope:victim by now, create one.
					random_courtier = {
						limit = { ep3_laamp_flavour_ewan_2011_valid_courtier_for_gossip_trigger = yes }
						save_scope_as = victim
					}
				}
				# Plus stress out our victim a little.
				scope:victim = { add_stress = medium_stress_gain }
			}
			# Hidden feud.
			100 = {
				# Register our result.
				save_scope_value_as = {
					name = gossip_type
					value = flag:hidden_feud
				}
				# Try to find a suitable candidate to make this true.
				## First, grab anyone/everyone who'd start shit over nothing.
				every_courtier = {
					limit = {
						ep3_laamp_flavour_ewan_2011_valid_courtier_for_gossip_trigger = yes
						ep3_laamp_flavour_ewan_2011_might_feud_trigger = yes
					}
					add_to_list = possible_feuds_list
				}
				## Then try to find anyone they'd steal from.
				random_courtier = {
					limit = {
						ep3_laamp_flavour_ewan_2011_valid_courtier_for_gossip_trigger = yes
						save_temporary_scope_as = char_temp
						any_in_list = {
							list = possible_feuds_list
							this != scope:char_temp
							has_relation_potential_rival = scope:char_temp
							opinion = {
								target = scope:char_temp
								value <= -25
							}
							save_temporary_scope_as = rival_temp
						}
					}
					# Grab our scopes.
					save_scope_as = rival_1
					scope:rival_temp = { save_scope_as = rival_2 }
					# Now, randomise whether the story was true or false.
					random = {
						chance = 50
						# Ok, exacerbate our rivalry.
						hidden_effect = {
							scope:rival_1 = {
								add_opinion = {
									target = scope:rival_2
									modifier = irritated_opinion
									opinion = -50
								}
								reverse_add_opinion = {
									target = scope:rival_2
									modifier = irritated_opinion
									opinion = -50
								}
							}
						}
						# And note that the story was true.
						save_scope_value_as = {
							name = gossip_veracity
							value = flag:true
						}
					}
				}
				# Otherwise, we register it as false.
				if = {
					limit = {
						NOT = { exists = scope:gossip_veracity }
					}
					save_scope_value_as = {
						name = gossip_veracity
						value = flag:false
					}
				}
			}
		}
		# Error suppression.
		if = {
			limit = { scope:gossip_veracity = flag:false }
		}
	}

	# Investigate the truth of the matter.
	option = {
		name = ep3_laamp_flavour_ewan.2011.a

		custom_tooltip = ep3_laamp_flavour_ewan.2011.a.tt.explanation
		duel = {
			skill = intrigue
			value = high_skill_rating
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.2011.a.tt.success
					# Alright, what event do we want to see?
				## Affair actually happening.
				if = {
					limit = {
						scope:gossip_type = flag:affair
						scope:gossip_veracity = flag:true
					}
					trigger_event = ep3_laamp_flavour_ewan.2012
				}
				## Petty theft actually happened.
				else_if = {
					limit = {
						scope:gossip_type = flag:petty_theft
						scope:gossip_veracity = flag:true
					}
					trigger_event = ep3_laamp_flavour_ewan.2013
				}
				## Cruel pranks actually happening.
				else_if = {
					limit = {
						scope:gossip_type = flag:cruel_pranks
						scope:gossip_veracity = flag:true
					}
					trigger_event = ep3_laamp_flavour_ewan.2014
				}
				## Nasty rumours actually happening.
				else_if = {
					limit = {
						scope:gossip_type = flag:nasty_rumours
						scope:gossip_veracity = flag:true
					}
					trigger_event = ep3_laamp_flavour_ewan.2015
				}
				## Hidden feud actually on-going.
				else_if = {
					limit = {
						scope:gossip_type = flag:hidden_feud
						scope:gossip_veracity = flag:true
					}
					trigger_event = ep3_laamp_flavour_ewan.2016
				}
				## Otherwise, nothing was really happening.
				else = {
					# Which means we won the duel but there was nothing to see.
					save_scope_value_as = {
						name = duel_result
						value = flag:won
					}
					trigger_event = ep3_laamp_flavour_ewan.2017
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.2011.a.tt.failure
				# Flag that we failed the skill check & proceed to part 2.
				save_scope_value_as = {
					name = duel_result
					value = flag:lost
				}
				trigger_event = ep3_laamp_flavour_ewan.2017
				show_as_tooltip = { ep3_laamp_flavour_ewan_2011_duel_loss_effect = yes }
			}
		}

		stress_impact = {
			diligent = miniscule_stress_impact_loss
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = 2 }
		}
	}

	# Agree with the accusations baselessly.
	option = {
		name = ep3_laamp_flavour_ewan.2011.b

		# Give us a minor modifier.
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_2011_source_of_truth_modifier
			years = 3
		}
		# At the cost of annoying scope:victim, if they exist.
		scope:victim ?= {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -30
			}
		}

		stress_impact = {
			deceitful = miniscule_stress_impact_loss
			gregarious = miniscule_stress_impact_loss
			shy = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_sociability = 1
				ai_honor = -1
			}
		}
	}

	# Leave well enough alone.
	option = {
		name = ep3_laamp_flavour_ewan.2011.c

		# Consolation prestige for staying aloof.
		add_prestige = minor_prestige_gain

		stress_impact = {
			shy = minor_stress_impact_loss
			honest = miniscule_stress_impact_loss
			deceitful = minor_stress_impact_gain
			gregarious = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 1 }
		}
	}
}

#	Discovered affair.
ep3_laamp_flavour_ewan.2012 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.2012.t
	desc = ep3_laamp_flavour_ewan.2012.desc
	theme = laamp
	left_portrait = {
		character = scope:lover_1
		animation = shock
	}
	right_portrait = {
		character = scope:lover_2
		animation = worry
	}
	override_background = { reference = ep3_campfire }

	immediate = {
		# Nab our secret lover relationship.
		scope:lover_1 = {
			random_secret = {
				type = secret_lover
				limit = {
					OR = {
						AND = {
							secret_owner = scope:lover_1
							secret_target = scope:lover_2
						}
						AND = {
							secret_owner = scope:lover_2
							secret_target = scope:lover_1
						}
					}
				}
				save_scope_as = secret
			}
		}
		# And reveal it to root.
		scope:secret = { reveal_to = root }
	}

	# Reveal it immediately for bonuses.
	option = {
		name = ep3_laamp_flavour_ewan.2012.a

		scope:secret = { expose_secret = root }
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_2011_truth_hound_modifier
			years = 10
		}
		reverse_add_opinion = {
			target = scope:lover_1
			modifier = cruelty_opinion
			opinion = -40
		}
		reverse_add_opinion = {
			target = scope:lover_2
			modifier = cruelty_opinion
			opinion = -40
		}

		stress_impact = {
			honest = minor_stress_impact_loss
			deceitful = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = 1 }
		}
	}

	# Keep it — for now.
	option = {
		name = ep3_laamp_flavour_ewan.2012.b

		reverse_add_opinion = {
			target = scope:lover_1
			modifier = grateful_opinion
			opinion = 50
		}
		reverse_add_opinion = {
			target = scope:lover_2
			modifier = grateful_opinion
			opinion = 50
		}

		stress_impact = {
			deceitful = minor_stress_impact_loss
			honest = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
		}
	}
}

#	Discovered theft.
ep3_laamp_flavour_ewan.2013 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.2013.t
	desc = ep3_laamp_flavour_ewan.2013.desc
	theme = laamp
	left_portrait = {
		character = scope:victim
		animation = anger
	}
	right_portrait = {
		character = scope:thief
		animation = disbelief
	}
	override_background = { reference = ep3_campfire }

	immediate = {
		scope:victim = {
			pay_short_term_gold = {
				target = scope:thief
				gold = minor_gold_laamps_value
			}
		}
	}

	# Punish scope:thief.
	option = {
		name = ep3_laamp_flavour_ewan.2013.a

		# Scope:victim is happy.
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_2011_truth_hound_modifier
			years = 10
		}
		scope:victim = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 40
			}
			progress_towards_rival_effect = {
				REASON = rival_stole_petty_sum
				CHARACTER = scope:thief
				OPINION = default_rival_opinion
			}
		}
		# Apply consequences.
		scope:thief = {
			add_opinion = {
				target = root
				modifier = cruelty_opinion
				opinion = -30
			}
			# Plus some stress.
			add_stress = major_stress_gain
			# Apply some gallowsbait XP for scope:thief.
			laamp_rewards_apply_criminal_xp_effect = {
				TRACK = thief
				XP_MAX = gallowsbait_xp_minor_gain
				XP_MIN = gallowsbait_xp_minor_gain
			}
		}

		stress_impact = {
			honest = miniscule_stress_impact_loss
			just = miniscule_stress_impact_loss
			arbitrary = minor_stress_impact_gain
			deceitful = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = 1 }
		}
	}

	# Cover for scope:thief.
	option = {
		name = ep3_laamp_flavour_ewan.2013.b

		# Scope:thief is happy.
		add_favour_hook_if_possible_simple_effect = { TARGET = scope:thief }
		reverse_add_opinion = {
			target = scope:thief
			modifier = grateful_opinion
			opinion = 40
		}
		# Apply consequences.
		scope:victim = {
			add_opinion = {
				target = root
				modifier = failure_opinion
				opinion = -20
			}
			# Plus some stress.
			add_stress = major_stress_gain
		}

		stress_impact = {
			deceitful = miniscule_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
			just = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = -11 }
		}
	}

	# Let it be known, but leave it at that.
	option = {
		name = ep3_laamp_flavour_ewan.2013.c

		# Neither party is too happy.
		scope:victim = {
			add_opinion = {
				target = root
				modifier = upset_opinion
				opinion = -10
			}
			progress_towards_rival_effect = {
				REASON = rival_stole_petty_sum
				CHARACTER = scope:thief
				OPINION = default_rival_opinion
			}
		}
		scope:thief = {
			add_opinion = {
				target = root
				modifier = upset_opinion
				opinion = -10
			}
			# Apply some gallowsbait XP for scope:thief.
			laamp_rewards_apply_criminal_xp_effect = {
				TRACK = thief
				XP_MAX = gallowsbait_xp_minor_gain
				XP_MIN = gallowsbait_xp_minor_gain
			}
		}
		# But you do seem quite impartial.
		add_prestige = medium_prestige_gain
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_2011_truth_hound_modifier
			years = 10
		}

		# No stress for opt out.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -2 }
		}
	}
}

#	Discovered cruel pranks.
ep3_laamp_flavour_ewan.2014 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.2014.t
	desc = ep3_laamp_flavour_ewan.2014.desc
	theme = laamp
	left_portrait = {
		character = scope:victim
		animation = anger
	}
	right_portrait = {
		character = scope:prankster
		animation = disbelief
	}
	override_background = { reference = ep3_campfire }

	# Punish scope:prankster.
	option = {
		name = ep3_laamp_flavour_ewan.2014.a

		# Scope:victim is happy.
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_2011_truth_hound_modifier
			years = 10
		}
		scope:victim = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 30
			}
			progress_towards_rival_effect = {
				REASON = rival_played_cruel_pranks
				CHARACTER = scope:prankster
				OPINION = default_rival_opinion
			}
		}
		# Apply consequences.
		scope:prankster = {
			add_opinion = {
				target = root
				modifier = cruelty_opinion
				opinion = -20
			}
			# Plus some stress.
			add_stress = medium_stress_gain
		}

		stress_impact = {
			honest = miniscule_stress_impact_loss
			just = miniscule_stress_impact_loss
			arbitrary = minor_stress_impact_gain
			deceitful = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = 1 }
		}
	}

	# Cover for scope:prankster.
	option = {
		name = ep3_laamp_flavour_ewan.2014.b

		# Scope:prankster is happy.
		add_favour_hook_if_possible_simple_effect = { TARGET = scope:prankster }
		reverse_add_opinion = {
			target = scope:prankster
			modifier = grateful_opinion
			opinion = 30
		}
		# Apply consequences.
		scope:victim = {
			add_opinion = {
				target = root
				modifier = failure_opinion
				opinion = -20
			}
			# Plus some stress.
			add_stress = medium_stress_gain
		}

		stress_impact = {
			deceitful = miniscule_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
			just = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = -11 }
		}
	}

	# Let it be known, but leave it at that.
	option = {
		name = ep3_laamp_flavour_ewan.2014.c

		# Neither party is too happy.
		scope:victim = {
			add_opinion = {
				target = root
				modifier = upset_opinion
				opinion = -10
			}
			progress_towards_rival_effect = {
				REASON = rival_played_cruel_pranks
				CHARACTER = scope:prankster
				OPINION = default_rival_opinion
			}
		}
		reverse_add_opinion = {
			target = scope:prankster
			modifier = upset_opinion
			opinion = -10
		}
		# But you do seem quite impartial.
		add_prestige = minor_prestige_gain
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_2011_truth_hound_modifier
			years = 10
		}

		# No stress for opt out.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -2 }
		}
	}
}

#	Discovered source of rumours.
ep3_laamp_flavour_ewan.2015 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.2015.t
	desc = ep3_laamp_flavour_ewan.2015.desc
	theme = laamp
	left_portrait = {
		character = scope:victim
		animation = anger
	}
	right_portrait = {
		character = scope:rumourmonger
		animation = disbelief
	}
	override_background = { reference = ep3_campfire }

	# Punish scope:rumourmonger.
	option = {
		name = ep3_laamp_flavour_ewan.2015.a

		# Scope:victim is happy.
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_2011_truth_hound_modifier
			years = 10
		}
		scope:victim = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 30
			}
			progress_towards_rival_effect = {
				REASON = rival_spread_rumours
				CHARACTER = scope:rumourmonger
				OPINION = default_rival_opinion
			}
		}
		# Apply consequences.
		scope:rumourmonger = {
			add_opinion = {
				target = root
				modifier = cruelty_opinion
				opinion = -20
			}
			# Plus some stress.
			add_stress = medium_stress_gain
		}

		stress_impact = {
			honest = miniscule_stress_impact_loss
			just = miniscule_stress_impact_loss
			arbitrary = minor_stress_impact_gain
			deceitful = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = 1 }
		}
	}

	# Cover for scope:rumourmonger.
	option = {
		name = ep3_laamp_flavour_ewan.2015.b

		# Scope:rumourmonger is happy.
		add_favour_hook_if_possible_simple_effect = { TARGET = scope:rumourmonger }
		reverse_add_opinion = {
			target = scope:rumourmonger
			modifier = grateful_opinion
			opinion = 30
		}
		# Apply consequences.
		scope:victim = {
			add_opinion = {
				target = root
				modifier = failure_opinion
				opinion = -20
			}
			# Plus some stress.
			add_stress = medium_stress_gain
		}

		stress_impact = {
			deceitful = miniscule_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
			just = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = -11 }
		}
	}

	# Let it be known, but leave it at that.
	option = {
		name = ep3_laamp_flavour_ewan.2015.c

		# Neither party is too happy.
		scope:victim = {
			add_opinion = {
				target = root
				modifier = upset_opinion
				opinion = -10
			}
			progress_towards_rival_effect = {
				REASON = rival_spread_rumours
				CHARACTER = scope:rumourmonger
				OPINION = default_rival_opinion
			}
		}
		reverse_add_opinion = {
			target = scope:rumourmonger
			modifier = upset_opinion
			opinion = -10
		}
		# But you do seem quite impartial.
		add_prestige = minor_prestige_gain
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_2011_truth_hound_modifier
			years = 10
		}

		# No stress for opt out.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -2 }
		}
	}
}

#	Discovered hidden feud.
ep3_laamp_flavour_ewan.2016 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.2016.t
	desc = ep3_laamp_flavour_ewan.2016.desc
	theme = laamp
	left_portrait = {
		character = scope:rival_1
		animation = anger
	}
	right_portrait = {
		character = scope:rival_2
		animation = dismissal
	}
	override_background = { reference = ep3_campfire }

	immediate = {
		scope:rival_1 = {
			set_random_rivalry_reason = {
				TARGET = scope:rival_2
				RELATION = rival
			}
		}
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_2011_truth_hound_modifier
			years = 10
		}
		add_prestige = minor_prestige_gain
	}

	# Try to reconcile them.
	option = {
		name = ep3_laamp_flavour_ewan.2016.a

		# Nab whichever rival has the higher diplomacy to be the duel target.
		if = {
			limit = { scope:rival_1.diplomacy >= scope:rival_2.diplomacy }
			scope:rival_1 = { save_scope_as = duel_target }
		}
		else = {
			scope:rival_2 = { save_scope_as = duel_target }
		}
		# Then roll the duel.
		duel = {
			skill = diplomacy
			target = scope:duel_target
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.2016.a.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.2016.a.tt.success
					left_icon = scope:rival_1
					right_icon = scope:rival_2
					scope:rival_1 = { remove_relation_rival = scope:rival_2 }
					add_favour_hook_if_possible_simple_effect = { TARGET = scope:rival_1 }
					add_favour_hook_if_possible_simple_effect = { TARGET = scope:rival_2 }
				}
				reverse_add_opinion = {
					target = scope:rival_1
					modifier = respect_opinion
					opinion = 30
				}
				reverse_add_opinion = {
					target = scope:rival_2
					modifier = respect_opinion
					opinion = 30
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.2016.a.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.2016.a.tt.failure
					left_icon = scope:rival_1
					right_icon = scope:rival_2
					reverse_add_opinion = {
						target = scope:rival_1
						modifier = respect_opinion
						opinion = -30
					}
					reverse_add_opinion = {
						target = scope:rival_2
						modifier = respect_opinion
						opinion = -30
					}
				}
			}
		}

		stress_impact = {
			gregarious = miniscule_stress_impact_loss
			compassionate = miniscule_stress_impact_loss
			shy = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 2 }
		}
	}

	# Instruct them that they will not allow their rivalry to hurt the camp.
	option = {
		name = ep3_laamp_flavour_ewan.2016.b

		reverse_add_opinion = {
			target = scope:rival_1
			modifier = respect_opinion
			opinion = 20
		}
		reverse_add_opinion = {
			target = scope:rival_2
			modifier = respect_opinion
			opinion = 20
		}

		# No stress for opt out.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 1 }
		}
	}
}

#	No discovery.
ep3_laamp_flavour_ewan.2017 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.2017.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:gossip_type = flag:affair }
				desc = ep3_laamp_flavour_ewan.2017.desc.affair
			}
			triggered_desc = {
				trigger = { scope:gossip_type = flag:petty_theft }
				desc = ep3_laamp_flavour_ewan.2017.desc.petty_theft
			}
			triggered_desc = {
				trigger = { scope:gossip_type = flag:cruel_pranks }
				desc = ep3_laamp_flavour_ewan.2017.desc.cruel_pranks
			}
			triggered_desc = {
				trigger = { scope:gossip_type = flag:nasty_rumours }
				desc = ep3_laamp_flavour_ewan.2017.desc.nasty_rumours
			}
			triggered_desc = {
				trigger = { scope:gossip_type = flag:hidden_feud }
				desc = ep3_laamp_flavour_ewan.2017.desc.hidden_feud
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = { scope:duel_result = flag:won }
				desc = ep3_laamp_flavour_ewan.2017.desc.duel.won
			}
			desc = ep3_laamp_flavour_ewan.2017.desc.duel.lost
		}
	}
	theme = laamp
	left_portrait = {
		character = root
		triggered_animation = {
			animation = boredom
			trigger = { scope:duel_result = flag:won }
		}
		triggered_animation = {
			animation = shame
			trigger = { scope:duel_result = flag:lost }
		}
	}
	right_portrait = {
		character = scope:victim
		animation = paranoia
	}
	override_background = { reference = ep3_campfire }

	immediate = {
		# If we have a victim, they're none too happy.
		scope:victim ?= { add_stress = major_stress_gain }
	}

	# Duel won.
	option = {
		name = ep3_laamp_flavour_ewan.2017.a
		trigger = { scope:duel_result = flag:won }

		add_prestige = minor_prestige_gain

		stress_impact = { diligent = minor_stress_impact_loss }
		ai_chance = {
			# No logic needed for notification event.
			base = 1
		}
	}

	# Duel lost.
	option = {
		name = ep3_laamp_flavour_ewan.2017.b
		trigger = { scope:duel_result = flag:lost }

		ep3_laamp_flavour_ewan_2011_duel_loss_effect = yes

		stress_impact = {
			trusting = miniscule_stress_impact_loss
			paranoid = miniscule_stress_impact_gain
		}
		ai_chance = {
			# No logic needed for notification event.
			base = 1
		}
	}
}

##################################################
# Bound Together
# by Ewan Cowhig Croft
# # 2021 - 2030
##################################################

scripted_trigger ep3_laamp_flavour_ewan_2021_valid_courtier_for_own_marriage_general_trigger = {
	NOT = { has_character_flag = marriage_request_turned_down }
	NOT = { has_trait = celibate }
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
	# Make sure they either don't have complex relationships already, or else don't care about them.
	any_consort = { count <= 0 }
	might_cheat_on_every_partner_trigger = yes
	# Filter out anyone who matters to us (excepting friends, who it's nice to approve, and rivals, who it's nice to turn down), we want mostly petty people.
	NOR = {
		is_close_family_of = root
		has_relation_lover = root
	}
}

scripted_trigger ep3_laamp_flavour_ewan_2021_valid_courtier_for_own_marriage_precise_trigger = {
	ep3_laamp_flavour_ewan_2021_valid_courtier_for_own_marriage_general_trigger = yes
	NOT = { this = $TARGET$ }
	# Must have matching sexualities & the right legalities in place.
	is_attracted_to_gender_of = $TARGET$
	$TARGET$ = { is_attracted_to_gender_of = prev }
	allowed_to_marry_character_gender_trigger = { CHARACTER = $TARGET$ }
	# Avoid pairing up people that are already somehow related to each other
	NOT = { is_close_or_extended_family_of = $TARGET$ }
	# Ensure our ages aren't too far apart — not that this couldn't happen, but huge age gaps are a big verisimilitude problem for many players.
	age >= {
		value = $TARGET$.age
		add = -15
	}
	age <= {
		value = $TARGET$.age
		add = 15
	}
	# Try to see how well they get along.
	OR = {
		AND = {
			# Something in common.
			number_of_personality_traits_in_common = {
				target = $TARGET$
				value >= 1
			}
			# Mutual positive opinions.
			opinion = {
				target = $TARGET$
				value >= 1
			}
			reverse_opinion = {
				target = $TARGET$
				value >= 1
			}
		}
		AND = {
			# Lots in common.
			number_of_personality_traits_in_common = {
				target = $TARGET$
				value >= 2
			}
			# They don't hate each other completely.
			opinion = {
				target = $TARGET$
				value >= -30
			}
			reverse_opinion = {
				target = $TARGET$
				value >= -30
			}
		}
		# Everything in common.
		number_of_personality_traits_in_common = {
			target = $TARGET$
			value >= 3
		}
	}
	# Make sure we're not already lovers.
	NOT = { has_relation_lover = $TARGET$ }
	# Filter out any rivals that somehow made it this far.
	NOT = {
		has_any_moderate_bad_relationship_with_character_trigger = { CHARACTER = $TARGET$ }
	}
}

#	Marriage/concubinage at camp.
ep3_laamp_flavour_ewan.2021 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.2021.t
	desc = ep3_laamp_flavour_ewan.2021.desc
	theme = laamp
	left_portrait = {
		character = scope:follower_1
		animation = flirtation_left
	}
	right_portrait = {
		character = scope:follower_2
		animation = admiration
	}
	override_background = { reference = ep3_campfire }

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_2021
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_2021
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_short
			}
		}
		# Make sure they like each other.
		scope:follower_1 = {
			add_opinion = {
				target = scope:follower_2
				modifier = love_opinion
				opinion = 100
			}
			reverse_add_opinion = {
				target = scope:follower_2
				modifier = love_opinion
				opinion = 100
			}
		}
		# Plus, check if we should be matrilineal or patrilineal.
		random_list = {
			100 = {
				trigger = {
					scope:follower_1 = {
						faith = {
							OR = {
								has_doctrine = doctrine_gender_female_dominated
								has_doctrine = doctrine_gender_equal
							}
						}
						is_female = yes
					}
				}
				save_scope_value_as = {
					name = dominant_partner
					value = flag:matrilineal
				}
			}
			100 = {
				trigger = {
					scope:follower_1 = {
						faith = {
							OR = {
								has_doctrine = doctrine_gender_male_dominated
								has_doctrine = doctrine_gender_equal
							}
						}
						is_male = yes
					}
				}
				save_scope_value_as = {
					name = dominant_partner
					value = flag:patrilineal
				}
			}
			100 = {
				trigger = {
					scope:follower_2 = {
						faith = {
							OR = {
								has_doctrine = doctrine_gender_female_dominated
								has_doctrine = doctrine_gender_equal
							}
						}
						is_female = yes
					}
				}
				save_scope_value_as = {
					name = dominant_partner
					value = flag:matrilineal
				}
			}
			100 = {
				trigger = {
					scope:follower_2 = {
						faith = {
							OR = {
								has_doctrine = doctrine_gender_male_dominated
								has_doctrine = doctrine_gender_equal
							}
						}
						is_male = yes
					}
				}
				save_scope_value_as = {
					name = dominant_partner
					value = flag:patrilineal
				}
			}
		}
	}

	# Permit the union.
	option = {
		name = ep3_laamp_flavour_ewan.2021.a

		if = {
			limit = {
				scope:dominant_partner = flag:matrilineal
				scope:follower_1 = { is_female = yes }
			}
			scope:follower_1 = { marry_matrilineal = scope:follower_2 }
		}
		else = {
			scope:follower_2 = { marry = scope:follower_1 }
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
		}
	}

	# Allow, but require only concubinage.
	option = {
		name = ep3_laamp_flavour_ewan.2021.b
		trigger = {
			OR = {
				AND = {
					scope:dominant_partner = flag:matrilineal
					OR = {
						scope:follower_1 = {
							is_female = yes
							faith = { has_doctrine = doctrine_concubines }
						}
						scope:follower_2 = {
							is_female = yes
							faith = { has_doctrine = doctrine_concubines }
						}
					}
				}
				AND = {
					scope:dominant_partner = flag:patrilineal
					OR = {
						scope:follower_1 = {
							is_male = yes
							faith = { has_doctrine = doctrine_concubines }
						}
						scope:follower_2 = {
							is_male = yes
							faith = { has_doctrine = doctrine_concubines }
						}
					}
				}
			}
		}

		# Apply the concubinage.
		if = {
			limit = {
				scope:dominant_partner = flag:matrilineal
				scope:follower_1 = { is_female = yes }
			}
			scope:follower_1 = { make_concubine = scope:follower_2 }
		}
		else = {
			scope:follower_2 = { make_concubine = scope:follower_1 }
		}
		# If your faith doesn't allow concubinage, pay piety for this.
		if = {
			limit = {
				NOT = {
					faith = { has_doctrine = doctrine_concubines }
				}
			}
			add_piety = major_piety_loss
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_vengefulness = 0.25 }
		}
	}

	# Forbid them.
	option = {
		name = ep3_laamp_flavour_ewan.2021.c

		custom_tooltip = ep3_laamp_flavour_ewan.2021.c.tt
		reverse_add_opinion = {
			target = scope:follower_1
			modifier = angry_opinion
			opinion = -50
		}
		reverse_add_opinion = {
			target = scope:follower_2
			modifier = angry_opinion
			opinion = -50
		}
		# Decent chance this won't stop 'em.
		hidden_effect = {
			random = {
				chance = 25
				scope:follower_1 = {
					add_secret = {
						target = scope:follower_2
						type = secret_lover
					}
				}
			}
		}
		# Stop either of them from asking again for a _while_.
		scope:follower_1 = {
			add_character_flag = {
				flag = marriage_request_turned_down
				years = 30
			}
		}
		scope:follower_2 = {
			add_character_flag = {
				flag = marriage_request_turned_down
				years = 30
			}
		}

		stress_impact = {
			sadistic = minor_stress_impact_loss
			callous = miniscule_stress_impact_loss
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -1 }
		}
	}
}

#	Pre-filtering event to set up scopes.
ep3_laamp_flavour_ewan.2022 = {
	hidden = yes

	trigger = {
		trigger_if = {
			limit = {
				is_ai = yes
			}
			static_group_filter = {
				group = ep3_laamp_flavour_ewan.2022
				match = 0.2
			}
		}
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_2021 }
		}
		# Must have suitable courtiers around and about.
		any_courtier = {
			ep3_laamp_flavour_ewan_2021_valid_courtier_for_own_marriage_general_trigger = yes
			save_temporary_scope_as = char_temp
			root = {
				any_courtier = {
					ep3_laamp_flavour_ewan_2021_valid_courtier_for_own_marriage_precise_trigger = { TARGET = scope:char_temp }
				}
			}
		}
	}

	immediate = {
		while = {
			count = 10
			limit = {
				NOT = { exists = scope:follower_2 }
			}
			# Alright, let's select our lovebirds.
			## First, pick a scope:follower_1 candidate.
			random_courtier = {
				limit = {
					ep3_laamp_flavour_ewan_2021_valid_courtier_for_own_marriage_general_trigger = yes
					NOT = { is_in_list = checked_courtier_1_candidates_list }
				}
				save_scope_as = follower_1
				add_to_list = checked_courtier_1_candidates_list
			}
			## Now, nab a suitable pair.
			if = {
				limit = { exists = scope:follower_1 }
				random_courtier = {
					limit = {
						ep3_laamp_flavour_ewan_2021_valid_courtier_for_own_marriage_precise_trigger = { TARGET = scope:follower_1 }
					}
					weight = {
						opinion_modifier = {
							opinion_target = scope:follower_1
							multiplier = 0.5
						}
						opinion_modifier = {
							who = scope:follower_1
							opinion_target = this
							multiplier = 0.5
						}
					}
					save_scope_as = follower_2
				}
				# And, wipe our checks so we can iterate the loop if required.
				if = {
					limit = {
						NOT = { exists = scope:follower_2 }
					}
					clear_saved_scope = follower_1
				}
			}
		}
		# If we've actually got our dudes, proceed to the event.
		if = {
			limit = {
				exists = scope:follower_1
				exists = scope:follower_2
			}
			trigger_event = ep3_laamp_flavour_ewan.2021
		}
	}
}

##################################################
# Through with You
# by Ewan Cowhig Croft
# # 2031 - 2040
##################################################

scripted_trigger ep3_laamp_flavour_ewan_2031_valid_hating_courtier_trigger = {
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
	# Make sure they hate us.
	opinion = {
		target = root
		value <= -95
	}
	# And wouldn't suck in the resultant duel.
	diplomacy >= high_skill_rating
	# Plus stop the stooge from leaving.
	NOT = { has_court_position = stooge_camp_officer }
	# Filter out characters who've tried this and failed.
	NOT = { has_character_flag = failed_to_quit_camp }
}

#	Someone who hates you up and leaves.
ep3_laamp_flavour_ewan.2031 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.2031.t
	desc = {
		desc = ep3_laamp_flavour_ewan.2031.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { scope:waverers_check = flag:some }
				desc = ep3_laamp_flavour_ewan.2031.desc.waverers.some
			}
			desc = ep3_laamp_flavour_ewan.2031.desc.waverers.none
		}
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:firebrand
		animation = rage
	}
	override_background = { reference = ep3_campfire }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_2031 }
		}
		# Make sure we have at least one firebrand troublemaker.
		any_courtier = { ep3_laamp_flavour_ewan_2031_valid_hating_courtier_trigger = yes }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_2031
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_2031
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_longer
			}
		}
		# Grab a suitable firebrand.
		ordered_courtier = {
			limit = { ep3_laamp_flavour_ewan_2031_valid_hating_courtier_trigger = yes }
			order_by = diplomacy
			save_scope_as = firebrand
		}
		# See if we have anyone else who'd leave with them.
		every_courtier = {
			limit = {
				ep3_laamp_flavour_ewan_available_courtier_trigger = yes
				opinion = {
					target = root
					value <= -60
				}
				# Not the stooge.
				NOT = { has_court_position = stooge_camp_officer }
				# Nor scope:firebrand themselves.
				this != scope:firebrand
			}
			add_to_list = wavering_courtiers_list
			save_scope_value_as = {
				name = waverers_check
				value = flag:some
			}
		}
		# If we've got not waverers, flag that for loc.
		if = {
			limit = { "list_size(wavering_courtiers_list)" <= 0 }
			save_scope_value_as = {
				name = waverers_check
				value = flag:none
			}
		}
	}

	# Perhaps I can persuade you...
	option = {
		name = ep3_laamp_flavour_ewan.2031.a

		duel = {
			skill = diplomacy
			target = scope:firebrand
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.2031.a.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.2031.a.tt.success
					left_icon = scope:firebrand
					scope:firebrand = {
						add_stress = major_stress_gain
						hidden_effect = {
							add_opinion = {
								target = root
								modifier = respect_opinion
								opinion = 30
							}
						}
					}
					every_in_list = {
						list = wavering_courtiers_list
						custom = ep3_laamp_flavour_ewan.2031.tt.success.wavering_courtiers
						add_opinion = {
							target = root
							modifier = respect_opinion
							opinion = 30
						}
					}
				}
				scope:firebrand = { add_character_flag = failed_to_quit_camp }
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.2031.a.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.2031.a.tt.failure
					left_icon = scope:firebrand
					add_prestige = medium_prestige_loss
					scope:firebrand = { select_and_move_to_pool_effect = yes }
					every_in_list = {
						list = wavering_courtiers_list
						custom = ep3_laamp_flavour_ewan.2031.tt.failure.wavering_courtiers_move_to_pool
						select_and_move_to_pool_effect = yes
					}
				}
			}
		}

		stress_impact = {
			calm = minor_stress_impact_loss
			forgiving = minor_stress_impact_loss
			vengeful = medium_stress_impact_gain
			wrathful = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
		}
	}

	# You're going nowhere, clap HerHim in irons!
	option = {
		name = ep3_laamp_flavour_ewan.2031.b

		# If you don't have a good reason, then yeah, this'll make you look like a douche.
		imprison_character_effect = {
			TARGET = scope:firebrand
			IMPRISONER = root
		}
		scope:firebrand = { add_character_flag = failed_to_quit_camp }

		stress_impact = {
			wrathful = miniscule_stress_impact_loss
			vengeful = miniscule_stress_impact_loss
			forgiving = minor_stress_impact_gain
			calm = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -2 }
		}
	}

	# Leave if you wish, but you'll take no one and nothing.
	option = {
		name = ep3_laamp_flavour_ewan.2031.c
		trigger = { scope:waverers_check = flag:some }

		duel = {
			skill = prowess
			target = scope:firebrand
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.2031.c.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.2031.c.tt.success
					left_icon = scope:firebrand
					scope:firebrand = { select_and_move_to_pool_effect = yes }
					every_in_list = {
						list = wavering_courtiers_list
						custom = ep3_laamp_flavour_ewan.2031.tt.success.wavering_courtiers
						add_opinion = {
							target = root
							modifier = respect_opinion
							opinion = 30
						}
					}
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.2031.c.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.2031.c.tt.failure
					left_icon = scope:firebrand
					add_prestige = medium_prestige_loss
					scope:firebrand = { select_and_move_to_pool_effect = yes }
					every_in_list = {
						list = wavering_courtiers_list
						custom = ep3_laamp_flavour_ewan.2031.tt.failure.wavering_courtiers_move_to_pool
						select_and_move_to_pool_effect = yes
					}
				}
			}
		}

		stress_impact = {
			calm = miniscule_stress_impact_loss
			forgiving = miniscule_stress_impact_loss
			vengeful = miniscule_stress_impact_gain
			wrathful = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 1 }
		}
	}

	# Go then, all of you.
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { scope:waverers_check = flag:some }
						desc = ep3_laamp_flavour_ewan.2031.d.multi
					}
					desc = ep3_laamp_flavour_ewan.2031.d.solo
				}
			}
		}

		# Consolation prestige.
		if = {
			limit = { scope:waverers_check = flag:some }
			add_prestige = medium_prestige_gain
		}
		else = { add_prestige = minor_prestige_gain }
		# And we lose _everyone_.
		scope:firebrand = { select_and_move_to_pool_effect = yes }
		every_in_list = {
			list = wavering_courtiers_list
			select_and_move_to_pool_effect = yes
		}

		stress_impact = {
			shy = medium_stress_impact_loss
			calm = medium_stress_impact_loss
			forgiving = medium_stress_impact_loss
			compassionate = medium_stress_impact_loss
			gregarious = minor_stress_impact_gain
			sadistic = medium_stress_impact_gain
			vengeful = major_stress_impact_gain
			wrathful = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -2 }
		}
	}
}

##################################################
# Closer Quarters
# by Ewan Cowhig Croft
# # 2041 - 2050
##################################################

scripted_trigger ep3_laamp_flavour_ewan_2041_valid_courtier_to_gain_lover_general_trigger = {
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
	NOT = { has_trait = celibate }
	# Make sure they either don't have complex relationships already, or else don't care about them.
	might_cheat_on_every_partner_trigger = yes
	# One lover at a time (for most), just to keep the complexity down.
	OR = {
		num_of_relation_lover <= 0
		has_trait = lustful
		has_trait = seducer
		has_trait = rakish
	}
	# Filter out anyone we're in a relationship with, so that there's no weird complexities to account for there.
	NOR = {
		is_consort_of = root
		has_relation_lover = root
	}
	# If it'd be criminal for us to cheat/fornicate, then at least make sure we'd chance it.
	trigger_if = {
		limit = {
			OR = {
				trait_is_criminal_in_faith_trigger = {
					FAITH = faith
					TRAIT = adulterer
					GENDER_CHARACTER = this
				}
				AND = {
					is_male = yes
					faith = { has_doctrine_parameter = homosexuality_illegal }
				}
			}
		}
		NOR = {
			has_trait = zealous
			has_trait = craven
			has_trait = just
		}
	}
}

scripted_trigger ep3_laamp_flavour_ewan_2041_valid_courtier_to_gain_lover_precise_trigger = {
	ep3_laamp_flavour_ewan_2041_valid_courtier_to_gain_lover_general_trigger = yes
	NOT = { this = $TARGET$ }
	# Must have matching sexualities & the right legalities in place.
	is_attracted_to_gender_of = $TARGET$
	$TARGET$ = { is_attracted_to_gender_of = prev }
	# Ensure our ages aren't too far apart — not that this couldn't happen, but huge age gaps are a big verisimilitude problem for many players.
	age >= {
		value = $TARGET$.age
		add = -8
	}
	age <= {
		value = $TARGET$.age
		add = 8
	}
	# Try to see how well they get along.
	OR = {
		AND = {
			# Something in common.
			number_of_personality_traits_in_common = {
				target = $TARGET$
				value >= 1
			}
			# Mutual positive opinions.
			opinion = {
				target = $TARGET$
				value >= 1
			}
			reverse_opinion = {
				target = $TARGET$
				value >= 1
			}
		}
		AND = {
			# Lots in common.
			number_of_personality_traits_in_common = {
				target = $TARGET$
				value >= 2
			}
			# They don't hate each other completely.
			opinion = {
				target = $TARGET$
				value >= -30
			}
			reverse_opinion = {
				target = $TARGET$
				value >= -30
			}
		}
		# Everything in common.
		number_of_personality_traits_in_common = {
			target = $TARGET$
			value >= 3
		}
		# Allow the terminally horny to hook up.
		AND = {
			has_trait = lustful
			$TARGET$ = { has_trait = lustful }
		}
	}
	# Filter out any rivals that somehow made it this far.
	NOT = {
		has_any_moderate_bad_relationship_with_character_trigger = { CHARACTER = $TARGET$ }
	}
}

#	Lover developing from various sources.
ep3_laamp_flavour_ewan.2041 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.2041.t
	desc = ep3_laamp_flavour_ewan.2041.desc
	theme = laamp
	left_portrait = {
		character = scope:follower_1
		animation = love
	}
	right_portrait = {
		character = scope:follower_2
		animation = flirtation
	}
	override_background = { reference = ep3_campfire }

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_2041
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_2041
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Make sure they like each other.
		scope:follower_1 = {
			add_opinion = {
				target = scope:follower_2
				modifier = tryst_opinion
				opinion = 75
			}
			reverse_add_opinion = {
				target = scope:follower_2
				modifier = tryst_opinion
				opinion = 75
			}
		}
	}

	# Have them split up.
	option = {
		name = ep3_laamp_flavour_ewan.2041.a

		# Nab whichever follower has the higher diplomacy to be the duel target.
		if = {
			limit = { scope:follower_1.diplomacy >= scope:follower_2.diplomacy }
			scope:follower_1 = { save_scope_as = duel_target }
		}
		else = {
			scope:follower_2 = { save_scope_as = duel_target }
		}
		duel = {
			skill = diplomacy
			target = scope:duel_target
			# Victory!
			60 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.2041.a.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.2041.a.tt.success
					left_icon = scope:follower_1
					right_icon = scope:follower_2
					add_prestige = minor_prestige_gain
					scope:follower_1 = {
						stress_impact = {
							base = medium_stress_gain
							chaste = minor_stress_impact_loss
							lustful = minor_stress_impact_gain
						}
					}
					scope:follower_2 = {
						stress_impact = {
							base = medium_stress_gain
							chaste = minor_stress_impact_loss
							lustful = minor_stress_impact_gain
						}
					}
				}
			}
			# Defeat.
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.2041.a.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.2041.a.tt.failure
					left_icon = scope:follower_1
					right_icon = scope:follower_2
					scope:follower_1 = {
						set_random_lover_reason = { TARGET = scope:follower_2 }
						add_opinion = {
							target = root
							modifier = annoyed_opinion
							opinion = -40
						}
					}
					reverse_add_opinion = {
						target = scope:follower_2
						modifier = annoyed_opinion
						opinion = -40
					}
				}
				scope:follower_1 = {
					remove_opinion = {
						target = scope:follower_2
						modifier = tryst_opinion
					}
				}
				scope:follower_2 = {
					remove_opinion = {
						target = scope:follower_1
						modifier = tryst_opinion
					}
				}
			}
		}

		stress_impact = {
			sadistic = miniscule_stress_impact_loss
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -2 }
			opinion_modifier = {
				opinion_target = scope:follower_1
				multiplier = -0.5
			}
			opinion_modifier = {
				opinion_target = scope:follower_2
				multiplier = -0.5
			}
		}
	}

	# None of my business.
	option = {
		name = ep3_laamp_flavour_ewan.2041.b

		scope:follower_1 = {
			set_random_lover_reason = { TARGET = scope:follower_2 }
		}

		# No stress for opt out.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 2 }
			opinion_modifier = {
				opinion_target = scope:follower_1
				multiplier = 0.5
			}
			opinion_modifier = {
				opinion_target = scope:follower_2
				multiplier = 0.5
			}
		}
	}
}

#	Pre-filtering event to set up scopes.
ep3_laamp_flavour_ewan.2042 = {
	hidden = yes

	trigger = {
		trigger_if = {
			limit = {
				is_ai = yes
			}
			static_group_filter = {
				group = ep3_laamp_flavour_ewan.2042
				match = 0.2
			}
		}
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_2041 }
		}
		# Must have suitable courtiers around and about.
		any_courtier = {
			ep3_laamp_flavour_ewan_2041_valid_courtier_to_gain_lover_general_trigger = yes
			save_temporary_scope_as = char_temp
			root = {
				any_courtier = {
					ep3_laamp_flavour_ewan_2041_valid_courtier_to_gain_lover_precise_trigger = { TARGET = scope:char_temp }
				}
			}
		}
	}

	immediate = {
		while = {
			count = 10
			limit = {
				NOT = { exists = scope:follower_2 }
			}
			# Alright, let's select our lovebirds.
			## First up, pick an appropriate character.
			random_courtier = {
				limit = {
					ep3_laamp_flavour_ewan_2041_valid_courtier_to_gain_lover_general_trigger = yes
					NOT = { is_in_list = checked_courtier_1_candidates_list }
				}
				save_scope_as = follower_1
				add_to_list = checked_courtier_1_candidates_list
			}
			## Now, nab a suitable pair.
			if = {
				limit = { exists = scope:follower_1 }
				random_courtier = {
					limit = {
						ep3_laamp_flavour_ewan_2021_valid_courtier_for_own_marriage_precise_trigger = { TARGET = scope:follower_1 }
					}
					weight = {
						modifier = {
							add = attraction
							always = yes
						}
						modifier = {
							add = 50
							has_trait = lustful
						}
						modifier = {
							add = -50
							has_trait = chaste
						}
					}
					save_scope_as = follower_2
				}
				# And, wipe our checks so we can iterate the loop if required.
				if = {
					limit = {
						NOT = { exists = scope:follower_2 }
					}
					clear_saved_scope = follower_1
				}
			}
		}
		# If we've actually got our dudes, proceed to the event.
		if = {
			limit = {
				exists = scope:follower_1
				exists = scope:follower_2
			}
			trigger_event = ep3_laamp_flavour_ewan.2041
		}
	}
}

##################################################
# What's the Point?
# by Ewan Cowhig Croft
# # 2051 - 2060
##################################################

scripted_trigger ep3_laamp_flavour_ewan_2051_suitably_lazy_courtier_trigger = {
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
	OR = {
		has_trait = lazy
		has_trait = eccentric
		has_trait = athletic
		AND = {
			has_trait = diligent
			has_trait = humble
		}
	}
	NOR = {
		has_trait = arrogant
		has_trait = gregarious
		culture = { has_cultural_parameter = better_disease_resistance }
	}
}

#	Someone abandons bathing.
ep3_laamp_flavour_ewan.2051 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.2051.t
	desc = {
		desc = ep3_laamp_flavour_ewan.2051.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:smelly = {
						has_trait = diligent
						has_trait = humble
					}
				}
				desc = ep3_laamp_flavour_ewan.2051.desc.diligent_and_humble
			}
			triggered_desc = {
				trigger = {
					scope:smelly = { has_trait = athletic }
				}
				desc = ep3_laamp_flavour_ewan.2051.desc.athletic
			}
			triggered_desc = {
				trigger = {
					scope:smelly = { has_trait = gregarious }
				}
				desc = ep3_laamp_flavour_ewan.2051.desc.gregarious
			}
			desc = ep3_laamp_flavour_ewan.2051.desc.lazy
		}
		desc = ep3_laamp_flavour_ewan.2051.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = disgust
	}
	right_portrait = {
		character = scope:smelly
		animation = personality_bold
	}
	override_background = { reference = wilderness }
	override_effect_2d = { reference = flies }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_2051 }
		}
		# Must have at least one potential scope:smelly.
		any_courtier = { ep3_laamp_flavour_ewan_2051_suitably_lazy_courtier_trigger = yes }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_2051
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_2051
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_longer
			}
		}
		# Nab our scope:smelly.
		ordered_courtier = {
			limit = { ep3_laamp_flavour_ewan_2051_suitably_lazy_courtier_trigger = yes }
			order_by = {
				# We want the least socially competent person available.
				value = 100
				subtract = diplomacy
			}
			save_scope_as = smelly
			add_character_modifier = {
				modifier = ep3_laamp_flavour_ewan_2051_is_stinker_modifier
				years = 10
			}
		}
		every_courtier = {
			limit = {
				ep3_laamp_flavour_ewan_available_anybody_trigger = yes
				this != scope:smelly
			}
			custom = custom.every_follower
			add_opinion = {
				target = scope:smelly
				modifier = disgusted_opinion
				opinion = -30
			}
		}
	}

	# Scope:smelly, you _reek_!
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							scope:smelly = {
								has_trait = diligent
								has_trait = humble
							}
						}
						desc = ep3_laamp_flavour_ewan.2051.a.diligent_and_humble
					}
					triggered_desc = {
						trigger = {
							scope:smelly = { has_trait = athletic }
						}
						desc = ep3_laamp_flavour_ewan.2051.a.athletic
					}
					triggered_desc = {
						trigger = {
							scope:smelly = { has_trait = gregarious }
						}
						desc = ep3_laamp_flavour_ewan.2051.a.gregarious
					}
					desc = ep3_laamp_flavour_ewan.2051.a.lazy
				}
			}
		}

		reverse_add_opinion = {
			target = scope:smelly
			modifier = upset_opinion
			opinion = -20
		}
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_2051_disciplined_stinker_modifier
			years = 10
		}

		stress_impact = {
			arrogant = minor_stress_impact_loss
			honest = minor_stress_impact_loss
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = 2 }
		}
	}

	# Join HerHim in filthy freedom.
	option = {
		name = ep3_laamp_flavour_ewan.2051.b

		reverse_add_opinion = {
			target = scope:smelly
			modifier = pleased_opinion
			opinion = 35
		}
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_2051_joined_stinker_modifier
			years = 10
		}

		stress_impact = {
			content = miniscule_stress_impact_loss
			humble = miniscule_stress_impact_loss
			arrogant = medium_stress_impact_gain
			ambitious = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_sociability = -1
				ai_boldness = 1
			}
		}
	}

	# Leave this petty drama to play out.
	option = {
		name = ep3_laamp_flavour_ewan.2051.c

		# Consolation prestige.
		add_prestige = minor_prestige_gain

		stress_impact = {
			shy = miniscule_stress_impact_loss
			lazy = miniscule_stress_impact_loss
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = -2 }
		}
	}
}

##################################################
# My Spot
# by Ewan Cowhig Croft
# # 2061 - 2070
##################################################

scripted_trigger ep3_laamp_flavour_ewan_2061_valid_angry_courtier_general_trigger = {
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
	NOR = {
		has_trait = patient
		has_trait = calm
		has_trait = humble
	}
}

scripted_trigger ep3_laamp_flavour_ewan_2061_valid_angry_courtier_precise_trigger = {
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
	NOT = { this = $TARGET$ }
	# Make sure we've got poor relations with our target.
	opinion = {
		target = $TARGET$
		value <= -20
	}
	reverse_opinion = {
		target = $TARGET$
		value <= -20
	}
	NOT = {
		has_any_moderate_good_relationship_with_character_trigger = { CHARACTER = $TARGET$ }
	}
	save_temporary_scope_as = char_temp2
}

#	Fight at dinner over tent pitch location.
ep3_laamp_flavour_ewan.2061 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.2061.t
	desc = ep3_laamp_flavour_ewan.2061.desc
	theme = laamp
	left_portrait = {
		character = scope:victim
		animation = anger
	}
	right_portrait = {
		character = scope:thief
		animation = dismissal
	}
	override_background = { reference = corridor_night }

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_2061
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_2061
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Now, make them upset with one another.
		scope:thief = {
			add_opinion = {
				target = scope:victim
				modifier = overreaction_opinion
				opinion = -30
			}
			reverse_add_opinion = {
				target = scope:victim
				modifier = annoyed_opinion
				opinion = -30
			}
		}
	}

	# Side with scope:victim.
	option = {
		name = ep3_laamp_flavour_ewan.2061.a

		add_favour_hook_if_possible_simple_effect = { TARGET = scope:victim }
		reverse_add_opinion = {
			target = scope:victim
			modifier = respect_opinion
			opinion = 20
		}
		reverse_add_opinion = {
			target = scope:thief
			modifier = upset_opinion
			opinion = -20
		}

		stress_impact = {
			honest = miniscule_stress_impact_loss
			just = miniscule_stress_impact_loss
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = 1 }
			opinion_modifier = { opinion_target = scope:victim }
		}
	}

	# Side with scope:thief.
	option = {
		name = ep3_laamp_flavour_ewan.2061.b

		add_favour_hook_if_possible_simple_effect = { TARGET = scope:thief }
		reverse_add_opinion = {
			target = scope:thief
			modifier = respect_opinion
			opinion = 20
		}
		reverse_add_opinion = {
			target = scope:victim
			modifier = upset_opinion
			opinion = -20
		}

		stress_impact = {
			deceitful = miniscule_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
			just = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = -1 }
			opinion_modifier = { opinion_target = scope:thief }
		}
	}

	# Fixed Layout: we have rules for a reason, scope:thief.
	option = {
		name = ep3_laamp_flavour_ewan.2061.c
		trigger = {
			domicile = { has_domicile_building = camp_perimeter_fixed_layout }
		}
		reason = has_building_camp_perimeter_fixed_layout

		add_favour_hook_if_possible_simple_effect = { TARGET = scope:victim }
		reverse_add_opinion = {
			target = scope:victim
			modifier = respect_opinion
			opinion = 30
		}
		reverse_add_opinion = {
			target = scope:thief
			modifier = respect_opinion
			opinion = 20
		}
		add_prestige = medium_prestige_gain

		stress_impact = {
			honest = miniscule_stress_impact_loss
			just = miniscule_stress_impact_loss
			diligent = miniscule_stress_impact_loss
		}
		ai_chance = {
			# Just a good option for the AI to take if they can.
			base = 1000
		}
	}

	# Figure it out amongst yourselves.
	option = {
		name = ep3_laamp_flavour_ewan.2061.d

		# Consolation prestige.
		add_prestige = minor_prestige_gain

		stress_impact = {
			shy = miniscule_stress_impact_loss
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -1 }
		}
	}
}

#	Pre-filtering event to set up scopes.
ep3_laamp_flavour_ewan.2062 = {
	hidden = yes

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_2061 }
		}
		# Make sure we've got suitable courtiers available.
		any_courtier = {
			ep3_laamp_flavour_ewan_2061_valid_angry_courtier_general_trigger = yes
			save_temporary_scope_as = char_temp
			root = {
				any_courtier = {
					ep3_laamp_flavour_ewan_2061_valid_angry_courtier_precise_trigger = { TARGET = scope:char_temp }
				}
			}
		}
	}

	immediate = {
		while = {
			count = 10
			limit = {
				NOT = { exists = scope:thief }
			}
			# Find our best courtiers.
			## First, grabbing a valid annoyed char.
			random_courtier = {
				limit = {
					ep3_laamp_flavour_ewan_2061_valid_angry_courtier_general_trigger = yes
					NOT = { is_in_list = checked_courtier_1_candidates_list }
				}
				save_scope_as = victim
				add_to_list = checked_courtier_1_candidates_list
			}
			## Then processing out a good thief.
			if = {
				limit = { exists = scope:victim }
				random_courtier = {
					limit = {
						ep3_laamp_flavour_ewan_2061_valid_angry_courtier_precise_trigger = { TARGET = scope:victim }
					}
					weight = {
						modifier = {
							add = 20
							has_trait = wrathful
						}
						modifier = {
							add = 15
							has_trait = deceitful
						}
						modifier = {
							add = 5
							has_trait = arrogant
						}
						modifier = {
							add = 10
							has_trait = arbitrary
						}
						modifier = {
							add = -20
							has_trait = just
						}
						modifier = {
							add = 5
							has_trait = fickle
						}
						modifier = {
							add = 15
							has_trait = vengeful
						}
						modifier = {
							add = -15
							has_trait = forgiving
						}
						modifier = {
							add = -15
							has_trait = honest
						}
					}
					save_scope_as = thief
				}
				# And, wipe our checks so we can iterate the loop if required.
				if = {
					limit = {
						NOT = { exists = scope:thief }
					}
					clear_saved_scope = victim
				}
			}
		}
		# If we've actually got our dudes, proceed to the event.
		if = {
			limit = {
				exists = scope:victim
				exists = scope:thief
			}
			trigger_event = ep3_laamp_flavour_ewan.2061
		}
	}
}

##################################################
# Second-in-Command
# by Ewan Cowhig Croft
# # 2071 - 2080
##################################################

scripted_trigger ep3_laamp_flavour_ewan_2071_better_possible_sics_trigger = {
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
	can_be_employed_as = second_camp_officer
	"aptitude(second_camp_officer)" >= 2
	# Plus make sure they'd actually want the job.
	NOR = {
		has_trait = lazy
		has_trait = humble
		has_trait = content
		has_any_moderate_bad_relationship_with_character_trigger = { CHARACTER = root }
	}
	opinion = {
		target = root
		value >= 20
	}
	# For tonal reasons, it's easiest to just avoid disloyal/loyalty-hooked characters getting in here for any reason.
	NOR = {
		has_trait = disloyal
		root = { has_strong_hook = prev }
	}
}

scripted_effect ep3_laamp_flavour_ewan_2071_apply_appointment_effect = {
	camp_officer_grant_effect = {
		EMPLOYER = root
		POS = second
		CANDIDATE = $CHOSEN$
	}
	reverse_add_opinion = {
		target = $CHOSEN$
		modifier = grateful_opinion
		opinion = 50
	}
}

scripted_effect ep3_laamp_flavour_ewan_2071_apply_trio_annoyed_opinions_effect = {
	# If we have a scope:current_sic, then they're upset too.
	scope:current_sic ?= {
		add_opinion = {
			target = root
			modifier = insult_opinion
			opinion = -50
		}
	}
	# Whilst everyone else is just annoyed.
	reverse_add_opinion = {
		target = $CANDIDATE_A$
		modifier = insult_opinion
		opinion = -30
	}
	reverse_add_opinion = {
		target = $CANDIDATE_B$
		modifier = insult_opinion
		opinion = -30
	}
}

#	People scrabble for empty/ineffectual SiC position.
ep3_laamp_flavour_ewan.2071 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.2071.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:current_sic }
				desc = ep3_laamp_flavour_ewan.2071.desc.sic_exists
			}
			desc = ep3_laamp_flavour_ewan.2071.desc.sic_vacant
		}
		desc = ep3_laamp_flavour_ewan.2071.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:current_sic
		animation = worry
	}
	lower_left_portrait = scope:candidate_1
	lower_center_portrait = scope:candidate_2
	lower_right_portrait = scope:candidate_3
	override_background = { reference = armory }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_2071 }
		}
		# Either you don't have a SiC, or your SiC sucks.
		OR = {
			NOT = { employs_court_position = second_camp_officer }
			court_position:second_camp_officer = { "aptitude(second_camp_officer)" <= 1 }
		}
		# You have at least three characters who'd be better.
		any_courtier = {
			count >= 3
			ep3_laamp_flavour_ewan_2071_better_possible_sics_trigger = yes
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_2071
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_2071
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Is the spot vacant, or merely incompetent?
		if = {
			limit = { employs_court_position = second_camp_officer }
			court_position:second_camp_officer = { save_scope_as = current_sic }
		}
		# Alright, process out our possible SiCs.
		ordered_courtier = {
			limit = { ep3_laamp_flavour_ewan_2071_better_possible_sics_trigger = yes }
			order_by = {
				# Ok, first we group by aptitude.
				value = "aptitude(second_camp_officer)"
				# Then we want to use diplomacy as a tiebreaker...
				## ... so make it a decimal of aptitude...
				multiply = 100
				## ... and _then_ add it.
				add = diplomacy
			}
			max = 3
			check_range_bounds = no
			# We place these in order of how much they'll offer you, which means we actually want to invert our count for how we save the scopes (so 3 -> 2 -> 1).
			if = {
				limit = {
					NOT = { exists = scope:candidate_3 }
				}
				save_scope_as = candidate_3
			}
			else_if = {
				limit = {
					NOT = {
						this = scope:candidate_3
						exists = scope:candidate_2
					}
				}
				save_scope_as = candidate_2
			}
			else_if = {
				limit = {
					NOT = {
						this = scope:candidate_3
						this = scope:candidate_2
						exists = scope:candidate_1
					}
				}
				save_scope_as = candidate_1
			}
		}
	}

	# Accept scope:candidate_1, and their offer of complete loyalty.
	option = {
		name = ep3_laamp_flavour_ewan.2071.a

		ep3_laamp_flavour_ewan_2071_apply_appointment_effect = { CHOSEN = scope:candidate_1 }
		add_hook = {
			target = scope:candidate_1
			type = loyalty_hook
		}
		# Flag that the loyalty hook is dependent on this court position.
		scope:candidate_1 = {
			set_variable = {
				name = loyalty_dependent_on_position
				value = root
			}
		}
		# Everyone else is upset.
		ep3_laamp_flavour_ewan_2071_apply_trio_annoyed_opinions_effect = {
			CANDIDATE_A = scope:candidate_2
			CANDIDATE_B = scope:candidate_3
		}

		# No stress here.
		ai_chance = {
			base = 1
			opinion_modifier = { opinion_target = scope:candidate_1 }
		}
	}

	# Take scope:candidate_2, who says they'll work themselves to death.
	option = {
		name = ep3_laamp_flavour_ewan.2071.b

		ep3_laamp_flavour_ewan_2071_apply_appointment_effect = { CHOSEN = scope:candidate_2 }
		scope:candidate_2 = {
			add_character_modifier = {
				modifier = ep3_laamp_flavour_ewan_2071_b_work_self_to_death_modifier
				years = 20
			}
		}
		# Everyone else is upset.
		ep3_laamp_flavour_ewan_2071_apply_trio_annoyed_opinions_effect = {
			CANDIDATE_A = scope:candidate_1
			CANDIDATE_B = scope:candidate_3
		}

		# No stress here.
		ai_chance = {
			base = 1
			opinion_modifier = { opinion_target = scope:candidate_2 }
		}
	}

	# Mmmm, scope:candidate_3, please: HerHis skills are self-evident.
	option = {
		name = ep3_laamp_flavour_ewan.2071.c

		ep3_laamp_flavour_ewan_2071_apply_appointment_effect = { CHOSEN = scope:candidate_3 }
		# Everyone else is upset.
		ep3_laamp_flavour_ewan_2071_apply_trio_annoyed_opinions_effect = {
			CANDIDATE_A = scope:candidate_1
			CANDIDATE_B = scope:candidate_2
		}

		# No stress here.
		ai_chance = {
			base = 1
			opinion_modifier = { opinion_target = scope:candidate_3 }
		}
	}

	# It shall remain vacant/scope:sic shall keep HerHis post.
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { exists = scope:current_sic }
						desc = ep3_laamp_flavour_ewan.2071.d.post_filled
					}
					desc = ep3_laamp_flavour_ewan.2071.d.post_empty
				}
			}
		}

		# If we have a scope:current_sic, then they're duly grateful.
		scope:current_sic ?= {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 30
			}
		}
		# Whilst everyone else is just annoyed.
		reverse_add_opinion = {
			target = scope:candidate_1
			modifier = insult_opinion
			opinion = -30
		}
		reverse_add_opinion = {
			target = scope:candidate_2
			modifier = insult_opinion
			opinion = -30
		}
		reverse_add_opinion = {
			target = scope:candidate_3
			modifier = insult_opinion
			opinion = -30
		}
		# Consolation prestige.
		add_prestige = minor_prestige_gain

		# Lose stress if we're playing to our reputation + it's appropriate.
		if = {
			limit = { exists = scope:current_sic }
			stress_impact = { loyal = medium_stress_loss }
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -2 }
		}
	}
}

##################################################
# A Well-Oiled Machine
# by Ewan Cowhig Croft
# # 2081 - 2090
##################################################

#	Helping each other out at pitch time.
ep3_laamp_flavour_ewan.2081 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.2081.t
	desc = {
		desc = ep3_laamp_flavour_ewan.2081.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:follower_1 = {
						OR = {
							opinion = {
								target = scope:follower_2
								value <= -25
							}
							reverse_opinion = {
								target = scope:follower_2
								value <= -25
							}
						}
					}
				}
				desc = ep3_laamp_flavour_ewan.2081.desc.dislike
			}
			triggered_desc = {
				trigger = {
					scope:follower_1 = {
						OR = {
							opinion = {
								target = scope:follower_2
								value >= 25
							}
							reverse_opinion = {
								target = scope:follower_2
								value >= 25
							}
						}
					}
				}
				desc = ep3_laamp_flavour_ewan.2081.desc.like
			}
			desc = ep3_laamp_flavour_ewan.2081.desc.neutral
		}
		desc = ep3_laamp_flavour_ewan.2081.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = scope:follower_1
		animation = laugh
	}
	right_portrait = {
		character = scope:follower_2
		animation = personality_bold
	}
	override_background = { reference = corridor_night }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_2081 }
		}
		# Must have suitable courtiers available.
		any_courtier = {
			count >= 2
			ep3_laamp_flavour_ewan_available_courtier_trigger = yes
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_2081
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_2081
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_longer
			}
		}
		# Nab our two courtiers.
		random_courtier = {
			limit = { ep3_laamp_flavour_ewan_available_courtier_trigger = yes }
			weight = {
				modifier = {
					add = stewardship
					always = yes
				}
				modifier = {
					add = 10
					has_trait = diligent
				}
				modifier = {
					add = -10
					has_trait = lazy
				}
			}
			save_scope_as = follower_1
		}
		random_courtier = {
			limit = {
				ep3_laamp_flavour_ewan_available_courtier_trigger = yes
				this != scope:follower_1
			}
			weight = {
				modifier = {
					add = stewardship
					always = yes
				}
				modifier = {
					add = 10
					has_trait = diligent
				}
				modifier = {
					add = -10
					has_trait = lazy
				}
			}
			save_scope_as = follower_2
		}
	}

	# Do you need another hand?
	option = {
		name = ep3_laamp_flavour_ewan.2081.a

		reverse_add_opinion = {
			target = scope:follower_1
			modifier = one_of_us_opinion
			opinion = 30
		}
		reverse_add_opinion = {
			target = scope:follower_2
			modifier = one_of_us_opinion
			opinion = 30
		}
		add_prestige = minor_prestige_loss

		stress_impact = {
			diligent = miniscule_stress_impact_loss
			humble = miniscule_stress_impact_loss
			content = miniscule_stress_impact_loss
			ambitious = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
			arrogant = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
		}
	}

	# Legitimist: after you're done here, go help raise my pavillion.
	option = {
		name = ep3_laamp_flavour_ewan.2081.b
		trigger = { has_realm_law = camp_purpose_legitimists }
		reason = purpose_legitimists

		add_prestige = medium_prestige_gain

		stress_impact = {
			arrogant = medium_stress_impact_loss
			lazy = minor_stress_impact_loss
			ambitious = miniscule_stress_impact_loss
			content = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 2 }
		}
	}

	# Hmmm... don't like that, better move them apart.
	option = {
		name = ep3_laamp_flavour_ewan.2081.c
		trigger = {
			NOT = { has_realm_law = camp_purpose_legitimists }
		}

		reverse_add_opinion = {
			target = scope:follower_1
			modifier = annoyed_opinion
			opinion = -10
		}
		reverse_add_opinion = {
			target = scope:follower_2
			modifier = annoyed_opinion
			opinion = -10
		}

		stress_impact = {
			paranoid = minor_stress_impact_loss
			trusting = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -1 }
		}
	}

	# Fixed Layout: as it should be.
	option = {
		name = ep3_laamp_flavour_ewan.2081.d
		trigger = {
			domicile = { has_domicile_building = camp_perimeter_fixed_layout }
		}
		reason = has_building_camp_perimeter_fixed_layout

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_2081_d_well_oiled_operation_modifier
			years = 10
		}

		# No stress here,
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = 1 }
		}
	}

	# Good to see those two getting on!
	option = {
		name = ep3_laamp_flavour_ewan.2081.e

		scope:follower_1 = {
			add_opinion = {
				target = scope:follower_2
				modifier = respect_opinion
				opinion = 30
			}
			reverse_add_opinion = {
				target = scope:follower_2
				modifier = respect_opinion
				opinion = 30
			}
		}

		# No stress here,
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = 1 }
		}
	}
}

##################################################
# Crimes of Passion
# by Ewan Cowhig Croft
# # 2091 - 2100
##################################################

scripted_trigger ep3_laamp_flavour_ewan_2091_valid_angry_courtier_general_trigger = {
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
	# Mustn't have a deescalatory personality.
	NOR = {
		has_trait = patient
		has_trait = calm
		has_trait = forgiving
	}
	# And make sure a fight is conceivable.
	prowess >= 7
	can_start_single_combat_trigger = yes
}

scripted_trigger ep3_laamp_flavour_ewan_2091_valid_angry_courtier_precise_trigger = {
	NOT = { this = $TARGET$ }
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
	# Make sure we've got poor relations with our target.
	opinion = {
		target = $TARGET$
		value <= -25
	}
	reverse_opinion = {
		target = $TARGET$
		value <= -25
	}
	NOT = {
		has_any_moderate_good_relationship_with_character_trigger = { CHARACTER = $TARGET$ }
	}
	save_temporary_scope_as = char_temp2
}

scripted_effect ep3_laamp_flavour_ewan_2091_start_duel_to_death_effect = {
	configure_start_single_combat_effect = {
		SC_INITIATOR = scope:attacker
		SC_ATTACKER = scope:attacker
		SC_DEFENDER = scope:defender
		FATALITY = always
		FIXED = no
		LOCALE = terrain_scope
		INVALIDATION_EVENT = single_combat.1006
		OUTPUT_EVENT = ep3_laamp_flavour_ewan.2092
	}
}

#	Followers attack each other.
ep3_laamp_flavour_ewan.2091 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.2091.t
	desc = ep3_laamp_flavour_ewan.2091.desc
	theme = laamp
	left_portrait = {
		character = scope:attacker
		animation = random_weapon_aggressive
	}
	right_portrait = {
		character = scope:defender
		animation = shock
	}
	override_background = { reference = ep3_campfire }

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_2091
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_2091
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Now, make them upset with one another.
		scope:attacker = {
			add_opinion = {
				target = scope:defender
				modifier = hate_opinion
				opinion = -50
			}
			reverse_add_opinion = {
				target = scope:defender
				modifier = hate_opinion
				opinion = -50
			}
		}
		# Plus make sure we _definitely_ know who root is, for the after-toasts.
		save_scope_as = og_root
	}

	# Intervene.
	option = {
		name = ep3_laamp_flavour_ewan.2091.a

		duel = {
			skill = diplomacy
			target = scope:attacker
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.2091.a.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.2091.a.tt.success
					left_icon = scope:attacker
					right_icon = scope:defender
					reverse_add_opinion = {
						target = scope:attacker
						modifier = respect_opinion
						opinion = 40
					}
					reverse_add_opinion = {
						target = scope:defender
						modifier = respect_opinion
						opinion = 40
					}
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.2091.a.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.2091.a.tt.failure
					left_icon = scope:attacker
					right_icon = scope:defender
					reverse_add_opinion = {
						target = scope:attacker
						modifier = respect_opinion
						opinion = -20
					}
					reverse_add_opinion = {
						target = scope:defender
						modifier = respect_opinion
						opinion = -20
					}
				}
				scope:attacker = {
					increase_wounds_no_death_effect = { REASON = fight }
				}
				scope:defender = {
					increase_wounds_no_death_effect = { REASON = fight }
				}
			}
		}

		stress_impact = {
			calm = miniscule_stress_impact_loss
			just = miniscule_stress_impact_loss
			arbitrary = minor_stress_impact_gain
			patient = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
		}
	}

	# Freebooters/S4H: invite them to settle their grievances with a formal duel.
	option = {
		name = ep3_laamp_flavour_ewan.2091.b
		trigger = {
			OR = {
				has_realm_law = camp_purpose_mercenaries
				has_realm_law = camp_purpose_brigands
			}
		}
		reason = purpose_brigands_and_mercenaries

		add_prestige = medium_prestige_gain
		every_courtier = {
			limit = {
				ep3_laamp_flavour_ewan_available_courtier_trigger = yes
				NOR = {
					this = scope:attacker
					this = scope:defender
				}
			}
			custom = custom.every_adult_follower
			add_stress = major_stress_loss
			add_opinion = {
				target = root
				modifier = entertained_opinion
				opinion = 30
			}
		}
		save_scope_value_as = {
			name = duel_legal
			value = yes
		}
		custom_tooltip = ep3_laamp_flavour_ewan.2091.tt.duel_commences
		ep3_laamp_flavour_ewan_2091_start_duel_to_death_effect = yes

		# For once, all sides of the Calm/Just axes are happy! Blood and justice on the right terms!
		## ... or something.
		stress_impact = {
			calm = minor_stress_impact_loss
			arbitrary = minor_stress_impact_loss
			just = minor_stress_impact_loss
			wrathful = minor_stress_impact_loss
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = -2 }
		}
	}

	# Have the attacker arrested and thrown in the stocks.
	option = {
		name = ep3_laamp_flavour_ewan.2091.c

		rightfully_imprison_character_effect = {
			TARGET = scope:attacker
			IMPRISONER = root
		}
		reverse_add_opinion = {
			target = scope:defender
			modifier = grateful_opinion
			opinion = 50
		}

		stress_impact = {
			just = miniscule_stress_impact_loss
			arbitrary = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = 1 }
		}
	}

	# Let them play it out.
	option = {
		name = ep3_laamp_flavour_ewan.2091.d

		custom_tooltip = ep3_laamp_flavour_ewan.2091.tt.duel_commences
		ep3_laamp_flavour_ewan_2091_start_duel_to_death_effect = yes

		stress_impact = {
			wrathful = miniscule_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
			just = minor_stress_impact_gain
			calm = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = 1 }
		}
	}
}

ep3_laamp_flavour_ewan.2092 = {
	hidden = yes

	immediate = {
		if = {
			limit = { scope:sc_victor = scope:attacker }
			scope:og_root = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.2092.tt.attacker_won
					left_icon = scope:attacker
					right_icon = scope:defender
					custom_tooltip = ep3_laamp_flavour_ewan.2092.tt.attacker_won.tt
					scope:attacker = {
						if = {
							limit = {
								NOT = { exists = scope:duel_legal }
							}
							laamp_rewards_apply_criminal_xp_effect = {
								TRACK = marauder
								XP_MAX = gallowsbait_xp_medium_gain
								XP_MIN = gallowsbait_xp_medium_gain
							}
						}
					}
				}
			}
		}
		else = {
			scope:og_root = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.2092.tt.defender_won
					left_icon = scope:defender
					right_icon = scope:attacker
					custom_tooltip = ep3_laamp_flavour_ewan.2092.tt.defender_won.tt
				}
			}
		}
	}
}

#	Pre-filtering event to set up scopes.
ep3_laamp_flavour_ewan.2093 = {
	hidden = yes

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_2091 }
		}
		# Make sure we've got suitable courtiers available.
		any_courtier = {
			ep3_laamp_flavour_ewan_2091_valid_angry_courtier_general_trigger = yes
			save_temporary_scope_as = char_temp
			root = {
				any_courtier = {
					ep3_laamp_flavour_ewan_2091_valid_angry_courtier_precise_trigger = { TARGET = scope:char_temp }
				}
			}
		}
	}

	immediate = {
		while = {
			count = 10
			limit = {
				NOT = { exists = scope:attacker }
			}
			# Find our best courtiers.
			## First, grab a suitable candidate.
			random_courtier = {
				limit = {
					ep3_laamp_flavour_ewan_2091_valid_angry_courtier_general_trigger = yes
					NOT = { is_in_list = checked_courtier_1_candidates_list }
				}
				save_scope_as = defender
				add_to_list = checked_courtier_1_candidates_list
			}
			## Then processing out a good one.
			if = {
				limit = { exists = scope:defender }
				random_courtier = {
					limit = {
						ep3_laamp_flavour_ewan_2091_valid_angry_courtier_precise_trigger = { TARGET = scope:defender }
					}
					weight = {
						modifier = {
							add = 20
							has_trait = wrathful
						}
						modifier = {
							add = 15
							has_trait = deceitful
						}
						modifier = {
							add = 5
							has_trait = arrogant
						}
						modifier = {
							add = 10
							has_trait = arbitrary
						}
						modifier = {
							add = -20
							has_trait = just
						}
						modifier = {
							add = 5
							has_trait = fickle
						}
						modifier = {
							add = 15
							has_trait = vengeful
						}
						modifier = {
							add = -15
							has_trait = forgiving
						}
						modifier = {
							add = -15
							has_trait = honest
						}
						opinion_modifier = {
							who = this
							opinion_target = scope:defender
							multiplier = -0.5
						}
					}
					save_scope_as = attacker
				}
				# And, wipe our checks so we can iterate the loop if required.
				if = {
					limit = {
						NOT = { exists = scope:attacker }
					}
					clear_saved_scope = defender
				}
			}
		}
		# If we've actually got our dudes, proceed to the event.
		if = {
			limit = {
				exists = scope:defender
				exists = scope:attacker
			}
			trigger_event = ep3_laamp_flavour_ewan.2091
		}
	}
}











##################################################
# CAMP PURPOSE

##################################################
# Heard of You
# by Ewan Cowhig Croft
# # 3001 - 3010
##################################################

scripted_effect ep3_laamp_flavour_ewan_3001_spawn_appropriate_characters_effect = {
	create_character = {
		template = criminal_brains_character
		location = root.location
		save_scope_as = brains
		diplomacy = {
			$OVERRIDE_SKILL_LOW$
			$OVERRIDE_SKILL_HIGH$
		}
		stewardship = {
			min_template_medium_skill
			max_template_medium_skill
		}
	}
	create_character = {
		template = criminal_brawn_character
		location = root.location
		save_scope_as = brawn
		prowess = {
			$OVERRIDE_SKILL_LOW$
			$OVERRIDE_SKILL_HIGH$
		}
	}
	create_character = {
		template = criminal_fingers_character
		location = root.location
		save_scope_as = fingers
		intrigue = {
			$OVERRIDE_SKILL_LOW$
			$OVERRIDE_SKILL_HIGH$
		}
	}
	# Plus try to give 'em all fun nicknames.
	hidden_effect = {
		scope:brains = { assign_random_nickname_effect = yes }
		scope:brawn = { assign_random_nickname_effect = yes }
		scope:fingers = { assign_random_nickname_effect = yes }
	}
}

scripted_effect ep3_laamp_flavour_ewan_3001_recruit_characters_effect = {
	add_courtier = scope:brains
	add_courtier = scope:brawn
	add_courtier = scope:fingers
	reverse_add_opinion = {
		target = scope:brains
		modifier = grateful_opinion
		opinion = $OPINION$
	}
	reverse_add_opinion = {
		target = scope:brawn
		modifier = grateful_opinion
		opinion = $OPINION$
	}
	reverse_add_opinion = {
		target = scope:fingers
		modifier = grateful_opinion
		opinion = $OPINION$
	}
}

#	Brigands attract cool local criminals, scaled to prestige level.
ep3_laamp_flavour_ewan.3001 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.3001.t
	desc = {
		desc = ep3_laamp_flavour_ewan.3001.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { prestige_level >= 5 }
				desc = ep3_laamp_flavour_ewan.3001.desc.legendary
			}
			triggered_desc = {
				trigger = { prestige_level >= 4 }
				desc = ep3_laamp_flavour_ewan.3001.desc.exalted
			}
			triggered_desc = {
				trigger = { prestige_level >= 3 }
				desc = ep3_laamp_flavour_ewan.3001.desc.illustrious
			}
			triggered_desc = {
				trigger = { prestige_level >= 2 }
				desc = ep3_laamp_flavour_ewan.3001.desc.distinguished
			}
			triggered_desc = {
				trigger = { prestige_level >= 1 }
				desc = ep3_laamp_flavour_ewan.3001.desc.established
			}
			desc = ep3_laamp_flavour_ewan.3001.desc.disgraced
		}
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:brains
		animation = admiration
	}
	lower_center_portrait = scope:brawn
	lower_right_portrait = scope:fingers
	override_background = { reference = armory }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_3001 }
		}
		# Must have the correct camp purpose.
		has_realm_law = camp_purpose_brigands
		# And can't have more than a certain amount of courtiers already.
		any_courtier = { count <= 20 }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_3001
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_3001
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_long
			}
		}
		# Spawn our lil dudes.
		if = {
			limit = { prestige_level = 0 }
			ep3_laamp_flavour_ewan_3001_spawn_appropriate_characters_effect = {
				OVERRIDE_SKILL_LOW = min_template_low_skill
				OVERRIDE_SKILL_HIGH = max_template_low_skill
			}
		}
		else_if = {
			limit = { prestige_level = 1 }
			ep3_laamp_flavour_ewan_3001_spawn_appropriate_characters_effect = {
				OVERRIDE_SKILL_LOW = min_template_average_skill
				OVERRIDE_SKILL_HIGH = max_template_average_skill
			}
		}
		else_if = {
			limit = { prestige_level = 2 }
			ep3_laamp_flavour_ewan_3001_spawn_appropriate_characters_effect = {
				OVERRIDE_SKILL_LOW = min_template_medium_skill
				OVERRIDE_SKILL_HIGH = max_template_medium_skill
			}
		}
		else_if = {
			limit = { prestige_level = 3 }
			ep3_laamp_flavour_ewan_3001_spawn_appropriate_characters_effect = {
				OVERRIDE_SKILL_LOW = min_template_decent_skill
				OVERRIDE_SKILL_HIGH = max_template_decent_skill
			}
		}
		else_if = {
			limit = { prestige_level = 4 }
			ep3_laamp_flavour_ewan_3001_spawn_appropriate_characters_effect = {
				OVERRIDE_SKILL_LOW = min_template_high_skill
				OVERRIDE_SKILL_HIGH = max_template_high_skill
			}
		}
		else_if = {
			limit = { prestige_level = 5 }
			ep3_laamp_flavour_ewan_3001_spawn_appropriate_characters_effect = {
				OVERRIDE_SKILL_LOW = min_template_very_high_skill
				OVERRIDE_SKILL_HIGH = max_template_very_high_skill
			}
		}
		## Shouldn't happen, but just in case, leave a fallback equivalent to the bottom rung.
		else = {
			ep3_laamp_flavour_ewan_3001_spawn_appropriate_characters_effect = {
				OVERRIDE_SKILL_LOW = min_template_low_skill
				OVERRIDE_SKILL_HIGH = max_template_low_skill
			}
		}
		# Plus make sure they get on.
		hidden_effect = {
			scope:brains = {
				set_relation_friend = {
					reason = friend_petty_criminals_together
					target = scope:fingers
				}
				set_relation_friend = {
					reason = friend_petty_criminals_together
					target = scope:brawn
				}
			}
			scope:brawn = {
				set_relation_friend = {
					reason = friend_petty_criminals_together
					target = scope:fingers
				}
			}
		}
		# Save our county for loc.
		location.county = { save_scope_as = current_county }
	}

	# Sure, we'll take you on...
	option = {
		name = ep3_laamp_flavour_ewan.3001.a

		ep3_laamp_flavour_ewan_3001_recruit_characters_effect = { OPINION = 100 }

		stress_impact = {
			trusting = miniscule_stress_impact_loss
			paranoid = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 2 }
		}
	}

	# Stewardship duel: ... but you've gotta pay into the _pot_ first.
	option = {
		name = ep3_laamp_flavour_ewan.3001.b

		duel = {
			skill = stewardship
			target = scope:brains
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.3001.b.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.3001.b.tt.success
					left_icon = scope:brains
					scope:brains = {
						pay_short_term_gold = {
							target = root
							gold = medium_gold_laamps_value
						}
						# Don't actually charge scope:brains, though.
						hidden_effect = { add_gold = medium_gold_laamps_value }
					}
				}
				ep3_laamp_flavour_ewan_3001_recruit_characters_effect = { OPINION = 40 }
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.3001.b.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.3001.b.tt.failure
					left_icon = scope:brains
					add_prestige = medium_prestige_loss
				}
			}
		}

		stress_impact = {
			greedy = minor_stress_impact_loss
			generous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_greed = 2 }
		}
	}

	# Heh, get out of here y'curs.
	option = {
		name = ep3_laamp_flavour_ewan.3001.c

		add_prestige = medium_prestige_gain
		reverse_add_opinion = {
			target = scope:brains
			modifier = disappointed_opinion
			opinion = -20
		}
		reverse_add_opinion = {
			target = scope:brawn
			modifier = disappointed_opinion
			opinion = -20
		}
		reverse_add_opinion = {
			target = scope:fingers
			modifier = disappointed_opinion
			opinion = -20
		}

		stress_impact = {
			paranoid = miniscule_stress_impact_loss
			trusting = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = -2 }
		}
	}

	after = {
		# If we're an AI & didn't recruit them, clean up our criminals.
		if = {
			limit = {
				is_ai = yes
				NOR = {
					this = scope:brains.liege
					this = scope:brawn.liege
					this = scope:fingers.liege
				}
			}
			scope:brains = {
				death = { death_reason = death_vanished }
			}
			scope:brawn = {
				death = { death_reason = death_vanished }
			}
			scope:fingers = {
				death = { death_reason = death_vanished }
			}

		}
	}
}

##################################################
# Arguing the Toss
# by Ewan Cowhig Croft
# # 3011 - 3020
##################################################

scripted_trigger ep3_laamp_flavour_ewan_3011_eloquent_courtier_trigger = {
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
	diplomacy >= decent_skill_rating
}

scripted_trigger ep3_laamp_flavour_ewan_3011_wise_courtier_trigger = {
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
	learning >= decent_skill_rating
}

#	Scholars debate a learned follower.
ep3_laamp_flavour_ewan.3011 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.3011.t
	desc = ep3_laamp_flavour_ewan.3011.desc
	theme = laamp
	left_portrait = {
		character = scope:eloquent_follower
		animation = toast_goblet
	}
	right_portrait = {
		character = scope:wise_follower
		animation = writing
	}
	override_background = { reference = bp1_bonfire }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_3011 }
		}
		# Must have the correct camp purpose.
		has_realm_law = camp_purpose_scholars
		# And some suitable courtiers.
		any_courtier = { ep3_laamp_flavour_ewan_3011_eloquent_courtier_trigger = yes }
		## Check for at least two, if we only have one valid courtier for diplo, them also being the best courtier for learning doesn't cause a hole in the script.
		any_courtier = {
			count >= 2
			ep3_laamp_flavour_ewan_3011_wise_courtier_trigger = yes
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_3011
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_3011
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_long
			}
		}
		# Set up our courtiers.
		ordered_courtier = {
			limit = { ep3_laamp_flavour_ewan_3011_eloquent_courtier_trigger = yes }
			order_by = diplomacy
			save_scope_as = eloquent_follower
		}
		ordered_courtier = {
			limit = {
				ep3_laamp_flavour_ewan_3011_wise_courtier_trigger = yes
				this != scope:eloquent_follower
			}
			order_by = learning
			save_scope_as = wise_follower
		}
	}

	# Diplo duel the eloquent follower for prestige.
	option = {
		name = ep3_laamp_flavour_ewan.3011.a

		duel = {
			skill = diplomacy
			target = scope:eloquent_follower
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.3011.a.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.3011.a.tt.success
					left_icon = scope:eloquent_follower
					add_prestige = {
						if = {
							limit = { scope:eloquent_follower.diplomacy >= 32 }
							add = major_prestige_gain
						}
						else = { add = medium_prestige_gain }
					}
					reverse_add_opinion = {
						target = scope:eloquent_follower
						modifier = respect_opinion
						opinion = 40
					}
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.3011.a.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.3011.a.tt.failure
					left_icon = scope:eloquent_follower
					reverse_add_opinion = {
						target = scope:eloquent_follower
						modifier = respect_opinion
						opinion = 20
					}
				}
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 2 }
		}
	}

	# Learning duel the wise follower for prestige.
	option = {
		name = ep3_laamp_flavour_ewan.3011.b

		duel = {
			skill = learning
			target = scope:wise_follower
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.3011.b.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.3011.b.tt.success
					left_icon = scope:wise_follower
					add_prestige = {
						if = {
							limit = { scope:wise_follower.learning >= 32 }
							add = major_prestige_gain
						}
						else = { add = medium_prestige_gain }
					}
					reverse_add_opinion = {
						target = scope:wise_follower
						modifier = respect_opinion
						opinion = 40
					}
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.3011.b.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.3011.b.tt.failure
					left_icon = scope:wise_follower
					reverse_add_opinion = {
						target = scope:wise_follower
						modifier = respect_opinion
						opinion = 20
					}
				}
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 2 }
		}
	}

	# Nightly Debates: better version of the usual modifier.
	option = {
		name = ep3_laamp_flavour_ewan.3011.c
		trigger = {
			domicile = { has_domicile_building = camp_fire_nightly_debates }
		}
		reason = has_building_camp_fire_nightly_debates

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_3011_d_presiding_over_lively_debates_modifier
			years = 10
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -2 }
		}
	}

	# Nod along for a positive modifier.
	option = {
		name = ep3_laamp_flavour_ewan.3011.d
		trigger = {
			NOT = {
				domicile = { has_domicile_building = camp_fire_nightly_debates }
			}
		}

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_3011_d_presiding_over_debates_modifier
			years = 10
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = -1 }
		}
	}
}

##################################################
# Over the Horizon
# by Ewan Cowhig Croft
# # 3021 - 3030
##################################################

scripted_trigger ep3_laamp_flavour_ewan_3021_suitable_kingdom_to_dream_about_trigger = {
	save_temporary_scope_as = title_temp
	holder ?= {
		OR = {
			prestige_level >= high_prestige_level
			court_grandeur_current_level >= 6
		}
		root = {
			NOR = {
				knows_language_of_culture = prev.culture
				knows_language_of_culture = capital_county.culture
				current_extra_languages >= language_soft_cap
			}
			OR = {
				NOT = { has_variable = laamp_recently_visited_kingdoms }
				NOT = {
					is_target_in_variable_list = {
  						name = laamp_recently_visited_kingdoms
  						target = scope:title_temp
  					}
				}
			}
		}
		NOT = {
			has_any_moderate_bad_relationship_with_character_trigger = { CHARACTER = root }
		}
		# Put our performance-intensive checks riiiiight at the back, so we've ruled out as many places as possible by the time we get to these.
		## First a bunch of mass county-counting, but we only care about this for players.
		root = {
			trigger_if = {
				limit = { is_ai = no }
				NOT = {
					culture = {
						any_culture_kingdom = { this = scope:title_temp }
					}
				}
			}
		}
		## Then distance.
		capital_county.title_province = { "squared_distance(root.location)" >= squared_distance_massive }
	}
}

scripted_effect ep3_laamp_flavour_ewan_3021_choose_kingdom_effect = {
	# Make sure the contracts we're about to generate won't disappear.
	save_scope_value_as = {
		name = toggle_distance_ignore
		value = yes
	}
	# Now create our actual contracts.
	populate_location_with_special_contracts_effect = {
		AREA_CHAR = $KINGDOM$.holder
		AMOUNT = 5
	}
	# Then, an easier-than-usual learning duel to try to pick up the language from afar.
	duel = {
		skill = learning
		value = very_high_skill_rating
		# Victory!
		60 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = 3.5
				min = -49
			}
			min = 10
			desc = ep3_laamp_flavour_ewan.3021.tt.success
			send_interface_toast = {
				title = ep3_laamp_flavour_ewan.3021.tt.success
				learn_language_of_culture = $KINGDOM$.title_capital_county.culture
			}
		}
		# Defeat.
		40 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = -3.5
				min = -49
			}
			min = 5
			desc = ep3_laamp_flavour_ewan.3021.tt.failure
			send_interface_toast = {
				title = ep3_laamp_flavour_ewan.3021.tt.failure
				add_stress = medium_stress_gain
			}
		}
	}
}

#	Explorer gets a passion for stories of a distant land, populating contracts there & learning the local language.number.
ep3_laamp_flavour_ewan.3021 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.3021.t
	desc = ep3_laamp_flavour_ewan.3021.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = admiration
	}

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_3021 }
		}
		# Must have the correct camp purpose.
		has_realm_law = camp_purpose_explorers
		any_kingdom = {
			count >= 3
			ep3_laamp_flavour_ewan_3021_suitable_kingdom_to_dream_about_trigger = yes
		}
	}

	weight_multiplier = {
		# Weight this down for the AI, as we're doing a bunch of distance checks.
		modifier = {
			add = -0.9
			is_ai = yes
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_3021
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_3021
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Alright, let's pick some kingdoms.
		## First, put all the valid ones in a list.
		every_kingdom = {
			limit = { ep3_laamp_flavour_ewan_3021_suitable_kingdom_to_dream_about_trigger = yes }
			add_to_list = potential_kingdoms_list
		}
		ordered_in_list = {
			list = potential_kingdoms_list
			order_by = {
				holder = {
					# Go by CGV level first.
					add = {
						value = court_grandeur_current_level
						multiply = 1000
					}
					# Then prestige level.
					add = {
						value = prestige_level
						multiply = 100
					}
					# Then add diplomacy as a tie-breaker.
					add = diplomacy
				}
			}
			max = 3
			check_range_bounds = no
			if = {
				limit = {
					NOT = { exists = scope:kingdom_1 }
				}
				save_scope_as = kingdom_1
			}
			else_if = {
				limit = {
					NOT = {
						this = scope:kingdom_1
						exists = scope:kingdom_2
					}
				}
				save_scope_as = kingdom_2
			}
			else_if = {
				limit = {
					NOT = {
						this = scope:kingdom_1
						this = scope:kingdom_2
						exists = scope:kingdom_3
					}
				}
				save_scope_as = kingdom_3
			}
		}
	}

	# Scope:kingdom_1.
	option = {
		name = ep3_laamp_flavour_ewan.3021.a

		custom_tooltip = ep3_laamp_flavour_ewan.3021.tt.kingdom_1.contracts_appear
		ep3_laamp_flavour_ewan_3021_choose_kingdom_effect = { KINGDOM = scope:kingdom_1 }

		# No stress here.
		ai_chance = {
			base = 1
			modifier = {
				add = {
					value = "scope:kingdom_1.holder.capital_county.culture.cultural_acceptance(root.culture)"
					multiply = 2
				}
				always = yes
			}
		}
	}

	# Scope:kingdom_2.
	option = {
		name = ep3_laamp_flavour_ewan.3021.b

		custom_tooltip = ep3_laamp_flavour_ewan.3021.tt.kingdom_2.contracts_appear
		ep3_laamp_flavour_ewan_3021_choose_kingdom_effect = { KINGDOM = scope:kingdom_2 }

		# No stress here.
		ai_chance = {
			base = 1
			modifier = {
				add = {
					value = "scope:kingdom_2.holder.capital_county.culture.cultural_acceptance(root.culture)"
					multiply = 2
				}
				always = yes
			}
		}
	}

	# Scope:kingdom_3.
	option = {
		name = ep3_laamp_flavour_ewan.3021.c

		custom_tooltip = ep3_laamp_flavour_ewan.3021.tt.kingdom_3.contracts_appear
		ep3_laamp_flavour_ewan_3021_choose_kingdom_effect = { KINGDOM = scope:kingdom_3 }

		# No stress here.
		ai_chance = {
			base = 1
			modifier = {
				add = {
					value = "scope:kingdom_3.holder.capital_county.culture.cultural_acceptance(root.culture)"
					multiply = 2
				}
				always = yes
			}
		}
	}

	# I have places to ponder yet...
	option = {
		name = ep3_laamp_flavour_ewan.3021.d

		# Consolation prestige.
		add_prestige = minor_prestige_gain

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -3 }
		}
	}
}

##################################################
# Mine by Right
# by Ewan Cowhig Croft
# # 3031 - 3040
##################################################

scripted_trigger ep3_laamp_flavour_ewan_3031_family_title_trigger = {
	any_held_title = {
		title_tier >= kingdom
		save_temporary_scope_as = title_temp
		root = {
			NOT = { has_claim_on = scope:title_temp }
		}
	}
}

scripted_trigger ep3_laamp_flavour_ewan_3031_claim_adjacent_title_trigger = {
	holder ?= {
		any_held_title = {
			title_tier >= kingdom
			save_temporary_scope_as = title_temp2
			root = {
				NOR = {
					scope:title_temp ?= scope:title_temp2
					has_claim_on = scope:title_temp2
				}
			}
		}
	}
}

scripted_trigger ep3_laamp_flavour_ewan_3031_formerly_claimed_title_trigger = {
	has_memory_type = became_landless_adventurer_memory
	var:old_primary_title ?= {
		tier >= tier_kingdom
		save_temporary_scope_as = title_temp3
		root = {
			NOR = {
				scope:title_temp ?= this
				scope:title_temp2 ?= this
				has_claim_on = scope:title_temp3
			}
		}
	}
}

#	Legitimist broods & extends their claims.
ep3_laamp_flavour_ewan.3031 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.3031.t
	desc = {
		desc = ep3_laamp_flavour_ewan.3031.desc.intro
		triggered_desc = {
			trigger = { exists = scope:family_title }
			desc = ep3_laamp_flavour_ewan.3031.desc.family_title
		}
		triggered_desc = {
			trigger = { exists = scope:adjacent_title }
			desc = ep3_laamp_flavour_ewan.3031.desc.adjacent_title
		}
		triggered_desc = {
			trigger = { exists = scope:memory_title }
			desc = ep3_laamp_flavour_ewan.3031.desc.memory_title
		}
		desc = ep3_laamp_flavour_ewan.3031.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = spymaster
	}
	lower_left_portrait = scope:portrait_3
	lower_center_portrait = scope:portrait_2
	lower_right_portrait = scope:portrait_1

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_3031 }
		}
		# Must have the correct camp purpose.
		has_realm_law = camp_purpose_legitimists
		# Then make sure that we could populate at least one specific option.
		OR = {
			any_close_or_extended_family_member = { ep3_laamp_flavour_ewan_3031_family_title_trigger = yes }
			any_claim = { ep3_laamp_flavour_ewan_3031_claim_adjacent_title_trigger = yes }
			any_memory = { ep3_laamp_flavour_ewan_3031_formerly_claimed_title_trigger = yes }
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_3031
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_3031
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_short
			}
		}
		# Try to nab our titles.
		ordered_close_or_extended_family_member = {
			limit = { ep3_laamp_flavour_ewan_3031_family_title_trigger = yes }
			order_by = {
				# If we're a player, order it by their opinion of us.
				if = {
					limit = { is_ai = no }
					value = "reverse_opinion(root)"
				}
				# Otherwise, order by our opinion of them.
				else = { value = "opinion(root)" }
			}
			scope:title_temp = { save_scope_as = family_title }
		}
		ordered_claim = {
			limit = { ep3_laamp_flavour_ewan_3031_claim_adjacent_title_trigger = yes }
			order_by = {
				# If we're a player, order it by their opinion of us.
				if = {
					limit = { holder = { is_ai = no } }
					value = "holder.reverse_opinion(root)"
				}
				# Otherwise, order by our opinion of them.
				else = { value = "holder.opinion(root)" }
			}
			save_scope_as = adjacent_title
		}
		random_memory = {
			limit = { ep3_laamp_flavour_ewan_3031_formerly_claimed_title_trigger = yes }
			var:old_primary_title = { save_scope_as = memory_title }
		}
		# Sort our portrait scopes.
		scope:family_title ?= {
			holder = { save_scope_as = portrait_1 }
		}
		scope:adjacent_title ?= {
			if = {
				limit = { exists = scope:portrait_1 }
				holder = { save_scope_as = portrait_2 }
			}
			else = {
				holder = { save_scope_as = portrait_1 }
			}
		}
		scope:memory_title ?= {
			if = {
				limit = { exists = scope:portrait_2 }
				holder = { save_scope_as = portrait_3 }
			}
			else_if = {
				limit = { exists = scope:portrait_1 }
				holder = { save_scope_as = portrait_2 }
			}
			else = {
				holder = { save_scope_as = portrait_1 }
			}
		}
		# Account for some stress that'd apply in every option.
		stress_impact = {
			ambitious = medium_stress_impact_loss
			arrogant = medium_stress_impact_loss
		}
	}

	# Add the best extant title held by up to an extended family member.
	option = {
		name = ep3_laamp_flavour_ewan.3031.a
		trigger = { exists = scope:family_title }

		add_pressed_claim = scope:family_title
		reverse_add_opinion = {
			target = scope:family_title.holder
			modifier = audacity_opinion
			opinion = -30
		}

		stress_impact = {
			arbitrary = medium_stress_impact_loss
			just = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_greed = 1 }
			opinion_modifier = {
				opinion_target = scope:family_title.holder
				multiplier = -1
			}
		}
	}

	# Add another same-tier-or-higher title held by someone who holds a kingdom+title you have a claim on.
	option = {
		name = ep3_laamp_flavour_ewan.3031.b
		trigger = { exists = scope:adjacent_title }

		add_pressed_claim = scope:adjacent_title
		reverse_add_opinion = {
			target = scope:adjacent_title.holder
			modifier = audacity_opinion
			opinion = -30
		}

		stress_impact = {
			arbitrary = medium_stress_impact_loss
			just = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_greed = 1 }
			opinion_modifier = {
				opinion_target = scope:adjacent_title.holder
				multiplier = -1
			}
		}
	}

	# Regain claims to a title you have a memory of losing but don't have a claim on.
	option = {
		name = ep3_laamp_flavour_ewan.3031.c
		trigger = { exists = scope:memory_title }

		add_pressed_claim = scope:memory_title
		reverse_add_opinion = {
			target = scope:memory_title.holder
			modifier = audacity_opinion
			opinion = -30
		}

		stress_impact = {
			arbitrary = medium_stress_impact_loss
			just = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_greed = 1 }
			opinion_modifier = {
				opinion_target = scope:memory_title.holder
				multiplier = -1
			}
		}
	}

	# Fixate on future gains.
	option = {
		name = ep3_laamp_flavour_ewan.3031.d

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_3031_d_brooding_over_titles_modifier
			years = 10
		}

		# No stress for opt out.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = 2 }
		}
	}
}

##################################################
# People from a Better Time
# by Ewan Cowhig Croft
# # 3041 - 3050
##################################################

scripted_trigger ep3_laamp_flavour_ewan_3041_valid_memory_trigger = {
	has_memory_type = became_landless_adventurer_memory
	memory_age_years >= 5
	var:old_primary_title ?= { tier >= tier_kingdom }
}

scripted_effect ep3_laamp_flavour_ewan_3041_sort_partisan_titles_list_effect = {
	random_de_jure_county = {
		limit = {
			holder = {
				any_liege_or_above = { this = scope:former_title.holder }
			}
			NOT = { is_in_list = partisan_titles_list }
			# Make sure players don't get caught in the crossfire.
			trigger_if = {
				limit = {
					holder = { is_ai = no }
				}
				holder = scope:former_title.holder
			}
		}
		weight = {
			# Weight up stuff directly held by the usurper.
			modifier = {
				add = 10000
				holder = scope:former_title.holder
			}
			# And stuff adjacent to the capital, just to cluster the effects in large realms.
			modifier = {
				add = 100
				kingdom.title_capital_county = scope:former_title.capital_county
			}
		}
		add_to_list = partisan_titles_list
	}
}

#	Old loyalists join legitimist.
ep3_laamp_flavour_ewan.3041 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.3041.t
	desc = {
		desc = ep3_laamp_flavour_ewan.3041.desc.intro
		random_valid = {
			triggered_desc = {
				trigger = { has_trait = compassionate }
				desc = ep3_laamp_flavour_ewan.3041.desc.compassionate
			}
			triggered_desc = {
				trigger = { has_trait = sadistic }
				desc = ep3_laamp_flavour_ewan.3041.desc.sadistic
			}
			triggered_desc = {
				trigger = { has_trait = callous }
				desc = ep3_laamp_flavour_ewan.3041.desc.callous
			}
			triggered_desc = {
				trigger = { has_trait = wrathful }
				desc = ep3_laamp_flavour_ewan.3041.desc.wrathful
			}
			triggered_desc = {
				trigger = { has_trait = calm }
				desc = ep3_laamp_flavour_ewan.3041.desc.calm
			}
			triggered_desc = {
				trigger = { has_trait = arrogant }
				desc = ep3_laamp_flavour_ewan.3041.desc.arrogant
			}
			triggered_desc = {
				trigger = { has_trait = humble }
				desc = ep3_laamp_flavour_ewan.3041.desc.humble
			}
			triggered_desc = {
				trigger = { has_trait = ambitious }
				desc = ep3_laamp_flavour_ewan.3041.desc.ambitious
			}
			triggered_desc = {
				trigger = { has_trait = content }
				desc = ep3_laamp_flavour_ewan.3041.desc.content
			}
			triggered_desc = {
				trigger = { has_trait = arbitrary }
				desc = ep3_laamp_flavour_ewan.3041.desc.arbitrary
			}
			triggered_desc = {
				trigger = { has_trait = just }
				desc = ep3_laamp_flavour_ewan.3041.desc.just
			}
			triggered_desc = {
				trigger = {
					NOR = {
						has_trait = compassionate
						has_trait = sadistic
						has_trait = callous
						has_trait = wrathful
						has_trait = calm
						has_trait = arrogant
						has_trait = humble
						has_trait = ambitious
						has_trait = content
						has_trait = arbitrary
						has_trait = just
					}
				}
				desc = ep3_laamp_flavour_ewan.3041.desc.fallback
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = { has_claim_on = scope:former_title }
				desc = ep3_laamp_flavour_ewan.3041.desc.title_claimed
			}
			desc = ep3_laamp_flavour_ewan.3041.desc.title_forsaken
		}
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = personality_bold
	}
	right_portrait = {
		character = scope:commander
		animation = marshal
	}

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_3041 }
		}
		# Must have the correct camp purpose.
		has_realm_law = camp_purpose_legitimists
		# And we have to be doing something with our lives.
		prestige_level >= 2
		# Must have held a title some years ago.
		any_memory = { ep3_laamp_flavour_ewan_3041_valid_memory_trigger = yes }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_3041
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_3041
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_short
			}
		}
		# Nab our title.
		random_memory = {
			limit = { ep3_laamp_flavour_ewan_3041_valid_memory_trigger = yes }
			var:old_primary_title = { save_scope_as = former_title }
		}
		## Plus pick titles to be affected by our partisans.
		scope:former_title = {
			ep3_laamp_flavour_ewan_3041_sort_partisan_titles_list_effect = yes
			ep3_laamp_flavour_ewan_3041_sort_partisan_titles_list_effect = yes
			ep3_laamp_flavour_ewan_3041_sort_partisan_titles_list_effect = yes
			ep3_laamp_flavour_ewan_3041_sort_partisan_titles_list_effect = yes
			ep3_laamp_flavour_ewan_3041_sort_partisan_titles_list_effect = yes
			ep3_laamp_flavour_ewan_3041_sort_partisan_titles_list_effect = yes
			ep3_laamp_flavour_ewan_3041_sort_partisan_titles_list_effect = yes
			ep3_laamp_flavour_ewan_3041_sort_partisan_titles_list_effect = yes
			ep3_laamp_flavour_ewan_3041_sort_partisan_titles_list_effect = yes
			ep3_laamp_flavour_ewan_3041_sort_partisan_titles_list_effect = yes
		}
		# Create a commander for the troops.
		create_character = {
			template = new_commander_character
			culture = scope:former_title.capital_county.culture
			faith = scope:former_title.capital_county.faith
			location = root.location
			gender_female_chance = root_soldier_female_chance
			dynasty = none
			save_scope_as = commander
			after_creation = {
				add_opinion = {
					target = root
					modifier = loyalty_opinion
					opinion = 300
				}
			}
		}
		## Give 'em a nickname.
		hidden_effect = {
			scope:commander = { assign_random_nickname_effect = yes }
		}
	}

	# More troops for the royal army-in-exile!
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							any_claim = { tier >= tier_empire }
						}
						desc = ep3_laamp_flavour_ewan.3041.a.imperial
					}
					desc = ep3_laamp_flavour_ewan.3041.a.royal
				}
			}
		}

		add_courtier = scope:commander
		add_hook = {
			type = loyalty_hook
			target = scope:commander
		}
		spawn_army = {
			name = legitimist_loyalists
			levies = {
				value = 200
				# Increase this by a step for every prestige level we have beyond the minimum.
				add = {
					value = prestige_level
					add = -1
				}
			}
			men_at_arms = {
				type = armored_footmen
				men = {
					value = 200
					# Increase this by a step for every prestige level we have beyond the minimum.
					add = {
						value = prestige_level
						add = -1
					}
				}
			}
			location = root.location
			origin = scope:former_title.capital_county.title_province
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 2 }
		}
	}

	# Your loyalty is noted, but best used to subvert scope:usurper's rule [go reinforce peasant faction].
	option = {
		name = ep3_laamp_flavour_ewan.3041.b
		trigger = {
			NOT = { has_trait = deceitful }
			# Can't be used against players unless it's _both_ players.
			OR = {
				scope:former_title.holder = { is_ai = yes }
				AND = {
					is_ai = no
					scope:former_title.holder = { is_ai = no }
				}
			}
		}

		every_in_list = {
			list = partisan_titles_list
			custom = ep3_laamp_flavour_ewan.3041.tt.up_to_ten_usurper_held_counties
			change_county_control = -30
		}

		stress_impact = {
			deceitful = miniscule_stress_impact_loss
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = -2 }
		}
	}

	# Deceitful: as above, but better.
	option = {
		name = ep3_laamp_flavour_ewan.3041.c
		trigger = {
			has_trait = deceitful
			# Can't be used against players unless it's _both_ players.
			OR = {
				scope:former_title.holder = { is_ai = yes }
				AND = {
					is_ai = no
					scope:former_title.holder = { is_ai = no }
				}
			}
		}
		trait = deceitful

		every_in_list = {
			list = partisan_titles_list
			custom = ep3_laamp_flavour_ewan.3041.tt.up_to_ten_usurper_held_counties
			change_county_control = -50
		}

		stress_impact = {
			deceitful = miniscule_stress_impact_loss
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = -2 }
		}
	}

	# I thank you, but I do not _need_ you.
	option = {
		name = ep3_laamp_flavour_ewan.3041.d

		add_prestige = medium_prestige_gain

		stress_impact = {
			arrogant = miniscule_stress_impact_loss
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			# The AI should virtually never turn down free troops.
			base = 1
		}
	}

	after = {
		# Clean up our captain  if we're not a player.
		if = {
			limit = {
				is_ai = yes
				this != scope:captain.liege
			}
			scope:captain = {
				death = { death_reason = death_vanished }
			}
		}
	}
}

##################################################
# Map Painting
# by Ewan Cowhig Croft
# # 3051 - 3060
##################################################

scripted_effect ep3_laamp_flavour_ewan_3051_duel_and_spawn_artefact = {
	duel = {
		skill = diplomacy
		value = $DUEL_DIFF$
		# Victory!
		50 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = 3.5
				min = -49
			}
			min = 5
			desc = ep3_laamp_flavour_ewan.3051.tt.success
			send_interface_toast = {
				title = ep3_laamp_flavour_ewan.3051.tt.success
				create_artifact = {
					name = handcrafted_map
					description = {
						random_valid = {
							desc = handcrafted_map_desc.mythic_beasts
							desc = handcrafted_map_desc.geography
							desc = handcrafted_map_desc.settlements
							desc = handcrafted_map_desc.people.urban
							desc = handcrafted_map_desc.fauna
							desc = handcrafted_map_desc.flora
							desc = handcrafted_map_desc.government
							desc = handcrafted_map_desc.tourism_sites
							desc = handcrafted_map_desc.routes
							desc = handcrafted_map_desc.people.rural
						}
					}
					modifier = artifact_learning_$TIER$_modifier
					modifier = artifact_diplomacy_$TIER$_modifier
					type = miscellaneous
					rarity = $RARITY$
					visuals = pocket_map
					max_durability = 100
					save_scope_as = newly_created_map
				}
				scope:newly_created_map = {
					set_variable = {
						name = map_subject_title
						value = root.location.empire
					}
				}
			}
		}
		# Defeat.
		50 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = -3.5
				min = -49
			}
			min = 5
			desc = ep3_laamp_flavour_ewan.3051.tt.failure
			send_interface_toast = {
				title = ep3_laamp_flavour_ewan.3051.tt.failure
				add_stress = medium_stress_gain
			}
		}
	}
}

#	Explorer writes/draws map of local area.
ep3_laamp_flavour_ewan.3051 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.3051.t
	desc = ep3_laamp_flavour_ewan.3051.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = writing
	}
	artifact = {
		target = scope:newly_created_map
		position = lower_center_portrait
		trigger = { exists = scope:newly_created_map }
	}

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_3051 }
		}
		# Must have the correct camp purpose.
		has_realm_law = camp_purpose_explorers
		# For tonal reasons, you can't be blind.
		NOT = { has_trait = blind }
		# Can't already have a map of this empire.
		NOT = {
			any_artifact = {
				artifact_type = miscellaneous
				# Deliberately not using ?= in case the NOT makes it go wonky.
				has_variable = map_subject_title
				var:map_subject_title = root.location.empire
			}
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_3051
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_3051
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_long
			}
		}
		# Nab our location for loc.
		location.kingdom = { save_scope_as = kingdom }
	}

	# Go for an illustrious artefact.
	option = {
		name = ep3_laamp_flavour_ewan.3051.a

		ep3_laamp_flavour_ewan_3051_duel_and_spawn_artefact = {
			DUEL_DIFF = extremely_high_skill_rating
			RARITY = illustrious
			TIER = 3
		}

		stress_impact = {
			diligent = medium_stress_impact_loss
			lazy = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 3 }
		}
	}

	# Go for a famed artefact.
	option = {
		name = ep3_laamp_flavour_ewan.3051.b

		ep3_laamp_flavour_ewan_3051_duel_and_spawn_artefact = {
			DUEL_DIFF = very_high_skill_rating
			RARITY = famed
			TIER = 2
		}

		stress_impact = {
			diligent = minor_stress_impact_loss
			lazy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = 2 }
		}
	}

	# Go for a masterwork artefact.
	option = {
		name = ep3_laamp_flavour_ewan.3051.c

		ep3_laamp_flavour_ewan_3051_duel_and_spawn_artefact = {
			DUEL_DIFF = high_skill_rating
			RARITY = masterwork
			TIER = 1
		}

		stress_impact = {
			diligent = miniscule_stress_impact_loss
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 1 }
		}
	}

	# Simply have fun with it.
	option = {
		name = ep3_laamp_flavour_ewan.3051.d

		# Consolation prestige.
		add_prestige = medium_prestige_gain

		# Plus some solid stress loss.
		add_stress = medium_stress_loss
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -1 }
		}
	}
}

##################################################
# A Guide to ...
# by Ewan Cowhig Croft
# # 3061 - 3070
##################################################

#	Scholar writes book on local subject.
ep3_laamp_flavour_ewan.3061 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.3061.t
	desc = ep3_laamp_flavour_ewan.3061.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = writing
	}

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_3061 }
		}
		# Must have the correct camp purpose.
		has_realm_law = camp_purpose_scholars
		# For tonal reasons, you can't be blind.
		NOT = { has_trait = blind }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_3061
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_3061
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown
			}
		}
		# Save our county for loc.
		location.county = { save_scope_as = current_county }
	}

	# Write on peoples & places.
	option = {
		name = ep3_laamp_flavour_ewan.3061.a

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_3061_peoples_and_places_modifier
			years = 10
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = 1 }
		}
	}

	# Write on prose & poetry.
	option = {
		name = ep3_laamp_flavour_ewan.3061.b

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_3061_prose_and_poetry_modifier
			years = 10
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 1 }
		}
	}

	# Write on plants & animals.
	option = {
		name = ep3_laamp_flavour_ewan.3061.c

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_3061_plants_and_animals_modifier
			years = 10
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = 1 }
		}
	}

	# Simply doodle some thoughts.
	option = {
		name = ep3_laamp_flavour_ewan.3061.d

		# Mostly just stress relief.
		add_stress = major_stress_loss
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -1 }
		}
	}
}

##################################################
# The Law in Scope:location
# by Ewan Cowhig Croft
# # 3071 - 3080
##################################################

#	Law attacks criminal gang.
ep3_laamp_flavour_ewan.3071 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.3071.t
	desc = ep3_laamp_flavour_ewan.3071.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:local_soldier
		animation = random_weapon_aggressive
	}
	override_background = { reference = wilderness }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_3071 }
		}
		# Must have the correct camp purpose.
		has_realm_law = camp_purpose_brigands
		# Sheriffs'll still try even against an army, just picking their moment, but even they have their limits.
		current_military_strength < @ep3_laamp_flavour_ewan_baggage_train_has_very_significant_armed_force
		# Plus make sure that we're kind of a dick.
		calc_true_if = {
			amount >= 2
			# We'll either take moderate progress in at least two tracks...
			has_trait_xp = {
				trait = gallowsbait
				track = bandit
				value >= 30
			}
			has_trait_xp = {
				trait = gallowsbait
				track = trickster
				value >= 30
			}
			has_trait_xp = {
				trait = gallowsbait
				track = thief
				value >= 30
			}
			has_trait_xp = {
				trait = gallowsbait
				track = poacher
				value >= 30
			}
			has_trait_xp = {
				trait = gallowsbait
				track = marauder
				value >= 30
			}
			## Or getting significant progress in any one track (since this'll count the prior increment as a separate validated trigger).
			has_trait_xp = {
				trait = gallowsbait
				track = bandit
				value >= 60
			}
			has_trait_xp = {
				trait = gallowsbait
				track = trickster
				value >= 60
			}
			has_trait_xp = {
				trait = gallowsbait
				track = thief
				value >= 60
			}
			has_trait_xp = {
				trait = gallowsbait
				track = poacher
				value >= 60
			}
			has_trait_xp = {
				trait = gallowsbait
				track = marauder
				value >= 60
			}
		}
		# County checks.
		location.county = {
			# Must be in both a high-security area.
			county_control >= 100
			# And not currently doing a job for the land's ruler.
			holder = { save_temporary_scope_as = holder_temp }
			NOT = {
				root = {
					any_character_active_contract = {
						task_contract_employer ?= {
							save_temporary_scope_as = employer_temp
							OR = {
								this = scope:holder_temp
								scope:holder_temp = {
									any_liege_or_above = { this = scope:employer_temp }
								}
							}
						}
					}
				}
			}
			# Plus make sure that the holder doesn't actually think we're pretty chill.
			holder = {
				opinion = {
					target = root
					value <= 35
				}
				NOT = {
					has_any_moderate_good_relationship_with_character_trigger = { CHARACTER = root }
				}
			}
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_3071
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_3071
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_long
			}
		}
		# Create a local soldier.
		hidden_effect_new_object = {
			create_character = {
				template = new_warrior_character
				location = root.location
				culture = root.location.culture
				faith = root.location.faith
				gender_female_chance = root_soldier_female_chance
				save_scope_as = local_soldier
			}
			location.county.holder = { add_courtier = scope:local_soldier }
		}
		# Save our county for loc.
		location.county = { save_scope_as = current_county }
	}

	# SCE: duel the lead attacker.
	option = {
		name = ep3_laamp_flavour_ewan.3071.a
		trigger = { can_start_single_combat_trigger = yes }

		custom_tooltip = {
			text = duel_to_the_death.tt
			configure_start_single_combat_effect = {
				SC_INITIATOR = scope:local_soldier
				SC_ATTACKER = scope:local_soldier
				SC_DEFENDER = root
				FATALITY = always
				FIXED = no
				LOCALE = terrain_scope
				INVALIDATION_EVENT = single_combat.1006
				OUTPUT_EVENT = ep3_laamp_flavour_ewan.3072
			}
		}

		stress_impact = {
			brave = medium_stress_impact_loss
			craven = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 2 }
		}
	}

	# Intrigue insta-win: bring in your ambush immediately.
	option = {
		name = ep3_laamp_flavour_ewan.3071.b
		trigger = { intrigue >= extremely_high_skill_rating }
		skill = intrigue

		scope:local_soldier = {
			death = { death_reason = death_battle }
		}
		add_prestige = medium_prestige_gain

		stress_impact = { deceitful = minor_stress_impact_loss }
		ai_chance = {
			# Honour or no, if you can insta-win, do it.
			base = 1000
		}
	}

	# Intrigue duel: you've got men nearby who can help.
	option = {
		name = ep3_laamp_flavour_ewan.3071.c
		trigger = { intrigue < extremely_high_skill_rating }

		duel = {
			skill = intrigue
			value = high_skill_rating
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.3071.c.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.3071.c.tt.success
					left_icon = scope:local_soldier
					scope:local_soldier = {
						death = { death_reason = death_battle }
					}
					add_prestige = medium_prestige_gain
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.3071.c.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.3071.c.tt.failure
					left_icon = scope:local_soldier
					increase_wounds_effect = { REASON = battle }
					add_prestige = medium_prestige_loss
				}
			}
		}

		stress_impact = { deceitful = miniscule_stress_impact_loss }
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = -2 }
		}
	}

	# Martial insta-win: your party easily counter-attacks.
	option = {
		name = ep3_laamp_flavour_ewan.3071.d
		trigger = { martial >= extremely_high_skill_rating }
		skill = martial

		scope:local_soldier = {
			death = { death_reason = death_battle }
		}
		add_prestige = medium_prestige_gain

		# No stress here.
		ai_chance = {
			# Honour or no, if you can insta-win, do it.
			base = 1000
		}
	}

	# Martial duel: rally your small party against them.
	option = {
		name = ep3_laamp_flavour_ewan.3071.e
		trigger = { martial < extremely_high_skill_rating }

		duel = {
			skill = martial
			value = high_skill_rating
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.3071.e.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.3071.e.tt.success
					left_icon = scope:local_soldier
					scope:local_soldier = {
						death = { death_reason = death_battle }
					}
					add_prestige = medium_prestige_gain
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.3071.e.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.3071.e.tt.failure
					left_icon = scope:local_soldier
					increase_wounds_effect = { REASON = battle }
					add_prestige = medium_prestige_loss
				}
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_boldness = 1
				ai_rationality = 1
			}
		}
	}

	# Flee.
	option = {
		name = ep3_laamp_flavour_ewan.3071.f

		random_list = {
			100 = {
				desc = ep3_laamp_flavour_ewan.3071.f.success
				add_prestige = minor_prestige_loss
			}
			100 = {
				desc = ep3_laamp_flavour_ewan.3071.f.failure
				increase_wounds_effect = { REASON = battle }
				add_prestige = medium_prestige_loss
			}
		}

		stress_impact = {
			craven = medium_stress_impact_loss
			brave = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = -2 }
		}
	}
}

ep3_laamp_flavour_ewan.3072 = {
	hidden = yes

	immediate = {
		if = {
			limit = { scope:sc_victor = root }
			root = {
				trigger_event = {
					id = ep3_laamp_flavour_ewan.3073
					days = 1
				}
			}
		}
		# No else: doesn't really matter if root is dead now, does it?
	}
}

#	You won the single combat!
ep3_laamp_flavour_ewan.3073 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.3073.t
	desc = ep3_laamp_flavour_ewan.3073.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = random_weapon_celebrate
	}
	override_background = { reference = battlefield }

	# Victory!
	option = {
		name = ep3_laamp_flavour_ewan.3073.a

		# We give you a bit more than the usual amount, since you risked your life overtly.
		add_prestige = 250

		# No stress here.
		ai_chance = {
			# No logic needed for notification event.
			base = 1
		}
	}
}

##################################################
# Wrestle for It
# by Ewan Cowhig Croft
# # 3081 - 3090
##################################################

scripted_trigger ep3_laamp_flavour_ewan_3081_challenging_courtier_trigger = {
	can_start_single_combat_trigger = yes
	ep3_laamp_flavour_ewan_available_courtier_trigger = yes
	prowess >= medium_skill_rating
	is_knight = yes
	NOR = {
		has_trait = shy
		has_trait = humble
		has_trait = lazy
	}
	# This is a friendly challenge, so make sure we're not getting an utter bastard to do it.
	opinion = {
		target = root
		value >= 1
	}
}

#	Merc challenged to a wrastlin'.
ep3_laamp_flavour_ewan.3081 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.3081.t
	desc = ep3_laamp_flavour_ewan.3081.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = stayback
	}
	right_portrait = {
		character = scope:challenger
		animation = wrestling_victory
	}
	override_background = { reference = army_camp }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_3081 }
		}
		# Must have the correct camp purpose.
		has_realm_law = camp_purpose_mercenaries
		# We're not _actually_ going to use the SCE, but it's a good benchmark for whether wrestling would even make sense.
		can_start_single_combat_trigger = yes
		# And we should have at least one courtier who'd be game to try.
		any_courtier = { ep3_laamp_flavour_ewan_3081_challenging_courtier_trigger = yes }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_3081
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_3081
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_long
			}
		}
		# Grab a suitable courtier.
		ordered_courtier = {
			limit = { ep3_laamp_flavour_ewan_3081_challenging_courtier_trigger = yes }
			order_by = {
				value = prowess
				# A few traits let you skip the queue (partially).
				if = {
					limit = { has_trait = wrathful }
					add = 5
				}
				if = {
					limit = { has_trait = arrogant }
					add = 5
				}
				if = {
					limit = { has_trait = athletic }
					add = 5
				}
			}
			save_scope_as = challenger
		}
	}

	# Sure.
	option = {
		name = ep3_laamp_flavour_ewan.3081.a

		duel = {
			skill = prowess
			target = scope:challenger
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.3081.a.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.3081.a.tt.success
					left_icon = scope:challenger
					add_prestige = medium_prestige_gain
					reverse_add_opinion = {
						target = scope:challenger
						modifier = respect_opinion
						opinion = 40
					}
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.3081.a.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.3081.a.tt.failure
					left_icon = scope:challenger
					add_prestige = miniscule_prestige_gain
					reverse_add_opinion = {
						target = scope:challenger
						modifier = respect_opinion
						opinion = 20
					}
				}
			}
		}

		stress_impact = {
			humble = minor_stress_impact_loss
			gregarious = miniscule_stress_impact_loss
			shy = minor_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 2 }
			opinion_modifier = { opinion_target = scope:challenger }
		}
	}

	# Have HerHim beaten for even asking.
	option = {
		name = ep3_laamp_flavour_ewan.3081.b

		add_dread = 30
		reverse_add_opinion = {
			target = scope:challenger
			modifier = overreaction_opinion
			opinion = -50
		}
		scope:challenger = { increase_wounds_effect = { REASON = beaten } }

		stress_impact = {
			sadistic = medium_stress_impact_loss
			arrogant = minor_stress_impact_loss
			callous = miniscule_stress_impact_loss
			compassionate = minor_stress_impact_gain
			humble = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_vengefulness = 2 }
			opinion_modifier = {
				opinion_target = scope:challenger
				multiplier = -1
			}
		}
	}

	# Hah, no.
	option = {
		name = ep3_laamp_flavour_ewan.3081.c

		add_prestige = minor_prestige_gain
		reverse_add_opinion = {
			target = scope:challenger
			modifier = haughty_opinion
			opinion = -20
		}

		stress_impact = {
			arrogant = minor_stress_impact_loss
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = 2 }
		}
	}
}











##################################################
# TRAVEL DANGER / SUPPLIES


##################################################
# Bandits!
# by Ewan Cowhig Croft
# 4001 - 4010
##################################################

scripted_effect ep3_laamp_flavour_ewan_4001_duel_victory_effect = {
	add_prestige = {
		value = medium_prestige_gain
		if = {
			limit = { scope:sc_victor ?= root }
			# If you win the duel, we give you a bit more than the usual amount, since you risked your life overtly.
			add = 100
		}
	}
	every_courtier = {
		limit = { ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes }
		custom = custom.every_adult_follower
		add_opinion = {
			target = root
			modifier = respect_opinion
			opinion = 20
		}
	}
}

scripted_effect ep3_laamp_flavour_ewan_4001_duel_defeat_effect = {
	add_prestige = medium_prestige_loss
	increase_wounds_effect = { REASON = bandit_attack }
	domicile = {
		change_provisions = {
			value = scope:provisions_loss
			multiply = -1
		}
	}
}

#	Bandit raid whilst moving.
ep3_laamp_flavour_ewan.4001 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.4001.t
	desc = ep3_laamp_flavour_ewan.4001.desc
	theme = widgetless_travel_danger
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:bandit_leader
		animation = threatening
	}
	override_background = { reference = wilderness }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_available_travelling_adult = yes
		current_travel_plan = { is_travel_with_domicile = yes }
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_4001 }
		}
		# Must have the correct travel danger type.
		location = {
			travel_danger_type = {
				travel_plan = root.current_travel_plan
				type = county_control
			}
		}
		# Bandits won't attack forces over a certain size, even assuming you're spread out in a long line.
		current_military_strength < @ep3_laamp_flavour_ewan_baggage_train_has_significant_armed_force
	}

	immediate = {
		# Slow down in MP.
		mp_delay_travel_plan = { DAYS = 90 }
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_4001
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_4001
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_shorter
			}
			# Nab this as a scope, as we may need it if the duel finishes up.
			save_scope_as = laamp_title
		}
		# Increment XP.
		traveler_danger_xp_effect = {
			MIN = 1
			MAX = 3
		}
		# Create a hostile bandit.
		create_character = {
			template = bandit_character
			location = root.location
			culture = root.location.culture
			faith = root.location.faith
			martial = {
				min_template_decent_skill
				max_template_high_skill
			}
			prowess = {
				min_template_decent_skill
				max_template_high_skill
			}
			save_scope_as = bandit_leader
		}
		# How many provisions do we need to surrender?
		save_scope_value_as = {
			name = provisions_loss
			value = {
				add = domicile.provisions
				multiply = 0.33
				floor = yes
				min = @ep3_laamp_flavour_ewan_4000_min_provisions_worth_attacking
			}
		}
	}

	# Martial duel to repel them.
	option = {
		name = ep3_laamp_flavour_ewan.4001.a

		duel = {
			skill = martial
			target = scope:bandit_leader
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4001.a.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4001.a.tt.success
					left_icon = scope:bandit_leader
					ep3_laamp_flavour_ewan_4001_duel_victory_effect = yes
					scope:bandit_leader = {
						death = { death_reason = death_attacking_laamp_train }
					}
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4001.a.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4001.a.tt.failure
					left_icon = scope:bandit_leader
					ep3_laamp_flavour_ewan_4001_duel_defeat_effect = yes
				}
			}
		}

		stress_impact = {
			brave = miniscule_stress_impact_loss
			craven = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_boldness = 1
				ai_rationality = 1
			}
		}
	}

	# SCE: tackle the bandit leader head-on.
	option = {
		name = ep3_laamp_flavour_ewan.4001.b
		trigger = { can_start_single_combat_trigger = yes }

		custom_tooltip = {
			text = duel_to_the_death.tt
			configure_start_single_combat_effect = {
				SC_INITIATOR = root
				SC_ATTACKER = root
				SC_DEFENDER = scope:bandit_leader
				FATALITY = always
				FIXED = no
				LOCALE = terrain_scope
				INVALIDATION_EVENT = single_combat.1006
				OUTPUT_EVENT = ep3_laamp_flavour_ewan.4002
			}
		}

		stress_impact = {
			brave = medium_stress_impact_loss
			craven = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 2 }
		}
	}

	# Brigands: back off, little fish.
	option = {
		name = ep3_laamp_flavour_ewan.4001.c
		trigger = { has_realm_law = camp_purpose_brigands }
		reason = purpose_brigands

		duel = {
			skill = intrigue
			target = scope:bandit_leader
			# Victory!
			60 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4001.c.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4001.c.tt.success
					left_icon = scope:bandit_leader
					ep3_laamp_flavour_ewan_4001_duel_victory_effect = yes
				}
			}
			# Defeat.
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4001.c.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4001.c.tt.failure
					left_icon = scope:bandit_leader
					ep3_laamp_flavour_ewan_4001_duel_defeat_effect = yes
				}
			}
		}

		stress_impact = {
			arrogant = miniscule_stress_impact_loss
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = -2 }
		}
	}

	# Surrender an amount of provisions to them.
	option = {
		name = ep3_laamp_flavour_ewan.4001.d
		trigger = { domicile.provisions >= scope:provisions_loss }
		show_as_unavailable = { always = yes }

		add_prestige = miniscule_prestige_loss
		domicile = {
			change_provisions = {
				value = scope:provisions_loss
				multiply = -1
			}
		}

		stress_impact = {
			craven = major_stress_impact_loss
			brave = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = -2 }
		}
	}

	# If we're slowed due to multi, resume travel.
	after = { mp_resume_travel_plan = yes }
}

ep3_laamp_flavour_ewan.4002 = {
	hidden = yes

	immediate = {
		if = {
			limit = { scope:sc_victor = root }
			root = {
				trigger_event = {
					id = ep3_laamp_flavour_ewan.4003
					days = 1
				}
			}
		}
		else = {
			# Otherwise, remember to have the bandits loot.
			scope:laamp_title.holder.domicile = {
				change_provisions = {
					value = scope:provisions_loss
					multiply = -1
				}
			}
		}
	}
}

#	You won the single combat!
ep3_laamp_flavour_ewan.4003 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.4003.t
	desc = ep3_laamp_flavour_ewan.4003.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = random_weapon_celebrate
	}
	override_background = { reference = battlefield }

	# Victory!
	option = {
		name = ep3_laamp_flavour_ewan.4003.a

		ep3_laamp_flavour_ewan_4001_duel_victory_effect = yes

		# No stress here.
		ai_chance = {
			# No logic needed for notification event.
			base = 1
		}
	}
}

##################################################
# A Land of Milk & Honey
# by Ewan Cowhig Croft
# 4011 - 4020
##################################################

#	Bountiful hunting/foraging.
ep3_laamp_flavour_ewan.4011 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.4011.t
	desc = ep3_laamp_flavour_ewan.4011.desc
	theme = widgetless_travel
	left_portrait = {
		character = root
		animation = happiness
	}
	override_background = { reference = wilderness }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_available_travelling_adult = yes
		current_travel_plan = { is_travel_with_domicile = yes }
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_4011 }
		}
		# Must be in a nice, safe area with plentiful food.
		current_travel_plan.current_danger_value <= 0
		location = {
			county.county_control >= 100
			OR = {
				terrain = farmlands
				AND = {
					terrain = floodplains
					county.development_level >= 25
				}
			}
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_4011
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_4011
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_shorter
			}
		}
		# Everyone loses stress.
		stress_impact = {
			base = medium_stress_loss
			lazy = minor_stress_impact_loss
			gluttonous = minor_stress_impact_loss
		}
		every_courtier = {
			limit = { ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes }
			custom = custom.every_adult_follower
			# No complex impact because it'll make the tooltips wonky.
			add_stress = medium_stress_loss
		}
		# How many provisions do we take on?
		random_list = {
			100 = {
				save_scope_value_as = {
					name = provisions_gain
					value = medium_provisions_gain
				}
			}
			100 = {
				save_scope_value_as = {
					name = provisions_gain
					value = major_provisions_gain
				}
			}
			100 = {
				save_scope_value_as = {
					name = provisions_gain
					value = massive_provisions_gain
				}
			}
		}
		# Save our county for loc.
		location.county = { save_scope_as = current_county }
	}

	# Enjoy the fruits.
	option = {
		name = ep3_laamp_flavour_ewan.4011.a

		domicile = { change_provisions = scope:provisions_gain }

		# Stress handled in the immediate.
		ai_chance = {
			# Only one option, so no logic needed.
			base = 1
		}
	}
}

##################################################
# Parched
# by Ewan Cowhig Croft
# 4021 - 4030
##################################################

scripted_effect ep3_laamp_flavour_ewan_4021_camp_avoids_dehydration_effect = {
	add_prestige = minor_prestige_gain
	every_courtier = {
		limit = { ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes }
		custom = custom.every_adult_follower
		add_opinion = {
			target = root
			modifier = saviour_opinion
			opinion = 20
		}
	}
}

scripted_effect ep3_laamp_flavour_ewan_4021_increment_dehydration_effect = {
	if = {
		limit = { has_character_modifier = ep3_laamp_flavour_ewan_4021_extended_period_of_dehydration_t3_modifier }
		custom_tooltip = ep3_laamp_flavour_ewan.4021.tt.dehydration_already_at_worst
	}
	else_if = {
		limit = { has_character_modifier = ep3_laamp_flavour_ewan_4021_extended_period_of_dehydration_t2_modifier }
		hidden_effect = { remove_character_modifier = ep3_laamp_flavour_ewan_4021_extended_period_of_dehydration_t2_modifier }
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_4021_extended_period_of_dehydration_t3_modifier
			years = 10
		}
	}
	else_if = {
		limit = { has_character_modifier = ep3_laamp_flavour_ewan_4021_extended_period_of_dehydration_t1_modifier }
		hidden_effect = { remove_character_modifier = ep3_laamp_flavour_ewan_4021_extended_period_of_dehydration_t1_modifier }
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_4021_extended_period_of_dehydration_t2_modifier
			years = 10
		}
	}
	else = {
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_4021_extended_period_of_dehydration_t1_modifier
			years = 10
		}
	}
}

scripted_effect ep3_laamp_flavour_ewan_4021_camp_suffers_dehydration_effect = {
	if = {
		limit = { health <= good_health }
		ep3_laamp_flavour_ewan_4021_increment_dehydration_effect = yes
	}
	every_courtier = {
		limit = {
			location = root.location
			health <= good_health
		}
		custom = ep3_laamp_flavour_ewan.4021.tt.every_courtier_at_your_location_with_less_than_excellent_health
		custom_tooltip = ep3_laamp_flavour_ewan.4021.tt.dehydration_increments
		hidden_effect = { ep3_laamp_flavour_ewan_4021_increment_dehydration_effect = yes }
	}
}

scripted_effect ep3_laamp_flavour_ewan_4021_delegate_search_to_officer_effect = {
	custom_tooltip = ep3_laamp_flavour_ewan.4021.tt.officer_aptitude
	random_list = {
		0 = {
			desc = ep3_laamp_flavour_ewan.4021.tt.delegated_to_officer.success
			send_interface_toast = {
				title = ep3_laamp_flavour_ewan.4021.tt.delegated_to_officer.success
				left_icon = $OFFICER$
				ep3_laamp_flavour_ewan_4021_camp_avoids_dehydration_effect = yes
			}
			modifier = {
				add = {
					value = $APTITUDE$
					multiply = 20
					min = 5
					max = 95
				}
				always = yes
			}
		}
		0 = {
			desc = ep3_laamp_flavour_ewan.4021.tt.delegated_to_officer.failure
			send_interface_toast = {
				title = ep3_laamp_flavour_ewan.4021.tt.delegated_to_officer.failure
				left_icon = $OFFICER$
				ep3_laamp_flavour_ewan_4021_camp_suffers_dehydration_effect = yes
			}
			modifier = {
				add = {
					value = 100
					add = {
						add = $APTITUDE$
						multiply = -20
					}
					min = 5
					max = 95
				}
				always = yes
			}
		}
	}
}

#	Difficulty finding water.
ep3_laamp_flavour_ewan.4021 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.4021.t
	desc = ep3_laamp_flavour_ewan.4021.desc
	theme = widgetless_travel_danger
	left_portrait = {
		character = root
		animation = stress
	}
	lower_left_portrait = scope:portrait_1
	override_background = { reference = wilderness }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_available_travelling_adult = yes
		current_travel_plan = { is_travel_with_domicile = yes }
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_4021 }
		}
		# If we've already got the parched modifier, don't stack it past the max.
		NOT = { has_character_modifier = ep3_laamp_flavour_ewan_4021_extended_period_of_dehydration_t3_modifier }
		# Make sure we're not somewhere where we could credibly source water.
		location = {
			any_neighboring_province = { is_river_province = no }
			# You can't drink coastal ocean water except for some inland freshwater seas, but they will tend to have tributaries flowing into them so we allow it.
			is_coastal = no
		}
		# And make sure we're not absolutely swimming in supplies.
		domicile ?= { provisions <= sixty_percent_provisions_value }
		# Must have the correct travel danger type.
		location = {
			OR = {
				travel_danger_type = {
					travel_plan = root.current_travel_plan
					terrain = desert
				}
				travel_danger_type = {
					travel_plan = root.current_travel_plan
					terrain = desert_mountains
				}
				# Some terrains depend on season.
				AND = {
					is_nice_season_to_be_outside_trigger = { LOCATION = root.location }
					travel_danger_type = {
						travel_plan = root.current_travel_plan
						terrain = steppe
					}
				}
				AND = {
					is_nice_season_to_be_outside_trigger = { LOCATION = root.location }
					travel_danger_type = {
						travel_plan = root.current_travel_plan
						terrain = drylands
					}
				}
			}
		}
	}

	immediate = {
		# Slow down in MP.
		mp_delay_travel_plan = { DAYS = 90 }
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_4021
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_4021
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_shorter
			}
		}
		# Increment XP.
		traveler_danger_xp_effect = {
			MIN = 1
			MAX = 3
		}
		# If we have a forager or a huntsman, grab whichever is better at their job.
		court_position:chief_forager_camp_officer ?= {
			if = {
				limit = { ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes }
				save_scope_as = forager
				# We'll want their aptitude later.
				save_scope_value_as = {
					name = forager_apt
					value = "aptitude(chief_forager_camp_officer)"
				}
				# Plus, register who we're showing a portrait of.
				save_scope_as = portrait_1
			}
		}
		court_position:huntperson_camp_officer ?= {
			if = {
				limit = { ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes }
				save_scope_as = hunter
				# We'll want their aptitude later.
				save_scope_value_as = {
					name = hunter_apt
					value = "aptitude(huntperson_camp_officer)"
				}
				# Plus, register who we're showing a portrait of.
				save_scope_as = portrait_1
			}
		}
		# Sort whose event option will be displayed.
		## If we have both, pick whichever is better (preferring the forager).
		if = {
			limit = {
				exists = scope:forager
				exists = scope:hunter
			}
			if = {
				limit = { scope:forager_apt >= scope:hunter_apt }
				save_scope_value_as = {
					name = preferred_officer
					value = flag:forager
				}
			}
			else = {
				save_scope_value_as = {
					name = preferred_officer
					value = flag:hunter
				}
			}
		}
		else_if = {
			limit = { exists = scope:forager }
			save_scope_value_as = {
				name = preferred_officer
				value = flag:forager
			}
		}
		else_if = {
			limit = { exists = scope:hunter }
			save_scope_value_as = {
				name = preferred_officer
				value = flag:hunter
			}
		}
		# Sort our duel diff according to what terrain we're in.
		save_scope_value_as = {
			name = duel_diff
			value = {
				if = {
					limit = {
						location = { terrain = desert }
					}
					add = very_high_skill_rating
				}
				if = {
					limit = {
						location = { terrain = desert_mountains }
					}
					add = extremely_high_skill_rating
				}
				if = {
					limit = {
						location = { terrain = steppe }
					}
					add = high_skill_rating
				}
				if = {
					limit = {
						location = { terrain = drylands }
					}
					add = decent_skill_rating
				}
			}
		}
	}

	weight_multiplier = {
		modifier = {
			add = 1
			ep3_laamp_flavour_ewan_0041_access_sahara_provision_options_trigger = yes
		}
	}

	# Learning duel: there must be _something_ around here...
	option = {
		name = ep3_laamp_flavour_ewan.4021.a

		duel = {
			skill = intrigue
			value = scope:duel_diff
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4021.a.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4021.a.tt.success
					left_icon = scope:CHANGE_ME
					ep3_laamp_flavour_ewan_4021_camp_avoids_dehydration_effect = yes
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4021.a.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4021.a.tt.failure
					left_icon = scope:CHANGE_ME
					ep3_laamp_flavour_ewan_4021_camp_suffers_dehydration_effect = yes
				}
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 1 }
		}
	}

	# Chief forager: send them out searching.
	option = {
		name = ep3_laamp_flavour_ewan.4021.b
		trigger = { scope:preferred_officer ?= flag:forager }
		reason = have_chief_forager

		ep3_laamp_flavour_ewan_4021_delegate_search_to_officer_effect = {
			OFFICER = scope:forager
			APTITUDE = scope:forager_apt
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = 1 }
		}
	}

	# Huntsman: send them out searching.
	option = {
		name = ep3_laamp_flavour_ewan.4021.c
		trigger = { scope:preferred_officer ?= flag:hunter }
		reason = have_huntperson

		ep3_laamp_flavour_ewan_4021_delegate_search_to_officer_effect = {
			OFFICER = scope:hunter
			APTITUDE = scope:hunter_apt
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = 1 }
		}
	}

	# Reserve water: ration your way through this.
	option = {
		name = ep3_laamp_flavour_ewan.4021.d
		trigger = {
			domicile = { has_domicile_building = supply_tent_reserve_water }
		}
		reason = has_building_supply_tent_reserve_water

		add_prestige = minor_prestige_gain
		every_courtier = {
			limit = { ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes }
			custom = custom.every_adult_follower
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = 10
			}
		}

		# No stress here.
		ai_chance = {
			# If you have the good option, take the good option.
			base = 1000
		}
	}

	# Let's hope we're out of this hell soon.
	option = {
		name = ep3_laamp_flavour_ewan.4021.e

		random_list = {
			30 = {
				desc = ep3_laamp_flavour_ewan.4021.e.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4021.e.tt.success
					# Consolation prestige, since you took the "I'm inept and I did no planning" option.
					add_prestige = minor_prestige_gain
				}
				modifier = {
					add = -20
					location = { terrain = desert_mountains }
				}
				modifier = {
					add = 25
					location = { terrain = drylands }
				}
			}
			70 = {
				desc = ep3_laamp_flavour_ewan.4021.e.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4021.e.tt.failure
					ep3_laamp_flavour_ewan_4021_camp_suffers_dehydration_effect = yes
				}
				modifier = {
					add = 20
					location = { terrain = desert_mountains }
				}
				modifier = {
					add = -25
					location = { terrain = drylands }
				}
			}
		}

		stress_impact = {
			zealous = miniscule_stress_impact_loss
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -1 }
		}
	}

	# If we're slowed due to multi, resume travel.
	after = { mp_resume_travel_plan = yes }
}

##################################################
# Sickness in the Herd
# by Ewan Cowhig Croft
# 4031 - 4040
##################################################

scripted_effect ep3_laamp_flavour_ewan_4031_animals_treated_effect = {
	add_prestige = minor_prestige_gain
	every_courtier = {
		limit = { ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes }
		custom = custom.every_adult_follower
		add_opinion = {
			target = root
			modifier = respect_opinion
			opinion = 10
		}
	}
}

scripted_effect ep3_laamp_flavour_ewan_4031_sickness_spreads_through_herd_effect = {
	add_prestige = minor_prestige_loss
	add_character_modifier = {
		modifier = ep3_laamp_flavour_ewan_4031_sickness_spreads_through_herd_modifier
		years = 10
	}
}

scripted_effect ep3_laamp_flavour_ewan_4031_cull_sick_animals_apply_opinions_effect = {
	every_courtier = {
		limit = {
			location = root.location
			has_trait = callous
		}
		custom = custom.every_callous_follower
		add_opinion = {
			target = root
			modifier = practical_opinion
			opinion = 40
		}
	}
	every_courtier = {
		limit = {
			location = root.location
			has_trait = compassionate
		}
		custom = custom.every_compassionate_follower
		add_opinion = {
			target = root
			modifier = callous_opinion
			opinion = -40
		}
	}
}

#	Pack animals are sick or wounded.
ep3_laamp_flavour_ewan.4031 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.4031.t
	desc = ep3_laamp_flavour_ewan.4031.desc
	theme = widgetless_travel_danger
	left_portrait = {
		character = root
		animation = stress
	}
	lower_left_portrait = scope:groom
	override_background = { reference = wilderness }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_available_travelling_adult = yes
		current_travel_plan = { is_travel_with_domicile = yes }
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_4031 }
		}
		# Make sure we're not already suffering from the previous effects of sickness amongst the animals.
		NOR = {
			has_character_modifier = ep3_laamp_flavour_ewan_4031_sickness_affects_some_of_herd_modifier
			has_character_modifier = ep3_laamp_flavour_ewan_4031_sickness_spreads_through_herd_modifier
			has_character_modifier = ep3_laamp_flavour_ewan_4031_sickness_spreads_wildly_through_herd_modifier
			has_character_modifier = ep3_laamp_flavour_ewan_4031_callous_culled_herd_modifier
			has_character_modifier = ep3_laamp_flavour_ewan_4031_plentiful_steeds_culled_herd_modifier
			has_character_modifier = ep3_laamp_flavour_ewan_4031_callous_and_plentiful_steeds_culled_herd_modifier
		}
	}

	immediate = {
		# Slow down in MP.
		mp_delay_travel_plan = { DAYS = 90 }
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_4031
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_4031
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_shorter
			}
		}
		# Increment XP.
		traveler_danger_xp_effect = {
			MIN = 1
			MAX = 3
		}
		# If we have a groom, nab 'em.
		court_position:head_groom_camp_officer ?= {
			if = {
				limit = { ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes }
				save_scope_as = groom
				# We'll want their aptitude later.
				save_scope_value_as = {
					name = groom_apt
					value = "aptitude(head_groom_camp_officer)"
				}
			}
		}
	}

	# Learning duel to treat them.
	option = {
		name = ep3_laamp_flavour_ewan.4031.a

		duel = {
			skill = learning
			value = very_high_skill_rating
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4031.a.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4031.a.tt.success
					ep3_laamp_flavour_ewan_4031_animals_treated_effect = yes
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4031.a.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4031.a.tt.failure
					ep3_laamp_flavour_ewan_4031_sickness_spreads_through_herd_effect = yes
				}
			}
		}

		stress_impact = { compassionate = miniscule_stress_impact_loss }
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
			modifier = {
				add = 50
				highest_skill = learning
			}
		}
	}

	# Martial duel to treat them.
	option = {
		name = ep3_laamp_flavour_ewan.4031.b

		duel = {
			skill = martial
			value = very_high_skill_rating
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4031.b.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4031.b.tt.success
					ep3_laamp_flavour_ewan_4031_animals_treated_effect = yes
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4031.b.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4031.b.tt.failure
					ep3_laamp_flavour_ewan_4031_sickness_spreads_through_herd_effect = yes
				}
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
			modifier = {
				add = 50
				highest_skill = martial
			}
		}
	}

	# Head groom: up & at 'em m'droog.
	option = {
		name = ep3_laamp_flavour_ewan.4031.c
		trigger = { exists = scope:groom }

		random_list = {
			0 = {
				desc = ep3_laamp_flavour_ewan.4031.tt.delegated_to_officer.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4031.tt.delegated_to_officer.success
					left_icon = scope:groom
					ep3_laamp_flavour_ewan_4031_animals_treated_effect = yes
				}
				modifier = {
					add = {
						value = scope:groom_apt
						multiply = 20
						min = 5
						max = 95
					}
					always = yes
				}
			}
			0 = {
				desc = ep3_laamp_flavour_ewan.4031.tt.delegated_to_officer.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4031.tt.delegated_to_officer.failure
					left_icon = scope:groom
					ep3_laamp_flavour_ewan_4031_sickness_spreads_through_herd_effect = yes
				}
				modifier = {
					add = {
						value = 100
						add = {
							add = scope:groom_apt
							multiply = -20
						}
						min = 5
						max = 95
					}
					always = yes
				}
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = 1 }
		}
	}

	# Callous: slaughter and toss the sick ones, save the rest.
	option = {
		name = ep3_laamp_flavour_ewan.4031.d
		trigger = {
			has_trait = callous
			NOT = {
				domicile = { has_domicile_building = baggage_train_ample_steeds }
			}
		}
		trait = callous

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_4031_callous_culled_herd_modifier
			years = 10
		}
		ep3_laamp_flavour_ewan_4031_cull_sick_animals_apply_opinions_effect = yes

		stress_impact = { callous = medium_stress_impact_loss }
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -2 }
		}
	}

	# Plentiful Steeds: slaughter and toss the sick ones, save the rest.
	option = {
		name = ep3_laamp_flavour_ewan.4031.e
		trigger = {
			NOT = { has_trait = callous }
			domicile = { has_domicile_building = baggage_train_ample_steeds }
		}
		reason = has_building_baggage_train_ample_steeds

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_4031_plentiful_steeds_culled_herd_modifier
			years = 10
		}
		ep3_laamp_flavour_ewan_4031_cull_sick_animals_apply_opinions_effect = yes

		stress_impact = {
			callous = minor_stress_impact_loss
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -2 }
		}
	}

	# Callous & Plentiful Steeds: slaughter and toss the sick ones, save the rest.
	option = {
		name = ep3_laamp_flavour_ewan.4031.f
		trigger = {
			has_trait = callous
			domicile = { has_domicile_building = baggage_train_ample_steeds }
		}
		reason = is_callous_has_building_baggage_train_ample_steeds

		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_4031_callous_and_plentiful_steeds_culled_herd_modifier
			years = 10
		}
		ep3_laamp_flavour_ewan_4031_cull_sick_animals_apply_opinions_effect = yes

		stress_impact = { callous = major_stress_impact_loss }
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = -2 }
		}
	}

	# Carry on & pray to HealthGodName for mercy.
	option = {
		name = ep3_laamp_flavour_ewan.4031.g

		random_list = {
			10 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4031.g.tt.sickness_fades
					custom_tooltip = ep3_laamp_flavour_ewan.4031.g.tt.some_of_herd.tt
				}
			}
			30 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4031.g.tt.sickness_contained
					add_character_modifier = {
						modifier = ep3_laamp_flavour_ewan_4031_sickness_affects_some_of_herd_modifier
						years = 10
					}
				}
			}
			40 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4031.g.tt.sickness_spreads
					add_character_modifier = {
						modifier = ep3_laamp_flavour_ewan_4031_sickness_spreads_through_herd_modifier
						years = 10
					}
				}
			}
			20 = {
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4031.g.tt.sickness_spreads_wildly
					add_character_modifier = {
						modifier = ep3_laamp_flavour_ewan_4031_sickness_spreads_wildly_through_herd_modifier
						years = 10
					}
				}
			}
		}

		stress_impact = {
			zealous = miniscule_stress_impact_loss
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_zeal = 1 }
		}
	}

	# If we're slowed due to multi, resume travel.
	after = { mp_resume_travel_plan = yes }
}

##################################################
# Fortuna's Tithe
# by Ewan Cowhig Croft
# 4041 - 4050
##################################################

scripted_trigger ep3_laamp_flavour_ewan_4041_here_and_not_peak_health_trigger = {
	location = root.location
	health <= good_health
}

scripted_trigger ep3_laamp_flavour_ewan_4041_valid_regiment_trigger = {
	maa_current_troops_count >= 2
	root = {
		OR = {
			is_at_war = no
			AND = {
				is_at_war = yes
				prev = { is_raised = no }
			}
		}
	}
}

scripted_trigger ep3_laamp_flavour_ewan_4041_use_snowy_forest_backdrop_trigger = {
	OR = {
		scope:weather_type = flag:storm_snow
		scope:weather_type = flag:frozen_water
	}
}

scripted_effect ep3_laamp_flavour_ewan_4041_train_rallies_effect = {
	add_prestige = medium_prestige_gain
	every_courtier = {
		limit = { ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes }
		custom = custom.every_adult_follower
		add_opinion = {
			target = root
			modifier = saviour_opinion
			opinion = $OPINION$
		}
	}
}

scripted_effect ep3_laamp_flavour_ewan_4041_increment_hypothermia_effect = {
	if = {
		limit = { has_character_modifier = ep3_laamp_flavour_ewan_4041_hypothermia_t3_modifier }
		custom_tooltip = ep3_laamp_flavour_ewan.4041.tt.hypothermia_already_at_worst
	}
	else_if = {
		limit = { has_character_modifier = ep3_laamp_flavour_ewan_4041_hypothermia_t2_modifier }
		hidden_effect = { remove_character_modifier = ep3_laamp_flavour_ewan_4041_hypothermia_t2_modifier }
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_4041_hypothermia_t3_modifier
			years = 8
		}
	}
	else_if = {
		limit = { has_character_modifier = ep3_laamp_flavour_ewan_4041_hypothermia_t1_modifier }
		hidden_effect = { remove_character_modifier = ep3_laamp_flavour_ewan_4041_hypothermia_t1_modifier }
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_4041_hypothermia_t2_modifier
			years = 8
		}
	}
	else = {
		add_character_modifier = {
			modifier = ep3_laamp_flavour_ewan_4041_hypothermia_t1_modifier
			years = 8
		}
	}
}

scripted_effect ep3_laamp_flavour_ewan_4041_process_consequences_by_weather_type_effect = {
	switch = {
		trigger = scope:weather_type
		flag:storm_thunder = {
			every_courtier = {
				limit = { ep3_laamp_flavour_ewan_4041_here_and_not_peak_health_trigger = yes }
				custom = ep3_laamp_flavour_ewan.4021.tt.every_courtier_at_your_location_with_less_than_excellent_health
				random = {
					chance = 40
					custom_tooltip = ep3_laamp_flavour_ewan.4041.tt.hypothermia_increments
					hidden_effect = { ep3_laamp_flavour_ewan_4041_increment_hypothermia_effect = yes }
				}
				if = {
					limit = {
						NOR = {
							exists = scope:lightning_strike_happened
							root.primary_title = { has_variable = had_ep3_laamp_flavour_ewan_4041_lightning_strike }
						}
					}
					random = {
						chance = 1
						custom_tooltip = ep3_laamp_flavour_ewan.4041.tt.struck_by_lightning
						hidden_effect = {
							random_list = {
								60 = {
									increase_wounds_effect = { REASON = struck_by_lightning }
									increase_wounds_effect = { REASON = struck_by_lightning }
									increase_wounds_effect = { REASON = struck_by_lightning }
								}
								40 = {
									death = { death_reason = death_struck_by_lightning }
								}
							}
							save_scope_as = lightning_strike_happened
							root = {
								primary_title = {
									set_variable = {
										name = had_ep3_laamp_flavour_ewan_4041_lightning_strike
										value = scope:lightning_strike_happened
										years = 50
									}
								}
								send_interface_toast = {
									title = ep3_laamp_flavour_ewan.4041.tt.struck_by_lightning
									if = {
										limit = {
											scope:lightning_strike_happened = { is_alive = no }
										}
										custom_tooltip = ep3_laamp_flavour_ewan.4041.tt.struck_by_lightning.dead
									}
									else = { custom_tooltip = ep3_laamp_flavour_ewan.4041.tt.struck_by_lightning.alive }
								}
							}
						}
					}
				}
			}
		}
		flag:storm_wind = {
			every_courtier = {
				limit = { ep3_laamp_flavour_ewan_4041_here_and_not_peak_health_trigger = yes }
				custom = ep3_laamp_flavour_ewan.4021.tt.every_courtier_at_your_location_with_less_than_excellent_health
				random = {
					chance = 25
					custom_tooltip = ep3_laamp_flavour_ewan.4041.tt.hypothermia_increments
					hidden_effect = { ep3_laamp_flavour_ewan_4041_increment_hypothermia_effect = yes }
				}
			}
		}
		flag:storm_snow = {
			every_courtier = {
				limit = { ep3_laamp_flavour_ewan_4041_here_and_not_peak_health_trigger = yes }
				custom = ep3_laamp_flavour_ewan.4021.tt.every_courtier_at_your_location_with_less_than_excellent_health
				random = {
					chance = 60
					custom_tooltip = ep3_laamp_flavour_ewan.4041.tt.hypothermia_increments_twice
					hidden_effect = {
						ep3_laamp_flavour_ewan_4041_increment_hypothermia_effect = yes
						ep3_laamp_flavour_ewan_4041_increment_hypothermia_effect = yes
					}
				}
			}
		}
		flag:storm_sand = {
			every_courtier = {
				limit = { ep3_laamp_flavour_ewan_4041_here_and_not_peak_health_trigger = yes }
				custom = ep3_laamp_flavour_ewan.4021.tt.every_courtier_at_your_location_with_less_than_excellent_health
				random = {
					chance = 50
					custom_tooltip = ep3_laamp_flavour_ewan.4041.tt.modifier_worse_for_vulnerable_characters
					hidden_effect = {
						if = {
							limit = {
								OR = {
									is_adult = no
									AND = {
										is_female = yes
										age >= Define:NCharacter|FEMALE_ELDERLY_AGE
									}
									AND = {
										is_male = yes
										age >= Define:NCharacter|MALE_ELDERLY_AGE
									}
								}
							}
							add_character_modifier = {
								modifier = ep3_laamp_flavour_ewan_4041_sandstorm_lungs_vulnerable_modifier
								years = 10
							}
						}
						else = {
							add_character_modifier = {
								modifier = ep3_laamp_flavour_ewan_4041_sandstorm_lungs_adult_modifier
								years = 5
							}
						}
					}
				}
			}
		}
		flag:wild_fires = {
			every_courtier = {
				limit = { ep3_laamp_flavour_ewan_4041_here_and_not_peak_health_trigger = yes }
				custom = ep3_laamp_flavour_ewan.4021.tt.every_courtier_at_your_location_with_less_than_excellent_health
				random = {
					chance = 30
					custom_tooltip = ep3_laamp_flavour_ewan.4041.tt.modifier_worse_for_vulnerable_characters
					hidden_effect = {
						if = {
							limit = {
								OR = {
									is_adult = no
									AND = {
										is_female = yes
										age >= Define:NCharacter|FEMALE_ELDERLY_AGE
									}
									AND = {
										is_male = yes
										age >= Define:NCharacter|MALE_ELDERLY_AGE
									}
								}
							}
							add_character_modifier = {
								modifier = ep3_laamp_flavour_ewan_4041_wildfire_lungs_vulnerable_modifier
								years = 10
							}
						}
						else = {
							add_character_modifier = {
								modifier = ep3_laamp_flavour_ewan_4041_wildfire_lungs_adult_modifier
								years = 5
							}
						}
					}
				}
				if = {
					limit = {
						# Some people can always outrun the flames...
						trigger_if = {
							limit = {
								# ... unless fate has been especially cruel.
								NOT = { has_trait = one_legged }
							}
							NOR = {
								has_trait = athletic
								has_trait = strong
								has_trait = physique_good
							}
						}
					}
					random = {
						chance = 5
						death = { death_reason = death_burnt_in_wild_fire }
					}
				}
			}
			every_maa_regiment = {
				limit = { ep3_laamp_flavour_ewan_4041_valid_regiment_trigger = yes }
				custom = ep3_laamp_flavour_ewan.4041.tt.every_regiment
				random = {
					chance = 40
					custom_tooltip = ep3_laamp_flavour_ewan.4041.tt.regiments_take_damage_range.wildfire
					hidden_effect = {
						change_maa_troops_count = {
							value = maa_current_troops_count
							multiply = {
								integer_range = {
									min = ep3_laamp_flavour_ewan_4041_regiment_damage_wildfires_min
									max = ep3_laamp_flavour_ewan_4041_regiment_damage_wildfires_max
								}
							}
							multiply = -1
						}
					}
				}
			}
		}
		flag:avalanches = {
			every_courtier = {
				limit = { ep3_laamp_flavour_ewan_4041_here_and_not_peak_health_trigger = yes }
				custom = ep3_laamp_flavour_ewan.4021.tt.every_courtier_at_your_location_with_less_than_excellent_health
				random = {
					chance = 60
					custom_tooltip = ep3_laamp_flavour_ewan.4041.tt.hypothermia_increments_twice
					hidden_effect = {
						ep3_laamp_flavour_ewan_4041_increment_hypothermia_effect = yes
						ep3_laamp_flavour_ewan_4041_increment_hypothermia_effect = yes
					}
				}
				if = {
					limit = {
						NOR = {
							has_trait = winter_soldier
							has_trait = rough_terrain_expert
						}
					}
					random = {
						chance = 5
						death = { death_reason = death_swept_away_by_avalanche }
					}
				}
			}
			every_maa_regiment = {
				limit = { ep3_laamp_flavour_ewan_4041_valid_regiment_trigger = yes }
				custom = ep3_laamp_flavour_ewan.4041.tt.every_regiment
				random = {
					chance = {
						value = 40
						# Big ups to the Barcas.
						if = {
							limit = { is_unit_type = elephant_cavalry }
							add = 40
						}
					}
					custom_tooltip = ep3_laamp_flavour_ewan.4041.tt.regiments_take_damage_range.avalanche
					hidden_effect = {
						change_maa_troops_count = {
							value = maa_current_troops_count
							multiply = {
								integer_range = {
									min = ep3_laamp_flavour_ewan_4041_regiment_damage_avalanches_min
									max = ep3_laamp_flavour_ewan_4041_regiment_damage_avalanches_max
								}
							}
							multiply = -1
						}
					}
				}
			}
		}
		flag:flash_floods = {
			every_courtier = {
				limit = { ep3_laamp_flavour_ewan_4041_here_and_not_peak_health_trigger = yes }
				custom = ep3_laamp_flavour_ewan.4021.tt.every_courtier_at_your_location_with_less_than_excellent_health
				random = {
					chance = 30
					custom_tooltip = ep3_laamp_flavour_ewan.4041.tt.hypothermia_increments
					hidden_effect = { ep3_laamp_flavour_ewan_4041_increment_hypothermia_effect = yes }
				}
				if = {
					limit = {
						# Except strong/veteran swimmers...
						trigger_if = {
							limit = {
								# ... unless fate has been especially cruel.
								NOT = { has_trait = one_legged }
							}
							NOR = {
								has_trait = forder
								has_trait = athletic
								has_trait = strong
								has_trait = physique_good
							}
						}
					}
					random = {
						chance = 5
						death = { death_reason = death_swept_away_by_flash_flood }
					}
				}
			}
			every_maa_regiment = {
				limit = { ep3_laamp_flavour_ewan_4041_valid_regiment_trigger = yes }
				custom = ep3_laamp_flavour_ewan.4041.tt.every_regiment
				random = {
					chance = {
						value = 40
						# Big ups to the Barcas.
						if = {
							limit = { is_unit_type = elephant_cavalry }
							add = 40
						}
					}
					custom_tooltip = ep3_laamp_flavour_ewan.4041.tt.regiments_take_damage_range.flash_floods
					hidden_effect = {
						change_maa_troops_count = {
							value = maa_current_troops_count
							multiply = {
								integer_range = {
									min = ep3_laamp_flavour_ewan_4041_regiment_damage_flash_floods_min
									max = ep3_laamp_flavour_ewan_4041_regiment_damage_flash_floods_max
								}
							}
							multiply = -1
						}
					}
				}
			}
		}
		flag:frozen_water = {
			every_courtier = {
				limit = { ep3_laamp_flavour_ewan_4041_here_and_not_peak_health_trigger = yes }
				custom = ep3_laamp_flavour_ewan.4021.tt.every_courtier_at_your_location_with_less_than_excellent_health
				random = {
					chance = 50
					custom_tooltip = ep3_laamp_flavour_ewan.4041.tt.hypothermia_increments_twice
					hidden_effect = {
						ep3_laamp_flavour_ewan_4041_increment_hypothermia_effect = yes
						ep3_laamp_flavour_ewan_4041_increment_hypothermia_effect = yes
					}
				}
				if = {
					limit = {
						NOT = { has_trait = winter_soldier }
						# No swimming exception on this one: the shock of it, especially in thick winter clothing, is gonna paralyse you.
					}
					random = {
						chance = 5
						death = { death_reason = death_drowned_in_hidden_icy_water }
					}
				}
			}
			every_maa_regiment = {
				limit = { ep3_laamp_flavour_ewan_4041_valid_regiment_trigger = yes }
				custom = ep3_laamp_flavour_ewan.4041.tt.every_regiment
				random = {
					chance = {
						value = 30
						# Heavier MaA types & cavalry are screwed.
						if = {
							limit = {
								OR = {
									is_unit_type = elephant_cavalry
									is_unit_type = camel_cavalry
									is_unit_type = heavy_cavalry
									is_unit_type = light_cavalry
									is_unit_type = heavy_infantry
									is_unit_type = siege_weapon
								}
							}
							add = 30
						}
						# Anything lighter, or at least not mounted, can at least _try_ to bolt.
						else_if = {
							limit = {
								OR = {
									is_unit_type = skirmishers
									is_unit_type = archers
									is_unit_type = pikemen
								}
							}
							add = -20
						}
					}
					custom_tooltip = ep3_laamp_flavour_ewan.4041.tt.regiments_take_damage_range.frozen_water
					hidden_effect = {
						change_maa_troops_count = {
							value = maa_current_troops_count
							multiply = {
								integer_range = {
									min = ep3_laamp_flavour_ewan_4041_regiment_damage_frozen_water_min
									max = ep3_laamp_flavour_ewan_4041_regiment_damage_frozen_water_max
								}
							}
							multiply = -1
						}
					}
				}
			}
		}
		flag:earthquake = {
			every_courtier = {
				limit = { ep3_laamp_flavour_ewan_4041_here_and_not_peak_health_trigger = yes }
				custom = ep3_laamp_flavour_ewan.4021.tt.every_courtier_at_your_location_with_less_than_excellent_health
				random = {
					chance = 25
					death = { death_reason = death_consumed_by_earthquake }
				}
			}
			every_maa_regiment = {
				limit = { ep3_laamp_flavour_ewan_4041_valid_regiment_trigger = yes }
				custom = ep3_laamp_flavour_ewan.4041.tt.every_regiment
				random = {
					chance = {
						value = 50
						# Heavier MaA types are screwed.
						if = {
							limit = {
								OR = {
									is_unit_type = elephant_cavalry
									is_unit_type = heavy_infantry
									is_unit_type = siege_weapon
									is_unit_type = heavy_cavalry
								}
							}
							add = 30
						}
						# Anything lighter can at least _try_ to bolt.
						else_if = {
							limit = {
								OR = {
									is_unit_type = skirmishers
									is_unit_type = archers
								}
							}
							add = -30
						}
					}
					custom_tooltip = ep3_laamp_flavour_ewan.4041.tt.regiments_take_damage_range.earthquake
					hidden_effect = {
						change_maa_troops_count = {
							value = maa_current_troops_count
							multiply = {
								integer_range = {
									min = ep3_laamp_flavour_ewan_4041_regiment_damage_earthquake_min
									max = ep3_laamp_flavour_ewan_4041_regiment_damage_earthquake_max
								}
							}
							multiply = -1
						}
					}
				}
			}
		}
	}
}

#	Bad weather destroys wagons or pack animals.
ep3_laamp_flavour_ewan.4041 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.4041.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:weather_type = flag:storm_thunder }
				desc = ep3_laamp_flavour_ewan.4041.desc.weather_type.storm.thunder
			}
			triggered_desc = {
				trigger = { scope:weather_type = flag:storm_wind }
				desc = ep3_laamp_flavour_ewan.4041.desc.weather_type.storm.wind
			}
			triggered_desc = {
				trigger = { scope:weather_type = flag:storm_snow }
				desc = ep3_laamp_flavour_ewan.4041.desc.weather_type.storm.snow
			}
			triggered_desc = {
				trigger = { scope:weather_type = flag:storm_sand }
				desc = ep3_laamp_flavour_ewan.4041.desc.weather_type.storm.sand
			}
			triggered_desc = {
				trigger = { scope:weather_type = flag:wild_fires }
				desc = {
					desc = ep3_laamp_flavour_ewan.4041.desc.weather_type.wild_fires.intro
					first_valid = {
						triggered_desc = {
							trigger = {
								location = {
									OR = {
										terrain = steppe
										terrain = drylands
									}
								}
							}
							desc = ep3_laamp_flavour_ewan.4041.desc.weather_type.wild_fires.scrub
						}
						triggered_desc = {
							trigger = {
								location = {
									OR = {
										terrain = hills
										terrain = mountains
									}
								}
							}
							desc = ep3_laamp_flavour_ewan.4041.desc.weather_type.wild_fires.slopes
						}
						triggered_desc = {
							trigger = {
								location = {
									OR = {
										terrain = jungle
										terrain = forest
										terrain = taiga
									}
								}
							}
							desc = ep3_laamp_flavour_ewan.4041.desc.weather_type.wild_fires.treeline
						}
						desc = ep3_laamp_flavour_ewan.4041.desc.weather_type.wild_fires.fallback
					}
				}
			}
			triggered_desc = {
				trigger = { scope:weather_type = flag:avalanches }
				desc = ep3_laamp_flavour_ewan.4041.desc.weather_type.avalanche
			}
			triggered_desc = {
				trigger = { scope:weather_type = flag:flash_floods }
				desc = ep3_laamp_flavour_ewan.4041.desc.weather_type.flood
			}
			triggered_desc = {
				trigger = { scope:weather_type = flag:frozen_water }
				desc = ep3_laamp_flavour_ewan.4041.desc.weather_type.frozen_water
			}
			triggered_desc = {
				trigger = { scope:weather_type = flag:earthquake }
				desc = ep3_laamp_flavour_ewan.4041.desc.weather_type.earthquake
			}
		}
		desc = ep3_laamp_flavour_ewan.4041.desc.outro
	}
	theme = widgetless_travel_danger
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					scope:weather_type = flag:storm_thunder
					scope:weather_type = flag:storm_snow
					scope:weather_type = flag:storm_wind
				}
			}
			animation = shiver
		}
		animation = shock
	}
	override_background = {
		trigger = { ep3_laamp_flavour_ewan_4041_use_snowy_forest_backdrop_trigger = yes }
		reference = wilderness
	}
	override_background = {
		trigger = { ep3_laamp_flavour_ewan_4041_use_snowy_forest_backdrop_trigger = no }
		reference = wilderness
	}
	# ALL THE VFX!
	override_effect_2d = {
		trigger = { scope:weather_type = flag:wild_fires }
		reference = smoke
	}
	widgets = {
		widget = {
			is_shown = {
				OR = {
					scope:weather_type = flag:storm_snow
					scope:weather_type = flag:avalanches
					scope:weather_type = flag:frozen_water
				}
			}
			gui = "event_window_widget_vfx_snowstorm"
			container = "foreground_shader_vfx_container"
		}
		widget = {
			is_shown = { scope:weather_type = flag:storm_thunder }
			gui = "event_window_widget_vfx_lightning_storm"
			container = "foreground_shader_vfx_container"
		}
		widget = {
			is_shown = { scope:weather_type = flag:storm_wind }
			gui = "event_window_widget_vfx_rain_storm"
			container = "foreground_shader_vfx_container"
		}
		widget = {
			is_shown = { scope:weather_type = flag:storm_sand }
			gui = "event_window_widget_vfx_sandstorm"
			container = "foreground_shader_vfx_container"
		}
		widget = {
			is_shown = { scope:weather_type = flag:wild_fires }
			gui = "event_window_widget_vfx_heavy_smoke"
			container = "foreground_shader_vfx_container"
		}
		widget = {
			is_shown = { scope:weather_type = flag:flash_floods }
			gui = "event_window_widget_vfx_rainy_fog"
			container = "foreground_shader_vfx_container"
		}
		widget = {
			is_shown = { scope:weather_type = flag:earthquake }
			gui = "event_window_widget_vfx_earthquake"
			container = "foreground_shader_vfx_container"
		}
	}

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_available_travelling_adult = yes
		current_travel_plan = { is_travel_with_domicile = yes }
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_4041 }
		}
	}

	immediate = {
		# Slow down in MP.
		mp_delay_travel_plan = { DAYS = 90 }
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_4041
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_4041
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_shorter
			}
		}
		# Increment XP.
		traveler_danger_xp_effect = {
			MIN = 1
			MAX = 3
		}
		# Roll our severe weather type.
		random_list = {
			# Some storms can happen anywhere.
			## Thunder.
			250 = {
				trigger = {
					location = {
						NOR = {
							terrain = desert
							terrain = desert_mountains
							terrain = oasis
						}
					}
				}
				save_scope_value_as = {
					name = weather_type
					value = flag:storm_thunder
				}
			}
			## Wind.
			250 = {
				trigger = {
					location = {
						NOR = {
							terrain = desert
							terrain = desert_mountains
							terrain = oasis
						}
					}
				}
				save_scope_value_as = {
					name = weather_type
					value = flag:storm_wind
				}
			}
			# Snow storms.
			100 = {
				trigger = {
					location_has_normal_or_worse_winter_trigger = yes
					# Some people won't consider this excessive hardship.
					NOR = {
						culture_uses_frequent_winter_transportation_trigger = yes
						has_trait = winter_soldier
					}
				}
				save_scope_value_as = {
					name = weather_type
					value = flag:storm_snow
				}
			}
			# Sand storms.
			100 = {
				trigger = {
					location = {
						OR = {
							terrain = desert
							terrain = desert_mountains
							terrain = oasis
						}
					}
				}
				save_scope_value_as = {
					name = weather_type
					value = flag:storm_sand
				}
			}
			# Wild fires.
			100 = {
				trigger = {
					# Is it summer where we are?
					is_nice_season_to_be_outside_trigger = { LOCATION = root.location }
					# If so, proceed.
					location = {
						# Just in case, since winter may retreat late in Siberia but wild fires do happen.
						county = { county_has_winter_trigger = no }
						# Suitable terrains.
						OR = {
							terrain = plains
							terrain = farmlands
							terrain = hills
							terrain = mountains
							terrain = jungle
							terrain = forest
							terrain = taiga
							terrain = steppe
							terrain = drylands
						}
						# And places where they occur.
						OR = {
							geographical_region = world_europe_south
							geographical_region = world_europe_east
							geographical_region = world_asia_minor
							geographical_region = world_middle_east
							geographical_region = world_india
							geographical_region = world_africa
							geographical_region = world_steppe
							geographical_region = world_burma
							geographical_region = world_asia_china
							geographical_region = world_asia_japan
							geographical_region = world_asia_korea
							geographical_region = world_asia_southeast
						}
					}
				}
				save_scope_value_as = {
					name = weather_type
					value = flag:wild_fires
				}
			}
			# Avalanches.
			200 = {
				trigger = {
					location_has_normal_or_worse_winter_trigger = yes
					location = { terrain = mountains }
					# Some people won't consider this excessive hardship.
					NOR = {
						has_trait = rough_terrain_expert
						culture = { has_cultural_parameter = mountain_trait_bonuses }
					}
				}
				save_scope_value_as = {
					name = weather_type
					value = flag:avalanches
				}
			}
			# Flood.
			200 = {
				trigger = {
					OR = {
						location = {
							OR = {
								terrain = floodplains
								terrain = wetlands
							}
						}
						AND = {
							current_season_wet = yes
							location = {
								OR = {
									is_coastal = yes
									any_neighboring_province = { is_river_province = yes }
									terrain = plains
									terrain = hills
									terrain = farmlands
									terrain = jungle
									terrain = forest
								}
								# Some places will never have floods — not that they mightn't IRL, but they'd be potentially verisimilitude-breaking at a glance IG.
								NOR = {
									terrain = mountains
									terrain = desert
									terrain = desert_mountains
									terrain = oasis
								}
							}
						}
					}
					# Some people won't consider this excessive hardship.
					NOT = { has_trait = forder }
				}
				save_scope_value_as = {
					name = weather_type
					value = flag:flash_floods
				}
			}
			# Frozen water.
			200 = {
				trigger = {
					location_has_normal_or_worse_winter_trigger = yes
					location = {
						OR = {
							terrain = plains
							terrain = forest
							terrain = taiga
						}
					}
					# Rule out anyone who wouldn't be fooled by this.
					NOR = {
						culture_uses_frequent_winter_transportation_trigger = yes
						has_trait = winter_soldier
					}
				}
				save_scope_value_as = {
					name = weather_type
					value = flag:frozen_water
				}
			}
			# Earthquakes.
			10 = {
				trigger = {
					location = {
						OR = {
							geographical_region = world_europe_south_east
							geographical_region = world_europe_south_italy
							geographical_region = world_asia_minor
							geographical_region = world_middle_east_persia
							geographical_region = world_tibet
							geographical_region = world_himalaya
							geographical_region = world_burma
							geographical_region = world_asia_china
							geographical_region = world_asia_japan
							geographical_region = world_asia_korea
							geographical_region = world_asia_southeast
							# Plus some places but _only_ in their mountainous/hilly areas.
							AND = {
								geographical_region = ghw_region_iberia
								OR = {
									terrain = mountains
									terrain = desert_mountains
									terrain = hills
								}
							}
							AND = {
								geographical_region = ghw_region_north_africa
								OR = {
									terrain = mountains
									terrain = desert_mountains
									terrain = hills
								}
							}
							AND = {
								geographical_region = ghw_region_horn_of_africa
								OR = {
									terrain = mountains
									terrain = desert_mountains
									terrain = hills
								}
							}
						}
					}
				}
				save_scope_value_as = {
					name = weather_type
					value = flag:earthquake
				}
				# If this isn't the direct holding of a player, cause some serious damage.
				location.county.holder = {
					if = {
						limit = {
							NOT = { is_ai = yes }
						}
						random_courtier = {
							limit = { location = prev.location }
							death = { death_reason = death_consumed_by_earthquake }
						}
						random_courtier = {
							limit = { location = prev.location }
							death = { death_reason = death_consumed_by_earthquake }
						}
						random_courtier = {
							limit = { location = prev.location }
							death = { death_reason = death_consumed_by_earthquake }
						}
						random_courtier = {
							limit = { location = prev.location }
							death = { death_reason = death_consumed_by_earthquake }
						}
						prev = {
							change_development_level = {
								integer_range = {
									min = -35
									max = -10
								}
							}
							change_county_control = -100
						}
						random = {
							chance = 20
							death = { death_reason = death_consumed_by_earthquake }
						}
					}
				}
			}
		}
	}

	# Martial duel to get things going.
	option = {
		name = ep3_laamp_flavour_ewan.4041.a

		duel = {
			skill = martial
			value = very_high_skill_rating
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4041.a.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4041.a.tt.success
					ep3_laamp_flavour_ewan_4041_train_rallies_effect = { OPINION = 30 }
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4041.a.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4041.a.tt.failure
					ep3_laamp_flavour_ewan_4041_process_consequences_by_weather_type_effect = yes
				}
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 1 }
		}
	}

	# Stewardship duel to get things going.
	option = {
		name = ep3_laamp_flavour_ewan.4041.b

		duel = {
			skill = stewardship
			value = very_high_skill_rating
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4041.b.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4041.b.tt.success
					ep3_laamp_flavour_ewan_4041_train_rallies_effect = { OPINION = 30 }
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4041.b.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4041.b.tt.failure
					ep3_laamp_flavour_ewan_4041_process_consequences_by_weather_type_effect = yes
				}
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_greed = 1 }
		}
	}

	# Stubborn: come on, _heave_!
	option = {
		name = ep3_laamp_flavour_ewan.4041.c
		trigger = { has_trait = stubborn }
		trait = stubborn

		random_list = {
			50 = {
				desc = ep3_laamp_flavour_ewan.4041.c.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4041.c.tt.success
					ep3_laamp_flavour_ewan_4041_train_rallies_effect = { OPINION = 40 }
				}
			}
			50 = {
				desc = ep3_laamp_flavour_ewan.4041.c.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4041.c.tt.failure
					ep3_laamp_flavour_ewan_4041_process_consequences_by_weather_type_effect = yes
				}
			}
		}

		stress_impact = { stubborn = minor_stress_impact_loss }
		ai_chance = {
			# If you're stubborn, you're quite likely to uhhh... be stubborn.
			base = 100
		}
	}

	# Pray to FateGodName & hope.
	option = {
		name = ep3_laamp_flavour_ewan.4041.d
		trigger = {
			NOT = { has_trait = stubborn }
		}

		random_list = {
			25 = {
				desc = ep3_laamp_flavour_ewan.4041.d.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4041.d.tt.success
					add_prestige = minor_prestige_gain
				}
			}
			75 = {
				desc = ep3_laamp_flavour_ewan.4041.d.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4041.d.tt.failure
					add_piety = minor_piety_loss
					ep3_laamp_flavour_ewan_4041_process_consequences_by_weather_type_effect = yes
				}
			}
		}

		stress_impact = {
			zealous = miniscule_stress_impact_loss
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_zeal = 1 }
		}
	}

	# If we're slowed due to multi, resume travel.
	after = { mp_resume_travel_plan = yes }
}

##################################################
# Supplies Unaccounted For
# by Ewan Cowhig Croft
# 4051 - 4060
##################################################

scripted_effect ep3_laamp_flavour_ewan_4051_roll_duel_effect = {
	duel = {
		skill = $SKILL$
		value = very_high_skill_rating
		# Victory!
		50 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = 3.5
				min = -49
			}
			min = 5
			desc = $VICTORY_LOC$
			send_interface_toast = {
				title = $VICTORY_LOC$
				add_prestige = minor_prestige_gain
				custom_tooltip = ep3_laamp_flavour_ewan.4051.tt.most_provisions_regained
				domicile = {
					change_provisions = {
						value = scope:provisions_tally
						multiply = 0.8
						ceiling = yes
					}
				}
			}
		}
		# Defeat.
		50 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = -3.5
				min = -49
			}
			min = 5
			desc = $DEFEAT_LOC$
			send_interface_toast = {
				title = $DEFEAT_LOC$
				random_list = {
					40 = {
						custom_tooltip = ep3_laamp_flavour_ewan.4051.tt.some_provisions_regained
						domicile = {
							change_provisions = {
								value = scope:provisions_tally
								multiply = 0.2
								ceiling = yes
							}
						}
					}
					60 = { custom_tooltip = ep3_laamp_flavour_ewan.4051.tt.provisions_lost }
				}
			}
		}
	}
}

#	Supplies go missing in large armies.
ep3_laamp_flavour_ewan.4051 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.4051.t
	desc = ep3_laamp_flavour_ewan.4051.desc
	theme = widgetless_travel_danger
	left_portrait = {
		character = root
		animation = anger
	}
	override_background = { reference = army_camp }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_available_travelling_adult = yes
		current_travel_plan = { is_travel_with_domicile = yes }
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_4051 }
		}
		# No one would seriously try this in a smaller baggage train.
		## Outside of that one gallowsbait event, of course.
		current_military_strength >= @ep3_laamp_flavour_ewan_baggage_train_has_significant_armed_force
		# Plus make sure we've got enough provisions for someone to try it on.
		domicile.provisions >= @ep3_laamp_flavour_ewan_4051_minimum_provisions_count
	}

	immediate = {
		# Slow down in MP.
		mp_delay_travel_plan = { DAYS = 90 }
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_4051
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_4051
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_shorter
			}
		}
		# Increment XP.
		traveler_danger_xp_effect = {
			MIN = 1
			MAX = 3
		}
		# Lose an amount of provisions scaling to how many we currently have.
		domicile = {
			if = {
				limit = { provisions >= 1000 }
				# Register how many we're expending so we can try to get most of them back.
				save_scope_value_as = {
					name = provisions_tally
					value = 300
				}
				change_provisions = {
					value = scope:provisions_tally
					multiply = -1
				}
			}
			else_if = {
				limit = { provisions >= 750 }
				# Register how many we're expending so we can try to get most of them back.
				save_scope_value_as = {
					name = provisions_tally
					value = 250
				}
				change_provisions = {
					value = scope:provisions_tally
					multiply = -1
				}
			}
			else_if = {
				limit = { provisions >= 500 }
				# Register how many we're expending so we can try to get most of them back.
				save_scope_value_as = {
					name = provisions_tally
					value = 150
				}
				change_provisions = {
					value = scope:provisions_tally
					multiply = -1
				}
			}
			else_if = {
				limit = { provisions >= 250 }
				# Register how many we're expending so we can try to get most of them back.
				save_scope_value_as = {
					name = provisions_tally
					value = 75
				}
				change_provisions = {
					value = scope:provisions_tally
					multiply = -1
				}
			}
			else = {
				# Register how many we're expending so we can try to get most of them back.
				save_scope_value_as = {
					name = provisions_tally
					value = 50
				}
				change_provisions = {
					value = scope:provisions_tally
					multiply = -1
				}
			}
		}
	}

	# Martial duel to find who's responsible.
	option = {
		name = ep3_laamp_flavour_ewan.4051.a

		ep3_laamp_flavour_ewan_4051_roll_duel_effect = {
			SKILL = martial
			VICTORY_LOC = ep3_laamp_flavour_ewan.4051.a.tt.success
			DEFEAT_LOC = ep3_laamp_flavour_ewan.4051.a.tt.failure
		}

		stress_impact = { wrathful = miniscule_stress_impact_loss }
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 1 }
		}
	}

	# Stewardship duel to find who's responsible.
	option = {
		name = ep3_laamp_flavour_ewan.4051.b

		ep3_laamp_flavour_ewan_4051_roll_duel_effect = {
			SKILL = stewardship
			VICTORY_LOC = ep3_laamp_flavour_ewan.4051.b.tt.success
			DEFEAT_LOC = ep3_laamp_flavour_ewan.4051.b.tt.failure
		}

		stress_impact = { diligent = miniscule_stress_impact_loss }
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_greed = 1 }
		}
	}

	# Intrigue duel to find who's responsible.
	option = {
		name = ep3_laamp_flavour_ewan.4051.c

		ep3_laamp_flavour_ewan_4051_roll_duel_effect = {
			SKILL = intrigue
			VICTORY_LOC = ep3_laamp_flavour_ewan.4051.c.tt.success
			DEFEAT_LOC = ep3_laamp_flavour_ewan.4051.c.tt.failure
		}

		stress_impact = { deceitful = miniscule_stress_impact_loss }
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_honor = -1 }
		}
	}

	# If we're slowed due to multi, resume travel.
	after = { mp_resume_travel_plan = yes }
}

##################################################
# Eyes in the Night
# by Ewan Cowhig Croft
# 4061 - 4070
##################################################

scripted_trigger ep3_laamp_flavour_ewan_4061_local_cannibal_trigger = {
	OR = {
		has_trait = cannibal
		any_secret = { type = secret_cannibal }
	}
}

scripted_effect ep3_laamp_flavour_ewan_4061_roll_animal_size_effect = {
	# Alright, figure out how big our size mult'll be.
	save_scope_value_as = {
		name = hunter_size
		value = {
			integer_range = {
				min = $MIN$
				max = $MAX$
			}
		}
	}
	# And set up our duel diffs.
	save_scope_value_as = {
		name = duel_diff_safe
		value = {
			value = scope:hunter_size
			multiply = 2.5
			floor = yes
			min = 10
			max = 20
		}
	}
	save_scope_value_as = {
		name = duel_diff_risky
		value = {
			value = scope:hunter_size
			multiply = 3.5
			floor = yes
		}
	}
}

scripted_effect ep3_laamp_flavour_ewan_4061_roll_courtier_deaths_effect = {
	if = {
		limit = { scope:hunter_size >= 9 }
		random_courtier = {
			limit = { location = root.location }
			weight = {
				base = 50
				modifier = {
					add = {
						add = prowess
						add = {
							value = martial
							multiply = 0.5
						}
						multiply = -1
					}
				}
			}
			save_scope_as = death_1
			death = { death_reason = death_hunted_by_wild_beast }
		}
		random_courtier = {
			limit = {
				location = root.location
				this != scope:death_1
			}
			weight = {
				base = 50
				modifier = {
					add = {
						add = prowess
						add = {
							value = martial
							multiply = 0.5
						}
						multiply = -1
					}
				}
			}
			save_scope_as = death_2
			death = { death_reason = death_hunted_by_wild_beast }
		}
		random_courtier = {
			limit = {
				location = root.location
				NOR = {
					this = scope:death_1
					this = scope:death_2
				}
			}
			weight = {
				base = 50
				modifier = {
					add = {
						add = prowess
						add = {
							value = martial
							multiply = 0.5
						}
						multiply = -1
					}
				}
			}
			save_scope_as = death_3
			death = { death_reason = death_hunted_by_wild_beast }
		}
		random_courtier = {
			limit = {
				location = root.location
				NOR = {
					this = scope:death_1
					this = scope:death_2
					this = scope:death_3
				}
			}
			weight = {
				base = 50
				modifier = {
					add = {
						add = prowess
						add = {
							value = martial
							multiply = 0.5
						}
						multiply = -1
					}
				}
			}
			death = { death_reason = death_hunted_by_wild_beast }
		}
	}
	else_if = {
		limit = { scope:hunter_size >= 6 }
		random_courtier = {
			limit = { location = root.location }
			weight = {
				base = 50
				modifier = {
					add = {
						add = prowess
						add = {
							value = martial
							multiply = 0.5
						}
						multiply = -1
					}
				}
			}
			save_scope_as = death_1
			death = { death_reason = death_hunted_by_wild_beast }
		}
		random_courtier = {
			limit = {
				location = root.location
				this != scope:death_1
			}
			weight = {
				base = 50
				modifier = {
					add = {
						add = prowess
						add = {
							value = martial
							multiply = 0.5
						}
						multiply = -1
					}
				}
			}
			save_scope_as = death_2
			death = { death_reason = death_hunted_by_wild_beast }
		}
		random_courtier = {
			limit = {
				location = root.location
				NOR = {
					this = scope:death_1
					this = scope:death_2
				}
			}
			weight = {
				base = 50
				modifier = {
					add = {
						add = prowess
						add = {
							value = martial
							multiply = 0.5
						}
						multiply = -1
					}
				}
			}
			death = { death_reason = death_hunted_by_wild_beast }
		}
	}
	else_if = {
		limit = { scope:hunter_size >= 3 }
		random_courtier = {
			limit = { location = root.location }
			weight = {
				base = 50
				modifier = {
					add = {
						add = prowess
						add = {
							value = martial
							multiply = 0.5
						}
						multiply = -1
					}
				}
			}
			save_scope_as = death_1
			death = { death_reason = death_hunted_by_wild_beast }
		}
		random_courtier = {
			limit = {
				location = root.location
				this != scope:death_1
			}
			weight = {
				base = 50
				modifier = {
					add = {
						add = prowess
						add = {
							value = martial
							multiply = 0.5
						}
						multiply = -1
					}
				}
			}
			save_scope_as = death_2
			death = { death_reason = death_hunted_by_wild_beast }
		}
	}
	else = {
		random_courtier = {
			limit = { location = root.location }
			weight = {
				base = 50
				modifier = {
					add = {
						add = prowess
						add = {
							value = martial
							multiply = 0.5
						}
						multiply = -1
					}
				}
			}
			death = { death_reason = death_hunted_by_wild_beast }
		}
	}
}

#	Local predator picking off people each evening.
ep3_laamp_flavour_ewan.4061 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.4061.t
	desc = {
		desc = ep3_laamp_flavour_ewan.4061.desc.intro
		# Animal size.
		first_valid = {
			triggered_desc = {
				trigger = { scope:hunter_size >= 12 }
				desc = ep3_laamp_flavour_ewan.4061.desc.size.titanic
			}
			triggered_desc = {
				trigger = { scope:hunter_size >= 10 }
				desc = ep3_laamp_flavour_ewan.4061.desc.size.colossal
			}
			triggered_desc = {
				trigger = { scope:hunter_size >= 8 }
				desc = ep3_laamp_flavour_ewan.4061.desc.size.mammoth
			}
			triggered_desc = {
				trigger = { scope:hunter_size >= 6 }
				desc = ep3_laamp_flavour_ewan.4061.desc.size.huge
			}
			triggered_desc = {
				trigger = { scope:hunter_size >= 4 }
				desc = ep3_laamp_flavour_ewan.4061.desc.size.large
			}
			desc = ep3_laamp_flavour_ewan.4061.desc.size.nimble
		}
		desc = ep3_laamp_flavour_ewan.4061.desc.midtro
		# Sight.
		first_valid = {
			triggered_desc = {
				trigger = { has_trait = blind }
				desc = ep3_laamp_flavour_ewan.4061.desc.sight.blind
			}
			desc = ep3_laamp_flavour_ewan.4061.desc.sight.sighted
		}
		# Terrain
		first_valid = {
			triggered_desc = {
				trigger = {
					location = {
						any_neighboring_province = { is_river_province = yes }
					}
				}
				desc = ep3_laamp_flavour_ewan.4061.desc.terrain.major_river
			}
			triggered_desc = {
				trigger = {
					location = { terrain = farmlands }
				}
				desc = ep3_laamp_flavour_ewan.4061.desc.terrain.farmlands
			}
			triggered_desc = {
				trigger = {
					location = { terrain = hills }
				}
				desc = ep3_laamp_flavour_ewan.4061.desc.terrain.hills
			}
			triggered_desc = {
				trigger = {
					location = { terrain = mountains }
				}
				desc = ep3_laamp_flavour_ewan.4061.desc.terrain.mountains
			}
			triggered_desc = {
				trigger = {
					location = { terrain = desert }
				}
				desc = ep3_laamp_flavour_ewan.4061.desc.terrain.desert
			}
			triggered_desc = {
				trigger = {
					location = { terrain = desert_mountains }
				}
				desc = ep3_laamp_flavour_ewan.4061.desc.terrain.desert_mountains
			}
			triggered_desc = {
				trigger = {
					location = { terrain = oasis }
				}
				desc = ep3_laamp_flavour_ewan.4061.desc.terrain.oasis
			}
			triggered_desc = {
				trigger = {
					location = { terrain = jungle }
				}
				desc = ep3_laamp_flavour_ewan.4061.desc.terrain.jungle
			}
			triggered_desc = {
				trigger = {
					location = { terrain = forest }
				}
				desc = ep3_laamp_flavour_ewan.4061.desc.terrain.forest
			}
			triggered_desc = {
				trigger = {
					location = { terrain = taiga }
				}
				desc = ep3_laamp_flavour_ewan.4061.desc.terrain.taiga
			}
			triggered_desc = {
				trigger = {
					location = { terrain = wetlands }
				}
				desc = ep3_laamp_flavour_ewan.4061.desc.terrain.wetlands
			}
			triggered_desc = {
				trigger = {
					location = { terrain = steppe }
				}
				desc = ep3_laamp_flavour_ewan.4061.desc.terrain.steppe
			}
			triggered_desc = {
				trigger = {
					location = { terrain = floodplains }
				}
				desc = ep3_laamp_flavour_ewan.4061.desc.terrain.floodplains
			}
			triggered_desc = {
				trigger = {
					location = { terrain = drylands }
				}
				desc = ep3_laamp_flavour_ewan.4061.desc.terrain.drylands
			}
			desc = ep3_laamp_flavour_ewan.4061.desc.terrain.plains
		}
		desc = ep3_laamp_flavour_ewan.4061.desc.outro
	}
	theme = widgetless_travel_danger
	left_portrait = {
		character = root
		animation = worry
	}
	# Night would be more dramatic, but the follow-up wilderness events _have_ to be during the day due to art constraints, so we start off in the morning instead.
	override_background = { reference = corridor_day }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_available_travelling_adult = yes
		current_travel_plan = { is_travel_with_domicile = yes }
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_4061 }
		}
		# Narrative'll break if you don't have _some_ available courtiers.
		any_courtier = { location = root.location }
	}

	immediate = {
		# Slow down in MP.
		mp_delay_travel_plan = { DAYS = 90 }
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_4061
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_4061
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_short
			}
		}
		# Increment XP.
		traveler_danger_xp_effect = {
			MIN = 1
			MAX = 3
		}
		# Roll our large Old World man-eater.
		random_list = {
			# Feral Dog (fallback)
			25 = {
				save_scope_value_as = {
					name = hunter_type
					value = flag:dog
				}
				ep3_laamp_flavour_ewan_4061_roll_animal_size_effect = {
					MIN = 1
					MAX = 4
				}
			}
			# Wolf
			250 = {
				trigger = {
					location = { hunt_animal_wolf_trigger = yes }
				}
				save_scope_value_as = {
					name = hunter_type
					value = flag:wolf
				}
				ep3_laamp_flavour_ewan_4061_roll_animal_size_effect = {
					MIN = 2
					MAX = 4
				}
			}
			# Hyena
			200 = {
				trigger = {
					location = { hunt_animal_hyena_trigger = yes }
				}
				save_scope_value_as = {
					name = hunter_type
					value = flag:hyena
				}
				ep3_laamp_flavour_ewan_4061_roll_animal_size_effect = {
					MIN = 1
					MAX = 4
				}
			}
			# Lion
			200 = {
				trigger = {
					location = { hunt_animal_lion_trigger = yes }
				}
				save_scope_value_as = {
					name = hunter_type
					value = flag:lion
				}
				ep3_laamp_flavour_ewan_4061_roll_animal_size_effect = {
					MIN = 2
					MAX = 6
				}
			}
			# Tiger
			300 = {
				trigger = {
					location = { hunt_animal_tiger_trigger = yes }
				}
				save_scope_value_as = {
					name = hunter_type
					value = flag:tiger
				}
				ep3_laamp_flavour_ewan_4061_roll_animal_size_effect = {
					MIN = 4
					MAX = 7
				}
			}
			# Leopard
			150 = {
				trigger = {
					location = { hunt_animal_leopard_trigger = yes }
				}
				save_scope_value_as = {
					name = hunter_type
					value = flag:leopard
				}
				ep3_laamp_flavour_ewan_4061_roll_animal_size_effect = {
					MIN = 3
					MAX = 5
				}
			}
			# Panther (black leopards)
			1 = {
				trigger = {
					location = { hunt_animal_leopard_trigger = yes }
				}
				save_scope_value_as = {
					name = hunter_type
					value = flag:panther
				}
				ep3_laamp_flavour_ewan_4061_roll_animal_size_effect = {
					MIN = 3
					MAX = 5
				}
			}
			# Lynx
			75 = {
				trigger = {
					location = { hunt_animal_lynx_trigger = yes }
				}
				save_scope_value_as = {
					name = hunter_type
					value = flag:lynx
				}
				ep3_laamp_flavour_ewan_4061_roll_animal_size_effect = {
					MIN = 2
					MAX = 4
				}
			}
			# Caracal
			75 = {
				trigger = {
					location = { hunt_animal_caracal_trigger = yes }
				}
				save_scope_value_as = {
					name = hunter_type
					value = flag:caracal
				}
				ep3_laamp_flavour_ewan_4061_roll_animal_size_effect = {
					MIN = 1
					MAX = 3
				}
			}
			# Bear
			150 = {
				trigger = {
					location = { hunt_animal_bear_trigger = yes }
				}
				save_scope_value_as = {
					name = hunter_type
					value = flag:bear
				}
				ep3_laamp_flavour_ewan_4061_roll_animal_size_effect = {
					MIN = 4
					MAX = 9
				}
			}
			# Hippo
			## This one goes out to Dog: he was the best, deadliest pet an Arisen could ever ask for.
			## Yes, hippos do eat meat, though in the ordinary course of things they wouldn't _hunt_ per se. Not like this — basically this'd have to be a hippo that's maybe desperate for food, likely extra territorial, and probably just has a certain taste for meat.
			25 = {
				trigger = {
					location = { hunt_animal_hippo_trigger = yes }
				}
				save_scope_value_as = {
					name = hunter_type
					value = flag:hippo
				}
				ep3_laamp_flavour_ewan_4061_roll_animal_size_effect = {
					MIN = 8
					MAX = 12
				}
			}
			# Crocodile
			100 = {
				trigger = {
					##
					location = { hunt_animal_crocodile_trigger = yes }
					# Just to be safe, try to ensure we're at least intending to step near their habitat for longer than a day.
					current_travel_plan.next_location = { hunt_animal_crocodile_trigger = yes }
				}
				save_scope_value_as = {
					name = hunter_type
					value = flag:crocodile
				}
				ep3_laamp_flavour_ewan_4061_roll_animal_size_effect = {
					MIN = 3
					MAX = 8
				}
			}
			# Cannibal (generated)
			1 = {
				trigger = { can_start_single_combat_trigger = yes }
				save_scope_value_as = {
					name = hunter_type
					value = flag:cannibal_generated
				}
				ep3_laamp_flavour_ewan_4061_roll_animal_size_effect = {
					MIN = 1
					MAX = 1
				}
				# Create & nab our cannibal.
				create_character = {
					template = criminal_brawn_character
					location = root.location
					save_scope_as = cannibal
					trait = cannibal
					prowess = {
						max_template_medium_skill
						max_template_very_high_skill
					}
				}
			}
			# Cannibal (existing)
			10 = {
				trigger = {
					can_start_single_combat_trigger = yes
					any_pool_character = {
						province = root.location
						ep3_laamp_flavour_ewan_4061_local_cannibal_trigger = yes
					}
				}
				save_scope_value_as = {
					name = hunter_type
					value = flag:cannibal_existing
				}
				ep3_laamp_flavour_ewan_4061_roll_animal_size_effect = {
					MIN = 1
					MAX = 1
				}
				# Nab our cannibal.
				random_pool_character = {
					province = root.location
					limit = { ep3_laamp_flavour_ewan_4061_local_cannibal_trigger = yes }
					save_scope_as = cannibal
				}
			}
			# Cannibal (Chad)
			50 = {
				trigger = {
					can_start_single_combat_trigger = yes
					character:easteregg_chad_uhl ?= {
						is_alive = yes
						location ?= root.location
						is_pool_character = yes
					}
				}
				save_scope_value_as = {
					name = hunter_type
					value = flag:cannibal_chad
				}
				ep3_laamp_flavour_ewan_4061_roll_animal_size_effect = {
					MIN = 1
					MAX = 1
				}
				# Nab our cannibal.
				character:easteregg_chad_uhl = { save_scope_as = cannibal }
			}
		}
		# Apply our local modifier.
		location.county = {
			if = {
				limit = {
					# But not to hapless players who don't know what's happening.
					NOT = {
						holder = { is_ai = no }
					}
				}
				switch = {
					trigger = scope:hunter_size
					12 = {
						add_county_modifier = {
							modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_12_modifier
							years = 3
						}
					}
					11 = {
						add_county_modifier = {
							modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_11_modifier
							years = 3
						}
					}
					10 = {
						add_county_modifier = {
							modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_10_modifier
							years = 3
						}
					}
					9 = {
						add_county_modifier = {
							modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_09_modifier
							years = 3
						}
					}
					8 = {
						add_county_modifier = {
							modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_08_modifier
							years = 3
						}
					}
					7 = {
						add_county_modifier = {
							modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_07_modifier
							years = 3
						}
					}
					6 = {
						add_county_modifier = {
							modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_06_modifier
							years = 3
						}
					}
					5 = {
						add_county_modifier = {
							modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_05_modifier
							years = 3
						}
					}
					4 = {
						add_county_modifier = {
							modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_04_modifier
							years = 3
						}
					}
					3 = {
						add_county_modifier = {
							modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_03_modifier
							years = 3
						}
					}
					2 = {
						add_county_modifier = {
							modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_02_modifier
							years = 3
						}
					}
					1 = {
						add_county_modifier = {
							modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_01_modifier
							years = 3
						}
					}
				}
			}
		}
	}

	# Martial duel to try and organise better watches.
	option = {
		name = ep3_laamp_flavour_ewan.4061.a

		custom_tooltip = ep3_laamp_flavour_ewan.4061.a.tt.duel.safe
		duel = {
			skill = martial
			value = scope:duel_diff_safe
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4061.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = ep3_laamp_flavour_ewan.4061.a.tt.success
					add_prestige = minor_prestige_gain
					every_courtier = {
						limit = { ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes }
						custom = custom.every_adult_follower
						add_opinion = {
							target = root
							modifier = saviour_opinion
							opinion = 20
						}
					}
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4061.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = ep3_laamp_flavour_ewan.4061.a.tt.failure
					ep3_laamp_flavour_ewan_4061_roll_courtier_deaths_effect = yes
				}
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 2 }
		}
	}

	# Go after it yourself.
	option = {
		name = ep3_laamp_flavour_ewan.4061.b

		custom_tooltip = ep3_laamp_flavour_ewan.4061.a.tt.duel.risky
		custom_tooltip = ep3_laamp_flavour_ewan.4061.a.tt.duel.risky.are_you_sure
		trigger_event = ep3_laamp_flavour_ewan.4062

		# Flag not to clean up our cannibal, if we made one.
		save_scope_value_as = {
			name = dont_clean_cannibal
			value = yes
		}

		stress_impact = {
			lifestyle_hunter = minor_stress_impact_loss
			brave = minor_stress_impact_loss
			craven = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 2 }
		}
	}

	# As long as it doesn't eat anyone important.
	option = {
		name = ep3_laamp_flavour_ewan.4061.c

		random_list = {
			50 = {
				desc = ep3_laamp_flavour_ewan.4061.c.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4061.c.tt.success
					add_prestige = miniscule_prestige_gain
				}
			}
			50 = {
				desc = ep3_laamp_flavour_ewan.4061.c.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4061.c.tt.failure
					ep3_laamp_flavour_ewan_4061_roll_courtier_deaths_effect = yes
				}
			}
		}

		stress_impact = {
			craven = medium_stress_impact_loss
			brave = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_energy = -2 }
		}
	}

	after = {
		# If we're slowed due to multi, resume travel.
		mp_resume_travel_plan = yes
		# Clean up our cannibal, if necessary.
		if = {
			limit = {
				scope:hunter_type = flag:cannibal_generated
				NOT = { exists = scope:dont_clean_cannibal }
			}
			scope:cannibal = {
				death = { death_reason = death_vanished }
			}
		}
	}
}

scripted_trigger ep3_laamp_flavour_ewan_4062_cannibal_options_trigger = {
	OR = {
		scope:hunter_type = flag:cannibal_generated
		scope:hunter_type = flag:cannibal_existing
		scope:hunter_type = flag:cannibal_chad
	}
}

scripted_trigger ep3_laamp_flavour_ewan_4062_animal_group_canine_trigger = {
	OR = {
		scope:hunter_type = flag:dog
		scope:hunter_type = flag:wolf
		scope:hunter_type = flag:hyena
	}
}

scripted_trigger ep3_laamp_flavour_ewan_4062_animal_group_feline_trigger = {
	OR = {
		scope:hunter_type = flag:lion
		scope:hunter_type = flag:tiger
		scope:hunter_type = flag:leopard
		scope:hunter_type = flag:panther
		scope:hunter_type = flag:lynx
		scope:hunter_type = flag:caracal
	}
}

scripted_trigger ep3_laamp_flavour_ewan_4062_animal_group_human_trigger = {
	OR = {
		scope:hunter_type = flag:cannibal_generated
		scope:hunter_type = flag:cannibal_existing
		scope:hunter_type = flag:cannibal_chad
	}
}

scripted_effect ep3_laamp_flavour_ewan_4062_animal_duel_effect = {
	duel = {
		skill = $SKILL$
		value = scope:duel_diff_risky
		# Victory!
		50 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = 3.5
				min = -49
			}
			min = 5
			desc = ep3_laamp_flavour_ewan.4062.tt.success
			send_interface_toast = {
				title = ep3_laamp_flavour_ewan.4062.tt.success
				add_prestige = {
					value = medium_prestige_gain
					add = {
						value = scope:hunter_size
						multiply = 50
					}
				}
				every_courtier = {
					limit = { location = root.location }
					custom = custom.every_follower
					add_opinion = {
						target = root
						modifier = saviour_opinion
						opinion = {
							value = 30
							add = {
								value = scope:hunter_size
								multiply = 2
							}
						}
					}
				}
			}
			ep3_laamp_flavour_ewan_4062_clean_man_eater_effect = yes
		}
		# Defeat.
		50 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = -3.5
				min = -49
			}
			min = 5
			desc = ep3_laamp_flavour_ewan.4062.tt.failure
			send_interface_toast = {
				title = ep3_laamp_flavour_ewan.4062.tt.failure
				ep3_laamp_flavour_ewan_4062_animal_duel_loss_effect = yes
			}
		}
	}
}

scripted_effect ep3_laamp_flavour_ewan_4062_animal_duel_loss_effect = {
	switch = {
		trigger = scope:hunter_type
		flag:dog = {
			ep3_laamp_flavour_ewan_4062_animal_duel_loss_guts_effect = {
				ANIMAL = dog
				SUCCESS_% = 90
				FAILURE_% = 10
				WOUNDS = 1
			}
		}
		flag:wolf = {
			ep3_laamp_flavour_ewan_4062_animal_duel_loss_guts_effect = {
				ANIMAL = wolf
				SUCCESS_% = 80
				FAILURE_% = 20
				WOUNDS = 1
			}
		}
		flag:hyena = {
			ep3_laamp_flavour_ewan_4062_animal_duel_loss_guts_effect = {
				ANIMAL = hyena
				SUCCESS_% = 85
				FAILURE_% = 15
				WOUNDS = 1
			}
		}
		flag:lion = {
			ep3_laamp_flavour_ewan_4062_animal_duel_loss_guts_effect = {
				ANIMAL = lion
				SUCCESS_% = 60
				FAILURE_% = 40
				WOUNDS = 2
			}
		}
		flag:tiger = {
			ep3_laamp_flavour_ewan_4062_animal_duel_loss_guts_effect = {
				ANIMAL = tiger
				SUCCESS_% = 40
				FAILURE_% = 60
				WOUNDS = 3
			}
		}
		flag:leopard = {
			ep3_laamp_flavour_ewan_4062_animal_duel_loss_guts_effect = {
				ANIMAL = leopard
				SUCCESS_% = 60
				FAILURE_% = 40
				WOUNDS = 2
			}
		}
		flag:panther = {
			ep3_laamp_flavour_ewan_4062_animal_duel_loss_guts_effect = {
				ANIMAL = panther
				SUCCESS_% = 60
				FAILURE_% = 40
				WOUNDS = 2
			}
		}
		flag:lynx = {
			ep3_laamp_flavour_ewan_4062_animal_duel_loss_guts_effect = {
				ANIMAL = lynx
				SUCCESS_% = 80
				FAILURE_% = 20
				WOUNDS = 1
			}
		}
		flag:caracal = {
			ep3_laamp_flavour_ewan_4062_animal_duel_loss_guts_effect = {
				ANIMAL = caracal
				SUCCESS_% = 80
				FAILURE_% = 20
				WOUNDS = 1
			}
		}
		flag:bear = {
			ep3_laamp_flavour_ewan_4062_animal_duel_loss_guts_effect = {
				ANIMAL = bear
				SUCCESS_% = 30
				FAILURE_% = 70
				WOUNDS = 3
			}
		}
		flag:hippo = {
			ep3_laamp_flavour_ewan_4062_animal_duel_loss_guts_effect = {
				ANIMAL = hippo
				SUCCESS_% = 10
				FAILURE_% = 90
				WOUNDS = 3
			}
		}
		flag:crocodile = {
			ep3_laamp_flavour_ewan_4062_animal_duel_loss_guts_effect = {
				ANIMAL = crocodile
				SUCCESS_% = 40
				FAILURE_% = 60
				WOUNDS = 3
			}
		}
	}
}

scripted_effect ep3_laamp_flavour_ewan_4062_animal_duel_loss_guts_effect = {
	save_scope_value_as = {
		name = wounds_tally
		value = $WOUNDS$
	}
	random_list = {
		$SUCCESS_%$ = {
			increase_wounds_effect = { REASON = killed_by_monstrous_$ANIMAL$ }
			if = {
				limit = { scope:wounds_tally = 2 }
				increase_wounds_effect = { REASON = killed_by_monstrous_$ANIMAL$ }
			}
			else_if = {
				limit = { scope:wounds_tally >= 3 }
				increase_wounds_effect = { REASON = killed_by_monstrous_$ANIMAL$ }
				increase_wounds_effect = { REASON = killed_by_monstrous_$ANIMAL$ }
			}
		}
		$FAILURE_%$ = {
			death = { death_reason = death_killed_by_monstrous_$ANIMAL$ }
		}
	}
}

scripted_effect ep3_laamp_flavour_ewan_4062_clean_man_eater_effect = {
	hidden_effect = {
		location.county = {
			remove_county_modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_12_modifier
			remove_county_modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_11_modifier
			remove_county_modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_10_modifier
			remove_county_modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_09_modifier
			remove_county_modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_08_modifier
			remove_county_modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_07_modifier
			remove_county_modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_06_modifier
			remove_county_modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_05_modifier
			remove_county_modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_04_modifier
			remove_county_modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_03_modifier
			remove_county_modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_02_modifier
			remove_county_modifier = ep3_laamp_flavour_ewan_4061_hungry_maneater_size_01_modifier
		}
	}
}

scripted_effect ep3_laamp_flavour_ewan_4062_engagement_stress_effect = {
	# vs. cannibals.
	if = {
		limit = {
			OR = {
				scope:hunter_type = flag:cannibal_generated
				scope:hunter_type = flag:cannibal_existing
				scope:hunter_type = flag:cannibal_chad
			}
		}
		stress_impact = {
			base = 10
			lifestyle_hunter = -10
			brave = -20
			craven = 10
		}
	}
	# vs. size.
	## 12.
	else_if = {
		limit = { scope:hunter_size >= 12 }
		stress_impact = {
			base = 50
			lifestyle_hunter = -30
			brave = -30
			craven = 30
		}
	}
	## 10.
	else_if = {
		limit = { scope:hunter_size >= 10 }
		stress_impact = {
			base = 40
			lifestyle_hunter = -25
			brave = -25
			craven = 25
		}
	}
	## 08.
	else_if = {
		limit = { scope:hunter_size >= 8 }
		stress_impact = {
			base = 20
			lifestyle_hunter = -20
			brave = -20
			craven = 20
		}
	}
	## 06.
	else_if = {
		limit = { scope:hunter_size >= 6 }
		stress_impact = {
			base = 10
			lifestyle_hunter = -15
			brave = -15
			craven = 15
		}
	}
	## 04.
	else_if = {
		limit = { scope:hunter_size >= 4 }
		stress_impact = {
			lifestyle_hunter = -10
			brave = -10
			craven = 10
		}
	}
	## 02.
	else_if = {
		limit = { scope:hunter_size >= 2 }
		stress_impact = {
			lifestyle_hunter = -7
			brave = -7
			craven = 7
		}
	}
	## 01.
	else = {
		stress_impact = {
			lifestyle_hunter = -5
			brave = -5
			craven = 5
		}
	}
	# If we're over a certain size, we take base stress.
	# Set up our animal stress.
		save_scope_value_as = {
			name = brave_size_stress
			value = {
				add = scope:hunter_size
				multiply = -3
			}
		}
		save_scope_value_as = {
			name = craven_size_stress
			value = {
				add = scope:hunter_size
				multiply = 4
			}
		}
}

#	Alright, time to fight!
ep3_laamp_flavour_ewan.4062 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:hunter_type = flag:dog }
				desc = ep3_laamp_flavour_ewan.4062.t.dog
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:wolf }
				desc = ep3_laamp_flavour_ewan.4062.t.wolf
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:hyena }
				desc = ep3_laamp_flavour_ewan.4062.t.hyena
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:lion }
				desc = ep3_laamp_flavour_ewan.4062.t.lion
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:tiger }
				desc = ep3_laamp_flavour_ewan.4062.t.tiger
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:leopard }
				desc = ep3_laamp_flavour_ewan.4062.t.leopard
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:panther }
				desc = ep3_laamp_flavour_ewan.4062.t.panther
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:lynx }
				desc = ep3_laamp_flavour_ewan.4062.t.lynx
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:caracal }
				desc = ep3_laamp_flavour_ewan.4062.t.caracal
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:bear }
				desc = ep3_laamp_flavour_ewan.4062.t.bear
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:hippo }
				desc = ep3_laamp_flavour_ewan.4062.t.hippo
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:crocodile }
				desc = ep3_laamp_flavour_ewan.4062.t.crocodile
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:cannibal_generated }
				desc = ep3_laamp_flavour_ewan.4062.t.cannibal_generated
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:cannibal_existing }
				desc = ep3_laamp_flavour_ewan.4062.t.cannibal_existing
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:cannibal_chad }
				desc = ep3_laamp_flavour_ewan.4062.t.cannibal_chad
			}
		}
	}
	desc = {
		desc = ep3_laamp_flavour_ewan.4062.desc.intro
		# Tracks.
		first_valid = {
			triggered_desc = {
				trigger = { ep3_laamp_flavour_ewan_4062_animal_group_canine_trigger = yes }
				desc = ep3_laamp_flavour_ewan.4062.desc.tracks.canine
			}
			triggered_desc = {
				trigger = { ep3_laamp_flavour_ewan_4062_animal_group_feline_trigger = yes }
				desc = ep3_laamp_flavour_ewan.4062.desc.tracks.feline
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:bear }
				desc = ep3_laamp_flavour_ewan.4062.desc.tracks.ursine
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:hippo }
				desc = ep3_laamp_flavour_ewan.4062.desc.tracks.hippopotomine
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:crocodile }
				desc = ep3_laamp_flavour_ewan.4062.desc.tracks.crocodyline
			}
			triggered_desc = {
				trigger = { ep3_laamp_flavour_ewan_4062_animal_group_human_trigger = yes }
				desc = ep3_laamp_flavour_ewan.4062.desc.tracks.human
			}
		}
		desc = ep3_laamp_flavour_ewan.4062.desc.tracks.connector
		# Terrain
		first_valid = {
			triggered_desc = {
				trigger = {
					location = {
						any_neighboring_province = { is_river_province = yes }
					}
				}
				desc = ep3_laamp_flavour_ewan.4062.desc.terrain.major_river
			}
			triggered_desc = {
				trigger = {
					location = { terrain = farmlands }
				}
				desc = ep3_laamp_flavour_ewan.4062.desc.terrain.farmlands
			}
			triggered_desc = {
				trigger = {
					location = { terrain = hills }
				}
				desc = ep3_laamp_flavour_ewan.4062.desc.terrain.hills
			}
			triggered_desc = {
				trigger = {
					location = { terrain = mountains }
				}
				desc = ep3_laamp_flavour_ewan.4062.desc.terrain.mountains
			}
			triggered_desc = {
				trigger = {
					location = { terrain = desert }
				}
				desc = ep3_laamp_flavour_ewan.4062.desc.terrain.desert
			}
			triggered_desc = {
				trigger = {
					location = { terrain = desert_mountains }
				}
				desc = ep3_laamp_flavour_ewan.4062.desc.terrain.desert_mountains
			}
			triggered_desc = {
				trigger = {
					location = { terrain = oasis }
				}
				desc = ep3_laamp_flavour_ewan.4062.desc.terrain.oasis
			}
			triggered_desc = {
				trigger = {
					location = { terrain = jungle }
				}
				desc = ep3_laamp_flavour_ewan.4062.desc.terrain.jungle
			}
			triggered_desc = {
				trigger = {
					location = { terrain = forest }
				}
				desc = ep3_laamp_flavour_ewan.4062.desc.terrain.forest
			}
			triggered_desc = {
				trigger = {
					location = { terrain = taiga }
				}
				desc = ep3_laamp_flavour_ewan.4062.desc.terrain.taiga
			}
			triggered_desc = {
				trigger = {
					location = { terrain = wetlands }
				}
				desc = ep3_laamp_flavour_ewan.4062.desc.terrain.wetlands
			}
			triggered_desc = {
				trigger = {
					location = { terrain = steppe }
				}
				desc = ep3_laamp_flavour_ewan.4062.desc.terrain.steppe
			}
			triggered_desc = {
				trigger = {
					location = { terrain = floodplains }
				}
				desc = ep3_laamp_flavour_ewan.4062.desc.terrain.floodplains
			}
			triggered_desc = {
				trigger = {
					location = { terrain = drylands }
				}
				desc = ep3_laamp_flavour_ewan.4062.desc.terrain.drylands
			}
			desc = ep3_laamp_flavour_ewan.4062.desc.terrain.plains
		}
		desc = ep3_laamp_flavour_ewan.4062.desc.terrain.connector
		# Animal
		first_valid = {
			triggered_desc = {
				trigger = { scope:hunter_type = flag:dog }
				desc = ep3_laamp_flavour_ewan.4062.desc.animal.dog
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:wolf }
				desc = ep3_laamp_flavour_ewan.4062.desc.animal.wolf
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:hyena }
				desc = ep3_laamp_flavour_ewan.4062.desc.animal.hyena
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:lion }
				desc = ep3_laamp_flavour_ewan.4062.desc.animal.lion
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:tiger }
				desc = ep3_laamp_flavour_ewan.4062.desc.animal.tiger
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:leopard }
				desc = ep3_laamp_flavour_ewan.4062.desc.animal.leopard
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:panther }
				desc = ep3_laamp_flavour_ewan.4062.desc.animal.panther
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:lynx }
				desc = ep3_laamp_flavour_ewan.4062.desc.animal.lynx
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:caracal }
				desc = ep3_laamp_flavour_ewan.4062.desc.animal.caracal
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:bear }
				desc = ep3_laamp_flavour_ewan.4062.desc.animal.bear
			}
			triggered_desc = {
				trigger = {
					scope:hunter_type = flag:hippo
					scope:hunter_size >= 10
				}
				desc = ep3_laamp_flavour_ewan.4062.desc.animal.hippo.largest
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:hippo }
				desc = ep3_laamp_flavour_ewan.4062.desc.animal.hippo.fallback
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:crocodile }
				desc = ep3_laamp_flavour_ewan.4062.desc.animal.crocodile
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:cannibal_generated }
				desc = ep3_laamp_flavour_ewan.4062.desc.animal.cannibal_generated
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:cannibal_existing }
				desc = {
					first_valid = {
						triggered_desc = {
							trigger = { character:easteregg_anna_johansson ?= scope:cannibal }
							desc = ep3_laamp_flavour_ewan.4062.desc.animal.cannibal_existing.anna
						}
						triggered_desc = {
							trigger = {
								scope:cannibal = {
									any_secret = { type = secret_cannibal }
								}
							}
							desc = ep3_laamp_flavour_ewan.4062.desc.animal.cannibal_existing.secret
						}
						desc = ep3_laamp_flavour_ewan.4062.desc.animal.cannibal_existing.fallback
					}
				}
			}
			triggered_desc = {
				trigger = { scope:hunter_type = flag:cannibal_chad }
				desc = ep3_laamp_flavour_ewan.4062.desc.animal.cannibal_chad
			}
		}
	}
	theme = widgetless_travel_danger
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:cannibal
		animation = random_weapon_aggressive
	}
	override_background = { reference = wilderness }

	immediate = {
		# Plus, we'll need to know how big our animal is.
		set_variable = {
			name = 4061_size_adjective
			value = scope:hunter_size
		}
		# Sort our sacrifices.
		court_position:huntperson_camp_officer ?= {
			if = {
				limit = { ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes }
				save_scope_as = huntsperson
			}
		}
		court_position:kennelperson_camp_officer ?= {
			if = {
				limit = { ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes }
				save_scope_as = kenneler
			}
		}
	}

	# Animal: martial duel.
	option = {
		name = ep3_laamp_flavour_ewan.4062.a
		trigger = { ep3_laamp_flavour_ewan_4062_cannibal_options_trigger = no }

		ep3_laamp_flavour_ewan_4062_animal_duel_effect = { SKILL = martial }

		ep3_laamp_flavour_ewan_4062_engagement_stress_effect = yes
		ai_chance = {
			base = 1
			modifier = {
				add = {
					value = martial
					multiply = 10
				}
				martial > prowess
			}
		}
	}

	# Animal: prowess duel.
	option = {
		name = ep3_laamp_flavour_ewan.4062.b
		trigger = { ep3_laamp_flavour_ewan_4062_cannibal_options_trigger = no }

		ep3_laamp_flavour_ewan_4062_animal_duel_effect = { SKILL = prowess }

		ep3_laamp_flavour_ewan_4062_engagement_stress_effect = yes
		ai_chance = {
			base = 1
			modifier = {
				add = {
					value = prowess
					multiply = 10
				}
				prowess > martial
			}
		}
	}

	# Huntperson: shoot her, SHOOOOT HERRRR!
	option = {
		name = ep3_laamp_flavour_ewan.4062.c
		trigger = {
			ep3_laamp_flavour_ewan_4062_cannibal_options_trigger = no
			exists = scope:huntsperson
		}
		reason = have_huntperson

		scope:huntsperson = {
			duel = {
				skill = prowess
				value = scope:duel_diff_risky
				# Victory!
				50 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
						min = -49
					}
					min = 5
					desc = ep3_laamp_flavour_ewan.4062.c.tt.success
					root = {
						send_interface_toast = {
							title = ep3_laamp_flavour_ewan.4062.c.tt.success
							left_icon = scope:huntsperson
							add_prestige = {
								value = medium_prestige_gain
								add = {
									value = scope:hunter_size
									multiply = 50
								}
								multiply = 0.5
							}
							every_courtier = {
								limit = { location = root.location }
								custom = custom.every_follower
								add_opinion = {
									target = scope:huntsperson
									modifier = saviour_opinion
									opinion = {
										value = 30
										add = {
											value = scope:hunter_size
											multiply = 2
										}
									}
								}
							}
						}
						ep3_laamp_flavour_ewan_4062_clean_man_eater_effect = yes
					}
				}
				# Defeat.
				50 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
						min = -49
					}
					min = 5
					desc = ep3_laamp_flavour_ewan.4062.c.tt.failure
					root = {
						send_interface_toast = {
							title = ep3_laamp_flavour_ewan.4062.c.tt.failure
							left_icon = scope:huntsperson
							scope:huntsperson = { ep3_laamp_flavour_ewan_4062_animal_duel_loss_effect = yes }
						}
					}
				}
			}
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = 1 }
		}
	}

	# Dog: kennelmaster, bring me that hound!
	option = {
		name = ep3_laamp_flavour_ewan.4062.d
		trigger = {
			ep3_laamp_flavour_ewan_4062_cannibal_options_trigger = no
			scope:hunter_type = flag:dog
			exists = scope:kenneler
			NOT = { has_character_modifier = dog_story_modifier }
		}

		scope:kenneler = {
			duel = {
				skill = prowess
				value = scope:duel_diff_risky
				# Victory!
				50 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
						min = -49
					}
					min = 5
					desc = ep3_laamp_flavour_ewan.4062.d.tt.success
					root = {
						send_interface_toast = {
							title = ep3_laamp_flavour_ewan.4062.d.tt.success
							left_icon = scope:kenneler
							add_prestige = medium_prestige_gain
							start_dog_story_cycle_effect = yes
							every_courtier = {
								limit = { location = root.location }
								custom = custom.every_follower
								add_opinion = {
									target = scope:kenneler
									modifier = impressed_opinion
									opinion = {
										value = 15
										add = {
											value = scope:hunter_size
											multiply = 2
										}
									}
								}
							}
						}
						ep3_laamp_flavour_ewan_4062_clean_man_eater_effect = yes
					}
				}
				# Defeat.
				50 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
						min = -49
					}
					min = 5
					desc = ep3_laamp_flavour_ewan.4062.d.tt.failure
					root = {
						send_interface_toast = {
							title = ep3_laamp_flavour_ewan.4062.d.tt.failure
							left_icon = scope:kenneler
							scope:kenneler = { ep3_laamp_flavour_ewan_4062_animal_duel_loss_effect = yes }
						}
					}
				}
			}
		}

		stress_impact = {
			greedy = miniscule_stress_impact_loss
			lustful = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_sociability = 1 }
		}
	}

	# Cannibal: single combat.
	option = {
		name = ep3_laamp_flavour_ewan.4062.e
		trigger = { ep3_laamp_flavour_ewan_4062_cannibal_options_trigger = yes }

		# In case death would change it (say, losing an artefact), register scope:cannibal's prowess.
		save_scope_value_as = {
			name = cannibal_prowess
			value = scope:cannibal.prowess
		}
		# Then, into the actual duel we go!
		custom_tooltip = {
			text = duel_to_the_death.tt
			configure_start_single_combat_effect = {
				SC_INITIATOR = scope:cannibal
				SC_ATTACKER = scope:cannibal
				SC_DEFENDER = root
				FATALITY = always
				FIXED = no
				LOCALE = terrain_scope
				INVALIDATION_EVENT = single_combat.1006
				OUTPUT_EVENT = ep3_laamp_flavour_ewan.4063
			}
		}

		# No stress here.
		ai_chance = {
			# You don't get a choice here, you're fightin'.
			base = 1
		}
	}

	after = {
		# If we're slowed due to multi, resume travel.
		mp_resume_travel_plan = yes
		# Clean up our animal size.
		if = {
			# The AI can get killed here _real_ fast, so we make sure to check that they're not gonna fire an error.
			limit = { is_alive = yes }
			remove_variable = 4061_size_adjective
		}
	}
}

ep3_laamp_flavour_ewan.4063 = {
	hidden = yes

	immediate = {
		if = {
			limit = { scope:sc_victor = root }
			root = {
				trigger_event = {
					id = ep3_laamp_flavour_ewan.4064
					days = 1
				}
			}
			# Log if it was Chad who lost.
			if = {
				limit = { character:easteregg_chad_uhl ?= scope:sc_loser }
				trigger_event = ep3_laamp_flavour_ewan.4065
			}
			# Or Anna.
			else_if = {
				limit = { character:easteregg_anna_johansson ?= scope:sc_loser }
				trigger_event = ep3_laamp_flavour_ewan.4067
			}
		}
		# Log if it was Chad who won.
		else_if = {
			limit = { character:easteregg_chad_uhl ?= scope:sc_victor }
			trigger_event = ep3_laamp_flavour_ewan.4066
		}
		# Or Anna.
		else_if = {
			limit = { character:easteregg_anna_johansson ?= scope:sc_loser }
			trigger_event = ep3_laamp_flavour_ewan.4068
		}
	}
}

#	You won the single combat!
ep3_laamp_flavour_ewan.4064 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.4064.t
	desc = ep3_laamp_flavour_ewan.4064.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = random_weapon_celebrate
	}
	override_background = { reference = wilderness }

	immediate = {
		add_prestige = {
			value = medium_prestige_gain
			add = {
				value = scope:cannibal_prowess
				multiply = 25
			}
		}
		ep3_laamp_flavour_ewan_4062_clean_man_eater_effect = yes
	}

	# Victory!
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							OR = {
								any_secret = { type = secret_cannibal }
								has_trait = cannibal
							}
						}
						desc = ep3_laamp_flavour_ewan.4064.a.is_cannibal
					}
					desc = ep3_laamp_flavour_ewan.4064.a.not_cannibal
				}
			}
		}

		every_courtier = {
			limit = { location = root.location }
			custom = custom.every_follower
			add_opinion = {
				target = root
				modifier = saviour_opinion
				opinion = {
					value = 30
					add = scope:cannibal_prowess
				}
			}
		}

		# No stress here.
		ai_chance = {
			# No logic needed for notification event.
			base = 1
		}
	}
}

# Gather our ultimate fighter statistics.
ep3_laamp_flavour_ewan.4065 = { hidden = yes }
ep3_laamp_flavour_ewan.4066 = { hidden = yes }
ep3_laamp_flavour_ewan.4067 = { hidden = yes }
ep3_laamp_flavour_ewan.4068 = { hidden = yes }

##################################################
# Slavers
# by Ewan Cowhig Croft
# 4071 - 4080
##################################################

scripted_trigger ep3_laamp_flavour_ewan_4071_valid_courtiers_to_lose_trigger = {
	ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes
	NOR = {
		is_close_family_of = root
		is_consort_of = root
		has_important_relationship_with_character_trigger = { CHARACTER = root }
		highest_skill_value >= very_high_skill_rating
		prowess >= very_high_skill_rating
		average_of_all_skills_and_prowess >= sum_of_all_skills_threshold_excellent
		has_trait_with_flag = illness
		has_wounds_trigger = yes
	}
}

scripted_effect ep3_laamp_flavour_ewan_4071_won_duel_effect = {
	add_prestige = {
		value = medium_prestige_gain
		if = {
			limit = { scope:sc_victor ?= root }
			# If you win the duel, we give you a bit more than the usual amount, since you risked your life overtly.
			add = 100
		}
	}
	every_courtier = {
		limit = { location = root.location }
		custom = custom.every_follower
		add_opinion = {
			target = root
			modifier = saviour_opinion
			opinion = 30
		}
	}
}

scripted_effect ep3_laamp_flavour_ewan_4071_lose_courtiers_effect = {
	scope:follower_1 = {
		death = { death_reason = death_disappeared_into_slave_markets }
	}
	scope:follower_2 = {
		death = { death_reason = death_disappeared_into_slave_markets }
	}
	scope:follower_3 = {
		death = { death_reason = death_disappeared_into_slave_markets }
	}
}

#	Bastards try to kidnap people from the edges of your train.
ep3_laamp_flavour_ewan.4071 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.4071.t
	desc = ep3_laamp_flavour_ewan.4071.desc
	theme = widgetless_travel_danger
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:slaver
		animation = schadenfreude
	}
	lower_left_portrait = scope:follower_1
	lower_center_portrait = scope:follower_2
	lower_right_portrait = scope:follower_3
	override_background = { reference = wilderness }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_available_travelling_adult = yes
		current_travel_plan = { is_travel_with_domicile = yes }
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_4071 }
		}
		# Must have the correct travel danger type.
		location = {
			travel_danger_type = {
				travel_plan = root.current_travel_plan
				type = county_control
			}
		}
		# And you won't see slavers literally outside someone important's capital, just openly kidnapping travellers.
		NOT = {
			location.county = {
				holder.highest_held_title_tier >= tier_duchy
				this = holder.capital_county
			}
		}
		# Must have enough courtiers to lose in a duel.
		any_courtier = {
			count >= 3
			ep3_laamp_flavour_ewan_4071_valid_courtiers_to_lose_trigger = yes
		}
		# Slavers won't attack forces over a certain size, even assuming you're spread out in a long line.
		current_military_strength < @ep3_laamp_flavour_ewan_baggage_train_has_significant_armed_force
	}

	immediate = {
		# Slow down in MP.
		mp_delay_travel_plan = { DAYS = 90 }
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_4071
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_4071
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_shorter
			}
		}
		# Increment XP.
		traveler_danger_xp_effect = {
			MIN = 1
			MAX = 3
		}
		# Nab our available courtiers.
		## First sorting them to a list.
		every_courtier = {
			limit = { ep3_laamp_flavour_ewan_4071_valid_courtiers_to_lose_trigger = yes }
			add_to_list = loseable_courtiers_list
		}
		## Then sorting who we'll lose if we lose a duel.
		ordered_in_list = {
			list = loseable_courtiers_list
			order_by = sum_of_all_skills_and_prowess_value
			max = 3
			check_range_bounds = no
			if = {
				limit = {
					NOT = { exists = scope:follower_1 }
				}
				save_scope_as = follower_1
			}
			else_if = {
				limit = {
					NOT = {
						this = scope:follower_1
						exists = scope:follower_2
					}
				}
				save_scope_as = follower_2
			}
			else_if = {
				limit = {
					NOT = {
						this = scope:follower_1
						this = scope:follower_2
						exists = scope:follower_3
					}
				}
				save_scope_as = follower_3
			}
		}
		## Then sorting who we'll lose if we sell people.
		if = {
			# Which means making sure we've got enough people; we want 5, we have three taken from us, so we need at least 8 in the list.
			limit = { "list_size(loseable_courtiers_list)" >= 8 }
			ordered_in_list = {
				list = loseable_courtiers_list
				order_by = {
					value = sum_of_all_skills_and_prowess_value
					multiply = -1
				}
				max = 5
				check_range_bounds = no
				# We're gonna save these as individual scopes for easier tooltipping, but also put them in a list for less verbose checking in some specific script later.
				if = {
					limit = {
						NOT = { exists = scope:follower_4 }
					}
					save_scope_as = follower_4
					add_to_list = sellable_courtiers_list
				}
				else_if = {
					limit = {
						NOT = {
							this = scope:follower_4
							exists = scope:follower_5
						}
					}
					save_scope_as = follower_5
					add_to_list = sellable_courtiers_list
				}
				else_if = {
					limit = {
						NOT = {
							this = scope:follower_4
							this = scope:follower_5
							exists = scope:follower_6
						}
					}
					save_scope_as = follower_6
					add_to_list = sellable_courtiers_list
				}
				else_if = {
					limit = {
						NOT = {
							this = scope:follower_4
							this = scope:follower_5
							this = scope:follower_6
							exists = scope:follower_7
						}
					}
					save_scope_as = follower_7
					add_to_list = sellable_courtiers_list
				}
				else_if = {
					limit = {
						NOT = {
							this = scope:follower_4
							this = scope:follower_5
							this = scope:follower_6
							this = scope:follower_7
							exists = scope:follower_8
						}
					}
					save_scope_as = follower_8
					add_to_list = sellable_courtiers_list
				}
			}
		}
		# Create a hostile slaver.
		create_character = {
			template = bandit_character
			location = root.location
			culture = root.location.culture
			faith = root.location.faith
			trait = gallowsbait
			martial = {
				min_template_decent_skill
				max_template_high_skill
			}
			stewardship = {
				min_template_decent_skill
				max_template_high_skill
			}
			prowess = {
				min_template_decent_skill
				max_template_high_skill
			}
			save_scope_as = slaver
			after_creation = {
				# Make sure we telegraph that they're a dick.
				## First, level up their gallowsbait
				laamp_rewards_apply_criminal_xp_effect = {
					TRACK = bandit
					XP_MAX = gallowsbait_xp_massive_gain
					XP_MIN = gallowsbait_xp_massive_gain
				}
				laamp_rewards_apply_criminal_xp_effect = {
					TRACK = marauder
					XP_MAX = gallowsbait_xp_massive_gain
					XP_MIN = gallowsbait_xp_massive_gain
				}
				## Then make sure they've got a suitably horrid personality.
				if = {
					limit = { number_of_personality_traits < 3 }
					add_trait = callous
				}
				if = {
					limit = { number_of_personality_traits < 3 }
					add_trait = greedy
				}
				if = {
					limit = { number_of_personality_traits < 3 }
					add_trait = arbitrary
				}
				if = {
					limit = { number_of_personality_traits < 3 }
					add_trait = wrathful
				}
				if = {
					limit = { number_of_personality_traits < 3 }
					add_trait = vengeful
				}
			}
		}
	}

	# Martial duel to fight them off.
	option = {
		name = ep3_laamp_flavour_ewan.4071.a

		duel = {
			skill = martial
			target = scope:slaver
			# Victory!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4071.a.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4071.a.tt.success
					left_icon = scope:slaver
					ep3_laamp_flavour_ewan_4071_won_duel_effect = yes
					scope:slaver = {
						death = { death_reason = death_attacking_laamp_train }
					}
				}
			}
			# Defeat.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4071.a.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4071.a.tt.failure
					left_icon = scope:slaver
					add_prestige = minor_prestige_loss
					ep3_laamp_flavour_ewan_4071_lose_courtiers_effect = yes
				}
			}
		}

		# No stress here,
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 2 }
		}
	}

	# SCE: launch yourself at the largest and fiercest of them.
	option = {
		name = ep3_laamp_flavour_ewan.4071.b
		trigger = { can_start_single_combat_trigger = yes }

		custom_tooltip = {
			text = duel_to_the_death.tt
			configure_start_single_combat_effect = {
				SC_INITIATOR = root
				SC_ATTACKER = root
				SC_DEFENDER = scope:slaver
				FATALITY = always
				FIXED = no
				LOCALE = terrain_scope
				INVALIDATION_EVENT = single_combat.1006
				OUTPUT_EVENT = ep3_laamp_flavour_ewan.4072
			}
		}
		save_scope_value_as = {
			name = duel_begun
			value = yes
		}

		stress_impact = {
			brave = medium_stress_impact_loss
			craven = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 1 }
		}
	}

	# Haggle & sell some lesser courtiers yourself.
	option = {
		name = ep3_laamp_flavour_ewan.4071.c
		trigger = { exists = scope:follower_4 }

		# Alright, explain how this works.
		custom_tooltip = ep3_laamp_flavour_ewan.4071.c.sale_explanation.profit
		custom_tooltip = ep3_laamp_flavour_ewan.4071.c.sale_explanation.limitations
		custom_tooltip = ep3_laamp_flavour_ewan.4071.c.sale_explanation.death
		# Then sum it up.
		scope:slaver = {
			pay_short_term_gold = {
				target = root
				gold = {
					add = scope:follower_4.sum_of_all_skills_and_prowess_value
					add = scope:follower_5.sum_of_all_skills_and_prowess_value
					add = scope:follower_6.sum_of_all_skills_and_prowess_value
					add = scope:follower_7.sum_of_all_skills_and_prowess_value
					add = scope:follower_8.sum_of_all_skills_and_prowess_value
				}
			}
		}
		# And we'd lose the listed courtiers, permanently.
		scope:follower_4 = {
			death = {
				death_reason = death_disappeared_into_slave_markets
				killer = root
			}
		}
		scope:follower_5 = {
			death = {
				death_reason = death_disappeared_into_slave_markets
				killer = root
			}
		}
		scope:follower_6 = {
			death = {
				death_reason = death_disappeared_into_slave_markets
				killer = root
			}
		}
		scope:follower_7 = {
			death = {
				death_reason = death_disappeared_into_slave_markets
				killer = root
			}
		}
		scope:follower_8 = {
			death = {
				death_reason = death_disappeared_into_slave_markets
				killer = root
			}
		}
		# Sort out opinions.
		## We make a fake version first for easier tooltipping.
		show_as_tooltip = {
			every_courtier = {
				limit = {
					ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes
					has_trait = callous
				}
				custom = custom.every_callous_follower
				add_opinion = {
					target = root
					modifier = practical_opinion
					opinion = 30
				}
			}
			every_courtier = {
				limit = {
					ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes
					has_trait = compassionate
				}
				custom = custom.every_compassionate_follower
				add_opinion = {
					target = root
					modifier = callous_opinion
					opinion = -100
				}
			}
			every_courtier = {
				limit = {
					ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes
					NOR = {
						has_trait = compassionate
						has_trait = callous
					}
				}
				custom = custom.every_other_follower
				add_opinion = {
					target = root
					modifier = outraged_opinion
					opinion = -50
				}
			}
		}
		## Then we process the actual list.
		hidden_effect = {
			every_courtier = {
				# Compassionates.
				if = {
					limit = {
						ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes
						has_trait = compassionate
					}
					add_opinion = {
						target = root
						modifier = callous_opinion
						opinion = -100
					}
				}
				# Callous courtiers who didn't lose friends, consorts, or spouses.
				else_if = {
					limit = {
						has_trait = callous
						save_temporary_scope_as = char_temp
						NOT = {
							any_in_list = {
								list = sellable_courtiers_list
								OR = {
									AND = {
										reverse_opinion = {
											target = scope:char_temp
											value >= 30
										}
										OR = {
											is_consort_of = scope:char_temp
											is_close_or_extended_family_of = scope:char_temp
										}
									}
									has_any_moderate_good_relationship_with_character_trigger = { CHARACTER = scope:char_temp }
								}
							}
						}
					}
					add_opinion = {
						target = root
						modifier = practical_opinion
						opinion = 30
					}
				}
				else_if = {
					limit = {
						save_temporary_scope_as = char_temp
						NOT = {
							any_in_list = {
								list = sellable_courtiers_list
								count = all
								OR = {
									reverse_opinion = {
										target = scope:char_temp
										value <= -80
									}
									has_any_moderate_bad_relationship_with_character_trigger = { CHARACTER = scope:char_temp }
								}
							}
						}
					}
					add_opinion = {
						target = root
						modifier = outraged_opinion
						opinion = -50
					}
				}
			}
		}
		# Last, but by no means least, gallowsbait.
		laamp_rewards_apply_criminal_xp_effect = {
			TRACK = marauder
			XP_MAX = gallowsbait_xp_major_gain
			XP_MIN = gallowsbait_xp_major_gain
		}

		stress_impact = {
			callous = major_stress_impact_loss
			arbitrary = medium_stress_impact_loss
			just = massive_stress_impact_gain
			compassionate = massive_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_greed = 2
				ai_compassion = -3
			}
		}
	}

	# Ignore the cries and hope for the best.
	option = {
		name = ep3_laamp_flavour_ewan.4071.d

		random_list = {
			25 = {
				desc = ep3_laamp_flavour_ewan.4071.d.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4071.d.tt.success
					scope:slaver = {
						death = { death_reason = death_attacking_laamp_train }
					}
				}
			}
			75 = {
				desc = ep3_laamp_flavour_ewan.4071.d.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4071.d.tt.failure
					add_prestige = medium_prestige_loss
					ep3_laamp_flavour_ewan_4071_lose_courtiers_effect = yes
				}
			}
		}

		stress_impact = {
			craven = medium_stress_impact_loss
			brave = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_energy = 1
				ai_honor = -0.5
			}
		}
	}

	after = {
		# If we're slowed due to multi, resume travel.
		mp_resume_travel_plan = yes
		# Whatever else happens, our slaver is gone.
		hidden_effect = {
			scope:slaver = {
				if = {
					limit = {
						is_alive = yes
						NOT = { exists = scope:duel_begun }
					}
					death = { death_reason = death_vanished }
				}
			}
		}
	}
}

ep3_laamp_flavour_ewan.4072 = {
	hidden = yes

	immediate = {
		if = {
			limit = { scope:sc_victor = root }
			root = { trigger_event = ep3_laamp_flavour_ewan.4073 }
		}
		else = { ep3_laamp_flavour_ewan_4071_lose_courtiers_effect = yes }
	}
}

#	You won the single combat!
ep3_laamp_flavour_ewan.4073 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.4073.t
	desc = ep3_laamp_flavour_ewan.4073.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = random_weapon_celebrate
	}
	override_background = { reference = battlefield }

	# Victory!
	option = {
		name = ep3_laamp_flavour_ewan.4073.a

		ep3_laamp_flavour_ewan_4071_won_duel_effect = yes

		# No stress here.
		ai_chance = {
			# No logic needed for notification event.
			base = 1
		}
	}
}

##################################################
# Born of Desperation
# by Ewan Cowhig Croft
# 4081 - 4090
##################################################

scripted_effect ep3_laamp_flavour_ewan_4081_duel_loss_effect = {
	add_prestige = medium_prestige_loss
	increase_wounds_effect = { REASON = starving_peasant_horde }
	domicile = {
		change_provisions = {
			value = scope:provisions_loss
			multiply = -1
		}
	}
}

scripted_effect ep3_laamp_flavour_ewan_4081_roll_non_financial_duel_effect = {
	duel = {
		skill = $SKILL$
		value = high_skill_rating
		# Victory!
		50 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = 3.5
				min = -49
			}
			min = 5
			desc = $VICTORY_LOC$
			send_interface_toast = {
				title = $VICTORY_LOC$
				add_prestige = medium_prestige_gain
				every_courtier = {
					limit = { ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes }
					custom = custom.every_adult_follower
					add_opinion = {
						target = root
						modifier = respect_opinion
						opinion = 20
					}
				}
			}
		}
		# Defeat.
		50 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = -3.5
				min = -49
			}
			min = 5
			desc = $DEFEAT_LOC$
			send_interface_toast = {
				title = $DEFEAT_LOC$
				ep3_laamp_flavour_ewan_4081_duel_loss_effect = yes
			}
		}
	}
}

#	Hungry locals swarm at you, searching for food.
ep3_laamp_flavour_ewan.4081 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.4081.t
	desc = {
		desc = ep3_laamp_flavour_ewan.4081.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { scope:hunger_type = flag:epidemic }
				desc = ep3_laamp_flavour_ewan.4081.desc.epidemic
			}
			triggered_desc = {
				trigger = { scope:hunger_type = flag:mundane }
				desc = ep3_laamp_flavour_ewan.4081.desc.mundane
			}
		}
		desc = ep3_laamp_flavour_ewan.4081.desc.outro
	}
	theme = widgetless_travel_danger
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:local_peasant
		animation = aggressive_spear
		outfit_tags = { beggar_rags }
		hide_info = yes
	}
	override_background = { reference = wilderness }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_available_travelling_adult = yes
		current_travel_plan = { is_travel_with_domicile = yes }
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_4081 }
		}
		# Must have the correct travel danger type.
		location = {
			OR = {
				travel_danger_type = {
					travel_plan = root.current_travel_plan
					type = county_control
				}
				travel_danger_type = {
					travel_plan = root.current_travel_plan
					type = epidemic
				}
			}
		}
		# A mob won't attack forces over a certain size, even assuming you're spread out in a long line.
		current_military_strength < @ep3_laamp_flavour_ewan_baggage_train_has_significant_armed_force
	}

	immediate = {
		# Slow down in MP.
		mp_delay_travel_plan = { DAYS = 90 }
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_4081
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_4081
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_shorter
			}
		}
		# Increment XP.
		traveler_danger_xp_effect = {
			MIN = 1
			MAX = 3
		}
		# Check to see if this is a generic famine or an epidemic-induced one.
		if = {
			limit = {
				location = {
					any_province_epidemic = { }
				}
			}
			save_scope_value_as = {
				name = hunger_type
				value = flag:epidemic
			}
		}
		else ={
			save_scope_value_as = {
				name = hunger_type
				value = flag:mundane
			}
		}
		# How many provisions do we need to surrender?
		save_scope_value_as = {
			name = provisions_loss
			value = {
				add = domicile.provisions
				multiply = 0.2
				floor = yes
				min = @ep3_laamp_flavour_ewan_4000_min_provisions_worth_attacking
			}
		}
		# Save our county for loc.
		location.county = { save_scope_as = current_county }
		# Create a peasant to look annoyed for players.
		if = {
			limit = { is_ai = no }
			hidden_effect = {
				random_list = {
					90 = {
						create_character = {
							template = generic_peasant_character
							location = root.location
							culture = root.location.culture
							faith = root.location.faith
							prowess = 16
							save_scope_as = local_peasant
							after_creation = {
								change_current_weight = -100
								add_character_flag = no_headgear
							}
						}
					}
					10 = {
						create_character = {
							template = diseased_peasant_character
							location = root.location
							culture = root.location.culture
							faith = root.location.faith
							prowess = 16
							save_scope_as = local_peasant
							after_creation = {
								change_current_weight = -100
								add_character_flag = no_headgear
							}
						}
					}
				}
			}
		}
	}

	# Diplomacy duel to try and calm them.
	option = {
		name = ep3_laamp_flavour_ewan.4081.a

		ep3_laamp_flavour_ewan_4081_roll_non_financial_duel_effect = {
			SKILL = diplomacy
			VICTORY_LOC = ep3_laamp_flavour_ewan.4081.a.tt.success
			DEFEAT_LOC = ep3_laamp_flavour_ewan.4081.a.tt.failure
		}

		stress_impact = {
			calm = miniscule_stress_impact_loss
			compassionate = miniscule_stress_impact_loss
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_compassion = 1 }
		}
	}

	# Stewardship duel to try and force them to pay.
	option = {
		name = ep3_laamp_flavour_ewan.4081.b

		duel = {
			skill = stewardship
			value = high_skill_rating
			# Victory!
			60 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4081.b.tt.success
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4081.b.tt.success
					add_gold = medium_gold_laamps_value
					every_courtier = {
						limit = {
							ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes
							OR = {
								has_trait = compassionate
								has_trait = generous
							}
							# Compassionate overrules greedy, but callous and sadistic overrule generous.
							NOR = {
								has_trait = callous
								has_trait = sadistic
							}
						}
						custom = ep3_laamp_flavour_ewan.4081.b.tt.success.every_compassionate_or_generous_follower
						add_opinion = {
							target = root
							modifier = callous_opinion
							opinion = -30
						}
					}
					every_courtier = {
						limit = {
							ep3_laamp_flavour_ewan_available_courtier_travel_danger_trigger = yes
							OR = {
								has_trait = callous
								has_trait = sadistic
								has_trait = greedy
							}
							# Callous and sadistic overrule generous, but compassionate overrules greedy.
							NOT = { has_trait = compassionate }
						}
						custom = ep3_laamp_flavour_ewan.4081.b.tt.success.every_callous_greedy_or_sadistic_follower
						add_opinion = {
							target = root
							modifier = practical_opinion
							opinion = 30
						}
					}
				}
			}
			# Defeat.
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep3_laamp_flavour_ewan.4081.b.tt.failure
				send_interface_toast = {
					title = ep3_laamp_flavour_ewan.4081.b.tt.failure
					ep3_laamp_flavour_ewan_4081_duel_loss_effect = yes
				}
			}
		}

		stress_impact = {
			greedy = medium_stress_impact_loss
			callous = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
			compassionate = medium_stress_impact_gain
			generous = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_greed = 1
				ai_compassion = -0.5
			}
		}
	}

	# Martial duel to force them back.
	option = {
		name = ep3_laamp_flavour_ewan.4081.c

		ep3_laamp_flavour_ewan_4081_roll_non_financial_duel_effect = {
			SKILL = martial
			VICTORY_LOC = ep3_laamp_flavour_ewan.4081.c.tt.success
			DEFEAT_LOC = ep3_laamp_flavour_ewan.4081.c.tt.failure
		}

		stress_impact = {
			wrathful = medium_stress_impact_loss
			callous = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
			calm = minor_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_boldness = 1
				ai_compassion = -0.5
			}
		}
	}

	# Accept and let them take X provisions.
	option = {
		name = ep3_laamp_flavour_ewan.4081.d
		trigger = { domicile.provisions >= scope:provisions_loss }
		show_as_unavailable = { always = yes }

		add_prestige = miniscule_prestige_loss
		domicile = {
			change_provisions = {
				value = scope:provisions_loss
				multiply = -1
			}
		}

		stress_impact = {
			calm = miniscule_stress_impact_loss
			generous = miniscule_stress_impact_loss
			compassionate = miniscule_stress_impact_loss
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
			greedy = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = -1 }
		}
	}

	# If we're slowed due to multi, resume travel.
	after = {
		mp_resume_travel_plan = yes
		# Clean up our peasant.
		scope:local_peasant ?= { silent_disappearance_effect = yes }
	}
}

##################################################
# Night Attack
# by Ewan Cowhig Croft
# 4091 - 4100
##################################################

scripted_effect ep3_laamp_flavour_ewan_4091_roll_duel_effect = {
	duel = {
		skill = $SKILL$
		value = very_high_skill_rating
		# Victory!
		50 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = 3.5
				min = -49
			}
			min = 5
			desc = $SUCCESS_LOC$
			send_interface_toast = {
				title = $SUCCESS_LOC$
				add_prestige = medium_prestige_gain
			}
		}
		# Defeat.
		50 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = -3.5
				min = -49
			}
			min = 5
			desc = $FAILURE_LOC$
			send_interface_toast = {
				title = $FAILURE_LOC$
				increase_wounds_effect = { REASON = battle }
				random_courtier = {
					limit = { location = root.location }
					increase_wounds_effect = { REASON = battle }
					save_temporary_scope_as = courtier_1
				}
				random_courtier = {
					limit = {
						location = root.location
						this != scope:courtier_1
					}
					increase_wounds_effect = { REASON = battle }
					save_temporary_scope_as = courtier_2
				}
				random_courtier = {
					limit = {
						location = root.location
						this != scope:courtier_1
						this != scope:courtier_2
					}
					increase_wounds_effect = { REASON = battle }
				}
			}
		}
	}
}

#	Unknown group assaults your camp one evening.
ep3_laamp_flavour_ewan.4091 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.4091.t
	desc = ep3_laamp_flavour_ewan.4091.desc
	theme = widgetless_travel_danger
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:retainer
		animation = aggressive_sword
		outfit_tags = { military_outfit }
		hide_info = yes
	}
	override_background = { reference = ep3_campfire }

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_available_travelling_adult = yes
		current_travel_plan = { is_travel_with_domicile = yes }
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_4091 }
		}
		# Must have the correct travel danger type.
		location = {
			OR = {
				travel_danger_type = {
					travel_plan = root.current_travel_plan
					type = owner_opinion
				}
				travel_danger_type = {
					travel_plan = root.current_travel_plan
					type = county_control
				}
			}
		}
		# Plus rule out anyone who'd have likely have a palisade.
		NOT = {
			domicile = { has_domicile_building = camp_perimeter_palisade }
		}
	}

	immediate = {
		# Slow down in MP.
		mp_delay_travel_plan = { DAYS = 90 }
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_4091
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_4091
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_shorter
			}
		}
		# Increment XP.
		traveler_danger_xp_effect = {
			MIN = 1
			MAX = 3
		}
		# Save our county for loc.
		location.county = { save_scope_as = current_county }
		# Create a bandit to look annoyed for players.
		if = {
			limit = { is_ai = no }
			hidden_effect = {
				create_character = {
					template = mercenary
					employer = root.location.county.holder
					culture = root.location.culture
					faith = root.location.county.holder.faith
					gender_female_chance = root_soldier_female_chance
					save_scope_as = retainer
				}
			}
		}
	}

	# Martial duel to fight them off.
	option = {
		name = ep3_laamp_flavour_ewan.4091.a

		ep3_laamp_flavour_ewan_4091_roll_duel_effect = {
			SKILL = martial
			SUCCESS_LOC = ep3_laamp_flavour_ewan.4091.a.tt.success
			FAILURE_LOC = ep3_laamp_flavour_ewan.4091.a.tt.failure
		}

		# No stress here.
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_rationality = 1 }
		}
	}

	# Prowess duel to launch yourself into the frey.
	option = {
		name = ep3_laamp_flavour_ewan.4091.b

		ep3_laamp_flavour_ewan_4091_roll_duel_effect = {
			SKILL = prowess
			SUCCESS_LOC = ep3_laamp_flavour_ewan.4091.b.tt.success
			FAILURE_LOC = ep3_laamp_flavour_ewan.4091.b.tt.failure
		}

		stress_impact = {
			brave = minor_stress_impact_loss
			craven = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = 1 }
		}
	}

	# Hide from the chaos.
	option = {
		name = ep3_laamp_flavour_ewan.4091.c

		every_courtier = {
			limit = {
				location = root.location
				NOT = { has_trait = craven }
			}
			custom = ep3_laamp_flavour_ewan.4091.c.every_non_craven_follower
			add_opinion = {
				target = root
				modifier = disgusted_opinion
				opinion = -25
			}
		}

		stress_impact = {
			craven = minor_stress_impact_loss
			brave = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = { ai_boldness = -1 }
		}
	}

	# If we're slowed due to multi, resume travel.
	after = { mp_resume_travel_plan = yes }
}











##################################################
# LOANED COURTIER RETURNS

##################################################
# Core Tombola
# by Ewan Cowhig Croft
# 9501 - 9510
##################################################

scripted_trigger ep3_laamp_flavour_ewan_9501_culture_to_adopt_trigger = {
	culture = {
		OR = {
			this != prev.host.culture
			this != prev.host.capital_county.culture
		}
	}
}

scripted_trigger ep3_laamp_flavour_ewan_9501_faith_sin_virtue_check_trigger = {
	num_sinful_traits = {
		value <= 0
		target = $FAITH$
	}
	num_virtuous_traits = {
		value >= 1
		target = $FAITH$
	}
}

scripted_trigger ep3_laamp_flavour_ewan_9501_character_would_go_idea_shopping_trigger = {
	NOT  = { has_character_flag = ai_will_not_convert }
	faith = {
		NOR = {
			this = prev.host.faith
			this = prev.host.capital_county.faith
		}
	}
	# Cynics don't care enough to switch
	## Or rather, they switch for entirely cynical reasons and we're portraying this as more of a finding-your-true-self thing.
	NOT = { has_trait = cynical }
	# Religious characters compare what faiths fit them best.
	OR = {
		# Non-zealous characters will consider a switch if they're not virtuous but would be in a new faith.
		AND = {
			NOT = { has_trait = zealous }
			num_virtuous_traits = {
				value <= 0
				target = faith
			}
			OR = {
				ep3_laamp_flavour_ewan_9501_faith_sin_virtue_check_trigger = { FAITH = host.faith }
				ep3_laamp_flavour_ewan_9501_faith_sin_virtue_check_trigger = { FAITH = host.capital_county.faith }
			}
		}
		# Zealous characters will _also_ switch, but also need to feel like they're sinful in their current faith.
		AND = {
			has_trait = zealous
			num_sinful_traits = {
				value >= 1
				target = faith
			}
			num_virtuous_traits = {
				value <= 0
				target = faith
			}
			OR = {
				ep3_laamp_flavour_ewan_9501_faith_sin_virtue_check_trigger = { FAITH = host.faith }
				ep3_laamp_flavour_ewan_9501_faith_sin_virtue_check_trigger = { FAITH = host.capital_county.faith }
			}
		}
	}
}

#	Takes care of returning to camp after a period away.
ep3_laamp_flavour_ewan.9501 = {
	hidden = yes

	trigger = {
		is_imprisoned = no
		scope:visitor = {
			is_alive = yes
			is_imprisoned = no
			is_incapable = no
		}
	}

	on_trigger_fail = {
		# Dead.
		if = {
			limit = {
				scope:visitor = { is_alive = no }
			}
			trigger_event = ep3_laamp_flavour_ewan.9531
		}
		# Imprisoned.
		else_if = {
			limit = {
				scope:visitor = { is_imprisoned = yes }
			}
			trigger_event = ep3_laamp_flavour_ewan.9532
		}
		# Incapable.
		else_if = {
			limit = {
				scope:visitor = { is_incapable = yes }
			}
			trigger_event = ep3_laamp_flavour_ewan.9533
		}
		# If we're imprisoned, just return them to camp with no fanfare.
		else_if = {
			limit = { is_imprisoned = yes }
			scope:visitor = { return_to_court = yes }
		}
		# Fallback (we don't know what's happened to them).
		else = { trigger_event = ep3_laamp_flavour_ewan.9534 }
	}

	immediate = {
		# Wherever they were, we give them the language of the place & their soon-to-be-former host if they didn't speak them already.
		scope:visitor = {
			# Prio the host's language.
			if = {
				limit = {
					NOT = { knows_language_of_culture = host.culture }
					current_extra_languages < language_soft_cap
				}
				learn_language_of_culture = host.culture
			}
			# Then the local tongue.
			if = {
				limit = {
					NOT = { knows_language_of_culture = host.capital_county.culture }
					current_extra_languages < language_soft_cap
				}
				learn_language_of_culture = host.capital_county.culture
			}
			# Nab our host scopes so we can reference them in loc.
			host = {
				save_scope_as = host
				capital_county = { save_scope_as = capital }
			}
		}
		# Next, determine what event we get when they return.
		## Try to have these add up to 100%.
		random_list = {
			# They're the same as ever.
			60 = {
				trigger_event = ep3_laamp_flavour_ewan.9511
				# Boosts for other entries come out of this one, so we reduce the likelihood based on modifiers further down.
				modifier = {
					add = -20
					scope:visitor = { has_trait = gregarious }
				}
				modifier = {
					add = -60
					scope:visitor = {
						has_trait = zealous
						ep3_laamp_flavour_ewan_9501_character_would_go_idea_shopping_trigger = yes
					}
				}
			}
			# They've learnt a thing or two.
			25 = {
				trigger_event = ep3_laamp_flavour_ewan.9512
			}
			# They have taken on the local culture.
			5 = {
				trigger = {
					scope:visitor = {
						ep3_laamp_flavour_ewan_9501_culture_to_adopt_trigger = yes
						NOT = { has_character_flag = laamp_follower_tombola_changed_culture_flag }
					}
				}
				scope:visitor = { add_character_flag = laamp_follower_tombola_changed_culture_flag }
				trigger_event = ep3_laamp_flavour_ewan.9521
				# More likely for gregarious characters.
				modifier = {
					add = 20
					scope:visitor = { has_trait = gregarious }
				}
				# Less likely for shy characters.
				modifier = {
					add = -5
					scope:visitor = { has_trait = shy }
				}
			}
			# They have adopted the local faith.
			5 = {
				# Zealous characters won't ever consider this unless they have a sin-virtue mismatch.
				trigger = {
					scope:visitor = {
						ep3_laamp_flavour_ewan_9501_character_would_go_idea_shopping_trigger = yes
						NOT = { has_character_flag = laamp_follower_tombola_changed_faith_flag }
					}
				}
				scope:visitor = { add_character_flag = laamp_follower_tombola_changed_faith_flag }
				trigger_event = ep3_laamp_flavour_ewan.9522
				# If zealous characters are valid for this, then it means the new faith is a much better fit, so we weight them up drastically.
				modifier = {
					add = 60
					scope:visitor = { has_trait = zealous }
				}
			}
			# They've taken both the culture and the faith
			5 = {
				trigger = {
					scope:visitor = {
						ep3_laamp_flavour_ewan_9501_culture_to_adopt_trigger = yes
						# Zealous characters won't ever consider this unless they have a sin-virtue mismatch.
						ep3_laamp_flavour_ewan_9501_character_would_go_idea_shopping_trigger = yes
						NOR = {
							has_character_flag = laamp_follower_tombola_changed_culture_flag
							has_character_flag = laamp_follower_tombola_changed_faith_flag
						}
					}
				}
				scope:visitor = {
					add_character_flag = laamp_follower_tombola_changed_culture_flag
					add_character_flag = laamp_follower_tombola_changed_faith_flag
				}
				trigger_event = ep3_laamp_flavour_ewan.9523
				# More likely for gregarious characters.
				modifier = {
					add = 20
					scope:visitor = { has_trait = gregarious }
				}
				# Less likely for shy characters.
				modifier = {
					add = -5
					scope:visitor = { has_trait = shy }
				}
				# If zealous characters are valid for this, then it means the new faith is a much better fit, so we weight them up drastically.
				modifier = {
					add = 60
					scope:visitor = { has_trait = zealous }
				}
			}
		}
	}
}

##################################################
# Follower Returned
# by Ewan Cowhig Croft
# 9511 - 9520
##################################################

scripted_effect ep3_laamp_flavour_ewan_9511_standard_drive_away_char_stress_effect = {
	stress_impact = {
		sadistic = minor_stress_impact_loss
		callous = miniscule_stress_impact_loss
		compassionate = medium_stress_impact_gain
	}
}

#	Follower returns, the same as when they left.
ep3_laamp_flavour_ewan.9511 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.9511.t
	desc = {
		desc = ep3_laamp_flavour_ewan.9511.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:visitor_spouse }
				desc = ep3_laamp_flavour_ewan.9511.desc.spouse.got_married
			}
			desc = ep3_laamp_flavour_ewan.9511.desc.spouse.nope
		}
		desc = ep3_laamp_flavour_ewan.9511.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = personality_honorable
	}
	right_portrait = {
		character = scope:visitor
		animation = happiness
	}
	lower_right_portrait = scope:visitor_spouse
	override_background = { reference = ep3_campfire }

	immediate = {
		scope:visitor = {
			# Have they have gotten married to a local?
			if = {
				limit = {
					can_marry_trigger = yes
					OR = {
						NOT = { has_sexuality = homosexual }
						allowed_to_marry_same_sex_trigger = yes
					}
					might_cheat_on_every_partner_trigger = yes
				}
				random = {
					chance = {
						value = 20
						# Reduce this a little for each existing marriage.
						every_spouse = { add = -5 }
						# Gregarious characters go out more.
						if = {
							limit = { has_trait = gregarious }
							add = 10
						}
						# Lustful characters are potentially in the market.
						if = {
							limit = { has_trait = gregarious }
							add = 5
						}
					}
					# Create our new char.
					save_scope_as = attraction_check
					create_character = {
						employer = root
						age = {
							value = scope:visitor.age
							integer_range = {
								min = -5
								max = 5
							}
							min = 20
							max = 85
						}
						gender_female_chance = scope_attraction_based_female_chance
						culture = scope:visitor.host.capital_county.culture
						faith = scope:visitor.host.capital_county.faith
						dynasty = none
						diplomacy = {
							min_template_low_skill
							max_template_medium_skill
						}
						martial = {
							min_template_low_skill
							max_template_medium_skill
						}
						stewardship = {
							min_template_low_skill
							max_template_medium_skill
						}
						intrigue = {
							min_template_low_skill
							max_template_medium_skill
						}
						learning = {
							min_template_low_skill
							max_template_medium_skill
						}
						prowess = {
							min_template_low_skill
							max_template_medium_skill
						}
						random_traits = no
						# Education
						random_traits_list = {
							count = 1
							education_diplomacy_2  = {}
							education_martial_2  = {}
							education_stewardship_2  = {}
							education_intrigue_2  = {}
							education_learning_2  = {}
						}
						# Personality traits that match their partner
						random_traits_list = {
							count = 2
							lustful = {
								trigger = {
									scope:visitor = { has_trait = lustful }
								}
							}
							chaste = {
								trigger = {
									scope:visitor = { has_trait = chaste }
								}
							}
							gluttonous = {
								trigger = {
									scope:visitor = { has_trait = gluttonous }
								}
							}
							temperate = {
								trigger = {
									scope:visitor = { has_trait = temperate }
								}
							}
							greedy = {
								trigger = {
									scope:visitor = { has_trait = greedy }
								}
							}
							generous = {
								trigger = {
									scope:visitor = { has_trait = generous }
								}
							}
							lazy = {
								trigger = {
									scope:visitor = { has_trait = lazy }
								}
							}
							diligent = {
								trigger = {
									scope:visitor = { has_trait = diligent }
								}
							}
							wrathful = {
								trigger = {
									scope:visitor = { has_trait = wrathful }
								}
							}
							calm = {
								trigger = {
									scope:visitor = { has_trait = calm }
								}
							}
							patient = {
								trigger = {
									scope:visitor = { has_trait = patient }
								}
							}
							impatient = {
								trigger = {
									scope:visitor = { has_trait = impatient }
								}
							}
							arrogant = {
								trigger = {
									scope:visitor = { has_trait = arrogant }
								}
							}
							humble = {
								trigger = {
									scope:visitor = { has_trait = humble }
								}
							}
							deceitful = {
								trigger = {
									scope:visitor = { has_trait = deceitful }
								}
							}
							honest = {
								trigger = {
									scope:visitor = { has_trait = honest }
								}
							}
							craven = {
								trigger = {
									scope:visitor = { has_trait = craven }
								}
							}
							brave = {
								trigger = {
									scope:visitor = { has_trait = brave }
								}
							}
							shy = {
								trigger = {
									scope:visitor = { has_trait = shy }
								}
							}
							gregarious = {
								trigger = {
									scope:visitor = { has_trait = gregarious }
								}
							}
							ambitious = {
								trigger = {
									scope:visitor = { has_trait = ambitious }
								}
							}
							content = {
								trigger = {
									scope:visitor = { has_trait = content }
								}
							}
							arbitrary = {
								trigger = {
									scope:visitor = { has_trait = arbitrary }
								}
							}
							just = {
								trigger = {
									scope:visitor = { has_trait = just }
								}
							}
							cynical = {
								trigger = {
									scope:visitor = { has_trait = cynical }
								}
							}
							zealous = {
								trigger = {
									scope:visitor = { has_trait = zealous }
								}
							}
							paranoid = {
								trigger = {
									scope:visitor = { has_trait = paranoid }
								}
							}
							trusting = {
								trigger = {
									scope:visitor = { has_trait = trusting }
								}
							}
							compassionate = {
								trigger = {
									scope:visitor = { has_trait = compassionate }
								}
							}
							callous = {
								trigger = {
									scope:visitor = { has_trait = callous }
								}
							}
							sadistic = {
								trigger = {
									scope:visitor = { has_trait = sadistic }
								}
							}
							stubborn = {
								trigger = {
									scope:visitor = { has_trait = stubborn }
								}
							}
							fickle = {
								trigger = {
									scope:visitor = { has_trait = fickle }
								}
							}
							vengeful = {
								trigger = {
									scope:visitor = { has_trait = vengeful }
								}
							}
							forgiving = {
								trigger = {
									scope:visitor = { has_trait = forgiving }
								}
							}
							eccentric = {
								trigger = {
									scope:visitor = { has_trait = eccentric }
								}
							}
						}
						# +1 random personality trait
						random_traits_list = {
							count = 1
							lustful = {}
							chaste = {}
							gluttonous = {}
							temperate = {}
							greedy = {}
							generous = {}
							lazy = {}
							diligent = {}
							wrathful = {}
							calm = {}
							patient = {}
							impatient = {}
							arrogant = {}
							humble = {}
							deceitful = {}
							honest = {}
							craven = {}
							brave = {}
							shy = {}
							gregarious = {}
							ambitious = {}
							content = {}
							arbitrary = {}
							just = {}
							cynical = {}
							zealous = {}
							paranoid = {}
							trusting = {}
							compassionate = {}
							callous = {}
							sadistic = {}
							stubborn = {}
							fickle = {}
							vengeful = {}
							forgiving = {}
							eccentric = {}
						}
						# Somethings to spice 'em up.
						random_traits_list = {
							count = { 1 2 }
							# Lifestyles
							lifestyle_reveler = {}
							lifestyle_blademaster = {}
							lifestyle_hunter = {}
							lifestyle_mystic = {}
							lifestyle_physician = {}
							lifestyle_herbalist = {}
							lifestyle_gardener = {}
							# Stress
							drunkard = {}
							rakish = {}
							reclusive = {}
							irritable = {}
							flagellant = {}
							profligate = {}
							improvident = {}
							contrite = {}
							comfort_eater = {}
							inappetetic = {}
							journaller = {}
							confider = {}
							athletic = {}
							# Fame
							lifestyle_poet = {}
							loyal = {}
							disloyal = {}
							gallowsbait = {}
							# Health
							depressed_genetic = {}
							lunatic_genetic = {}
							possessed_genetic = {}
							one_eyed = {}
							one_legged = {}
							disfigured = {}
							# Genetic
							beauty_bad_1 = {}
							beauty_good_1 = {}
							intellect_bad_1 = {}
							intellect_good_1 = {}
							physique_bad_1 = {}
							physique_good_1 = {}
							clubfooted = {}
							hunchbacked = {}
							lisping = {}
							stuttering = {}
							dwarf = {}
							giant = {}
							spindly = {}
							scaly = {}
							albino = {}
							wheezing = {}
							bleeder = {}
							infertile = {}
							# Natural
							fecund = {}
							strong = {}
							shrewd = {}
						}
						save_scope_as = visitor_spouse
						after_creation = { set_sexuality = bisexual }
					}
					# Alright, now let's marry 'em up.
					if = {
						limit = { is_female = yes }
						marry_matrilineal = scope:visitor_spouse
					}
					else = { marry = scope:visitor_spouse }
					# Aaaand make sure that the marriage is a happy one.
					hidden_effect = {
						set_random_lover_reason = { TARGET = scope:visitor_spouse }
						add_opinion = {
							target = scope:visitor_spouse
							modifier = love_opinion
							opinion = 100
						}
						reverse_add_opinion = {
							target = scope:visitor_spouse
							modifier = love_opinion
							opinion = 100
						}
					}
				}
			}
			# And send 'em home.
			return_to_court = yes
		}
	}

	# Welcome, welcome!
	option = {
		name = ep3_laamp_flavour_ewan.9511.a

		# No stress here.
		# The AI should always just uncritically take people back.
		ai_chance = { base = 100 }
	}

	# _Married?_ I think not!
	option = {
		name = ep3_laamp_flavour_ewan.9511.b
		trigger = { exists = scope:visitor_spouse }

		# Divorce.
		scope:visitor = { divorce = scope:visitor_spouse }
		# Banish them.
		remove_courtier_or_guest = {
			character = scope:visitor_spouse
			new_location = scope:host.capital_county.title_province
		}
		# And apply some opinions.
		scope:visitor = {
			add_opinion = {
				modifier = forced_divorce_opinion
				target = root
			}
		}
		scope:visitor_spouse = {
			add_opinion = {
				modifier = forced_divorce_opinion
				target = root
			}
		}

		stress_impact = {
			sadistic = major_stress_impact_loss
			callous = miniscule_stress_impact_loss
			compassionate = major_stress_impact_gain
		}
		# The AI should never take this option.
		ai_chance = { base = 0 }
	}

	# You are no longer welcome with us.
	option = {
		name = ep3_laamp_flavour_ewan.9511.c

		scope:visitor = { select_and_move_to_pool_effect = yes }

		ep3_laamp_flavour_ewan_9511_standard_drive_away_char_stress_effect = yes
		# The AI should never take this option.
		ai_chance = { base = 0 }
	}
}

#	Follower returns and they've learnt a thing or two.
ep3_laamp_flavour_ewan.9512 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.9512.t
	desc = ep3_laamp_flavour_ewan.9512.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:visitor
		triggered_animation = {
			trigger = { scope:skill = flag:diplomacy }
			animation = chancellor
		}
		triggered_animation = {
			trigger = {
				OR = {
					scope:skill = flag:martial
					scope:skill = flag:prowess
				}
			}
			animation = marshal
		}
		triggered_animation = {
			trigger = { scope:skill = flag:stewardship }
			animation = steward
		}
		triggered_animation = {
			trigger = { scope:skill = flag:intrigue }
			animation = spymaster
		}
		triggered_animation = {
			trigger = { scope:skill = flag:learning }
			animation = chaplain
		}
		animation = hero_flex
	}
	override_background = { reference = ep3_campfire }

	immediate = {
		scope:visitor = {
			# Sort how much skill we'll be adding.
			save_scope_value_as = {
				name = skill_gain
				value = {
					integer_range = {
						min = 2
						max = 4
					}
					if = {
						limit = { has_trait = diligent }
						add = 1
					}
					else_if = {
						limit = { has_trait = lazy }
						add = -1
					}
				}
			}
			# Now add it to the highest skill that scope:visitor has.
			switch = {
				trigger = highest_skill
				diplomacy = { add_diplomacy_skill = scope:skill_gain }
				martial = { add_martial_skill = scope:skill_gain }
				stewardship = { add_stewardship_skill = scope:skill_gain }
				intrigue = { add_intrigue_skill = scope:skill_gain }
				learning = { add_learning_skill = scope:skill_gain }
			}
			# Finally, return them to court.
			return_to_court = yes
		}
	}

	# How you've improved, scope:visitor!
	option = {
		name = ep3_laamp_flavour_ewan.9512.a

		# No effect.

		# No stress here.
		# The AI should always just uncritically take people back.
		ai_chance = { base = 100 }
	}

	# Begone, vagabond.
	option = {
		name = ep3_laamp_flavour_ewan.9512.b

		scope:visitor = { select_and_move_to_pool_effect = yes }

		ep3_laamp_flavour_ewan_9511_standard_drive_away_char_stress_effect = yes
		# The AI should never take this option.
		ai_chance = { base = 0 }
	}
}

##################################################
# Not As I Remember You
# by Ewan Cowhig Croft
# 9521 - 9530
##################################################

scripted_effect ep3_laamp_flavour_ewan_9521_change_visitor_culture_effect = {
	scope:visitor = {
		culture = { save_scope_as = old_culture }
		random_list = {
			100 = {
				trigger = {
					this != host.culture
				}
				set_culture = host.culture
				save_scope_value_as = {
					name = culture_change
					value = flag:host
				}
			}
			100 = {
				trigger = {
					this != host.capital_county.culture
				}
				set_culture = host.capital_county.culture
				save_scope_value_as = {
					name = culture_change
					value = flag:capital
				}
			}
		}
		culture = { save_scope_as = new_culture }
	}
}

scripted_effect ep3_laamp_flavour_ewan_9521_register_culture_change_reaction_effect = {
	# Sort our reactions.
	## They changed away from our culture.
	if = {
		limit = { culture = scope:old_culture }
		save_scope_value_as = {
			name = culture_reaction
			value = flag:changed_away
		}
	}
	## They changed _to_ our culture.
	else_if = {
		limit = { culture = scope:new_culture }
		save_scope_value_as = {
			name = culture_reaction
			value = flag:changed_to
		}
	}
	## They simply changed culture.
	else = {
		save_scope_value_as = {
			name = culture_reaction
			value = flag:uninvolved
		}
	}
}

scripted_effect ep3_laamp_flavour_ewan_9521_apply_ethos_skill_bonuses_effect = {
	# They've learnt a lot from their new ethos (even if it was the same as their old one).
	## First, randomise our values.
	save_scope_value_as = {
		name = skill_2
		value = {
			integer_range = {
				min = 2
				max = 5
			}
		}
	}
	save_scope_value_as = {
		name = skill_1
		value = {
			integer_range = {
				min = {
					value = scope:skill_2
					add = 1
				}
				max = 6
			}
		}
	}
	## Then apply them.
	switch = {
		trigger = has_cultural_pillar
		ethos_bellicose = {
			custom_tooltip = {
				text = ep3_laamp_flavour_ewan.9521.tt.primary_skill.martial
				add_martial_skill = scope:skill_1
			}
			custom_tooltip = {
				text = ep3_laamp_flavour_ewan.9521.tt.secondary_skill.prowess
				add_prowess_skill = scope:skill_2
			}
		}
		ethos_stoic = {
			custom_tooltip = {
				text = ep3_laamp_flavour_ewan.9521.tt.primary_skill.martial
				add_martial_skill = scope:skill_1
			}
			custom_tooltip = {
				text = ep3_laamp_flavour_ewan.9521.tt.secondary_skill.stewardship
				add_stewardship_skill = scope:skill_2
			}
		}
		ethos_bureaucratic = {
			custom_tooltip = {
				text = ep3_laamp_flavour_ewan.9521.tt.primary_skill.stewardship
				add_stewardship_skill = scope:skill_1
			}
			custom_tooltip = {
				text = ep3_laamp_flavour_ewan.9521.tt.secondary_skill.learning
				add_learning_skill = scope:skill_2
			}
		}
		ethos_spiritual = {
			custom_tooltip = {
				text = ep3_laamp_flavour_ewan.9521.tt.primary_skill.learning
				add_learning_skill = scope:skill_1
			}
			custom_tooltip = {
				text = ep3_laamp_flavour_ewan.9521.tt.secondary_skill.diplomacy
				add_diplomacy_skill = scope:skill_2
			}
		}
		ethos_courtly = {
			custom_tooltip = {
				text = ep3_laamp_flavour_ewan.9521.tt.primary_skill.diplomacy
				add_diplomacy_skill = scope:skill_1
			}
			custom_tooltip = {
				text = ep3_laamp_flavour_ewan.9521.tt.secondary_skill.intrigue
				add_intrigue_skill = scope:skill_2
			}
		}
		ethos_egalitarian = {
			custom_tooltip = {
				text = ep3_laamp_flavour_ewan.9521.tt.primary_skill.diplomacy
				add_diplomacy_skill = scope:skill_1
			}
			custom_tooltip = {
				text = ep3_laamp_flavour_ewan.9521.tt.secondary_skill.stewardship
				add_stewardship_skill = scope:skill_2
			}
		}
		ethos_communal = {
			custom_tooltip = {
				text = ep3_laamp_flavour_ewan.9521.tt.primary_skill.stewardship
				add_stewardship_skill = scope:skill_1
			}
			custom_tooltip = {
				text = ep3_laamp_flavour_ewan.9521.tt.secondary_skill.learning
				add_learning_skill = scope:skill_2
			}
		}
	}
}

#	Follower has taken on the culture of the place they stayed at.
ep3_laamp_flavour_ewan.9521 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.9521.t
	desc = {
		desc = ep3_laamp_flavour_ewan.9521.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { scope:culture_change = flag:host }
				desc = ep3_laamp_flavour_ewan.9521.desc.source.host
			}
			triggered_desc = {
				trigger = { scope:culture_change = flag:capital }
				desc = ep3_laamp_flavour_ewan.9521.desc.source.capital
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = { scope:culture_reaction = flag:changed_away }
				desc = ep3_laamp_flavour_ewan.9521.desc.reaction.changed_away
			}
			triggered_desc = {
				trigger = { scope:culture_reaction = flag:changed_to }
				desc = ep3_laamp_flavour_ewan.9521.desc.reaction.changed_to
			}
			triggered_desc = {
				trigger = { scope:culture_reaction = flag:uninvolved }
				desc = ep3_laamp_flavour_ewan.9521.desc.reaction.uninvolved
			}
		}
		desc = ep3_laamp_flavour_ewan.9521.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { scope:culture_reaction = flag:changed_away }
			animation = shock
		}
		triggered_animation = {
			trigger = { scope:culture_reaction = flag:changed_to }
			animation = admiration
		}
		triggered_animation = {
			trigger = { scope:culture_reaction = flag:uninvolved }
			animation = personality_forgiving
		}
	}
	right_portrait = {
		character = scope:visitor
		animation = personality_bold
	}
	override_background = { reference = ep3_campfire }

	immediate = {
		# Configure scope:visitor's culture change.
		ep3_laamp_flavour_ewan_9521_change_visitor_culture_effect = yes
		# Sort our reactions.
		ep3_laamp_flavour_ewan_9521_register_culture_change_reaction_effect = yes
		# They've learnt a lot from their new ethos (even if it was the same as their old one).
		ep3_laamp_flavour_ewan_9521_apply_ethos_skill_bonuses_effect = yes
		# Bring them home.
		scope:visitor = { return_to_court = yes }
	}

	# Accept them back.
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { scope:culture_reaction = flag:changed_away }
						desc = ep3_laamp_flavour_ewan.9521.a.changed_away
					}
					triggered_desc = {
						trigger = { scope:culture_reaction = flag:changed_to }
						desc = ep3_laamp_flavour_ewan.9521.a.changed_to
					}
					triggered_desc = {
						trigger = { scope:culture_reaction = flag:uninvolved }
						desc = ep3_laamp_flavour_ewan.9521.a.uninvolved
					}
				}
			}
		}

		# No effects.

		# No stress here.
		# The AI should always just uncritically take people back.
		ai_chance = { base = 100 }
	}

	# You're not wanted any more, scope:visitor.
	option = {
		name = ep3_laamp_flavour_ewan.9521.b

		scope:visitor = { select_and_move_to_pool_effect = yes }

		ep3_laamp_flavour_ewan_9511_standard_drive_away_char_stress_effect = yes
		# The AI should never take this option.
		ai_chance = { base = 0 }
	}
}

scripted_effect ep3_laamp_flavour_ewan_9522_change_visitor_faith_effect = {
	scope:visitor = {
		faith = { save_scope_as = old_faith }
		random_list = {
			100 = {
				trigger = {
					this != host.faith
				}
				set_character_faith = host.faith
				save_scope_value_as = {
					name = faith_change
					value = flag:host
				}
			}
			100 = {
				trigger = {
					this != host.capital_county.faith
				}
				set_character_faith = host.capital_county.faith
				save_scope_value_as = {
					name = faith_change
					value = flag:capital
				}
			}
		}
		faith = { save_scope_as = new_faith }
	}
}

scripted_effect ep3_laamp_flavour_ewan_9522_register_faith_change_reaction_effect = {
	# Sort our reactions.
	## We are cynical.
	if = {
		limit = { has_trait = cynical }
		save_scope_value_as = {
			name = faith_reaction
			value = flag:give_a_shit
		}
	}
	## They changed away from our faith.
	if = {
		limit = { faith = scope:old_faith }
		save_scope_value_as = {
			name = faith_reaction
			value = flag:changed_away
		}
	}
	## They changed _to_ our faith.
	else_if = {
		limit = { faith = scope:new_faith }
		save_scope_value_as = {
			name = faith_reaction
			value = flag:changed_to_ours
		}
	}
	## They changed to a faith we love.
	else_if = {
		limit = { faith = scope:new_faith }
		save_scope_value_as = {
			name = faith_reaction
			value = flag:changed_to_lovable
		}
	}
	## They changed to a faith we tolerate.
	else_if = {
		limit = { faith = scope:new_faith }
		save_scope_value_as = {
			name = faith_reaction
			value = flag:changed_to_acceptable
		}
	}
	## They simply changed faith.
	else = {
		save_scope_value_as = {
			name = faith_reaction
			value = flag:uninvolved
		}
	}
}

#	Follower has taken on the faith of the place they stayed at.
ep3_laamp_flavour_ewan.9522 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.9522.t
	desc = {
		desc = ep3_laamp_flavour_ewan.9522.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { scope:faith_change = flag:host }
				desc = ep3_laamp_flavour_ewan.9522.desc.source.host
			}
			triggered_desc = {
				trigger = { scope:faith_change = flag:capital }
				desc = ep3_laamp_flavour_ewan.9522.desc.source.capital
			}
		}
		desc = ep3_laamp_flavour_ewan.9522.desc.source.bridge
		first_valid = {
			triggered_desc = {
				trigger = { scope:faith_reaction = flag:give_a_shit }
				desc = ep3_laamp_flavour_ewan.9522.desc.reaction.give_a_shit
			}
			triggered_desc = {
				trigger = { scope:faith_reaction = flag:changed_away }
				desc = ep3_laamp_flavour_ewan.9522.desc.reaction.changed_away
			}
			triggered_desc = {
				trigger = { scope:faith_reaction = flag:changed_to_ours }
				desc = ep3_laamp_flavour_ewan.9522.desc.reaction.changed_to_ours
			}
			triggered_desc = {
				trigger = { scope:faith_reaction = flag:changed_to_lovable }
				desc = ep3_laamp_flavour_ewan.9522.desc.reaction.changed_to_lovable
			}
			triggered_desc = {
				trigger = { scope:faith_reaction = flag:changed_to_acceptable }
				desc = ep3_laamp_flavour_ewan.9522.desc.reaction.changed_to_acceptable
			}
			triggered_desc = {
				trigger = { scope:faith_reaction = flag:uninvolved }
				desc = ep3_laamp_flavour_ewan.9522.desc.reaction.uninvolved
			}
		}
		desc = ep3_laamp_flavour_ewan.9522.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { scope:faith_reaction = flag:give_a_shit }
			animation = dismissal
		}
		triggered_animation = {
			trigger = { scope:faith_reaction = flag:changed_away }
			animation = shock
		}
		triggered_animation = {
			trigger = {
				OR = {
					scope:faith_reaction = flag:changed_to_ours
					scope:faith_reaction = flag:changed_to_lovable
					scope:faith_reaction = flag:changed_to_acceptable
				}
			}
			animation = admiration
		}
		triggered_animation = {
			trigger = { scope:faith_reaction = flag:uninvolved }
			animation = personality_forgiving
		}
	}
	right_portrait = {
		character = scope:visitor
		animation = personality_zealous
	}
	override_background = { reference = ep3_campfire }

	immediate = {
		# Configure scope:visitor's faith change.
		ep3_laamp_flavour_ewan_9522_change_visitor_faith_effect = yes
		# Sort our reactions.
		ep3_laamp_flavour_ewan_9522_register_faith_change_reaction_effect = yes
		# The conversion process involves a lot of education.
		scope:visitor = {
			add_learning_skill = {
				integer_range = {
					min = 3
					max = 8
				}
			}
		}
		# Bring them home.
		scope:visitor = { return_to_court = yes }
	}

	# Zealous, same faith: welcome, SisterBrother!
	option = {
		name = ep3_laamp_flavour_ewan.9522.a
		trigger = {
			has_trait = zealous
			faith = scope:visitor.faith
		}
		trait = zealous

		add_piety = minor_piety_gain

		stress_impact = { zealous = minor_stress_impact_loss }
		# The AI should always just uncritically take people back.
		ai_chance = { base = 100 }
	}

	# Zealous, other: But why convert to scope:new_faith...
	option = {
		name = ep3_laamp_flavour_ewan.9522.b
		trigger = {
			has_trait = zealous
			NOR = {
				faith = scope:visitor.faith
				faith = scope:old_faith
			}
		}
		trait = zealous

		# No effects.

		# No stress here.
		# The AI should always just uncritically take people back.
		ai_chance = { base = 100 }
	}

	# Zealous, converted away: What have you done, you fool?!
	option = {
		name = ep3_laamp_flavour_ewan.9522.c
		trigger = {
			has_trait = zealous
			faith = scope:old_faith
		}
		trait = zealous

		# No effects.

		stress_impact = { zealous = minor_stress_impact_gain }
		# The AI should always just uncritically take people back.
		ai_chance = { base = 100 }
	}

	# Cynical: scope:old_faith, scope:new_faith, you're still scope:visitor to me.
	option = {
		name = ep3_laamp_flavour_ewan.9522.d
		trigger = { has_trait = cynical }

		reverse_add_opinion = {
			target = scope:visitor
			modifier = respect_opinion
			opinion = 50
		}
		if = {
			limit = {
				can_set_relation_potential_friend_trigger = { CHARACTER = scope:visitor }
			}
			set_relation_potential_friend = scope:visitor
		}

		stress_impact = { cynical = medium_stress_impact_loss }
		# The AI should always just uncritically take people back.
		ai_chance = { base = 100 }
	}

	# Good to have you back, scope:visitor.
	option = {
		name = ep3_laamp_flavour_ewan.9522.e
		trigger = {
			NOR = {
				has_trait = zealous
				has_trait = cynical
			}
		}

		# No effect.

		# No stress here.
		# The AI should always just uncritically take people back.
		ai_chance = { base = 100 }
	}

	# You are no longer welcome here.
	option = {
		name = ep3_laamp_flavour_ewan.9522.f

		scope:visitor = { select_and_move_to_pool_effect = yes }

		ep3_laamp_flavour_ewan_9511_standard_drive_away_char_stress_effect = yes
		# The AI should never take this option.
		ai_chance = { base = 0 }
	}
}

#	Follower has taken on the faith and culture of the place they stayed at.
ep3_laamp_flavour_ewan.9523 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.9523.t
	desc = {
		desc = ep3_laamp_flavour_ewan.9523.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { scope:faith_change = flag:host }
				desc = ep3_laamp_flavour_ewan.9523.desc.source.host
			}
			triggered_desc = {
				trigger = { scope:faith_change = flag:capital }
				desc = ep3_laamp_flavour_ewan.9523.desc.source.capital
			}
		}
		desc = ep3_laamp_flavour_ewan.9523.desc.source.bridge
		first_valid = {
			triggered_desc = {
				trigger = { scope:faith_reaction = flag:give_a_shit }
				desc = ep3_laamp_flavour_ewan.9523.desc.reaction.give_a_shit
			}
			triggered_desc = {
				trigger = { scope:faith_reaction = flag:changed_away }
				desc = ep3_laamp_flavour_ewan.9523.desc.reaction.changed_away
			}
			triggered_desc = {
				trigger = { scope:faith_reaction = flag:changed_to_ours }
				desc = ep3_laamp_flavour_ewan.9523.desc.reaction.changed_to_ours
			}
			triggered_desc = {
				trigger = { scope:faith_reaction = flag:changed_to_lovable }
				desc = ep3_laamp_flavour_ewan.9523.desc.reaction.changed_to_lovable
			}
			triggered_desc = {
				trigger = { scope:faith_reaction = flag:changed_to_acceptable }
				desc = ep3_laamp_flavour_ewan.9523.desc.reaction.changed_to_acceptable
			}
			triggered_desc = {
				trigger = { scope:faith_reaction = flag:uninvolved }
				desc = ep3_laamp_flavour_ewan.9523.desc.reaction.uninvolved
			}
		}
		desc = ep3_laamp_flavour_ewan.9523.desc.outro
	}
	theme = laamp
	# We dupe the faith logic for portraits, because it's the more important of the two & because _Jesus H. Christ_ the permutations otherwise.
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { scope:faith_reaction = flag:give_a_shit }
			animation = dismissal
		}
		triggered_animation = {
			trigger = { scope:faith_reaction = flag:changed_away }
			animation = shock
		}
		triggered_animation = {
			trigger = {
				OR = {
					scope:faith_reaction = flag:changed_to_ours
					scope:faith_reaction = flag:changed_to_lovable
					scope:faith_reaction = flag:changed_to_acceptable
				}
			}
			animation = admiration
		}
		triggered_animation = {
			trigger = { scope:faith_reaction = flag:uninvolved }
			animation = personality_forgiving
		}
	}
	right_portrait = {
		character = scope:visitor
		animation = personality_zealous
	}
	override_background = { reference = ep3_campfire }

	immediate = {
		# Configure scope:visitor's changes.
		## Culture.
		ep3_laamp_flavour_ewan_9521_change_visitor_culture_effect = yes
		## Faith.
		ep3_laamp_flavour_ewan_9522_change_visitor_faith_effect = yes
		# Sort our reactions.
		## Culture.
		ep3_laamp_flavour_ewan_9521_register_culture_change_reaction_effect = yes
		## Faith.
		ep3_laamp_flavour_ewan_9522_register_faith_change_reaction_effect = yes
		# They've learnt a lot from their new ethos (even if it was the same as their old one).
		## Ignore a bonus from conversion — they're already getting a substantial one from this change that's more flavourful.
		ep3_laamp_flavour_ewan_9521_apply_ethos_skill_bonuses_effect = yes
		# Bring them home.
		scope:visitor = { return_to_court = yes }
	}

	# Zealous, same faith: welcome, SisterBrother!
	option = {
		name = ep3_laamp_flavour_ewan.9523.a
		trigger = {
			has_trait = zealous
			faith = scope:visitor.faith
		}
		trait = zealous

		add_piety = minor_piety_gain

		stress_impact = { zealous = minor_stress_impact_loss }
		# The AI should always just uncritically take people back.
		ai_chance = { base = 100 }
	}

	# Zealous, other: But why convert to scope:new_faith...
	option = {
		name = ep3_laamp_flavour_ewan.9523.b
		trigger = {
			has_trait = zealous
			NOR = {
				faith = scope:visitor.faith
				faith = scope:old_faith
			}
		}
		trait = zealous

		# No effects.

		# No stress here.
		# The AI should always just uncritically take people back.
		ai_chance = { base = 100 }
	}

	# Zealous, converted away: What have you done, you fool?!
	option = {
		name = ep3_laamp_flavour_ewan.9523.c
		trigger = {
			has_trait = zealous
			faith = scope:old_faith
		}
		trait = zealous

		# No effects.

		stress_impact = { zealous = minor_stress_impact_gain }
		# The AI should always just uncritically take people back.
		ai_chance = { base = 100 }
	}

	# Cynical: scope:old_faith, scope:new_faith, you're still scope:visitor to me.
	option = {
		name = ep3_laamp_flavour_ewan.9523.d
		trigger = { has_trait = cynical }

		reverse_add_opinion = {
			target = scope:visitor
			modifier = respect_opinion
			opinion = 50
		}
		if = {
			limit = {
				can_set_relation_potential_friend_trigger = { CHARACTER = scope:visitor }
			}
			set_relation_potential_friend = scope:visitor
		}

		stress_impact = { cynical = medium_stress_impact_loss }
		# The AI should always just uncritically take people back.
		ai_chance = { base = 100 }
	}

	# Good to have you back, scope:visitor.
	option = {
		name = ep3_laamp_flavour_ewan.9523.e
		trigger = {
			NOR = {
				has_trait = zealous
				has_trait = cynical
			}
		}

		# No effect.

		# No stress here.
		# The AI should always just uncritically take people back.
		ai_chance = { base = 100 }
	}

	# You are no longer welcome here.
	option = {
		name = ep3_laamp_flavour_ewan.9523.f

		scope:visitor = { select_and_move_to_pool_effect = yes }

		ep3_laamp_flavour_ewan_9511_standard_drive_away_char_stress_effect = yes
		# The AI should never take this option.
		ai_chance = { base = 0 }
	}
}

##################################################
# Missing Follower
# by Ewan Cowhig Croft
# 9531 - 9540
##################################################

#	Follower has died whilst away from camp.
ep3_laamp_flavour_ewan.9531 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.9531.t
	desc = ep3_laamp_flavour_ewan.9531.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:visitor
		animation = map_fear
	}
	override_background = { reference = ep3_campfire }

	trigger = {
		# Make sure that this isn't a character who we would've been informed about the death of already (i.e., a spouse or family — relations are lost on death already so we have to bite the bullet there without doing something awful with variables).
		NOR = {
			is_spouse_of_even_if_dead = scope:visitor
			is_close_or_extended_family_of = scope:visitor
		}
	}

	immediate = {
		custom_tooltip = ep3_laamp_flavour_ewan.9531.tt.follower_is_dead
		hidden_effect = {
			scope:visitor = { return_to_court = yes }
		}
	}

	# To think we shall never see HerHim again...
	option = {
		name = ep3_laamp_flavour_ewan.9531.a

		# No effect.

		# No stress here.
		# The AI should only take this if it's the _only_ option.
		ai_chance = { base = 0 }
	}

	# Callous: eh.
	option = {
		name = ep3_laamp_flavour_ewan.9531.b
		trigger = { has_trait = callous }
		trait = callous

		stress_impact = { callous = major_stress_impact_loss }
		# If you're callous, take the stress loss.
		ai_chance = { base = 100 }
	}
}

#	Follower has been imprisoned away from camp.
ep3_laamp_flavour_ewan.9532 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.9532.t
	desc = ep3_laamp_flavour_ewan.9532.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:visitor
		animation = prisondungeon
	}
	override_background = { reference = ep3_campfire }

	trigger = {
		root != scope:visitor.imprisoner
	}

	on_trigger_fail = {
		scope:visitor = { return_to_court = yes }
	}

	immediate = {
		scope:visitor.imprisoner = { save_scope_as = imprisoner }
		show_as_tooltip = {
			rightfully_imprison_character_less_verbose_effect = {
				TARGET = scope:visitor
				IMPRISONER = scope:imprisoner
			}
		}
		hidden_effect = {
			scope:visitor = { return_to_court = yes }
		}
	}

	# We must free scope:visitor!
	option = {
		name = ep3_laamp_flavour_ewan.9532.a

		# No effects.

		# No stress here.
		# The AI should always just uncritically take people back.
		ai_chance = { base = 100 }
	}

	# Scope:imprisoner can keep HerHim for all I care.
	option = {
		name = ep3_laamp_flavour_ewan.9532.b

		remove_courtier_or_guest = scope:visitor

		ep3_laamp_flavour_ewan_9511_standard_drive_away_char_stress_effect = yes
		# The AI should never take this option.
		ai_chance = { base = 0 }
	}
}

#	Follower has become incapable whilst away from camp.
ep3_laamp_flavour_ewan.9533 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.9533.t
	desc = ep3_laamp_flavour_ewan.9533.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:visitor
		animation = paranoia
	}
	override_background = { reference = ep3_campfire }

	immediate = {
		custom_tooltip = ep3_laamp_flavour_ewan.9533.tt.follower_is_incapable
		scope:visitor = { return_to_court = yes }
	}

	# What on Earth happened to HerHim?
	option = {
		name = ep3_laamp_flavour_ewan.9533.a
		trigger = {
			NOT = { has_trait = compassionate }
		}

		# No effect.

		# No stress here.
		# The AI should always just uncritically take people back.
		ai_chance = { base = 100 }
	}

	# Compassionate: worry not, scope:visitor, we shall care for you.
	option = {
		name = ep3_laamp_flavour_ewan.9533.b
		trigger = { has_trait = compassionate }
		trait = compassionate

		reverse_add_opinion = {
			target = scope:visitor
			modifier = feast_helped_me_opinion
			opinion = 50
		}
		every_courtier = {
			custom = custom.every_non_callous_or_sadistic_follower
			limit = {
				NOR = {
					has_trait = callous
					has_trait = sadistic
				}
			}
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = 20
			}
		}

		stress_impact = { compassionate = major_stress_impact_loss }
		# The AI should always just uncritically take people back.
		ai_chance = { base = 100 }
	}

	# Drive this imbecile away.
	option = {
		name = ep3_laamp_flavour_ewan.9533.c

		scope:visitor = { select_and_move_to_pool_effect = yes }

		ep3_laamp_flavour_ewan_9511_standard_drive_away_char_stress_effect = yes
		# The AI should never take this option.
		ai_chance = { base = 0 }
	}
}

#	Follower never comes home.
ep3_laamp_flavour_ewan.9534 = {
	type = character_event
	title = ep3_laamp_flavour_ewan.9534.t
	desc = ep3_laamp_flavour_ewan.9534.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = worry
	}
	right_portrait = {
		character = scope:visitor
		animation = map_disbelief
	}
	override_background = { reference = ep3_campfire }

	immediate = {
		custom_tooltip = ep3_laamp_flavour_ewan.9534.tt.follower_is_lost
		hidden_effect = {
			remove_courtier_or_guest = {
				character = scope:visitor
				new_location = scope:visitor.location
			}
		}
	}

	# I wonder what could have happened to HerHim...
	option = {
		name = ep3_laamp_flavour_ewan.9534.a

		# No effects.

		# No stress, no AI.
	}
}

##################################################
# Camp Activity Feed Message
# by Ewan Cowhig Croft
# 9541 - 9550
##################################################

scripted_trigger ep3_laamp_flavour_ewan_9541_suitable_courtier_trigger = {
	is_adult = yes
	is_available_allow_travelling = yes
}

scripted_trigger ep3_laamp_flavour_ewan_9541_valid_nicknameable_courtier_trigger = {
	ep3_laamp_flavour_ewan_9541_suitable_courtier_trigger = yes
	has_any_nickname = no
}

scripted_trigger ep3_laamp_flavour_ewan_9541_valid_dog_courtier_trigger = {
	ep3_laamp_flavour_ewan_9541_suitable_courtier_trigger = yes
	ep3_laamp_flavour_ewan_no_dog_trigger = yes
}

scripted_trigger ep3_laamp_flavour_ewan_9541_valid_cat_courtier_trigger = {
	ep3_laamp_flavour_ewan_9541_suitable_courtier_trigger = yes
	ep3_laamp_flavour_ewan_no_cat_trigger = yes
}

scripted_trigger ep3_laamp_flavour_ewan_9541_valid_potential_friend_courtier_trigger = {
	this != scope:follower_1
	ep3_laamp_flavour_ewan_9541_suitable_courtier_trigger = yes
	"trait_compatibility(scope:follower_1)" >= low_positive_trait_compatibility
	NOT = {
		has_important_relationship_with_character_trigger = { CHARACTER = scope:follower_1 }
	}
}

scripted_trigger ep3_laamp_flavour_ewan_9541_valid_potential_rival_courtier_trigger = {
	this != scope:follower_1
	ep3_laamp_flavour_ewan_9541_suitable_courtier_trigger = yes
	"trait_compatibility(scope:follower_1)" <= low_negative_trait_compatibility
	NOT = {
		has_important_relationship_with_character_trigger = { CHARACTER = scope:follower_1 }
	}
}

scripted_trigger ep3_laamp_flavour_ewan_9541_valid_stressed_courtier_trigger = {
	ep3_laamp_flavour_ewan_9541_suitable_courtier_trigger = yes
	stress >= 1
}

#	Something minor happens at camp.
ep3_laamp_flavour_ewan.9541 = {
	hidden = yes

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_9541 }
		}
		# Plus make sure _someone_ is valid for something.
		any_courtier = { ep3_laamp_flavour_ewan_9541_suitable_courtier_trigger = yes }
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_9541
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_9541
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_shorter
			}
		}
		# Grab a courtier for our relation effect triggers.
		random_courtier = {
			limit = { ep3_laamp_flavour_ewan_9541_suitable_courtier_trigger = yes }
			save_scope_as = follower_1
		}
		# Right, determine what's going to be happening.
		random_list = {
			# Nicknames.
			500 = {
				trigger = {
					any_courtier = { ep3_laamp_flavour_ewan_9541_valid_nicknameable_courtier_trigger = yes }
				}
				random_courtier = {
					limit = { ep3_laamp_flavour_ewan_9541_valid_nicknameable_courtier_trigger = yes }
					weight = { laamp_weight_up_minor_chars_modifier = yes }
					save_scope_as = eponymee
				}
				hidden_effect = {
					scope:eponymee = {
						assign_random_nickname_effect = yes
						hidden_effect = {
							if = {
								limit = {
									has_any_nickname = no
								}
								set_random_negative_nickname_effect = yes
							}
						}
					}
				}
				send_interface_message = {
					type = event_camp_follower_with_text
					title = ep3_laamp_flavour_ewan.9541.t.nickname_gained
					desc = ep3_laamp_flavour_ewan.9541.desc.nickname_gained
					left_icon = scope:eponymee
				}
			}
			# Dogs.
			75 = {
				trigger = {
					any_courtier = { ep3_laamp_flavour_ewan_9541_valid_dog_courtier_trigger = yes }
				}
				random_courtier = {
					limit = { ep3_laamp_flavour_ewan_9541_valid_dog_courtier_trigger = yes }
					weight = { laamp_weight_up_minor_chars_modifier = yes }
					save_scope_as = pet_owner
				}
				send_interface_message = {
					type = event_camp_follower_with_text
					title = ep3_laamp_flavour_ewan.9541.t.dog_gained
					desc = ep3_laamp_flavour_ewan.9541.desc.dog_gained
					left_icon = scope:pet_owner
					scope:pet_owner = { start_dog_story_cycle_effect = yes }
				}
			}
			# Cats.
			100 = {
				trigger = {
					any_courtier = { ep3_laamp_flavour_ewan_9541_valid_cat_courtier_trigger = yes }
				}
				random_courtier = {
					limit = { ep3_laamp_flavour_ewan_9541_valid_cat_courtier_trigger = yes }
					weight = { laamp_weight_up_minor_chars_modifier = yes }
					save_scope_as = pet_owner
				}
				send_interface_message = {
					type = event_camp_follower_with_text
					title = ep3_laamp_flavour_ewan.9541.t.cat_gained
					desc = ep3_laamp_flavour_ewan.9541.desc.cat_gained
					left_icon = scope:pet_owner
					scope:pet_owner = { start_cat_story_cycle_effect = yes }
				}
			}
			# Opinions & potential friends.
			100 = {
				trigger = {
					any_courtier = { ep3_laamp_flavour_ewan_9541_valid_potential_friend_courtier_trigger = yes }
				}
				ordered_courtier = {
					limit = { ep3_laamp_flavour_ewan_9541_valid_potential_friend_courtier_trigger = yes }
					order_by = "trait_compatibility(scope:follower_1)"
					save_scope_as = follower_2
				}
				send_interface_message = {
					type = event_camp_follower_with_text
					title = ep3_laamp_flavour_ewan.9541.t.opinion_gained
					desc = ep3_laamp_flavour_ewan.9541.desc.opinion_gained
					left_icon = scope:follower_1
					right_icon = scope:follower_2
					scope:follower_1 = {
						if = {
							limit = {
								can_set_relation_potential_friend_trigger = { CHARACTER = scope:follower_2 }
							}
							set_relation_potential_friend = scope:follower_2
						}
						add_opinion = {
							target = scope:follower_2
							modifier = friendliness_opinion
							opinion = 30
						}
						reverse_add_opinion = {
							target = scope:follower_2
							modifier = friendliness_opinion
							opinion = 30
						}
					}
				}
			}
			# Opinions & potential rivals.
			100 = {
				trigger = {
					any_courtier = { ep3_laamp_flavour_ewan_9541_valid_potential_rival_courtier_trigger = yes }
				}
				ordered_courtier = {
					limit = { ep3_laamp_flavour_ewan_9541_valid_potential_rival_courtier_trigger = yes }
					order_by = "trait_compatibility(scope:follower_1)"
					save_scope_as = follower_2
				}
				send_interface_message = {
					type = event_camp_follower_with_text
					title = ep3_laamp_flavour_ewan.9541.t.opinion_lost
					desc = ep3_laamp_flavour_ewan.9541.desc.opinion_lost
					left_icon = scope:follower_1
					right_icon = scope:follower_2
					scope:follower_1 = {
						if = {
							limit = {
								can_set_relation_potential_rival_trigger = { CHARACTER = scope:follower_2 }
							}
							set_relation_potential_rival = scope:follower_2
						}
						add_opinion = {
							target = scope:follower_2
							modifier = irritated_opinion
							opinion = -30
						}
						reverse_add_opinion = {
							target = scope:follower_2
							modifier = irritated_opinion
							opinion = -30
						}
					}
				}
			}
			# Gain stress.
			## Largely here as a fallback — not that interesting so we weight it down reaaaalll good.
			5 = {
				trigger = {
					any_courtier = { ep3_laamp_flavour_ewan_9541_suitable_courtier_trigger = yes }
				}
				random_courtier = {
					limit = { ep3_laamp_flavour_ewan_9541_suitable_courtier_trigger = yes }
					weight = { laamp_weight_up_minor_chars_modifier = yes }
					save_scope_as = stressee
				}
				send_interface_message = {
					type = event_camp_follower_with_text
					title = ep3_laamp_flavour_ewan.9541.t.stress_gained
					desc = ep3_laamp_flavour_ewan.9541.desc.stress_gained
					left_icon = scope:stressee
					scope:stressee = {
						random_list = {
							20 = { add_stress = minor_stress_gain }
							60 = { add_stress = medium_stress_gain }
							20 = { add_stress = major_stress_gain }
						}
					}
				}
			}
			# Lose stress.
			120 = {
				trigger = {
					any_courtier = { ep3_laamp_flavour_ewan_9541_valid_stressed_courtier_trigger = yes }
				}
				random_courtier = {
					limit = { ep3_laamp_flavour_ewan_9541_valid_stressed_courtier_trigger = yes }
					save_scope_as = stressee
				}
				send_interface_message = {
					type = event_camp_follower_with_text
					title = ep3_laamp_flavour_ewan.9541.t.stress_lost
					desc = ep3_laamp_flavour_ewan.9541.desc.stress_lost
					left_icon = scope:stressee
					scope:stressee = {
						random_list = {
							10 = { add_stress = minor_stress_loss }
							60 = { add_stress = medium_stress_loss }
							30 = { add_stress = major_stress_loss }
						}
					}
				}
			}
		}
	}
}

##################################################
# AI Laamp Converts
# by Ewan Cowhig Croft
# 9551 - 9560
##################################################

scripted_trigger ep3_laamp_flavour_ewan_9551_character_would_go_idea_shopping_trigger = {
	NOR  = {
		has_character_flag = ai_will_not_convert
		has_trait = faith_warrior
		has_trait = crusader_king
		has_trait = stubborn
		faith = location.faith
	}
	# Religious characters compare what faiths fit them best.
	OR = {
		# Non-zealous characters will consider a switch if they're not virtuous but would be in a new faith.
		AND = {
			NOT = { has_trait = zealous }
			num_virtuous_traits = {
				value <= 0
				target = faith
			}
			ep3_laamp_flavour_ewan_9501_faith_sin_virtue_check_trigger = { FAITH = location.faith }
		}
		# Zealous characters will _also_ switch, but also need to feel like they're sinful in their current faith.
		AND = {
			has_trait = zealous
			num_sinful_traits = {
				value >= 1
				target = faith
			}
			num_virtuous_traits = {
				value <= 0
				target = faith
			}
			ep3_laamp_flavour_ewan_9501_faith_sin_virtue_check_trigger = { FAITH = location.faith }
		}
		# Cynical characters will gladly convert to whatever, provided they feel it suits them.
		AND = {
			has_trait = cynical
			NOR = {
				has_trait = arrogant
				has_trait = stubborn
			}
		}
	}
	# Just rule out the inevitable modded HoF laamps from trying to abandon their faith.
	NOT = { faith.religious_head ?= root }
}

#	AI laamps convert to various local faiths.
ep3_laamp_flavour_ewan.9551 = {
	hidden = yes

	trigger = {
		# DLC check.
		has_ep3_dlc_trigger = yes
		# Standard checks.
		is_adult = yes
		is_available_allow_travelling = yes
		# Make sure we're on dry land.
		is_location_valid_for_travel_event_on_land = yes
		# Laamps use title cooldowns, to help trim down repeats when succession happens.
		primary_title = {
			NOT = { has_variable = had_ep3_laamp_flavour_ewan_9551 }
		}
		# Now make sure that we'd actually convert.
		## Never convert reformed to unreformed without good reason.
		location.faith = {
			OR = {
				NOT = { has_doctrine_parameter = unreformed }
				AND = {
					has_doctrine_parameter = unreformed
					root.faith = { has_doctrine_parameter = unreformed }
				}
				root = { has_trait = eccentric }
			}
		}
		## General validity checks.
		ep3_laamp_flavour_ewan_9551_character_would_go_idea_shopping_trigger = yes
		# AI-only.
		is_ai = yes
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_lfe_9551
				VAL = 1
			}
		}
		# Set our cooldown.
		primary_title = {
			set_variable = {
				name = had_ep3_laamp_flavour_ewan_9551
				value = yes
				years = @ep3_laamp_flavour_ewan_event_cooldown_longest
			}
		}
		# And convert our character.
		set_character_faith_with_conversion = location.faith
	}
}











##################################################
# MAINTENANCE

# Range 9801+ reserved for w/e lil management events might turn up.
