namespace = travel_events_bp3

scripted_trigger bp3_travel_event_default_trigger = {
	has_bp3_dlc_trigger = yes
	is_location_valid_for_travel_event_on_land = yes
	is_available_travelling_adult = yes
}

scripted_trigger travel_events_bp3_1_character = {
	age >= 12
	OR = {
		is_child_of = root
		is_spouse_of = root
		has_friendly_relationship_trigger = { CHARACTER = root }
	}
}

travel_events_bp3.1 = { # Seasons of Change
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.1.t
	desc = {
		desc = travel_events_bp3.1.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					current_season_spring = yes
				}
				desc = travel_events_bp3.1.desc.spring
			}
			triggered_desc = {
				trigger = {
					current_season_summer = yes
				}
				desc = travel_events_bp3.1.desc.summer
			}
			triggered_desc = {
				trigger = {
					current_season_autumn = yes
					location = {
						OR = {
							terrain = desert
							terrain = desert_mountains
							terrain = drylands
						}
					}
				}
				desc = travel_events_bp3.1.desc.autumn_desert
			}
			triggered_desc = {
				trigger = {
					current_season_autumn = yes
					location = {
						NOR = {
							terrain = desert
							terrain = desert_mountains
							terrain = drylands
						}
					}
				}
				desc = travel_events_bp3.1.desc.autumn
			}
			triggered_desc = {
				trigger = {
					current_season_winter = yes
					location = {
						has_winter_trigger = no
					}
				}
				desc = travel_events_bp3.1.desc.winter
			}
			triggered_desc = {
				trigger = {
					current_season_winter = yes
					location = {
						has_winter_trigger = yes
					}
				}
				desc = travel_events_bp3.1.desc.winter_snow
			}
			triggered_desc = {
				trigger = {
					current_season_dry_season = yes
				}
				desc = travel_events_bp3.1.desc.dry_season
			}
			triggered_desc = {
				trigger = {
					current_season_rainy_season = yes
				}
				desc = travel_events_bp3.1.desc.rainy_season
			}
		}
	}

	theme = travel

	override_background = { reference = wilderness }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:friendly_character
		animation = survey
	}

	override_effect_2d = {
		trigger = {
			current_season_rainy_season = yes
		}
		reference = rain
	}

	override_effect_2d = {
		trigger = {
			OR = {
				current_season_dry_season = yes
				current_season_summer = yes
			}
		}
		reference = legend_glow
	}

	widget = {
		is_shown = {
			current_season_winter = yes
			location = { 
				has_winter_trigger = yes
			}
		}
		gui = "event_window_widget_vfx_snow"
		container = "foreground_shader_vfx_container"
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.1
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		current_travel_plan = {
			any_entourage_character = {
				travel_events_bp3_1_character = yes
			}
		}
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
		current_travel_plan = {
			random_entourage_character = {
				limit = {
					travel_events_bp3_1_character = yes	
				}
				save_scope_as = friendly_character
			}
		}
	}

	option = {
		name = travel_events_bp3.1.a
		scope:friendly_character = {
			add_opinion = {
				modifier = friendliness_opinion
				target = root
				opinion = 15
			}
		}
		current_travel_plan ?= {
			delay_travel_plan = { days = 2 }
		}
		stress_impact = {
			base = minor_stress_impact_loss
		}

		ai_chance = {
			base = 0
		}
	}

	option = {
		name = travel_events_bp3.1.b
		flavor = travel_events_bp3.1.b.flavor
		current_travel_plan ?= {
			add_destination_progress = { days = 2 }
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mp_resume_travel_plan = yes
	}
}

travel_events_bp3.5 = { # Caught Outside
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.5.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					current_season_winter = yes
				}
				desc = travel_events_bp3.5.desc.snow
			}
			triggered_desc = {
				trigger = {
					current_season_winter = no
				}
				desc = travel_events_bp3.5.desc.rain
			}
		}
	}
	theme = travel

	override_background = { reference = wilderness }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = disappointed
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.5
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		OR = {
			AND = {
				current_season_winter = yes
				location = { 
					has_winter_trigger = yes
				}
			}
			current_season_rainy_season = yes
			AND = {
				OR = {
					current_season_spring = yes
					current_season_autumn = yes
				}
				location = {
					NOR = {
						terrain = desert
						terrain = desert_mountains
						terrain = drylands
					}
				}
			}
		}
	}

	override_effect_2d = {
		trigger = {
			current_season_winter = no
		}
		reference = rain
	}

	widget = {
		is_shown = {
			current_season_winter = yes
		}
		gui = "event_window_widget_vfx_snow"
		container = "foreground_shader_vfx_container"
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
	}

	option = {
		name = travel_events_bp3.5.a

		stress_impact = {
			base = minor_stress_impact_loss
		}

		current_travel_plan ?= {
			delay_travel_plan = { weeks = 1 }
		}

		ai_chance = {
			base = 0
			modifier = {
				age > 55
				add = 100
			}
		}
	}

	option = {
		name = {
			trigger = {
				current_season_winter = yes
			}
			text = travel_events_bp3.5.b.snow
		}
		name = {
			trigger = {
				current_season_winter = no
			}
			text = travel_events_bp3.5.b.rain
		}

		if = {
			limit = {
				NOT = { has_trait = ill }
			}
			random = {
				chance = {
					value = 20
					if = {
						limit = {
							age > 55
						}
						add = {
							value = age 
							subtract = 55
						}
					}
				}
				contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = yes }
			}
		}

		custom_tooltip = travel_events_bp3.5.b.tt

		hidden_effect = {
			current_travel_plan = {
				every_entourage_character = {
					limit = {
						this != root
					}
					random = {
						chance = {
							value = 5
							if = {
								limit = {
									age > 55
								}
								add = {
									value = age 
									subtract = 55
								}
							}
						}
						contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = yes }
					}
				}
			}
		}

		current_travel_plan ?= {
			add_destination_progress = { days = 5 }
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				age > 55
			}
		}
	}

	after = {
		mp_resume_travel_plan = yes
	}
}

scripted_effect find_holy_site_effect = {
	random_county_province = {
		limit = {
			is_county_capital = yes
			barony = { is_holy_site_of = root.faith }
		}
		alternative_limit = {
			barony = { is_holy_site_of = root.faith }
		}
		save_scope_as = holy_location
	}
}

travel_events_bp3.10 = { # Pilgrims on the Road
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.10.t
	desc = {
		desc = travel_events_bp3.10.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:holy_order_character
				}
				desc = travel_events_bp3.10.desc.holy_order
			}
			triggered_desc = {
				trigger = {
					NOT = { exists = scope:holy_order_character }
				}
				desc = travel_events_bp3.10.desc.pilgrims
			}
		}
	}
	theme = travel

	override_background = { reference = ep3_campfire }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = toast
	}

	right_portrait = {
		character = scope:pilgrim_character
		animation = lantern
		hide_info = yes
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.10
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		NOT = { government_has_flag = government_is_celestial }
		location.county = {
			OR = {
				any_county_province = {
					barony = { is_holy_site_of = root.faith }
				}
				any_neighboring_county = {
					any_county_province = {
						barony = { is_holy_site_of = root.faith }
					}
				}
			}
		}
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
		location.county = {
			find_holy_site_effect = yes
			if = {
				limit = {
					NOT = { exists = scope:holy_location }
				}
				random_neighboring_county = {
					limit = {
						any_county_province = {
							barony = { is_holy_site_of = root.faith }
						}	
					}
					find_holy_site_effect = yes
				}
			}
		}
		faith = {
			random_faith_holy_order = {
				leader = { save_scope_as = grandmaster }
			}
		}
		if = {
			limit = {
				exists = scope:grandmaster
			}
			create_character = {
				template = soldier_friend_character
				culture = scope:grandmaster.culture
				faith = scope:grandmaster.faith
				location = root.location

				after_creation = {
					save_scope_as = holy_order_character
					save_scope_as = pilgrim_character
					add_character_flag = {
						flag = need_military_outfit
					}
					add_trait = order_member
					add_piety_level = 1
					scope:grandmaster = {
						add_courtier = prev
					}
				}
			}
		}
		else = {
			create_character = {
				template = soldier_friend_character
				culture = root.culture
				faith = root.faith
				gender = root
				location = root.location
				save_scope_as = pilgrim_character
			}
		}
	}

	option = {
		name = travel_events_bp3.10.a
		if = {
			limit = {
				exists = scope:holy_order_character
			}
			add_piety = minor_piety_gain
			add_hook = {
				type = favor_hook
				target = scope:holy_order_character
			}
			progress_towards_friend_effect = {
				REASON = friend_story_by_fire
				CHARACTER = scope:holy_order_character
				OPINION = default_friend_opinion
			}
		}
		else = {
			add_prestige = minor_prestige_gain
		}

		stress_impact = {
			gregarious = minor_stress_impact_loss
			paranoid = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = paranoid
			}
			modifier = {
				factor = 5
				has_trait = gregarious
			}
		}
	}

	option = {
		name = travel_events_bp3.10.b
		trigger = {
			current_travel_plan.next_destination_province = scope:holy_location
		}
		if = {
			limit = {
				exists = scope:holy_order_character
			}
			add_piety = medium_piety_gain
			current_travel_plan = {
				add_travel_plan_modifier = {
					modifier = holy_knights_travel_modifier
					years = 1
				}
			}
		}
		else = {
			current_travel_plan = {
				add_travel_plan_modifier = {
					modifier = holy_pilgrims_travel_modifier
					years = 1
				}
			}
		}

		stress_impact = {
			gregarious = minor_stress_impact_loss
			paranoid = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = paranoid
			}
			modifier = {
				factor = 5
				has_trait = gregarious
			}
		}
	}

	option = {
		name = {
			trigger = {
				exists = scope:holy_order_character
			}
			text = travel_events_bp3.10.c.holy_order
		}
		name = {
			trigger = {
				NOT = { exists = scope:holy_order_character }
			}
			text = travel_events_bp3.10.c.pilgrims
		}
		flavor = travel_events_bp3.10.c.flavor
		if = {
			limit = {
				exists = scope:holy_order_character
			}
			add_piety = medium_piety_loss
			add_gold = {
				value = {
					value = tiny_gold_value
					divide = 2
					multiply = scope:holy_order_character.stewardship
				}
				min = 50
				max = 1000
			}
			scope:holy_order_character = {
				death = {
					death_reason = death_murder
					killer = root
				}
			}
		}
		else = {
			add_piety = major_piety_loss
			add_dread = medium_dread_gain
			add_gold = minor_gold_value

			hidden_effect = {
				scope:pilgrim_character = {
					death = {
						death_reason = death_murder
						killer = root
					}
				}
			}
		}
		if = {
			limit = {
				has_government = landless_adventurer_government
				NOT = { has_trait = gallowsbait }
			}
			add_trait = gallowsbait
		}
		else_if = {
			limit = {
				has_government = landless_adventurer_government
				has_trait = gallowsbait
			}
			add_trait_xp = {
				trait = gallowsbait
				track = bandit
				value = 5
			}
		}

		stress_impact = {
			compassionate = medium_stress_gain
			greedy = minor_stress_impact_loss
			callous = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = compassionate
			}
			modifier = {
				factor = 5
				OR = {
					has_trait = greedy
					has_trait = callous
					has_trait = sadistic
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.10.d
		if = {
			limit = {
				exists = scope:holy_order_character
			}
			scope:holy_order_character = {
				add_opinion = {
					modifier = disrespect_opinion
					target = root
					opinion = -15
				}
			}
		}

		stress_impact = {
			paranoid = minor_stress_impact_loss
			gregarious = minor_stress_gain
			compassionate = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = gregarious
					has_trait = compassionate
				}
			}
			modifier = {
				factor = 5
				has_trait = paranoid
			}
		}
	}

	after = {
		mp_resume_travel_plan = yes
		if = {
			limit = {
				NOT = { exists = scope:holy_order_character }
			}
			scope:pilgrim_character = {
				silent_disappearance_ai_effect = yes
			}
		}
		if = {
			limit = {
				exists = scope:holy_order_character
			}
			scope:holy_order_character = {
				silent_disappearance_ai_effect = yes
			}
		}
	}
}

scripted_trigger bard_murderer_trait_trigger = {
	OR = {
		has_trait = callous
		has_trait = sadistic
		has_trait = murderer
		has_trait = schemer
		has_trait = torturer
	}
}

scripted_trigger bard_lustful_trait_trigger = {
	OR = {
		has_trait = lustful
		has_trait = adulterer
		has_trait = fornicator
		has_trait = deviant
	}
}

scripted_trigger bard_gluttonous_trait_trigger = {
	OR = {
		has_trait = drunkard
		has_trait = gluttonous
		has_trait = lifestyle_reveler
	}
}

scripted_trigger bard_fool_trait_trigger = {
	OR = {
		has_trait = lunatic
		has_trait = possessed
		has_trait = intellect_bad
		has_trait = dull
	}
}

scripted_trigger bard_sinful_trait_trigger = {
	OR = {
		bard_murderer_trait_trigger = yes
		bard_lustful_trait_trigger = yes
		bard_gluttonous_trait_trigger = yes
		bard_fool_trait_trigger = yes
		has_trait = craven
	}
}

scripted_effect bard_replace_position_effect = {
	add_character_flag = temporary_court_position_cost_removal
	replace_court_position = {
		recipient = scope:bard_character
		holder = court_position:$POSITION$
		court_position = $POSITION$
	}
	remove_character_flag = temporary_court_position_cost_removal
}

travel_events_bp3.15 = { # The Stories of <X>
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.15.t
	desc = {
		desc = travel_events_bp3.15.desc
		random_valid = {
			triggered_desc = {
				trigger = {
					scope:liege = { bard_murderer_trait_trigger = yes }
				}
				desc = travel_events_bp3.15.desc.murderer
			}
			triggered_desc = {
				trigger = {
					scope:liege = { bard_lustful_trait_trigger = yes }
				}
				desc = travel_events_bp3.15.desc.lustful.man
			}
			triggered_desc = {
				trigger = {
					scope:liege = { bard_lustful_trait_trigger = yes }
				}
				desc = travel_events_bp3.15.desc.lustful.woman
			}
			triggered_desc = {
				trigger = {
					scope:liege = { bard_gluttonous_trait_trigger = yes }
				}
				desc = travel_events_bp3.15.desc.gluttonous
			}
			triggered_desc = {
				trigger = {
					scope:liege = { bard_fool_trait_trigger = yes }
				}
				desc = travel_events_bp3.15.desc.fool
			}
			triggered_desc = {
				trigger = {
					scope:liege = { has_trait = craven }
				}
				desc = travel_events_bp3.15.desc.craven
			}
		}
		desc = travel_events_bp3.15.desc.outro
	}
	theme = travel

	override_background = { reference = wilderness }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = laugh
	}

	right_portrait = {
		character = scope:bard_character
		animation = storyteller
	}

	lower_right_portrait = scope:liege

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.15
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		NOR = {
			location.county.holder.top_liege = ROOT
			location.county.title_province = {
				OR = {
					has_holding_type = nomad_holding
					has_holding_type = herder_holding
				}
			}
			location.county.holder.top_liege = {
				has_title = title:h_china
			}
		}
		location.county.holder.top_liege = {
			age > 16
			bard_sinful_trait_trigger = yes
		}
	}

	immediate = {
		location = { save_scope_as = location }
		mp_delay_travel_plan = { DAYS = 90 }
		location.county.holder.top_liege = {
			save_scope_as = liege
		}

		create_character = {
			template = master_bard_camp_officer_template
			culture = location.culture
			faith = location.faith
			gender = root
			location = location
			save_scope_as = bard_character
		}
	}

	option = {
		name = travel_events_bp3.15.a
		stress_impact = {
			base = minor_stress_impact_loss
		}
		custom_tooltip = travel_events_bp3.15.a.tt
		hidden_effect = {
			if = {
				limit = {
					is_ai = no
				}
				random = {
					chance = 33
					scope:liege = {
						random_secret = {
							expose_secret = root
						}
					}
				}
			}
			scope:bard_character = {
				silent_disappearance_ai_effect = yes
			}
		}

		ai_chance = {
			base = 250
			modifier = {
				factor = 5
				has_trait = ambitious
			}
		}
	}

	option = {
		name = travel_events_bp3.15.b
		trigger = {
			OR = {
				is_valid_to_hire_court_position_type = court_musician_court_position
				is_valid_to_hire_court_position_type = court_jester_court_position
				is_valid_to_hire_court_position_type = master_bard_camp_officer
			}
		}

		show_as_tooltip = {
			if = {
				limit = {
					is_valid_to_hire_court_position_type = court_musician_court_position
				}
				appoint_court_position = {
					recipient = scope:bard_character
					court_position = court_musician_court_position
				}
			}
			else_if = {
				limit = {
					is_valid_to_hire_court_position_type = court_jester_court_position
				}
				appoint_court_position = {
					recipient = scope:bard_character
					court_position = court_jester_court_position
				}
			}
			else_if = {
				limit = {
					is_valid_to_hire_court_position_type = master_bard_camp_officer
				}
				appoint_court_position = {
					recipient = scope:bard_character
					court_position = master_bard_camp_officer
				}
			}
		}
		custom_tooltip = will_have_excellent_aptitude

		hidden_effect = {
			scope:bard_character = { add_to_court_and_entourage_effect = yes }
			if = {
				limit = {
					is_valid_to_hire_court_position_type = court_musician_court_position
					NOT = { employs_court_position = court_musician_court_position }
				}
				appoint_court_position = {
					recipient = scope:bard_character
					court_position = court_musician_court_position
				}
			}
			else_if = {
				limit = {
					is_valid_to_hire_court_position_type = court_musician_court_position
					employs_court_position = court_musician_court_position
				}
				bard_replace_position_effect = { POSITION = court_musician_court_position }
			}
			else_if = {
				limit = {
					is_valid_to_hire_court_position_type = court_jester_court_position
					NOT = { employs_court_position = court_jester_court_position }
				}
				appoint_court_position = {
					recipient = scope:bard_character
					court_position = court_jester_court_position
				}
			}
			else_if = {
				limit = {
					is_valid_to_hire_court_position_type = court_jester_court_position
					employs_court_position = court_jester_court_position
				}
				bard_replace_position_effect = { POSITION = court_jester_court_position }
			}
			else_if = {
				limit = {
					is_valid_to_hire_court_position_type = master_bard_camp_officer
					NOT = { employs_court_position = master_bard_camp_officer }
				}
				appoint_court_position = {
					recipient = scope:bard_character
					court_position = master_bard_camp_officer
				}
			}
			else_if = {
				limit = {
					is_valid_to_hire_court_position_type = master_bard_camp_officer
					employs_court_position = master_bard_camp_officer
				}
				bard_replace_position_effect = { POSITION = master_bard_camp_officer }
			}
		}

		ai_chance = {
			base = 100
		}
	}

	option = {
		name = travel_events_bp3.15.c
		add_dread = minor_dread_gain
		scope:liege = {
			add_opinion = {
				modifier = grateful_opinion
				target = root
				opinion = 15
			}
		}
		scope:bard_character = {
			death = {
				death_reason = death_murder
				killer = root
			}
		}

		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				has_trait = compassionate
			}
			modifier = {
				factor = 10
				OR = {
					has_trait = callous
					has_trait = sadistic
				}
			}
		}
	}

	after = {
		mp_resume_travel_plan = yes
		
		scope:bard_character = {
			silent_disappearance_ai_effect = yes
		}
	}
}

scripted_trigger bp3_home_city_trigger = {
	has_holding_type = city_holding
	free_building_slots > 0 
}

travel_events_bp3.20 = { # The <X> Guild
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.20.t
	desc = travel_events_bp3.20.desc
	theme = travel

	override_background = { reference = market }

	cooldown = { years = 25 }

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:merchant_character
		animation = debating
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 0.3
			is_ai = yes
		}
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.20
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		location = {
			has_holding_type = city_holding
			local_guild_trigger = yes
		}
		any_sub_realm_barony = {
			title_province = { bp3_home_city_trigger = yes }
		}
		OR = { # Check if it is at all feasible that these people have an interest in your lands
			location.empire = capital_barony.empire
			location.county = {
				any_title_to_title_neighboring_and_across_water_empire = {
					this = root.capital_barony.empire
				}
			}
		}
		highest_held_title_tier < tier_empire
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
		location = {
			local_guild_effect = yes
		}
		random_sub_realm_barony = {
			limit = {
				county = { holder = root }
				title_province = { 
					bp3_home_city_trigger = yes 
					local_guild_compare_trigger = yes
				}
			}
			alternative_limit = {
				title_province = { 
					bp3_home_city_trigger = yes 
					local_guild_compare_trigger = yes
				}
			}
			alternative_limit = {
				title_province = {
					bp3_home_city_trigger = yes
				}
			}
			title_province = { save_scope_as = new_home_province }
		}

		create_character = {
			template = merchant_template
			faith = location.faith
			culture = location.culture
			gender = root
			location = location
			save_scope_as = merchant_character
		}
	}

	option = {
		name = travel_events_bp3.20.a
		add_gold = 1
		scope:new_home_province = {
			if = {
				limit = {
					local_guild_compare_trigger = yes
				}
				local_guild_reward_effect = yes
			}
			else = {
				add_random_economic_building_effect = yes
			}
		}

		stress_impact = {
			diligent = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = diligent
			}
		}
	}

	option = {
		name = travel_events_bp3.20.b
		flavor = travel_events_bp3.20.b.tt
		add_gold = tiny_gold_value
		scope:new_home_province.county = {
			change_development_progress_with_overflow = 25
			change_county_control = -25
		}

		stress_impact = {
			greedy = minor_stress_impact_loss
			arbitrary = minor_stress_impact_loss
			just = minor_stress_gain
			generous = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = just
					has_trait = generous
				}
			}
			modifier = {
				factor = 5
				OR = {
					has_trait = greedy
					has_trait = arbitrary
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.20.c
		if = {
			limit = {
				location.culture != culture
			}
			culture = {
				change_cultural_acceptance = {
					target = root.location.culture
					value = 2
					desc = cultural_acceptance_gain_event
				}
			}
		}
		else = {
			add_prestige = minor_prestige_gain
		}

		stress_impact = {
			gregarious = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = gregarious
			}
		}
	}

	after = {
		mp_resume_travel_plan = yes
		scope:merchant_character = {
			silent_disappearance_ai_effect = yes
		}
	}
}

travel_events_bp3.25 = { # The Toils of War
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.25.t
	desc = {
		desc = travel_events_bp3.25.desc
		random_valid = {
			triggered_desc = {
				trigger = {
					NOT = { has_trait = sadistic }
				}
				desc = travel_events_bp3.25.desc.outro
			}
			triggered_desc = {
				trigger = {
					has_trait = sadistic
				}
				desc = travel_events_bp3.25.desc.outro.sadistic
			}
		}
	}

	theme = travel

	override_background = { reference = market }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				has_trait = sadistic
			}
			animation = schadenfreude
		}
		triggered_animation = {
			trigger = {
				NOT = { has_trait = sadistic }
			}
			animation = sadness
		}
	}

	right_portrait = {
		character = scope:soldier_character
		animation = storyteller
		hide_info = yes
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.25
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		location = {
			has_holding_type = castle_holding
		}
		OR = {
			location.county.holder = { 
				days_of_continuous_war > 150 
				NOT = { is_at_war_with = root }
			}
			location.county.holder.top_liege = { 
				days_of_continuous_war > 150 
				NOT = { is_at_war_with = root }
			}
		}
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
		location.county.holder = {
			save_scope_as = liege
			random_character_war = {
				save_scope_as = ongoing_war
			}
			if = {
				limit = {
					NOT = { exists = scope:ongoing_war }
				}
				top_liege = {
					save_scope_as = liege
					random_character_war = {
						save_scope_as = ongoing_war
					}
				}
			}
		}
		scope:liege = {
			random_war_enemy = {
				save_scope_as = opponent
			}
		}
		create_character = {
			template = soldier_friend_character
			culture = root.location.culture
			faith = root.location.faith
			gender = root
			employer = scope:liege
			save_scope_as = soldier_character
		}

		save_scope_value_as = {
			name = lifestyle_modifier_xp
			value = {
				integer_range = { 
					min = 100 max = 500 
				}
				divide = 10
				ceiling = yes
				multiply = 10
			}
		}
	}

	option = {
		name = travel_events_bp3.25.a
		add_piety = medium_piety_gain
		remove_short_term_gold = tiny_gold_value
		if = {
			limit = {
				location.culture != culture
			}
			culture = {
				change_cultural_acceptance = {
					target = root.location.culture
					value = 2
					desc = cultural_acceptance_gain_event
				}
			}
		}

		stress_impact = {
			compassionate = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = compassionate
			}
		}
	}

	option = {
		name = travel_events_bp3.25.b
		random_list = {
			25 = {
				desc = travel_events_bp3.25.b.insulted
				modifier = {
					add = {
						value = 35
						subtract = root.diplomacy
					}
				}
				send_interface_toast = {
					type = event_generic_bad
					title = travel_events_bp3.25.b.insulted
					left_icon = root

					add_prestige = medium_prestige_loss
				}
			}
			25 = {
				desc = travel_events_bp3.25.b.stories
				modifier = {
					add = {
						value = 0
						add = root.martial
						add = root.prowess
					}
				}
				send_interface_toast = {
					type = event_generic_good
					title = travel_events_bp3.25.b.stories
					left_icon = root

					add_martial_lifestyle_xp = scope:lifestyle_modifier_xp
				}
			}
			50 = {
				desc = travel_events_bp3.25.b.martial
				modifier = {
					add = {
						value = 0
						subtract = root.martial
					}
				}
				send_interface_toast = {
					type = event_generic_good
					title = travel_events_bp3.25.b.martial
					left_icon = root

					add_martial_skill = 1
				}
			}
			50 = {
				desc = travel_events_bp3.25.b.prowess
				modifier = {
					add = {
						value = 0
						subtract = root.prowess
					}
				}
				send_interface_toast = {
					type = event_generic_good
					title = travel_events_bp3.25.b.prowess
					left_icon = root

					add_prowess_skill = 1
				}
			}
		}

		stress_impact = {
			brave = minor_stress_impact_loss
			craven = minor_stress_gain
			shy = medium_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = craven
					has_trait = shy
				}
			}
			modifier = {
				factor = 5
				has_trait = brave
			}
		}
	}

	option = {
		name = travel_events_bp3.25.c
		stress_impact = {
			base = minor_stress_impact_loss
			diligent = minor_stress_impact_loss
		}
		current_travel_plan ?= {
			add_destination_progress = { days = 3 }
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = diligent
			}
		}
	}

	after = {
		mp_resume_travel_plan = yes
		scope:soldier_character = {
			silent_disappearance_ai_effect = yes
		}
	}
}

travel_events_bp3.30 = { # The Mercenaries of <X>
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.30.t
	desc = travel_events_bp3.30.desc

	theme = travel

	override_background = { reference = tavern }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = drink
	}

	right_portrait = {
		character = scope:soldier_character
		animation = toast
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.30
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		location = {
			has_holding_type = castle_holding
		}
		highest_held_title_tier < tier_empire
		maa_regiments_max_count > 0 #This is to ensure we don't fire the event for characters that are not allowed to have MAA at all
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
		create_character = {
			template = great_mercenary
			culture = root.location.culture
			faith = root.location.faith
			gender_female_chance = root_soldier_female_chance
			location = root.location
			save_scope_as = soldier_character

			after_creation = {
				add_character_flag = {
					flag = need_military_outfit
				}
				if = {
					limit = { NOT = { has_trait = lifestyle_blademaster } }
					add_trait = lifestyle_blademaster
				}
				add_trait_xp = {
					trait = lifestyle_blademaster
					value = 75
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.30.a
		remove_short_term_gold = medium_gold_value
		spawn_army = {
			name = mercenary_army_default
			levies = {
				value = 200
				multiply = {
					min = 1
					value = highest_held_title_tier
				}
			}
			location = root.capital_province
			inheritable = no
			war_keep_on_attacker_victory = yes
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_education_martial_trigger = yes
			}
			modifier = {
				factor = 5
				OR = {
					has_trait = brave
					has_trait = ambitious
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.30.b
		trigger = {
			NOR = {
				is_valid_to_hire_court_position_type = bodyguard_court_position
				is_valid_to_hire_court_position_type = master_of_arms_camp_officer
			}
		}
		remove_short_term_gold = {
			value = tiny_gold_value
			min = 20
			max = 100
		}
		show_as_tooltip = { add_courtier = scope:soldier_character }
		hidden_effect = {
			scope:soldier_character = { add_to_court_and_entourage_effect = yes }
		}

		stress_impact = {
			paranoid = medium_stress_gain
			shy = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = paranoid
					has_trait = shy
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.30.c
		trigger = {
			OR = {
				is_valid_to_hire_court_position_type = bodyguard_court_position
				is_valid_to_hire_court_position_type = master_of_arms_camp_officer
			}
		}
		remove_short_term_gold = {
			value = minor_gold_value
			min = 20
			max = 100
		}

		show_as_tooltip = {
			if = {
				limit = {
					is_valid_to_hire_court_position_type = bodyguard_court_position
				}
				appoint_court_position = {
					recipient = scope:soldier_character
					court_position = bodyguard_court_position
				}
			}
			else_if = {
				limit = {
					is_valid_to_hire_court_position_type = master_of_arms_camp_officer
				}
				appoint_court_position = {
					recipient = scope:soldier_character
					court_position = master_of_arms_camp_officer
				}
			}
		}
		custom_tooltip = will_have_excellent_aptitude

		scope:soldier_character = {
			add_opinion = {
				modifier = friendliness_opinion
				target = root
				opinion = 25
			}
		}

		hidden_effect = {
			scope:soldier_character = { add_to_court_and_entourage_effect = yes }
			if = {
				limit = {
					is_valid_to_hire_court_position_type = bodyguard_court_position
					any_court_position_holder = {
					 	count <= 1
					 	has_court_position = bodyguard_court_position
					}
				}
				appoint_court_position = {
					recipient = scope:soldier_character
					court_position = bodyguard_court_position
				}
			}
			else_if = {
				limit = {
					is_valid_to_hire_court_position_type = bodyguard_court_position
					any_court_position_holder = {
					 	count > 1
					 	has_court_position = bodyguard_court_position
					}
				}
				add_character_flag = temporary_court_position_cost_removal
				replace_court_position = {
					recipient = scope:soldier_character
					holder = court_position:bodyguard_court_position
					court_position = bodyguard_court_position
				}
				remove_character_flag = temporary_court_position_cost_removal
			}
			else_if = {
				limit = {
					is_valid_to_hire_court_position_type = master_of_arms_camp_officer
					NOT = { employs_court_position = master_of_arms_camp_officer }
				}
				appoint_court_position = {
					recipient = scope:soldier_character
					court_position = master_of_arms_camp_officer
				}
			}
			else_if = {
				limit = {
					is_valid_to_hire_court_position_type = master_of_arms_camp_officer
					employs_court_position = master_of_arms_camp_officer
				}
				add_character_flag = temporary_court_position_cost_removal
				replace_court_position = {
					recipient = scope:soldier_character
					holder = court_position:master_of_arms_camp_officer
					court_position = master_of_arms_camp_officer
				}
				remove_character_flag = temporary_court_position_cost_removal
			}
		}

		stress_impact = {
			paranoid = medium_stress_gain
			shy = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = paranoid
					has_trait = shy
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.30.d
		stress_impact = {
			base = minor_stress_impact_loss
		}

		ai_chance = {
			base = 200
			modifier = {
				factor = 5
				OR = {
					has_trait = shy
					has_trait = paranoid
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.30.e
		trigger = {
			OR = {
				has_trait = callous
				has_trait = wrathful
			}
		}

		add_dread = medium_dread_gain
		scope:soldier_character = {
			death = {
				death_reason = death_murder
				killer = root
			}
		}

		stress_impact = {
			callous = minor_stress_impact_loss
			wrathful = medium_stress_impact_loss
			compassionate = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				OR = {
					has_trait = callous
					has_trait = wrathful
				}
			}
			modifier = {
				factor = 0
				has_trait = compassionate
			}
		}
	}

	after = {
		mp_resume_travel_plan = yes
		if = {
			limit = {
				OR = {
					is_ai = yes
					scope:soldier_character != root
				}
			}
			scope:soldier_character = {
				silent_disappearance_ai_effect = yes
			}
		}
	}
}

scripted_trigger travel_event_teachable_kid_trigger = {
	is_child_of = root
	is_adult = no
	age > 6
	has_focus = education_martial
}

travel_events_bp3.35 = { # The Teacher of Knights
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.35.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:kid_character = { is_travel_entourage_character = yes }
				}
				desc = travel_events_bp3.35.desc.traveling
			}
			desc = travel_events_bp3.35.desc.home
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } }
					scope:kid_character = { is_travel_entourage_character = yes }
				}
				desc = travel_events_bp3.35.outro.non_martial_gender
			}
			desc = travel_events_bp3.35.outro.martial_gender
		}
	}

	theme = travel

	override_background = { reference = courtyard }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:soldier_character
		animation = marshal_wooden_sword
	}

	lower_right_portrait = scope:kid_character

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.35
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		any_child = {
			travel_event_teachable_kid_trigger = yes
		}
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
		create_character = {
			template = old_knight_teacher
			culture = root.location.culture
			faith = root.location.faith
			gender_female_chance = root_soldier_female_chance
			location = root.location
			save_scope_as = soldier_character

			after_creation = {
				add_character_flag = {
					flag = roaming_character
					flag = need_military_outfit
				}
				add_trait_xp = {
					trait = lifestyle_blademaster
					value = 100
				}
				add_character_modifier = knight_teacher_modifier
			}
		}
		random_child = {
			limit = {
				is_travel_entourage_character = yes
				travel_event_teachable_kid_trigger = yes
			}
			alternative_limit = {
				travel_event_teachable_kid_trigger = yes
			}
			save_scope_as = kid_character
		}

		save_scope_value_as = {
			name = lifestyle_trait_xp
			value = lifestyle_blademaster_xp_gain_minor_value
		}
	}

	option = {
		name = {
			trigger = {
				scope:kid_character = { is_travel_entourage_character = yes }
			}
			text = travel_events_bp3.35.a.travel
		}
		name = {
			trigger = {
				scope:kid_character = { is_travel_entourage_character = no }
			}
			text = travel_events_bp3.35.a.home
		}
		if = {
			limit = {
				scope:kid_character = { is_travel_entourage_character = no }
			}
			remove_short_term_gold = {
				value = minor_gold_value
				min = 5
				max = 150
			}
		}

		hidden_effect = { 
			scope:soldier_character = { add_to_court_and_entourage_effect = yes }
		}

		scope:soldier_character = {
			set_relation_ward = scope:kid_character
			custom_tooltip = travel_events_bp3.35.a.tt
		}

		stress_impact = {
			diligent = minor_stress_impact_loss
			paranoid = medium_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = diligent
			}
			modifier = {
				factor = 0
				has_trait = paranoid
			}
		}
	}

	option = {
		name = {
			trigger = {
				can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
			}
			text = travel_events_bp3.35.b.martial
		}
		name = {
			trigger = {
				NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } }
			}
			text = travel_events_bp3.35.b.non_martial
		}
		if = {
			limit = {
				has_trait = lifestyle_blademaster
			}
			add_trait_xp = {
				trait = lifestyle_blademaster
				value = scope:lifestyle_trait_xp
			}
		}
		duel = {
			skill = prowess
			target = scope:soldier_character
			50 = {
				desc = travel_events_bp3.35.b.win
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -39
				}
				send_interface_toast = {
					type = event_generic_good
					title = travel_events_bp3.35.b.win
					left_icon = root

					add_prestige = minor_prestige_gain
					stress_impact = {
						base = minor_stress_impact_loss
					}
					if = {
						limit = {
							NOT = { has_trait = lifestyle_blademaster }
						}
						add_trait = lifestyle_blademaster
					}
				}
			}
			50 = {
				desc = travel_events_bp3.35.b.lose
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -39
				}
				send_interface_toast = {
					type = event_generic_good
					title = travel_events_bp3.35.b.lose
					left_icon = root

					add_prowess_skill = 1
				}
			}
		}

		hidden_effect = {
			scope:soldier_character = {
				silent_disappearance_ai_effect = yes
			}
		}

		stress_impact = {
			brave = minor_stress_impact_loss
			craven = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = brave
			}
			modifier = {
				factor = 0
				has_trait = craven
			}
		}
	}

	option = {
		name = {
			trigger = {
				scope:kid_character = { is_travel_entourage_character = yes }
			}
			text = travel_events_bp3.35.c.travel
		}
		name = {
			trigger = {
				scope:kid_character = { is_travel_entourage_character = no }
			}
			text = travel_events_bp3.35.c.home
		}
		stress_impact = {
			base = medium_stress_impact_loss
			gregarious = minor_stress_impact_loss
		}

		hidden_effect = {
			scope:soldier_character = {
				silent_disappearance_ai_effect = yes
			}
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = gregarious
			}
		}
	}

	after = {
		mp_resume_travel_plan = yes
		scope:soldier_character = {
			silent_disappearance_ai_effect = yes
		}
	}
}

scripted_trigger travel_event_decent_combatant_trigger = {
	this != root
	can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
	prowess >= 12
}

travel_events_bp3.40 = { # The Local Champion
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.40.t
	desc = {
		desc = travel_events_bp3.40.desc
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:challenger_character }
				desc = travel_events_bp3.40.outro.challenger
			}
			desc = travel_events_bp3.40.fallback
		}
	}
	
	theme = travel

	override_background = { reference = market }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = brave
					prowess > 12
				}
			}
			animation = anger
		}
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = craven
					prowess <= 12
				}
			}
			animation = fear
		}
	}

	right_portrait = {
		character = scope:soldier_character
		animation = wrestling_victory
	}

	lower_right_portrait = scope:challenger_character

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.40
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes

		OR = {
			can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
			current_travel_plan = {
				any_entourage_character = {
					NOT = { this = root }
					is_adult = yes
					travel_event_decent_combatant_trigger = yes
					prowess >= 12
				}
			}
		}
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }

		create_character = {
			template = wrestler_character
			culture = root.location.culture
			faith = root.location.faith
			gender_female_chance = root_soldier_female_chance
			location = root.location
			save_scope_as = soldier_character

			after_creation = {
				add_character_flag = should_be_topless
				add_character_flag = no_hat
			}
		}

		current_travel_plan = {
			ordered_entourage_character = { 
				limit = {
					this != root
					is_adult = yes
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
					prowess >= 12
				}
				order_by = prowess
				save_scope_as = challenger_character
			}
		}
	}

	option = {
		name = travel_events_bp3.40.a
		trigger = {
			can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
		}

		duel = {
			skill = prowess
			target = scope:soldier_character
			50 = {
				desc = travel_events_bp3.40.win
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -29
				}
				send_interface_toast = {
					type = event_generic_good
					title = travel_events_bp3.40.win
					left_icon = root

					add_prestige = medium_prestige_gain
					add_gold = medium_gold_value
				}
			}
			50 = {
				desc = travel_events_bp3.40.lose
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -29
				}
				send_interface_toast = {
					type = event_generic_bad
					title = travel_events_bp3.40.lose
					left_icon = root

					remove_short_term_gold = tiny_gold_value
					stress_impact = {
						base = minor_stress_gain
						ambitious = minor_stress_gain
					}
				}
			}
		}

		stress_impact = {
			craven = medium_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				OR = {
					has_trait = brave
					has_trait = ambitious
					has_trait = greedy
				}
				prowess > 12
			}
			modifier = {
				factor = 0
				has_trait = craven
			}
		}
	}

	option = {
		name = travel_events_bp3.40.b
		trigger = {
			exists = scope:challenger_character
		}
		scope:challenger_character ?= {
			duel = {
				skill = prowess
				target = scope:soldier_character
				50 = {
					desc = travel_events_bp3.40.win
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
						min = -29
					}
					root = {
						show_as_tooltip = {
							add_prestige = {
								value = medium_prestige_gain
								multiply = 0.5
							}
							add_gold = {
								value = medium_gold_value
								multiply = 0.75
							}
							scope:challenger_character = {
								add_prestige = {
									value = medium_prestige_gain
									multiply = 0.5
								}
								add_gold = {
									value = root.medium_gold_value
									multiply = 0.25
								}
							}
						}
						hidden_effect = {
							send_interface_toast = {
								type = event_generic_good
								title = travel_events_bp3.40.win
								left_icon = root
								right_icon = scope:challenger_character

								add_prestige = {
									value = medium_prestige_gain
									multiply = 0.5
								}
								add_gold = {
									value = medium_gold_value
									multiply = 0.75
								}
								hidden_effect = {
									scope:challenger_character = {
										add_prestige = {
											value = medium_prestige_gain
											multiply = 0.5
										}
										add_gold = {
											value = root.medium_gold_value
											multiply = 0.25
										}
									}
								}
							}
						}
					}
				}
				50 = {
					desc = travel_events_bp3.40.lose
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
						min = -29
					}
					root = {
						send_interface_toast = {
							type = event_generic_bad
							title = travel_events_bp3.40.lose
							left_icon = root
							
							remove_short_term_gold = tiny_gold_value

							scope:challenger_character = {
								stress_impact = {
									base = minor_stress_gain
									ambitious = minor_stress_gain
								}
							}
						}
					}
				}
			}
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				OR = {
					has_trait = ambitious
					has_trait = greedy
				}
				prowess <= 12
			}
		}
	}

	option = {
		name = travel_events_bp3.40.c

		current_travel_plan ?= {
			add_destination_progress = { days = 2 }
		}
	}

	after = {
		mp_resume_travel_plan = yes
		scope:soldier_character = {
			remove_character_flag = should_be_topless
			remove_character_flag = no_hat
			silent_disappearance_ai_effect = yes
		}
	}
}

travel_events_bp3.45 = { # The Wandering Knight
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.45.t
	desc = travel_events_bp3.45.desc

	theme = travel

	override_background = { reference = market }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:knight_character
		animation = debating

	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.45
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		location = { has_holding_type = castle_holding }
		has_government = feudal_government
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }

		create_character = {
			template = wandering_knight_character
			culture = root.location.culture
			faith = root.location.faith
			gender_female_chance = root_soldier_female_chance
			location = root.location
			save_scope_as = knight_character

			after_creation = {
				add_character_flag = no_hat
				add_character_flag = need_military_outfit
				add_prestige = { integer_range = { min = 250 max = 1250 } }
				add_piety = { integer_range = { min = 100 max = 500 } }
				add_gold = { integer_range = { min = 25 max = 250 } }
			}
		}

		save_scope_value_as = {
			name = piety_chance
			value = { integer_range = { min = 10 max = 30 } }
		}

		save_scope_value_as = {
			name = prestige_chance
			value = { integer_range = { min = 10 max = 30 } }
		}
	}

	option = {
		name = travel_events_bp3.45.a
		pay_short_term_gold = {
			target = scope:knight_character
			gold = {
				value = tiny_gold_value
				divide = 2
				min = 25
			}
		}

		scope:knight_character = {
			add_to_court_and_entourage_effect = yes 
		}

		stress_impact = {
			paranoid = medium_stress_gain
			shy = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = paranoid
					has_trait = shy
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.45.b
		flavor = travel_events_bp3.45.b.flavor
		remove_short_term_gold = {
			value = tiny_gold_value
			max = 35
		}
		random_list = {
			20 = {
				desc = travel_events_bp3.45.diplomacy
				modifier = {
					add = {
						value = 0
						subtract = root.diplomacy
					}
				}
				send_interface_message = {
					type = event_generic_good
					title = travel_events_bp3.45.diplomacy
					left_icon = root
					right_icon = scope:knight_character

					add_diplomacy_skill = 1
				}
			}
			20 = {
				desc = travel_events_bp3.45.prowess
				modifier = {
					add = {
						value = 0
						subtract = root.prowess
					}
				}
				send_interface_message = {
					type = event_generic_good
					title = travel_events_bp3.45.prowess
					left_icon = root
					right_icon = scope:knight_character

					add_prowess_skill = 1
				}
			}
			0 = {
				desc = travel_events_bp3.45.piety
				modifier = {
					add = scope:piety_chance
				}

				send_interface_message = {
					type = event_generic_good
					title = travel_events_bp3.45.piety
					left_icon = root
					right_icon = scope:knight_character

					add_piety = minor_piety_gain
				}
			}
			0 = {
				desc = travel_events_bp3.45.prestige
				modifier = {
					add = scope:prestige_chance
				}

				send_interface_message = {
					type = event_generic_good
					title = travel_events_bp3.45.prestige
					left_icon = root
					right_icon = scope:knight_character

					add_prestige = minor_prestige_gain
				}
			}
		}

		stress_impact = {
			gregarious = minor_stress_impact_loss
			shy = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = shy
			}
			modifier = {
				factor = 5
				has_trait = gregarious
			}
		}
	}

	option = {
		name = travel_events_bp3.45.c

		current_travel_plan ?= {
			add_destination_progress = { days = 2 }
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mp_resume_travel_plan = yes
		scope:knight_character = {
			remove_character_flag = no_hat
			silent_disappearance_ai_effect = yes
		}
	}
}

travel_events_bp3.50 = { # A Band of Two
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.50.t
	desc = travel_events_bp3.50.desc

	theme = travel

	override_background = { reference = alley_day }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:child_character
		animation = happiness
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.50
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		location = { has_holding_type = city_holding }
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }

		create_character = {
			template = peasant_child_character
			age = { 6 10 }
			culture = root.location.culture
			faith = root.location.faith
			location = root.location

			save_scope_as = child_character

			after_creation = {
				create_story = story_cycle_pet_dog
			}
		}
	}

	option = {
		name = travel_events_bp3.50.a

		remove_short_term_gold = {
			value = tiny_gold_value
			divide = 2
			min = 2
			max = 7
		}
		add_piety = minor_piety_gain

		add_character_modifier = {
			modifier = kind_ruler_modifier
			years = 5
		}

		if = {
			limit = {
				location.culture != culture
			}
			culture = {
				change_cultural_acceptance = {
					target = root.location.culture
					value = 1
					desc = cultural_acceptance_gain_event
				}
			}
		}

		stress_impact = {
			generous = medium_stress_impact_loss
			greedy = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = generous
			}
			modifier = {
				factor = 0
				has_trait = greedy
			}
		}
	}

	option = {
		name = travel_events_bp3.50.b
		trigger = {
			has_trait = compassionate
		}

		add_character_modifier = {
			modifier = kind_ruler_modifier
			years = 5
		}

		stress_impact = {
			compassionate = medium_stress_impact_loss
		}

		scope:child_character = {
			add_opinion = {
				modifier = saviour_opinion
				target = root
				opinion = 100
			}
		}

		show_as_tooltip = { add_courtier = scope:child_character }
		hidden_effect = {
			scope:child_character = { 
				add_to_court_and_entourage_effect = yes 
				remove_character_flag = peasant_outfit
			}
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = compassionate
			}
		}
	}

	option = {
		name = travel_events_bp3.50.c
		trigger = {
			OR = {
				has_trait = callous
				has_trait = sadistic
			}
		}

		show_as_tooltip = {
			add_character_modifier = dog_story_modifier
		}
		create_story = story_cycle_pet_dog
		add_character_modifier = {
			modifier = heartless_modifier
			years = 5
		}
		scope:child_character = {
			add_opinion = {
				modifier = hate_opinion
				target = root
				opinion = -200
			}
		}
		hidden_effect = {
			scope:child_character = {
				random_owned_story = {
					type = story_cycle_pet_dog
					end_story = yes
				}
			}
		}

		stress_impact = {
			callous = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
			compassionate = major_stress_gain
			generous = medium_stress_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = generous
					has_trait = compassionate
				}
			}

			modifier = {
				factor = 5
				OR = {
					has_trait = sadistic
					has_trait = callous
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.50.d

		current_travel_plan ?= {
			add_destination_progress = { days = 2 }
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mp_resume_travel_plan = yes
		scope:child_character = {
			silent_disappearance_ai_effect = yes
		}
	}
}

scripted_trigger republic_ruler_check_trigger = {
	government_has_flag = government_is_republic
	in_diplomatic_range = root
	NOT = { is_allied_to = root }
}

travel_events_bp3.55 = { # Traveling Traders
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.55.t
	desc = travel_events_bp3.55.desc

	theme = travel

	override_background = { 
		trigger = {
			location = {
				OR = {
					is_coastal = yes
					is_riverside_province = yes
				}
			}
		}
		reference = docks 
	}

	override_background = {
		trigger = {
			location = {
				is_coastal = no
				is_riverside_province = no
			}
		}
		reference = market
	}

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:merchant_character
		animation = anger
	}

	lower_right_portrait = scope:republic_ruler

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.55
			match = 0.50
		}
		is_ai = no
		bp3_travel_event_default_trigger = yes
		location = { has_holding_type = city_holding }
		OR = {
			any_independent_ruler = {
				republic_ruler_check_trigger = yes
			}
			faith = {
				any_faith_ruler = {
					republic_ruler_check_trigger = yes
				}
			}
		}
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
		ordered_independent_ruler = {
			order_by = current_military_strength
			limit = {
				republic_ruler_check_trigger = yes	
			}
			position = 0
			save_scope_as = republic_ruler
		}
		if = {
			limit = {
				NOT = { exists = scope:republic_ruler }
			}
			faith = {
				ordered_faith_ruler = {
					order_by = current_military_strength
					limit = {
						republic_ruler_check_trigger = yes	
					}
					position = 0
					save_scope_as = republic_ruler
				}
			}
		}
		create_character = {
			template = merchant_template
			faith = scope:republic_ruler.faith
			culture = scope:republic_ruler.culture
			gender = root
			location = location
			save_scope_as = merchant_character

			after_creation = {
				add_prestige = { integer_range = { min = 25 max = 500 } }
				add_piety = { integer_range = { min = 25 max = 250 } }
				add_gold = { integer_range = { min = root.medium_gold_value max = root.major_gold_value } }
			}
		}
		save_scope_value_as = {
			name = price_for_alliance
			value = {
				value = scope:republic_ruler.current_military_strength
				divide = 10
			}
		}
	}

	option = {
		name = travel_events_bp3.55.a
		flavor = travel_events_bp3.55.a.flavor
		remove_short_term_gold = scope:price_for_alliance
		create_alliance = scope:republic_ruler
		custom_tooltip = travel_events_bp3.55.a.tt
		scope:republic_ruler = {
			add_opinion = {
				modifier = event_negotiated_alliance_opinion
				target = root
			}
		}

		stress_impact = {
			generous = minor_stress_impact_loss
			greedy = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = generous
			}
			modifier = {
				factor = 0
				has_trait = greedy
			}
		}
	}

	option = {
		name = travel_events_bp3.55.b
		flavor = travel_events_bp3.55.b.flavor
		duel = {
			skill = stewardship
			target = scope:merchant_character

			50 = {
				desc = travel_events_bp3.55.b.win
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_message = {
					type = event_generic_good
					title = travel_events_bp3.55.b.win

					scope:merchant_character = {
						pay_short_term_gold = {
							target = root
							gold = root.medium_gold_value
						}
					}
					scope:republic_ruler = {
						add_opinion = {
							modifier = angry_opinion
							target = root
							opinion = -25
						}
					}
				}
			}
			50 = {
				desc = travel_events_bp3.55.b.lose
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_message = {
					type = event_generic_bad
					title = travel_events_bp3.55.b.lose

					pay_short_term_gold = {
						target = scope:merchant_character
						gold = root.minor_gold_value
					}
					scope:republic_ruler = {
						add_opinion = {
							modifier = disrespect_opinion
							target = root
							opinion = -15
						}
					}
				}
			}
		}

		stress_impact = {
			generous = minor_stress_gain
			greedy = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = greedy
			}
			modifier = {
				factor = 0
				has_trait = generous
			}
		}
	}

	option = {
		name = travel_events_bp3.55.c

		stress_impact = {
			base = minor_stress_impact_loss
		}

		ai_chance = {
			base = 300
		}
	}

	after = {
		mp_resume_travel_plan = yes
		hidden_effect = {
			scope:merchant_character = {
				set_employer = scope:republic_ruler
			}
		}
	}
}

travel_events_bp3.60 = { # A Small Deal
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.60.t
	desc = travel_events_bp3.60.desc

	theme = travel

	override_background = { 
		trigger = {
			location = {
				OR = {
					is_coastal = yes
					is_riverside_province = yes
				}
			}
		}
		reference = docks 
	}

	override_background = {
		trigger = {
			location = {
				is_coastal = no
				is_riverside_province = no
			}
		}
		reference = market
	}

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:merchant_character
		animation = disbelief
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.60
			match = 0.50
		}
		is_landed = yes
		bp3_travel_event_default_trigger = yes
		location = { 
			has_holding_type = city_holding 
			this != root.capital_province
		}
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }

		capital_province = {
			set_variable = {
				name = extra_building_resources
				value = 3
			}
		}

		create_character = {
			template = merchant_template
			faith = root.location.faith
			culture = root.location.culture
			gender = root
			location = location
			save_scope_as = merchant_character

			after_creation = {
				add_prestige = { integer_range = { min = 25 max = 500 } }
				add_piety = { integer_range = { min = 25 max = 250 } }
				add_gold = { integer_range = { min = root.medium_gold_value max = root.major_gold_value } }
			}
		}
	}

	option = {
		name = travel_events_bp3.60.a

		remove_short_term_gold = {
			value = minor_gold_value
			min = 25
			max = 500
		}

		capital_province = {
			add_province_modifier = travel_extra_building_resources_modifier
		}

		ai_chance = {
			base = 100
		}
	}

	option = {
		name = travel_events_bp3.60.b

		remove_short_term_gold = {
			value = tiny_gold_value
			min = 10
			max = 250
		}

		add_character_modifier = {
			modifier = travel_extra_building_resources_character_modifier
			years = 5
		}

		ai_chance = {
			base = 100
		}
	}

	option = {
		name = travel_events_bp3.60.c

		current_travel_plan ?= {
			add_destination_progress = { days = 2 }
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mp_resume_travel_plan = yes
		hidden_effect = {
			scope:merchant_character = {
				silent_disappearance_ai_effect = yes
			}
		}
	}
}

travel_events_bp3.65 = { # Purse Pursuit
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.65.t
	desc = travel_events_bp3.65.desc

	theme = travel

	override_background = market

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = shock
	}

	right_portrait = {
		character = scope:thief_character
		animation = betting
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.65
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		location = { has_holding_type = city_holding }
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }

		create_character = {
			random_traits = no
			age = { 16 20 }
			dynasty = none
			faith = root.location.faith
			culture = root.location.culture
			location = root.location
			random_traits_list = {
				count = 1
				education_intrigue_3 = {}
				education_intrigue_4 = {}
			}
			random_traits_list = {
				count = 3
				brave = {}
				ambitious = {}
				stubborn = {}
				vengeful = {}
				arrogant = {}
				deceitful = {}
				stubborn = {}
				callous = {}
			}
			intrigue = {
				min_template_decent_skill
				max_template_decent_skill
			}
			gender_female_chance = root_soldier_female_chance
			save_scope_as = thief_character

			after_creation = {
				add_gold = { integer_range = { min = 5 max = 75 } }
				add_piety = { integer_range = { min = -100 max = -25 } }
			}
		}

		save_scope_value_as = {
			name = gold_value
			value = {
				value = tiny_gold_value
				divide = 2
			}
		}

		remove_short_term_gold = scope:gold_value
	}

	option = {
		name = travel_events_bp3.65.a

		show_as_tooltip = {
			add_courtier = scope:thief_character
		}

		scope:thief_character = {
			hidden_effect = { add_to_court_and_entourage_effect = yes }

			add_opinion = {
				modifier = respect_opinion
				target = root
				opinion = 25
			}
		}

		stress_impact = {
			paranoid = major_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = paranoid
			}
		}
	}

	option = {
		name = travel_events_bp3.65.b

		add_dread = minor_dread_gain

		add_gold = {
			value = scope:gold_value
			add = scope:thief_character.gold
		}

		scope:thief_character = {
			death = {
				death_reason = death_murder
				killer = root
			}
		}

		stress_impact = {
			wrathful = medium_stress_impact_loss
			callous = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
			greedy = minor_stress_impact_loss
			compassionate = minor_stress_gain
		}	

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = compassionate
			}
			modifier = {
				factor = 5
				OR = {
					has_trait = wrathful
					has_trait = callous
					has_trait = sadistic
					has_trait = greedy
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.65.c

		add_gold = scope:gold_value

		stress_impact = {
			base = minor_stress_impact_loss
			compassionate = minor_stress_impact_loss
			forgiving = minor_stress_impact_loss
			wrathful = medium_stress_gain
			vengeful = medium_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = wrathful
					has_trait = vengeful
				}
			}
			modifier = {
				factor = 5
				OR = {
					has_trait = compassionate
					has_trait = forgiving
				}
			}
		}
	}

	after = {
		mp_resume_travel_plan = yes
		scope:thief_character = {
			silent_disappearance_ai_effect = yes
		}
	}
}

travel_events_bp3.70 = { # <X> Festival
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.70.t
	desc = {
		desc = travel_events_bp3.70.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:local_character
				}
				desc = travel_events_bp3.70.desc.local
			}
			triggered_desc = {
				trigger = {
					exists = scope:dancing_partner
				}
				desc = travel_events_bp3.70.desc.entourage
			}
		}
		desc = travel_events_bp3.70.desc.outro
	}

	theme = travel

	override_background = { reference = village_festival }

	cooldown = { years = 50 }

	left_portrait = {
		character = root
		animation = dancing
	}

	right_portrait = {
		character = scope:dancing_partner
		animation = dancing
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.70
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		location = { 
			has_holding_type = city_holding 
			culture != root.culture
		}
		NOT = { exists = var:special_culture }
		prestige_level >= 4
		NOR = {
			has_trait = shy
			has_trait = paranoid
		}
		location.culture = {
			NOT = {
				any_parent_culture = { this = root.culture }
			}
		}
		culture = {
			NOR = {
				any_parent_culture = { this = root.location.culture }
				has_same_culture_heritage = root.location.culture
			}
		}
		highest_held_title_tier < tier_empire
	}

	immediate = {
		save_scope_as = root_scope
		mp_delay_travel_plan = { DAYS = 90 }

		current_travel_plan = {
			random_entourage_character = {
				limit = {
					OR = {
						is_spouse_of = root
						is_child_of = root
					}
				}
				save_scope_as = dancing_partner
			}
		}

		if = {
			limit = {
				NOT = { exists = scope:dancing_partner }
			}
			create_character = {
				template = merchant_template
				age = { 20 25 }
				faith = root.location.faith
				culture = root.location.culture
				opposite_gender = root
				location = location
				save_scope_as = local_character
				save_scope_as = dancing_partner
			}
		}

		set_variable = {
			name = special_culture_tooltip
			value = root.location.culture
		}
	}

	option = {
		name = travel_events_bp3.70.a

		reason = prestige_level

		culture = {
			change_cultural_acceptance = {
				target = root.location.culture
				value = 5
				desc = cultural_acceptance_gain_event
			}
		}

		if = {
			limit = {
				has_dlc_feature = hybridize_culture
			}
			custom_tooltip = travel_events_bp3.70.a.cultural_acceptance
			custom_tooltip = travel_events_bp3.70.a.counties

			set_variable = {
				name = special_culture
				value = root.location.culture
			}
		}

		ai_chance = {
			base = 0
		}
	}

	option = {
		name = travel_events_bp3.70.b

		stress_impact = {
			base = major_stress_impact_loss
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mp_resume_travel_plan = yes

		remove_variable = special_culture_tooltip
	}
}

travel_events_bp3.75 = { # Dreams Brewing
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.75.t
	desc = travel_events_bp3.75.desc

	theme = travel

	override_background = { reference = market }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = drink
	}

	right_portrait = {
		character = scope:brewmaster_character
		animation = obsequious_bow
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.75
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		NOT = { has_trait = paranoid }
		location = { 
			has_holding_type = church_holding
		}
		OR = {
			root.culture = { has_cultural_parameter = allows_brewery }
			root.faith = {
				OR = {
					this = faith:catholic
					has_doctrine_parameter = allows_brewery
				}
			}
		}
		OR = {
			any_sub_realm_barony = {
				county.holder = root
				title_province = { 
					has_holding_type = city_holding 
					NOT = { has_building_or_higher = breweries_01 }
				}
				root.culture = { has_cultural_parameter = allows_brewery }
			}
			any_sub_realm_barony = {
				county.holder = root
				title_province = { 
					has_holding_type = church_holding 
					NOT = { has_building_or_higher = breweries_01 }
				}
				root.faith = { 
					OR = {
						has_doctrine_parameter = allows_brewery 
						this = faith:catholic
					}
				}
			}
		}
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
		if = {
			limit = {
				culture = { has_cultural_parameter = allows_brewery }
			}
			random_sub_realm_barony = {
				limit = {
					county.holder = root
					title_province = { 
						has_holding_type = city_holding 
						NOT = { has_building_or_higher = breweries_01 }
					}
				}
				save_scope_as = target_barony
			}
		}
		if = {
			limit = {
				NOT = { exists = scope:barony }
				faith = { 
					OR = {
						has_doctrine_parameter = allows_brewery 
						this = faith:catholic
					}
				}
			}
			random_sub_realm_barony = {
				limit = {
					county.holder = root
					title_province = { 
						has_holding_type = church_holding 
						NOT = { has_building_or_higher = breweries_01 }
					}
				}
				save_scope_as = target_barony
			}
		}
		if = {
			limit = {
				OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
				faith = {
					OR = {
						this = faith:catholic
						has_doctrine_parameter = allows_brewery
					}
				}
			}
			create_character = {
				template = monk_brewer_template
				culture = root.location.culture
				location = root.location

				save_scope_as = brewmaster_character
			}
		}
		else = {
			create_character = {
				template = merchant_template
				age = { 18 28 }
				culture = root.location.culture
				faith = root.faith
				gender_female_chance = root_faith_clergy_gender_female_chance

				random_traits_list = {
					count = 1
					diligent = {}
					patient = {}
				}

				random_traits_list = {
					count = 2
					humble = {}
					content = {}
					gluttonous = {}
					chaste = {}
					generous = {}
					calm = {}
					deceitful = {}
					honest = {}
					craven = {}
					gregarious = {}
					arbitrary = {}
					just = {}
					zealous = {}
					trusting = {}
				}

				location = root.location

				save_scope_as = brewmaster_character
			}
		}
	}

	option = {
		name = travel_events_bp3.75.a

		remove_treasury_or_gold = tiny_treasury_or_gold_value

		scope:target_barony.title_province = {
			add_building = breweries_01
		}

		ai_chance = {
			base = 0
		}
	}

	option = {
		name = travel_events_bp3.75.b

		remove_short_term_gold = minor_gold_value

		scope:target_barony.title_province = {
			add_building = breweries_01
		}

		scope:brewmaster_character = { 
			show_as_tooltip = { set_employer = root }
			hidden_effect = { add_to_court_and_entourage_effect = yes }
		}

		show_as_tooltip = {
			appoint_court_position = {
				recipient = scope:brewmaster_character
				court_position = court_brewmaster_court_position
			}
			custom_tooltip = will_have_excellent_aptitude
		}

		hidden_effect = {
			if = {
				limit = {
					is_valid_to_hire_court_position_type = court_brewmaster_court_position
					NOT = { employs_court_position = court_brewmaster_court_position }
				}
				appoint_court_position = {
					recipient = scope:brewmaster_character
					court_position = court_brewmaster_court_position
				}
			}
			else_if = {
				limit = {
					is_valid_to_hire_court_position_type = court_brewmaster_court_position
					employs_court_position = court_brewmaster_court_position
				}
				add_character_flag = temporary_court_position_cost_removal
				replace_court_position = {
					recipient = scope:brewmaster_character
					holder = court_position:court_brewmaster_court_position
					court_position = court_brewmaster_court_position
				}
				remove_character_flag = temporary_court_position_cost_removal
			}
		}

		ai_chance = {
			base = 0
		}
	}

	option = {
		name = travel_events_bp3.75.c

		stress_impact = {
			base = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mp_resume_travel_plan = yes
		stress_impact = {
			drunkard = medium_stress_impact_loss
		}
		if = {
			limit = {
				scope:brewmaster_character.liege != root
			}
			scope:brewmaster_character = { silent_disappearance_ai_effect = yes }
		}
	}
}

scripted_trigger travel_events_monk_child_trigger = {
	is_heir_of = root
	NOT = { is_primary_heir_of = root }
	age > 10
	age <= 25
	is_married = no
	OR = {
		has_trait = chaste
		has_trait = temperate
		has_trait = lazy
		has_trait = humble
		has_trait = diligent
		has_trait = calm
		has_trait = patient
		has_trait = honest
		has_trait = craven
		has_trait = content
		has_trait = zealous
		has_trait = compassionate
		has_trait = forgiving
		has_trait = education_learning
		ai_zeal >= 0
	}
	NOR = {
		has_trait = ambitious
		has_trait = cynical
	}
}

travel_events_bp3.80 = { # A Life of Service
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.80.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:grandmaster
				}
				desc = travel_events_bp3.80.desc.holy_order
			}
			triggered_desc = {
				trigger = {
					scope:monk_character = {
						is_adult = yes
					}
				}
				desc = travel_events_bp3.80.desc.adult
			}
			triggered_desc = {
				trigger = {
					scope:monk_character = {
						is_adult = no
					}
				}
				desc = travel_events_bp3.80.desc.child
			}
		}
	}

	theme = travel

	override_background = { reference = temple }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:monk_character
		animation = debating
	}

	lower_right_portrait = scope:grandmaster
	lower_left_portrait = {
		trigger = {
			NOT = { exists = scope:grandmaster }
		}
		character = root.location.barony.holder
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.80
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		location = { 
			has_holding_type = church_holding 
			faith = root.faith
		}
		current_travel_plan = {
			any_entourage_character = {
				travel_events_monk_child_trigger = yes
				save_temporary_scope_as = monk_character_temp
			}
		}
		faith = {
			OR = {
				has_doctrine_parameter = take_vows_active
				AND = {
					any_faith_holy_order = { }
					scope:monk_character_temp = {
						is_adult = yes
						OR = {
							has_trait = education_martial
							prowess > 10
						}
					}
				}
			}
		}
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
		current_travel_plan = {
			random_entourage_character = {
				limit = {
					travel_events_monk_child_trigger = yes
				}
				save_scope_as = monk_character
			}
		}
		if = {
			limit = {
				scope:monk_character = {
					is_adult = yes
					OR = {
						has_trait = education_martial
						prowess > 10
					}
				}
			}
			faith = {
				random_faith_holy_order = {
					leader = { save_scope_as = grandmaster }
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.80.a

		scope:monk_character = {
			add_opinion = {
				target = root
				modifier = friendliness_opinion
				opinion = 25
			}
		}

		if = {
			limit = {
				exists = scope:grandmaster
			}
			save_scope_as = actor
			scope:monk_character = {
				save_scope_as = recipient
				send_child_to_holy_order_effect = { GRANDMASTER = grandmaster }
			}
		}
		else = {
			scope:monk_character = {
				simplified_clergy_effect = { RECIPIENT = scope:monk_character }
			}
			if = {
				limit = {
					scope:monk_character = { is_adult = yes }
				}
				root.location.barony.holder = {
					add_courtier = scope:monk_character
				}
			}
		}

		stress_impact = {
			zealous = medium_stress_impact_loss
			content = minor_stress_impact_loss
			cynical = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = cynical
			}
			modifier = {
				factor = 5
				OR = {
					has_trait = zealous
					has_trait = content
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.80.b

		scope:monk_character = {
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -10
			}
		}

		stress_impact = {
			zealous = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = zealous
			}
		}
	}

	after = {
		mp_resume_travel_plan = yes
	}
}

travel_events_bp3.85 = { # Brewers of Fame
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.85.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					root.location = {
						OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
						has_holding_type = church_holding 
					}
				}
				desc = travel_events_bp3.85.desc.monk
			}
			triggered_desc = {
				trigger = {
					root.location = {
						NAND = {
							OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
							has_holding_type = church_holding
						}
					}
				}
				desc = travel_events_bp3.85.desc
			}
		}
		desc = travel_events_bp3.85.desc.outro
	}

	theme = travel

	override_background = { reference = tavern }

	cooldown = { years = 20 }

	left_portrait = {
		character = root
		animation = drink
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.85
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		location = { 
			has_building_or_higher = breweries_01
			county.holder = {
				NOR = {
					this = root
					any_liege_or_above = {
						this = root
					}
				}
			}
		}
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }

		if = {
			limit = {
				any_held_title = {
					title_tier = county
					has_variable = brewery_counter_var
				}
			}
			ordered_sub_realm_county = {
				order_by = {
					value = 10000
					subtract = var:brewery_counter_var
				}
				limit = {
					has_variable = brewery_counter_var	
				}
				position = 0
				save_scope_as = brewery_county
			}
		}
	}

	option = {
		name = travel_events_bp3.85.a
		trigger = {
			exists = scope:brewery_county
			brewery_counter_value > 25
		}

		reason = brewery

		custom_tooltip = travel_events_bp3.85.a.tt

		add_prestige = {
			value = brewery_counter_value
			divide = 25
			floor = yes
			multiply = 50
			min = 50
			max = 500
		}

		dynasty = {
			add_dynasty_prestige = {
				value = brewery_counter_value
				divide = 25
				floor = yes
				multiply = 5
				min = 5
				max = 50
			}
		}

		stress_impact = {
			arrogant = minor_stress_impact_loss
			humble = minor_stress_gain
		}

		ai_chance = {
			base = 0
		}
	}

	option = {
		name = travel_events_bp3.85.b

		remove_short_term_gold = minor_gold_value

		add_character_modifier = {
			modifier = popular_beer_character_modifier
			years = 5
		}

		stress_impact = {
			greedy = minor_stress_gain
			generous = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = greedy
			}
			modifier = {
				factor = 5
				has_trait = generous
			}
		}
	}

	option = {
		name = travel_events_bp3.85.c

		stress_impact = {
			base = minor_stress_impact_loss
			content = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = content
			}
		}
	}

	after = {
		mp_resume_travel_plan = yes
		stress_impact = {
			drunkard = minor_stress_impact_loss
		}
	}
}

travel_events_bp3.90 = { # Patron of the <Temple/Mosque/Church>
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.90.t
	desc = travel_events_bp3.90.desc

	theme = travel

	override_background = { reference = temple }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:priest_character
		animation = obsequious_bow
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.90
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		location = { 
			has_holding_type = church_holding 
			faith = root.faith
			county.holder.top_liege = root.top_liege
		}
		NOR = {
			has_character_modifier = church_investment_modifier
			has_character_modifier = church_investment_cost_modifier
		}
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
		create_character = {
			template = simple_priest_character_template
			culture = root.location.culture
			faith = root.location.faith
			gender_female_chance = root_faith_clergy_gender_female_chance
			employer = root.location.barony.holder

			save_scope_as = priest_character
		}
		set_variable = {
			name = church_investment_year_var
			value = {
				value = current_year
				subtract = 5
			}
		}
		save_scope_value_as = {
			name = investment_cost
			value = { 
				value = tiny_gold_value
				divide = 10
				min = 2
				floor = yes
				multiply = 10
				max = 100
			}
		}
	}

	option = {
		name = travel_events_bp3.90.a
		flavor = travel_events_bp3.90.a.flavor

		add_character_modifier = church_investment_modifier
		add_character_modifier = church_investment_cost_modifier

		ai_chance = {
			base = 100
		}
	}

	option = {
		name = travel_events_bp3.90.b

		remove_short_term_gold = scope:investment_cost
		add_piety = {
			value = scope:investment_cost
			multiply = 2
		}

		ai_chance = {
			base = 100
		}
	}

	option = {
		name = travel_events_bp3.90.c

		current_travel_plan ?= {
			add_destination_progress = { days = 2 }
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mp_resume_travel_plan = yes
		scope:priest_character ?= { silent_disappearance_ai_effect = yes }
	}
}

scripted_trigger unvisited_holy_site_trigger = {
	root = { 
		OR = {
			NOT = { has_variable_list = visited_unique_holy_sites_list }
			AND = {
				has_variable_list = visited_unique_holy_sites_list
				NOT = {
					is_target_in_variable_list = {
						name = visited_unique_holy_sites_list
						target = prev
					}
				}
			}
		}
	}
}

travel_events_bp3.95 = { # A Pilgrim's Tale
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.95.t
	desc = travel_events_bp3.95.desc

	theme = travel

	override_background = { reference = temple }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:pilgrim_character
		hide_info = yes
		animation = storyteller
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.95
			match = 0.50
		}
		is_ai = no
		bp3_travel_event_default_trigger = yes
		location = { 
			has_holding_type = church_holding 
			faith = root.faith
			barony = { is_holy_site = no }
		}
		faith = {
			NOT = { has_doctrine = doctrine_pilgrimage_forbidden }
			any_holy_site = {
				unvisited_holy_site_trigger = yes
			}
		}
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
		faith = {
			random_holy_site = {
				limit = {
					unvisited_holy_site_trigger = yes
				}
				save_scope_as = unvisited_holy_site
			}
		}
		create_character = {
			template = merchant_template
			faith = root.faith
			culture = root.location.culture
			gender = root
			location = root.location
			save_scope_as = pilgrim_character

			after_creation = {
				add_piety = { integer_range = { min = 25 max = 250 } }
			}
		}
	}

	option = {
		name = travel_events_bp3.95.a
		flavor = travel_events_bp3.95.a.flavor

		if = {
			limit = {
				has_lifestyle = wanderer_lifestyle
			}
			custom_tooltip = travel_events_bp3.95.a.tt.wanderer
		}
		else = {
			custom_tooltip = travel_events_bp3.95.a.tt
		}

		remove_short_term_gold = tiny_gold_value

		add_to_variable_list = {
			name = holy_site_dreams
			target = scope:unvisited_holy_site
		}

		stress_impact = {
			zealous = minor_stress_impact_loss
		}
	}

	option = {
		name = travel_events_bp3.95.b

		stress_impact = {
			base = minor_stress_impact_loss
		}
	}

	after = {
		mp_resume_travel_plan = yes
		scope:pilgrim_character = { silent_disappearance_ai_effect = yes }
	}
}

scripted_trigger bp3_good_relations_trigger = {
	is_adult = yes
	likes_character_trigger = { CHARACTER = root }
	OR = {
		is_close_family_of = root
		is_spouse_of = root
		has_important_relationship_with_character_trigger = { CHARACTER = root }
	}
}

travel_events_bp3.100 = { # Land of Milk and... Fish?
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.100.t
	desc = travel_events_bp3.100.desc

	theme = travel

	override_background = { 
		trigger = {
			location = { is_coastal = yes }
		}
		reference = bp3_coast
	}

	override_background = {
		trigger = {
			location = { is_riverside_province = yes }
		}
		reference = bp3_riverside
	}

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:friend_character
		animation = happiness
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.100
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		location = {
			OR = {
				is_coastal = yes
				is_riverside_province = yes
			}
		}
		current_travel_plan = {
			any_entourage_character = {
				bp3_good_relations_trigger = yes
			}
		}
		OR = {
			current_season_spring = yes
			current_season_summer = yes
			current_season_autumn = yes
			current_season_dry_season = yes
		}		
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
		current_travel_plan = {
			random_entourage_character = {
				limit = {
					bp3_good_relations_trigger = yes
				}
				weight = {
					base = 1
					modifier = {
						factor = 5
						OR = {
							is_spouse_of = root
							is_close_family_of = root
						}
					}
				}
				save_scope_as = friend_character
			}
		}
	}

	option = {
		name = travel_events_bp3.100.a
		flavor = travel_events_bp3.100.a.flavor

		progress_towards_friend_effect = {
			REASON = friend_fishing_trip
			CHARACTER = scope:friend_character
			OPINION = default_friend_opinion
		}

		domicile ?= { change_provisions = miniscule_provisions_gain }

		stress_impact = {
			base = minor_stress_impact_loss
			content = minor_stress_impact_loss
			lazy = minor_stress_impact_loss
			patient = minor_stress_impact_loss

		}

		current_travel_plan ?= {
			delay_travel_plan = { days = 3 }
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				OR = {
					has_trait = lazy
					has_trait = content
					has_trait = patient
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.100.b
		flavor = travel_events_bp3.100.b.flavor

		domicile ?= { change_provisions = minor_provisions_gain }

		stress_impact = {
			base = medium_stress_impact_loss
			content = minor_stress_impact_loss
			lazy = minor_stress_impact_loss
		}

		current_travel_plan ?= {
			delay_travel_plan = { days = 10 }
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				OR = {
					has_trait = lazy
					has_trait = content
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.100.c

		current_travel_plan ?= {
			add_destination_progress = { days = 3 }
		}

		stress_impact = {
			diligent = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = diligent
			}
		}
	}

	after = {
		mp_resume_travel_plan = yes
	}
}

scripted_effect bp3_skill_learning_duel_effect = {
	root = {
		duel = {
			skill = $SKILL$
			value = 15
			60 = {
				desc = bp3_skill_travel_skill_learn_win
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -59
				}
				send_interface_message = {
					type = event_generic_good
					title = bp3_skill_travel_skill_learn_win

					left_icon = root
					right_icon = scope:lifestyle_character

					add_trait = $TRAIT$
				}
			}
			40 = {
				desc = bp3_skill_travel_skill_learn_fail
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -39
				}
				send_interface_message = {
					type = event_generic_bad
					title = bp3_skill_travel_skill_learn_fail

					left_icon = root
					right_icon = scope:lifestyle_character

					stress_impact = {
						base = minor_stress_gain
					}
				}
			}
		}
	}
}

scripted_trigger bp3_lifestyle_trait_trigger = {
	OR = {
		has_trait = lifestyle_reveler
		has_trait = lifestyle_blademaster
		has_trait = lifestyle_hunter
		has_trait = lifestyle_mystic
		has_trait = lifestyle_physician
		has_trait = lifestyle_herbalist
		has_trait = lifestyle_gardener
	}
}

travel_events_bp3.105 = { # A Woman/Man of Unusual Skills
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.105.t
	desc = {
		desc = travel_events_bp3.105.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:lifestyle_character = { has_trait = lifestyle_reveler }
				}
				desc = travel_events_bp3.105.desc.reveler
			}
			triggered_desc = {
				trigger = {
					scope:lifestyle_character = { has_trait = lifestyle_blademaster }
				}
				desc = travel_events_bp3.105.desc.blademaster
			}
			triggered_desc = {
				trigger = {
					scope:lifestyle_character = { has_trait = lifestyle_hunter }
				}
				desc = travel_events_bp3.105.desc.hunter
			}
			triggered_desc = {
				trigger = {
					scope:lifestyle_character = { has_trait = lifestyle_mystic }
				}
				desc = travel_events_bp3.105.desc.mystic
			}
			triggered_desc = {
				trigger = {
					scope:lifestyle_character = { has_trait = lifestyle_physician }
				}
				desc = travel_events_bp3.105.desc.physician
			}
			triggered_desc = {
				trigger = {
					scope:lifestyle_character = { has_trait = lifestyle_herbalist }
				}
				desc = travel_events_bp3.105.desc.herbalist
			}
			triggered_desc = {
				trigger = {
					scope:lifestyle_character = { has_trait = lifestyle_gardener }
				}
				desc = travel_events_bp3.105.desc.gardener
			}
		}
	}

	theme = travel

	override_background = {
		trigger = {
			scope:lifestyle_character = { has_trait = lifestyle_reveler }
		}
		reference = ep3_campfire
	}

	override_background = {
		trigger = {
			scope:lifestyle_character = { has_trait = lifestyle_blademaster }
		}
		reference = ep3_campfire
	}

	override_background = {
		trigger = {
			scope:lifestyle_character = { has_trait = lifestyle_hunter }
		}
		reference = terrain_travel
	}

	override_background = {
		trigger = {
			scope:lifestyle_character = { has_trait = lifestyle_mystic }
		}
		reference = terrain_travel
	}

	override_background = {
		trigger = {
			scope:lifestyle_character = { has_trait = lifestyle_physician }
		}
		reference = market
	}

	override_background = {
		trigger = {
			scope:lifestyle_character = { has_trait = lifestyle_herbalist }
		}
		reference = terrain_travel
	}

	override_background = {
		trigger = {
			scope:lifestyle_character = { has_trait = lifestyle_gardener }
		}
		reference = garden
	}

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:lifestyle_character
		triggered_animation = {
			trigger = {
				scope:lifestyle_character = { has_trait = lifestyle_reveler }
			}
			animation = toast
		}

		triggered_animation = {
			trigger = {
				scope:lifestyle_character = { has_trait = lifestyle_blademaster }
			}
			animation = inspect_weapon
		}

		triggered_animation = {
			trigger = {
				scope:lifestyle_character = { has_trait = lifestyle_hunter }
			}
			animation = bow_idle
		}

		triggered_animation = {
			trigger = {
				scope:lifestyle_character = { has_trait = lifestyle_mystic }
			}
			animation = happy_teacher
		}

		triggered_animation = {
			trigger = {
				scope:lifestyle_character = { has_trait = lifestyle_physician }
			}
			animation = physician
		}

		triggered_animation = {
			trigger = {
				scope:lifestyle_character = { has_trait = lifestyle_herbalist }
			}
			animation = storyteller
		}

		triggered_animation = {
			trigger = {
				scope:lifestyle_character = { has_trait = lifestyle_gardener }
			}
			animation = survey
		}
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.105
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		bp3_lifestyle_trait_trigger = no
		current_travel_plan = {
			any_entourage_character = {
				bp3_lifestyle_trait_trigger = yes
			}
		}
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }

		current_travel_plan = {
			random_entourage_character = {
				limit = {
					bp3_lifestyle_trait_trigger = yes
				}
				save_scope_as = lifestyle_character
			}
		}
	}

	option = {
		name = {
			trigger = {
				scope:lifestyle_character = { has_trait = lifestyle_reveler }
			}
			text = travel_events_bp3.105.a.reveler
		}
		name = {
			trigger = {
				scope:lifestyle_character = { has_trait = lifestyle_blademaster }
			}
			text = travel_events_bp3.105.a.blademaster
		}
		name = {
			trigger = {
				scope:lifestyle_character = { has_trait = lifestyle_hunter }
			}
			text = travel_events_bp3.105.a.hunter
		}
		name = {
			trigger = {
				scope:lifestyle_character = { has_trait = lifestyle_mystic }
			}
			text = travel_events_bp3.105.a.mystic
		}
		name = {
			trigger = {
				scope:lifestyle_character = { has_trait = lifestyle_physician }
			}
			text = travel_events_bp3.105.a.physician
		}
		name = {
			trigger = {
				scope:lifestyle_character = { has_trait = lifestyle_herbalist }
			}
			text = travel_events_bp3.105.a.herbalist
		}
		name = {
			trigger = {
				scope:lifestyle_character = { has_trait = lifestyle_gardener }
			}
			text = travel_events_bp3.105.a.gardener
		}

		scope:lifestyle_character = {
			switch = {
				trigger = has_trait
				lifestyle_reveler = {
					bp3_skill_learning_duel_effect = {
						TRAIT = lifestyle_reveler
						SKILL = diplomacy
					}
					root = {
						stress_impact = {
							drunkard = minor_stress_impact_loss
							content = minor_stress_impact_loss
							gregarious = minor_stress_impact_loss
						}
					}
				}
				lifestyle_blademaster = {
					bp3_skill_learning_duel_effect = {
						TRAIT = lifestyle_blademaster
						SKILL = prowess
					}
					root = {
						stress_impact = {
							brave = minor_stress_impact_loss
							diligent = minor_stress_impact_loss
							ambitious = minor_stress_impact_loss
						}
					}
				}
				lifestyle_hunter = {
					bp3_skill_learning_duel_effect = {
						TRAIT = lifestyle_hunter
						SKILL = prowess
					}
					root = {
						stress_impact = {
							brave = minor_stress_impact_loss
							greedy = minor_stress_impact_loss
							ambitious = minor_stress_impact_loss
						}
					}
				}
				lifestyle_mystic = {
					bp3_skill_learning_duel_effect = {
						TRAIT = lifestyle_mystic
						SKILL = learning
					}
					root = {
						stress_impact = {
							patient = minor_stress_impact_loss
							eccentric = minor_stress_impact_loss
							cynical = minor_stress_impact_loss
						}
					}
				}
				lifestyle_physician = {
					bp3_skill_learning_duel_effect = {
						TRAIT = lifestyle_physician
						SKILL = learning
					}
					root = {
						stress_impact = {
							patient = minor_stress_impact_loss
							compassionate = minor_stress_impact_loss
							humble = minor_stress_impact_loss
						}
					}
				}
				lifestyle_herbalist = {
					bp3_skill_learning_duel_effect = {
						TRAIT = lifestyle_herbalist
						SKILL = learning
					}
					root = {
						stress_impact = {
							patient = minor_stress_impact_loss
							calm = minor_stress_impact_loss
							content = minor_stress_impact_loss
						}
					}
				}
				lifestyle_gardener = {
					bp3_skill_learning_duel_effect = {
						TRAIT = lifestyle_gardener
						SKILL = stewardship
					}
					root = {
						stress_impact = {
							patient = minor_stress_impact_loss
							calm = minor_stress_impact_loss
							diligent = minor_stress_impact_loss
						}
					}
				}
			}
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 5
				scope:lifestyle_character = {
					switch = {
						trigger = has_trait
						lifestyle_reveler = {
							root = {
								OR = {
									has_trait = drunkard
									has_trait = content
									has_trait = gregarious
								}
							}
						}
						lifestyle_blademaster = {
							root = {
								OR = {
									has_trait = brave
									has_trait = diligent
									has_trait = ambitious
								}
							}
						}
						lifestyle_hunter = {
							root = {
								OR = {
									has_trait = brave
									has_trait = greedy
									has_trait = ambitious
								}
							}
						}
						lifestyle_mystic = {
							root = {
								OR = {
									has_trait = patient
									has_trait = eccentric
									has_trait = cynical
								}
							}
						}
						lifestyle_physician = {
							root = {
								OR = {
									has_trait = patient
									has_trait = compassionate
									has_trait = humble
								}
							}
						}
						lifestyle_herbalist = {
							root = {
								OR = {
									has_trait = patient
									has_trait = calm
									has_trait = content
								}
							}
						}
						lifestyle_gardener = {
							root = {
								OR = {
									has_trait = patient
									has_trait = calm
									has_trait = diligent
								}
							}
						}
					}
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.105.b

		scope:lifestyle_character = {
			add_opinion = {
				modifier = friendliness_opinion
				target = root
				opinion = 15
			}
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		mp_resume_travel_plan = yes
	}
}

travel_events_bp3.110 = { # Heart-to-Heart
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.110.t
	desc = {
		desc = travel_events_bp3.110.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:negative_memory
				}
				desc = travel_events_bp3.110.desc.negative_memory
			}
			desc = travel_events_bp3.110.desc.fallback
		}
		desc = travel_events_bp3.110.desc.outro
	}

	theme = travel

	override_background = { reference = ep3_campfire }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = stress
	}

	right_portrait = {
		character = scope:friend_character
		animation = thinking
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.110
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		stress >= 50
		NOR = {
			has_trait = paranoid
			has_trait = shy
		}
		current_travel_plan = {
			any_entourage_character = {
				is_adult = yes
				bp3_good_relations_trigger = yes
			}
		}
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
		current_travel_plan = {
			random_entourage_character = {
				limit = {
					is_adult = yes
					bp3_good_relations_trigger = yes
				}
				save_scope_as = friend_character
			}
		}
		random_memory = {
			limit = {
				has_memory_category = negative
			}
			save_scope_as = negative_memory
		}
	}

	option = {
		name = travel_events_bp3.110.a
		flavor = travel_events_bp3.110.a.flavor

		progress_towards_friend_effect = {
			REASON = friend_opened_up
			CHARACTER = scope:friend_character
			OPINION = default_friend_opinion
		}

		stress_impact = {
			base = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				OR = {
					has_trait = gregarious
					has_trait = compassionate
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.110.b
		flavor = travel_events_bp3.110.b.flavor

		stress_impact = {
			base = major_stress_impact_loss
		}

		ai_chance = {
			base = 200
			modifier = {
				factor = 5
				has_trait = arrogant
			}
		}
	}

	after = {
		mp_resume_travel_plan = yes
	}
}

scripted_effect travel_entourage_bp3_effect = {
	if = {
		limit = {
			exists = var:saved_character_number
		}
		switch = {
			trigger = var:saved_character_number
			1 = { prev = { save_scope_as = character_number_1 } }
			2 = { prev = { save_scope_as = character_number_2 } }
			3 = { prev = { save_scope_as = character_number_3 } }
		}
		change_variable = { name = saved_character_number add = 1 }
	}
}

scripted_effect campfire_friendliness_effect = {
	scope:character_number_1 ?= {
		add_opinion = {
			modifier = friendliness_opinion
			target = root
			opinion = $VALUE$
		}
	}
	scope:character_number_2 ?= {
		add_opinion = {
			modifier = friendliness_opinion
			target = root
			opinion = $VALUE$
		}
	}
	scope:character_number_3 ?= {
		add_opinion = {
			modifier = friendliness_opinion
			target = root
			opinion = $VALUE$
		}
	}
}

scripted_trigger travel_bp3_relevant_character_trigger = {
	likes_character_trigger = { CHARACTER = root }
	is_adult = yes
	OR = {
		is_knight_of = root
		is_councillor_of = root
		has_any_court_position = yes
		is_spouse_of = root
		is_close_family_of = root
		has_important_relationship_with_character_trigger = { CHARACTER = root }
	}
}

travel_events_bp3.115 = { # Night by the Campfire
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.115.t
	desc = {
		desc = travel_events_bp3.115.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:character_number_3
				}
				desc = travel_events_bp3.115.desc.3_characters
			}
			triggered_desc = {
				trigger = {
					exists = scope:character_number_2
				}
				desc = travel_events_bp3.115.desc.2_characters
			}
			desc = travel_events_bp3.115.desc.1_character
		}
		desc = travel_events_bp3.115.desc.outro
	}

	theme = travel

	override_background = { reference = ep3_campfire }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = laugh
	}

	right_portrait = {
		character = scope:character_number_1
		animation = storyteller
	}

	lower_left_portrait = scope:character_number_2
	lower_right_portrait = scope:character_number_3

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.115
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		current_travel_plan = {
			any_entourage_character = {
				count >= 1
				travel_bp3_relevant_character_trigger = yes
			}
		}
	}

	immediate = {
		set_variable = {
			name = saved_character_number
			value = 1
		}
		mp_delay_travel_plan = { DAYS = 90 }
		current_travel_plan = {
			ordered_entourage_character = {
				order_by = {
					value = "opinion(root)"
					if = {
						limit = {
							is_knight_of = root
						}
						subtract = 50
					}
					if = {
						limit = {
							OR = {
								is_spouse_of = root
								is_close_family_of = root
							}
						}
						add = 25
					}
				}
				limit = { travel_bp3_relevant_character_trigger = yes }
				max = 3
				check_range_bounds = no
				root = { travel_entourage_bp3_effect = yes }
			}
		}
	}

	option = {
		name = travel_events_bp3.115.a

		campfire_friendliness_effect = { VALUE = 5 }

		stress_impact = {
			gregarious = minor_stress_impact_loss
			honest = minor_stress_impact_loss
			shy = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				OR = {
					has_trait = gregarious
					has_trait = honest
				}
			}
			modifier = {
				factor = 0
				has_trait = shy
			}
		}
	}

	option = {
		name = travel_events_bp3.115.b

		duel = {
			skills = { diplomacy intrigue }
			value = 20
			50 = {
				desc = travel_events_bp3.115.b.impressed
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1.5
					min = -49
				}
				send_interface_toast = {
					type = event_generic_bad
					title = travel_events_bp3.115.b.impressed
					left_icon = root
					right_icon = scope:character_number_1

					campfire_friendliness_effect = { VALUE = 15 }
				}
			}
			50 = {
				desc = travel_events_bp3.115.b.unimpressed
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1.5
					min = -49
				}
				send_interface_toast = {
					type = event_generic_bad
					title = travel_events_bp3.115.b.unimpressed
					left_icon = root
					right_icon = scope:character_number_1

					campfire_friendliness_effect = { VALUE = 2 }
				}
			}
		}

		stress_impact = {
			deceitful = minor_stress_impact_loss
			honest = minor_stress_gain
			shy = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = deceitful
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = shy
					has_trait = honest
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.115.c

		progress_towards_friend_effect = {
			REASON = friend_story_by_fire_corresponding
			CHARACTER = scope:character_number_1
			OPINION = default_friend_opinion
		}

		stress_impact = {
			base = minor_stress_impact_loss
		}

		ai_chance = {
			base = 300
		}
	}

	after = {
		mp_resume_travel_plan = yes
		remove_variable = saved_character_number
	}
}

travel_events_bp3.120 = { # The Wrecked Boat
	type = character_event
	content_source = dlc_015
	title = travel_events_bp3.120.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					location = { is_coastal = yes }
				}
				desc = travel_events_bp3.120.desc.intro.coast
			}
			desc = travel_events_bp3.120.desc.intro.river
		}
		desc = travel_events_bp3.120.desc
	}

	theme = travel

	override_background = { 
		trigger = {
			location = { is_coastal = yes }
		}
		reference = bp3_coast
	}

	override_background = {
		reference = bp3_riverside
	}

	cooldown = { years = 20 }

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:merchant_character
		animation = severelywounded
	}

	trigger = {
		static_group_filter = {
			group = travel_events_bp3.120
			match = 0.50
		}
		bp3_travel_event_default_trigger = yes
		location = { is_riverside_province = yes }
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
		create_character = {
			template = merchant_template
			location = root.location
			faith = root.location.faith
			culture = root.location.culture

			after_creation = {
				add_gold = {
					integer_range = { 
						min = root.minor_gold_value 
						max = root.medium_gold_value 
					}
				}
			}

			save_scope_as = merchant_character
		}
		location = {
			random_neighboring_province = {
				limit = {
					is_river_province = yes
				}
				save_scope_as = river_province
			}
		}
	}

	option = {
		name = travel_events_bp3.120.a

		stress_impact = {
			base = minor_stress_impact_loss
			compassionate = medium_stress_impact_loss
			generous = minor_stress_impact_loss
		}

		current_travel_plan ?= { delay_travel_plan = { days = 5 } }

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				OR = {
					has_trait = compassionate
					has_trait = generous
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.120.b

		scope:merchant_character = {
			pay_short_term_gold = {
				target = root
				gold = {
					value = scope:merchant_character.gold
					divide = 2
				}
			}	
		}

		current_travel_plan ?= { delay_travel_plan = { days = 5 } }

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = greedy
			}
		}
	}

	option = {
		name = travel_events_bp3.120.c
		trigger = {
			OR = {
				has_trait = callous
				has_trait = sadistic
			}
		}

		add_dread = minor_dread_gain
		add_gold = scope:merchant_character.gold

		scope:merchant_character = {
			death = {
				death_reason = death_murder
				killer = root
			}
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 5 
				OR = {
					has_trait = callous
					has_trait = sadistic
				}
			}
		}
	}

	option = {
		name = travel_events_bp3.120.d

		current_travel_plan ?= { add_destination_progress = { days = 3 } }

		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				OR = {
					has_trait = diligent
					has_trait = ambitious
				}
			}
		}
	}

	after = {
		mp_resume_travel_plan = yes
		scope:merchant_character = { silent_disappearance_ai_effect = yes }
	}
}
