# Events for Pilgrimages

namespace = pilgrimage

################################################################################################################################
## Pilgrimage Activity System Events
## 0040-0100
## by Filippa Gannholm Kirsten
################################
# pilgrimage.0040 - Invalidation
# pilgrimage.0042 - Invalidation because you bury old host back home
# pilgrimage.0500 - Promise your dying religious relative to go on a Pilgrimage
#
############################
## Generic Journey Events
## 1001-2100 + 6001-6010
## by Petter Vilberg & Filippa Gannholm Kirsten & Joe Parkin
############################
# pilgrimage.1100 - Sea: Saint Elmo's Fire
# pilgrimage.1110 - Heathen Raiders
# pilgrimage.1120 - Tour Church
# pilgrimage.1130 - Roadside Shrine
# pilgrimage.1140 - Strength in Numbers
# pilgrimage.2002 - Heathen-hating adherent challenges you
# pilgrimage.2003 - Hire more guards?
# pilgrimage.2004 - Run into a potential friend
# pilgrimage.2005 - A peasant inadvertedly insults you
# pilgrimage.2006 - Your pilgrimage is taking a little detour 
# pilgrimage.2008 - Fall ill
# pilgrimage.2009 - Develop pneumonia
# pilgrimage.2010-5 - Meet a Mystic
# pilgrimage.2020-21 - Pilgrimage thieves
# pilgrimage.2030 - Sea: Massive rainbow
# pilgrimage.2040 - Sea: Go fish
# pilgrimage.2050 - Sea: Shipwrecked pilgrims
#
############################
## 'Temptation' Events
## 2101-2999
## by Bianca Savazzi & Sean Hughes
############################
# pilgrimage.2101 - Rakish or Lustful character considers making a pit stop, or perhaps, a detour to the local brothels
# pilgrimage.2501-4 - Persistent Beggar
# pilgrimage.2511 - Cocky Lordling
#
################################
# Religion-specific Journey Events
# 3001-3999
# by Sean Hughes
################################
## 3001-3100: Christianity
# pilgrimage.3001 - Zealous priest giving sermon in freezing rains
# pilgrimage.3002-3 - Naked preacher claiming to have reclaimed the lost innocence of Adam & Eve
# pilgrimage.3004 - Doomsayer claiming the end is nigh!
#
## 3101-3200: Islam
# pilgrimage.3102 - Ziyarat - Why am I taking this pilgrimage?
#
## 3201-3300: Hinduism
# pilgrimage.3201 - Ritual purification in a river
# pilgrimage.3202 - Contemplating the universe
#
## 3301-3400: Buddhism
# pilgrimage.3301 - Critical Wanderer
# pilgrimage.3302 - The Wisdom of Goats
# pilgrimage.3303 - Kalama Sutta
#
## 3401-3500: Dharmic
# pilgrimage.3401 - Brahmacharya Challenged
#
############################
## DLC Events
## by Chad Uhl
############################
## 6001-6010: BP1
# pilgrimage.6001-4 - Sneaking off to a tavern with your pal
# pilgrimage.6005 - You find out your friend is a Non-Believer
# pilgrimage.6006 - You and a friend are on a pilgrimage and your friend is healed in a miracle performed by a wandering priest
#
################################
# Hajj Arrival Event
# 3101
################################
# pilgrimage.3101 - Entering state of Ihram
#
################################
## Generic Arrival Events
## 4001-4999
## by Petter Vilberg
################################
# pilgrimage.4001 - Generic Destination
# pilgrimage.4002 - The Mystic you met on your journey is there!
# pilgrimage.4010 - Obligatory Pilgrimage - Skip Destination Event
# pilgrimage.4020 - Bury old host at Destination
#
################################
## Holy Site-specific destination arrival events
## 5001-5999
## by Sean Hughes
################################
## Christian
# pilgrimage.5001 - Rome
# pilgrimage.5011 - Jerusalem
# pilgrimage.5021 - Constantinople
# pilgrimage.5031 - Alexandria
#
## Jewish
# pilgrimage.5101 - Mount Sinai
#
## Muslim
# pilgrimage.5201 - Medina
#
## Hindu
# pilgrimage.5301 - Varanasi
# pilgrimage.5311 - Ayodhya
# pilgrimage.5321 - Mathura
# pilgrimage.5331 - Haridwar
# pilgrimage.5341 - Kanchipuram
# pilgrimage.5351 - Ujjayini
# pilgrimage.5361 - Dwarka
#
## Buddhism
# pilgrimage.5401 - Bodh Gaya
# pilgrimage.5411 - Kushinagar
# pilgrimage.5421 - Sarnath
#
## Jainism
# pilgrimage.5501 - Shikharj
#
## Zoroastrian
# pilgrimage.5601 - Ushi-darena
#
## Norse Germanic
# pilgrimage.5901 - Paderborn
#
## Tengri
# pilgrimage.5911 - Open Blue Skies
#
## Sanctity of Nature
# pilgrimage.5921 - Sacred Groves
#
################################
## Remaining at a Holy Site events
## 6500-6999
## by Filippa Gannholm Kirsten & Veronica Pazos
################################
# pilgrimage.6500 - Appreciation
# pilgrimage.6510 - Lost in Translation
# pilgrimage.6520 - Time To Go Home Soon?
# pilgrimage.6530-5 - Fishy local guide?
# pilgrimage.6540 - Find some exotic wares
# pilgrimage.6750 - Repent - remove secret/coping trait
# pilgrimage.6760 - Theological debate with facts and logic
# pilgrimage.6770 - Do you wanna buy some cheeky relic?
# pilgrimage.6780 - Recruit skillful courtier
# pilgrimage.6790 - Meet local guru - trait flipping event
# pilgrimage.6800 - Entourage member feels The Calling
# pilgrimage.6810 - Do you wanna buy an indulgence?
# pilgrimage.6820 - Do you wanna buy a pilgrim's guide? - based in the Codex Calixtinus
# pilgrimage.6830 - Admire the holy site in a religious way
# pilgrimage.6840 - Ask a local priest to bless your artifact
# pilgrimage.6850 - A Master Thief
################################
## Conclusion events
## 7000-7499
## by Filippa Gannholm Kirsten
################################
# pilgrimage.7000 - Summarizing our activity
#
################################
## Return Events
## 9001-9999
## by Petter Vilberg & Filippa Gannholm Kirsten
################################
# pilgrimage.9001 - Nice spiritual journey
# pilgrimage.9010 - Bury old host back home
# pilgrimage.9100 - Follow-up to exotic wares event
#


################################################################################################################################
## Pilgrimage Activity System Events
# 0040-0100
## by Filippa Gannholm Kirsten
################################
# pilgrimage.0040 - Invalidation
# pilgrimage.0042 - Invalidation because you bury old host back home
# pilgrimage.0500 - Promise your religious relative to go on a Pilgrimage
#

#Invalidation
pilgrimage.0040 = {
	type = character_event
	title = pilgrimage.0040.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { has_variable = moved_capital_to_holy_site }
				desc = pilgrimage.0040.desc_moved_capital
			}
			desc = pilgrimage.0040.desc
		}
	}
	theme = travel_pilgrimage
	override_background = {
		trigger = { is_imprisoned = yes }
		reference = dungeon
	}
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = moved_capital_to_holy_site }
			animation = thinking
		}
		animation = sadness
	}
	immediate = {
		#If our inherited Pilgrimage invalidated, remove the indicator modifier and bury them at home
		if = {
			limit = { has_character_modifier = pilgrimage_burial_at_destination_modifier }
			remove_character_modifier = pilgrimage_burial_at_destination_modifier
			add_character_flag = pilgrimage_burial_interrupted_pilgrimage
		}
		else = {
			add_character_flag = pilgrimage_invalidated
		}
	}
	option = {
		name = {
			trigger = { has_variable = moved_capital_to_holy_site }
			text = pilgrimage.0040.a_moved_capital
		}
		name = pilgrimage.0040.a
	}
	after = {
		remove_character_flag = pilgrim_group_joined
		#Bury the old host
		if = {
			limit = { has_character_modifier = pilgrimage_burial_at_capital_modifier }
			#Trigger burial
			trigger_event = {
				id = pilgrimage.9010
				days = 5
			}
		}
		#Our capital was moved to the holy site
		if = {
			limit = { exists = var:moved_capital_to_holy_site }
			remove_variable = moved_capital_to_holy_site
		}
	}
}

#Invalidation because you bury old host back home
pilgrimage.0042 = {
	type = character_event
	title = pilgrimage.0042.t
	desc = pilgrimage.0042.desc
	theme = travel_pilgrimage
	override_background = { reference = army_camp }
	left_portrait = {
		character = root
		animation = sadness
	}
	lower_left_portrait = {
		character = scope:old_pilgrimage_host
	}
	immediate = {
		if = {
			limit = { exists = var:old_host_to_be_buried }
			var:old_host_to_be_buried = { save_scope_as = old_pilgrimage_host }
		}
	}
	option = { 
		name = pilgrimage.0042.a
		#Trigger burial
		trigger_event = {
			id = pilgrimage.9010
			days = 5
		}
	}
}

scripted_trigger pilgrimage_0500_valid_holy_site_trigger = {
	#... we really shouldn't talk about the holy site we might be _in_ right now / invalid capital_province holy site
	NOR = { 
		this = root.location.barony
		AND = {
			exists = capital_province
			this = capital_province.barony
		}
	}
}

#Promise your dying religious relative to go on a Pilgrimage
pilgrimage.0500 = {
	type = character_event
	title = pilgrimage.0500.t
	desc = pilgrimage.0500.desc
	theme = death
	override_background = { reference = bedchamber }
	left_portrait = {
		character = root
		animation = worry
	}
	right_portrait = {
		character = scope:pilgrimage_dying_relative
		animation = sick
	}
	cooldown = { years = 10 }
	trigger = {
		any_close_family_member = {
			OR = {
				has_any_good_relationship_with_character_trigger = { CHARACTER = root }
				has_any_best_good_relationship_with_character_trigger = { CHARACTER = root }
				opinion = {
					target = root
					value >= 40
				}
			}
			OR = {
				health <= death_chance_dying_health
				has_trait = incapable
				has_trait = infirm
			}
			OR = {
				AND = {
					has_trait = zealous
					NOT = {
						any_secret = { type = secret_non_believer }
					}
				}
				ai_zeal >= 50
			}
			is_adult = yes
			faith = root.faith
			has_trait = pilgrim
		}
		is_available_healthy_adult = yes
		#Forbidden from pilgrimages? No pilgrimage for you!
		faith = {
			NOT = { has_doctrine_parameter = forbidden_from_pilgrimage }
			any_holy_site = { 
				pilgrimage_0500_valid_holy_site_trigger = yes
				save_temporary_scope_as = holy_site_check
			}
			any_holy_site = { 
				pilgrimage_0500_valid_holy_site_trigger = yes
				this != scope:holy_site_check
			}	
		}
		#This really should take care of most Hajj/Pilgrim-related trigger checks - if you don't have this trait, you haven't been pilgrimming before
		NOR = { 
			has_trait = pilgrim
			has_trait = hajjaj
		}
		#Only one modifier for _you_
		NOR = {
			has_character_modifier = ghost_pilgrimage_promised_modifier
			has_character_modifier = hajj_promised_modifier
			has_character_modifier = pilgrimage_promised_modifier
		}
	}
	immediate = {
		random_close_family_member = {
			limit = {
				OR = {
					has_any_good_relationship_with_character_trigger = { CHARACTER = root }
					has_any_best_good_relationship_with_character_trigger = { CHARACTER = root }
				}
				OR = {
					health <= death_chance_dying_health
					has_trait = incapable
					has_trait = infirm
				}
				is_adult = yes
				faith = root.faith
				has_trait = pilgrim
			}
			save_scope_as = pilgrimage_dying_relative
		}
		scope:pilgrimage_dying_relative = {
			if = {
				limit = {
					NOT = { has_character_flag = use_sickness_clothes }
				}
				add_character_flag = use_sickness_clothes
			}
		}
		#Some loc flavor
		faith = {
			random_holy_site = { 
				limit = { pilgrimage_0500_valid_holy_site_trigger = yes }
				save_scope_as = first_holy_site 
			}
			random_holy_site = {
				limit = {
					pilgrimage_0500_valid_holy_site_trigger = yes
					this != scope:first_holy_site
				}
				save_scope_as = second_holy_site
			}
		}
	}
	#Hajj it is
	option = {
		name = pilgrimage.0500.a
		scope:pilgrimage_dying_relative = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 15
			}
		}
		custom_tooltip = {
			text = pilgrimage.0500.a.tt_pilgrimage
			add_character_modifier = pilgrimage_promised_modifier
		}
		add_piety = miniscule_piety_gain
		stress_impact = {
			cynical = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = cynical
				factor = 0
			}
		}
	}
	#Erm... no.
	option = {
		name = pilgrimage.0500.b
		scope:pilgrimage_dying_relative = {
			add_opinion = {
				target = root
				modifier = disappointed_opinion
				opinion = -5
			}
		}
		stress_impact = {
			sadistic = medium_stress_impact_loss
			callous = minor_stress_impact_loss
			compassionate = major_stress_impact_gain
			zealous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = compassionate
					has_trait = zealous
				}
				factor = 0
			}
		}
	}
	after = {
		scope:pilgrimage_dying_relative ?= {
			if = {
				limit = {
					has_character_flag = use_sickness_clothes
				}
				remove_character_flag = use_sickness_clothes
			}
		}
	}
}

############################
## Generic Journey Events
# 1001-6100
## by Petter Vilberg & Filippa Gannholm Kirsten & Joe Parkin
############################
# pilgrimage.1100 - Sea: Saint Elmo's Fire
# pilgrimage.1110 - Heathen Raiders
# pilgrimage.1120 - Tour Church
# pilgrimage.1130 - Roadside Shrine
# pilgrimage.1140 - Strength in Numbers
# pilgrimage.2002 - Heathen-hating adherent challenges you
# pilgrimage.2003 - Hire more guards?
# pilgrimage.2004 - Run into a potential friend
# pilgrimage.2005 - A peasant inadvertedly insults you
# pilgrimage.2006 - Your pilgrimage is taking a little detour 
# pilgrimage.2008 - Fall ill
# pilgrimage.2009 - Develop pneumonia
# pilgrimage.2010-5 - Meet a Mystic
# pilgrimage.2020-21 - Pilgrimage thieves
# pilgrimage.2030 - Sea: Massive rainbow
# pilgrimage.2040 - Sea: Go fish
# pilgrimage.2050 - Sea: Shipwrecked pilgrims
#

scripted_effect pilgrimage_st_elmo_success_effect = {
	random_list = {
		7 = {
			show_chance = no
			desc = pilgrimage.1100.success
			modifier = { add = scope:duel_variety }
			send_interface_toast = {
				title = pilgrimage.1100.success
				current_travel_plan = {
					add_destination_progress = { days = 5 }
				}
			}
		}
		7 = {
			show_chance = no
			desc = pilgrimage.1100.failure
			modifier = {
				add = {
					value = 0
					subtract = scope:duel_variety
				}
			}
			send_interface_toast = {
				title = pilgrimage.1100.failure
				current_travel_plan = {
					delay_travel_plan = { days = 90 }
		        }
		    }
		}
	}
}

#Sea: Saint Elmo's Fire
# by Joe Parkin
pilgrimage.1100 = {
	type = character_event
	title = {
		desc = {
			first_valid = {
				triggered_desc = {
					trigger = {
						culture = {
							OR = {
								has_cultural_tradition = tradition_byzantine_succession
								has_cultural_tradition = tradition_ep3_roman_ceremonies
							}
						}
					}
					desc = pilgrimage.1100.t.greek
				}
				triggered_desc = {
					trigger = { OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion } }
					desc = pilgrimage.1100.t.christian
				}
				triggered_desc = {
					trigger = {
						faith = { has_doctrine = unreformed_faith_doctrine }
					}
					desc = pilgrimage.1100.t.pagan
				}
				desc = pilgrimage.1100.t
			}
		}
	}
	desc = {
		desc = pilgrimage.1100.desc
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:panicked_pilgrim }
				desc = pilgrimage.1100.companion
			}
			desc = pilgrimage.1100.alone
		}
	}
	theme = travel_pilgrimage
	override_background = { reference = terrain }
	right_portrait = {
		character = scope:panicked_pilgrim
		animation = fear
	}
	left_portrait = {
		character = root
		animation = shock
	}
	cooldown = { years = 10 }

	trigger = {
		is_travelling = yes
		location = {
			has_sea_danger_type = { TRAVEL = root.current_travel_plan }
		}
		current_travel_plan = {
			any_entourage_character = {
				count > 4
			}
			any_entourage_character = {
				NOR = {
					this = root
					has_trait = brave
					has_trait = zealous
				}
			}
		}
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
		current_travel_plan = {
			random_entourage_character = {
				limit = {
					NOR = {
						this = root
						has_trait = brave
						has_trait = zealous
					}
				}
				weight = {
					base = 1
					modifier = {
						has_trait = craven
						add = 10
					}
					modifier = {
						has_trait = cynical
						add = 10
					}
				}
				save_scope_as = panicked_pilgrim
			}
			random_entourage_character = {
				limit = {
					this != root
				}
				alternative_limit = { always = yes }
				save_scope_as = victim_pilgrim
			}
			random_entourage_character = {
				limit = {
					NOR = {
						this = root
						this = scope:victim_pilgrim
						is_spouse_of = root
						is_close_family_of = root
						is_landed = yes
					}
					is_lowborn = yes
				}
				alternative_limit = {
					NOR = {
						this = root
						this = scope:victim_pilgrim
						is_spouse_of = root
						is_close_family_of = root
						is_landed = yes
					}
				}
				alternative_limit = {
					NOR = {
						this = root
						this = scope:victim_pilgrim
					}					
				}
				alternative_limit = {
					this != root
				}
				save_scope_as = sacrifice_pilgrim
			}
		}
		save_scope_value_as = {
			name = duel_variety
			value = { 1 4 }
		}
	}

	option = { # Look, god guides our path
		name = pilgrimage.1100.a
		add_piety = minor_piety_gain
		scope:panicked_pilgrim = {
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -10
			}
		}
		if = {
			limit = { exists = scope:victim_pilgrim }
			random = {
				chance = 50	
				custom_tooltip = {
					text = pilgrimage_random_pilgrim_tt		
					send_interface_toast = {
						title = pilgrimage_fell_overboard_tt
						left_icon = scope:victim_pilgrim
						scope:victim_pilgrim = {
							death = { death_reason = death_drowned }
							every_close_family_member = {
								custom = every_family_member_tt
								limit = {
									this != root
								}
								add_opinion = {
									target = root
									modifier = accidentally_killed_family_opinion
									opinion = -15
								}
							}
						}
					}
				}
			}
		}		
		pious_type_option_effect = yes
		pilgrimage_st_elmo_success_effect = yes
		stress_impact = {
			craven = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
			fickle = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = 1
				ai_boldness = 1
			}
		}
	}

	option = { # Climb rigging
		name = pilgrimage.1100.b
		trigger = {
			OR = {
				has_trait = lunatic_1
				has_trait = lunatic_genetic
				has_trait = possessed_1
				has_trait = possessed_genetic
			}
		}
		flavor = pilgrimage.1100.b.flavor
		trait = lunatic_1
		trait = lunatic_genetic
		add_piety = medium_piety_gain
		duel = {
			skill = prowess
			value = medium_skill_rating
			50 = {
				modifier = { add = scope:duel_variety }
				modifier = {
					factor = 1.5
					has_trait = athletic
				}
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = 5
				}
				send_interface_toast = {
					title = pilgrimage.1100.b.success.t
					left_icon = root
					add_character_modifier = {
						modifier = pilgrimage_touched_divine_modifier
						years = 10
					}
				}
			}
			30 = {
				modifier = {
					factor = 1.5
					has_trait = wounded
				}
				modifier = {
					factor = 1.5
					has_trait = one_legged
				}
				modifier = {
					factor = 1.5
					has_trait = one_eyed
				}
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
					min = 5
				}
				send_interface_toast = {
					title = pilgrimage.1100.b.wounded.t
					left_icon = root
					change_trait_rank = {
						trait = wounded
						rank = 1
						max = 3
					}
				}
			}
			10 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = 5
				}
				death = { death_reason = death_drowned }
			}
		}
		pilgrimage_st_elmo_success_effect = yes
		stress_impact = {
			base = major_stress_impact_loss
			craven = medium_stress_impact_gain
			cynical = medium_stress_impact_gain
			fickle = minor_stress_impact_gain
		}
		ai_chance = {
			base = 25
			ai_value_modifier = {
				ai_rationality = -1
				ai_zeal = 0.5
			}
		}
	}

	option = { # Sacrifice
		name = pilgrimage.1100.c
		trigger = {
			faith = {
				OR = {
					has_doctrine = unreformed_faith_doctrine
					has_doctrine_parameter = gruesome_festivals_active
					has_doctrine_parameter = human_sacrifice_active
				}
			}
			exists = scope:sacrifice_pilgrim
		}
		flavor = pilgrimage.1100.c.flavor
		add_piety = medium_piety_gain
		scope:sacrifice_pilgrim = {
			death = { death_reason = death_drowned }
			every_close_family_member = {
				custom = every_family_member_tt
				add_opinion = {
					target = root
					modifier = executed_close_family
					opinion = -15
				}
			}
		}
		pilgrimage_st_elmo_success_effect = yes
		stress_impact = {
			compassionate = medium_stress_impact_gain
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 25
			ai_value_modifier = {
				ai_rationality = -1
				ai_zeal = 0.5
			}
		}
	}

	option = { # We must turn back!
		name = pilgrimage.1100.d
		scope:panicked_pilgrim = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 10
			}
		}
		current_travel_plan = {
			delay_travel_plan = { days = 90 }
        }
		stress_impact = {
			brave = minor_stress_impact_gain
			zealous = medium_stress_impact_gain
			stubborn = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = -0.5
				ai_boldness = -0.5
			}
		}
	}

	after = {
		mp_resume_travel_plan = yes
	}
}

scripted_trigger pilgrim_heathen_raider_trigger = {
	# Landless
	is_landed = no
	# No claims
	NOT = {
		any_claim = {}
	}
	# No house
	is_lowborn = yes
	# Faith is hostile to traveler's
	faith = {
		faith_hostility_level = {
			target = root.faith
			value > 1
		}
	}
	# Is martial gender for own culture/faith
	can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = this }
	# Is a military person of some sort
	OR = {
		number_of_commander_traits > 1
		has_trait = education_martial
	}
}

#Heathen Raiders
# by Joe Parkin
pilgrimage.1110 = {
	type = character_event
	title = pilgrimage.1110.t
	desc = {
		desc = pilgrimage.1110.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:shared_holy_site ?= {
						this = title:b_makka
						this = root.involved_activity.activity_location.barony
						county.county_controller.religion = scope:heathen_raider.religion
					}
				}
				desc = pilgrimage.1110.shared_target_heathen_hajj
			}
			triggered_desc = {
				trigger = {
					scope:shared_holy_site ?= {
						this = title:b_makka
						this = root.involved_activity.activity_location.barony
						county.county_controller.religion = root.religion
						county.county_controller.religion != scope:heathen_raider.religion
					}
				}
				desc = pilgrimage.1110.shared_target_controlled_hajj
			}
			triggered_desc = {
				trigger = {
					scope:shared_holy_site ?= {
						this = title:b_jerusalem
						this = root.involved_activity.activity_location.barony
						county.county_controller.religion = scope:heathen_raider.religion
					}
				}
				desc = pilgrimage.1110.shared_target_heathen_jerusalem
			}
			triggered_desc = {
				trigger = {
					scope:shared_holy_site ?= {
						this = title:b_jerusalem
						this = root.involved_activity.activity_location.barony
						county.county_controller.religion = root.religion
						county.county_controller.religion != scope:heathen_raider.religion
					}
				}
				desc = pilgrimage.1110.shared_target_controlled_jerusalem
			}
			triggered_desc = {
				trigger = {
					scope:shared_holy_site ?= {
						this = root.involved_activity.activity_location.barony
						county.county_controller.religion = scope:heathen_raider.religion
					}
				}
				desc = pilgrimage.1110.shared_target_heathen
			}
			triggered_desc = {
				trigger = {
					scope:shared_holy_site ?= {
						this = root.involved_activity.activity_location.barony
						county.county_controller.religion = root.religion
						county.county_controller.religion != scope:heathen_raider.religion
					}
				}
				desc = pilgrimage.1110.shared_target_controlled
			}
			desc = pilgrimage.1110.fallback
		}
	}
	theme = travel_pilgrimage
	override_background = { reference = terrain }
	right_portrait = {
		character = scope:heathen_raider
		animation = marshal
	}
	cooldown = { years = 1 }

	trigger = {
		is_travelling = yes
		is_location_valid_for_travel_event_on_land = yes
		location.county = {
			faith = {
				faith_hostility_level = { target = root.faith value > 1 }
			}
			holder = {
				NOR = {
					this = root
					any_liege_or_above = { this = root }
				}
			}
		}
		current_travel_plan = {
			any_entourage_character = {
				this != root
				count >= 2
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 0.5
			location.county.faith = { has_doctrine = tenet_dharmic_pacifism }
		}
	}

	immediate = {
		location.county = { save_scope_as = heathen_raider_county }
		location.county.holder.top_liege = { save_scope_as = county_liege }
		# Save or create a heathen raider
		random_list = {
			9 = {
				trigger = { # Does a valid heather raider exist in the county?
					any_pool_character = {
						province = root.location
						pilgrim_heathen_raider_trigger = yes
					}
				}
				random_pool_character = {
					province = root.location
					limit = { pilgrim_heathen_raider_trigger = yes }
					weight = {
						base = 1
						modifier = {
							add = 10
							has_trait = reaver
						}
					}
					save_scope_as = heathen_raider
					if = {
						limit = {
							location != root.location
						}
						hidden_effect = { move_to_pool_at = root.location }
					}
				}
			}
			1 = {
				create_character = {
					template = new_raider_character
					culture = root.location.culture
					faith = root.location.faith
					dynasty = none
					location = root.location
					gender_female_chance = scope:county_liege.root_soldier_female_chance
					save_scope_as = heathen_raider
				}
			}
		}
		scope:heathen_raider = {
			add_character_flag = wear_armor
		}
		# Save potential victim
		current_travel_plan = {
			random_entourage_character = {
				limit = {
					this != root
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
				}
				alternative_limit = {
					this != root
				}
				weight = {
					base = 1
					modifier = {
						factor = 2
						prowess < decent_skill_rating
					}
					modifier = {
						factor = 0
						has_trait = wounded
					}
				}
				save_scope_as = victim_pilgrim_1
			}
			if = {
				limit = { exists = scope:victim_pilgrim_1 }
				random_entourage_character = {
					limit = {
						NOR = {
							this = root
							this = scope:victim_pilgrim_1
						}
						can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
					}
					alternative_limit = {
						this != root
					}
					weight = {
						base = 1
						modifier = {
							factor = 2
							prowess < decent_skill_rating
						}
						modifier = {
							factor = 0
							has_trait = wounded
						}
					}
					save_scope_as = victim_pilgrim_2
				}
			}
		}
		# Does raider faith share the holy site?
		involved_activity.activity_location.barony = {
			if = {
				limit = { is_holy_site_of = scope:heathen_raider.faith }
				save_scope_as = shared_holy_site
			}
		}
		save_scope_value_as = {
			name = duel_variety
			value = { 1 4 }
		}
	}
	# Come on then
	option = { 
		name = pilgrimage.1110.a
		duel = {
			skill = martial
			target = scope:heathen_raider
			20 = {
				desc = pilgrimage.1110.a.fled
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
					min = 5
				}
				modifier = {
					add = {
						value = dread
						divide = 6
					}
				}
				modifier = {
					current_travel_plan = {	num_entourage_characters >= 15 }
					factor = 1.5
				}
				modifier = {
					current_travel_plan = {	
						num_entourage_characters < 15
						num_entourage_characters > 8 
					}
					factor = 1.3
				}
				modifier = {
					current_travel_plan = {	
						num_entourage_characters < 8
						num_entourage_characters > 4 
					}
					factor = 1.1
				}
				send_interface_toast = {
					title = pilgrimage.1110.a.fled
					left_icon = scope:heathen_raider
					add_dread = minor_dread_gain
					add_prestige = minor_prestige_gain
				}
			}
			20 = {
				desc = pilgrimage.1110.a.skirmish
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = 5
				}
				show_as_tooltip = { add_prestige = miniscule_prestige_gain }
				if = {
					limit = { exists = scope:victim_pilgrim_2 }
					custom_tooltip = two_entourage_members_wounded_tt
				}
				else = { custom_tooltip = one_entourage_members_wounded_tt }
				hidden_effect = {
					send_interface_toast = {
						title = pilgrimage.1110.a.skirmish
						left_icon = scope:victim_pilgrim_1
						right_icon = scope:victim_pilgrim_2
						add_prestige = miniscule_prestige_gain
						if = {
							limit = { exists = scope:victim_pilgrim_2 }
							scope:victim_pilgrim_2 = {
								random = {
									chance = 50
									modifier = {
										add = {
											value = 0
											subtract = prowess
										}
									}
									change_trait_rank = {
										trait = wounded
										rank = 1
										max = 3
									}
								}
							}
						}
						if = {
							limit = { exists = scope:victim_pilgrim_1 }
							scope:victim_pilgrim_1 = {
								random = {
									chance = 50
									modifier = {
										add = {
											value = 0
											subtract = prowess
										}
									}
									change_trait_rank = {
										trait = wounded
										rank = 1
										max = 3
									}
								}
							}
						}
						else = {
							random = {
								chance = 50
								modifier = {
									add = {
										value = 0
										subtract = prowess
									}
								}
								change_trait_rank = {
									trait = wounded
									rank = 1
									max = 3
								}
							}
						}
					}
				}
			}
			5 = {
				desc = pilgrimage.1110.a.beaten
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = 5
				}
				modifier = {
					current_travel_plan = {	num_entourage_characters >= 15 }
					factor = 0.5
				}
				modifier = {
					current_travel_plan = {	
						num_entourage_characters < 15
						num_entourage_characters > 8 
					}
					factor = 0.7
				}
				modifier = {
					current_travel_plan = {	
						num_entourage_characters < 8
						num_entourage_characters > 4 
					}
					factor = 0.9
				}
				show_as_tooltip = {
					add_prestige = minor_prestige_loss
					pay_short_term_gold = {
						target = scope:heathen_raider
						gold = {
							value = medium_gold_value
							max = 50
						}
					}
				}
				if = {
					limit = { exists = scope:victim_pilgrim_2 }
					custom_tooltip = two_entourage_members_die_tt
				}
				else = { custom_tooltip = one_entourage_members_die_tt }
				hidden_effect = {
					send_interface_toast = {
						title = pilgrimage.1110.a.beaten
						left_icon = scope:victim_pilgrim_1
						right_icon = scope:victim_pilgrim_2
						add_prestige = minor_prestige_loss
						pay_short_term_gold = {
							target = scope:heathen_raider
							gold = {
								value = medium_gold_value
								max = 50
							}
						}
						if = {
							limit = { exists = scope:victim_pilgrim_2 }
							scope:victim_pilgrim_2 = {
								random_list = {
									50 = {
										modifier = { add = prowess }
										change_trait_rank = {
											trait = wounded
											rank = 1
											max = 3
										}
									}
									50 = {
										death = { death_reason = death_pilgrimage_bandit_attack }
									}
								}
							}
						}
						if = {
							limit = { exists = scope:victim_pilgrim_1 }
							scope:victim_pilgrim_1 = {
								random_list = {
									50 = {
										modifier = { add = prowess }
										change_trait_rank = {
											trait = wounded
											rank = 1
											max = 3
										}
									}
									50 = {
										death = { death_reason = death_pilgrimage_bandit_attack }
									}
								}
							}
						}
						else = {
							random_list = {
								50 = {
									modifier = { add = prowess }
									change_trait_rank = {
										trait = wounded
										rank = 1
										max = 3
									}
								}
								50 = {
									death = { death_reason = death_pilgrimage_bandit_attack }
								}
							}
						}
					}
				}
			}
		}
		add_internal_flag = dangerous
		stress_impact = {
			craven = minor_stress_impact_gain
			patient = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = 0.5
				ai_boldness = 1
			}
		}
	}
	# Leave us in peace
	option = { 
		name = {
			trigger = { religion = scope:heathen_raider.religion }
			text = pilgrimage.1110.b.religion
		}
		name = {
			trigger = {
				NOT = {
					faith = { has_doctrine = unreformed_faith_doctrine }
				}
				scope:heathen_raider.faith = { has_doctrine = unreformed_faith_doctrine }
			}
			text = pilgrimage.1110.b.unreformed
		}
		name = {
			trigger = {
				religion != scope:heathen_raider.religion
				NAND = {
					NOT = {
						faith = { has_doctrine = unreformed_faith_doctrine }
					}
					scope:heathen_raider.faith = { has_doctrine = unreformed_faith_doctrine }
				}
			}
			text = pilgrimage.1110.b
		}
		duel = {
			skill = diplomacy
			target = scope:heathen_raider
			5 = {
				desc = pilgrimage.1110.c.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = 5
				}
				modifier = {
					has_perk = zealous_proselytizer_perk
					factor = 2
				}
				send_interface_toast = {
					title = pilgrimage.1110.c.success
					left_icon = scope:heathen_raider
					add_piety = minor_piety_gain
				}
			}
			5 = {
				desc = pilgrimage.1110.c.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = 5
				}
				send_interface_toast = {
					title = pilgrimage.1110.c.failure
					left_icon = scope:heathen_raider
					pay_short_term_gold = {
						target = scope:heathen_raider
						gold = {
							value = medium_gold_value
							max = 50
						}
					}
				}
			}
		}
		stress_impact = {
			wrathful = minor_stress_impact_gain
			zealous = minor_stress_impact_loss
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = 1
				ai_boldness = -0.5
			}
		}
	}
	# Join me, God is pretty cool
	option = { 
		name = pilgrimage.1110.c
		trigger = {
			OR = {
				AND = {
					NOT = {
						faith = { has_doctrine = unreformed_faith_doctrine }
					}
					scope:heathen_raider.faith = { has_doctrine = unreformed_faith_doctrine }
				}
				scope:heathen_raider.religion = root.religion
			}
		}
		duel = {
			skill = learning
			target = scope:heathen_raider
			10 = {
				desc = pilgrimage.1110.c.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = 5
				}
				modifier = {
					scope:heathen_raider = { has_trait = cynical }
					add = 5
				}
				send_interface_toast = {
					title = pilgrimage.1110.c.success
					left_icon = scope:heathen_raider
					scope:heathen_raider = {
						hidden_effect = { set_character_faith_with_conversion = root.faith }
						set_character_faith = root.faith
					}
					add_to_entourage_court_and_activity_effect = { 
						CHAR_TO_ADD = scope:heathen_raider 
						NEW_COURT_OWNER = root 
					}
					spawn_army = {
						name = event_troop_default_name
						levies = 250
						location = root.location
						origin = root.location
					}
				}
			}
			10 = {
				desc = pilgrimage.1110.c.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = 5
				}
				modifier = {
					scope:heathen_raider = { has_trait = zealous }
					add = 5
				}
				send_interface_toast = {
					title = pilgrimage.1110.c.failure
					left_icon = scope:heathen_raider
					add_prestige = minor_prestige_loss
					pay_short_term_gold = {
						target = scope:heathen_raider
						gold = {
							value = medium_gold_value
							max = 50
						}
					}
				}
			}
		}
		stress_impact = {
			cynical = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_sociability = 0.5
				ai_rationality = 0.5
			}
		}
	}

	option = { # Take your damned money
		name = pilgrimage.1110.d
		pay_short_term_gold = {
			target = scope:heathen_raider
			gold = {
				value = medium_gold_value
				max = 25
			}
		}
		stress_impact = {
			brave = medium_stress_impact_gain
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_greed = -1
				ai_rationality = 0.5
			}
		}
	}
	after = {
		scope:heathen_raider = {
			remove_character_flag = wear_armor
		}
	}
}

scripted_trigger pilgrim_admire_temple_person_trigger = {
	# Landless
	is_landed = no
	# No claims
	NOT = {
		any_claim = {}
	}
	# No house
	is_lowborn = yes
	# Faith is same as traveler's
	faith = root.location.faith
	# Is a priestly person of some sort
	OR = {
		has_trait = education_learning
		has_trait = devoted
		has_trait = theologian
		is_clergy = yes
	}
	trigger_if = {
		limit = {
			faith = { has_doctrine_parameter = clergy_must_be_male }
		}
		is_male = yes
	}
	trigger_if = {
		limit = {
			faith = { has_doctrine_parameter = clergy_must_be_female }
		}
		is_female = yes
	}
}

#Tour Church
# by Joe Parkin
pilgrimage.1120 = {
	type = character_event
	title = pilgrimage.1120.t
	desc = pilgrimage.1120.desc
	theme = travel_pilgrimage
	override_background = { reference = holy_site_generic }
	left_portrait = {
		character = scope:temple_person
		animation = chaplain
	}
	lower_right_portrait = scope:temple_liege
	cooldown = { years = 1 }

	trigger = {
		is_travelling = yes
		is_location_valid_for_travel_event_on_land = yes
		# Not at the target destination of the pilgrimage
		involved_activity.activity_location != root.location
		location = {
			has_holding_type = church_holding
			county = {
				development_level >= 5
				faith = {
					religion = root.religion
					faith_hostility_level = { target = root.faith value <= 1 }
				}
				holder = {
					NOR = {
						this = root
						any_liege_or_above = { this = root }
					}
				}
				save_temporary_scope_as = temple_faith
			}
		}
		faith = {
			faith_hostility_level = { target = scope:temple_faith.faith value <= 1 }
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			location.barony = { is_holy_site_of = root.faith }
			add = 10
		}
		modifier = {
			location = { has_special_building = yes }
			add = 10
		}
		modifier = {
			add = {
				value = location.county.development_level
				divide = 4
			}
		}
	}

	immediate = {
		location = { save_scope_as = temple_province }
		# Save or create a temple person
		random_list = {
			9 = {
				trigger = { # Does a valid temple person exist in the county?
					any_pool_character = {
						province = scope:temple_province
						pilgrim_admire_temple_person_trigger = yes
					}
				}
				random_pool_character = {
					province = scope:temple_province
					limit = { pilgrim_admire_temple_person_trigger = yes }
					weight = {
						base = 1
						modifier = {
							add = 10
							is_clergy = yes
						}
					}
					save_scope_as = temple_person
					if = {
						limit = {
							location != root.location
						}
						hidden_effect = { move_to_pool_at = root.location }
					}
				}
			}
			1 = {
				create_character = {
					template = priest_character_template
					culture = root.location.culture
					faith = root.location.faith
					dynasty = none
					location = root.location
					gender_female_chance = root_faith_clergy_gender_female_chance
					save_scope_as = temple_person
				}
			}
		}
		location.county.holder.top_liege = { save_scope_as = temple_liege }
		save_scope_value_as = {
			name = duel_variety
			value = { 1 4 }
		}
	}

	option = { # Architect insights
		name = pilgrimage.1120.a
		trigger = { has_trait = architect }
		trait = architect
		add_character_modifier = {
			modifier = pilgrimage_temple_architect_modifier
			years = 5
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = -0.5
				ai_energy = 1
			}
		}
	}

	option = { # Pray
		name = pilgrimage.1120.e
		add_piety = miniscule_piety_gain
		pious_type_option_effect = yes
		stress_impact = {
			cynical = minor_stress_impact_gain
			impatient = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = -0.5
				ai_sociability = 0.5
				ai_zeal = 1
			}
		}
	}

	option = { # Insult place
		name = pilgrimage.1120.c
		add_prestige = minor_prestige_gain
		reverse_add_opinion = {
			target = scope:temple_liege
			modifier = annoyed_opinion
			opinion = -10
		}
		stress_impact = {
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_sociability = -0.5
				ai_zeal = 0.5
			}
		}
	}

	option = { # Leave
		name = pilgrimage.1120.d
		stress_impact = {
			patient = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_sociability = -0.5
				ai_zeal = 0.5
			}
		}
	}
	after = {
		scope:temple_person = {
			silent_disappearance_ai_effect = yes
		}
	}
}

scripted_trigger pilgrimage_1130_pro_character_trigger = {
	faith = root.location.faith
	this != root
	age > 5
}

scripted_trigger pilgrimage_1130_anti_character_trigger = {
	faith != root.location.faith
	this != root
	age > 5
}

#Roadside Shrine
# by Joe Parkin
pilgrimage.1130 = {
	type = character_event
	title = pilgrimage.1130.t
	desc = {
		desc = pilgrimage.1130.desc
		first_valid = {
		    triggered_desc = {
		        trigger = {
		        	exists = scope:shrine_faithist
		        	exists = scope:shrine_mocker
		        }
		        desc = pilgrimage.1130.both
		    }
		    triggered_desc = {
		        trigger = { exists = scope:shrine_faithist }
		        desc = pilgrimage.1130.faithist
		    }
		    triggered_desc = {
		        trigger = { exists = scope:shrine_mocker }
		        desc = pilgrimage.1130.mocker
		    }
		}
	}
	theme = travel_pilgrimage
	override_background = { reference = terrain }
	left_portrait = {
		character = scope:shrine_faithist
		animation = throne_room_bow_1
	}
	right_portrait = {
		character = scope:shrine_mocker
		animation = eyeroll
	}
	cooldown = { years = 1 }

	trigger = {
		is_travelling = yes
		is_location_valid_for_travel_event_on_land = yes
		# Not at the target destination of the pilgrimage
		involved_activity.activity_location != root.location
		location = {
			county = {
				holder = {
					NOR = {
						this = root
						any_liege_or_above = { this = root }
					}
				}
				save_temporary_scope_as = temple_faith
			}
		}
		current_travel_plan = {
			OR = {
				any_entourage_character = { pilgrimage_1130_pro_character_trigger = yes }
				any_entourage_character = { pilgrimage_1130_anti_character_trigger = yes }
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = -0.75
			location.county.development_level >= 10
		}
	}

	immediate = {
		save_scope_as = shrine_visitor
		location = { save_scope_as = shrine_province }
		current_travel_plan = {
			# Save a shrine faithist
			if = {
				limit = {
					any_entourage_character = { pilgrimage_1130_pro_character_trigger = yes }
				}
				random_entourage_character = {
					limit = {
						pilgrimage_1130_pro_character_trigger = yes
						is_of_major_interest_to_root_trigger = yes
					}
					alternative_limit = {
						pilgrimage_1130_pro_character_trigger = yes
						is_of_minor_interest_to_root_trigger = yes
					}
					alternative_limit = { pilgrimage_1130_pro_character_trigger = yes }
					weight = {
						base = 1
						modifier = {
							has_trait = zealous
							add = 10
						}
						modifier = {
							has_trait = cynical
							factor = 0
						}
					}
					save_scope_as = shrine_faithist
				}
			}
			# Save a shrine mocker
			if = {
				limit = {
					any_entourage_character = { pilgrimage_1130_anti_character_trigger = yes }
				}
				random_entourage_character = {
					limit = {
						pilgrimage_1130_anti_character_trigger = yes
						is_of_major_interest_to_root_trigger = yes
					}
					limit = {
						pilgrimage_1130_anti_character_trigger = yes
						is_of_minor_interest_to_root_trigger = yes
					}
					alternative_limit = { pilgrimage_1130_anti_character_trigger = yes }
					weight = {
						base = 1
						modifier = {
							has_trait = arrogant
							add = 10
						}
						modifier = {
							has_trait = humble
							factor = 0
						}
					}
					save_scope_as = shrine_mocker
				}
			}
		}
		save_scope_value_as = {
			name = duel_variety
			value = { 1 4 }
		}
	}
	# Stop to pray
	option = { 
		name = pilgrimage.1130.a
		trigger = { location.faith = root.faith }
		remove_treasury_or_gold = 5
		add_piety = miniscule_piety_gain
		stress_impact = {
			greedy = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
			improvident = minor_stress_impact_loss
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = -0.5
				ai_energy = 1
			}
		}
	}
	# Steal de moolah
	option = { 
		name = pilgrimage.1130.b
		flavor = pilgrimage.1130.b.flavor
		add_gold = {
			value = tiny_gold_value
			max = 15
		}
		if = {
			limit = { faith = root.location.faith }
			add_piety = medium_piety_loss
		}
		current_travel_plan = {
			every_entourage_character = {
				limit = {
					faith = root.location.faith
					this != root
				}
				custom = every_root_faith_entourage_member_tt
				add_opinion = {
					target = root
					modifier = shrine_pilferer_opinion
				}
			}
		}
		if = {
			limit = { exists = scope:shrine_mocker }
			reverse_add_opinion = {
				target = scope:shrine_mocker
				modifier = shrine_pilferer_opinion
				opinion = 10
			}
		}
		if = {
			limit = { location.faith = root.faith }
			stress_impact = {
				base = minor_stress_impact_gain
				zealous = medium_stress_impact_gain
				just = medium_stress_impact_gain
				cynical = minor_stress_impact_loss
				greedy = minor_stress_impact_loss
				callous = minor_stress_impact_loss
			}
		}
		else = {
			stress_impact = {
				zealous = minor_stress_impact_gain
				just = minor_stress_impact_gain
			}
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = -0.5
				ai_sociability = 0.5
				ai_zeal = 1
			}
		}
	}
	# Desecrate de shrine
	option = { 
		name = pilgrimage.1130.c
		trigger = {
			location.faith != root.faith
		}
		flavor = pilgrimage.1130.c.flavor
		add_piety = minor_piety_gain
		current_travel_plan = {
			every_entourage_character = {
				limit = {
					NOR = {
						faith = root.location.faith
						this = root
					}
					has_trait = zealous
				}
				custom = every_zealous_root_faith_entourage_member_tt
				add_opinion = {
					target = root
					modifier = shrine_desecrater_opinion
					opinion = 15
				}
			}
			every_entourage_character = {
				limit = {
					faith = root.location.faith
					this != root
				}
				custom = every_province_faith_entourage_member_tt
				add_opinion = {
					target = root
					modifier = shrine_desecrater_opinion
				}
			}
		}
		stress_impact = {
			just = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 1
				ai_zeal = 0.5
				ai_compassion = -0.5
			}
		}
	}
	# Mock de prayer
	option = { 
		name = pilgrimage.1130.d
		trigger = {
			exists = scope:shrine_faithist
			faith != scope:shrine_faithist.faith
		}
		flavor = pilgrimage.1130.d.flavor
		reverse_add_opinion = {
			target = scope:shrine_faithist
			modifier = insulted_opinion
			opinion = -10
		}
		if = {
			limit = { exists = scope:shrine_mocker }
			progress_towards_friend_effect = {
				REASON = friend_mocked_heathen_together
				CHARACTER = scope:shrine_mocker
				OPINION = default_friend_opinion
			}
		}
		stress_impact = {
			compassionate = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_sociability = -0.5
				ai_zeal = 0.5
			}
		}
	}
	# Insult de mocker
	option = { 
		name = pilgrimage.1130.e
		trigger = {
			exists = scope:shrine_mocker
			faith = scope:shrine_province.faith
		}
		reverse_add_opinion = {
			target = scope:shrine_mocker
			modifier = insulted_opinion
			opinion = -10
		}
		if = {
			limit = { exists = scope:shrine_faithist }
			progress_towards_friend_effect = {
				REASON = friend_rebuffed_heathen
				CHARACTER = scope:shrine_faithist
				OPINION = default_friend_opinion
			}
		}
		stress_impact = {
			shy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_honor = 0.5
				ai_zeal = 0.5
			}
		}
	}
	# Leave
	option = { 
		name = {
			text = pilgrimage.1130.f
			trigger = { faith = scope:shrine_province.faith }
		}
		name = {
			text = pilgrimage.1130.f.other
			trigger = {
				faith != scope:shrine_province.faith
			}
		}
		if = {
			limit = { faith = scope:shrine_province.faith }
			add_piety = minor_piety_loss
		}
		if = {
			limit = { exists = scope:shrine_faithist }
			reverse_add_opinion = {
				target = scope:shrine_faithist
				modifier = annoyed_opinion
				opinion = -10
			}
		}
		stress_impact = {
			generous = minor_stress_impact_gain
			profligate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_honor = 0.5
				ai_zeal = 0.5
			}
		}
	}
}

scripted_trigger pilgrim_group_leader_trigger = {
	is_available = yes
	# Landless
	is_landed = no
	# No claims
	NOT = {
		any_claim = {}
	}
	# No house
	is_lowborn = yes
	# Faith is same as root's
	faith = root.faith
	# Dominant gender
	trigger_if = {
		limit = {
			faith = { has_doctrine_parameter = male_dominated_law }
		}
		is_male = yes
	}
	trigger_else_if = {
		limit = {
			faith = { has_doctrine_parameter = female_dominated_law }
		}
		is_female = yes
	}
	trigger_else = { always = yes }
}

#Strength in Numbers
# by Joe Parkin
pilgrimage.1140 = {
	type = character_event
	title = pilgrimage.1140.t
	desc = pilgrimage.1140.desc
	theme = travel_pilgrimage
	override_background = { reference = terrain_travel }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_trait = zealous }
			animation = personality_zealous
		}
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = lunatic
					has_trait = possessed
				}
			}
			animation = personality_irrational
		}
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = paranoid
					has_trait = craven
				}
			}
			animation = personality_coward
		}
		triggered_animation = {
			trigger = { has_trait = callous }
			animation = personality_callous
		}
		animation = personality_content
	}
	right_portrait = {
		character = scope:group_leader
		animation = beg
	}
	cooldown = { years = 1 }

	trigger = {
		is_travelling = yes
		is_location_valid_for_travel_event_on_land = yes
		current_travel_plan = {
			# Not just left
			next_destination_progress >= 0.2
			# Not super close to arrival
			next_destination_progress < 0.75
		}
		# Not at the target destination of the pilgrimage
		involved_activity.activity_location != root.location
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = {
				value = location.county.development_level
				divide = 4
			}
		}
	}

	immediate = {
		involved_activity.activity_location = { save_scope_as = destination }
		# Save a culture for the pilgrim leader
		hidden_effect = {
			random_list = {
				10 = {
					location.culture = { save_scope_as = pilgrim_culture }
				}
				10 = {
					culture = { save_scope_as = pilgrim_culture }
				}
			}
		}
		# Save or create a pilgrim leader
		random_list = {
			9 = {
				trigger = { # Does a valid pilgrim leader exist in the county?
					any_pool_character = {
						province = root.location
						pilgrim_group_leader_trigger = yes
					}
				}
				random_pool_character = {
					province = root.location
					limit = { pilgrim_group_leader_trigger = yes }
					save_scope_as = group_leader
					if = {
						limit = {
							location != root.location
						}
						hidden_effect = { move_to_pool_at = root.location }
					}
				}
			}
			1 = {
				create_character = {
					template = generic_peasant_character
					culture = root.culture
					faith = root.faith
					dynasty = none
					location = root.location
					gender_female_chance = root_faith_dominant_gender_female_chance
					save_scope_as = group_leader
				}
			}
		}
		scope:group_leader = { add_character_flag = peasant_pilgrim_leader }
		save_scope_value_as = {
			name = duel_variety
			value = { 1 4 }
		}
	}
	# Welcome them
	option = { 
		name = pilgrimage.1140.a
		remove_short_term_gold = 10
		add_piety = minor_piety_gain
		add_to_entourage_court_and_activity_effect = { 
			CHAR_TO_ADD = scope:group_leader 
			NEW_COURT_OWNER = root 
		}
		current_travel_plan = {
			add_travel_plan_modifier = { modifier = pilgrim_group_joined_modifier }
		}
		add_character_flag = pilgrim_group_joined
		stress_impact = {
			shy = minor_stress_impact_gain
			greedy = minor_stress_impact_gain
			improvident = minor_stress_impact_gain
			callous = medium_stress_impact_gain
			paranoid = minor_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = 0.5
				ai_sociability = 0.5
				ai_greed = -0.5
			}
		}
	}
	# Culture turn away
	option = { 
		name = pilgrimage.1140.b
		trigger = {
			culture != scope:group_leader.culture
		}
		flavor = pilgrimage.1140.b.flavor
		add_prestige = minor_prestige_gain
		culture = {
			change_cultural_acceptance = {
				target = scope:group_leader.culture
				value = minor_cultural_acceptance_loss
				desc = cultural_acceptance_rejected_pilgrims
			}
		}
		stress_impact = {
			compassionate = minor_stress_impact_gain
			just = minor_stress_impact_gain
			humble = minor_stress_impact_gain
			trusting = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = -0.5
				ai_greed = 0.5
				ai_rationality = -0.5
			}
		}
	}
	# Provision them
	option = { 
		name = pilgrimage.1140.c
		add_piety = miniscule_piety_gain
		remove_short_term_gold = 20
		stress_impact = {
			greedy = medium_stress_impact_gain
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			improvident = medium_stress_impact_loss
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = -0.5
				ai_greed = 0.5
				ai_rationality = -0.5
			}
		}
	}
	# Turn away
	option = { 
		name = pilgrimage.1140.d
		flavor = pilgrimage.1140.d.flavor
		add_prestige = miniscule_prestige_gain
		stress_impact = {
			compassionate = minor_stress_impact_gain
			improvident = minor_stress_impact_gain
			generous = minor_stress_impact_gain
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = -1
				ai_greed = 0.5
			}
		}
	}
	after = {
		scope:group_leader = {
			silent_disappearance_ai_effect = yes
		}
	}
}

#Heathen-hating adherent challenges you
# by Petter Vilberg
pilgrimage.2002 = {
	type = character_event
	title = pilgrimage.2002.t
	desc = pilgrimage.2002.desc
	theme = travel_pilgrimage
	override_background = { reference = bp1_bonfire }
	left_portrait = {
		character = root
		animation = disapproval
	}
	right_portrait = {
		character = scope:heathen_hater
		animation = anger
	}
	cooldown = { years = 2 }
	trigger = {
		is_location_valid_for_travel_event_on_land = yes
		religion = {
			is_in_family = rf_abrahamic
		} 
		current_travel_plan ?= {
			any_entourage_character = {
				is_physically_able_ai_adult = yes
				NOR = {
					this = root
					has_trait = cynical
					is_courtier_of = root
				}
			}
		}
	}
	immediate = {
		random_dummy_gender_effect = yes
		current_travel_plan = {
			random_entourage_character = {
				limit = {
					is_physically_able_ai_adult = yes
					NOR = {
						this = root
						has_trait = cynical
						is_courtier_of = root
					}
				}
				weight = {
					base = 1
					# Try to find someone relevant
					modifier = {
						has_trait = zealous
						add = 2
					}
					modifier = {
						has_trait_malicious_trigger = yes
						add = 2
					}
				}
				save_scope_as = heathen_hater
			}
		}
	}
	option = { # Zealous: YOU ARE ABSOLUTELY RIGHT
		name = pilgrimage.2002.c
		trigger = {
			has_trait = zealous
		}
		trait = zealous
		pious_type_option_effect = yes
		add_piety = minor_piety_gain
		add_character_modifier = {
			modifier = pilgrimage_disdainful_towards_faiths_modifier
			years = 10
		}
		scope:heathen_hater = {
			add_opinion = {
				modifier = respect_opinion
				target = root
				opinion = 30
			}
		}
		ai_chance = {
			base = 500
		}
	}
	# Are they truly all that bad?
	option = { 
		name = pilgrimage.2002.a
		worldly_type_option_effect = yes
		add_character_modifier = {
			modifier = pilgrimage_sympathetic_towards_faiths_modifier
			years = 10
		}
		scope:heathen_hater = {
			add_opinion = {
				modifier = disappointed_opinion
				target = root
				opinion = -10
			}
		}
		if = {
			limit = {
				NOT = {
					faith = { has_doctrine = doctrine_pluralism_pluralistic }
				}
			}
			stress_impact = {
				zealous = major_stress_impact_gain
			}
		}
		stress_impact = {
			craven = medium_stress_impact_gain
			shy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 0.5
			}
		}
	}
	# Of course
	option = { 
		name = pilgrimage.2002.b
		add_character_modifier = {
			modifier = pilgrimage_disdainful_towards_faiths_modifier
			years = 10
		}
		scope:heathen_hater = {
			add_opinion = {
				modifier = respect_opinion
				target = root
				opinion = 10
			}
		}
		stress_impact = {
			cynical = minor_stress_impact_gain
			trusting = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = 1
				ai_compassion = -1
			}
		}
	}
}

scripted_trigger 2002_local_prowess_character_trigger = {
	is_available_healthy_ai_adult = yes
	prowess >= high_skill_rating
	can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
	can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = this }
}
#Hire more guards?
# by Petter Vilberg & Filippa Gannholm Kirsten
pilgrimage.2003 = {
	type = character_event
	title = pilgrimage.2003.t
	desc = pilgrimage.2003.desc
	theme = travel_pilgrimage
	override_background = { reference = terrain_travel }
	left_portrait = {
		character = root
		animation = worry
	}
	right_portrait = {
		character = scope:2002_local_warrior
		animation = marshal
	}
	cooldown = { years = 2}
	trigger = {
		current_travel_plan = { next_destination_progress > 0.5 }
		is_location_valid_for_travel_event_on_land = yes
	}
	weight_multiplier = {
		base = 1
		modifier = {
			current_travel_plan = { has_travel_option = hire_experienced_mercenaries_option }
			add = -0.5
		}
		modifier = {
			location = {
				travel_danger_value = {
					target = root.current_travel_plan
					value < 20
				}
			}
			add = 0.2
		}
		modifier = {
			location = {
				travel_danger_value = {
					target = root.current_travel_plan
					value < 40
				}
			}
			add = 0.2
		}
		modifier = {
			location = {
				travel_danger_value = {
					target = root.current_travel_plan
					value < 60
				}
			}
			add = 0.2
		}
		modifier = {
			location = {
				travel_danger_value = {
					target = root.current_travel_plan
					value < 80
				}
			}
			add = 0.2
		}
		modifier = {
			location = {
				travel_danger_value = {
					target = root.current_travel_plan
					value = 100
				}
			}
			add = 0.2
		}
	}
	immediate = {
		if = {
			limit = {
				any_pool_character = {
					province = root.location
					2002_local_prowess_character_trigger = yes
				}
			}
			random_pool_character = {
				province = root.location
				limit = { 2002_local_prowess_character_trigger = yes }
				save_scope_as = 2002_local_warrior
			}
		}
		else = {
			create_character = {
				template = new_warrior_character
				location = root.location
				culture = root.location.county.culture
				faith = root.location.county.faith
				gender_female_chance = root_soldier_female_chance
				prowess = { medium_skill_rating high_skill_rating }
				save_scope_as = 2002_local_warrior
			}
			scope:2002_local_warrior = { add_character_flag = created_warrior }
		}
	}
	#Hire more guards
	option = { 
		name = pilgrimage.2003.a
		trigger = {
			current_travel_plan = {
				NOT = { has_travel_option = hire_experienced_mercenaries_option }
			}
		}
		if = {
			limit = { 
				faith = { has_doctrine = tenet_armed_pilgrimages } 
			}
			custom_description_no_bullet = {
				text = pilgrimage_piousness_because_i_have_tenet_armed_pilgrimages
				pious_type_option_effect = yes
			}
		}
		else_if = {
			limit = { 
				faith = { has_doctrine = tenet_struggle_submission } 
			}
			custom_description_no_bullet = {
				text = pilgrimage_piousness_because_i_have_tenet_struggle_submission
				pious_type_option_effect = yes
			}
		}
		current_travel_plan = { add_travel_plan_modifier = pilgrim_protection_modifier }
		remove_short_term_gold = medium_gold_value
		stress_impact = {
			humble = medium_stress_impact_gain
			greedy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = -0.5
				ai_rationality = 0.5
			}
			# Reduced chance the less gold you have compared to the gold required
			modifier = {
				factor = {
					value = short_term_gold
					divide = medium_gold_value
				}
				short_term_gold < medium_gold_value
			}
			# Don't choose this if you're already in debt
			modifier = {
				factor = 0
				gold < 0
			}
		}
	}
	#Hire that beefy chonk
	option = { 
		name = pilgrimage.2003.b
		if = {
			limit = { 
				faith = { has_doctrine = tenet_warmonger } 
			}
			custom_description_no_bullet = {
				text = pilgrimage_piousness_because_i_have_tenet_warmonger
				pious_type_option_effect = yes
			}
		}
		remove_short_term_gold = minor_gold_value
		recruit_to_entourage_court_and_activity_effect = { 
			CHAR_TO_ADD = scope:2002_local_warrior 
			NEW_COURT_OWNER = root 
		}
		stress_impact = {
			humble = medium_stress_impact_gain
			greedy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = -0.5
				ai_rationality = 0.5
			}
			# Reduced chance the less gold you have compared to the gold required
			modifier = {
				factor = {
					value = short_term_gold
					divide = medium_gold_value
				}
				short_term_gold < medium_gold_value
			}
			# Don't choose this if you're already in debt
			modifier = {
				factor = 0
				gold < 0
			}
		}
	}
	# This journey will remain humble and personal
	option = { 
		name = pilgrimage.2003.c
		pious_type_option_effect = yes
		give_pilgrim_xp_effect = yes
		add_character_modifier = {
			modifier = pilgrimage_divine_protection_modifier
			years = 10
		}
		stress_impact = {
			arrogant = minor_stress_impact_gain
			craven = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
			}
		}
	}
	after = {
		if = {
			limit = {
				NOT = {
					current_travel_plan = {
						any_entourage_character = { this = scope:2002_local_warrior }
					}
				}
				scope:2002_local_warrior = { has_character_flag = created_warrior }
			}
			scope:2002_local_warrior = {
				if = {
					limit = {
						root = { is_ai = yes }
					}
					silent_disappearance_effect = yes
				}
			}
		}
	}
}

scripted_trigger pilgrimage_2004_potential_friend_trigger = {
	is_available_ai_adult = yes
	faith = root.faith
	NOT = { is_courtier_of = root }
	location = root.location
}

#Run into a potential friend
# by Petter Vilberg
pilgrimage.2004 = {
	type = character_event
	title = pilgrimage.2004.t
	desc = pilgrimage.2004.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		animation = personality_honorable
	}
	right_portrait = {
		character = scope:potential_friend
		animation = happiness
	}
	cooldown = { years = 2 }
	trigger = {
		any_relation = {
			type = potential_friend
			pilgrimage_2004_potential_friend_trigger = yes
		}
		is_location_valid_for_travel_event_on_land = yes
	}
	immediate = {
		random_relation = {
			type = potential_friend
			limit = {
				pilgrimage_2004_potential_friend_trigger = yes
			}
			save_scope_as = potential_friend
		}
	}
	#PantheonTerm has brought us together!
	option = { 
		name = pilgrimage.2004.a
		worldly_type_option_effect = yes
		set_relation_friend = { 
			reason = friend_pilgrimage 
			target = scope:potential_friend 
		}
		reverse_add_opinion = {
			target = scope:potential_friend
			modifier = divine_blessing_friendship_opinion
		}
		add_to_entourage_court_and_activity_effect = { 
			CHAR_TO_ADD = scope:potential_friend 
			NEW_COURT_OWNER = root 
		}
		hidden_effect = {
			add_opinion = {
				target = scope:potential_friend
				modifier = divine_blessing_friendship_opinion
			}
		}
		stress_impact = {
			shy = medium_stress_impact_gain
			paranoid = major_stress_impact_gain
		}
		ai_chance = {
			base = 500
			modifier = {
				OR = {
					has_trait = shy
					has_trait = paranoid
				}
				factor = 0
			}
		}
	}
	# I must do this in solitude
	option = { 
		name = pilgrimage.2004.b
		pious_type_option_effect = yes
		add_piety = minor_piety_gain
		stress_impact = {
			cynical = medium_stress_impact_gain
			gregarious = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = cynical
					has_trait = gregarious
				}
				factor = 0.1
			}
		}
	}
}

#A peasant inadvertedly insults you
# by Petter Vilberg
pilgrimage.2005 = {
	type = character_event
	title = pilgrimage.2005.t
	desc = {
		desc = pilgrimage.2005.desc
		first_valid = {
			triggered_desc = {
			    trigger = {
			    	location.county.holder = { top_liege = root.top_liege }
			    }
			    desc = pilgrimage.2005.desc_close
			}
			desc = pilgrimage.2005.desc_far
		}
		desc = pilgrimage.2005.outro
	}
	theme = travel_pilgrimage
	override_background = { reference = bp1_bonfire }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { ai_vengefulness > 0 }
			animation = anger
		}
		animation = shock
	}
	right_portrait = {
		character = scope:rude_pilgrim
		animation = laugh
	}
	cooldown = { years = 2 }
	trigger = {
		is_location_valid_for_travel_event_on_land = yes
		current_travel_plan ?= {
			any_entourage_character = {
				is_physically_able_ai_adult = yes
				this != root
				NOT = { is_courtier_of = root }
			}
		}
	}
	immediate = {
		random_dummy_gender_peasant_effect = yes
		current_travel_plan = {
			random_entourage_character = {
				limit = {
					is_physically_able_ai_adult = yes
					this != root
					NOT = { is_courtier_of = root }
				}
				weight = {
					base = 1
					modifier = {
						has_personality_malicious_trigger = yes
						add = 100
					}
					modifier = {
						has_trait_malicious_trigger = yes
						add = 10
					}
					modifier = {
						has_personality_extroverted_trigger = yes
						add = 50
					}
					modifier = {
						has_trait_extroverted_trigger = yes
						add = 5
					}
				}
				save_scope_as = rude_pilgrim
			}
		}
	}
	# Take it with some humour
	option = { 
		name = pilgrimage.2005.a
		flavor = pilgrimage.2005.a.flavor
		worldly_type_option_effect = yes
		if = {
			limit = {
				NOR = {
					has_trait = arrogant
					has_trait = vengeful
				}
			}
			add_stress = medium_stress_loss
		}
		stress_impact = {
			arrogant = medium_stress_impact_gain
			vengeful = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
				ai_compassion = 0.5
			}
		}
	}
	# What an insult! String them up!
	option = { 
		name = pilgrimage.2005.b
		add_dread = medium_dread_gain
		add_piety = minor_piety_loss
		scope:rude_pilgrim = {
			increase_wounds_effect = { REASON = whipping }
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = low_negative_opinion
			}
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
			humble = medium_stress_impact_gain
			sadistic = major_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 1
			}
		}
	}
	# Find other people to travel with
	option = { 
		name = pilgrimage.2005.c
		add_character_modifier = {
			modifier = new_pilgrimage_companions_modifier
			years = 5
		}
		stress_impact = {
			stubborn = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 1
			}
		}
	}
}

#Your pilgrimage is taking a little detour 
# by Filippa Gannholm Kirsten
pilgrimage.2006 = {
	type = character_event
	title = pilgrimage.2006.t
	desc = {
		desc = pilgrimage.2006.intro
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:caravan_master }
				desc = pilgrimage.2006.desc_travel_leader
			}
			desc = pilgrimage.2006.desc_alone
		}
	}
	theme = travel_pilgrimage
	override_background = { reference = wilderness }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				exists = scope:caravan_master
				ai_vengefulness > 50
				NOT = { has_trait = forgiving }
			}
			animation = disapproval
		}
		triggered_animation = {
			trigger = {	ai_boldness < 0 }
			animation = worry
		}
		animation = thinking
	}
	right_portrait = {
		trigger = { exists = scope:other_person }
		character = scope:other_person
		triggered_animation = {
			trigger = { scope:other_person = scope:local_person }
			#Peasants herpiderp
			animation = personality_irrational
		}
		animation = stress
	}
	cooldown = { years = 2 }
	trigger = {
		#Shouldn't happen immediately
		current_travel_plan = { next_destination_progress > 0.2 }
		is_location_valid_for_travel_event_on_land = yes
		is_character_not_specialized_in_terrain = yes
		any_pool_character = {
			province = root.location
			is_available_ai_adult = yes
			has_no_real_status_trigger = yes
		}
		NOT = {
			location ?= capital_province
			current_travel_plan = { has_travel_plan_modifier = travel_guide_modifier }
			has_character_flag = had_1006_travel_danger_lost_event_recently
		}
	}
	weight_multiplier = {
		base = 1
		modifier = {
			exists = current_travel_plan.travel_leader
			current_travel_plan.travel_leader = {
				aptitude:travel_leader_court_position < 10
			}
			faith = {
				OR = {
					trait_is_virtue = forgiving
					trait_is_virtue = patient
				}	
			}
			add = 1
		}
	}
	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
		#Some cooldown between Lost-themed events
		add_character_flag = {
			flag = had_2006_lost_pilgrimage_event_recently
			months = 3
		}
		#Do we have a caravan master?
		if = {
			limit = { exists = current_travel_plan.travel_leader }
			current_travel_plan.travel_leader = { save_scope_as = caravan_master }
		}
		if = {
			limit = {
				any_pool_character = {
					province = root.location
					is_available_ai_adult = yes
					has_no_real_status_trigger = yes
				}
			}
			random_pool_character = {
				province = root.location
				limit = { 
					is_available_ai_adult = yes
					has_no_real_status_trigger = yes
				}
				save_scope_as = local_person
			}
		}
		if = {
			limit = { exists = scope:caravan_master }
			scope:caravan_master = { save_scope_as = other_person }
		}
		else = {
			scope:local_person = { save_scope_as = other_person }
		}
		#Are we travel-ept
		if = {
			limit = {
				OR = {
					#Are we an experienced pilgrim?
					AND = {
						has_trait = pilgrim
						has_trait_xp = {
							trait = pilgrim
							value >= 50
						}
					}
					#Or an experienced traveler?
					AND = {
						has_trait = lifestyle_traveler
						OR = {
							has_trait_xp = {
								trait = lifestyle_traveler
								track = travel
								value >= 50
							}
							has_trait_xp = {
								trait = lifestyle_traveler
								track = danger
								value >= 50
							}
						}
					}
					#Duh, the sun rises in the east and sets in the west
					learning >= high_skill_rating
				}
			}
			add_character_flag = pilgrimage_travel_smart
		}
	}
	#I'm too old for this #¤%#
	option = { 
		name = {
			trigger = {
				involved_activity = {
					NOR = {
						has_activity_option = {
							category = special_type
							option = pilgrimage_type_pious
						}
						has_activity_option = {
							category = special_type
							option = pilgrimage_type_hajj
						}
					}
				}
			}
			text = pilgrimage.2006.a
		}
		name = pilgrimage.2006.a_pious
		trigger = { has_character_flag = pilgrimage_travel_smart }
		bonus_to_all_types_effect = yes
		if = {
			limit = {
				has_trait = lifestyle_traveler
				has_trait_xp = {
					trait = lifestyle_traveler
					track = travel
					value < 100
				}
			}
			add_trait_xp = {
				trait = lifestyle_traveler
				track = travel
				value = 5
			}
		}
		else_if = {
			limit = {
				has_trait = pilgrim
				has_trait_xp = {
					trait = pilgrim
					value < 100
				}
			}
			add_trait_xp = {
				trait = pilgrim
				value = 5
			}
		}
		else_if = {
			limit = { has_lifestyle = learning_lifestyle }
			add_learning_lifestyle_xp = medium_lifestyle_xp
		}
		else = {
			stress_impact = {
				base = minor_stress_loss
			}
		}
		ai_chance = {
			base = 200
		}
	}
	#Let's accept the situation
	option = { 
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.2006.b_cynical
		}
		name = pilgrimage.2006.b
		current_travel_plan = {
			delay_travel_plan = { days = 90 }
		}
		if = {
			limit = { exists = scope:caravan_master }
			scope:caravan_master = {
				add_opinion = {
					target = root
					modifier = relieved_opinion
					opinion = 20
				}
			}
		}
		pious_type_option_effect = yes
		if = {
			limit = {
				OR = {
					AND = {
						exists = scope:caravan_master
						faith = { trait_is_virtue = forgiving }
					}
					faith = { trait_is_virtue = patient }
				}
			}
			add_piety = miniscule_piety_gain
		}
		else_if = {
			limit = {
				OR = {
					AND = {
						exists = scope:caravan_master
						faith = { trait_is_sin = forgiving }
					}
					faith = { trait_is_sin = patient }
				}
			}
			add_piety = minor_piety_loss
		}
		add_character_modifier = {
			modifier = pilgrimage_accepting_modifier
			years = 5
		}
		stress_impact = {
			base = minor_stress_impact_loss
			patient = minor_stress_impact_loss
			humble = minor_stress_impact_loss
			impatient = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = impatient
					has_trait = cynical
				}
				add = -50
			}
		}
	}
	#This is unacceptable!
	option = { 
		name = {
			trigger = { 
				NOT = { exists = scope:caravan_master }
			}
			text = pilgrimage.2006.c
		}
		name = pilgrimage.2006.c_caravan_master
		if = {
			limit = { exists = scope:caravan_master }
			scope:caravan_master = {
				add_opinion = {
					target = root
					modifier = humiliated_opinion
					opinion = -20
				}
			}
		}
		if = {
			limit = {
				OR = {
					AND = {
						exists = scope:caravan_master
						faith = { trait_is_virtue = vengeful }
					}
					faith = { trait_is_virtue = impatient }
				}
			}
			pious_type_option_effect = yes
			add_piety = miniscule_piety_gain
		}
		else_if = {
			limit = {
				OR = {
					AND = {
						exists = scope:caravan_master
						faith = { trait_is_sin = vengeful }
					}
					faith = { trait_is_sin = impatient }
				}
			}
			add_piety = minor_piety_loss
		}
		if = {
			limit = { exists = scope:caravan_master }
			add_dread = minor_dread_gain
			stress_impact = {
				forgiving = minor_stress_impact_gain
				compassionate = minor_stress_impact_gain

			}
		}
		else = {
			add_prestige = minor_prestige_loss
			stress_impact = {
				shy = minor_stress_impact_gain
				craven = minor_stress_impact_gain
				paranoid = medium_stress_impact_gain
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = forgiving
					has_trait = compassionate
				}
				factor = 0
			}
			modifier = {
				faith = { 
					OR = {
						trait_is_virtue = forgiving
						trait_is_virtue = patient
					}
				}
				factor = 0
			}
		}
	}
	after = { 
		remove_character_flag = pilgrimage_travel_smart
		mp_resume_travel_plan = yes
	}
}

#Fall ill
# by Petter Vilberg
pilgrimage.2008 = {
	type = character_event
	title = pilgrimage.2008.t
	desc = pilgrimage.2008.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		trigger = { exists = scope:traveling_court_physician }
		character = scope:traveling_court_physician
		animation = worry
	}
	cooldown = { years = 10 }
	trigger = {
		#Shouldn't happen immediately
		current_travel_plan = { next_destination_progress > 0.2 }
		involved_activity ?= { has_activity_type = activity_pilgrimage }
		can_contract_disease_trigger = { DISEASE = ill }
		is_location_valid_for_travel_event_on_land = yes
	}
	immediate = {
		play_music_cue = "mx_cue_illness"
		show_as_tooltip = { add_trait = ill }
		hidden_effect = {
			#Adds the trait, sends event "health.2201" to those who care if health is brought too low
			contract_disease_effect = { 
				DISEASE = ill 
				TREATMENT_EVENT = yes 
			} 	
		}
		current_travel_plan = {
			if = {
				limit = {
					any_entourage_character = { has_court_position = court_physician_court_position }
				}
				random_entourage_character = {
					limit = { has_court_position = court_physician_court_position }
					save_scope_as = traveling_court_physician
				}
			}
		}

	}
	#Gogo Whole of Body
	option = {
		name = pilgrimage.2008.whole_of_body
		trigger = { has_trait = whole_of_body }
		show_as_tooltip = { remove_trait = ill }
		hidden_effect = {
			recover_from_disease_effect = { DISEASE = ill }
		}
		ai_chance = {
			base = 1000
		}
	}
	#Gogo Court Physician
	option = {
		name = pilgrimage.2008.court_physician
		trigger = { exists = scope:traveling_court_physician }
		show_as_tooltip = { remove_trait = ill }
		hidden_effect = {
			recover_from_disease_effect = { DISEASE = ill }
		}
		ai_chance = {
			base = 1000
		}
	}
	#Oh no
	option = { 
		name = pilgrimage.2008.a
		custom_tooltip = pilgrimage.2008.a.tt
		#Decide whether to go home or continue on
		trigger_event = health.1001
		ai_chance = {
			base = 100
		}
	}
}

#Develop pneumonia
# by Petter Vilberg
pilgrimage.2009 = {
	type = character_event
	title = pilgrimage.2009.t
	desc = pilgrimage.2009.desc
	theme = travel_pilgrimage
#	override_background = { reference = army_camp }
	left_portrait = {
		character = root
		animation = sick
	}
	cooldown = { years = 10 }
	trigger = {
		has_trait = ill
		can_contract_disease_trigger = { DISEASE = pneumonic }
		involved_activity ?= { has_activity_type = activity_pilgrimage }
	}
	immediate = {
		show_as_tooltip = { add_trait_force_tooltip = pneumonic }
		hidden_effect = {
			#Adds the trait, sends event "health.2201" to those who care if health is brought too low
			contract_disease_effect = {
				DISEASE = pneumonic
				TREATMENT_EVENT = no
			}
		}
	}
	#Ok, guess I have pneumonia now
	option = { 
		name = pilgrimage.2009.a
		ai_chance = {
			base = 100
		}
	}
	after = {
		#Decide whether to go home or continue on
		trigger_event = health.1001
	}
}

scripted_trigger pilgrimage_2010_mystic_ruler = {	
	faith = root.faith
	has_trait = lifestyle_mystic
	is_available_ai = yes
	NOR = {
		AND = { # Not your liege
			liege ?= root
		}
		# Not a family member
		any_close_or_extended_family_member = {
			this = root
		}
		# Not a direct vassal
		any_vassal = {
			this = root
		}
		AND = { # Not your religious head
			exists = root.faith.religious_head
			this = root.faith.religious_head
		}
	}
	location = root.location
}

scripted_trigger pilgrimage_2010_mystic_home_ruler = {
	faith = root.faith
	this != root
	exists = capital_province
	location = root.location
}

scripted_effect pilgrimage_2013_outcome_effect = {
	if = {
		limit = {
			NOT = { has_trait = lifestyle_mystic }
		}
		add_trait = lifestyle_mystic
	}
	else_if = {
		limit = { 
			has_trait = lifestyle_mystic
			has_trait_xp = {
				trait = lifestyle_mystic
				value < 100
			}
		}
		add_trait_xp = {
			trait = lifestyle_mystic
			value = 10
		}
	}
	else_if = {
		limit = { has_lifestyle = learning_lifestyle }
		add_learning_lifestyle_perk_points = 1
	}
	else_if = {
		limit = { 
			has_trait = pilgrim
			has_trait_xp = {
				trait = pilgrim
				value < 100
			}
		}
		add_trait_xp = {
			trait = pilgrim
			value = 10
		}
	}
	else = {
		add_piety = medium_piety_gain
	}
}

scripted_effect pilgrimage_2014_outcome_effect = {
	random_list = {
		50 = {
			show_chance = no
			desc = pilgrimage.2014.pilfered.desc
			send_interface_toast = {
				title = pilgrimage.2014.pilfered.t
				left_icon = root
				remove_short_term_gold = tiny_gold_value
				stress_impact = { base = miniscule_stress_impact_loss }
			}
		}
		50 = {
			show_chance = no
			desc = pilgrimage.2014.restful.desc
			send_interface_toast = {
				title = pilgrimage.2014.restful.t
				left_icon = root
				stress_impact = { base = minor_stress_impact_loss }
				add_character_modifier = {
					modifier = pilgrimage_rest_and_good_health_modifier
					years = 5
				}
			}
		}
	}
}

scripted_effect pilgrimage_2015_outcome_effect = {
	duel = {
		skill = learning
		target = scope:2010_mystic
		50 = {
			desc = pilgrimage.2015.learning.desc
			compare_modifier = {
				value = scope:duel_value
				multiplier = 3
			}
			send_interface_toast = {
				title = pilgrimage.2015.learning.t
				left_icon = root
				right_icon = scope:2010_mystic
				if = {
					limit = { has_lifestyle = learning_lifestyle }
					add_learning_lifestyle_xp = medium_lifestyle_xp
				}
				else = { add_learning_skill = 1 }
				
			}
		}
		50 = {
			desc = pilgrimage.2015.piety.desc
			compare_modifier = {
				value = scope:duel_value
				multiplier = -3
				min = 5
			}
			send_interface_toast = {
				title = pilgrimage.2015.piety.t
				left_icon = root
				right_icon = scope:2010_mystic
				add_piety = miniscule_piety_gain
			}				
		}
	}
}

# Meet a Mystic on your journey
#by Petter Vilberg
pilgrimage.2010 = {
	type = character_event
	title = pilgrimage.2010.t
	desc = pilgrimage.2010.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = zealous
					has_trait = cynical
					has_trait = paranoid
					has_trait = craven
				}
			}
			animation = personality_cynical
		}
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = lifestyle_mystic
					has_trait = scholar
					has_trait = trusting
					has_trait = gregarious
				}
			}
			animation = admiration
		}
		animation = idle
	}
	right_portrait = {
		character = scope:2010_mystic
		animation = personality_rational
	}
	cooldown = { years = 5 }
	trigger = {
		is_ai = no
		NOT = { has_trait = lifestyle_mystic }
		religion = { is_in_family = rf_abrahamic }
		faith = {
			any_faith_ruler = {
				OR = {
					pilgrimage_2010_mystic_ruler = yes
					pilgrimage_2010_mystic_home_ruler = yes
				}
			}
		}
		is_location_valid_for_travel_event_on_land = yes
	}
	immediate = {
		# Find our Mystic
		faith = {
			if = {
				limit = {
					any_faith_ruler = { pilgrimage_2010_mystic_ruler = yes }
				}
				random_faith_ruler = {
					limit = { pilgrimage_2010_mystic_ruler = yes }
					save_scope_as = 2010_mystic
				}
			}
			else = {
				random_faith_ruler = {
					limit = { pilgrimage_2010_mystic_home_ruler = yes }
					save_scope_as = mystic_home_owner
				}
				create_character = {
					template = default_mystic_character
					location = scope:mystic_home_owner.capital_province
					culture = scope:mystic_home_owner.culture
					save_scope_as = 2010_mystic
				}
			}
		}
		add_character_flag = in_pilgrimage_event_chain
	}
	# Let's see what this person is up to
	option = { 
		name = pilgrimage.2010.a
		custom_tooltip = pilgrimage.2010.a.tt
		worldly_type_option_effect = yes
		current_travel_plan = { delay_travel_plan = { days = 90 } }
		trigger_event = {
			id = pilgrimage.2011
			days = 5
		}
	}
	# Smells of heresy to me!
	option = { 
		name = pilgrimage.2010.b
		pious_type_option_effect = yes
		add_piety = minor_piety_gain
		if = {
			limit = { exists = cp:councillor_court_chaplain }
			cp:councillor_court_chaplain = {
				add_opinion = {
					target = root
					modifier = pious_opinion
					opinion = 30
				}
			}
		}
		# Mystic gets out with the Pilgrim trait for flavor
		hidden_effect = {
			scope:2010_mystic = {
				if = {
					limit = {
						NOT = { has_trait = pilgrim }
					}
					add_trait = pilgrim
				}
			}
		}
	}
}

#The Mystic has a lot to say about your faith
pilgrimage.2011 = {
	type = character_event
	title = pilgrimage.2010.t
	desc = pilgrimage.2011.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = zealous
					has_trait = cynical
					has_trait = paranoid
					has_trait = craven
				}
			}
			animation = worry
		}
		animation = thinking
	}
	right_portrait = {
		character = scope:2010_mystic
		animation = personality_rational
	}
	trigger = {
		scope:2010_mystic = {
			is_available_adult = yes
			is_imprisoned = no
		}
	}
	on_trigger_fail = {
		trigger_event = pilgrimage.2012
	}
	# Tell me more!
	option = { 
		name = pilgrimage.2011.a
		custom_tooltip = pilgrimage.2011.a.tt
		trigger = { learning >= decent_skill_rating }
		show_as_unavailable = { always = yes }
		skill = learning
		bonus_to_all_types_effect = yes
		show_as_tooltip = { pilgrimage_2013_outcome_effect = yes }
		trigger_event = {
			id = pilgrimage.2013
			days = 5
		}
	}
	# I'm just going to take a nap
	option = { 
		name = pilgrimage.2011.b
		custom_tooltip = pilgrimage.2011.b.tt
		show_as_tooltip = { pilgrimage_2014_outcome_effect = yes }
		worldly_type_option_effect = yes
		trigger_event = {
			id = pilgrimage.2014
			days = 5
		}
	}
	# Engage in vigorous debate
	option = { 
		name = pilgrimage.2011.c
		custom_tooltip = pilgrimage.2011.c.tt
		show_as_tooltip = { pilgrimage_2015_outcome_effect = yes }
		pious_type_option_effect = yes
		trigger_event = {
			id = pilgrimage.2015
			days = 5
		}
	}
	after = {
		current_travel_plan = { resume_travel_plan = yes } #Paused in the preceding event
	}
}

#Fallback in case something happened in between events
pilgrimage.2012 = {
	type = character_event
	title = pilgrimage.2010.t
	desc = pilgrimage.2012.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = zealous
					has_trait = cynical
					has_trait = paranoid
					has_trait = craven
				}
			}
			animation = worry
		}
		animation = thinking
	}
	right_portrait = {
		character = scope:2010_mystic
		animation = personality_rational
	}
	option = {
		name = pilgrimage.2012.a
		add_character_modifier = {
			modifier = pilgrimage_religious_reflections_modifier
			years = 5
		}
	}
	after = {
		current_travel_plan = { resume_travel_plan = yes }
		remove_character_flag = in_pilgrimage_event_chain 
	}
}

#Outcome of engaging
pilgrimage.2013 = {
	type = character_event
	title = pilgrimage.2010.t
	desc = pilgrimage.2013.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = zealous
					has_trait = cynical
					has_trait = paranoid
					has_trait = craven
				}
			}
			animation = worry
		}
		animation = thinking
	}
	right_portrait = {
		character = scope:2010_mystic
		animation = happiness
	}
	immediate = {
		pilgrimage_2013_outcome_effect = yes
	}
	#Woo! Mystic!
	option = {
		name = pilgrimage.2013.a
		add_trait = lifestyle_mystic
	}
	after = {
		# Mystic gets out with the Pilgrim trait for flavor
		hidden_effect = {
			scope:2010_mystic = {
				if = {
					limit = {
						NOT = { has_trait = pilgrim }
					}
					add_trait = pilgrim
				}
			}
		}
		current_travel_plan = { resume_travel_plan = yes }
		remove_character_flag = in_pilgrimage_event_chain
	}
}

#Outcome of sleeping
pilgrimage.2014 = {
	type = character_event
	title = pilgrimage.2010.t
	desc = pilgrimage.2014.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				NOT = { has_character_modifier = pilgrimage_rest_and_good_health_modifier }
			}
			animation = worry
		}
		animation = thinking
	}
	right_portrait = {
		character = scope:2010_mystic
		animation = personality_rational
	}
	immediate = {
		pilgrimage_2014_outcome_effect = yes
	}
	#Alright
	option = {
		#Someone stole gold!
		name = {
			trigger = {
				NOT = { has_character_modifier = pilgrimage_rest_and_good_health_modifier }
			}
			text = pilgrimage.2014.a
		}
		#Very restful
		name = pilgrimage.2014.a_restful
	}
	after = {
		# Mystic gets out with the Pilgrim trait for flavor
		hidden_effect = {
			scope:2010_mystic = {
				if = {
					limit = {
						NOT = { has_trait = pilgrim }
					}
					add_trait = pilgrim
				}
			}
		}
		current_travel_plan = { resume_travel_plan = yes }
		remove_character_flag = in_pilgrimage_event_chain
	}
}

#Outcome of debating
pilgrimage.2015 = {
	type = character_event
	title = pilgrimage.2010.t
	desc = pilgrimage.2015.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = scope:2010_mystic
		animation = personality_rational
	}
	immediate = { 
		pilgrimage_2015_outcome_effect = yes 
	}
	#Go debate team!
	option = {
		name = pilgrimage.2015.a
	}
	after = {
		set_local_variable = {
			name = debated_mystic
			value = yes
		}
		# Mystic gets out with the Pilgrim trait for flavor
		hidden_effect = {
			scope:2010_mystic = {
				if = {
					limit = {
						NOT = { has_trait = pilgrim }
					}
					add_trait = pilgrim
				}
			}
		}
		current_travel_plan = { resume_travel_plan = yes }
		remove_character_flag = in_pilgrimage_event_chain
	}
}

scripted_trigger pilgrimage_2020_suitable_thief = {
	is_healthy = yes
	AND = {
		age >= 6
		age <= 25
	}
	has_trait = greedy
	OR = {
		has_trait = deceitful
		has_trait = cynical
	}
	OR = {
		NOT = { has_trait = zealous }
		any_secret = {
			type = secret_non_believer
		}
	}
	is_lowborn = yes
}

#Pilgrimage thieves
# by Filippa Gannholm Kirsten
pilgrimage.2020 = {
	type = character_event
	title = pilgrimage.2020.t
	desc = {
		desc = pilgrimage.2020.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:thief_to_convert = { is_adult = yes }
				}
				desc = pilgrimage.2020.desc_adult
			}
			triggered_desc = {
				trigger = {
					scope:thief_to_convert = { is_adult = no }
				}
				desc = pilgrimage.2020.desc_child
			}
		}
	}
	theme = travel_pilgrimage
	override_background = { reference = bp1_bonfire }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_trait = cynical }
			animation = personality_cynical
		}
		triggered_animation = {
			trigger = {
				NOT = {
					any_secret = { type = secret_non_believer }
				}
				has_trait = zealous
			}
			animation = personality_zealous
		}
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = wrathful
					has_trait = irritable
					has_trait = vengeful
				}
			}
			animation = anger
		}
		animation = personality_coward
	}
	right_portrait = {
		character = scope:thief_to_convert
		animation = fear
	}
	cooldown = { years = 2 }
	trigger = {
		#Only if you're an established pilgrim
		has_trait = pilgrim
		is_location_valid_for_travel_event_on_land = yes
	}
	immediate = {
		if = {
			limit = {
				any_pool_character = { 
					province = root.location
					pilgrimage_2020_suitable_thief = yes 
				}
			}
			random_pool_character = {
				province = root.location
				limit = { pilgrimage_2020_suitable_thief = yes }
				save_scope_as = thief_to_convert
			}
		}
		else = {
			random_list = {
				#50% it's a child
				50 = {
					create_character = {
						template = child_thief_character
						location = root.location
						age = { 6 15 }
						culture = root.location.county.culture
						faith = root.location.county.faith
						after_creation = {
							set_to_lowborn = yes
						}
						save_scope_as = thief_to_convert
					}
				}
				#Or a young adult
				50 = {
					create_character = {
						template = generic_peasant_character
						location = root.location
						age = { 16 25 }
						culture = root.location.county.culture
						faith = root.location.county.faith
						after_creation = {
							set_to_lowborn = yes
						}
						save_scope_as = thief_to_convert
					}
				}
			}
			scope:thief_to_convert = { add_character_flag = created_thief }
		}
		scope:thief_to_convert = { add_character_flag = use_stealth_clothes }
	}
	#Have them join you
	option = { 
		name = {
			trigger = {
				scope:thief_to_convert = { is_adult = no }
			}
			text = pilgrimage.2020.a_child
		}
		name = {
			trigger = {
				scope:thief_to_convert = { is_adult = yes }
			}
			text = pilgrimage.2020.a
		}
		#We should be a nice and approachable person
		trigger = {
			has_trait = pilgrim
			OR = {
				has_trait = family_first
				has_trait = forgiving
			}
			NOR = {
				has_trait = sadistic
				has_trait = callous
			}
		}
		flavor = pilgrimage.2020.a.flavor
		bonus_to_all_types_effect = yes
		if = {
			limit = {
				faith = { trait_is_virtue = forgiving }
			}
			add_piety = medium_piety_gain
		}
		else_if = {
			limit = {
				faith = { trait_is_virtue = vengeful }
			}
			add_piety = minor_piety_loss
		}
		else = { add_piety = minor_piety_gain }
		#Hook 'em'
		if = {
			limit = {
				can_add_hook = {
					target = scope:thief_to_convert
					type = loyalty_hook
				}
			}
			add_hook = {
				target = scope:thief_to_convert
				type = loyalty_hook
			}
		}
		add_to_entourage_court_and_activity_effect = { 
			CHAR_TO_ADD = scope:thief_to_convert 
			NEW_COURT_OWNER = root 
		}
		scope:thief_to_convert = {
			#Add them to your family
			if = {
				limit = { is_adult = no }
				if = {
					limit = {
						root = { is_male = yes }
					}
					set_father = root
				}
				else = { set_mother = root }
				set_house = root.house
				add_opinion = {
					modifier = grateful_child
					target = root
					opinion = 40
				}
			}
			else = {
				add_opinion = {
					modifier = grateful_opinion
					target = root
					opinion = 40
				}
			}
			add_character_flag = recruited_thief
		}
		stress_impact = {
			paranoid = medium_stress_impact_gain
			wrathful = medium_stress_impact_gain
			vengeful = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				OR = {
					has_trait = paranoid
					has_trait = wrathful
					has_trait = vengeful
				}
				factor = 0
			}
			ai_value_modifier = {
				ai_compassion = 2
				ai_honor = 1
			}
		}
	}
	#Try to convert them
	option = { 
		name = pilgrimage.2020.b
		trigger = {
			religion = { is_in_family = rf_abrahamic }
		}
		pious_type_option_effect = yes
		duel = {
			skill = diplomacy
			value = average_skill_rating
			#Implore them to change their ways
			50 = {
				desc = pilgrimage.2020.b.success.desc
				compare_modifier = {
					value = scope:duel_value
					multiplier = 5
				}
				modifier = {
					has_perk = zealous_proselytizer_perk
					factor = 2
				}
				modifier = {
					has_trait = zealous
					add = 10
				}
				modifier = {
					has_trait = cynical
					add = -10
				}
				scope:thief_to_convert = { add_character_flag = convinced_thief }
				custom_tooltip =  pilgrimage.2020.b.success.tt
				hidden_effect = {
					current_travel_plan = { delay_travel_plan = { days = 90 } }
				}
				trigger_event = {
					id = pilgrimage.2021
					days = 3
				}
			}
			#You fail and they run away
			50 = {
				desc = pilgrimage.2020.b.failure.desc
				compare_modifier = {
					value = scope:duel_value
					multiplier = -5
					min = -5
				}
				send_interface_toast = {
					title = pilgrimage.2020.b.failure.t
					left_icon = root
					remove_short_term_gold = minor_gold_value
				}
			}
		}
		stress_impact = {
			cynical = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = cynical
				factor = 0
			}
			ai_value_modifier = {
				ai_zeal = 2
				ai_boldness = 1
				ai_honor = 1
				ai_vengefulness = -2
			}
		}
	}
	#Let them go in peace
	option = { 
		#What will God say about that...
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.2020.c_cynical
		}
		#We all do what we must
		name = pilgrimage.2020.c
		worldly_type_option_effect = yes
		remove_short_term_gold = minor_gold_value
		stress_impact = {
			greedy = minor_stress_impact_gain
			forgiving = medium_stress_impact_loss
			cynical = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = -1
				ai_boldness = -0.5
			}
		}
	}
	after = {
		scope:thief_to_convert = {
			if = {
				limit = { 
					has_character_flag = created_thief
					NOR = {
						has_character_flag = recruited_thief
						has_character_flag = convinced_thief
					}
				}
				if = {
					limit = {
						root = { is_ai = yes }
					}
					silent_disappearance_effect = yes
				}
			}
			else = { remove_character_flag = use_stealth_clothes }
		}
	}
}

pilgrimage.2021 = {
	type = character_event
	title = pilgrimage.2021.t
	desc = pilgrimage.2021.desc
	theme = travel_pilgrimage
	override_background = { reference = bp1_bonfire }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_trait = sadistic }
			animation = personality_dishonorable
		}
		animation = thinking
	}
	right_portrait = {
		character = scope:thief_to_convert
		animation = shame
	}
	immediate = {
		scope:thief_to_convert = {
			remove_character_flag = recruited_thief
			remove_character_flag = convinced_thief
		}
		hidden_effect = {
			current_travel_plan = { resume_travel_plan = yes }
		}
	}
	#Convert them to your faith and have them spread the word
	option = { 
		name = pilgrimage.2021.a
		pious_type_option_effect = yes
		add_character_modifier = {
			modifier = pilgrimage_religion_spread_modifier
			years = 5
		}
		scope:thief_to_convert = {
			if = {
				limit = {
					root.faith != this.faith
				}
				set_character_faith = root.faith
			}
		}
		stress_impact = {
			zealous = medium_stress_impact_loss
			cynical = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = zealous
				factor = 2
			}
			modifier = {
				has_trait = cynical
				factor = 0
			}
			ai_value_modifier = {
				ai_zeal = 2
			}
		}
	}
	#Whips always make _me_ feel better
	option = {
		name = pilgrimage.2021.b
		trigger = {
			OR = {
				OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
				religion = religion:judaism_religion
			}
			OR = {
				has_trait = flagellant
				has_trait = sadistic
			}
			scope:thief_to_convert = { is_adult = yes }
		}
		pious_type_option_effect = yes
		add_dread = medium_dread_gain
		add_character_modifier = {
			modifier = pilgrimage_flogging_spread_modifier
			years = 5
		}
		scope:thief_to_convert = {
			if = {
				limit = {
					root.faith != this.faith
				}
				set_character_faith = root.faith
			}
			add_trait = flagellant
			increase_wounds_no_death_effect = { REASON = flagellant }
		}
		stress_impact = {
			flagellant = major_stress_impact_loss
			sadistic = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = flagellant
				factor = 2
			}
			ai_value_modifier = {
				ai_zeal = 2
			}
		}
	}
	#Have them work off their sins for you
	option = {
		name = pilgrimage.2021.c
		flavor = pilgrimage.2021.c.flavor
		add_character_modifier = {
			modifier = pilgrimage_work_work_modifier
			years = 5
		}
		scope:thief_to_convert = {
			if = {
				limit = {
					can_add_hook = {
						target = scope:thief_to_convert
						type = loyalty_hook
					}
				}
				add_hook = {
					target = scope:thief_to_convert
					type = loyalty_hook
				}
			}
		}
		add_courtier = scope:thief_to_convert
		stress_impact = {
			zealous = medium_stress_impact_gain
			cynical = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = zealous
				factor = 0
			}
			ai_value_modifier = {
				ai_zeal = -2
			}
		}
	}
	after = {
		if = {
			limit = { 
				current_travel_plan ?= { is_paused = yes }
			}
			current_travel_plan = { resume_travel_plan = yes }
		}
	}
}

#Sea: Massive rainbow
# by Filippa Gannholm Kirsten
pilgrimage.2030 = {
	type = character_event
	title = pilgrimage.2030.t
	desc = pilgrimage.2030.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = scholar
					learning > high_skill_rating
				}
			}
			animation = thinking
		}
		triggered_animation = {
			trigger = {
				OR = {
					has_activity_intent = zealot_intent
					AND = {
						has_trait = zealous
						NOT = { 
							any_secret = { type = secret_non_believer }
						}
					}
				}
			}
			animation = personality_zealous
		}
		triggered_animation = {
			trigger = { has_trait = cynical }
			animation = boredom
		}
		animation = admiration
	}
	right_portrait = {
		character = scope:portrait_entourage_character
		animation = disbelief
	}
	trigger = {
		location = { is_sea_province = yes }
		current_travel_plan ?= {
			any_entourage_character = { 
				count > 5 
			}
			any_entourage_character = {
				NOT = {
					is_of_major_or_minor_interest_trigger = { CHARACTER = root }
					this = root
				}
			}
		}
	}
	immediate = {
		current_travel_plan = {
			random_entourage_character = {
				limit = {
					NOT = {
						is_of_major_or_minor_interest_trigger = { CHARACTER = root }
						this = root
					}
				}
				save_scope_as = portrait_entourage_character
			}
		}
	}
	#Acshually...
	option = { 
		name = pilgrimage.2030.a
		trigger = {
			OR = {
				has_trait = scholar
				learning > high_skill_rating
			}
		}
		flavor = pilgrimage.2030.a.flavor
		very_worldly_type_option_effect = yes
		current_travel_plan = {
			every_entourage_character = {
				custom = every_entourage_tt
				add_opinion = {
					target = root
					modifier = pilgrimage_besserwisser_opinion
					opinion = -5
				}
			}
		}
		if = {
			limit = { 
				has_trait = lifestyle_traveler
				has_trait_xp = {
					trait = lifestyle_traveler
					track = travel
					value < 100
				}
			}
			add_trait_xp = {
				trait = lifestyle_traveler
				track = travel
				value = 10
			}
		}
		#Besserwisser gonna besserwiss
		stress_impact = {
			base = medium_stress_impact_loss
		}
		ai_chance = {
			base = 200
			modifier = {
				has_trait = zealous
				factor = 0
			}
		}
	}
	#This IS a sign from God!
	option = {
		name = pilgrimage.2030.b
		trigger = {
			OR = {
				has_activity_intent = zealot_intent
				AND = {
					has_trait = zealous
					NOT = { 
						any_secret = { type = secret_non_believer }
					}
				}
			}
		}
		if = {
			limit = { has_activity_intent = zealot_intent }
			custom_tooltip = available_because_intent_tt
		}
		flavor = pilgrimage.2030.b.flavor
		pious_type_option_effect = yes
		add_piety = miniscule_piety_gain
		if = {
			limit = { 
				has_trait = pilgrim
				has_trait_xp = {
					trait = pilgrim
					value < 100
				}
			}
			add_trait_xp = {
				trait = pilgrim
				value = 5
			}
		}
		stress_impact = {
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = cynical
				factor = 0
			}
		}
	}
	#Reflectors gonna reflect
	option = {
		name = pilgrimage.2030.c
		trigger = { has_activity_intent = reflection_intent }
		custom_tooltip = available_because_intent_tt
		bonus_to_all_types_effect = yes
		add_piety = miniscule_piety_gain
		if = {
			limit = {
				has_trait = lifestyle_mystic
			}
			add_trait_xp = {
				trait = lifestyle_mystic
				value = lifestyle_mystic_xp_gain_minor_value
			}
		}
		stress_impact = {
			base = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}
	#That's cool, I guess
	option = {
		name = pilgrimage.2030.d
		worldly_type_option_effect = yes
		stress_impact = {
			arbitrary = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = zealous
				factor = 0
			}
		}
	}
}

#Sea: Go fish
# by Filippa Gannholm Kirsten
pilgrimage.2040 = {
	type = character_event
	title = pilgrimage.2040.t
	desc = pilgrimage.2040.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:portrait_entourage_character
		animation = personality_content
	}
	trigger = {
		location = { is_sea_province = yes }
		current_travel_plan ?= {
			any_entourage_character = { 
				count > 5 
			}
			any_entourage_character = {
				is_adult = yes
				NOT = {
					is_of_major_or_minor_interest_trigger = { CHARACTER = root }
					this = root
				}
			}
		}
	}
	immediate = {
		current_travel_plan = {
			random_entourage_character = {
				limit = {
					is_adult = yes
					NOT = {
						is_of_major_or_minor_interest_trigger = { CHARACTER = root }
						this = root
					}
				}
				save_scope_as = portrait_entourage_character
			}
		}
	}
	#Fishing!
	option = {
		name = pilgrimage.2040.a
		worldly_type_option_effect = yes
		duel = {
			skill = prowess
			value = average_skill_rating
			#Catch a big fish
			50 = {
				desc = pilgrimage.2040.a.success.desc
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3
					min = -49
				}
				send_interface_toast = {
					title = pilgrimage.2040.a.success.t
					left_icon = root
					if = {
						limit = {
							has_trait = zealous
							NOT = { 
								any_secret = { type = secret_non_believer }
							}
						}
						stress_impact = {
							base = minor_stress_impact_loss
							zealous = minor_stress_impact_gain
						}
					}
					else = {
						stress_impact = {
							base = medium_stress_impact_loss
						}
					}
					add_prestige = medium_prestige_gain
				}	
			}
			#Catch a small fish
			50 = {
				desc = pilgrimage.2040.a.less_success.desc
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3
					min = -49
				}
				send_interface_toast = {
					title = pilgrimage.2040.a.less_success.t
					left_icon = root
					if = {
						limit = {
							has_trait = zealous
							NOT = { 
								any_secret = { type = secret_non_believer }
							}
						}
						stress_impact = {
							base = minor_stress_impact_loss
							zealous = minor_stress_impact_gain
						}
					}
					else = {
						stress_impact = {
							base = minor_stress_impact_loss
						}
					}
					add_prestige = minor_prestige_gain
				}				
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = zealous
				factor = 0
			}
			modifier = {
				has_trait = lazy
				factor = 0
			}
		}
	}
	#Praying!
	option = {
		name = pilgrimage.2040.b
		trigger = {
			OR = {
				has_activity_intent = zealot_intent
				AND = {
					has_trait = zealous
					NOT = { 
						any_secret = { type = secret_non_believer }
					}
				}
			}
		}
		if = {
			limit = { has_activity_intent = zealot_intent }
			custom_tooltip = available_because_intent_tt
		}
		pious_type_option_effect = yes
		add_piety = miniscule_piety_gain
		ai_chance = {
			base = 100
			modifier = {
				has_trait = lazy
				factor = 0
			}
		}
	}
	#Nap time!
	option = {
		name = pilgrimage.2040.c
		trigger = { 
			OR = {
				has_activity_intent = reflection_intent 
				has_trait = lazy
			}
			NOT = { has_character_modifier = pilgrimage_chill_ship_modifier }
		}
		if = {
			limit = { has_activity_intent = reflection_intent }
			custom_tooltip = available_because_intent_tt
		}
		add_character_modifier = {
			modifier = pilgrimage_chill_ship_modifier
			years = 5
		}
		stress_impact = {
			base = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = zealous
				factor = 0
			}
		}
	}
	#Nah
	option = {
		name = pilgrimage.2040.d
		ai_chance = {
			base = 100
			modifier = {
				has_trait = zealous
				factor = 0
			}
		}
	}
}

#Sea: Shipwrecked pilgrims
# by Filippa Gannholm Kirsten
pilgrimage.2050 = {
	type = character_event
	title = pilgrimage.2050.t
	desc = pilgrimage.2050.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		animation = personality_compassionate
	}
	right_portrait = {
		character = scope:first_pilgrim
		animation = pain
	}
	lower_center_portrait = {
		character = scope:second_pilgrim
	}
	lower_right_portrait = {
		character = scope:third_pilgrim
	}
	trigger = {
		location = { is_sea_province = yes }
		is_ai = no
	}
	cooldown = { years = 30 }
	immediate = {
		# Create pilgrims
		hidden_effect = {
			create_character = {
				template = pool_repopulate_local_flavor
				dynasty = none
				trait = pilgrim
				location = root.location
				save_scope_as = first_pilgrim
			}
			scope:first_pilgrim = { set_to_lowborn = yes }
			create_character = {
				template = pool_repopulate_local_flavor
				age = { 6 10 }
				dynasty = none
				faith = scope:first_pilgrim.faith
				culture = scope:first_pilgrim.culture
				location = root.location
				save_scope_as = second_pilgrim
			}
			scope:second_pilgrim = { set_to_lowborn = yes }
			create_character = {
				template = pool_repopulate_local_flavor
				dynasty = none
				faith = scope:first_pilgrim.faith
				culture = scope:first_pilgrim.culture
				trait = pilgrim
				location = root.location
				save_scope_as = third_pilgrim
			}
			scope:third_pilgrim = { set_to_lowborn = yes }
		}
	}
	#Come aboard
	option = {
		name = pilgrimage.2050.a
		worldly_type_option_effect = yes
		custom_tooltip = pilgrimage.2050.a.tt
		#We're not very fond of their culture
		if = {
			limit = {
				root.culture != scope:first_pilgrim.culture
				scope:first_pilgrim = {
					culture = {
						cultural_acceptance = {
							target = root.culture
							value < low_positive_culture_acceptance
						}
					}
				}
			}
			stress_impact = {
				base = minor_stress_impact_loss
				gregarious = minor_stress_impact_loss
				trusting = minor_stress_impact_loss
				compassionate = medium_stress_impact_loss
				paranoid = medium_stress_impact_gain
			}
		}
		#We're OK with their culture
		else = {
			stress_impact = {
				base = medium_stress_impact_loss
				gregarious = medium_stress_impact_loss
				trusting = medium_stress_impact_loss
				compassionate = medium_stress_impact_loss
				paranoid = minor_stress_impact_gain
			}
		}
		scope:first_pilgrim = { add_to_court_and_entourage_effect = yes }
		scope:second_pilgrim = { add_to_court_and_entourage_effect = yes }
		scope:third_pilgrim = { add_to_court_and_entourage_effect = yes }
		ai_chance = {
			base = 100
			modifier = {
				has_trait = paranoid
				factor = 0
			}
			modifier = {
				short_term_gold < minor_gold_value
				factor = 0
			}
		}
	}
	#...if you convert
	option = {
		name = pilgrimage.2050.b
		trigger = {
			faith = { has_doctrine = doctrine_pluralism_pluralistic }
			faith != scope:first_pilgrim.faith
		}
		duel = {
			skill = learning
			target = scope:first_pilgrim
			#Success
			60 = {
				desc = pilgrimage.2050.b.success.desc
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3
					min = -49
				}
				modifier = {
					has_perk = zealous_proselytizer_perk
					add = 25
				}
				modifier = {
					has_trait = zealous
					add = 25
				}
				send_interface_toast = {
					title = pilgrimage.2050.b.success.t
					left_icon = root
					right_icon = scope:first_pilgrim
					desc = pilgrimage.2050.b.success.desc
					add_piety = medium_piety_gain
					very_pious_type_option_effect = yes
				}
				#Keeping this outside of the toast so as to not cut off the toast
				scope:first_pilgrim = { add_to_court_and_entourage_effect = yes }
				scope:second_pilgrim = { add_to_court_and_entourage_effect = yes }
				scope:third_pilgrim = { add_to_court_and_entourage_effect = yes }
				scope:first_pilgrim = {
					set_character_faith = root.faith
				}
				scope:second_pilgrim = {
					set_character_faith = root.faith
				}
				scope:third_pilgrim = {
					set_character_faith = root.faith
				}
			}
			#Failure
			40 = {
				desc = pilgrimage.2050.b.failure.desc
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3
					min = -49
				}
				send_interface_toast = {
					title = pilgrimage.2050.b.failure.t
					left_icon = root
					add_prestige = medium_prestige_loss
				}
				scope:first_pilgrim = { death = { death_reason = death_drowned } }
				scope:second_pilgrim = { death = { death_reason = death_drowned } }
				scope:third_pilgrim = { death = { death_reason = death_drowned } }			
			}
		}
		stress_impact = {
			humble = minor_stress_impact_gain
			shy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}
	#... let's just move on
	option = {
		name = pilgrimage.2050.c
		add_dread = minor_dread_gain
		current_travel_plan = {
			every_entourage_character = {
				custom = every_entourage_tt
				add_opinion = {
					target = root
					modifier = cruelty_opinion
					opinion = -15
				}
			}
		}
		scope:first_pilgrim = { death = { death_reason = death_drowned } }
		scope:second_pilgrim = { death = { death_reason = death_drowned } }
		scope:third_pilgrim = { death = { death_reason = death_drowned } }		
		stress_impact = {
			paranoid = medium_stress_impact_loss
			callous = medium_stress_impact_loss
			sadistic = medium_stress_impact_loss
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = compassionate
				factor = 0
			}
			modifier = {
				has_trait = trusting
				factor = 0
			}
		}
	}
}

############################
## 'Temptation' Events
# 2500-2999
## by Bianca Savazzi & Sean Hughes
############################
# pilgrimage.2101 - Rakish or Lustful character considers making a pit stop, or perhaps, a detour to the local brothels
# pilgrimage.2501-4 - Persistent Beggar
# pilgrimage.2511 - Cocky Lordling
#
#

scripted_effect pilgrimage_2101_save_scopes_effect = {
	location = { save_scope_as = brothel_location }
	trigger_event = {
		id = lover.8102
		days = 30
	}
}

#Rakish or Lustful character considers making a pit stop, or perhaps, a detour to the local brothels
# by Bianca Savazzi
pilgrimage.2101 = {
	type = character_event
	title = pilgrimage.2101.t
	desc = { 
		desc = pilgrimage.2101.desc
	}
	cooldown = { years = 5 }
	theme = travel_pilgrimage
	override_background = { reference = tavern }
	left_portrait = {
		character = root
		animation = interested
	}
	right_portrait = {
		character = scope:naked_tempter
		animation = fanning_coyly
	}
	trigger = {
		stress > 0
		OR = {
			has_trait = lustful
			has_trait = rakish
		}
		is_location_valid_for_travel_event_on_land = yes
		might_cheat_on_every_partner_trigger = yes
	}
	immediate = {
		add_character_flag = {
			flag = no_sex_stress_loss
			days = 30
		}
		random_list = {
			50 = {
				# Spawn a temptress for event if....
				trigger = {
					OR = {
						#lesbian
						AND = {
							is_female = yes
							has_sexuality = homosexual
						}
						#straight or asexual guy 
						AND = {
							is_male = yes
							OR = {
								has_sexuality = heterosexual
								has_sexuality = asexual
							}
						}
						#asexual woman and homo is ok 
						AND = {
							has_sexuality = asexual
							is_female = yes 
							faith = { has_doctrine = doctrine_homosexuality_accepted }
						}
						#bisexual
						has_sexuality = bisexual
					}
				}
				create_character = {
					age = 30
					gender = female
					location = root.location
					faith = root.location.faith
					culture = root.location.culture
					dynasty = none
					random_traits = no
					random_traits_list = {
						count = 2
						deceitful = {}
						brave = {}
						gregarious = {}
						ambitious = {}
						vengeful = {}
						gluttonous = {}
						temperate  = {}
						greedy = {}
						generous = {}
						lazy = {}
						diligent = {}
						wrathful = {}
						calm = {}
						patient = {}
						impatient = {}
						arrogant = {}
						honest = {}
						arbitrary = {}
						just = {}
						paranoid = {}
						trusting = {}
						compassionate = {}
						callous = {}
						sadistic = {}
						stubborn = {}
						fickle = {}
						forgiving = {}
					}
					trait = lustful
					trait = rakish
					trait = deviant
					trait = fecund
					trait = beauty_good_3
					save_scope_as = naked_tempter
				}
			}
			50 = {
				# Spawn a tempter for event if....
				trigger = {
					OR = {
						#gay
						AND = {
							is_male = yes
							has_sexuality = homosexual
						}
						#straight or asexual woman 
						AND = {
							is_female = yes
							OR = {
								has_sexuality = asexual
								has_sexuality = heterosexual
							}
						}
						#asexual man and homo is ok 
						AND = {
							has_sexuality = asexual
							is_male = yes 
							faith = { has_doctrine = doctrine_homosexuality_accepted }
						}
						#bisexual
						has_sexuality = bisexual
					}
				}
				create_character = {
					age = 30
					gender = male
					location = root.location
					faith = root.location.faith
					culture = root.location.culture
					dynasty = none
					random_traits = no
					random_traits_list = {
						count = 2
						deceitful = {}
						brave = {}
						gregarious = {}
						ambitious = {}
						vengeful = {}
						gluttonous = {}
						temperate  = {}
						greedy = {}
						generous = {}
						lazy = {}
						diligent = {}
						wrathful = {}
						calm = {}
						patient = {}
						impatient = {}
						arrogant = {}
						honest = {}
						arbitrary = {}
						just = {}
						paranoid = {}
						trusting = {}
						compassionate = {}
						callous = {}
						sadistic = {}
						stubborn = {}
						fickle = {}
						forgiving = {}
					}
					trait = lustful
					trait = rakish
					trait = deviant
					trait = fecund
					trait = beauty_good_3
					save_scope_as = naked_tempter
				}
			}
		}
		scope:naked_tempter = {
			add_character_flag = is_naked
		}
	}
	#Option A: Visit one brothel
	option = {
		name = pilgrimage.2101.a
		if = {
			limit = {
				faith = { trait_is_virtue = lustful }
			}
			pious_type_option_effect = yes
			add_piety = minor_piety_gain
		}
		else_if = {
			limit = {
				faith = { trait_is_sin = lustful }
			}
			worldly_type_option_effect = yes
			add_piety = medium_piety_loss
		}
		add_stress = medium_stress_loss
		had_sex_with_effect = {
			CHARACTER = scope:naked_tempter
			PREGNANCY_CHANCE = pregnancy_chance
		}
		add_to_entourage_court_and_activity_effect = { 
			CHAR_TO_ADD = scope:naked_tempter 
			NEW_COURT_OWNER = root 
		}
		hidden_effect = {
			#STD transmission
			random_list = {
				50 = {
					trigger = { is_attracted_to_men = yes }
					had_sex_with_unknown_effect = { GENDER = male }
				}
				50 = {
					trigger = { is_attracted_to_women = yes }
					had_sex_with_unknown_effect = { GENDER = female }
				}
			}
			if = {
				limit = {
					NOT = {
						government_has_flag = government_is_mandala
						house ?= { has_house_power_parameter = aspect_of_creation }
					}
				}
				random = {
					chance = 33
					pilgrimage_2101_save_scopes_effect = yes
				}
			}
		}
		ai_chance = {
			base = 10	
			ai_value_modifier = {
				ai_energy = 0.5
				ai_greed = -1
			}
			modifier = {
				NOR = {
					is_married = no
					any_spouse = {
						count = all
						save_temporary_scope_as = partner
						root = { might_cheat_on_partner_trigger = { PARTNER = scope:partner } }
					}
				}
				factor = 0
			}
		}
	}
	#Option B: Visit ALL brothels!
	option = {
		name = pilgrimage.2101.b
		if = {
			limit = {
				faith = { trait_is_virtue = lustful }
			}
			pious_type_option_effect = yes
			add_piety = medium_piety_gain
		}
		else_if = {
			limit = {
				faith = { trait_is_sin = lustful }
			}
			worldly_type_option_effect = yes
			add_piety = major_piety_loss
		}
		remove_short_term_gold = tiny_gold_value
		rakish_brothel_night_effect = yes
		had_sex_with_effect = {
			CHARACTER = scope:naked_tempter
			PREGNANCY_CHANCE = pregnancy_chance
		}
		add_to_entourage_court_and_activity_effect = { 
			CHAR_TO_ADD = scope:naked_tempter 
			NEW_COURT_OWNER = root 
		}
		hidden_effect = {
			if = {
				limit = {
					NOT = {
						government_has_flag = government_is_mandala
						house ?= { has_house_power_parameter = aspect_of_creation }
					}
				}
				random = {
					chance = 75
					pilgrimage_2101_save_scopes_effect = yes
				}
			}
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = 2
				ai_energy = 2
				ai_greed = -2
			}
			modifier = {
				factor = 0
				short_term_gold < minor_gold_value #AI should not spend money they don't have
			}
			modifier = {
				NOR = {
					is_married = no
					any_spouse = {
						count = all
						save_temporary_scope_as = partner
						root = { might_cheat_on_partner_trigger = { PARTNER = scope:partner } }
					}
				}
				factor = 0
			}
		}
	}
	#Option C: Stay away from the houses of pleasure
	option = {
		name = pilgrimage.2101.c
		if = {
			limit = {
				faith = { trait_is_sin = lustful }
			}
			add_piety = miniscule_piety_gain
			pious_type_option_effect = yes
		}
		else_if = {
			limit = {
				faith = { trait_is_virtue = lustful }
			}
			add_piety = minor_piety_loss
		}
		else = {
			add_piety = miniscule_piety_gain
		}
		stress_impact = {
			base = minor_stress_impact_gain
			lustful = minor_stress_impact_gain #gets added on top of the base
			rakish = medium_stress_impact_gain #gets added on top of the base
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_greed = 2
				ai_energy = -1
			}
		}
	}
	after = {
		remove_character_flag = no_sex_stress_loss
		scope:naked_tempter = {
			remove_character_flag = is_naked
		}
		if = {
			limit = {
				is_ai = yes
			}
			scope:naked_tempter = {
				if = {
					limit = {
						root = { is_ai = yes }
					}
					silent_disappearance_effect = yes
				}
			}
		}
	}	
}

scripted_effect generosity_piety_stress_effect = {
	if = {
		limit = {
			faith = {
				OR = {
					trait_is_virtue = generous
					trait_is_virtue = compassionate
				}
			}
		}
		pious_type_option_effect = yes
		add_piety = miniscule_piety_gain
	}
	else_if = {
		limit = {
			faith = { trait_is_sin = generous }
		}
		add_piety = minor_piety_loss
	}

	stress_impact = {
		greedy = minor_stress_gain
		callous = minor_stress_gain
		arrogant = minor_stress_gain
		vengeful = minor_stress_gain
	}	
}

scripted_effect parsimony_piety_stress_effect = {
	if = {
		limit = {
			faith = { trait_is_sin = generous }
		}
		add_piety = miniscule_piety_gain
	}
	else_if = {
		limit = {
			faith = {
				OR = {
					trait_is_virtue = generous
					trait_is_virtue = compassionate
				}
			}
		}
		add_piety = minor_piety_loss
	}

	stress_impact = {
		generous = medium_stress_gain
		compassionate = minor_stress_gain
		forgiving = minor_stress_gain
		trusting = minor_stress_gain
	}
}

#Persistent Beggar
# by Sean Hughes
pilgrimage.2501 = {
	type = character_event
	title = pilgrimage.2501.t
	desc = {
		desc = pilgrimage.2501.desc.opening
		first_valid = {	
			triggered_desc = {
				trigger = { faith = { trait_is_virtue = generous } }
				desc = pilgrimage.2501.desc.virtue.generous
			}
			triggered_desc = {
				trigger = { faith = { trait_is_sin = generous } }
				desc = pilgrimage.2501.desc.sin.generous
			}
			triggered_desc = {
				trigger = { faith = { trait_is_virtue = compassionate } }
				desc = pilgrimage.2501.desc.virtue.compassionate
			}
		}
	}
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		animation = steward
	}
	right_portrait = {
		character = scope:beggar
		animation = beg
		outfit_tags = { beggar_rags }
	}
	cooldown = { years = 5 }
	trigger = {
		OR = {
			AND = {
				faith = { trait_is_virtue = generous }
				NOT = {	has_trait = generous }
				OR = {
					has_trait = greedy
					has_trait = callous
					has_trait = arrogant
					has_trait = vengeful
				}
			}
			AND = {
				faith = { trait_is_virtue = compassionate }
				NOT = {	has_trait = compassionate }
				OR = {
					has_trait = greedy
					has_trait = callous
					has_trait = arrogant
					has_trait = vengeful
				}
			}
			AND = {
				faith = { trait_is_sin = generous }
				has_trait = generous
			}
		}
		is_location_valid_for_travel_event_on_land = yes
	}
	immediate = {
		create_character = {
			age = 31
			gender_female_chance = 0.5
			trait = education_intrigue_1
			trait = stubborn
			diplomacy = 8
			martial = 3
			stewardship = 4
			intrigue = 8
			learning = 1
			random_traits_list = {
				count = 2
				compassionate = {}
				gregarious = {}
				deceitful = {}
				generous = {}
				content = {}
				greedy = {}
				just = {}
			}
			random_traits = yes
			location = root.location
			faith = root.faith # They 'convert' if they ever join your court.
			culture = root.location.culture
			save_scope_as = beggar
		}
		scope:beggar = {
			add_character_flag = peasant_outfit
		}
	}
	#Give gold
	option = {
		name = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = generous
						trait_is_virtue = compassionate
					}
				}
			}
			text = pilgrimage.2501.a.virtue
		}
		name = {
			trigger = { 
				faith = { trait_is_sin = generous } 
			}
			text = pilgrimage.2501.a.sin
		}
		trigger = {
			OR = {
				is_ai = no
				short_term_gold >= minor_gold_value
			}
		}
		pay_short_term_gold = {
			target = scope:beggar
			gold = minor_gold_value
		}
		generosity_piety_stress_effect = yes
		add_character_flag = {
			flag = pilgrimage_2501_gave_gold
			days = 3
		}
		trigger_event = pilgrimage.2502
	}
	#Go away
	option = {
		name = pilgrimage.2501.b
		parsimony_piety_stress_effect = yes
		trigger_event = pilgrimage.2502
	}
	#Die!
	option = {
		name = pilgrimage.2501.c.arrogant
		trigger = { has_trait = arrogant }
		scope:beggar = {
			death = {
				killer = root
				death_reason = death_execution
			}
		}
		add_dread = minor_dread_gain
	}
}

#Beggar wants another favor for their sister
pilgrimage.2502 = {
	type = character_event
	title = pilgrimage.2502.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = pilgrimage_2501_gave_gold
				}
				desc = pilgrimage.2502.desc.gave
			}
			desc = pilgrimage.2502.desc.refused
		}
		desc = pilgrimage.2502.desc.end
	}
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		animation = steward
	}
	right_portrait = {
		character = scope:beggar
		animation = beg
		outfit_tags = { beggar_rags }
	}
	# Option A: Relent and give the beggar (more) money.
	option = {
		name = pilgrimage.2502.a
		trigger = {
			OR = {
				is_ai = no
				short_term_gold >= minor_gold_value
			}
		}
		pay_short_term_gold = {
			target = scope:beggar
			gold = minor_gold_value
		}
		generosity_piety_stress_effect = yes
		if = {
			limit = {
				has_character_flag = pilgrimage_2501_gave_gold
			}
			trigger_event = pilgrimage.2503
		}
		else = {
			hidden_effect = {
				scope:beggar = {
					death = {
						death_reason = death_vanished
					}
				}
			}
		}
	}
	# Option B (Special): Refuse, losing Generous and gaining Callous
	option = {
		name = pilgrimage.2502.b
		trigger = {
			NOT = { has_character_flag = pilgrimage_2501_gave_gold }
			faith = { trait_is_sin = generous }
			has_trait = generous
			NOR = {
				has_trait = callous
				has_trait = compassionate
				has_trait = sadistic
			}
		}
		remove_trait = generous
		add_trait = callous
		stress_impact = {
			base = major_stress_impact_gain
		}
		hidden_effect = {
			scope:beggar = {
				death = {
					death_reason = death_vanished
				}
			}
		}
	}
	# Option C: Refuse the beggar's second request, normal effects.
	option = {
		name = {
			trigger = { has_character_flag = pilgrimage_2501_gave_gold }
			text = pilgrimage.2502.c.gave
		}
		name = {
			trigger = {
				NOT = {
					has_character_flag = pilgrimage_2501_gave_gold
				}
			}
			text = pilgrimage.2502.c.refused
		}
		parsimony_piety_stress_effect = yes
		hidden_effect = {
			scope:beggar = {
				death = {
					death_reason = death_vanished
				}
			}
		}
	}
}

#Beggar wants favor for sisters children
pilgrimage.2503 = {
	type = character_event
	title = pilgrimage.2503.t
	desc = pilgrimage.2503.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		animation = steward
	}
	right_portrait = {
		character = scope:beggar
		animation = beg
		outfit_tags = { beggar_rags }
	}

	option = {
		trigger = {
			OR = {
				is_ai = no
				short_term_gold >= minor_gold_value
			}
		}
		name = pilgrimage.2503.a
		pay_short_term_gold = {
			target = scope:beggar
			gold = minor_gold_value
		}
		generosity_piety_stress_effect = yes
		trigger_event = {
			id = pilgrimage.2504
			days = 0
		}
	}

	option = {
		name = pilgrimage.2503.b

		parsimony_piety_stress_effect = yes
	}

}
#Happy beggar
pilgrimage.2504 = {
	type = character_event
	title = pilgrimage.2504.t
	desc = pilgrimage.2504.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		animation = steward
	}
	right_portrait = {
		character = scope:beggar
		animation = beg
		outfit_tags = { beggar_rags }
	}
	#Add trait option
	option = {
		show_unlock_reason = no
		trigger = {
			OR = {
				is_ai = no
				short_term_gold >= medium_gold_value
			}
			OR = {
				# Must be able to replace a personality trait with either Generous...
				AND = {
					faith = {
						trait_is_virtue = generous
					}
					NOT = {	has_trait = generous }
					OR = {
						has_trait = greedy
						has_trait = callous
						has_trait = arrogant
						has_trait = vengeful
					}
				}
				# ...or with Compassionate
				AND = {
					faith = {
						trait_is_virtue = compassionate
					}
					NOR = {
						has_trait = compassionate
						has_trait = sadistic
					}
					OR = {
						has_trait = callous
						has_trait = greedy
						has_trait = arrogant
						has_trait = vengeful
					}
				}
			}
		}
		name = pilgrimage.2504.a
		flavor = pilgrimage.2504.a.flavor
		pious_type_option_effect = yes
		remove_short_term_gold = medium_gold_value
		if = {
			limit = {
				faith = {
					trait_is_virtue = generous
				}
				NOT = {	has_trait = generous }
			}
			if = {
				limit = { has_trait = greedy }
				remove_trait = greedy
			}
			else_if = {
				limit = { has_trait = callous }
				remove_trait = callous
			}
			else_if = {
				limit = { has_trait = arrogant }
				remove_trait = arrogant
			}
			else_if = {
				limit = { has_trait = vengeful }
				remove_trait = vengeful
			}
			stress_impact = {
				base = major_stress_impact_gain
			}
			add_trait_force_tooltip = generous
		}
		else = {
			if = {
				limit = { has_trait = callous }
				remove_trait = callous
			}
			else_if = {
				limit = { has_trait = greedy }
				remove_trait = greedy
			}
			else_if = {
				limit = { has_trait = arrogant }
				remove_trait = arrogant
			}
			else_if = {
				limit = { has_trait = vengeful }
				remove_trait = vengeful
			}
			stress_impact = {
				base = major_stress_impact_gain
			}
			add_trait_force_tooltip = compassionate
		}
	}
	#Hook/courtier option
	option = {
		name = pilgrimage.2504.b
		add_courtier = scope:beggar
		scope:beggar = {
			add_opinion = {
				modifier = grateful_opinion
				target = root
				opinion = 50
			}
			add_trait = loyal
		}
		add_hook = {
 			type = loyalty_hook
			target = scope:beggar
 	 	}
	}
	#Dismiss them
	option = {
		name = {
			trigger = { 
				faith = { trait_is_virtue = generous } 
			}
			text = pilgrimage.2504.c.virtue
		}
		name = {
			trigger = { 
				faith = { trait_is_sin = generous } 
			}
			text = pilgrimage.2504.c.sin
		}
		very_pious_type_option_effect = yes
		add_piety = miniscule_piety_gain
		hidden_effect = {
			scope:beggar = {
				death = {
					death_reason = death_vanished
				}
			}
		}
	}
}

scripted_trigger pilgrimage_2511_valid_lordling = {
	is_available = yes
	ai_compassion < 0
	age >= 13
	highest_held_title_tier < root.highest_held_title_tier
	NOR = {
		has_trait = shy
		has_trait = humble
	}
	OR = {
		has_trait = arrogant
		has_trait = arbitrary
		has_trait = sadistic
		has_trait = wrathful
		has_trait = vengeful
	}
	religion = root.religion
	location = root.location
}

#Cocky Lordling
# by Sean Hughes
pilgrimage.2511 = {
	type = character_event
	title = pilgrimage.2511.t
	desc = {
		desc = pilgrimage.2511.desc.start
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
					faith = { trait_is_sin = vengeful }
				}
				desc = pilgrimage.2511.desc.vengeful.christian
			}
			triggered_desc = {
				trigger = {
					faith = { trait_is_sin = vengeful }
				}
				desc = pilgrimage.2511.desc.vengeful
			}
			triggered_desc = {
				trigger = {
					faith = { trait_is_sin = wrathful }
				}
				desc = pilgrimage.2511.desc.wrathful
			}
		}
	}
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		animation = disapproval
	}
	right_portrait = {
		character = scope:lordling
		animation = anger
	}
	cooldown = { years = 2 }
	trigger = {
		OR = {
			# Potentially perf-heavy, restricted to players and important AIs.
			is_ai = no
			highest_held_title_tier >= tier_kingdom
		}
		# Character personality must conflict at least somewhat with their faith's relevant virtue(s).
		faith = {
			OR = {
				trait_is_sin = wrathful
				trait_is_sin = vengeful
			}
		}
		OR = {
			has_trait = wrathful
			has_trait = vengeful
			has_trait = arrogant
		}
		NOR = {
			has_trait = forgiving
			has_trait = humble
			has_trait = calm
		}
		# Ensure a valid target exists for the event.
		location = {
			county.holder ?= {
				OR = {
					pilgrimage_2511_valid_lordling = yes
					AND = {
						primary_heir ?= {
							pilgrimage_2511_valid_lordling = yes
						}
					}
				}
			}
		}
		is_location_valid_for_travel_event_on_land = yes
	}
	immediate = {
		# Compile a list of possible lordlings.
		location = {
			county.holder = {
				if = {
					limit = { pilgrimage_2511_valid_lordling = yes }
					add_to_list = arrogant_lordlings
				}
				if = {
					limit = { exists = primary_heir }
					primary_heir = {
						if = {
							limit = {
								pilgrimage_2511_valid_lordling = yes
								NOT = { is_in_list = arrogant_lordlings }
							}
							add_to_list = arrogant_lordlings
						}
					}
				}
				every_vassal = {
					if = {
						limit = {
							pilgrimage_2511_valid_lordling = yes
							NOT = { is_in_list = arrogant_lordlings }
						}
						add_to_list = arrogant_lordlings
					}
					if = {
						limit = { exists = primary_heir }
						primary_heir = {
							if = {
								limit = {
									pilgrimage_2511_valid_lordling = yes
									NOT = { is_in_list = arrogant_lordlings }
								}
								add_to_list = arrogant_lordlings
							}
						}
					}
				}
			}
		}
		random_in_list = {
			list = arrogant_lordlings
			# Prefer to select characters who are not powerful yet, but could become powerful.
			limit = {
				any_heir_title = {
					tier >= root.highest_held_title_tier
				}
			}
			alternative_limit = {
				any_heir_title = {
					tier = tier_duchy
				}
			}
			alternative_limit = {
				always = yes
			}

			weight = {
				base = 1

				# Trait modifiers - between +158 and +0, depending on traits
				modifier = {
					has_trait = arrogant
					add = 100
				}
				modifier = {
					has_trait = wrathful
					add = 33
				}
				modifier = {
					has_trait = sadistic
					add = 25
				}

				# Age modifiers - between +75 (at 13 years old) and +0 (at 28 years old)
				modifier = {
					add = {
						value = 28
						subtract = age
						multiply = 5
						min = 0
					}
				}
			}

			save_scope_as = lordling
		}
	}
	#Fight!
	option = {
		name = pilgrimage.2511.a
		worldly_type_option_effect = yes
		add_prestige = minor_prestige_gain
		scope:lordling = {
			increase_wounds_effect = { REASON = fight }
		}
		progress_towards_rival_effect = {
			CHARACTER = scope:lordling
			REASON = rival_pilgrimage_lordling
			OPINION = 0
		}
	}
	#Go 4 athletic
	option = {
		name = pilgrimage.2511.c
		trigger = {
			has_traits_that_negate_athletic_trigger = no #Are we already athletic or does any of our traits contradict athletic?
			health >= 2.0
		}
		add_prestige = minor_prestige_loss
		stress_impact = {
			base = massive_stress_impact_gain
		}
		add_trait = athletic
	}
	#Calm down
	option = {
		name = pilgrimage.2511.b
		pious_type_option_effect = yes
		add_prestige = minor_prestige_loss
		add_piety = miniscule_piety_gain
		stress_impact = {
			arrogant = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
			vengeful = minor_stress_impact_gain
		}
	}
}

################################
# Religion-specific Journey Events
# 3001-3999
# by Sean Hughes
################################
# 3001-3100: Christianity
# pilgrimage.3001 - Zealous priest giving sermon in freezing rains
# pilgrimage.3002-3 - Naked preacher claiming to have reclaimed the lost innocence of Adam & Eve
# pilgrimage.3004 - Doomsayer claiming the end is nigh!
#
# 3101-3200: Islam
# pilgrimage.3102 - Ziyarat - Why am I taking this pilgrimage?
#
# 3201-3300: Hinduism
# pilgrimage.3201 - Ritual purification in a river
# pilgrimage.3202 - Contemplating the universe
#
# 3301-3400: Buddhism
# pilgrimage.3301 - Critical Wanderer
# pilgrimage.3302 - The Wisdom of Goats
# pilgrimage.3303 - Kalama Sutta
#
## 3401-3500: Dharmic
# pilgrimage.3401 - Brahmacharya Challenged
#
###3001-3100: Christianity
#Zealous priest giving sermon in freezing rains
# by Sean Hughes
pilgrimage.3001 = {
	type = character_event
	title = pilgrimage.3001.t
	desc = pilgrimage.3001.desc
	theme = travel_pilgrimage
	override_background = { reference = terrain_travel }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_trait = cynical }
			animation = personality_cynical
		}
		triggered_animation = {
			trigger = { has_trait = zealous }
			animation = admiration
		}
		animation = personality_honorable
	}
	right_portrait = {
		character = scope:zealous_priest
		animation = personality_zealous
		outfit_tags = { bishop_outfit }
	}
	cooldown = { years = 15 }
	trigger = {
		OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
		is_location_valid_for_travel_event_on_land = yes
	}
	immediate = {
		play_music_cue = "mx_cue_general_crusade_event_2"
		random_dummy_gender_clergy_effect = yes
		create_character = {
			age = 40
			gender = scope:dummy_clergy_gender
			location = root.location
			faith = root.faith
			culture = root.culture
			save_scope_as = zealous_priest
		}
	}
	#Listen diligently
	option = {
		name = pilgrimage.3001.a
		pious_type_option_effect = yes
		add_piety = medium_piety_gain
		if = {
			limit = {
				NOT = { has_trait = whole_of_body }
			}
			if = {
				limit = { 
					NOT = { has_trait = ill } 
				}
				random = {
					chance = {
						value = 35
						add = {
							value = health
							multiply = -2.5
						}
					}
					show_as_tooltip = { add_trait = ill }
					custom_tooltip = pilgrimage.3001.a.tt
					hidden_effect = {
						#Adds the trait, sends event "health.2201" to those who care if health is brought too low
						contract_disease_effect = {
							DISEASE = ill
							TREATMENT_EVENT = no
						}
					}	
				}
			}
			else_if = {
				limit = {
					NOT = { has_trait = pneumonic }
				}
				random = {
					chance = {
						value = 15
						add = {
							value = health
							multiply = -1.5
						}
					}
					show_as_tooltip = { add_trait = pneumonic }
					custom_tooltip = pilgrimage.2009.a.tt
					hidden_effect = {
						#Adds the trait, sends event "health.2201" to those who care if health is brought too low
						contract_disease_effect = {
							DISEASE = pneumonic
							TREATMENT_EVENT = no
						}
					}	
				}
			}
		}
		give_pilgrim_xp_effect = yes
	}
	#No
	option = {
		name = pilgrimage.3001.b
		add_piety = miniscule_piety_loss
	}
	after = {
		hidden_effect = {
			scope:zealous_priest = {
				if = {
					limit = {
						root = { is_ai = yes }
					}
					silent_disappearance_effect = yes
				}
			}
		}
	}
}

#Naked preacher claiming to have reclaimed the lost innocence of Adam & Eve
# by Sean Hughes
pilgrimage.3002 = {
	type = character_event
	title = pilgrimage.3002.t
	desc = pilgrimage.3002.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				has_trait = zealous
			}
			animation = disapproval
		}
		triggered_animation = {
			trigger = {
				any_secret = { type = secret_non_believer }
			}
			animation = thinking
		}
		animation = disbelief
	}
	right_portrait = {
		character = scope:naked_preacher
		animation = personality_zealous
	}
	cooldown = { years = 30 }
	trigger = {
		OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
		faith = {
			NOR = {
				has_doctrine = tenet_natural_primitivism
				has_doctrine = special_doctrine_naked_priests
			}
		}
		NOT = { 
			any_courtier = { has_character_flag = convinced_naked_preacher }
		}
		is_location_valid_for_travel_event_on_land = yes
	}
	immediate = {
		create_character = {
			age = 40
			gender_female_chance = 50
			location = root.location
			faith = faith:adamites
			culture = root.culture
			trait = zealous
			random_traits_list = {
				count = 2
				calm = {}
				brave = {}
				gregarious = {}
				ambitious = {}
				stubborn = {}
				arrogant = {}
			}
			trait = lifestyle_mystic
			save_scope_as = naked_preacher
		}
		scope:naked_preacher = { add_character_flag = is_naked }
	}
	#Convert to Adamitism
	option = {
		name = pilgrimage.3002.a
		trigger = {
			# Should not show up for the AI with strict regional heresies enabled
			OR = {
				NOT = { has_game_rule = strict_regional_heresy }
				is_ai = no
			}
		}
		worldly_type_option_effect = yes
		add_piety = massive_piety_loss
		set_character_faith = faith:adamites
		add_to_entourage_court_and_activity_effect = { 
			CHAR_TO_ADD = scope:naked_preacher
			NEW_COURT_OWNER = root 
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 9
				has_trait = cynical
				has_trait = trusting
			}
			modifier = {
				add = {
					value = ai_rationality
					multiply = -1
					max = 0
				}
			}
			modifier = {
				add = {
					value = ai_zeal
					multiply = -1
					min = 0
				}
			}
			modifier = {
				add = 100
				OR = {
					ai_rationality <= -100
					has_trait = lunatic
					has_trait = possessed
				}
			}
			modifier = {
				factor = 0
				any_independent_ruler = {
					faith = faith:adamites
				}
			}
		}
		debug_log = "Character converting to Adamitism"
	}
	#Heretic!
	option = {
		name = pilgrimage.3002.b
		pious_type_option_effect = yes
		add_piety = minor_piety_gain
		ai_chance = { base = 100 }
	}
	#Convert 'em!
	option = {
		name = pilgrimage.3002.c
		pious_type_option_effect = yes
		add_prestige = medium_prestige_loss
		duel = {
			skill = learning
			value = average_skill_rating
			50 = {
				desc = pilgrimage.3002.c.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3
					min = -49
				}
				scope:naked_preacher = { add_character_flag = convinced_naked_preacher }
				custom_tooltip = pilgrimage.3002.c.success.tt
				#Convinced Adamite
				trigger_event = pilgrimage.3003
			}
			50 = {
				desc = pilgrimage.3002.c.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3
					min = -49
				}
				send_interface_toast = {
					title = pilgrimage.3002.c.failure
					left_icon = root
					add_learning_lifestyle_xp = medium_lifestyle_xp
				}				
			}
		}
		ai_chance = {
			base = 100
		}
	}
	#Nah
	option = {
		name = pilgrimage.3002.d
		worldly_type_option_effect = yes
		add_prestige = minor_prestige_gain
		ai_chance = {
			base = 100
		}
	}
	after = {
		scope:naked_preacher = {
			if = {
				limit = {
					NOT = { has_character_flag = convinced_naked_preacher }
				}
				if = {
					limit = {
						root = { is_ai = yes }
					}
					silent_disappearance_effect = yes
				}
			}
			if = {
				limit = { is_courtier_of = root }
				remove_character_flag = is_naked
			}
		}
	}
}

#Follow-up: Convinced Adamite
# by Filippa Gannholm Kirsten
pilgrimage.3003 = {
	type = character_event
	title = pilgrimage.3003.t
	desc = pilgrimage.3003.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:naked_preacher
		animation = disbelief
	}
	immediate = {
		wayfarer_storyteller_fame_effect = { VALUE = roaming_reward_fame_small }
		scope:naked_preacher = { set_character_faith = root.faith }
		add_learning_lifestyle_xp = major_lifestyle_xp
		add_piety = medium_piety_gain
	}
	#Put on some clothes and join us
	option = {
		name = pilgrimage.3003.a
		flavor = pilgrimage.3003.a.flavor
		add_to_entourage_court_and_activity_effect = { 
			CHAR_TO_ADD = scope:naked_preacher
			NEW_COURT_OWNER = root 
		}
	}
	#Good for you, now spread the word
	option = {
		name = pilgrimage.3003.b
		add_character_modifier = {
			modifier = pilgrimage_religion_spread_modifier
			years = 5
		}
	}
	after = {
		scope:naked_preacher = { remove_character_flag = is_naked }
	}
}

#Doomsayer claiming the end is nigh!
# by Sean Hughes
pilgrimage.3004 = {
	type = character_event
	title = pilgrimage.3004.t
	desc = pilgrimage.3004.desc
	theme = travel_pilgrimage
	override_background = { reference = market }
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:doomsayer
		animation = personality_zealous
		outfit_tags = { monk_outfit }
	}
	cooldown = { years = 15 }
	trigger = {
		OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
		is_location_valid_for_travel_event_on_land = yes
	}
	immediate = {
		wayfarer_storyteller_fame_effect = { VALUE = roaming_reward_fame_small }
		random_dummy_gender_clergy_effect = yes
		create_character = {
			age = 40
			trait = devoted
			gender = scope:dummy_clergy_gender
			location = root.location
			faith = root.faith
			culture = root.culture
			save_scope_as = doomsayer
		}
	}
	#Outwit them
	option = {
		name = pilgrimage.3004.a
		trigger = { learning >= high_skill_rating }
		pious_type_option_effect = yes
		if = {
			limit = { 
				has_trait = pilgrim
				has_trait_xp = {
					trait = pilgrim
					value < 100
				}
			}
			add_trait_xp = {
				trait = pilgrim
				value = 10
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_mystic
			}
			add_trait_xp = {
				trait = lifestyle_mystic
				value = lifestyle_mystic_xp_gain_minor_value
			}
		}
		add_piety = medium_piety_gain
		add_prestige = minor_prestige_value
	}
	#Entertaining!
	option = {
		name = pilgrimage.3004.b
		worldly_type_option_effect = yes
		add_stress = medium_stress_loss
	}
	#Heretic!
	option = {
		name = pilgrimage.3004.c
		pious_type_option_effect = yes
		add_piety = medium_piety_value
	}
	after = {
		hidden_effect = {
			if = {
				limit = {
					is_ai = yes
				}
				scope:doomsayer = {
					if = {
						limit = {
							root = { is_ai = yes }
						}
						silent_disappearance_effect = yes
					}
				}
			}
		}
	}		
}

###3101-3200: Islam
#Ziyarat - Why am I taking this pilgrimage?
# by Sean Hughes
pilgrimage.3102 = {
	type = character_event
	title = pilgrimage.3102.t
	desc = pilgrimage.3102.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		animation = thinking
	}
	cooldown = { years = 2 }
	trigger = {
		religion = religion:islam_religion
		is_location_valid_for_travel_event_on_land = yes
	}
	# See distant places
	option = { 
		name = pilgrimage.3102.a
		worldly_type_option_effect = yes
		if = {
			limit = { 
				has_trait = lifestyle_traveler
				has_trait_xp = {
					trait = lifestyle_traveler
					track = travel
					value < 100
				}
			}
			add_trait_xp = {
				trait = lifestyle_traveler
				track = travel
				value = 5
			}
		}
		add_stress = minor_stress_loss
		add_piety = miniscule_piety_gain
		if = {
			limit = {
				has_trait = lifestyle_mystic
			}
			add_trait_xp = {
				trait = lifestyle_mystic
				value = lifestyle_mystic_xp_gain_minor_value
			}
		}
		add_character_modifier = {
			modifier = pilgrimage_worldly_modifier
			years = 10
		}
		ai_chance = {
			base = 50
			compare_modifier = {
				value = stress
				multiplier = 2
			}
		}		
	}
	# My zeal drives me!
	option = { 
		name = pilgrimage.3102.b
		trigger = {
			NOT = { has_trait = cynical }
		}
		pious_type_option_effect = yes
		show_as_unavailable = {
			has_trait = cynical
		}
		if = {
			limit = { 
				has_trait = pilgrim
				has_trait_xp = {
					trait = pilgrim
					value < 100
				}
			}
			add_trait_xp = {
				trait = pilgrim
				value = 5
			}
		}
		add_piety = minor_piety_gain
		add_character_modifier = {
			modifier = dedicated_to_pilgrimage_modifier
			years = 10
		}
		ai_chance = {
			base = 200
			ai_value_modifier = {
				ai_zeal = 1
			}
		}
	}
	# I have... questions
	option = { 
		name = pilgrimage.3102.c
		trigger = {
			NOT = { has_trait = zealous }
		}
		pious_type_option_effect = yes
		show_as_unavailable = {
			has_trait = zealous
		}
		stress_impact = {
			base = minor_stress_impact_gain
			cynical = minor_stress_impact_loss

			stubborn = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		add_learning_lifestyle_xp = massive_lifestyle_xp
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = -1
			}
		}
	}
}

###3201-3300: Hinduism
#Ritual purification in a river
# by Sean Hughes
pilgrimage.3201 = {
	type = character_event
	title = pilgrimage.3201.t
	desc = pilgrimage.3201.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		animation = personality_content
	}
	cooldown = { years = 2 }
	trigger = {
		religion = religion:hinduism_religion
		is_location_valid_for_travel_event_on_land = yes
	}
	#Yep yep
	option = {
		name = pilgrimage.3201.a
		pious_type_option_effect = yes
		if = {
			limit = { 
				has_trait = pilgrim
				has_trait_xp = {
					trait = pilgrim
					value < 100
				}
			}
			add_trait_xp = {
				trait = pilgrim
				value = 5
			}
		}
		add_prestige = minor_prestige_loss
		add_piety = minor_piety_gain
		stress_impact = {
			arrogant = minor_stress_gain
		}
	}
	#This is beneath me
	option = {
		name = pilgrimage.3201.b
		add_piety = minor_piety_loss
		add_prestige = medium_prestige_gain
		stress_impact = {
			humble = medium_stress_gain
			zealous = minor_stress_gain
			compassionate = minor_stress_gain
		}
	}
}

#Contemplating the universe
pilgrimage.3202 = {
	type = character_event
	title = pilgrimage.3202.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { religion = religion:hinduism_religion }
				desc = pilgrimage.3202.desc.hinduism
			}
			triggered_desc = {
				trigger = { religion = religion:buddhism_religion }
				desc = pilgrimage.3202.desc.buddhism
			}
			triggered_desc = {
				trigger = { religion = religion:jainism_religion }
				desc = pilgrimage.3202.desc.jainism
			}
			triggered_desc = {
				trigger = { faith = { has_doctrine = tenet_sanctity_of_nature } }
				desc = pilgrimage.3202.desc.nature
			}
		}
		desc = pilgrimage.3202.desc.end
	}
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		animation = thinking
	}
	cooldown = { years = 2 }
	trigger = {
		OR = {
			religion = religion:hinduism_religion
			religion = religion:buddhism_religion
			religion = religion:jainism_religion
			faith = { has_doctrine = tenet_sanctity_of_nature }
		}
		location = {
			OR = {
				terrain = forest
				terrain = jungle
				terrain = taiga
			}
		}
		is_location_valid_for_travel_event_on_land = yes
		current_travel_plan = { next_destination_progress < 0.8 }
	}
	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
	}
	#Contempllllation
	option = {
		name = pilgrimage.3202.a
		pious_type_option_effect = yes
		current_travel_plan = {
			delay_travel_plan = { months = 2 }
		}
		add_learning_lifestyle_xp = major_lifestyle_xp
		if = {
			limit = {
				has_trait = lifestyle_mystic
			}
			add_trait_xp = {
				trait = lifestyle_mystic
				value = lifestyle_mystic_xp_gain_minor_value
			}
		}
		if = {
			limit = { 
				has_trait = pilgrim
				has_trait_xp = {
					trait = pilgrim
					value < 100
				}
			}
			add_trait_xp = {
				trait = pilgrim
				value = 20
			}
		}
		stress_impact = {
			base = minor_stress_loss
			calm = minor_stress_loss
			patient = minor_stress_loss
			impatient = medium_stress_gain
		}
	}
	#Jalla jalla
	option = {
		name = pilgrimage.3202.b
		current_travel_plan = {
			add_destination_progress = { weeks = 2 }
		}
		custom_tooltip = pilgrimage.3202.b.tt
		stress_impact = {
			zealous = minor_stress_gain
			patient = minor_stress_gain
		}
	}
	after = {
		mp_resume_travel_plan = yes
	}
}

###3301-3400: Buddhism
#Critical Wanderer
# by Sean Hughes
pilgrimage.3301 = {
	type = character_event
	title = pilgrimage.3301.t
	desc = pilgrimage.3301.desc
	theme = pilgrimage_activity
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = gluttonous
					has_trait = arrogant
					has_trait = greedy
				}
			}
			animation = disapproval
		}
		animation = personality_coward
	}
	right_portrait = {
		character = scope:wanderer
		animation = personality_zealous
		outfit_tags = { monk_outfit }
	}
	cooldown = { years = 5 }
	trigger = {
		religion = religion:buddhism_religion
		is_location_valid_for_travel_event_on_land = yes
	}
	immediate = {
		random_dummy_gender_clergy_effect = yes
		create_character = {
			age = 80
			gender = scope:dummy_clergy_gender
			location = root.location
			faith = root.faith
			culture = root.culture
			save_scope_as = wanderer
		}
	}
	#Show off your learning
	option = {
		name = pilgrimage.3301.c
		bonus_to_all_types_effect = yes
		trigger = { learning >= high_skill_rating }
		show_as_unavailable = { learning < high_skill_rating }
		add_prestige = medium_prestige_gain
		add_piety = minor_piety_gain
		if = {
			limit = { 
				has_trait = pilgrim
				has_trait_xp = {
					trait = pilgrim
					value < 100
				}
			}
			add_trait_xp = {
				trait = pilgrim
				value = 10
			}
		}
	}
	#...alright then
	option = {
		name = pilgrimage.3301.a
		pious_type_option_effect = yes
		add_piety = medium_piety_gain
		add_prestige = minor_prestige_loss
		stress_impact = {
			base = minor_stress_gain
			temperate = minor_stress_loss
			gluttonous = minor_stress_gain
			arrogant = minor_stress_gain
			greedy = minor_stress_gain
		}
	}
	#My things!
	option = {
		name = pilgrimage.3301.b
		add_piety = minor_piety_loss
		stress_impact = {
			humble = minor_stress_gain
		}
	}
	after = {
		hidden_effect = {
			scope:wanderer = {
				if = {
					limit = {
						root = { is_ai = yes }
					}
					silent_disappearance_effect = yes
				}
			}
		}
	}
}
#The Wisdom of Goats
# by Laurence Kennedy
pilgrimage.3302 = {
	type = character_event
	title = pilgrimage.3302.t
	desc = pilgrimage.3302.desc
	theme = pilgrimage_activity
	theme = travel_pilgrimage
	override_background = { reference = terrain }
	left_portrait = {
		character = root
		animation = interested
	}
	right_portrait = {
		character = scope:mountain_local
		animation = personality_zealous
	}
	cooldown = { years = 5 }

	trigger = {
		is_location_valid_for_travel_event_on_land = yes
		location = {
			is_mountainous_or_hilly_trigger = yes 
		}
		religion = religion:buddhism_religion
	}
	immediate = {
		create_character = {
			age = 80
			template = default_mystic_character
			location = root.location
			culture = root.location.county.culture
			faith = root.location.county.faith
			save_scope_as = mountain_local
		}
	}
	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			OR = { #you're in a reflection journey
				has_activity_intent = reflection_intent
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = pilgrimage_type_pious
					}
				}
			}
		}
	}
	#Judgemental Relection 
	option = {
		name = pilgrimage.3302.a
		add_piety = miniscule_piety_gain
		stress_impact = {
			humble = minor_stress_impact_gain
			cynical = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = humble
				has_trait = cynical
			}
		}
	}
	#Humble Relection 
	option = {
		name = pilgrimage.3302.b
		pious_type_option_effect = yes
		stress_impact = {
			arrogant = minor_stress_impact_gain
			cynical = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = arrogant
				has_trait = cynical
			}
		}
	}
	#Harvest the salt
	option = {
		name = pilgrimage.3302.c
		flavor = pilgrimage.3302.c.flavor
		add_gold = {
			value = tiny_gold_value
			max = 15
		}
		stress_impact = {
			base = minor_stress_gain
			generous = minor_stress_gain
			zealous = minor_stress_gain
			greedy = minor_stress_loss
		}
	}
	#gets rid of old man
	after = {
		scope:mountain_local = {
			silent_disappearance_effect = yes
		}
	}
}
# Kalama Sutta
# by Laurence Kennedy
pilgrimage.3303 = {
	type = character_event
	title = pilgrimage.3303.t
	desc = pilgrimage.3303.desc
	theme = travel_pilgrimage
	
	left_portrait = {
		character = root
		animation = chaplain
	}
	right_portrait = {
		character = scope:wisdom_seeker
		animation = beg
		
	}
	cooldown = { years = 5 }

	trigger = { 
		#Only for Buddhist
		religion = religion:buddhism_religion
		#make sure it is a city or castle
		is_location_valid_for_travel_event_on_land = yes
		location = {
        	OR = {
        		has_holding_type = castle_holding
        		has_holding_type = city_holding	
        	}
        	#is there a leader there to meet you
        	province_owner = {
        		is_available_ai_adult = yes
        	}	
        }
	}
	immediate = {
	    #set scope for location and find province owner
		location = {
			save_scope_as = place_to_teach
			province_owner = {
				save_scope_as = wisdom_seeker
			}
		}
	}
	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			OR = { #you're in a reflection journey
				has_activity_intent = reflection_intent
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = pilgrimage_type_pious
					}
				}
			}
		}
	}
	#Intellectual/zealous
	option = {
		name = pilgrimage.3303.a
		add_piety = medium_piety_gain
		pious_type_option_effect = yes
		#Improves the conversion rate of your court champlain
		location.county = {
			add_county_modifier = {
				modifier = buddhist_teachings_conversion_modifier
				#giving fifteen years because this might incentivize you to conquer the territory so you can take advantage of this and conversions can take awhile. 
				years = 15
			}
		}
		stress_impact = {
			humble = minor_stress_impact_gain
			cynical = medium_stress_impact_gain
			zealous = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = cynical
				has_trait = humble
			}
		}
	}
	#Open minded 
	option = {
		name = pilgrimage.3303.b
		flavor = pilgrimage.3303.b.flavor
		add_learning_lifestyle_xp = medium_lifestyle_xp
		add_character_modifier = {
			modifier = pilgrimage_conversion_modifier
			years = 5
		}
		stress_impact = {
			zealous = minor_stress_impact_gain
			arrogant = medium_stress_impact_gain
			humble = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = zealous
				has_trait = arrogant
			}
		}
	}
} 
### 3401-3500: Dharmic
# Brahmacharya Challenged
# by Laurence Kennedy
pilgrimage.3401 = {
	type = character_event
	title = pilgrimage.3401.t
	desc = pilgrimage.3401.desc
	theme = pilgrimage_activity
	theme = travel_pilgrimage
	#background for riverside province
	override_background = { 
		trigger = {
			location = {
        		is_riverside_province = yes
        	}	
		}
		reference = bp3_riverside
	}
	#background for lakeside province
	override_background = { 
		trigger = {
			location = {
        		is_lakeside_province = yes
        	}	
		}
		reference = wilderness_wetlands
	}
	#background for coastal province
	override_background = { 
		trigger = {
			location = {
        		is_coastal = yes
        	}	
		}
		reference = bp3_coast
	}
	left_portrait = {
		character = root
		animation = interested
	}
	right_portrait = {
		character = scope:bather
		animation = personality_zealous
		outfit_tags = { no_clothes }
	}
	cooldown = { years = 10 }

	trigger = { 
		#Only for Dharmic
		religion = {
			OR = {
				this = religion:buddhism_religion
				this = religion:hinduism_religion
			}
		}
		#make sure you are by a body of water
		is_location_valid_for_travel_event_on_land = yes
		location = {
        	OR = {
        		is_riverside_province = yes
        		is_lakeside_province = yes
        		is_coastal = yes
        	}	
        }
        #find someone in the entourage that you are attracted to
    	current_travel_plan = {
	    	any_entourage_character = {
				root = { 
					is_attracted_to_gender_of = prev
				}
				is_physically_able_adult = yes
				are_characters_sensible_lovers_trigger = {
					INSTIGATING_LOVER = root
					TARGET_OF_LOVE = this
				}
			}
		}

	}
	immediate = {
	#This is for loc to name body of water
		location = {			
	    	random_neighboring_province = {
	    		limit = {
	            	OR = {
	            		is_river_province = yes
	            		is_lake_province = yes
	            		is_sea_province = yes
	            	}
	    		}
	    		save_scope_as = body_of_water
		    }
	    }
	    #find person to be tempted by 
		current_travel_plan = {
			random_entourage_character = {
				limit = {
					root = { 
						is_attracted_to_gender_of = prev
					}
					is_physically_able_adult = yes
					are_characters_sensible_lovers_trigger = {
						INSTIGATING_LOVER = root
						TARGET_OF_LOVE = this
					}
				}
				save_scope_as = bather
			}
		}
	}
	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			OR = { #you're in a reflection journey
				has_activity_intent = reflection_intent
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = pilgrimage_type_pious
					}
				}
			}
		}
	}
	#Give in to temptation
	option = {
		name = pilgrimage.3401.a
		add_character_modifier = {
			modifier = pilgrimage_seduction_modifier
			years = 5
		}
		stress_impact = {
			chaste = minor_stress_impact_gain
			zealous = medium_stress_impact_gain
			lustful = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = chaste
				has_trait = zealous
			}
		}
	}
	#stay resolute in your chastity  
	option = {
		name = pilgrimage.3401.b
		flavor = pilgrimage.3401.b.flavor
		pious_type_option_effect = yes
		add_piety = miniscule_piety_gain
		stress_impact = {
			lustful = minor_stress_impact_gain
			cynical = medium_stress_impact_gain
			chaste = medium_stress_impact_loss
			zealous = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = lustful
				has_trait = cynical
			}
		}
	}
} 

############################
## BP1 Events
## by Chad Uhl
############################
# 6001-6010: BP1
# pilgrimage.6001-5 - Sneaking off to a tavern with your pal
# pilgrimage.6006 - You find out your friend is a Non-Believer
# pilgrimage.6007 - You and a friend are on a pilgrimage and your friend is healed in a miracle performed by a wandering priest
#
#

###6001 - 6010: BP1
scripted_trigger pilgrimage_6001_friend_trigger = {
	is_available_ai_adult = yes
	faith = root.faith
	trigger_if = {
		limit = { faith.religion = religion:islam_religion }
		has_trait = drunkard
	}
}
#Sneaking off to a tavern with your pal
# by Chad Uhl
pilgrimage.6001 = {
	type = character_event
	title = pilgrimage.6001.t
	desc = pilgrimage.6001.desc
	theme = travel_pilgrimage
	left_portrait = { 
		character = root
		animation = personality_content
	}
	right_portrait = { 
		character = scope:friend
		animation = happiness
	}
	cooldown = { years = 20 }
	trigger = {
		has_bp1_dlc_trigger = yes
		is_location_valid_for_travel_event_on_land = yes
		current_travel_plan = { next_destination_progress > 0.5 }
		trigger_if = {
			limit = { faith.religion = religion:islam_religion }
			has_trait = drunkard
		}
		any_relation = {
			type = friend
			pilgrimage_6001_friend_trigger = yes
		}
	}
	weight_multiplier = {
		base = 1
		modifier = {
			has_activity_intent = reduce_stress_intent
			factor = 2
		}
	}
	immediate = {
		random_relation = {
			type = friend
			limit = { pilgrimage_6001_friend_trigger = yes }
			save_scope_as = friend
		}
	}
	# Let's chat
	option = { 
		name = pilgrimage.6001.a
		worldly_type_option_effect = yes
		add_character_flag = in_pilgrimage_event_chain
		current_travel_plan = {
			delay_travel_plan = { days = 30 }
		}
		if = {
			limit = {
				scope:friend = { is_ruler = no }
			}
			add_to_entourage_court_and_activity_effect = { 
				CHAR_TO_ADD = scope:friend
				NEW_COURT_OWNER = root 
			}
		}
		if = { # Get schwasted at the tavern
			limit = {
				drinks_alcohol_trigger = yes
				scope:friend = {
					drinks_alcohol_trigger = yes
					OR = {
						has_trait = drunkard 
						has_trait = lifestyle_reveler
					}
				}
			}
			trigger_event = {
				id = pilgrimage.6002
				days = 5
			}
		}
		else_if = {
			limit = {
				NOT = {
					faith = { has_doctrine = doctrine_pluralism_pluralistic }
				}
				scope:friend = {
					any_secret = { type = secret_non_believer }
				}
			}
			trigger_event = {
				id = pilgrimage.6006
				days = 5
			}
		}
		else_if = {
			limit = {
				scope:friend = {
					OR = {
						# Physical Traits 
						has_trait = wounded_1
						has_trait = wounded_2
						has_trait = wounded_3
						has_trait = impotent 
						has_trait = infirm 
						# Diseases 
						has_trait = ill
						has_trait = bubonic_plague
						has_trait = cancer 
						has_trait = consumption 
						has_trait = great_pox 
						has_trait = gout_ridden
						has_trait = leper 
						has_trait = lovers_pox 
						has_trait = pneumonic 
						has_trait = smallpox 
						has_trait = typhus 
					}
				}
			}
			trigger_event = {
				id = pilgrimage.6007
				days = 5
			}
		}
		else = { # Fallback event
			trigger_event = {
				id = pilgrimage.6002
				days = 5
			}
		}
		reverse_add_opinion = {
			target = scope:friend
			modifier = friendliness_opinion
			opinion = 15
		}
		involved_activity = {
			set_variable = {
				name = friend_companion
				value = scope:friend 
			}
		}
		stress_impact = {
			zealous = miniscule_stress_impact_gain
			shy = medium_stress_impact_gain
			gregarious = minor_stress_impact_loss
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_zeal = -0.5
			}
		}
	}
	# Leave me alone
	option = { 
		name = pilgrimage.6001.b
		reverse_add_opinion = {
			target = scope:friend
			modifier = insulted_opinion
			opinion = -25
		}
		stress_impact = {
			gregarious = medium_stress_impact_gain
			callous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = -0.5
				ai_zeal = -0.5
			}
		}
	}
	# Zealous Option, bye bye pal
	option = { 
		name = pilgrimage.6001.c
		trigger = { has_trait = zealous }
		pious_type_option_effect = yes
		if = {
			limit = { 
				has_trait = pilgrim
				has_trait_xp = {
					trait = pilgrim
					value < 100
				}
			}
			add_trait_xp = {
				trait = pilgrim
				value = 5
			}
		}
		reverse_add_opinion = {
			target = scope:friend
			modifier = insulted_opinion
			opinion = -25
		}
		remove_relation_friend = scope:friend
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = -0.5
				ai_zeal = 1 
			}
		}
	}
}

#Tavern, Suggestion
pilgrimage.6002 = { 
	type = character_event
	title = pilgrimage.6001.t
	desc = pilgrimage.6002.desc 
	theme = travel_pilgrimage
	override_background = { reference = bp1_bonfire }
	left_portrait = { 
		character = root
		animation = personality_content
	}
	right_portrait = { 
		character = scope:friend
		animation = happiness
	}
	# Hit up the tavern
	option = { 
		name = pilgrimage.6002.a
		custom_tooltip = pilgrimage.6002.a_tt
		trigger_event = {
			id = pilgrimage.6003 
			days = 5 
		}
		stress_impact = {
			zealous = major_stress_impact_gain
			temperate = massive_stress_impact_gain
			gluttonous = medium_stress_impact_loss
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_zeal = -0.5
			}
		}
	}
	# Politely decline
	option = { 
		name = pilgrimage.6002.b
		remove_character_flag = in_pilgrimage_event_chain
		current_travel_plan = { resume_travel_plan = yes }
		custom_tooltip = pilgrimage.6002.b_tt
		stress_impact = {
			zealous = minor_stress_impact_loss
			temperate = minor_stress_impact_loss
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_zeal = -0.5
			}
		}
	}
	# Emphatic no
	option = { 
		name = pilgrimage.6002.c
		trigger = { has_trait = zealous }
		remove_character_flag = in_pilgrimage_event_chain
		current_travel_plan = { resume_travel_plan = yes }
		custom_tooltip = pilgrimage.6002.b_tt
		pious_type_option_effect = yes
		give_pilgrim_xp_effect = yes
		stress_impact = {
			zealous = minor_stress_impact_loss
			temperate = minor_stress_impact_loss
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_zeal = -0.5
			}
		}
	}
}

#Tavern, beginning
pilgrimage.6003 = { 
	type = character_event
	title = pilgrimage.6001.t
	desc = pilgrimage.6003.desc
	theme = pilgrimage_destination
	override_background = { reference = tavern }
	left_portrait = { 
		character = root
		animation = drink_goblet
	}
	right_portrait = { 
		character = scope:friend
		animation = toast_goblet
	}
	immediate = {
		play_music_cue = "mx_cue_in_taberna_instrumental"
	}
	#More drinks
	option = { 
		name = pilgrimage.6003.a
		custom_tooltip = pilgrimage.6003.a_tt
		remove_short_term_gold = tiny_gold_value
		random_list = {
			50 = {
				if = {
					limit = {
						NOT = { has_trait = lifestyle_reveler }
					}
					add_trait = lifestyle_reveler
				}
				else_if = {
					limit = {
						has_trait = lifestyle_reveler
						has_trait_xp = {
							trait = lifestyle_reveler
							value < 100
						}
					}
					add_trait_xp = {
						trait = lifestyle_reveler
						value = 10
					}
				}
			}
			50 = {
				#Nothing happens
			}
		}
		trigger_event = {
			id = pilgrimage.6004
			days = 3
		}
	}
	#Let's not
	option = {
		name = pilgrimage.6003.b
		custom_tooltip = pilgrimage.6003.b.tt
		current_travel_plan = { resume_travel_plan = yes }
	}
}

#Tavern, crash
pilgrimage.6004 = { 
	type = character_event
	title = pilgrimage.6001.t
	desc = pilgrimage.6004.desc
	theme = pilgrimage_destination
	override_background = { reference = bp1_wine_cellar }
	left_portrait = { 
		character = root
		animation = shock
	}
	right_portrait = { 
		character = scope:friend
		animation = shock
	}
	immediate = {
		play_music_cue = "mx_cue_in_taberna_instrumental"
		random_list = {
			5 = { 
				# Empty field, significant chance that nothing happens 
			} 
			1 = {
				add_trait = wounded_1 
				scope:friend = { add_trait = wounded_1 }
			}
			2 = {
				add_trait = wounded_1 
			}
			2 = {
				scope:friend = { add_trait = wounded_1 }
			}
		}
	}
	#_even more_ drinks!
	option = { 
		name = pilgrimage.6004.a
		custom_tooltip = pilgrimage.6004.a.tt
		add_character_modifier = {
			modifier = life_of_the_party_modifier
			years = 5
		}
		random_list = {
			50 = {
				if = {
					limit = {
						NOT = { has_trait = lifestyle_reveler }
					}
					add_trait = lifestyle_reveler
				}
				else_if = {
					limit = {
						has_trait = lifestyle_reveler
						has_trait_xp = {
							trait = lifestyle_reveler
							value < 100
						}
					}
					add_trait_xp = {
						trait = lifestyle_reveler
						value = 10
					}
				}
			}
			50 = {
				#Nothing happens
			}
		}
	}
	#Ayy
	option = {
		name = pilgrimage.6004.b
		custom_tooltip = pilgrimage.6003.b.tt
		current_travel_plan = { resume_travel_plan = yes }
	}
	after = {
		trigger_event = {
			id = pilgrimage.6005
			days = 5
		}
	}
}

#Returning to camp
pilgrimage.6005 = { 
	type = character_event
	title = pilgrimage.6001.t
	desc = {
		desc = pilgrimage.6005.desc
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:mad_inkeeper }
				desc = pilgrimage.6005.desc.bad
			}
			triggered_desc = {
				desc = pilgrimage.6005.desc.good 
			}
		}
	}
	theme = pilgrimage_destination
	override_background = { reference = bp1_bonfire }
	left_portrait = { 
		character = root
		animation = paranoia
	}
	right_portrait = { 
		character = scope:friend
		animation = paranoia
	}
	immediate = {
		random_list = {
			3 = { 
				trigger = { has_character_modifier = life_of_the_party_modifier }
				save_scope_as = mad_inkeeper 
			}
			7 = { 
				# 70% chance not to happen 
			} 
		}
		if = {
			limit = { 
				can_set_relation_best_friend_trigger = { CHARACTER = scope:friend } 
			}
			set_relation_best_friend = { 
				reason = best_friend_pilgrimage 
				copy_reason = friend 
				target = scope:friend
			}
		}
		remove_character_flag = in_pilgrimage_event_chain
	}
	#Woo! Good time!
	option = { 
		name = pilgrimage.6005.a
		trigger = {
			NOT = { exists = scope:mad_inkeeper }
		}
	}
	#Pay for damages
	option = {
		name = pilgrimage.6005.b
		trigger = { exists = scope:mad_inkeeper }
		remove_short_term_gold = medium_gold_value
		add_piety = minor_piety_gain
		pious_type_option_effect = yes
	}
	#Nuh-uh
	option = {
		name = pilgrimage.6005.c
		trigger = { exists = scope:mad_inkeeper }
		add_prestige = medium_prestige_gain
		add_piety = medium_piety_loss
		worldly_type_option_effect = yes
	}
	after = {
		if = {
			limit = {
				current_travel_plan ?= {
					is_paused = yes
				}
			}
			current_travel_plan = { resume_travel_plan = yes }
		}
	}
}

#You find out your friend is a Non-Believer
# by Chad Uhl
pilgrimage.6006 = {
	type = character_event
	title = pilgrimage.6001.t
	desc = pilgrimage.6006.desc
	theme = travel_pilgrimage
	left_portrait = { 
		character = root
		animation = shock
	}
	right_portrait = { 
		character = scope:friend
		animation = anger
	}
	immediate = {
		scope:friend = {
			random_secret = {
				type = secret_non_believer
				reveal_to = root
				save_scope_as = friend_secret
			}
		}
		remove_character_flag = in_pilgrimage_event_chain
	}
	# Priviledge friendship
	option = { 
		name = pilgrimage.6006.a
		worldly_type_option_effect = yes
		if = {
			limit = { 
				can_set_relation_best_friend_trigger = { CHARACTER = scope:friend } 
			}
			set_relation_best_friend = { 
				reason = best_friend_pilgrimage 
				copy_reason = friend 
				target = scope:friend 
			}
		}
		reverse_add_opinion = {
			target = scope:friend
			modifier = grateful_opinion
			opinion = 50
		}
	}
	# Priviledge faith
	option = { 
		name = pilgrimage.6006.b
		pious_type_option_effect = yes
		scope:friend_secret = { expose_secret = root }
		reverse_add_opinion = {
			target = scope:friend
			modifier = exposed_my_secret_opinion
		}
		add_piety = medium_piety_gain	
	}
	# You become a non-believer
	option = { 
		name = pilgrimage.6006.c
		trigger = {
			OR = {
				has_trait = fickle
				has_trait = arbitrary
			}
			NOR = {
				any_secret = { type = secret_non_believer }
				has_trait = zealous 
			}
		}
		add_secret = { type = secret_non_believer }
		random_secret = {
			type = secret_non_believer
			reveal_to = scope:friend
		}
		if = {
			limit = { can_set_relation_best_friend_trigger = { CHARACTER = scope:friend } }
			set_relation_best_friend = { 
				reason = best_friend_pilgrimage 
				copy_reason = friend 
				target = scope:friend 
			}
		}
	}
	after = {
		current_travel_plan = { resume_travel_plan = yes }
	}
}

#You and a friend are on a pilgrimage and your friend is healed in a miracle performed by a wandering priest
# by Chad Uhl
pilgrimage.6007 = {
	type = character_event
	title = pilgrimage.6007.t
	desc = pilgrimage.6007.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = scope:friend
		animation = sadness
	}
	right_portrait = {
		character = scope:6007_healer
		animation = admiration
		outfit_tags = { monk_outfit }
	}
	cooldown = { years = 10 }
	immediate = {
		play_music_cue = "mx_cue_sacredrite"
		create_character = {
			location = root.location
			template = priest_character_template
			faith = root.faith
			culture = root.culture
			gender_female_chance = root_faith_clergy_gender_female_chance
			save_scope_as = 6007_healer
		}
		scope:6007_healer = { add_character_flag = no_hat }
	}
	# Priest makes a learning challenge for healing
	option = { 
		name = pilgrimage.6007.a
		pious_type_option_effect = yes
		if = {
			limit = {
				has_trait = lifestyle_mystic
			}
			add_trait_xp = {
				trait = lifestyle_mystic
				value = lifestyle_mystic_xp_gain_minor_value
			}
		}
		scope:6007_healer = {
			duel = {
				skill = learning
				value = extremely_high_skill_rating
				30 = {
					desc = pilgrimage.6007.a.success
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
					}
					root = {
						send_interface_toast = {
							title = pilgrimage.6007.a.success
							left_icon = scope:friend
							scope:friend = { # Remove relevant trait
								if = {
									limit = { has_trait = wounded_1 }
									remove_trait = wounded_1
								}
								else_if = {
									limit = { has_trait = wounded_2 }
									remove_trait = wounded_2
								}
								else_if = {
									limit = { has_trait = wounded_3 }
									remove_trait = wounded_3
								}
								else_if = {
									limit = { has_trait = impotent }
									remove_trait = impotent
								}
								else_if = {
									limit = { has_trait = infirm }
									remove_trait = infirm
								}
								else_if = {
									limit = { has_trait = bubonic_plague }
									remove_trait = bubonic_plague
									if = {
										limit = { is_ai = no }
										add_achievement_global_variable_effect = {
											VARIABLE = ce1_not_today_achievement_unlocked
											VALUE = yes
										}
									}
								}
								else_if = {
									limit = { has_trait = lovers_pox }
									remove_trait = lovers_pox
								}
								else_if = {
									limit = { has_trait = cancer }
									remove_trait = cancer
								}
								else_if = {
									limit = { has_trait = consumption }
									remove_trait = consumption
								}
								else_if = {
									limit = { has_trait = great_pox }
									remove_trait = great_pox
								}
								else_if = {
									limit = { has_trait = gout_ridden }
									remove_trait = gout_ridden
								}
								else_if = {
									limit = { has_trait = leper }
									remove_trait = leper
								}
								else_if = {
									limit = { has_trait = pneumonic }
									remove_trait = pneumonic
								}
								else_if = {
									limit = { has_trait = smallpox }
									remove_trait = smallpox
								}
								else_if = {
									limit = { has_trait = typhus }
									remove_trait = typhus
								}
								else = {
									remove_trait = ill
								}
							}	
							add_character_modifier = {
								modifier = pilgrimage_miracle_witness_modifier
							}
						}
					}
				}
				70 = {	
					desc = pilgrimage.6007.a.failure
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
					}
					root = {
						send_interface_toast = {
							title = pilgrimage.6007.a.failure 
							left_icon = scope:friend 
							scope:friend = {
								add_character_modifier = {
									modifier = pilgrimage_botched_miracle_modifier
								}
							}
						}
					}
				}
			}
		}
		stress_impact = {
			trusting = minor_stress_impact_loss
			zealous = medium_stress_impact_loss
			cynical = major_stress_impact_gain	
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 1
				ai_zeal = 2
			}
		}
	}
	#Let's not
	option = {
		name = pilgrimage.6007.b
		add_prestige = minor_prestige_gain
		stress_impact = {
			trusting = medium_stress_impact_gain
			zealous = major_stress_impact_gain
			cynical = minor_stress_impact_loss	
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = -2
			}
		}
	}
	after = {
		remove_character_flag = in_pilgrimage_event_chain
		current_travel_plan = { resume_travel_plan = yes }
		scope:6007_healer = {
			if = {
				limit = {
					root = { is_ai = yes }
				}
				silent_disappearance_effect = yes
			}
		}
	}
}

################################
# Hajj Arrival Event
# 3101
################################
# pilgrimage.3101 - Entering state of Ihram

pilgrimage.3101 = {
	type = activity_event
	title = pilgrimage.3101.t
	desc = pilgrimage.3101.desc
	theme = travel_pilgrimage
	left_portrait = {
		character = root
		animation = personality_content
	}

	trigger = { exists = scope:activity }
	
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
		scope:activity = {
			add_activity_log_entry = {
				key = hajj_arrived_log
				tags = { arrived }
				score = 50
				character = root
				show_in_conclusion = yes
			}
		}
	}
	# Commit to the Irham
	option = {
		name = pilgrimage.3101.a
		pious_type_option_effect = yes
		add_piety = minor_piety_gain
		stress_impact = {
			base = medium_stress_gain
			# Stress Loss (minimal)
			zealous = medium_stress_loss
			temperate = minor_stress_loss
			humble = minor_stress_loss
			chaste = minor_stress_loss
			calm = minor_stress_loss
			# Stress Gain (can be substantial)
			lustful = medium_stress_gain
			arrogant = medium_stress_gain
			wrathful = medium_stress_gain
			sadistic = medium_stress_gain
			vengeful = medium_stress_gain
			arbitrary = medium_stress_gain

			hashishiyah = minor_stress_gain
			drunkard = minor_stress_gain
			rakish = minor_stress_gain

			gluttonous = minor_stress_gain
			impatient = minor_stress_gain
			deceitful = minor_stress_gain
			cynical = minor_stress_gain
		}
		ai_chance = {
			base = 200
			ai_value_modifier = {
				ai_zeal = 1
			}
		}	
	}
	# I don't have to be that strict
	option = { 
		name = pilgrimage.3101.b
		worldly_type_option_effect = yes
		add_piety = medium_piety_loss
		stress_impact = {
			# Stress Gain (major for some traits)
			zealous = major_stress_gain
			honest = medium_stress_gain
			just = medium_stress_gain
			# Stress Loss (can be minor to substantial)
			lustful = medium_stress_loss
			arrogant = medium_stress_loss

			sadistic = minor_stress_loss
			vengeful = minor_stress_loss
			wrathful = minor_stress_loss
			gluttonous = minor_stress_loss
			impatient = minor_stress_loss
			deceitful = minor_stress_loss
			cynical = minor_stress_loss

		}
		ai_chance = {
			base = 0
			ai_value_modifier = {
				ai_zeal = -1
				ai_vengefulness = 1
				ai_honor = -1
			}
		}
	}
	after = {
		#The Hajj rituals usually play out in 3 days, but we'll utilize the full 3 months for remaining at the Pilgrimage destination
		#They also happen in a decided order
		trigger_event = {
			#Pray at the Place of Abraham
			id = hajj.3010
			days = 20
		}
	}
}

################################
# Generic Arrival Events
# 4001-4999
# by Petter Vilberg
################################
# pilgrimage.4001 - Generic Destination
# pilgrimage.4002 - The Mystic you met on your journey is there!
# pilgrimage.4010 - Obligatory Pilgrimage - Skip Destination Events
# pilgrimage.4020 - Bury old host at Destination
#

#Generic Destination
# by Petter Vilberg
pilgrimage.4001 = {
	type = activity_event
	title = pilgrimage.4001.t
	desc = {
		desc = pilgrimage.4001.desc
		triggered_desc = {
			trigger = { has_trait = cynical }
			desc = pilgrimage.4001.cynical_end
		}
	}
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	artifact = {
		target = scope:christian_saint_bone_scope
		position = lower_right_portrait
	}
	trigger = {
	}
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
		christian_saint_bone_creation_effect = yes
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

#The Mystic you met on your journey is there!
# by Petter Vilberg
pilgrimage.4002 = {
	type = activity_event
	title = pilgrimage.4001.t
	desc = pilgrimage.4002.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = personality_rational
	}
	right_portrait = {
		character = scope:2010_mystic
		animation = ecstasy
	}
	trigger = {
		exists = scope:2010_mystic
		OR = {
			has_trait = lifestyle_mystic
			exists = local_var:debated_mystic
		}
		scope:2010_mystic = {
			is_available_ai = yes
		}
	}
	#Fwiends!
	option = {
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4002.a_cynical
		}
		name = pilgrimage.4002.a
		trigger = {
			NOT = { has_trait = cynical }
		}
		progress_towards_friend_effect = {
			REASON = friend_pilgrimage
			CHARACTER = scope:2010_mystic
			OPINION = default_friend_opinion
		}
		ai_chance = {
			base = 100
		}
	}
	#Hook up
	option = {
		name = pilgrimage.4002.b
		trigger = {
			has_trait = lustful
			scope:2010_mystic = {
				NOR = {
					has_trait = chaste
					has_trait = celibate
				}
				is_attracted_to_gender_of = root
				might_cheat_on_every_partner_trigger = yes
			}
			is_attracted_to_gender_of = scope:2010_mystic
			might_cheat_on_every_partner_trigger = yes
		}
		had_sex_with_effect = {
			CHARACTER = scope:2010_mystic
			PREGNANCY_CHANCE = pregnancy_chance
		}
		progress_towards_lover_effect = {
			CHARACTER = scope:2010_mystic
			REASON = lover_mystic_lust
			OPINION = default_lover_opinion
		}
		ai_chance = {
			base = 0
			modifier = {
				OR = {
					is_married = no
					any_spouse = {
						count = all
						save_temporary_scope_as = partner
						root = { 
							might_cheat_on_partner_trigger = { PARTNER = scope:partner } 
						}
					}
				}
				add = 100
			}
		}
	}
	after = {
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

#Obligatory Pilgrimage Skip Destination Events
pilgrimage.4010 = {
	type = activity_event
	title = pilgrimage.4010.t
	desc = pilgrimage.4010.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				NOT = { 
					any_secret = { type = secret_non_believer }
				}
				has_trait = zealous
			}
			animation = stress
		}
		animation = boredom
	}
	immediate = {
		give_pilgrim_trait_or_xp_effect = yes
	}
	#Zealous person regrets their decisiooon...
	option = { 
		name = pilgrimage.4010.a
		trigger = {
			NOT = { 
				any_secret = { type = secret_non_believer }
			}
			has_trait = zealous
		}
		flavor = pilgrimage.4010.a.flavor
		custom_tooltip = pilgrimage.4010.a.tt
		add_character_flag = pilgrimage_counter_obligatory
		if = {
			limit = {
				NOT = { 
					any_secret = { type = secret_non_believer }
				}
				has_trait = zealous
			}
			stress_impact = {
				impatient = medium_stress_impact_gain
				zealous = minor_stress_impact_loss
				patient = minor_stress_impact_loss
				fickle = minor_stress_impact_loss
				arbitrary = minor_stress_impact_loss
			}
		}
		trigger_event = {
			on_action = pilgrimage_destination_events
			delayed = yes
		}
	}
	#I'm _done_. Beam me up, Scotty!
	option = { 
		name = pilgrimage.4010.b
		flavor = pilgrimage.4010.b.flavor
		custom_tooltip = pilgrimage.4010.b.tt
		scope:activity = { progress_activity_phase_after = { days = 1 } }
		if = {
			limit = {
				NOT = { 
					any_secret = { type = secret_non_believer }
				}
				has_trait = zealous
			}
			stress_impact = {
				zealous = massive_stress_impact_gain
				impatient = medium_stress_impact_loss
				lazy = minor_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				impatient = medium_stress_impact_loss
				lazy = minor_stress_impact_gain
			}
		}
	}
}

#Bury old host at Destination
pilgrimage.4020 = {
	type = activity_event
	title = pilgrimage.4020.t
	desc = {
		desc = pilgrimage.4020.desc.intro
		first_valid = {
			#Dearly departed mother/father
			triggered_desc = {
				trigger = {
					is_close_family_of = scope:old_pilgrimage_host
					has_character_flag = pilgrimage_liked_my_predecessor
				}
				desc = pilgrimage.4020.desc.relation_family_liked
			}
			#Dearly departed <name>
			triggered_desc = {
				trigger = { has_character_flag = pilgrimage_liked_my_predecessor }
				desc = pilgrimage.4020.desc.relation_liked
			}
			#Departed mother/father
			triggered_desc = {
				trigger = {
					is_close_family_of = scope:old_pilgrimage_host
				}
				desc = pilgrimage.4020.desc.relation_family
			}
			#... dead liege?
			desc = pilgrimage.4020.desc.relation_neutral
		}
		first_valid = {
			triggered_desc = {
				trigger = { has_character_flag = pilgrimage_liked_my_predecessor }
				desc = pilgrimage.4020.desc.liked
			}
			desc = pilgrimage.4020.desc.neutral
		}
	}
	theme = pilgrimage_destination
	override_background = {
		trigger = {
			NOR = {
				religion = religion:hinduism_religion
				religion = religion:jainism_religion
				religion = religion:buddhism_religion
			}
		}
		reference = temple
	}
	left_portrait = {
		character = root
		animation = grief
	}
	right_portrait = {
		character = scope:burial_bishop
		animation = sadness
	}
	lower_center_portrait = {
		character = scope:old_pilgrimage_host
	}
	immediate = {
		give_pilgrim_trait_or_xp_effect = yes
		save_scope_as = root_scope
		if = {
			limit = { exists = var:old_host_to_be_buried }
			var:old_host_to_be_buried = { save_scope_as = old_pilgrimage_host }
		}
		if = {
			limit = {
				exists = location.county.holder.cp:councillor_court_chaplain
				location.county.holder.cp:councillor_court_chaplain.faith = root.faith
			}
			location.county.holder.cp:councillor_court_chaplain = { save_scope_as = burial_bishop }
		}
		else = {
			create_character = {
				template = priest_character_template
				dynasty = none
				location = root.location
				culture = root.location.culture
				faith = root.faith
				save_scope_as = burial_bishop
			}
			set_variable = created_burial_bishop_var
		}
		remove_character_modifier = pilgrimage_burial_at_destination_modifier
	}
	#In the ground ye go
	option = { 
		name = pilgrimage.4020.a
		flavor = pilgrimage.4020.a.flavor
		involved_activity ?= {
			add_activity_log_entry = {
				key = pilgrimage_burial_log
				tags = { destination_event }
				score = 50
				character = root
				target = scope:old_pilgrimage_host
				location = root.location
				show_in_conclusion = yes
				#Effects
				root = {
					pilgrimage_bury_at_destination_effect = yes
				}
			}
		}
		create_character_memory = {
			type = pilgrimage_handled_predecessor_remains_memory
			participants = { predecessor = scope:old_pilgrimage_host }
		}
		scope:new_memory = {
			set_variable = {
				name = pilgrimage_destination
				value = scope:activity.activity_location
			}
		}
	}
	after = {
		if = {
			limit = {
				is_ai = yes
				has_variable = created_burial_bishop_var
			}
			scope:burial_bishop = {
				if = {
					limit = {
						root = { is_ai = yes }
					}
					silent_disappearance_effect = yes
				}
			}
			remove_variable = created_burial_bishop_var
		}
		set_variable = {
			name = pilgrimage_burial_location
			value = root.location
		}
	}
}

################################
# Holy Site-specific destination arrival events
# 5001-5999
# by Sean Hughes
################################
# Christian
# pilgrimage.5001 - Rome
# pilgrimage.5011 - Jerusalem
# pilgrimage.5021 - Constantinople
# pilgrimage.5031 - Alexandria
#
# Jewish
# pilgrimage.5101 - Mount Sinai
#
# Muslim
# pilgrimage.5201 - Medina
#
# Hindu
# pilgrimage.5301 - Varanasi
# pilgrimage.5311 - Ayodhya
# pilgrimage.5321 - Mathura
# pilgrimage.5331 - Haridwar
# pilgrimage.5341 - Kanchipuram
# pilgrimage.5351 - Ujjayini
# pilgrimage.5361 - Dwarka
#
# Buddhism
# pilgrimage.5401 - Bodh Gaya
# pilgrimage.5411 - Kushinagar
# pilgrimage.5421 - Sarnath
#
# Dharmic 
# pilgrimage.5445 - Parikrama
#
# Jainism
# pilgrimage.5501 - Shikharj
#
# Zoroastrian
# pilgrimage.5601 - Ushi-darena
#
# Norse Germanic
# pilgrimage.5901 - Paderborn
#
# Tengri
# pilgrimage.5911 - Open Blue Skies
#
# Sanctity of Nature
# pilgrimage.5921 - Sacred Groves

###Christian
#Rome
pilgrimage.5001 = {
	type = activity_event
	title = pilgrimage.5001.t
	desc = pilgrimage.5001.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = { scope:activity.activity_location.county = title:c_roma }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

#Jerusalem
pilgrimage.5011 = {
	type = activity_event
	title = pilgrimage.5011.t
	desc = {
		desc = pilgrimage.5011.desc.beginning
		first_valid = {
			triggered_desc = {
				trigger = { religion = religion:islam_religion }
				desc = pilgrimage.5011.desc.muslim
			}
			triggered_desc = {
				trigger = { religion = religion:judaism_religion }
				desc = pilgrimage.5011.desc.jewish
			}
			desc = pilgrimage.5011.desc.christian
		}
		desc = pilgrimage.5011.desc.end
	}
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = ecstasy
	}
	trigger = { scope:activity.activity_location.county = title:c_jerusalem }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

#Constantinople
pilgrimage.5021 = {
	type = activity_event
	title = pilgrimage.5021.t
	desc = pilgrimage.5021.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = { scope:activity.activity_location.county = title:c_byzantion }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

#Alexandria
pilgrimage.5031 = {
	type = activity_event
	title = pilgrimage.5031.t
	desc = pilgrimage.5031.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = { scope:activity.activity_location.county = title:c_alexandria }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

###Jewish
#Mount Sinai
pilgrimage.5101 = {
	type = activity_event
	title = pilgrimage.5101.t
	desc = pilgrimage.5101.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = { scope:activity.activity_location.county = title:c_sinai }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

###Muslim
#Medina
pilgrimage.5201 = {
	type = activity_event
	title = pilgrimage.5201.t
	desc = pilgrimage.5201.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = { scope:activity.activity_location.county = title:c_medina }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

###Hindu
#Varanasi
pilgrimage.5301 = {
	type = activity_event
	title = pilgrimage.5301.t
	desc = pilgrimage.5301.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = { scope:activity.activity_location.county = title:c_varanasi }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

#Ayodhya
pilgrimage.5311 = {
	type = activity_event
	title = pilgrimage.5311.t
	desc = pilgrimage.5311.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = { scope:activity.activity_location.county = title:c_ayodhya }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

#Mathura
pilgrimage.5321 = {
	type = activity_event
	title = pilgrimage.5321.t
	desc = pilgrimage.5321.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = { scope:activity.activity_location.county = title:c_mathura }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

#Haridwar
pilgrimage.5331 = {
	type = activity_event
	title = pilgrimage.5331.t
	desc = pilgrimage.5331.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = { scope:activity.activity_location.county = title:c_sthanisvara }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

#Kanchipuram
pilgrimage.5341 = {
	type = activity_event
	title = pilgrimage.5341.t
	desc = pilgrimage.5341.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = { scope:activity.activity_location.county = title:c_kanchipuram }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

#Ujjayini
pilgrimage.5351 = {
	type = activity_event
	title = pilgrimage.5351.t
	desc = pilgrimage.5351.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = { scope:activity.activity_location.county = title:c_ujjayini }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

#Dwarka
pilgrimage.5361 = {
	type = activity_event
	title = pilgrimage.5361.t
	desc = pilgrimage.5361.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = { scope:activity.activity_location.county = title:c_dvaraka }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

###Buddhism
#Bodh Gaya
pilgrimage.5401 = {
	type = activity_event
	title = pilgrimage.5401.t
	desc = pilgrimage.5401.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = { scope:activity.activity_location.county = title:c_gaya }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

#Kushinagar
pilgrimage.5411 = {
	type = activity_event
	title = pilgrimage.5411.t
	desc = pilgrimage.5411.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = { scope:activity.activity_location.county = title:c_kusinagara }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

#Sarnath
pilgrimage.5421 = {
	type = activity_event
	title = pilgrimage.5421.t
	desc = pilgrimage.5421.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = {
		#Sarnath is literally a mile from Varanasi
		scope:activity.activity_location.county = title:c_varanasi
	}
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}
###Dharmic 
#Parikrama
# by Laurence Kennedy
pilgrimage.5445 = {
	type = activity_event
	title = pilgrimage.5445.t
	desc = pilgrimage.5445.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		animation = happiness
	}
	trigger = {
		OR = {
			religion = religion:hinduism_religion
			religion = religion:buddhism_religion
		}	   
	}
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.5445.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.5445.a_cynical
		}
		name = pilgrimage.5445.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

###Jainism
#Shikharj
pilgrimage.5501 = {
	type = activity_event
	title = pilgrimage.5501.t
	desc = pilgrimage.5501.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = { scope:activity.activity_location.county = title:c_radha }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

###Zoroastrian
#Ushi-darena
pilgrimage.5601 = {
	type = activity_event
	title = pilgrimage.5601.t
	desc = pilgrimage.5601.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = { scope:activity.activity_location.county = title:c_baduspan }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

###Norse Germanic
#Paderborn
pilgrimage.5901 = {
	type = activity_event
	title = pilgrimage.5901.t
	desc = pilgrimage.5901.desc
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	trigger = { scope:activity.activity_location.county = title:c_paderborn }
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

###Tengri
#Open Blue Skies
pilgrimage.5911 = {
	type = activity_event
	title = pilgrimage.5911.t
	desc = pilgrimage.5911.desc
	theme = pilgrimage_destination
	override_background = { reference = terrain }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

###Sanctity of Nature
#Sacred Groves
pilgrimage.5921 = {
	type = activity_event
	title = pilgrimage.5921.t
	desc = pilgrimage.5921.desc
	theme = pilgrimage_destination
	override_background = { reference = wilderness_forest }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			animation = sadness
		}
		animation = happiness
	}
	immediate = {
		play_music_cue = mx_cue_pilgrimage_arrival
	}
	#Alright
	option = {
		name = {
			trigger = { has_variable = pilgrimage_death_bury_home }
			text = pilgrimage.4001.a_dead
		}
		name = {
			trigger = { has_trait = cynical }
			text = pilgrimage.4001.a_cynical
		}
		name = pilgrimage.4001.a
		give_pilgrim_trait_or_xp_effect = yes
		pilgrimage_arrival_stress_loss_effect = yes
	}
}

################################
# Remaining at a Holy Site events
# 6500-6999
# by Filippa Gannholm Kirsten & Veronica Pazos
################################
# pilgrimage.6500 - Appreciation
# pilgrimage.6510 - Lost in Translation
# pilgrimage.6520 - Time To Go Home Soon?
# pilgrimage.6530-5 - Fishy local guide?
# pilgrimage.6540 - Find some exotic wares
# pilgrimage.6750 - Repent - remove secret/coping trait
# pilgrimage.6760 - Theological debate with facts and logic
# pilgrimage.6770 - Do you wanna buy some cheeky relic?
# pilgrimage.6780 - Recruit skillful courtier
# pilgrimage.6790 - Meet local guru - trait flipping event
# pilgrimage.6800 - Entourage member feels The Calling
# pilgrimage.6810 - Do you wanna buy an indulgence?
# pilgrimage.6820 - Do you wanna buy a pilgrim's guide? - based in the Codex Calixtinus
# pilgrimage.6830 - Admire the holy site in a religious way
# pilgrimage.6840 - Ask a local priest to bless your artifact
# pilgrimage.6850 - A Master Thief

#Appreciation
#by Filippa Gannholm Kirsten
pilgrimage.6500 = {
	type = activity_event
	title = pilgrimage.6500.t
	desc = pilgrimage.6500.desc
	theme = pilgrimage_destination
	override_background = { reference = market }
	center_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_trait = cynical }
			animation = personality_cynical
		}
		animation = personality_content
	}
	right_portrait = {
		character = scope:pilgrimage_member
		animation = survey_staff
	}
	cooldown = { years = 1 }
	trigger = {
		current_travel_plan ?= {
			any_entourage_character = { 
				count > 1
				NOR = {
					has_trait = sadistic
					has_trait = cynical
					has_trait = paranoid
					has_trait = craven
					has_trait = reclusive
					has_trait = callous
				}
				is_adult = yes
			}
		}
	}
	immediate = {
		current_travel_plan = {
			random_entourage_character = {
				limit = { 
					is_adult = yes
					NOR = {
						has_trait = sadistic
						has_trait = cynical
						has_trait = paranoid
						has_trait = craven
						has_trait = reclusive
						has_trait = callous
					}
				}
				save_scope_as = pilgrimage_member
			}
		}
	}
	#Let's frolick!
	option = {
		name = pilgrimage.6500.a
		trigger = {
			culture = { has_cultural_tradition = tradition_xenophilic }
		}
		show_as_unavailable = { 
			custom_tooltip = { text = pilgrimage.6500.a.tt } 
			NOT = {
				culture = { has_cultural_tradition = tradition_xenophilic }
			}
		}
		reason = has_cultrad
		worldly_type_option_effect = yes
		scope:pilgrimage_member = {
			add_opinion = {
				modifier = pleased_opinion
				target = root
				opinion = 20
			}
		}
		stress_impact = {
			base = medium_stress_impact_loss
			sadistic = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
			paranoid = minor_stress_impact_gain
			craven = minor_stress_impact_gain
			reclusive = minor_stress_impact_gain
		}
		ai_chance = {
			base = 200
			modifier = {
				OR = {
					has_trait = sadistic
					has_trait = cynical
					has_trait = paranoid
					has_trait = craven
					has_trait = reclusive
					has_trait = callous
				}
				factor = 0
			}
		}
	}
	#That's nice
	option = {
		name = pilgrimage.6500.b
		pious_type_option_effect = yes
		add_piety = miniscule_piety_gain
		stress_impact = {
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = cynical
				factor = 0
			}
		}
	}
	#_Technically_ ...
	option = {
		name = pilgrimage.6500.c
		trigger = { has_trait = cynical }
		stress_impact = {
			cynical = minor_stress_impact_loss
		}
		scope:pilgrimage_member = {
			add_opinion = {
				modifier = insulted_opinion
				target = root
				opinion = -10
			}
		}
		ai_chance = {
			base = 200
		}
	}
}

#Lost in Translation
#by Filippa Gannholm Kirsten
pilgrimage.6510 = {
	type = activity_event
	title = pilgrimage.6510.t
	desc = pilgrimage.6510.desc
	theme = pilgrimage_destination
	override_background = {
		trigger = {
			NOR = {
				religion = religion:hinduism_religion
				religion = religion:jainism_religion
				religion = religion:buddhism_religion
				religion = religion:tengrism_religion
			}
		}
		reference = temple
	}
	left_portrait = {
		character = root
		animation = thinking
	}
	cooldown = { years = 1 }
	#_I'll_ translate it for the unwashed masses
	option = {
		name = pilgrimage.6510.a
		flavor = pilgrimage.6510.a.flavor
		trigger = { learning >= medium_skill_rating }
		bonus_to_all_types_effect = yes
		involved_activity ?= {
			add_activity_log_entry = {
				key = pilgrimage_translator_log
				tags = { good }
				score = 50
				character = root

				#Effects
				root = {
					add_piety = minor_piety_gain
					if = {
						limit = { 
							NOT = { has_trait = scholar } 
						}
						random = {
							chance = 5
							add_trait = scholar	
						}
					}
				}
			}
		}
		stress_impact = { zealous = miniscule_stress_impact_loss }
		ai_chance = {
			base = 200
		}
	}
	#Pla-q-ue... ?
	option = {
		name = pilgrimage.6510.b
		trigger = { learning < medium_skill_rating }
		pious_type_option_effect = yes
		duel = {
			skill = learning
			value = average_skill_rating
			50 = {
				desc = pilgrimage.6510.b_success.desc
				compare_modifier = {
					value = scope:duel_value
				}
				modifier = {
					has_trait = diligent
					add = 10
				}
				modifier = {
					has_trait = scholar
					add = 10
				}
				modifier = {
					num_of_known_languages > 1
					add = 10
				}
				send_interface_toast = {
					left_icon = root
					title = pilgrimage.6510.b_success.t
					involved_activity ?= {
						add_activity_log_entry = {
							key = pilgrimage_translator_log
							tags = { good }
							score = 50
							character = root

							#Effects
							root = {
								add_learning_skill = 1
							}
						}
					}
				}
			}
			50 = {
				desc = pilgrimage.6510.b_failure.desc
				compare_modifier = {
					value = scope:duel_value
					min = 5
				}
				send_interface_toast = {
					type = event_toast_text_and_effect_bad
					left_icon = root
					title = pilgrimage.6510.b_failure.t
					desc = pilgrimage.6510.b_failure.desc
					stress_impact = { base = miniscule_stress_impact_gain }
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = lazy
					has_trait = cynical
					has_trait = paranoid
					has_trait = craven
					has_trait = reclusive
				}
				factor = 0
			}
			modifier = {
				learning >= medium_skill_rating
				factor = 0
			}
		}
	}
	#Psh who cares
	option = {
		name = pilgrimage.6510.c
		stress_impact = {
			lazy = miniscule_stress_impact_loss
			shy = miniscule_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = arrogant
				factor = 0
			}
			modifier = {
				learning >= medium_skill_rating
				factor = 0
			}
		}
	}
}

#Time To Go Home Soon?
#by Filippa Gannholm Kirsten
pilgrimage.6520 = {
	type = activity_event
	title = pilgrimage.6520.t
	desc = {
		desc = pilgrimage.6520.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_trait = zealous
						has_trait = vengeful
					}
				}
				desc = pilgrimage.6520.desc_nonforgiving
			}
			triggered_desc = {
				desc = pilgrimage.6520.desc_forgiving
			}
		}
	}
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = zealous
					has_trait = vengeful
				}
			}
			animation = anger
		}
		animation = personality_forgiving
	}
	right_portrait = {
		character = scope:impatient_pilgrim
		animation = eyeroll
	}
	cooldown = { years = 1 }
	trigger = {
		current_travel_plan ?= {
			any_entourage_character = { 
				count > 1
				OR = {
					has_trait = impatient
					has_trait = cynical
					has_trait = callous
				}
				has_any_good_relationship_with_root_trigger = yes
			}
		}
	}
	weight_multiplier = {
		base = 1
		modifier = {
			has_activity_intent = zealot_intent
			factor = 2
		}
	}
	immediate = {
		current_travel_plan ?= {
			random_entourage_character = {
				limit = {
					OR = {
						has_trait = impatient
						has_trait = cynical
						has_trait = callous
					}
					has_any_good_relationship_with_root_trigger = yes
				}
				save_scope_as = impatient_pilgrim
			}
		}
	}
	#Lecture 'em
	option = {
		name = pilgrimage.6520.a
		trigger = {
			OR = {
				has_trait = zealous
				has_trait = vengeful
			}
		}
		pious_type_option_effect = yes
		involved_activity ?= {
			add_activity_log_entry = {
				key = pilgrimage_corrective_lecture_log
				score = 50
				tags = { destination_event }
				character = root
				target = scope:impatient_pilgrim

				#Effects
				root = { 
					if = {
						limit = { 
							has_trait = pilgrim
							has_trait_xp = {
								trait = pilgrim
								value < 100
							}
						}
						add_trait_xp = {
							trait = pilgrim
							value = 10
						}
					}
					else = {
						add_piety = minor_piety_gain
					}
					worsen_relationship_effect = {
						TARGET = scope:impatient_pilgrim
						REASON = pilgrimage_corrective_lecture
					}
				}
			}
		}
		stress_impact = {
			zealous = medium_stress_impact_loss
			forgiving = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain 
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = cynical
				factor = 0
			}
			modifier = {
				has_trait = wrathful
				has_trait = zealous
				add = 100
			}
		}
	}
	#Have you tried looking around?
	option = {
		name = pilgrimage.6520.b
		pious_type_option_effect = yes
		add_piety = miniscule_piety_gain
		stress_impact = { 
			zealous = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = cynical
				factor = 0
			}
		}
	}
	#This is fine
	option = {
		name = pilgrimage.6520.c
		worldly_type_option_effect = yes
		reverse_add_opinion = {
			target = scope:impatient_pilgrim
			modifier = humored_opinion
			opinion = 10
		}
		stress_impact = { 
			zealous = medium_stress_impact_gain
			cynical = minor_stress_impact_loss
			lazy = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = zealous
				factor = 0
			}
			modifier = {
				has_trait = compassionate
				add = 100
			}
		}
	}
}

scripted_effect 6531_positive_outcome = {
	involved_activity ?= {
		add_activity_log_entry = {
			key = pilgrimage_hidden_divinity_log
			tags = { good }
			score = 50
			character = root
			show_in_conclusion = yes
			#Effects
			root = {
				add_learning_skill = 1
				give_pilgrim_xp_effect = yes
				if = {
					limit = {
						has_trait = lifestyle_traveler
						has_trait_xp = {
							trait = lifestyle_traveler
							track = travel
							value < 100
						}
					}
					add_trait_xp = {
						trait = lifestyle_traveler
						track = travel
						value = 5
					}
				}
			}
		}
	}
}

scripted_effect 6532_negative_outcome = {
	involved_activity ?= {
		add_activity_log_entry = {
			key = pilgrimage_robbed_log
			tags = { bad }
			score = 25
			character = root

			#Effects
			root = {
				remove_short_term_gold = minor_gold_value
				stress_impact = {
					base = minor_stress_impact_gain
				}
			}
		}
	}
}

#Fishy local guide?
#by Filippa Gannholm Kirsten
pilgrimage.6530 = {
	type = activity_event
	title = pilgrimage.6530.t
	desc = {
		desc = pilgrimage.6530.desc_intro
		first_valid = {
			triggered_desc = {
				trigger = { 
					scope:local_guide = { is_adult = yes }
				}
				desc = pilgrimage.6530.desc_adult
			}
			triggered_desc = {
				trigger = { 
					scope:local_guide = { is_adult = no }
				}
				desc = pilgrimage.6530.desc_child
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:warning_character }
				desc = pilgrimage.6530.desc_warning
			}
			triggered_desc = {
				trigger = { 
					learning >= high_skill_rating
					scope:local_guide = { has_character_flag = fishy_guide }
				}
				desc = pilgrimage.6530.desc_learned
			}
		}
	}
	theme = pilgrimage_destination
	override_background = { reference = market }
	left_portrait = {
		character = root
		#They're trying to fool us and it makes me _angry_
		triggered_animation = {
			trigger = { 
				learning >= high_skill_rating
				OR = {
					has_trait = wrathful
					has_trait = irritable
				}
				scope:local_guide = { 
					is_adult = yes
					has_character_flag = fishy_guide 
				}
			}
			animation = rage
		}
		#They're trying to fool us and we know it
		triggered_animation = {
			trigger = { 
				learning >= high_skill_rating
				scope:local_guide = { has_character_flag = fishy_guide }
			}
			animation = personality_cynical	
		}
		#I don't trust anyone
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = paranoid
					has_trait = craven
				}
			}
			animation = worry
		}
		#This is fine, I guess
		animation = personality_content
	}
	right_portrait = {
		character = scope:local_guide
		triggered_animation = {
			trigger = { 
				is_adult = no
				has_character_flag = fishy_guide
				root = { learning >= high_skill_rating }
			}
			animation = shame
		}
		triggered_animation = {
			trigger = { 
				is_adult = no 
			}
			animation = happiness
		}
		animation = personality_dishonorable
	}
	cooldown = { years = 1 }
	immediate = {
		random_list = {
			4 = {
				#An adult
				create_character = {
					template = generic_peasant_character
					location = root.location
					culture = root.location.county.culture
					faith = root.location.county.faith
					save_scope_as = local_guide
				}
			}
			1 = {
				#A child
				create_character = {
					#template = peasant_villager_foundling_character
					location = root.location
					age = { 5 10 }
					random_traits = yes
					culture = root.location.county.culture
					faith = root.location.county.faith
					gender_female_chance = 50
					save_scope_as = local_guide
				}
			}
		}
		random_list = {
			1 = {
				scope:local_guide = { add_character_flag = fishy_guide }
			}
			1 = {
				#Is not a fishy guide
			}
		}
		#If we're not particularly learned, find someone who can warn you in the desc
		if = {
			limit = {
				learning < high_skill_rating
				current_travel_plan ?= {
					any_entourage_character = { 
						count > 1
						is_adult = yes
						learning >= high_skill_rating 
					}
				}
				scope:local_guide = { has_character_flag = fishy_guide }
			}
			current_travel_plan ?= {
				random_entourage_character = {
					limit = { 
						is_adult = yes
						learning >= high_skill_rating 
					}
					save_scope_as = warning_character
				}
			}
		}
	}
	#I'll go along
	option = {
		name = pilgrimage.6530.a
		#This should only trigger if:
		trigger = {
			#We're learned and they're not fishy
			trigger_if = {
				limit = { learning >= high_skill_rating }
				NOT = { 
					scope:local_guide = { has_character_flag = fishy_guide } 
				}
			}
			#Or we're not learned
			trigger_else = { always = yes }
		}
		worldly_type_option_effect = yes
		add_character_flag = 6530_went_along_with_guide
		#Child outcome isn't really dangerous, show custom tooltip
		if = {
			limit = {
				scope:local_guide = { is_adult = no }
			}
			custom_tooltip = pilgrimage.6530.a_child.tt
			hidden_effect = {
				random_list = {
					#Wooh, educating roadtrip
					50 = {
						#If we're fishy we don't show you divinity
						modifier = {
							scope:local_guide = { has_character_flag = fishy_guide }
							factor = 0
						}
						#Divinity event
						trigger_event = pilgrimage.6531
					}
					#This is a trap
					50 = {
						#Non-fishy guides don't lead you to the trap
						modifier = {
							scope:local_guide = { 
								NOT = { has_character_flag = fishy_guide } 
							}
							factor = 0 
						}
						#Child heartstring event
						trigger_event = pilgrimage.6533
					}
				}
			}
		}
		#Adult outcome should show tooltip outcome
		else = {
			#If we're learned and they're not fishy this is a done deal
			if = {
				limit = {
					learning >= high_skill_rating
					NOT = { 
						scope:local_guide = { has_character_flag = fishy_guide } 
					}
				}
				random_list = {
					#Wooh, educating roadtrip
					50 = {
						show_chance = no
						desc = pilgrimage.6530.divinity.desc
						show_as_tooltip = { 6531_positive_outcome = yes }
						#Divinity event
						trigger_event = pilgrimage.6531
					}
				}
			}
			#But if we're not learned and they might be fishy then who knows
			else = {
				random_list = {
					#Wooh, educating roadtrip
					50 = {
						show_chance = no
						desc = pilgrimage.6530.divinity.desc
						#If we're fishy we don't show you divinity
						modifier = {
							scope:local_guide = { has_character_flag = fishy_guide }
							factor = 0
						}
						show_as_tooltip = { 6531_positive_outcome = yes }
						#Divinity event
						trigger_event = pilgrimage.6531
					}
					#This is a trap
					50 = {
						show_chance = no
						desc = pilgrimage.6530.dangerous.desc
						#Non-fishy guides don't lead you to the trap
						modifier = {
							scope:local_guide = { 
								NOT = { has_character_flag = fishy_guide } 
							}
							factor = 0 
						}
						show_as_tooltip = { 6532_negative_outcome = yes }
						#Trap event
						trigger_event = pilgrimage.6532
					}
				}
			}
		}
		stress_impact = { 
			paranoid = medium_stress_impact_gain
			craven = minor_stress_impact_gain 
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = craven
				factor = 0.5
			}
			modifier = {
				has_trait = paranoid
				factor = 0
			}
			modifier = {
				OR = {
					has_trait = trusting
					has_trait = gregarious
				}
				add = 100
			}
		}
	}
	#You sir, should be ashamed
	option = {
		name = {
			trigger = {
				scope:local_guide = { is_adult = no }
			}
			text = pilgrimage.6530.b_child
		}
		name = pilgrimage.6530.b
		trigger = {
			learning >= high_skill_rating
			scope:local_guide = { has_character_flag = fishy_guide }
		}
		flavor = pilgrimage.6530.b.flavor
		#Some tasty virtue piety
		if = {
			limit = {
				faith = {
					OR = {
						trait_is_virtue = forgiving
						trait_is_virtue = compassionate
					}
				}
			}
			pious_type_option_effect = yes
			add_piety = minor_piety_gain
		}
		else = {
			add_piety = miniscule_piety_gain
			stress_impact = { base = minor_stress_loss }
		}
		add_character_modifier = {
			modifier = pilgrimage_forgiving_modifier
			years = 5
		}
		stress_impact = { 
			forgiving = minor_stress_impact_loss
			compassionate = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}
	#You sir, need to pay me gold
	option = {
		name = pilgrimage.6530.c
		trigger = {
			learning >= high_skill_rating
			has_trait = greedy
			scope:local_guide = { 
				has_character_flag = fishy_guide
				is_adult = yes
			}
		}
		flavor = pilgrimage.6530.c.flavor
		#Some tasty virtue piety
		if = {
			limit = {
				faith = { trait_is_virtue = greedy }
			}
			pious_type_option_effect = yes
			add_piety = minor_piety_gain
		}
		scope:local_guide = {
			pay_short_term_gold = {
				target = root
				gold = major_gold_value
			}
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = low_negative_opinion
			}
		}
		stress_impact = { 
			greedy = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}
	#You sir, need to get whipped
	option = {
		name = pilgrimage.6530.d
		trigger = {
			learning >= high_skill_rating
			has_trait = sadistic
			scope:local_guide = { 
				has_character_flag = fishy_guide
				is_adult = yes 
			}
		}
		flavor = pilgrimage.6530.d.flavor
		#Some tasty virtue piety
		if = {
			limit = {
				faith = {
					OR = {
						trait_is_virtue = wrathful
						trait_is_virtue = irritable
						trait_is_virtue = sadistic
						trait_is_virtue = flagellant
					}
				}
			}
			pious_type_option_effect = yes
			add_piety = minor_piety_gain
		}
		add_dread = medium_dread_gain
		scope:local_guide = {
			increase_wounds_effect = { REASON = whipping }
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = low_negative_opinion
			}
		}
		stress_impact = { 
			sadistic = minor_stress_impact_loss
			flagellant = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = forgiving
					has_trait = compassionate
				}
				factor = 0
			}
		}
	}
	#I don't want any part in this
	option = {
		name = pilgrimage.6530.e
		if = {
			limit = {
				learning >= high_skill_rating
				OR = {
					has_trait = wrathful
					has_trait = irritable
					has_trait = sadistic
				}
				scope:local_guide = { has_character_flag = fishy_guide }
			}
			stress_impact = { 
				wrathful = minor_stress_impact_gain
				irritable = minor_stress_impact_gain 
			}
		}
		ai_chance = {
			base = 50
		}
	}
	after = {
		if = {
			limit = {
				NOT = { has_character_flag = 6530_went_along_with_guide }
			}
			#Clean up created characters
			trigger_event = {
				id = pilgrimage.6535
				days = 5
			}
		}
	}
}

#Fishy guide not so fishy actually
pilgrimage.6531 = {
	type = activity_event
	title = pilgrimage.6531.t
	desc = {
		random_valid = {
			desc = pilgrimage.6531.desc_wellspring
			desc = pilgrimage.6531.desc_crystal_cavern
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_trait = cynical
						any_secret = { type = secret_non_believer }
					}
				}
				desc = pilgrimage.6531.desc_cynical
			}
			triggered_desc = {
				desc = pilgrimage.6531.desc_non_cynical
			}
		}
	}
	theme = pilgrimage_destination
	override_background = { 
		trigger = {
			NOT = { 
				root.location = { geographical_region = world_middle_east } 
			}
		}
		reference = ep2_hunt_forest_cave 
	}
	override_background = { 
		trigger = { 
			root.location = { geographical_region = world_middle_east }
		}
		reference = wilderness 
	}
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = cynical
					any_secret = { type = secret_non_believer }
				}
			}
			animation = thinking
		}
		animation = prayer
	}
	right_portrait = {
		character = scope:local_guide
		animation = personality_content
	}
	immediate = {
		remove_character_flag = 6530_went_along_with_guide
		6531_positive_outcome = yes
	}
	#This is quite something!
	option = {
		name = pilgrimage.6531.a
		bonus_to_all_types_effect = yes
		ai_chance = {
			base = 100
		}
	}
	after = {
		#Clean up created characters
		trigger_event = {
			id = pilgrimage.6535
			days = 5
		}
	}
}

#Fishy guide _was_ fishy!
pilgrimage.6532 = {
	type = activity_event
	title = pilgrimage.6532.t
	desc = pilgrimage.6532.desc
	theme = pilgrimage_destination
	override_background = { 
		trigger = {
			NOT = { 
				root.location = { geographical_region = world_middle_east } 
			}
		}
		reference = ep2_hunt_foggy_forest
	}
	override_background = { 
		trigger = { 
			root.location = { geographical_region = world_middle_east }
		}
		reference = terrain_travel
	}
	left_portrait = {
		character = root
		animation = fear
	}
	right_portrait = {
		character = scope:6532_local_bandit
		animation = hunting_knife_start
	}
	lower_left_portrait = {
		trigger = { exists = scope:6532_protector }
		character = scope:6532_protector
	}
	lower_right_portrait = {
		character = scope:local_guide
	}
	immediate = {
		remove_character_flag = 6530_went_along_with_guide
		if = {
			limit = {
				any_pool_character = {
					province = root.location
					2002_local_prowess_character_trigger = yes
				}
			}
			random_pool_character = {
				province = root.location
				limit = { 2002_local_prowess_character_trigger = yes }
				save_scope_as = 6532_local_bandit
			}
		}
		else = {
			scope:local_guide = { save_scope_as = value_target }
			create_character = {
				template = new_warrior_character
				location = root.location
				culture = root.location.county.culture
				faith = root.location.county.faith
				gender_female_chance = scope_value_target_soldier_female_chance
				prowess = { medium_skill_rating high_skill_rating }
				save_scope_as = 6532_local_bandit
			}
			scope:6532_local_bandit = { add_character_flag = created_bandit }
		}
		if = {
			limit = {
				current_travel_plan ?= {
					any_entourage_character = { 
						OR = {
							has_court_position = bodyguard_court_position
							has_court_position = akolouthos_court_position
							is_knight_of = root
						}
					}
				}
			}
			current_travel_plan ?= {
				random_entourage_character = { 
					limit = { has_court_position = akolouthos_court_position }
					alternative_limit = { has_court_position = bodyguard_court_position }
					alternative_limit = { is_knight_of = root }
					save_scope_as = 6532_protector
				}
			}
		}
		if = {
			limit = { exists = scope:warning_character }
			reverse_add_opinion = {
				target = scope:warning_character
				modifier = ignored_opinion
				opinion = low_negative_opinion
			}
		}
	}
	#Bodyguard! Pls!
	option = {
		name = pilgrimage.6532.a
		trigger = { exists = scope:6532_protector }
		scope:6532_protector = {
			duel = {
				skill = prowess
				target = scope:6532_local_bandit
				75 = { 
					desc = pilgrimage.6532.a_success.desc
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
					}
					send_interface_toast = {
						type = event_toast_text_good
						title = pilgrimage.6532.a_success.t
						left_icon = scope:6532_protector
						right_icon = scope:6532_local_bandit
						desc = pilgrimage.6532.a_success.desc
					}
					scope:6532_protector = { add_prowess_skill = 1 }
				}
				25 = {
					desc = pilgrimage.6532.a_failure.desc
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
					}
					send_interface_toast = {
						type = event_toast_effect_bad
						title = pilgrimage.6532.a_failure.t
						left_icon = scope:6532_protector
						right_icon = scope:6532_local_bandit
						scope:6532_protector = {
							increase_wounds_effect = { REASON = attacked }
						}
					}
				}
			}
		}
		ai_chance = {
			base = 200
			modifier = {
				has_perk = zealous_proselytizer_perk
				factor = 0
			}
		}
	}
	#By the power of zeal!
	option = {
		name = pilgrimage.6532.b
		trigger = { has_perk = zealous_proselytizer_perk }
		show_as_unavailable = { 
			NOT = { has_perk = zealous_proselytizer_perk }
		}
		custom_tooltip = pilgrimage.6532.c_success.desc
		involved_activity ?= {
			add_activity_log_entry = {
				key = pilgrimage_exorcism_log
				tags = { good }
				score = 50
				character = root

				#Effects
				root = {
					add_piety = medium_piety_gain
				}
			}
		}
		ai_chance = {
			base = 200
		}
	}
	#Attempt to scare them off
	option = {
		name = pilgrimage.6532.c
		duel = {
			skills = { learning intrigue }
			value = medium_skill_rating
			75 = { 
				desc = pilgrimage.6532.c_success.desc
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				modifier = {
					has_trait = possessed
					factor = 2
				}
				send_interface_toast = {
					type = event_toast_effect_good
					title = pilgrimage.6532.c_success.t
					left_icon = root
					right_icon = scope:6532_local_bandit
					involved_activity ?= {
						add_activity_log_entry = {
							key = pilgrimage_exorcism_log
							tags = { good }
							score = 50
							character = root

							#Effects
							root = {
								if = {
									limit = { 
										NOT = { has_perk = zealous_proselytizer_perk } 
									}
									add_perk = zealous_proselytizer_perk
								}
								else = {
									add_piety = medium_piety_gain
								}
							}
						}
					}
				}
			}
			25 = {
				desc = pilgrimage.6532.c_failure.desc
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}
				send_interface_toast = {
					type = event_toast_effect_bad
					title = pilgrimage.6532.c_failure.t
					left_icon = root
					right_icon = scope:6532_local_bandit
					6532_negative_outcome = yes
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				exists = scope:6532_protector
				factor = 0
			}
			modifier = {
				has_perk = zealous_proselytizer_perk
				factor = 0
			}
		}
	}
	after = {
		#Clean up created characters
		trigger_event = {
			id = pilgrimage.6535
			days = 5
		}
	}
}

#Fishy child breaks down
pilgrimage.6533 = {
	type = activity_event
	title = pilgrimage.6533.t
	desc = pilgrimage.6533.desc
	theme = pilgrimage_destination
	override_background = { 
		trigger = {
			NOT = { 
				root.location = { geographical_region = world_middle_east } 
			}
		}
		reference = ep2_hunt_foggy_forest
	}
	override_background = { 
		trigger = { 
			root.location = { geographical_region = world_middle_east }
		}
		reference = terrain_travel
	}
	left_portrait = {
		character = root
		animation = disbelief
	}
	right_portrait = {
		character = scope:local_guide
		animation = sadness
	}
	immediate = {
		remove_character_flag = 6530_went_along_with_guide
	}
	#Show some compassion
	option = {
		name = pilgrimage.6533.a
		flavor = pilgrimage.6533.a.flavor
		bonus_to_all_types_effect = yes
		#Some tasty virtue piety
		involved_activity ?= {
			add_activity_log_entry = {
				key = pilgrimage_helped_child_log
				tags = { good }
				score = 50
				character = root

				#Effects
				root = {
					if = {
						limit = {
							faith = {
								OR = {
									trait_is_virtue = forgiving
									trait_is_virtue = compassionate
								}
							}
						}
						add_piety = medium_piety_gain
					}
					else = {
						add_character_modifier = {
							modifier = pilgrimage_forgiving_modifier
							years = 5
						}
					}
					pay_short_term_gold = {
						target = scope:local_guide
						gold = medium_gold_value
					}
				}
			}
		}
		stress_impact = {
			forgiving = major_stress_impact_loss
			compassionate = medium_stress_impact_loss
			vengeful = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = callous
					has_trait = greedy
					has_trait = vengeful
				}
				factor = 0
			}
			modifier = {
				short_term_gold < medium_gold_value
				factor = 0
			}
		}
	}
	#Unacceptable!
	option = {
		name = pilgrimage.6533.b
		flavor = pilgrimage.6533.b.flavor
		stress_impact = {
			forgiving = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
			vengeful = major_stress_impact_loss
			callous = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = forgiving
					has_trait = compassionate
					has_trait = generous
				}
				factor = 0
			}
		}
	}
	after = {
		#Clean up created characters
		trigger_event = {
			id = pilgrimage.6535
			days = 5
		}
	}
}

#To avoid people being cleaned up or dying before the chain is completed :angery:
pilgrimage.6535 = {
	hidden = yes
	immediate = {
		if = {
			limit = {
				scope:local_guide ?= { is_alive = yes }
			}
			scope:local_guide = {
				if = {
					limit = {
						root = { is_ai = yes }
					}
					silent_disappearance_effect = yes
				}
			}
		}
		
		if = {
			limit = { 
				scope:6532_local_bandit ?= { 
					is_alive = yes
					has_character_flag = created_bandit 
				}
			}
			scope:6532_local_bandit = {
				if = {
					limit = {
						root = { is_ai = yes }
					}
					silent_disappearance_effect = yes
				}
			}
		}
	}
}

scripted_trigger 6540_wares_vendor_trigger = {
	age = { 20 40 }
	is_lowborn = yes
	stewardship = {
		min_template_decent_skill
		max_template_decent_skill
	}
	OR = {
		has_trait = education_stewardship_2
		has_trait = education_stewardship_3
		has_trait = education_stewardship_4
		has_trait = education_stewardship_5
	}
}

#Find some exotic wares
#by Filippa Gannholm Kirsten
pilgrimage.6540 = {
	type = activity_event
	title = pilgrimage.6540.t
	desc = pilgrimage.6540.desc
	theme = pilgrimage_destination
	override_background = { reference = market }
	center_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				has_trait = zealous
			}
			animation = disapproval
		}
		animation = betting
	}
	right_portrait = {
		character = scope:6540_vendor
		animation = storyteller
	}
	cooldown = { years = 10 }
	trigger = { 
		#This is more for human flavor
		is_ai = no 
	}
	weight_multiplier = {
		base = 1
		modifier = {
			scope:activity = {
				has_activity_option = {
					category = special_type
					option = pilgrimage_type_worldly
				}
			}
			factor = 2
		}
	}
	immediate = {
		if = {
			limit = {
				any_pool_character = {
					province = root.location
					6540_wares_vendor_trigger = yes
				}
			}
			random_pool_character = {
				province = root.location
				limit = { 6540_wares_vendor_trigger = yes }
				save_scope_as = 6540_vendor
			}
		}
		else = {
			create_character = {
				location = root.location
				random_traits_list = {
					count = 1
					education_stewardship_1 = {}
					education_stewardship_2 = {}
					education_stewardship_3 = {}
					education_stewardship_4 = {}
				}
				random_traits = yes
				dynasty = none
				faith = root.location.county.faith
				culture = root.location.county.culture
				gender_female_chance = 50
				stewardship = {
					min_template_decent_skill
					max_template_decent_skill
				}
				save_scope_as = 6540_vendor
			}
			scope:6540_vendor = { add_character_flag = created_merchant }
		}
	}
	#Buy the goods
	option = {
		name = pilgrimage.6540.a
		flavor = pilgrimage.6540.a.flavor
		worldly_type_option_effect = yes
		custom_tooltip = pilgrimage.6540.a.tt
		pay_short_term_gold = {
			target = scope:6540_vendor
			gold = minor_gold_value
		}
		involved_activity = {
			add_activity_log_entry = {
				key = pilgrimage_exotic_wares_log
				tags = { destination_event }
				score = 50
				character = root

				#Effects
				root = {
					add_character_modifier = {
						modifier = pilgrimage_exotic_wares_modifier
					}
				}
			}
		}
		set_variable = {
			name = 6540_exotic_wares_cost
			value = minor_gold_value
		}
		stress_impact = { zealous = minor_stress_impact_gain }
	}
	#High stewardship; better goods!
	option = {
		name = pilgrimage.6540.b
		flavor = pilgrimage.6540.b.flavor
		trigger = { stewardship >= high_skill_rating }
		worldly_type_option_effect = yes
		custom_tooltip = pilgrimage.6540.a.tt
		pay_short_term_gold = {
			target = scope:6540_vendor
			gold = medium_gold_value
		}
		involved_activity = {
			add_activity_log_entry = {
				key = pilgrimage_exotic_wares_log
				tags = { destination_event }
				score = 50
				character = root

				#Effects
				root = {
					add_character_modifier = {
						modifier = pilgrimage_super_exotic_wares_modifier
					}
				}
			}
		}
		set_variable = {
			name = 6540_exotic_wares_cost
			value = medium_gold_value
		}
		stress_impact = { zealous = minor_stress_impact_gain }
	}
	#Pass
	option = {
		name = pilgrimage.6540.c
		if = {
			limit = {
				faith = {
					NOT = { trait_is_virtue = greedy }
				}
			}
			pious_type_option_effect = yes
		}
		stress_impact = { zealous = minor_stress_impact_loss }
	}
	after = {
		if = {
			limit = {
				OR = {
					has_character_modifier = pilgrimage_exotic_wares_modifier
					has_character_modifier = pilgrimage_super_exotic_wares_modifier
				}
			}
			set_variable = {
				name = 6540_exotic_wares_location
				value = root.location
			}
		}
		scope:6540_vendor = {
			if = {
				limit = { has_character_flag = created_merchant }
				if = {
					limit = {
						root = { is_ai = yes }
					}
					silent_disappearance_effect = yes
				}
			}
		}
	}
}

#Repentance
#by Veronica Pazos
pilgrimage.6750 = {
	type = activity_event
	title = pilgrimage.6750.t
	desc = {
		desc = pilgrimage.6750.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					any_secret = { is_criminal_for = secret_owner }
				}
				desc = pilgrimage.6750.desc.secret
			}
			triggered_desc = {
				trigger = {
					has_trait = drunkard
				}
				desc = pilgrimage.6750.desc.drunkard
			}
			triggered_desc = {
				trigger = {
					has_trait = hashishiyah
				}
				desc = pilgrimage.6750.desc.hashishiyah
			}
			triggered_desc = {
				trigger = {
					has_trait = rakish
				}
				desc = pilgrimage.6750.desc.rakish
			}
			triggered_desc = {
				trigger = {
					has_trait = irritable
				}
				desc = pilgrimage.6750.desc.irritable
			}
			triggered_desc = {
				trigger = {
					has_trait = flagellant
				}
				desc = pilgrimage.6750.desc.flagellant
			}
			triggered_desc = {
				trigger = {
					has_trait = contrite
				}
				desc = pilgrimage.6750.desc.contrite
			}
			triggered_desc = {
				trigger = {
					has_trait = profligate
				}
				desc = pilgrimage.6750.desc.profligate
			}
			triggered_desc = {
				trigger = {
					has_trait = comfort_eater
				}
				desc = pilgrimage.6750.desc.comfort_eater
			}
			triggered_desc = {
				trigger = {
					has_trait = inappetetic
				}
				desc = pilgrimage.6750.desc.inappetetic
			}
		}
		desc = pilgrimage.6750.desc.outro
	}
	theme = pilgrimage_destination
	override_background = {
		trigger = {
			NOR = {
				religion = religion:hinduism_religion
				religion = religion:jainism_religion
				religion = religion:buddhism_religion
				religion = religion:tengrism_religion
			}
		}
		reference = temple
	}
	left_portrait = {
		character = root
		animation = beg
	}
	#We don't really need a cooldown since it's once per character
	trigger = {
		has_dlc_feature = tours_and_tournaments
		NOT = { has_variable = had_pilgrimage_event_6750 }
		OR = { #you have something to repent
			any_secret = { is_criminal_for = secret_owner }
			has_a_bad_stress_coping_trait_trigger = yes
		}
		OR = { #you're in a religious journey
			has_activity_intent = zealot_intent
			scope:activity = {
				has_activity_option = {
					category = special_type
					option = pilgrimage_type_pious
				}
			}
		}
	}
	immediate = {
		set_variable = had_pilgrimage_event_6750 #once per character
		location = { save_scope_as = repent_location }
		if = {
			limit = {
				any_secret = { is_criminal_for = secret_owner }
			}
			random_secret = {
				limit = { is_criminal_for = secret_owner }
				save_scope_as = repent_trait
			}
		}
	}
	#I regret it all
	option = {
		name = pilgrimage.6750.a
		pious_type_option_effect = yes
		involved_activity = {
			add_activity_log_entry = {
				key = pilgrimage_repented_log
				tags = { destination_event }
				score = 50
				character = root
				location = scope:repent_location
				show_in_conclusion = yes
				#Effects
				root = {
					add_piety = medium_piety_gain
					if = {
						limit = {
							any_secret = { is_criminal_for = secret_owner }
						}
						scope:repent_trait = { remove_secret = yes }
					}
					else_if = {
						limit = { has_trait = drunkard }
						remove_trait = drunkard
					}
					else_if = {
						limit = { has_trait = hashishiyah }
						remove_trait = hashishiyah
					}
					else_if = {
						limit = { has_trait = rakish }
						remove_trait = rakish
					}
					else_if = {
						limit = { has_trait = irritable }
						remove_trait = irritable
					}
					else_if = {
						limit = { has_trait = flagellant }
						remove_trait = flagellant
					}
					else_if = {
						limit = { has_trait = contrite }
						remove_trait = contrite
					}
					else_if = {
						limit = { has_trait = profligate }
						remove_trait = profligate
					}
					else_if = {
						limit = { has_trait = comfort_eater }
						remove_trait = comfort_eater
					}
					else_if = {
						limit = { has_trait = inappetetic }
						remove_trait = inappetetic
					}
				}
			}
		}
		stress_impact = {
			base = major_stress_impact_gain
			zealous = major_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 0.75
				ai_compassion = 1.25
				ai_honor = 1.5
			}
		}
	}
	
	#Je ne regrette rien
	option = {
		name = pilgrimage.6750.b
		worldly_type_option_effect = yes
		stress_impact = {
			base = major_stress_impact_loss
			zealous = massive_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = zealous
			}
		}
	}
}

#Theological Debate
#by Veronica Pazos
pilgrimage.6760 = {
	type = activity_event
	title = pilgrimage.6760.t
	desc = {
		desc = pilgrimage.6760.desc.intro
		desc = pilgrimage.6760.desc.christian
	}
	theme = pilgrimage_destination
	override_background = {
		trigger = {
			NOR = {
				religion = religion:hinduism_religion
				religion = religion:jainism_religion
				religion = religion:buddhism_religion
				religion = religion:tengrism_religion
			}
		}
		reference = temple
	}
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:bishop_pilgrim
		animation = chaplain
	}
	cooldown = { years = 2 }
	
	trigger = {
		OR = {
			faith.religion = religion:eastern_orthodox_religion 
			faith.religion = religion:catholic_religion 
			faith.religion = religion:protestant_religion 
		}
		OR = {
			NOR = {
				faith = faith:orthodox
				faith = faith:catholic
			}
			any_secret = { type = secret_non_believer }
		}
		location.county.holder.cp:councillor_court_chaplain ?= {
			faith.religion ?= religion:christianity_religion
			OR = {
				NOR = {
					faith = faith:orthodox
					faith = faith:catholic
				}
				any_secret = { type = secret_non_believer }
			}
		}
	}
	
	immediate = {
		if = {
			limit = { exists = location.county.holder.cp:councillor_court_chaplain }
			location.county.holder.cp:councillor_court_chaplain = { save_scope_as = bishop_pilgrim }
		}
		else = {
			location.county.holder = {
				ordered_courtier_or_guest = {
					order_by = {
						value = learning
						if = {
							limit = { has_trait = theologian }
							add = 50
						}
						if = {
							limit = { has_trait = zealous }
							add = 20
						}
						if = {
							limit = { has_trait = cynical }
							add = -50
						}
						if = {
							limit = {
								NOR = {
									faith = faith:orthodox
									faith = faith:catholic
								}
								faith.religion ?= religion:christianity_religion
							}
							add = 100
						}
					}
					save_scope_as = bishop_pilgrim
				}
			}
		}
	}
	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			has_lifestyle = learning_lifestyle
		}
		modifier = {
			factor = 2
			OR = { #you're in a religious journey
				has_activity_intent = zealot_intent
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = pilgrimage_type_pious
					}
				}
			}
		}
	}
	#HEATHEN!
	option = {
		name = pilgrimage.6760.a
		pious_type_option_effect = yes
		add_piety = medium_piety_gain
		scope:bishop_pilgrim = {
			add_opinion = {
				target = root
				modifier = insulted_opinion
				opinion = -50
			}
		}
		stress_impact = {
			calm = minor_stress_impact_gain
			gregarious = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				has_trait = zealous
			}
			modifier = {
				factor = 1.5
				OR = {
					has_trait = wrathful
					has_trait = vengeful
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = calm
					has_trait = gregarious
					has_trait = cynical
				}
			}
		}
	}
	#Refute back
	option = {
		name = pilgrimage.6760.b
		duel = {
			skill = learning
			target = scope:bishop_pilgrim
			50 = { #this is HARD
				desc = pilgrimage.6760.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				modifier = {
					add = 25
					OR = {
						has_trait = theologian
						has_trait = zealous
					}
				}
				send_interface_toast = {
					title = pilgrimage.6760.b.success
					left_icon = root
					right_icon = scope:bishop_pilgrim
					involved_activity ?= {
						add_activity_log_entry = {
							key = pilgrimage_theological_debate_log
							tags = { good }
							score = 50
							character = root
							target = scope:bishop_pilgrim

							#Effects
							root = {
								if = {
									limit = { NOT = { has_perk = zealous_proselytizer_perk } }
									add_perk = zealous_proselytizer_perk
								}
								else = {
									add_learning_lifestyle_xp = major_lifestyle_experience
								}
							}
						}
					}
				}
			}
			50 = {
				desc = pilgrimage.6760.b.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}
				send_interface_toast = {
					title = pilgrimage.6760.b.failure
					left_icon = root
					right_icon = scope:bishop_pilgrim
					involved_activity ?= {
						add_activity_log_entry = {
							key = pilgrimage_theological_debate_log
							tags = { bad }
							score = 50
							character = root
							target = scope:bishop_pilgrim

							#Effects
							root = { add_piety = minor_piety_loss }
						}
					}
				}
			}
		}
		stress_impact = {
			calm = minor_stress_impact_gain
			gregarious = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 1.5
				has_lifestyle = learning_lifestyle
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = lazy
					has_trait = gregarious
					has_trait = cynical
				}
			}
		}
	}
	#Let's just revel
	option = {
		name = pilgrimage.6760.c
		worldly_type_option_effect = yes
		if = {
			limit = {
				can_set_relation_friend_trigger = { CHARACTER = scope:bishop_pilgrim }
			}
			set_relation_friend = {
				target = scope:bishop_pilgrim
				reason = friend_theological_debate
			}
		}
		stress_impact = {
			base = medium_stress_impact_loss
			zealous = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = zealous
			}
		}
	}
}

scripted_effect pilgrimage_6770_relic_effect = {
	if = {
		limit = { has_trait = trusting }
		add_piety = medium_piety_gain
		add_prestige = medium_prestige_gain
	}
	else = {
		add_piety = minor_piety_gain
	}
}

scripted_trigger pilgrimage_6770_trigger = {
	age = { 20 60 }
	is_lowborn = yes
	has_faith = root.faith #We are looking for a relic merchant who sells relics we have an interest in and can use.
	stewardship = {
		min_template_decent_skill
		max_template_decent_skill
	}
}

#Do you wanna buy a cool relic?
#by Veronica Pazos
pilgrimage.6770 = {
	type = activity_event
	title = pilgrimage.6770.t
	desc = {
		desc = pilgrimage.6770.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
				}
				desc = pilgrimage.6770.desc.christian
			}
			triggered_desc = {
				trigger = {
					religion = religion:islam_religion
				}
				desc = pilgrimage.6770.desc.islam
			}
			triggered_desc = {
				trigger = {
					religion = religion:buddhism_religion
				}
				desc = pilgrimage.6770.desc.buddhist
			}
			triggered_desc = {
				trigger = {
					religion = religion:judaism_religion
				}
				desc = pilgrimage.6770.desc.judaism
			}
			desc = pilgrimage.6770.desc.fallback
		}
		desc = pilgrimage.6770.desc.outro
	}
	theme = pilgrimage_destination
	override_background = { reference = market }
	center_portrait = {
		character = root
		animation = interested
	}
	right_portrait = {
		character = scope:relic_merchant
		animation = debating
	}
	artifact = {
		target = scope:merchant_relic
		position = lower_center_portrait
	}
	cooldown = { years = 1 }
	immediate = {
		location = { save_scope_as = relic_location }
		if = {
			limit = {
				any_pool_character = {
					province = root.location
					pilgrimage_6770_trigger = yes
				}
			}
			random_pool_character = {
				province = root.location
				limit = { pilgrimage_6770_trigger = yes }
				save_scope_as = relic_merchant
			}
		}
		else = {
			create_character = {
				template = merchant_template
				dynasty = none
				location = root.location
				culture = root.location.culture
				faith = root.faith #We are interested in relics we can use
				save_scope_as = relic_merchant
			}
			set_variable = created_random_merchant_var
		}
		hidden_effect_new_object = {
			if = {
				limit = { OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion } }
				create_artifact_pedestal_reliquary_christian_effect = { OWNER = scope:relic_merchant }
			}
			else_if = {
				limit = { religion = religion:islam_religion }
				create_artifact_pedestal_reliquary_islam_effect = { OWNER = scope:relic_merchant }
			}
			else_if = {
				limit = { religion = religion:buddhism_religion }
				create_artifact_pedestal_reliquary_buddhism_effect = { OWNER = scope:relic_merchant }
			}
			else_if = {
				limit = { religion = religion:judaism_religion }
				create_artifact_pedestal_reliquary_judaism_effect = { OWNER = scope:relic_merchant }
			}
			else = {
				create_artifact_sculpture_religious_effect = { OWNER = scope:relic_merchant }
			}
			scope:newly_created_artifact = {
				save_scope_as = merchant_relic
				if = {
					limit = {
						NOT = {
							root = { has_royal_court = yes }
						}
					}
					reforge_artifact = { type = miscellaneous }
				}
			}
		}
	}
	weight_multiplier = {
		base = 1
	}
	#Buy
	option = {
		name = pilgrimage.6770.a
		bonus_to_all_types_effect = yes
		involved_activity ?= {
			add_activity_log_entry = {
				key = pilgrimage_acquired_relic_log
				tags = { relic }
				score = 50
				character = root
				artifact = scope:newly_created_artifact
				location = scope:relic_location
				show_in_conclusion = yes
				# Effects
				root = { pilgrimage_6770_relic_effect = yes }
				scope:merchant_relic = { set_owner = root }
			}
		}
		pay_short_term_gold = {
			target = scope:relic_merchant
			gold = {
				value = minor_gold_value
				max = 10
			}
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			avaricious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				short_term_gold <= minor_gold_value
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = avaricious
				}
			}
		}
	}
	#Barter
	option = {
		name = pilgrimage.6770.b
		worldly_type_option_effect = yes
		duel = {
			skills = { diplomacy stewardship }
			target = scope:relic_merchant
			50 = {
				desc = pilgrimage.6770.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				send_interface_toast = {
					title = pilgrimage.6770.b.success
					left_icon = root
					involved_activity ?= {
						add_activity_log_entry = {
							key = pilgrimage_acquired_relic_log
							tags = { relic }
							score = 50
							character = root
							artifact = scope:newly_created_artifact
							location = scope:relic_location
							show_in_conclusion = yes
							# Effects
							root = { pilgrimage_6770_relic_effect = yes }
							scope:merchant_relic = { set_owner = root }
						}
					}
					pay_short_term_gold = {
						target = scope:relic_merchant
						gold = {
							value = minor_gold_value
							max = 5
						}
					}
				}
			}
			50 = {
				desc = pilgrimage.6770.b.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}
				send_interface_toast = {
					title = pilgrimage.6770.b.failure
					left_icon = root
					scope:relic_merchant = {
						add_opinion = {
							target = root
							modifier = insulted_opinion
							opinion = -10
						}
					}
				}
			}
		}
		stress_impact = {
			lazy = minor_stress_impact_gain
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				short_term_gold <= minor_gold_value
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = lazy
					has_trait = gregarious
				}
			}
		}
	}
	#Nah
	option = {
		name = pilgrimage.6770.c
		stress_impact = {
			zealous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = zealous
			}
		}
	}
	#Is this... a real piece?
	option = {
		name = pilgrimage.6770.d
		trigger = { learning >= high_skill_rating }
		bonus_to_all_types_effect = yes
		if = {
			limit = { has_lifestyle = learning_lifestyle }
			add_learning_lifestyle_xp = major_lifestyle_experience
		}
		else = {
			add_character_modifier = keen_eye_modifier
		}
		stress_impact = {
			base = major_stress_impact_loss
			zealous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = zealous
			}
		}
	}
	after = {
		if = {
			limit = {
				is_ai = yes
				has_variable = created_random_merchant_var #we only kill them if we created them, not if they came from the pool
			}
			scope:relic_merchant = {
				if = {
					limit = {
						root = { is_ai = yes }
					}
					silent_disappearance_effect = yes
				}
			}
			remove_variable = created_random_merchant_var
		}
	}
}

#Recruit skillful local
#by Veronica Pazos
pilgrimage.6780 = {
	type = activity_event
	title = pilgrimage.6780.t
	desc = pilgrimage.6780.desc
	theme = pilgrimage_destination
	override_background = { reference = relaxing_room }
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:stolen_courtier
		animation = thinking
	}
	lower_center_portrait = scope:current_employer
	cooldown = { years = 1 }
	trigger = {
		location.county.holder ?= {
			is_ai = yes
			this != root
			OR = {
				any_court_position_holder = {
					location = root.location
					is_physically_able_adult = yes
					is_available = yes
					is_landed = no
				}
				any_courtier_or_guest = {
					is_physically_able_adult = yes
					has_any_high_skill_rating = yes
					is_available = yes
				}
			}
		}
	}
	immediate = {
		location.county.holder = { save_scope_as = current_employer }
		if = {
			limit = {
				scope:current_employer = {
					any_court_position_holder = {
						location = root.location
						is_physically_able_adult = yes
						is_available = yes
						is_landed = no
					}
				}
			}
			scope:current_employer = {
				random_court_position_holder = {
					limit = {
						location = root.location
						is_physically_able_adult = yes
						is_available = yes
						is_landed = no
					}
					save_scope_as = stolen_courtier
				}
			}
		}
		else = {
			scope:current_employer = {
				random_courtier_or_guest = {
					limit = {
						is_physically_able_adult = yes
						has_any_high_skill_rating = yes
						is_available = yes
					}
					save_scope_as = stolen_courtier
				}
			}
		}
	}
	weight_multiplier = {
		base = 1
	}
	#My court is so much better than this one
	option = {
		name = pilgrimage.6780.b
		trigger = { diplomacy >= high_skill_rating } 
		show_as_unavailable = { diplomacy < high_skill_rating }
		skill = diplomacy
		duel = {
			skill = diplomacy
			target = scope:current_employer
			50 = { #you convince them
				desc = pilgrimage.6780.b.success.desc
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				send_interface_toast = {
					title = pilgrimage.6780.b.success.t
					left_icon = root
					right_icon = scope:stolen_courtier
					involved_activity ?= {
						add_activity_log_entry = {
							key = pilgrimage_recruited_courtier_log
							tags = { good }
							score = 50
							character = root
							target = scope:stolen_courtier

							#Effects
							root = {
								recruit_to_entourage_court_and_activity_effect = { 
									CHAR_TO_ADD = scope:stolen_courtier 
									NEW_COURT_OWNER = root 
								}
							}
						}
					}
				}
				hidden_effect = {
					reverse_add_opinion = {
						target = scope:stolen_courtier
						modifier = recruited_me_opinion
						opinion = 30
					}
				}
			}
			50 = { #theyre not impressed
				desc = pilgrimage.6780.b.failure.desc
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = 5
				}
				send_interface_toast = {
					type = event_toast_effect_bad
					title = pilgrimage.6780.b.failure.t
					right_icon = scope:stolen_courtier
					desc = pilgrimage.6780.b.failure.desc
				}
			}
		}
		if = {
			limit = {
				OR = {
					scope:stolen_courtier = {
						is_of_major_or_minor_interest_trigger = { CHARACTER = scope:stolen_courtier }
					}
					NOT = { has_relation_nemesis = scope:current_employer }
				}
			}
			progress_towards_rival_effect = {
				REASON = pilgrimage_poached_courtier
				CHARACTER = scope:current_employer
				OPINION = -10
			}
		}
		else = {
			scope:current_employer = {
				add_opinion = {
					target = root
					modifier = angry_opinion
					opinion = -20
				}
			}
		}
		stress_impact = {
			honest = medium_stress_impact_gain
			loyal = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = honest
					has_trait = loyal
				}
			}
		}
	}
	#Hey you wanna come work for me?
	option = {
		name = pilgrimage.6780.a
		pay_short_term_gold = {
			target = scope:stolen_courtier
			gold = minor_gold_value
		}
		custom_tooltip = obligation_hook_tt
		add_hook = {
			type = obligation_hook
			target = scope:stolen_courtier
		}
		involved_activity ?= {
			add_activity_log_entry = {
				key = pilgrimage_recruited_courtier_log
				tags = { good }
				score = 50
				character = root
				target = scope:stolen_courtier

				#Effects
				root = {
					recruit_to_entourage_court_and_activity_effect = { 
						CHAR_TO_ADD = scope:stolen_courtier 
						NEW_COURT_OWNER = root 
					}
				}
			}
		}
		hidden_effect = {
			reverse_add_opinion = {
				target = scope:stolen_courtier
				modifier = recruited_me_opinion
				opinion = 30
			}
		}
		if = {
			limit = {
				OR = {
					scope:stolen_courtier = {
						is_of_major_or_minor_interest_trigger = { CHARACTER = scope:stolen_courtier }
					}
					NOT = { has_relation_nemesis = scope:current_employer }
				}
			}
			progress_towards_rival_effect = {
				REASON = pilgrimage_poached_courtier
				CHARACTER = scope:current_employer
				OPINION = -10
			}
		}
		else = {
			scope:current_employer = {
				add_opinion = {
					target = root
					modifier = angry_opinion
					opinion = -20
				}
			}
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			avaricious = minor_stress_impact_gain
			honest = minor_stress_impact_gain
			loyal = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = honest
					has_trait = loyal
				}
			}
		}
	}
	#I don't care enough
	option = {
		name = pilgrimage.6780.c
		scope:current_employer = {
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 10
			}
		}
		stress_impact = {
			ambitious = minor_stress_impact_gain
			deceitful = minor_stress_impact_gain
			disloyal = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = ambitious
					has_trait = deceitful
					has_trait = disloyal
				}
			}
		}
	}
}

scripted_trigger pilgrimage_6790_trigger = {
	is_available_ai_adult = yes
	OR = {
		has_trait = lifestyle_mystic
		has_trait = theologian
	}
}

#Meet local guru - trait flipping event
#by Veronica Pazos
pilgrimage.6790 = {
	type = activity_event
	title = pilgrimage.6790.t
	desc = pilgrimage.6790.desc
	theme = pilgrimage_destination
	override_background = { reference = bp1_bonfire }
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:spiritual_mentor
		animation = personality_zealous
	}
	#We don't really need a cooldown since it's once per character
	trigger = {
		has_dlc_feature = tours_and_tournaments
		OR = { #you need to have some spiritual inclination
			AND = {
				has_trait = pilgrim
				has_trait_xp = {
					trait = pilgrim
					value >= 50
				}
			}					
			has_trait = hajjaj
			has_trait = lifestyle_mystic
			has_trait = theologian
		}
		num_sinful_traits > 0 #you have something to change
		NOT = { has_variable = pilgrimage_6790_var } #once per lifetime
	}
	immediate = {
		set_variable = pilgrimage_6790_var
		if = {
			limit = {
				any_pool_character = {
					province = root.location
					pilgrimage_6790_trigger = yes
				}
			}
			random_pool_character = {
				province = root.location
				limit = {
					pilgrimage_6790_trigger = yes
				}
				save_scope_as = spiritual_mentor
			}
		}
		else = {
			create_character = {
				template = local_saint_template
				dynasty = none
				location = root.location
				culture = root.location.culture
				faith = root.location.faith
				save_scope_as = spiritual_mentor
				after_creation = { 
					add_character_flag = mystic_beard_var
				}
			}
		}
	}
	weight_multiplier = {
		base = 1
	}
	#Youäve inspired me
	option = {
		name = pilgrimage.6790.a
		trigger = { is_ai = no }
		involved_activity = {
			add_activity_log_entry = {
				key = pilgrimage_changed_ways_log
				tags = { good }
				score = 50
				character = root
				show_in_conclusion = yes
				#Effects
				root = {
					flip_sinful_trait_effect = yes
				}
			}
		}
		stress_impact = {
			base = massive_stress_impact_gain #you are losing a part of yourself
			fickle = medium_stress_impact_loss
			zealous = minor_stress_impact_loss
		}
	}
	#I will just listen to your teachings instead
	option = {
		name = pilgrimage.6790.b
		pious_type_option_effect = yes
		add_piety = minor_piety_gain
		stress_impact = {
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = cynical
			}
		}
	}
	
	#I am PERFECT
	option = {
		name = pilgrimage.6790.c
		worldly_type_option_effect = yes
		add_prestige = minor_prestige_gain
		stress_impact = {
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = humble
			}
			modifier = {
				factor = 2
				has_trait = arrogant
			}
		}
	}
}

scripted_trigger pilgrimage_6800_valid_member = {
	is_landed = no
	is_ruler = no
	is_physically_able_ai_adult = yes
	faith = root.faith
	NOR = {
		this = root
		is_heir_of = root
		is_spouse_of = root
		has_trait = cynical
		has_trait = celibate
		has_trait = devoted
		is_courtier_of = $NEW_COURT_OWNER$
	}
}

scripted_effect pilgrimage_6800_friend_effect = {
	if = {
		limit = { 
			can_set_relation_friend_trigger = { CHARACTER = scope:called_member } 
		}
		set_relation_friend = {
			reason = friend_holy_site_monk
			target = scope:called_member
		}
	}
	else = {
		scope:called_member = {
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 50
			}
		}
	}
}

scripted_effect pilgrimage_6800_rival_effect = {
	scope:called_member = {
		if = {
			limit = { 
				can_set_relation_rival_trigger = { CHARACTER = root } 
			}
			progress_towards_rival_effect = {
				REASON = rival_no_holy_site_monk
				CHARACTER = root
				OPINION = -50
			}
		}
		else = {
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -50
			}
		}
	}
}

scripted_effect pilgrimage_6800_monk_effect = {
	add_trait = devoted
	add_piety = medium_piety_gain
	add_character_flag = need_priest_outfit
	every_spouse = { divorce = prev }
	every_consort = { remove_concubine = prev }
	current_travel_plan = { remove_character = scope:called_member }
	if = {
		limit = {
			scope:called_member = {
				is_ruler = no
				NOT = { is_courtier_of = scope:holy_site_owner }
			}
		}
		scope:holy_site_owner = { add_courtier = scope:called_member }
	}
}

#Entourage member feels The Calling
#by Veronica Pazos
pilgrimage.6800 = {
	type = activity_event
	title = pilgrimage.6800.t
	desc = pilgrimage.6800.desc
	theme = pilgrimage_destination
	override_background = {
		trigger = {
			NOR = {
				religion = religion:hinduism_religion
				religion = religion:jainism_religion
				religion = religion:buddhism_religion
				religion = religion:tengrism_religion
			}
		}
		reference = temple
	}
	center_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:called_member
		animation = beg
	}
	lower_center_portrait = scope:bishop_pilgrim
	cooldown = { years = 1 }
	trigger = {
		location.county.holder ?= {
			this != root
			save_temporary_scope_as = court_owner_check
		}
		exists = scope:court_owner_check.cp:councillor_court_chaplain
		current_travel_plan ?= {
			any_entourage_character = { 
				pilgrimage_6800_valid_member = { NEW_COURT_OWNER = scope:court_owner_check }
			}
		}				
	}
	immediate = {
		location.county.holder = { save_scope_as = holy_site_owner }
		if = {
			limit = { exists = scope:holy_site_owner.cp:councillor_court_chaplain }
			scope:holy_site_owner.cp:councillor_court_chaplain = { save_scope_as = bishop_pilgrim }
		}
		current_travel_plan = {
			random_entourage_character = {
				limit = { 
					pilgrimage_6800_valid_member = { NEW_COURT_OWNER = scope:holy_site_owner }
				}
				weight = {
					base = 1
					modifier = {
						is_close_or_extended_family_of = root
						add = 5
					}
					modifier = {
						has_trait = zealous
						add = 5
					}
					modifier = {
						has_lifestyle = learning_lifestyle
						add = 2
					}
					modifier = {
						has_trait = fickle
						add = 1
					}
					modifier = {
						is_married = yes
						add = -5
					}
				}
				save_scope_as = called_member
			}
		}
	}
	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			OR = { #you're in a religious journey
				has_activity_intent = zealot_intent
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = pilgrimage_type_pious
					}
				}
			}
		}
	}
	#Sure, go
	option = {
		name = pilgrimage.6800.a
		pious_type_option_effect = yes
		scope:called_member = { pilgrimage_6800_monk_effect = yes }
		involved_activity = {
			add_activity_log_entry = {
				key = pilgrimage_the_calling_log
				tags = { good }
				score = 50
				character = root
				target = scope:called_member
				location = root.location
				
				#Effects
				root = {
					add_piety = medium_piety_gain
				}
			}
		}
		stress_impact = {
			callous = minor_stress_impact_gain
			vengeful = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
			compassionate = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				has_trait = zealous
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = callous
					has_trait = vengeful
					has_trait = cynical
				}
			}
		}
	}
	#We have religious stuff at home too
	option = {
		name = pilgrimage.6800.b
		add_piety = minor_piety_gain
		scope:called_member = {
			add_trait = celibate
			add_piety = medium_piety_gain
			add_character_flag = need_priest_outfit
			every_spouse = { divorce = prev } #scope:called_member
		}
		stress_impact = {
			cynical = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = cynical
				}
			}
		}
	}
	#Don't be silly
	option = {
		name = pilgrimage.6800.c
		worldly_type_option_effect = yes
		pilgrimage_6800_rival_effect = yes
		stress_impact = {
			compassionate = minor_stress_impact_gain
			zealous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				has_trait = cynical
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = zealous
				}
			}
		}
	}
	#Oh, so you wanna stay to PLOT against me
	option = {
		name = pilgrimage.6800.d
		trigger = { has_trait = paranoid }
		pilgrimage_6800_rival_effect = yes
		stress_impact = {
			base = medium_stress_impact_loss #you caught them
			zealous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				has_trait = paranoid
			}
			modifier = {
				factor = 0
				has_trait = compassionate
			}
		}
	}
	#You can stay and ALSO I'll make a donation
	option = {
		name = pilgrimage.6800.e
		flavor = pilgrimage.6800.e.tt
		trigger = { has_trait = zealous }
		pious_type_option_effect = yes
		if = {
			limit = {
				has_trait = pilgrim
				has_trait_xp = {
					trait = pilgrim
					value < 100
				}
			}
			add_trait_xp = {
				trait = pilgrim
				value = 20
			}
			add_piety = medium_piety_gain
		}
		else = { add_piety = major_piety_gain }
		scope:called_member = { pilgrimage_6800_monk_effect = yes }
		pilgrimage_6800_friend_effect = yes
		if = {
			limit = {
				exists = scope:bishop_pilgrim
				can_set_relation_friend_trigger = { CHARACTER = scope:bishop_pilgrim }
			}
			set_relation_friend = {
				reason = friend_holy_site_monk_monk
				target = scope:bishop_pilgrim
			}
		}
		else_if = {
			limit = { can_set_relation_friend_trigger = { CHARACTER = scope:holy_site_owner } }
			scope:holy_site_owner = {
				set_relation_friend = {
					reason = friend_holy_site_monk_monk
					target = scope:bishop_pilgrim
				}
			}
		}
		else = {
			scope:holy_site_owner = {
				add_opinion = {
					target = root
					modifier = pleased_opinion
					opinion = 20
				}
			}
		}
		stress_impact = {
			avaricious = major_stress_impact_gain
			greedy = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				has_trait = zealous
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = avaricious
					has_trait = greedy
				}
			}
		}
	}
}

scripted_effect pilgrimage_6810_friend_effect = {
	if = {
		limit = {
			exists = scope:my_bishop
			can_set_relation_friend_trigger = { CHARACTER = scope:my_bishop }
		}
		set_relation_friend = {
			reason = friend_bought_indulgences
			target = scope:my_bishop
		}
	}
	else_if = { #if you can't be friends we make them endorse you
		limit = { exists = scope:my_bishop }
		scope:my_bishop = {
			add_opinion = {
				target = prev #we use prev so we can use the effect with your heir too
				modifier = pious_opinion
				opinion = 30
			}
		}
	}
	else = {
		scope:religious_head_scope = {
			add_opinion = {
				target = prev
				modifier = pious_opinion
				opinion = 30
			}
		}
	}
}

#Do you wanna buy an indulgence?
#by Veronica Pazos
pilgrimage.6810 = {
	type = activity_event
	title = pilgrimage.6810.t
	desc = pilgrimage.6810.desc
	theme = pilgrimage_destination
	override_background = {
		trigger = {
			NOR = {
				religion = religion:hinduism_religion
				religion = religion:jainism_religion
				religion = religion:buddhism_religion
				religion = religion:tengrism_religion
			}
		}
		reference = temple
	}
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:bishop_pilgrim
		animation = steward
	}
	lower_left_portrait = {
		trigger = { exists = scope:my_heir }
		character = scope:my_heir
	}
	lower_right_portrait = scope:religious_head_scope
	lower_center_portrait = {
		trigger = { exists = scope:my_bishop }
		character = scope:my_bishop
	}
	cooldown = { years = 1 }
	trigger = {
		faith = { religion_tag = christianity_religion } #this is basically a Christian thing
		exists = faith.religious_head #you have a religious head
		faith.religious_head = {
			this != root #and it's not you
			is_available_ai_adult = yes
		}
		exists = location.county.holder.cp:councillor_court_chaplain #there's also someone around to be handing out these
		location.county.holder.cp:councillor_court_chaplain.faith = faith.religious_head.faith #and they're the same faith (and, by extension, yours)
	}
	immediate = {
		faith.religious_head = { save_scope_as = religious_head_scope }
		location.county.holder.cp:councillor_court_chaplain = { save_scope_as = bishop_pilgrim }
		if = {
			limit = { exists = root.player_heir }
			player_heir = { save_scope_as = my_heir }
		}
		if = {
			limit = {
				exists = cp:councillor_court_chaplain
				current_travel_plan ?= {
					any_entourage_character = {
						this = root.cp:councillor_court_chaplain
					}
				}
			}
			cp:councillor_court_chaplain = { save_scope_as = my_bishop }
		}
	}
	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			OR = { #you're in a religious journey
				has_activity_intent = zealot_intent
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = pilgrimage_type_pious
					}
				}
			}
		}
	}
	#Buy one
	option = {
		name = pilgrimage.6810.a
		pious_type_option_effect = yes
		pay_short_term_gold = {
			target = scope:bishop_pilgrim
			gold = {
				value = medium_gold_value
				max = 25
			}
		}
		add_piety = minor_piety_gain
		pilgrimage_6810_friend_effect = yes
		if = {
			limit = {
				faith = { trait_is_virtue = greedy }
			}
			stress_impact = {
				greedy = medium_stress_impact_loss
			}
		}
		else = {
			stress_impact = {
				honest = minor_stress_impact_gain
				just = medium_stress_impact_gain
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0.5
				has_trait = greedy
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = honest
					has_trait = just
				}
			}
			modifier = {
				factor = 0
				short_term_gold <= medium_gold_value
			}
		}
	}
	#Buy one for your heir
	option = {
		name = pilgrimage.6810.b
		trigger = { exists = scope:my_heir }
		pious_type_option_effect = yes
		pay_short_term_gold = {
			target = scope:bishop_pilgrim
			gold = {
				value = medium_gold_value
				max = 25
			}
		}
		add_piety = minor_piety_gain
		scope:my_heir = { pilgrimage_6810_friend_effect = yes }
		if = {
			limit = {
				faith = { trait_is_virtue = greedy }
			}
			stress_impact = {
				greedy = medium_stress_impact_loss
				generous = medium_stress_impact_loss
			}
		}
		else = {
			stress_impact = {
				honest = minor_stress_impact_gain
				just = medium_stress_impact_gain
				generous = medium_stress_impact_loss
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 1.5
				has_trait = generous
			}
			modifier = {
				factor = 0.5
				OR = {
					has_trait = greedy
					has_trait = callous
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = honest
					has_trait = just
				}
			}
			modifier = {
				factor = 0
				short_term_gold <= medium_gold_value
			}
		}
	}
	#This is immoral
	option = {
		name = pilgrimage.6810.c
		worldly_type_option_effect = yes
		if = {
			limit = { has_lifestyle = learning_lifestyle }
			add_learning_lifestyle_xp = minor_lifestyle_experience
		}
		else_if = {
			limit = { has_lifestyle = diplomacy_lifestyle }
			add_diplomacy_lifestyle_xp = minor_lifestyle_experience
		}
		stress_impact = {
			cynical = medium_stress_impact_loss
			deceitful = minor_stress_impact_gain
			callous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = deceitful
					has_trait = arbitrary
					has_trait = callous
				}
			}
		}
	}
}

scripted_trigger pilgrimage_6820_trigger = {
	age = { 20 60 }
	is_lowborn = yes
	stewardship = {
		min_template_decent_skill
		max_template_decent_skill
	}
}

#Do you wanna buy a pilgrim's guide? - based in the Codex Calixtinus
#by Veronica Pazos
pilgrimage.6820 = {
	type = activity_event
	title = pilgrimage.6820.t
	desc = pilgrimage.6820.desc
	theme = pilgrimage_destination
	override_background = { reference = market }
	left_portrait = {
		character = root
		animation = personality_greedy
	}
	right_portrait = {
		character = scope:guide_merchant
		animation = beg
	}
	artifact = {
		target = scope:guide_scope
		position = lower_center_portrait
	}
	cooldown = { years = 1 }
	trigger = {
		#triggered by the on_action
	}
	immediate = {
		if = {
			limit = {
				any_pool_character = {
					province = root.location
					pilgrimage_6820_trigger = yes
				}
			}
			random_pool_character = {
				province = root.location
				limit = { pilgrimage_6820_trigger = yes }
				save_scope_as = guide_merchant
			}
		}
		else = {
			create_character = {
				template = merchant_template
				dynasty = none
				location = root.location
				culture = root.location.culture
				faith = root.location.faith
				save_scope_as = guide_merchant
			}
			set_variable = guide_merchant_var
		}
		hidden_effect_new_object = {
			scope:guide_merchant = {
				if = {
					limit = { artifacts_use_indian_books_trigger = yes }
					create_artifact = {
						name = pilgrim_guide_artifact
						description = pilgrim_guide_artifact_desc
						type = journal
						visuals = indian_book
						modifier = artifact_monthly_piety_2_modifier
						modifier = artifact_diplomacy_1_modifier
						save_scope_as = guide_scope
					}
				}
				else = {
					create_artifact = {
						name = pilgrim_guide_artifact
						description = pilgrim_guide_artifact_desc
						type = journal
						visuals = book
						modifier = artifact_monthly_piety_2_modifier
						modifier = artifact_diplomacy_1_modifier
						save_scope_as = guide_scope
					}
				}
			}
		}
	}
	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			has_lifestyle = diplomacy_lifestyle
		}
		modifier = {
			factor = 2
			scope:activity = {
				has_activity_option = {
					category = special_type
					option = pilgrimage_type_worldly
				}
			}
		}
	}
	#I wanna buy
	option = {
		name = pilgrimage.6820.a
		worldly_type_option_effect = yes
		pay_short_term_gold = {
			target = scope:guide_merchant
			gold = {
				value = minor_gold_value
				max = 5
			}
		}
		scope:guide_scope = {
			set_owner = {
				target = root
				history = {
					type = purchased
					actor = root
					recipient = scope:guide_merchant #giver
					location = root.location
				}
			}
		}
		current_travel_plan ?= {
			add_travel_plan_modifier = { modifier = pilgrim_guide_modifier }
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			avaricious = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = arrogant
				}
			}
			modifier = {
				factor = 0
				gold <= medium_gold_value
			}
		}
	}	
	#You explain the place to them
	option = {
		name = pilgrimage.6820.b
		flavor = pilgrim.6820.b.flavor
		trigger = {
			learning >= decent_skill_rating
			diplomacy >= decent_skill_rating
		}
		show_as_unavailable = {
			learning < decent_skill_rating
			diplomacy < decent_skill_rating
		}
		bonus_to_all_types_effect = yes
		add_character_modifier = {
			modifier = local_expert_modifier
			years = 10
		}
		random_list = {
			80 = { }
			20 = { add_diplomacy_skill = 1 }
		}
		current_travel_plan = {
			add_travel_plan_modifier = {
				modifier = pilgrim_guide_modifier
			}
		}
		stress_impact = {
			humble = medium_stress_impact_gain
		}
		hidden_effect = { destroy_artifact = scope:guide_scope } # Destroy the trinket if its not bought
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = humble
			}
		}
	}
	#I don't need no guide
	option = {
		name = pilgrimage.6820.c
		pious_type_option_effect = yes
		add_piety = miniscule_piety_gain
		hidden_effect = { destroy_artifact = scope:guide_scope } # Destroy the trinket if its not bought
	}
	after = {
		if = {
			limit = {
				is_ai = yes
				has_variable = guide_merchant_var
			}
			scope:guide_merchant = {
				if = {
					limit = {
						root = { is_ai = yes }
					}
					silent_disappearance_effect = yes
				}
			}
			remove_variable = guide_merchant_var
		}
	}
}

#Admire the holy site in a religious way
#by Veronica Pazos
pilgrimage.6830 = {
	type = activity_event
	title = pilgrimage.6830.t
	desc = pilgrimage.6830.desc
	theme = pilgrimage_destination
	override_background = { reference = temple }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = cynical
					has_trait = lifestyle_reveler
				}
			}
			animation = boredom
		}
		animation = personality_zealous
	}
	artifact = {
		trigger = { exists = scope:votive_artifact }
		target = scope:votive_artifact
		position = lower_center_portrait
	}
	cooldown = { years = 1 }
	trigger = {
		has_activity_intent = reflection_intent
		NOT = { religion = religion:tengrism_religion }
	}
	immediate = {
		if = {
			limit = {
				any_character_artifact = {
					is_equipped = no
					artifact_durability < 50
					NOR = { 
						rarity = illustrious
						rarity = famed 
					}
				}
			}
			random_character_artifact = {
				limit = {
					is_equipped = no
					artifact_durability < 50
					NOR = { 
						rarity = illustrious
						rarity = famed 
					}
				}
				save_scope_as = votive_artifact
			}
		}
		else_if = {
			limit = {
				any_character_artifact = {
					is_equipped = no
					NOR = { 
						rarity = illustrious
						rarity = famed 
					}
				}
			}
			random_character_artifact = {
				limit = {
					is_equipped = no
					NOR = { 
						rarity = illustrious
						rarity = famed 
					}
				}
				save_scope_as = votive_artifact
			}
		}
		else_if = {
			limit = {
				any_character_artifact = { is_equipped = no }
			}
			random_character_artifact = {
				limit = { is_equipped = no }
				save_scope_as = votive_artifact
			}
		}
		else = {
			random_character_artifact = { save_scope_as = votive_artifact }
		}
	}
	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			OR = { #you're in a reflection journey
				has_activity_intent = reflection_intent
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = pilgrimage_type_pious
					}
				}
			}
		}
	}
	#Pray
	option = {
		name = pilgrimage.6830.a
		pious_type_option_effect = yes
		add_piety = miniscule_piety_gain
		stress_impact = {
			base = medium_stress_impact_loss
			arrogant = minor_stress_impact_gain
			cynical = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = arrogant
				has_trait = cynical
			}
		}
	}
	#Admire the architecture
	option = {
		name = pilgrimage.6830.b
		worldly_type_option_effect = yes
		if = {
			limit = { has_lifestyle = learning_lifestyle }
			add_learning_lifestyle_xp = minor_lifestyle_experience
		}
		random_list = {
			80 = {
				add_character_modifier = {
					modifier = architectural_interest_modifier
					years = 10
				}
			}
			20 = {
				add_learning_skill = 1
			}
		}
		stress_impact = {
			base = medium_stress_impact_loss
			zealous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = zealous
			}
		}
	}
	#Make a donation
	option = {
		name = pilgrimage.6830.c
		trigger = {
			exists = scope:votive_artifact
			has_trait = pilgrim #Only pilgrim since you can't level up the hajj trait
			has_trait_xp = {
				trait = pilgrim
				value < 100
			}
		}
		custom_tooltip = pilgrimage.6830.c.tt
		pious_type_option_effect = yes
		add_piety = miniscule_piety_gain
		add_trait_xp = {
			trait = pilgrim
			value = 20
		}
		hidden_effect = { destroy_artifact = scope:votive_artifact }
		stress_impact = {
			base = medium_stress_impact_loss
			greedy = minor_stress_impact_gain
			avaricious = minor_stress_impact_gain
			cynical = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = cynical
				}
			}
			modifier = {
				factor = 0
				OR = {
					scope:votive_artifact = {
						rarity = illustrious
					}
					scope:votive_artifact = {
						rarity = famed
					}
				}
			}
			modifier = {
				factor = 2
				has_trait = zealous
			}
		}
	}
}

#Ask a local priest to bless your artifact
#by Veronica Pazos
pilgrimage.6840 = {
	type = activity_event
	title = pilgrimage.6840.t
	desc = pilgrimage.6840.desc
	theme = pilgrimage_destination
	override_background = {
		trigger = {
			NOR = {
				religion = religion:hinduism_religion
				religion = religion:jainism_religion
				religion = religion:buddhism_religion
				religion = religion:tengrism_religion
			}
		}
		reference = temple
	}
	left_portrait = {
		character = root
		animation = beg
		camera = camera_event_center_pointing_right
	}
	right_portrait = {
		character = scope:blessed_bishop
		animation = wedding_priest
	}
	artifact = {
		target = scope:blessed_artifact
		position = lower_center_portrait
	}
	cooldown = { years = 1 }
	trigger = {
		any_character_artifact = {
			category = inventory
		}
	}
	immediate = {
		location = { save_scope_as = holy_site_scope }
		if = {
			limit = {
				exists = location.county.holder.cp:councillor_court_chaplain
				location.county.holder.cp:councillor_court_chaplain.faith = root.faith
			}
			location.county.holder.cp:councillor_court_chaplain = { save_scope_as = blessed_bishop }
		}
		else = {
			create_character = {
				template = priest_character_template
				dynasty = none
				location = root.location
				culture = root.location.culture
				faith = root.faith
				save_scope_as = blessed_bishop
			}
			set_variable = created_blessed_bishop_var
		}
		if = {
			limit = {
				any_character_artifact = {
					is_equipped = yes
					rarity = illustrious
				}
			}
			random_character_artifact = {
				limit = {
					is_equipped = yes
					rarity = illustrious
				}
				save_scope_as = blessed_artifact
			}
		}
		else_if = {
			limit = {
				any_character_artifact = { is_equipped = yes }
			}
			random_character_artifact = {
				limit = { is_equipped = yes }
				save_scope_as = blessed_artifact
			}
		}
		else = { #inventory artifacts
			random_character_artifact = {
				save_scope_as = blessed_artifact
			}
		}
	}
	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			OR = { #you're in a religious journey
				has_activity_intent = zealot_intent
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = pilgrimage_type_pious
					}
				}
			}
		}
	}
	#Make my artifact more pious
	option = {
		name = pilgrimage.6840.a
		pious_type_option_effect = yes
		pay_short_term_gold = {
			target = scope:blessed_bishop
			gold = {
				value = medium_gold_value
				max = 15
			}
		}
		add_piety = miniscule_piety_gain
		scope:blessed_artifact = {
			add_durability = 10
			custom_tooltip = {
				text = pilgrimage.6840.a.tt
				add_artifact_modifier = artifact_monthly_piety_gain_mult_1_modifier
			}
			set_artifact_description = blessed_artifact_desc
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			avaricious = minor_stress_impact_gain
			humble = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
			zealous = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = humble
					has_trait = cynical
				}
			}
			modifier = {
				factor = 0
				gold < major_gold_value
			}
		}
	}
	#Make my artifact stronger
	option = {
		name = pilgrimage.6840.b
		worldly_type_option_effect = yes
		pay_short_term_gold = {
			target = scope:blessed_bishop
			gold = {
				value = medium_gold_value
				max = 15
			}
		}
		add_piety = miniscule_piety_gain
		scope:blessed_artifact = {
			add_durability = 10
			custom_tooltip = {
				text = pilgrimage.6840.b.tt
				add_artifact_modifier = artifact_monthly_prestige_5_modifier
			}
			set_artifact_description = blessed_artifact_desc
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			avaricious = minor_stress_impact_gain
			humble = minor_stress_impact_gain
			zealous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = humble
					has_trait = zealous
				}
			}
			modifier = {
				factor = 0
				gold < major_gold_value
			}
		}
	}
	#I don't need no blessing
	option = {
		name = pilgrimage.6840.c
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 1
				ai_zeal = -1
			}
		}
	}
	after = {
		if = {
			limit = {
				is_ai = yes
				has_variable = created_blessed_bishop_var
			}
			scope:blessed_bishop = {
				if = {
					limit = {
						root = { is_ai = yes }
					}
					silent_disappearance_effect = yes
				}
			}
			remove_variable = created_blessed_bishop_var
		}
	}
}
# A Master Thief
# by Laurence Kennedy
pilgrimage.6850 = {
	type = activity_event
	title = pilgrimage.6850.t
	desc = pilgrimage.6850.desc
	theme = pilgrimage_destination
	override_background = { reference = bedchamber } 

	left_portrait = {
		character = root
		animation = fear
	}
	right_portrait = {
		character = scope:fake_thief
		animation = assassin
	}
	center_portrait = {
		character = scope:wise_priest
		animation = throne_room_writer
	}
	cooldown = { years = 15 }

	trigger = {
		religion = religion:buddhism_religion
	}
	immediate = {
		if = {
		#Find yourself a local priest
			limit = {
				location.county.holder.cp:councillor_court_chaplain ?= {
					faith = root.faith
					is_available_ai_adult = yes
					this != root 
				}
			}
			location.county.holder.cp:councillor_court_chaplain = { save_scope_as = wise_priest }
		}
		else = {
		#make a priest
			create_character = {
				template = priest_character_template
				dynasty = none
				location = root.location
				culture = root.location.culture
				faith = root.faith
				save_scope_as = wise_priest
			}
		}
		#make a fake thief
		create_character = {
			template = generic_peasant_character
			dynasty = none
			location = root.location
			culture = root.location.culture
			faith = root.faith
			save_scope_as = fake_thief
		}	
	}
	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			OR = { #you're in a reflection journey
				has_activity_intent = reflection_intent
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = pilgrimage_type_pious
					}
				}
			}
		}
	}
	#Decrease enemy hostile scheme success chance
	option = {
		name = pilgrimage.6850.a
		add_piety = medium_piety_gain
		add_character_modifier = {
			modifier = light_in_shadow_modifier 
			years = 5
		}
		stress_impact = {
			cynical = minor_stress_impact_gain
			trusting = medium_stress_impact_gain
			paranoid = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = cynical
				has_trait = trusting
			}
		}
	}
	#Improve your spymaster's secret discovery chance
	option = {
		name = pilgrimage.6850.b
		add_learning_lifestyle_xp = medium_lifestyle_xp
		add_character_modifier = {
			modifier = spymaster_eyes_modifier
			years = 5
		}
		stress_impact = {
			diligent = minor_stress_impact_gain
			paranoid = medium_stress_impact_gain
			lazy = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = diligent
				has_trait = paranoid
			}
		}
	}
	#Imprison you court chaplain
	option = {
		name = pilgrimage.6850.c
		trigger = {
			cp:councillor_court_chaplain ?= {
				is_ai = yes
			}
		}
		rightfully_imprison_character_effect = {
			TARGET = cp:councillor_court_chaplain
			IMPRISONER = root 
		}
		add_intrigue_lifestyle_xp = medium_lifestyle_xp	
					
		stress_impact = {
			trusting = minor_stress_impact_gain
			just = medium_stress_impact_gain
			paranoid = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = trusting
				has_trait = just
			}
		}
	}
	after = {
		scope:wise_priest = {
			if = {
				limit = {
					is_ai = yes
					NOT = {
						has_council_position = councillor_court_chaplain 
					}
				}
				silent_disappearance_effect = yes
			}
		}
		scope:fake_thief = {
			silent_disappearance_effect = yes
		}
	}	
}

################################
# Conclusion events
# 7000-7499
# by Filippa Gannholm Kirsten
################################
# pilgrimage.7000 - Summarizing our activity
#
#

#Summarizing our activity
pilgrimage.7000 = {
	type = activity_event
	title = {
		first_valid = {
			#Obligatory Pilgrimage
			triggered_desc = {
				trigger = {
					scope:activity = {
						has_activity_option = {
							category = pilgrimage_option_fidelity
							option = pilgrimage_fidelity_obligatory
						}
					}
					NOT = { has_character_flag = pilgrimage_counter_obligatory }
				}
				desc = pilgrimage.7000.t_obligatory
			}
			#Hajj conclusion
			triggered_desc = {
				trigger = { 
					scope:activity = { activity_has_hajj_pilgrimage_type_trigger = yes }
				}
				desc = pilgrimage.7000.t_hajj
			}
			#Pilgrimage conclusion
			desc = pilgrimage.7000.t
		}
	}
	desc = {
		first_valid = {
			#Obligatory pilgrimage, rush rush go go
			triggered_desc = {
				trigger = {
					scope:activity = {
						has_activity_option = {
							category = pilgrimage_option_fidelity
							option = pilgrimage_fidelity_obligatory
						}
					}
					NOT = { has_character_flag = pilgrimage_counter_obligatory }
				}
				desc = pilgrimage.7000.desc_obligatory
			}
			#Standard pilgrimage
			triggered_desc = {
				desc = {
					#Hajj or Pilgrimage?
					first_valid = {
						#Hajj conclusion
						triggered_desc = {
							trigger = {
								scope:activity = { activity_has_hajj_pilgrimage_type_trigger = yes }
							}
							desc = pilgrimage.7000.intro_hajj
						}
						#Pilgrimage conclusion
						desc = pilgrimage.7000.intro
					}
					#Handle the type
					first_valid = {
						#Perfect pious
						triggered_desc = {
							trigger = {
								scope:activity = {
									OR = {
										activity_has_pious_pilgrimage_type_trigger = yes
										activity_has_hajj_pilgrimage_type_trigger = yes
									}
								}
								has_character_flag = perfect_pious_reward
							}
							desc = pilgrimage.7000.desc_perfect_pious
						}
						#High end pious
						triggered_desc = {
							trigger = {
								scope:activity = {
									OR = {
										activity_has_pious_pilgrimage_type_trigger = yes
										activity_has_hajj_pilgrimage_type_trigger = yes
									}
								}
								has_character_flag = high_pious_reward
							}
							desc = pilgrimage.7000.desc_high_pious
						}
						#OK pious
						triggered_desc = {
							trigger = {
								scope:activity = {
									OR = {
										activity_has_pious_pilgrimage_type_trigger = yes
										activity_has_hajj_pilgrimage_type_trigger = yes
									}
								}
								has_character_flag = mid_pious_reward
							}
							desc = pilgrimage.7000.desc_mid_pious
						}
						#Lousy pious
						triggered_desc = {
							trigger = {
								scope:activity = {
									OR = {
										activity_has_pious_pilgrimage_type_trigger = yes
										activity_has_hajj_pilgrimage_type_trigger = yes
									}
								}
								has_character_flag = low_pious_reward
							}
							desc = pilgrimage.7000.desc_low_pious
						}
						#High end worldly
						triggered_desc = {
							trigger = {
								scope:activity = { activity_has_worldly_pilgrimage_type_trigger = yes }
								has_character_flag = perfect_worldly_reward
							}
							desc = pilgrimage.7000.desc_perfect_worldly
						}
						#High end worldly
						triggered_desc = {
							trigger = {
								scope:activity = { activity_has_worldly_pilgrimage_type_trigger = yes }
								has_character_flag = high_worldly_reward
							}
							desc = pilgrimage.7000.desc_high_worldly
						}
						#OK worldly
						triggered_desc = {
							trigger = {
								scope:activity = { activity_has_worldly_pilgrimage_type_trigger = yes }
								has_character_flag = mid_worldly_reward
							}
							desc = pilgrimage.7000.desc_mid_worldly
						}
						#Lousy worldly
						triggered_desc = {
							trigger = {
								scope:activity = { activity_has_worldly_pilgrimage_type_trigger = yes }
								has_character_flag = low_worldly_reward
							}
							desc = pilgrimage.7000.desc_low_worldly
						}
					}
					#Outro - Did previous host die? Otherwise trivia about your pilgrimage/Hajj history
					first_valid = {
						#Buried predecessor here
						triggered_desc = {
							trigger = { has_variable = pilgrimage_death_bury_there }
							desc = pilgrimage.7000.outro_buried_predecessor_here
						}
						#Will bury them at home
						triggered_desc = {
							trigger = { has_variable = pilgrimage_death_bury_home }
							desc = pilgrimage.7000.outro_bury_predecessor_home
						}
						#First Hajj
						triggered_desc = {
							trigger = {
								scope:activity = { activity_has_hajj_pilgrimage_type_trigger = yes }
								any_memory = {
									memory_type = completed_hajj_memory
									count = 1
								}
							}
							desc = pilgrimage.7000.outro_first_hajj
						}
						#Second Hajj
						triggered_desc = {
							trigger = {
								scope:activity = { activity_has_hajj_pilgrimage_type_trigger = yes }
								any_memory = {
									memory_type = completed_hajj_memory
									count = 2
								}
							}
							desc = pilgrimage.7000.outro_second_hajj
						}
						#... the rest
						triggered_desc = {
							trigger = {
								scope:activity = { activity_has_hajj_pilgrimage_type_trigger = yes }
								any_memory = {
									memory_type = completed_hajj_memory
									count > 2
								}
							}
							desc = pilgrimage.7000.outro_multi_hajj
						}
						#First pilgrimage
						triggered_desc = {
							trigger = { var:num_pilgrimages_undertaken ?= 1 }
							desc = pilgrimage.7000.outro_first
						}
						#Second pilgrimage
						triggered_desc = {
							trigger = {
								var:num_pilgrimages_undertaken ?= 2
								NOT = { exists = scope:revisited_first_pilgrimage_memory }
							}
							desc = pilgrimage.7000.outro_second
						}
						#Second pilgrimage -- which revisited the first pilgrimage site
						triggered_desc = {
							trigger = {
								var:num_pilgrimages_undertaken ?= 2
								exists = scope:revisited_first_pilgrimage_memory
							}
							desc = pilgrimage.7000.outro_second_revisit
						}
						#... the rest
						triggered_desc = {
							trigger = {
								exists = var:num_pilgrimages_undertaken
								var:num_pilgrimages_undertaken >= 3
							}
							desc = pilgrimage.7000.outro_multi
						}
					}
					#Is this a new holy site? (And also not our first pilgrimage)
					first_valid = {
						triggered_desc = {
							trigger = {
								any_in_list = {
									variable = visited_unique_holy_sites_list
									count > 1
								}
								has_character_flag = added_new_holy_site 
							}
							desc = pilgrimage.7000.outro_new_holy_site
						}
					}
				}
			}
		}
	}
	theme = pilgrimage_destination
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				scope:activity = {
					has_activity_option = {
						category = pilgrimage_option_fidelity
						option = pilgrimage_fidelity_obligatory
					}
				}
				NOT = { has_character_flag = pilgrimage_counter_obligatory }
			}
			animation = disapproval
		}
		triggered_animation = {
			trigger = {
				OR = {
					has_character_flag = low_pious_reward
					has_character_flag = low_worldly_reward
				}
			}
			animation = worry
		}
		triggered_animation = {
			trigger = { has_trait = cynical }
			animation = personality_cynical
		}
		animation = personality_forgiving
	}
	artifact = {
		target = scope:christian_saint_bone_scope
		position = lower_center_portrait
	}
	immediate = {
		christian_saint_bone_creation_effect = yes
		#Save memory location for loc if this is our second pilgrimage
		if = {
			limit = {
				var:num_pilgrimages_undertaken ?= 2
				any_memory = {
					memory_type = completed_pilgrimage
					has_variable = first_pilgrimage
					#If it's the same place then we revisited the place
					var:pilgrimage_destination ?= root.location
				}
			}
			save_scope_as = revisited_first_pilgrimage_memory
		}
		else = {
			#For loc
			random_memory = {
				limit = {
					has_variable = first_pilgrimage
					NOT = { var:pilgrimage_destination = root.location }	
				}
				save_scope_as = first_pilgrimage_memory
			}
		}
		#The old host died, saving for loc
		if = {
			limit = { exists = var:old_host_to_be_buried }
			var:old_host_to_be_buried = { save_scope_as = old_pilgrimage_host }
		}

		# ACH Repent oath counter
		if = {
			limit = {
				has_variable = repent_oath_pilgrimage_counter
			}
			change_variable = {
				name = repent_oath_pilgrimage_counter
				add = 1
			}
		}
	}
	#Alright
	option = {
		#Hajj alright
		name = {
			trigger = { 
				scope:activity = { activity_has_hajj_pilgrimage_type_trigger = yes }
				has_trait = cynical 
			}
			text = pilgrimage.7000.a_hajj_cynical
		}
		#Hajj cynical
		name = {
			trigger = { 
				scope:activity = { activity_has_hajj_pilgrimage_type_trigger = yes } 
			}
			text = pilgrimage.7000.a_hajj
		}
		#Cynical
		name = {
			trigger = { 
				OR = {
					AND = {
						scope:activity = {
							has_activity_option = {
								category = pilgrimage_option_fidelity
								option = pilgrimage_fidelity_obligatory
							}
						}
						NOT = { has_character_flag = pilgrimage_counter_obligatory }
					}
					has_trait = cynical 
				}
			}
			text = pilgrimage.7000.a_cynical
		}
	 	#Alright
		name = {
			trigger = {
				NOR = {
					AND = {
						scope:activity = {
							has_activity_option = {
								category = pilgrimage_option_fidelity
								option = pilgrimage_fidelity_obligatory
							}
						}
						NOT = { has_character_flag = pilgrimage_counter_obligatory }
					}
					has_trait = cynical 
				}
			}
			text = pilgrimage.7000.a
		}
		custom_tooltip = pilgrimage.7000.a.tt
		#Rewards and log entries are resolved in on_end in the Pilgrimage activity setup
		show_as_tooltip = { pilgrimage_completed_log_entry_effect = yes }
	}
	
	option = {
		name = pilgrimage.7000.b
		trigger = { # If it's Pious or Hajj we lower your Gallowsbait
			has_ep3_dlc_trigger = yes
			has_trait = gallowsbait
			has_any_gallowsbait_xp_trigger = yes
			OR = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = pilgrimage_type_pious
					}
				}
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = pilgrimage_type_hajj
					}
				}
			}
		}
		if = { # If you are a devoted Pilgrim you lose it entirely
			limit = {
				OR = {
					AND = {
						has_trait = pilgrim
						has_trait_xp = {
							trait = pilgrim
							value >= 50
						}
					}
					has_character_flag = perfect_pious_reward
					has_character_flag = high_pious_reward
				}
			}
			remove_trait = gallowsbait
		}
		else = { # Else we lower it
			lower_gallowsbait_xp_effect = { VALUE = -25 }
		}
		show_as_tooltip = { pilgrimage_completed_log_entry_effect = yes }
	}
	
	after = {
		#Party's over; clean up time
		clean_up_pilgrimage_type_reward_flags_effect = yes
		#If we added a new holy site, remove the flag
		remove_character_flag = added_new_holy_site
		remove_character_flag = should_get_trait_piety
		remove_character_flag = pilgrimage_counter_obligatory
	}
}

################################
# Return Events
# 9001-9999
# by Petter Vilberg & Filippa Gannholm Kirsten
################################
# pilgrimage.9001 - Nice spiritual journey
# pilgrimage.9010 - Bury old host back home
# pilgrimage.9100 - Follow-up to exotic wares event
#

#Nice spiritual journey
pilgrimage.9001 = {
	type = character_event
	title = pilgrimage.9001.t
	desc = {
		desc = pilgrimage.9001.desc_intro
		first_valid = {
			triggered_desc = {
				trigger = { has_variable = pilgrimage_invalidated }
				desc = pilgrimage.9001.desc_invalidated
			}
			triggered_desc = {
				trigger = { has_variable = pilgrimage_death_bury_there }
				desc = pilgrimage.9001.desc_buried_there
			}
			desc = pilgrimage.9001.desc
		}
	}
	theme = pilgrimage_return
	override_background = { reference = relaxing_room }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = pilgrimage_invalidated }
			animation = sadness
		}
		animation = pondering
	}
	trigger = {
		OR = {
			has_variable = has_completed_pilgrimage
			has_variable = pilgrimage_invalidated
		}
		NOR = { 
			has_variable = pilgrimage_death_turn_back
			has_variable = pilgrimage_death_bury_home
			has_character_flag = pilgrimage_burial_interrupted_pilgrimage
		}
	}
	immediate = {
		play_music_cue = mx_cue_travel_arrival
		traveler_lifestyle_rank_up_check_effect = yes
		#For loc
		if = {
			limit = { exists = var:old_host_to_be_buried }
			var:old_host_to_be_buried = { save_scope_as = old_pilgrimage_host }
		}
		if = {
			limit = { exists = var:pilgrimage_burial_location }
			var:pilgrimage_burial_location = { save_scope_as = burial_location }
		}
		if = {
			limit = { exists = var:pilgrimage_invalidated_illness }
			var:pilgrimage_invalidated_illness = { save_scope_as = missed_holy_site }
		}
		# Cultural Ambassador travel option
		if = {
			limit = {
				current_travel_plan = {
					has_travel_option = cultural_ambassador_option
				}
			}
			custom_tooltip = cultural_ambassador_option.tt
		}
		# Allocates a tiny bit of Horse XP if you have the Hastiluder trait
		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = horse
				value = tournament_hastiludes_xp_gain_miniscule_value
			}
		}
	}
	option = {
		name = {
			trigger = { has_variable = pilgrimage_invalidated }
			text = pilgrimage.9001.a_invalidated
		}
		name = pilgrimage.9001.a
		custom_tooltip = pilgrimage.9001.a.tt
	}
	after = {
		if = {
			limit = { has_variable = has_completed_pilgrimage }
			remove_variable = has_completed_pilgrimage
		}
		if = {
			limit = { has_variable = pilgrimage_invalidated_illness }
			remove_variable = pilgrimage_invalidated_illness
		}
		remove_character_flag = pilgrimage_invalidated
		#Follow-up after old host died; burial at home
		if = {
			limit = { has_character_modifier = pilgrimage_burial_at_capital_modifier }
			trigger_event = {
				id = pilgrimage.9010
				days = 10
			}
		}
		#Follow-up to exotic wares event
		if = {
			limit = {
				OR = {
					has_character_modifier = pilgrimage_exotic_wares_modifier
					has_character_modifier = pilgrimage_super_exotic_wares_modifier
				}
			}
			trigger_event = {
				id = pilgrimage.9100
				days = 5
			}
		}
		remove_character_flag = pilgrim_group_joined
		if = {
			limit = { has_variable = pilgrimage_death_bury_there }
			remove_variable = pilgrimage_death_bury_there
		}
	}
}

#Bury old host back home
pilgrimage.9010 = {
	type = character_event
	title = pilgrimage.9010.t
	desc = {
		first_valid = {
			#Departed mother/father
			triggered_desc = {
				trigger = {
					is_close_family_of = scope:old_pilgrimage_host
				}
				desc = pilgrimage.9010.desc.relation_family
			}
			#Dearly departed <name>
			triggered_desc = {
				trigger = { has_character_flag = pilgrimage_liked_my_predecessor }
				desc = pilgrimage.9010.desc.relation_liked
			}
			#... dead liege?
			desc = pilgrimage.9010.desc.relation_neutral
		}
		first_valid = {
			#Turned back, liked host
			triggered_desc = {
				trigger = { 
					has_variable = pilgrimage_death_turn_back
					has_character_flag = pilgrimage_liked_my_predecessor 
				}
				desc = pilgrimage.9010.desc.turned_back_liked
			}
			#Turned back, neutral relation
			triggered_desc = {
				trigger = { has_variable = pilgrimage_death_turn_back }
				desc = pilgrimage.9010.desc.turned_back_neutral
			}
			#Went to holy site and back, liked host
			triggered_desc = {
				trigger = { 
					has_variable = pilgrimage_death_bury_home
					has_character_flag = pilgrimage_liked_my_predecessor
					NOT = { has_character_flag = pilgrimage_burial_interrupted_pilgrimage }
				}
				desc = pilgrimage.9010.desc.there_and_back_liked
			}
			#Went to holy site and back, neutral relation
			triggered_desc = {
				trigger = { 
					has_variable = pilgrimage_death_bury_home
					NOT = { has_character_flag = pilgrimage_burial_interrupted_pilgrimage }
				}
				desc = pilgrimage.9010.desc.there_and_back_neutral
			}
			#Tried to bury them at the holy site but activity invalidated, liked host
			triggered_desc = {
				trigger = { has_character_flag = pilgrimage_burial_interrupted_pilgrimage }
				desc = pilgrimage.9010.desc.invalidated_pilgrimage_liked
			}
			#Tried to bury them at the holy site but activity invalidated, neutral relation
			triggered_desc = {
				trigger = { has_character_flag = pilgrimage_burial_interrupted_pilgrimage }
				desc = pilgrimage.9010.desc.invalidated_pilgrimage_neutral
			}
		}
	}
	theme = pilgrimage_return
	override_background = {
		trigger = {
			NOR = {
				religion = religion:hinduism_religion
				religion = religion:jainism_religion
				religion = religion:buddhism_religion
			}
		}
		reference = temple
	}
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				is_close_family_of = scope:old_pilgrimage_host
				has_character_flag = pilgrimage_liked_my_predecessor
			}
			animation = grief
		}
		triggered_animation = {
			trigger = { has_character_flag = pilgrimage_liked_my_predecessor }
			animation = grief
		}
		animation = sadness
	}
	right_portrait = {
		trigger = { exists = scope:grieving_companion }
		character = scope:grieving_companion
		animation = sadness
	}
	lower_center_portrait = {
		character = scope:old_pilgrimage_host
	}
	trigger = {
		trigger_if = {
			limit = {
				has_variable = pilgrimage_death_bury_home
			}
			always = yes
		}
		trigger_else = {
			always = no
		}
	}
	immediate = {
		play_music_cue = mx_cue_travel_arrival
		remove_character_modifier = pilgrimage_burial_at_capital_modifier
		save_scope_as = root_scope
		#For loc
		if = {
			limit = { exists = var:old_host_to_be_buried }
			var:old_host_to_be_buried = { save_scope_as = old_pilgrimage_host }
		}
		if = {
			limit = { exists = var:previous_holy_site }
			var:previous_holy_site = { save_scope_as = previous_holy_site }
		}
		#For atmosphere
		if = {
			limit = { 
				exists = cp:councillor_court_chaplain
				cp:councillor_court_chaplain = { is_available = yes }
			}
			cp:councillor_court_chaplain = { save_scope_as = grieving_companion }	
		}
		else = {
			random_courtier = {
				limit = { is_available_adult = yes }
				save_scope_as = grieving_companion
			}
		}
	}
	option = {
		name = pilgrimage.9010.a
		name = {
			trigger = {
				has_variable = pilgrimage_death_bury_home
				has_character_flag = pilgrimage_burial_interrupted_pilgrimage
			}
			text = pilgrimage.9010.a_interrupted
		}
		name = {
			trigger = {
				has_government = landless_adventurer_government
			}
			text = pilgrimage.9010.a_adventurer
		}
		flavor = pilgrimage.9010.a.flavor
		if = {
			limit = { 
				OR = {
					has_variable = pilgrimage_death_turn_back
					#If we wanted to bury them at the holy site but our activity was invalidated
					AND = {
						has_variable = pilgrimage_death_bury_home
						has_character_flag = pilgrimage_burial_interrupted_pilgrimage
					}
				}
			}
			pilgrimage_turn_back_and_bury_effect = yes
		}
		if = {
			limit = { has_variable = pilgrimage_death_bury_home }
			pilgrimage_bury_at_home_effect = yes
		}
	}
	after = {
		remove_character_flag = pilgrimage_liked_my_predecessor
		remove_character_flag = pilgrimage_burial_interrupted_pilgrimage
		remove_variable = old_host_to_be_buried
		remove_variable = previous_holy_site
		if = {
			limit = { has_variable = pilgrimage_death_turn_back }
			remove_variable = pilgrimage_death_turn_back
		}
		if = {
			limit = { has_variable = pilgrimage_death_bury_there }
			remove_variable = pilgrimage_death_bury_there
		}
		if = {
			limit = { has_variable = pilgrimage_death_bury_home }
			create_character_memory = {
				type = pilgrimage_handled_predecessor_remains_memory
				participants = { predecessor = scope:old_pilgrimage_host }
			}
			if = {
				limit = { exists = scope:new_memory }
				scope:new_memory = {
					set_variable = {
						name = pilgrimage_destination
						value = scope:previous_holy_site
					}
					set_variable = {
						name = home
						value = root.location #Should be capital_province
					}
					set_variable = {
						name = buried_predecessor_back_home
						value = flag:yes
					}
				}
			}
			remove_variable = pilgrimage_death_bury_home
		}
	}
}

#Follow-up to exotic wares event
pilgrimage.9100 = {
	type = character_event
	title = pilgrimage.9100.t
	desc = {
		desc = pilgrimage.9100.desc_intro
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_variable = 6540_exotic_wares_gift
						has_variable = 6540_exotic_wares_super_gift
					}
				}
				desc = pilgrimage.9100.desc_has_gift
			}
			triggered_desc = {
				desc = pilgrimage.9100.desc
			}
		}
	}
	theme = pilgrimage_return
	override_background = { reference = market }
	left_portrait = {
		character = root
		animation = steward
	}
	#Sell the wares at a profit
	option = {
		name = {
			trigger = {
				OR = {
					has_variable = 6540_exotic_wares_gift
					has_variable = 6540_exotic_wares_super_gift
				}
			}
			text = pilgrimage.9100.a_has_gift
		}
		name =  {
			trigger = {
				NOR = {
					has_variable = 6540_exotic_wares_gift
					has_variable = 6540_exotic_wares_super_gift
				}
			}
			text = pilgrimage.9100.a
		}
		if = {
			limit = { has_character_modifier = pilgrimage_exotic_wares_modifier }
			custom_tooltip = pilgrimage.9100.a_double.tt
			add_gold = {
				value = var:6540_exotic_wares_cost
				multiply = 2
			}
		}
		else_if = {
			limit = { has_character_modifier = pilgrimage_super_exotic_wares_modifier }
			custom_tooltip = pilgrimage.9100.a_triple.tt
			add_gold = {
				value = var:6540_exotic_wares_cost
				multiply = 3
			}
		}
	}
	#Save them as a powerful personal scheme modifier
	option = {
		name = pilgrimage.9100.b
		trigger = {
			NOR = {
				has_variable = 6540_exotic_wares_gift
				has_variable = 6540_exotic_wares_super_gift
			}
		}
		custom_tooltip = pilgrimage.9100.b.tt
		if = {
			limit = { has_character_modifier = pilgrimage_exotic_wares_modifier }
			set_variable = {
				name = 6540_exotic_wares_gift
				value = var:6540_exotic_wares_location
			}
		}
		else_if = {
			limit = { has_character_modifier = pilgrimage_super_exotic_wares_modifier }
			set_variable = {
				name = 6540_exotic_wares_super_gift
				value = var:6540_exotic_wares_location
			}
		}
	}
	after = {
		if = {
			limit = { has_character_modifier = pilgrimage_exotic_wares_modifier }
			remove_character_modifier = pilgrimage_exotic_wares_modifier
		}
		if = {
			limit = { has_character_modifier = pilgrimage_super_exotic_wares_modifier }
			remove_character_modifier = pilgrimage_super_exotic_wares_modifier
		}
		remove_variable = 6540_exotic_wares_location
		remove_variable = 6540_exotic_wares_cost
	}
}
