﻿# Events for Pilgrimages

namespace = pilgrimage


################################
# TARGET SELECTION EVENTS
# 0001-0999
# by Petter Vilberg
################################

# First selection event
pilgrimage.0001 = {
	type = character_event
	title = pilgrimage.0001.t
	desc = pilgrimage.0001.desc
	theme = pilgrimage_activity
	override_background = {
		event_background = temple
	}
	left_portrait = root

	immediate = {
		# Stop characters from planning multiple activities at once.
		add_character_flag = {
			flag = planning_an_activity
			days = 30
		}

		set_up_holy_sites_for_selection_effect = yes
	}
	
	option = {
		name = pilgrimage.0001.a
		holy_site_selection_event_option_effect = {
			HOLY_SITE = scope:holy_site_1
		}
	}

	option = {
		name = pilgrimage.0001.b
		trigger = {
			exists = scope:holy_site_2
		}
		holy_site_selection_event_option_effect = {
			HOLY_SITE = scope:holy_site_2
		}
	}

	option = {
		name = pilgrimage.0001.c
		trigger = {
			exists = scope:holy_site_3
		}
		holy_site_selection_event_option_effect = {
			HOLY_SITE = scope:holy_site_3
		}
	}
	
	option = { # Switch to the next event
		name = pilgrimage.0001.d
		trigger = {
			exists = scope:holy_site_4
		}
		custom_tooltip = pilgrimage_other_selections_available_tt
		trigger_event = pilgrimage.0002
	}

	option = { # I don't want to go on a pilgrimage after all
		name = pilgrimage.0001.e
		trigger = {
			NOT = { exists = scope:holy_site_4 }
		}
		remove_decision_cooldown = go_on_pilgrimage_decision

		remove_character_flag = planning_an_activity
	}
}

# Second selection event
pilgrimage.0002 = {
	type = character_event
	title = pilgrimage.0001.t
	desc = pilgrimage.0001.desc
	theme = pilgrimage_activity
	override_background = {
		event_background = temple
	}
	left_portrait = root
	
	option = {
		name = pilgrimage.0002.a
		holy_site_selection_event_option_effect = {
			HOLY_SITE = scope:holy_site_4
		}
	}

	option = {
		name = pilgrimage.0002.b
		trigger = {
			exists = scope:holy_site_5
		}
		holy_site_selection_event_option_effect = {
			HOLY_SITE = scope:holy_site_5
		}
	}

	option = {
		name = pilgrimage.0002.c
		trigger = {
			exists = scope:holy_site_6
		}
		holy_site_selection_event_option_effect = {
			HOLY_SITE = scope:holy_site_6
		}
	}
	
	option = { # Switch to the next event
		name = pilgrimage.0001.d
		custom_tooltip = pilgrimage_other_selections_available_tt
		if = {
			limit = {
				exists = scope:holy_site_7
			}
			trigger_event = pilgrimage.0003
		}
		else = {
			trigger_event = pilgrimage.0001
		}
	}

	option = { # I don't want to go on a pilgrimage after all
		name = pilgrimage.0001.e
		trigger = {
			NOT = { exists = scope:holy_site_7 }
		}

		remove_decision_cooldown = go_on_pilgrimage_decision

		remove_character_flag = planning_an_activity
	}
}

# Third selection event
pilgrimage.0003 = {
	type = character_event
	title = pilgrimage.0001.t
	desc = pilgrimage.0001.desc
	theme = pilgrimage_activity
	override_background = {
		event_background = temple
	}
	left_portrait = root
	
	option = {
		name = pilgrimage.0003.a
		holy_site_selection_event_option_effect = {
			HOLY_SITE = scope:holy_site_7
		}
	}

	option = {
		name = pilgrimage.0003.b
		trigger = {
			exists = scope:holy_site_8
		}
		holy_site_selection_event_option_effect = {
			HOLY_SITE = scope:holy_site_8
		}
	}

	option = {
		name = pilgrimage.0003.c
		trigger = {
			exists = scope:holy_site_9
		}
		holy_site_selection_event_option_effect = {
			HOLY_SITE = scope:holy_site_9
		}
	}
	
	option = { # Switch to the next event
		name = pilgrimage.0001.d
		custom_tooltip = pilgrimage_other_selections_available_tt
		trigger_event = pilgrimage.0001
	}

	option = { # I don't want to go on a pilgrimage after all
		name = pilgrimage.0001.e
		remove_character_flag = planning_an_activity
		remove_decision_cooldown = go_on_pilgrimage_decision
	}
}


# AI Desitnation selection event
pilgrimage.0999 = {
	hidden = yes

	immediate = {
		# Stop characters from planning multiple activities at once.
		add_character_flag = {
			flag = planning_an_activity
			days = 30
		}

		if = {
			# Instead of spawning an actual pilgrimage activity for barons, we just give them the pilgrim trait to save on processing power.
			limit = {
				primary_title.tier = tier_barony
			}
			remove_short_term_gold = pilgrimage_medium_extra_cost
			add_trait = pilgrim
		}
		else = {	
			set_up_holy_sites_for_selection_effect = yes
			random_list = {
				100 = {
					holy_site_selection_event_option_effect = {
						HOLY_SITE = scope:holy_site_1
					}
				}
				100 = {
					trigger = { exists = scope:holy_site_2 }
					holy_site_selection_event_option_effect = {
						HOLY_SITE = scope:holy_site_2
					}
				}
				100 = {
					trigger = { exists = scope:holy_site_3 }
					holy_site_selection_event_option_effect = {
						HOLY_SITE = scope:holy_site_3
					}
				}
				100 = {
					trigger = { exists = scope:holy_site_4 }
					holy_site_selection_event_option_effect = {
						HOLY_SITE = scope:holy_site_4
					}
				}
				100 = {
					trigger = { exists = scope:holy_site_5 }
					holy_site_selection_event_option_effect = {
						HOLY_SITE = scope:holy_site_5
					}
				}
				100 = {
					trigger = { exists = scope:holy_site_6 }
					holy_site_selection_event_option_effect = {
						HOLY_SITE = scope:holy_site_6
					}
				}
				100 = {
					trigger = { exists = scope:holy_site_7 }
					holy_site_selection_event_option_effect = {
						HOLY_SITE = scope:holy_site_7
					}
				}
				100 = {
					trigger = { exists = scope:holy_site_8 }
					holy_site_selection_event_option_effect = {
						HOLY_SITE = scope:holy_site_8
					}
				}
				100 = {
					trigger = { exists = scope:holy_site_9 }
					holy_site_selection_event_option_effect = {
						HOLY_SITE = scope:holy_site_9
					}
				}
			}
		}
	}

	after = {
		remove_character_flag = planning_an_activity
	}
}


################################
# Start Events
# 1001-1999
# by Petter Vilberg
################################
pilgrimage.1001 = {
	type = character_event
	title = pilgrimage.1001.t
	desc = {
		desc = pilgrimage.1001.desc.opening
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:activity.var:pilgrimage_distance >= very_long_pilgrimage_var
				}
				desc = pilgrimage.1001.desc.very_long
			}
			triggered_desc = {
				trigger = {
					scope:activity.var:pilgrimage_distance >= long_pilgrimage_var
				}
				desc = pilgrimage.1001.desc.long
			}
			triggered_desc = {
				trigger = {
					scope:activity.var:pilgrimage_distance >= medium_pilgrimage_var
				}
				desc = pilgrimage.1001.desc.medium
			}
			desc = pilgrimage.1001.desc.short
		}
	}
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = root

	weight_multiplier = {
		base = 1
	}

	option = {
		name = pilgrimage.1001.a
	}

	after = {
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}

	immediate = {
		play_music_cue = "mx_cue_epic_sacral_moment"
	}

}


################################
# Generic Journey Events
# 2001-2499
# by Petter Vilberg
################################

### Bandit attack
# by Petter Vilberg
pilgrimage.2001 = {
	type = character_event
	title = pilgrimage.2001.t
	desc = pilgrimage.2001.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { ai_boldness > 0 }
			animation = anger
		}
		triggered_animation = {
			trigger = { always = yes }
			animation = fear
		}
	}

	trigger = {
		exists = scope:activity
		NOT = {
			exists = scope:activity.var:had_pilgrimage_2001
		}
	}

	immediate = {
		scope:activity = {
			set_variable = {
				name = had_pilgrimage_2001
				value = yes
			}
		}
		play_music_cue = "mx_cue_combat_stinger"
		hidden_effect = {
			if = {
				limit = {
					NOT = { has_trait = blademaster_3 }
				}
				random = {
					chance = 25
					save_scope_value_as = {
						name = increase_blademaster
						value = yes
					}
				}
			}
		}
	}
	
	option = { # Fight back
		name = pilgrimage.2001.a
		duel = {
			skill = prowess
			value = average_skill_rating
			15 = {
				desc = pilgrimage.2001.a.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
					min = -14
				}
				send_interface_toast = {
					title = pilgrimage.2001.a.success_title
					left_icon = root
					add_prestige = minor_prestige_gain
					if = {
						limit = { exists = scope:increase_blademaster }
						change_trait_rank = {
							trait = lifestyle_blademaster
							rank = 1
						}
					}
				}
			}
			10 = {
				desc = pilgrimage.2001.a.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.5
					min = -9
				}
				send_interface_toast = {
					title = pilgrimage.2001.a.failure_title
					left_icon = root
					increase_wounds_effect = {
						REASON = pilgrimage_bandit_attack
					}
				}
			}
		}
		stress_impact = {
			craven = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_honor = 1
			}
			compare_modifier = { # Consider your Prowess
				trigger = {
					prowess > average_skill_rating
				}
				value = prowess
				multiplier = 10
			}
		}
	}

	option = { # Try to hide!
		name = pilgrimage.2001.b
		add_prestige = minor_prestige_loss
		duel = {
			skill = intrigue
			value = average_skill_rating
			15 = {
				desc = pilgrimage.2001.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
					min = -14
				}
				send_interface_toast = {
					title = pilgrimage.2001.b.success_title
					left_icon = root
					custom_tooltip = pilgrimage.2001.b.success_tt
				}
			}
			10 = {
				desc = pilgrimage.2001.b.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.5
					min = -9
				}
				send_interface_toast = {
					title = pilgrimage.2001.b.failure_title
					left_icon = root
					increase_wounds_effect = {
						REASON = pilgrimage_bandit_attack
					}
				}
			}
		}
		stress_impact = {
			brave = major_stress_impact_gain
		}
		if = {
			limit = {
				faith = {
					trait_is_sin = craven
				}
			}
			add_piety = medium_piety_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
				ai_boldness = -0.5
				ai_honor = -1
			}
			compare_modifier = { # Consider your Intrigue
				trigger = {
					intrigue > average_skill_rating
				}
				value = intrigue
				multiplier = 10
			}
		}
	}
	
	option = { # Let them have whatever they want
		name = pilgrimage.2001.c
		add_prestige = minor_prestige_loss
		remove_short_term_gold = medium_gold_value
		stress_impact = {
			greedy = medium_stress_impact_gain
			brave = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = -1
				ai_boldness = -0.5
			}
		}
	}

	after = {
		if = {
			limit = { exists = scope:increase_blademaster }
			clear_saved_scope = increase_blademaster
		}
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}

### Someone truly hates heathens
# by Petter Vilberg
pilgrimage.2002 = {
	type = character_event
	title = pilgrimage.2002.t
	desc = pilgrimage.2002.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = root
		animation = disapproval
	}

	trigger = {
		exists = scope:activity
		NOT = {
			exists = scope:activity.var:had_pilgrimage_2002
		}
	}

	immediate = {
		scope:activity = {
			set_variable = {
				name = had_pilgrimage_2002
				value = yes
			}
		}
		random_dummy_gender_effect = yes
	}

	option = { # Zealous: YOU ARE ABSOLUTELY RIGHT
		name = pilgrimage.2002.c
		trigger = {
			has_trait = zealous
		}
		trait = zealous
		add_piety = medium_piety_gain
		add_character_modifier = {
			modifier = pilgrimage_disdainful_towards_faiths_modifier
			years = 10
		}
		ai_chance = {
			base = 500
		}
	}
	
	option = { # Are they truly all that bad?
		name = pilgrimage.2002.a
		add_character_modifier = {
			modifier = pilgrimage_sympathetic_towards_faiths_modifier
			years = 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
			}
		}
	}
	
	option = { # Of course
		name = pilgrimage.2002.b
		add_character_modifier = {
			modifier = pilgrimage_disdainful_towards_faiths_modifier
			years = 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
			}
		}
	}
	

	after = {
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}

### Loss of Companions
# by Petter Vilberg
pilgrimage.2003 = {
	type = character_event
	title = pilgrimage.2003.t
	desc = pilgrimage.2003.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = root
		animation = worry
	}

	trigger = {
		exists = scope:activity
		NOT = {
			exists = scope:activity.var:had_pilgrimage_2003
		}
		scope:activity.var:journey_event_counter > 1 # Prevent from firing at the very start of a Pilgrimage
	}

	immediate = {
		scope:activity = {
			set_variable = {
				name = had_pilgrimage_2003
				value = yes
			}
		}
	}
	
	option = { # Hire more guards
		name = pilgrimage.2003.a
		remove_short_term_gold = medium_gold_value
		add_character_modifier = {
			modifier = pilgrimage_foreign_guards_modifier
			years = 10
		}
		stress_impact = {
			humble = 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
			}
		}
	}
	
	option = { # This journey will remain humble and personal
		name = pilgrimage.2003.b
		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 = {
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}


### Run into a Potential Friend
# by Petter Vilberg
scripted_trigger pilgrimage_2004_potential_friend_trigger = {
	is_ai = yes
	is_adult = yes
	faith = root.faith
	NOT = { is_courtier_of = root }
}

pilgrimage.2004 = {
	type = character_event
	title = pilgrimage.2004.t
	desc = pilgrimage.2004.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = scope:potential_friend
		animation = happiness
	}

	trigger = {
		exists = scope:activity
		NOT = {
			exists = scope:activity.var:had_pilgrimage_2004
		}
		scope:activity.var:journey_event_counter = scope:activity.close_to_pilgrimage_end_counter # Can only happen towards the end of the pilgrimage
		any_relation = {
			type = potential_friend
			pilgrimage_2004_potential_friend_trigger = yes
		}
	}

	immediate = {
		scope:activity = {
			set_variable = {
				name = had_pilgrimage_2004
				value = yes
			}
		}
		random_relation = {
			type = potential_friend
			limit = {
				pilgrimage_2004_potential_friend_trigger = yes
			}
			save_scope_as = potential_friend
		}
		save_holy_site_for_loc_effect = yes
	}
	
	option = { #PantheonTerm has brought us together!
		name = pilgrimage.2004.a
		set_relation_friend = scope:potential_friend
		reverse_add_opinion = {
			target = scope:potential_friend
			modifier = divine_blessing_friendship_opinion
		}
		hidden_effect = {
			add_opinion = {
				target = scope:potential_friend
				modifier = divine_blessing_friendship_opinion
			}
		}
		stress_impact = {
			shy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 500
		}
	}

	option = { # I must do this in solitude
		name = pilgrimage.2004.b
		add_piety = medium_piety_gain
		stress_impact = {
			cynical = medium_stress_impact_gain
			gregarious = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	after = {
		hidden_effect = {
			scope:potential_friend = {
				add_trait = pilgrim
			}
		}
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}

### A peasant inadvertedly insults you
# by Petter Vilberg
pilgrimage.2005 = {
	type = character_event
	title = pilgrimage.2005.t
	desc = pilgrimage.2005.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { ai_vengefulness > 0 }
			animation = anger
		}
		triggered_animation = {
			trigger = { always = yes }
			animation = shock
		}
	}
	
	trigger = {
		exists = scope:activity
		is_ruler = yes
		NOT = {
			exists = scope:activity.var:had_pilgrimage_2005
		}
	}

	immediate = {
		scope:activity = {
			set_variable = {
				name = had_pilgrimage_2005
				value = yes
			}
		}
		random_dummy_gender_peasant_effect = yes
		primary_title = {
			save_scope_as = title
		}
	}

	option = { # Take it with some humour
		name = pilgrimage.2005.a
		flavor = pilgrimage.2005.a.flavor
		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
			}
		}
	}

	option = { # What an insult! String them up!
		name = pilgrimage.2005.b
		add_dread = medium_dread_gain
		add_piety = minor_piety_loss
		stress_impact = {
			compassionate = medium_stress_impact_gain
			humble = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 1
			}
		}
	}
	
	option = { # Find other people to travel with
		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
			}
		}
	}

	after = {
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}


### You have gotten lost
# by Petter Vilberg
pilgrimage.2006 = {
	type = character_event
	title = pilgrimage.2006.t
	desc = pilgrimage.2006.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { ai_boldness > 0 }
			animation = dismissal
		}
		triggered_animation = {
			trigger = { ai_boldness <= -50 }
			animation = fear
		}
		triggered_animation = {
			trigger = { always = yes }
			animation = worry
		}
	}
	
	trigger = {
		exists = scope:activity
		NOT = {
			exists = scope:activity.var:had_pilgrimage_2006
		}
	}

	immediate = {
		scope:activity = {
			set_variable = {
				name = had_pilgrimage_2006
				value = yes
			}
		}
	}

	option = { # Hire a guide
		name = pilgrimage.2006.a
		remove_short_term_gold = medium_gold_value
		stress_impact = {
			greedy = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			stubborn = medium_stress_impact_gain
		}
	}

	option = { # I can find the way
		name = pilgrimage.2006.b
		add_character_modifier = {
			modifier = pilgrimage_completely_lost_modifier
			years = 5
		}
	}

	after = {
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}


### Reflections
# by Petter Vilberg
pilgrimage.2007 = {
	type = character_event
	title = pilgrimage.2007.t
	desc = pilgrimage.2007.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = root
		animation = personality_content
	}
	
	trigger = {
		exists = scope:activity
		NOR = {
			exists = scope:activity.var:had_pilgrimage_2007
			religion = religion:islam_religion
		}

	}

	immediate = {
		scope:activity = {
			set_variable = {
				name = had_pilgrimage_2007
				value = yes
			}
		}
	}

	option = { # PantheonTerm would wish me to, of course
		name = pilgrimage.2007.a
		add_character_modifier = {
			modifier = dedicated_to_pilgrimage_modifier
			years = 10
		}
		stress_impact = {
			cynical = medium_stress_impact_gain
		}
		ai_chance = {
			base = 200
			ai_value_modifier = {
				ai_zeal = 1
			}
		}
	}

	option = { # I want to see foreign lands
		name = pilgrimage.2007.b
		add_stress = medium_stress_loss
		add_character_modifier = {
			modifier = pilgrimage_worldly_modifier
			years = 10
		}
		ai_chance = {
			base = 50
			compare_modifier = {
				value = stress
				multiplier = 2
			}
		}
	}
	
	option = { # For the sake of appearances, of course
		name = pilgrimage.2007.c
		add_character_modifier = {
			modifier = showy_about_pilgrimage_modifier
			years = 10
		}
		stress_impact = {
			zealous = major_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = -1
			}
		}
	}

	after = {
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}

### Fall Ill
# by Petter Vilberg
pilgrimage.2008 = {
	type = character_event
	title = pilgrimage.2008.t
	desc = pilgrimage.2008.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = root
		animation = sick
	}
	
	trigger = {
		exists = scope:activity
		NOT = {
			exists = scope:activity.var:had_pilgrimage_2008
		}
		can_contract_disease_trigger = { DISEASE = ill }
	}

	immediate = {
		scope:activity = {
			set_variable = {
				name = had_pilgrimage_2008
				value = yes
			}
			var:start_location = {
				save_scope_as = start_location
			}
		}
		show_as_tooltip = {
			add_trait = ill
		}
		hidden_effect = {
			contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = no } #Adds the trait, sends event "health.2201" to those who care if health is brought too low			
		}
		play_music_cue = "mx_cue_illness"
	}

	option = {
		name = pilgrimage.2008.whole_of_body
		trigger = {
			has_trait = whole_of_body
		}
		trait = whole_of_body
		show_as_tooltip = {
			remove_trait = ill
		}
		hidden_effect = {
			recover_from_disease_effect = {
				DISEASE = ill
			}
		}
		ai_chance = {
			base = 1000
		}
	}

	option = { # This is no time to give up
		name = pilgrimage.2008.a
		custom_tooltip = pilgrimage.2008.a.tt
		ai_chance = {
			base = 100
		}
	}

	option = { # I cannot go on like this
		name = pilgrimage.2008.b
		abandon_pilgrimage_early_effect = yes
		stress_impact = {
			stubborn = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = stubborn
			}
		}
	}

	after = {
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}


### Travelling while ill is bad for you
# by Petter Vilberg
pilgrimage.2009 = {
	type = character_event
	title = pilgrimage.2009.t
	desc = pilgrimage.2009.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = root
		animation = sick
	}
	
	trigger = {
		exists = scope:activity
		has_trait = ill
		can_contract_disease_trigger = {
			DISEASE = pneumonic
		}
	}

	immediate = {
		show_as_tooltip = {
			add_trait_force_tooltip = pneumonic
		}
		hidden_effect = {
			contract_disease_effect = {
				DISEASE = pneumonic
				TREATMENT_EVENT = no
			}
		}
		scope:activity = {
			var:start_location = {
				save_scope_as = start_location
			}
		}
	}

	option = { # I am too close now
		name = pilgrimage.2009.a
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = pilgrimage.2009.b
		abandon_pilgrimage_early_effect = yes
		ai_chance = {
			base = 100
		}
	}

	after = {
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}

### Meet a Mystic chain
### 2010-2012
### by Petter Vilberg

# Meet a Mystic on your journey
scripted_trigger pilgrimage_2010_mystic_ruler = {	
	faith = root.faith
	OR = {
		has_trait = mystic_1
		has_trait = mystic_2
		has_trait = mystic_3
	}
	is_available_ai = yes
	NOR = {
		AND = { # Not your liege
			exists = 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
		}
	}
}

scripted_trigger pilgrimage_2010_mystic_home_ruler = {
	faith = root.faith
	NOT = { this = root }
	exists = capital_province
}

pilgrimage.2010 = {
	type = character_event
	title = pilgrimage.2010.t
	desc = pilgrimage.2010.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = scope:mystic
		animation = personality_rational
	}
	
	trigger = {
		is_ai = no
		#scope:activity = {
		#	trigger_if = {
		#		limit = { exists = var:is_hajj }
		#		remaining_pilgrimage_journey_events > 2 # This will take up two events if the player goes with it
		#	}
		#	trigger_else = {
		#		remaining_pilgrimage_journey_events > 1 # This will take up two events if the player goes with it
		#	}
		#}
		NOT = { has_trait = mystic_1 }
		any_ruler = {
			OR = {
				pilgrimage_2010_mystic_ruler = yes
				pilgrimage_2010_mystic_home_ruler = yes
			}
		}
	}

	immediate = {
		# Find our Mystic
		if = {
			limit = {
				any_ruler = {
					pilgrimage_2010_mystic_ruler = yes
				}
			}
			random_ruler = {
				limit = {
					pilgrimage_2010_mystic_ruler = yes
				}
				save_scope_as = mystic
			}
		}
		else = {
			random_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
				save_scope_as = mystic
			}
		}
	}

	option = { # Let's see what this person is up to
		name = pilgrimage.2010.a
		custom_tooltip = pilgrimage.2010.a.tt
		trigger_event = {
			id = pilgrimage.2011
			days = 5
		}
	}

	option = { # Smells of heresy to me!
		name = pilgrimage.2010.b
		add_piety = medium_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:mystic = {
				if = {
					limit = {
						NOT = { has_trait = pilgrim }
						trigger_if = {
							limit = {
								faith.religion = religion:islam_religion
							}
							exists = scope:activity.var:is_hajj
						}
					}
					add_trait = pilgrim
				}
			}
		}
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}

# The Mystic has a lot to say about your faith
pilgrimage.2011 = {
	type = character_event
	title = pilgrimage.2010.t
	desc = pilgrimage.2011.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = scope:mystic
		animation = personality_rational
	}

	trigger = {
		scope:mystic = {
			is_alive = yes
			is_imprisoned = no
		}
	}

	on_trigger_fail = {
		trigger_event = pilgrimage.2012
	}

	option = { # Tell me more!
		name = pilgrimage.2011.a
		custom_tooltip = pilgrimage.2011.a.tt
		trigger = {
			learning >= decent_skill_rating
		}
		show_as_unavailable = {
			always = yes
		}
		skill = learning
		trigger_event = {
			id = pilgrimage.2013
			days = 5
		}
	}

	option = { # I'm just going to take a nap
		name = pilgrimage.2011.b
		custom_tooltip = pilgrimage.2011.b.tt
		trigger_event = {
			id = pilgrimage.2014
			days = 5
		}
	}

	option = { # Engage in vigorous debate
		name = pilgrimage.2011.c
		custom_tooltip = pilgrimage.2011.c.tt
		trigger_event = {
			id = pilgrimage.2015
			days = 5
		}
	}
}

# Fallback in case something happened in between events
pilgrimage.2012 = {
	type = character_event
	title = pilgrimage.2010.t
	desc = pilgrimage.2012.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = scope:mystic
		animation = personality_rational
	}

	option = {
		name = pilgrimage.2012.a
		add_character_modifier = {
			modifier = pilgrimage_religious_reflections_modifier
			years = 5
		}
	}

	after = {
		set_up_next_pilgrimage_event_effect = {
			DAYS = 20
		}
	}
}

# Outcome of engaging
pilgrimage.2013 = {
	type = character_event
	title = pilgrimage.2010.t
	desc = pilgrimage.2013.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = scope:mystic
		animation = happiness
	}

	option = {
		name = pilgrimage.2013.a
		add_trait = mystic_1
	}

	after = {
		# Mystic gets out with the Pilgrim trait for flavor
		hidden_effect = {
			scope:mystic = {
				if = {
					limit = {
						NOT = { has_trait = pilgrim }
						trigger_if = {
							limit = {
								faith.religion = religion:islam_religion
							}
							exists = scope:activity.var:is_hajj
						}
					}
					add_trait = pilgrim
				}
			}
		}
		set_up_next_pilgrimage_event_effect = {
			DAYS = 20
		}
	}
}

# Outcome of sleeping
pilgrimage.2014 = {
	type = character_event
	title = pilgrimage.2010.t
	desc = pilgrimage.2014.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = scope:mystic
		animation = personality_rational
	}

	option = {
		name = pilgrimage.2014.a
		remove_short_term_gold = tiny_gold_value
		add_character_modifier = {
			modifier = pilgrimage_rest_and_good_health_modifier
			years = 5
		}
	}

	after = {
		# Mystic gets out with the Pilgrim trait for flavor
		hidden_effect = {
			scope:mystic = {
				if = {
					limit = {
						NOT = { has_trait = pilgrim }
						trigger_if = {
							limit = {
								faith.religion = religion:islam_religion
							}
							exists = scope:activity.var:is_hajj
						}
					}
					add_trait = pilgrim
				}
			}
		}
		set_up_next_pilgrimage_event_effect = {
			DAYS = 20
		}
	}
}

# Outcome of debating
pilgrimage.2015 = {
	type = character_event
	title = pilgrimage.2010.t
	desc = pilgrimage.2015.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = scope:mystic
		animation = personality_rational
	}

	option = {
		name = pilgrimage.2015.a
		add_learning_skill = 1
	}

	after = {
		set_local_variable = {
			name = debated_mystic
			value = yes
		}
		# Mystic gets out with the Pilgrim trait for flavor
		hidden_effect = {
			scope:mystic = {
				if = {
					limit = {
						NOT = { has_trait = pilgrim }
						trigger_if = {
							limit = {
								faith.religion = religion:islam_religion
							}
							exists = scope:activity.var:is_hajj
						}
					}
					add_trait = pilgrim
				}
			}
		}
		set_up_next_pilgrimage_event_effect = {
			DAYS = 20
		}
	}
}

### END Mystic chain



################################
# Sin/Virtue Temptation Journey Events
# 2501-2999
# by Sean Hughes
################################

### Persistent Pauper
# by Sean Hughes
scripted_effect generosity_piety_stress_effect = {
	if = {
		limit = {
			faith = {
				OR = {
					trait_is_virtue = generous
					trait_is_virtue = compassionate
				}
			}
		}
		add_piety = minor_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 = minor_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
	}
}

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 = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = scope:beggar
		animation = beg
		outfit_tags = { beggar_rags }
	}

	trigger = {
		exists = scope:activity
		NOT = {
			exists = scope:activity.var:had_pilgrimage_2501
		}
		
		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
			}
		}
	}

	immediate = {
		scope:activity.activity_province.county = {
			save_scope_as = event_location
		}

		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 = scope:event_location.title_province
			faith = root.faith # They 'convert' if they ever join your court.
			culture = scope:event_location.culture
			save_scope_as = beggar
		}

		scope:activity = {
			set_variable = {
				name = had_pilgrimage_2501
				value = yes
			}
		}
	}
	
	option = {
		name = pilgrimage.2501.c.arrogant
		trigger = {
			has_trait = arrogant
		}
		trait = arrogant

		scope:beggar = {
			death = {
				killer = root
				death_reason = death_execution
			}
		}
		add_dread = minor_dread_gain
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}

	option = {
		trigger = {
			OR = {
				is_ai = no
				short_term_gold >= minor_gold_value
			}
		}

		name = {
			text = pilgrimage.2501.a.virtue
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = generous
						trait_is_virtue = compassionate
					}
				}
			}
		}
		name = {
			text = pilgrimage.2501.a.sin
			trigger = { faith = { trait_is_sin = generous } }
		}

		remove_short_term_gold = minor_gold_value
		generosity_piety_stress_effect = yes
		add_character_flag = {
			flag = pilgrimage_2501_gave_gold
			days = 3
		}
		trigger_event = {
			id = pilgrimage.2502
			days = 0
		}
	}

	option = {
		name = pilgrimage.2501.b

		parsimony_piety_stress_effect = yes
		trigger_event = {
			id = pilgrimage.2502
			days = 0
		}
	}
}

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 = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = scope:beggar
		animation = beg
		outfit_tags = { beggar_rags }
	}

	# Option A: Relent and give the beggar (more) money.
	option = {
		trigger = {
			OR = {
				is_ai = no
				short_term_gold >= minor_gold_value
			}
		}
		name = pilgrimage.2502.a

		remove_short_term_gold = minor_gold_value
		generosity_piety_stress_effect = yes

		if = {
			limit = {
				has_character_flag = pilgrimage_2501_gave_gold
			}
			trigger_event = {
				id = pilgrimage.2503
				days = 0
			}
		}
		else = {
			hidden_effect = {
				scope:beggar = {
					death = {
						death_reason = death_vanished
					}
				}
			}
			set_up_next_pilgrimage_event_effect = { DAYS = 30 }
		}
	}

	# Option B (Special): Refuse, losing Generous and gaining Callous
	option = {
		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
			}
		}
		name = pilgrimage.2502.b

		remove_trait = generous
		add_trait = callous
		stress_impact = {
			base = major_stress_impact_gain
		}

		hidden_effect = {
			scope:beggar = {
				death = {
					death_reason = death_vanished
				}
			}
		}
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}

	# 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
				}
			}
		}
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}

pilgrimage.2503 = {
	type = character_event
	title = pilgrimage.2503.t
	desc = pilgrimage.2503.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_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

		remove_short_term_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

		hidden_effect = {
			scope:beggar = {
				death = {
					death_reason = death_vanished
				}
			}
		}
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}

}

pilgrimage.2504 = {
	type = character_event
	title = pilgrimage.2504.t
	desc = pilgrimage.2504.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = scope:beggar
		animation = beg
		outfit_tags = { beggar_rags }
	}

	option = {
		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

		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
		}
	}

	option = {
		name = pilgrimage.2504.b
		add_courtier = scope:beggar
		reverse_add_opinion = {
			modifier = grateful_opinion
			target = scope:beggar
			opinion = 50
		}
		add_hook = {
 			type = loyalty_hook
				target = scope:beggar
 	 	}

 	 	hidden_effect = {
			scope:beggar = {
				death = {
					death_reason = death_vanished
				}
			}
		}
	}

	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
		}
		add_piety = minor_piety_gain

		hidden_effect = {
			scope:beggar = {
				death = {
					death_reason = death_vanished
				}
			}
		}
	}

	after = {
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}

### Cocky Lordling
# by Sean Hughes

scripted_trigger pilgrimage_2511_valid_lordling = {
	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
}

pilgrimage.2511 = {
	type = character_event
	title = pilgrimage.2511.t
	desc = {
		desc = pilgrimage.2511.desc.start
		first_valid = {
			triggered_desc = {
				trigger = {
					religion = religion:christianity_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 = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = scope:lordling
		animation = anger
	}

	trigger = {
		OR = {
			# Potentially perf-heavy, restricted to players and important AIs.
			is_ai = no
			highest_held_title_tier >= tier_kingdom
		}
		exists = scope:activity
		NOT = {
			exists = scope:activity.var:had_pilgrimage_2511
		}

		# 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.
		OR = {
			any_neighboring_and_across_water_top_liege_realm_owner = {
				any_vassal_or_below = {
					OR = {
						pilgrimage_2511_valid_lordling = yes
						AND = {
							exists = primary_heir
							primary_heir = {
								pilgrimage_2511_valid_lordling = yes
							}
						}
					}
				}
			}
			any_neighboring_and_across_water_realm_same_rank_owner = {
				any_vassal_or_below = {
					OR = {
						pilgrimage_2511_valid_lordling = yes
						AND = {
							exists = primary_heir
							primary_heir = {
								pilgrimage_2511_valid_lordling = yes
							}
						}
					}
				}
			}
		}
	}

	immediate = {
		scope:activity = {
			set_variable = {
				name = had_pilgrimage_2511
				value = yes
			}
		}
		save_holy_site_for_loc_effect = yes

		# Compile a list of possible lordlings.
		every_neighboring_and_across_water_top_liege_realm_owner = {
			every_vassal_or_below = {
				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
						}
					}
				}
			}
		}
		every_neighboring_and_across_water_top_liege_realm_owner = {
			every_vassal_or_below = {
				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
		}
	}

	option = {
		name = pilgrimage.2511.a
		add_piety = medium_piety_loss
		add_prestige = minor_prestige_gain
		scope:lordling = {
			increase_wounds_effect = { REASON = fight }
		}
		progress_towards_rival_effect = {
			CHARACTER = scope:lordling
			OPINION = no
		}
	}

	option = {
		name = pilgrimage.2511.b
		add_prestige = minor_prestige_loss
		add_piety = minor_piety_gain

		stress_impact = {
			arrogant = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
			vengeful = minor_stress_impact_gain
		}
	}

	option = {
		name = pilgrimage.2511.c
		trigger = {
			NOR = {
				has_trait = athletic
				has_trait = lazy
			}
			health >= 2.0
		}

		add_prestige = minor_prestige_loss
		stress_impact = {
			base = massive_stress_impact_gain
		}
		add_trait = athletic
	}

	after = {
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}

################################
# Religion-specific Journey Events
# 3001-3999
# by Sean Hughes
################################

# 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 = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = scope:zealous_priest
		animation = personality_zealous
		outfit_tags = { bishop_outfit }
		#hide_info = yes
	}

	trigger = {
		exists = scope:activity
		NOT = {
			exists = scope:activity.var:had_pilgrimage_3001
		}
		religion = religion:christianity_religion
		exists = capital_province
	}

	immediate = {
		random_dummy_gender_clergy_effect = yes
		create_character = {
			age = 40
			gender = scope:dummy_clergy_gender
			location = root.capital_province
			faith = root.faith
			culture = root.culture
			save_scope_as = zealous_priest
		}
		scope:activity = {
			set_variable = {
				name = had_pilgrimage_3001
				value = yes
			}
		}
		play_music_cue = "mx_cue_general_crusade_event_2"
	}

	option = {
		name = pilgrimage.3001.a

		add_piety = major_piety_gain
		random = {
			chance = {
				value = 35
				add = {
					value = health
					multiply = -2.5
				}
			}

			show_as_tooltip = { add_trait = ill }
			custom_tooltip = pilgrimage.3001.a.tt
			hidden_effect = {
				trigger_event = {
					id = health.1001
					days = { 3 10 }
				}
			}			
		}
	}

	option = {
		name = pilgrimage.3001.b

		add_piety = miniscule_piety_loss
	}

	after = {
		hidden_effect = {
			scope:zealous_priest = {
				death = {
					death_reason = death_vanished
				}
			}
		}
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}

# 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 = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = scope:naked_preacher
		animation = personality_zealous
	}

	trigger = {
		exists = scope:activity
		NOT = {
			exists = scope:activity.var:had_pilgrimage_3002
		}
		NOT = { has_game_rule = never_nudity }
		religion = religion:christianity_religion
		faith = {
			NOR = {
				has_doctrine = tenet_natural_primitivism
				has_doctrine = special_doctrine_naked_priests
			}
		}
	}

	immediate = {
		create_character = {
			age = 40
			gender_female_chance = 50
			location = root.capital_province
			faith = faith:adamites
			culture = root.culture
			trait = zealous
			random_traits_list = {
				count = 2
				calm = {}
				brave = {}
				gregarious = {}
				ambitious = {}
				stubborn = {}
				arrogant = {}
			}
			trait = mystic_2
			save_scope_as = naked_preacher
		}
		scope:activity = {
			set_variable = {
				name = had_pilgrimage_3002
				value = yes
			}
		}
	}

	option = {
		name = pilgrimage.3002.a
		add_piety = massive_piety_loss
		set_character_faith = faith:adamites
		if = {
			limit = { NOT = { scope:naked_preacher = { is_courtier_of = root } } }
			add_courtier = scope:naked_preacher
		}
		
		ai_chance = {
			base = -80	

			# Between -400 and +400 based on ai_rationality (Only highly irrational characters should even consider this option, due to running so strongly against social norms).
			modifier = {
				add = {
					value = ai_rationality
					if = {
						limit = {
							has_trait = wrathful
						}
						subtract = medium_negative_ai_value # Though Wrathful does has a low ai_rationality score, that's not *quite* the personality we're looking for here.
					}
					if = {
						limit = {
							has_trait = paranoid
						}
						subtract = medium_negative_ai_value # Same goes for Paranoid, they shouldn't be *more* likely to bare all to their supposed enemies!
					}
					if = {
						limit = {
							OR = {
								has_trait = arbitrary
								has_trait = fickle
							}
						}
						add = low_negative_ai_value # Yet arbitrary and/or fickle rulers should be even more likely to entertain this strange preacher than their 'ai_rationality' would suggest.
					}
					multiply = -5
				}
			}

			# Between -200 and +50 based on ai_greed (Greedy characters far less likely to accept, while generous characters are only slightly more likely to entertain the possibility).
			modifier = {
				add = {
					value = ai_greed
					if = {
						limit = {
							ai_greed < 0
						}
						multiply = 0.5
					}
					else = {
						multiply = -2
					}
				}
			}
			# Between -200 and +0 based on ai_zeal (Zealous characters extremely unlikely to convert from their faith, regardless of the new faith).
			modifier = {
				add = {
					value = ai_zeal
					multiply = -2
					max = 0
				}
			}
		}

		debug_log = "Character converting to Adamitism"
	}

	option = {
		name = pilgrimage.3002.b
		add_piety = medium_piety_gain

		hidden_effect = {
			scope:naked_preacher = {
				death = {
					death_reason = death_vanished
				}
			}
		}

		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_zeal = 1
			}
		}
	}

	option = {
		name = pilgrimage.3002.c

		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
				}

				send_interface_toast = {
					title = pilgrimage.3002.c.success

					scope:naked_preacher = {
						set_character_faith = root.faith
					}
					add_courtier = scope:naked_preacher
					add_learning_lifestyle_xp = major_lifestyle_xp
					add_piety = major_piety_gain
				}

			}
			50 = {
				desc = pilgrimage.3002.c.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3
					min = -49
				}

				send_interface_toast = {
					title = pilgrimage.3002.c.failure
					add_learning_lifestyle_xp = medium_lifestyle_xp
				}

				hidden_effect = {
					scope:naked_preacher = {
						death = {
							death_reason = death_vanished
						}
					}
				}				
			}
		}

		ai_chance = {
			base = 0
			ai_value_modifier = {
				ai_zeal = 0.5
				ai_compassion = 1
			}
		}
	}

	option = {
		name = pilgrimage.3002.d
		add_prestige = minor_prestige_gain

		hidden_effect = {
			scope:naked_preacher = {
				death = {
					death_reason = death_vanished
				}
			}
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = -1
			}
		}
	}

	after = {
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}	
}

# Doomsayer claiming the end is nigh!
# by Sean Hughes
pilgrimage.3003 = {
	type = character_event
	title = pilgrimage.3003.t
	desc = pilgrimage.3003.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	override_background = {
		event_background = market
	}
	left_portrait = {
		character = scope:doomsayer
		animation = personality_zealous
		outfit_tags = { bishop_outfit }
		remove_default_outfit = yes
		#hide_info = yes
	}

	trigger = {
		exists = scope:activity
		NOT = {
			exists = scope:activity.var:had_pilgrimage_3003
		}
		religion = religion:christianity_religion
	}

	immediate = {
		random_dummy_gender_clergy_effect = yes
		create_character = {
			age = 40
			gender = scope:dummy_clergy_gender
			location = root.capital_province
			faith = root.faith
			culture = root.culture
			save_scope_as = doomsayer
		}
		scope:activity = {
			set_variable = {
				name = had_pilgrimage_3003
				value = yes
			}
		}
	}

	option = {
		name = pilgrimage.3003.a
		trigger = {
			learning >= high_skill_rating
		}
		skill = learning
		flavor = pilgrimage.3003.a.flavor
		add_piety = major_piety_value
		add_prestige = minor_prestige_value
	}

	option = {
		name = pilgrimage.3003.b
		add_stress = medium_stress_loss
	}

	option = {
		name = pilgrimage.3003.c
		add_piety = medium_piety_value
	}

	after = {
		hidden_effect = {
			scope:doomsayer = {
				death = {
					death_reason = death_vanished
				}
			}
		}
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}		
}

# 3101-3200: Islam

### Irham
# by Sean Hughes
pilgrimage.3101 = {
	type = character_event
	title = pilgrimage.3101.t
	desc = pilgrimage.3101.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = root
	
	trigger = {
		religion = religion:islam_religion
		exists = scope:activity
		NOT = {
			exists = scope:activity.var:had_pilgrimage_3101
		}
		scope:activity.var:journey_event_counter = scope:activity.close_to_pilgrimage_end_counter
	}

	immediate = {
		scope:activity = {
			set_variable = {
				name = had_pilgrimage_3101
				value = yes
			}
		}
	}

	option = { # Commit to the Irham
		name = pilgrimage.3101.a
		add_piety = medium_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
			}
		}	
		
	}

	option = { # I don't have to be that strict
		name = pilgrimage.3101.b

		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 = {
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}

### Ziyarat
# by Sean Hughes
pilgrimage.3102 = {
	type = character_event
	title = pilgrimage.3102.t
	desc = pilgrimage.3102.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = root
	
	trigger = {
		religion = religion:islam_religion
		exists = scope:activity
		NOT = {
			exists = scope:activity.var:had_pilgrimage_3102
		}
	}

	immediate = {
		scope:activity = {
			set_variable = {
				name = had_pilgrimage_3102
				value = yes
			}
		}
		save_holy_site_for_loc_effect = yes
	}

	option = { # See distant places
		name = pilgrimage.3102.a
		add_stress = minor_stress_loss
		add_piety = minor_piety_gain
		add_character_modifier = {
			modifier = pilgrimage_worldly_modifier
			years = 10
		}

		ai_chance = {
			base = 50
			compare_modifier = {
				value = stress
				multiplier = 2
			}
		}		
		
	}

	option = { # My zeal drives me!
		name = pilgrimage.3102.b
		trigger = {
			NOT = {
				has_trait = cynical
			}
		}
		show_as_unavailable = {
			has_trait = cynical
		}

		add_piety = medium_piety_gain
		add_character_modifier = {
			modifier = dedicated_to_pilgrimage_modifier
			years = 10
		}

		ai_chance = {
			base = 200
			ai_value_modifier = {
				ai_zeal = 1
			}
		}
	}
	
	option = { # I have... questions
		name = pilgrimage.3102.c
		trigger = {
			NOT = {
				has_trait = zealous
			}
		}
		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
			}
		}
	}

	after = {
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}


# 3201-3300: Hinduism

### Ritual Purification
# by Sean Hughes
pilgrimage.3201 = {
	type = character_event
	title = pilgrimage.3201.t
	desc = pilgrimage.3201.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = root

	trigger = {
		exists = scope:activity
		NOT = {
			exists = scope:activity.var:had_pilgrimage_3201
		}
		religion = religion:hinduism_religion
	}

	immediate = {
		scope:activity = {
			set_variable = {
				name = had_pilgrimage_3201
				value = yes
			}
		}
	}

	option = {
		name = pilgrimage.3201.a
		
		stress_impact = {
			arrogant = minor_stress_gain
		}
		add_prestige = minor_prestige_loss
		add_piety = medium_piety_gain

	}

	option = {
		name = pilgrimage.3201.b

		stress_impact = {
			humble = medium_stress_gain
			zealous = minor_stress_gain
			compassionate = minor_stress_gain
		}
		add_piety = minor_piety_loss
		add_prestige = medium_prestige_gain
	}

	after = {
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}

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 = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = root

	trigger = {
		exists = scope:activity
		NOT = {
			exists = scope:activity.var:had_pilgrimage_3202
		}
		OR = {
			religion = religion:hinduism_religion
			religion = religion:buddhism_religion
			religion = religion:jainism_religion
			faith = { has_doctrine = tenet_sanctity_of_nature }
		}

	}

	immediate = {
		scope:activity = {
			set_variable = {
				name = had_pilgrimage_3202
				value = yes
			}
		}
	}

	option = {
		name = pilgrimage.3202.a
		
		custom_tooltip = pilgrimage.3202.a.tt
		add_learning_lifestyle_xp = major_lifestyle_xp
		set_up_next_pilgrimage_event_effect = { DAYS = 90 }

		stress_impact = {
			base = minor_stress_loss
			calm = minor_stress_loss
			patient = minor_stress_loss
			impatient = medium_stress_gain
		}
	}

	option = {
		name = pilgrimage.3202.b

		custom_tooltip = pilgrimage.3202.b.tt
		set_up_next_pilgrimage_event_effect = { DAYS = 5 }
		stress_impact = {
			zealous = minor_stress_gain
			patient = minor_stress_gain
		}
	}

	after = {
		# Do not run the normal set_up_next_pilgrimage_event effect here, as it's run in the options.
	}
}

# 3301-3400: Buddhism

### Critical Monk
# by Sean Hughes
pilgrimage.3301 = {
	type = character_event
	title = pilgrimage.3301.t
	desc = pilgrimage.3301.desc
	theme = pilgrimage_activity
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = {
		character = scope:wanderer
		animation = personality_zealous
		outfit_tags = { monk_outfit }
		remove_default_outfit = yes
		#hide_info = yes
	}

	trigger = {
		exists = scope:activity
		NOT = {
			exists = scope:activity.var:had_pilgrimage_3301
		}
		religion = religion:buddhism_religion
	}

	immediate = {
		random_dummy_gender_clergy_effect = yes
		create_character = {
			age = 80
			gender = scope:dummy_clergy_gender
			location = root.capital_province
			faith = root.faith
			culture = root.culture
			save_scope_as = wanderer
		}
		scope:activity = {
			set_variable = {
				name = had_pilgrimage_3301
				value = yes
			}
		}
	}

	option = {
		name = pilgrimage.3301.c
		trigger = {
			learning >= high_skill_rating
		}
		skill = learning
		show_as_unavailable = {
			learning < high_skill_rating
		}
		add_prestige = medium_prestige_gain
		add_piety = medium_piety_gain
	}

	option = {
		name = pilgrimage.3301.a
		add_piety = major_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
		}
	}

	option = {
		name = pilgrimage.3301.b

		add_piety = minor_piety_loss
		stress_impact = {
			humble = minor_stress_gain
		}
	}

	after = {
		hidden_effect = {
			scope:wanderer = {
				death = {
					death_reason = death_vanished
				}
			}
		}
		set_up_next_pilgrimage_event_effect = { DAYS = 30 }
	}
}

################################
# Generic Destination Events
# 4001-4999
# by Petter Vilberg
################################

### Generic Destination
# by Petter Vilberg
pilgrimage.4001 = {
	type = character_event
	title = pilgrimage.4001.t
	desc = {
		desc = pilgrimage.4001.desc
		triggered_desc = {
			trigger = { has_trait = cynical }
			desc = pilgrimage.4001.cynical_end
		}
	}
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = ecstasy
	}

	trigger = {
		exists = scope:activity
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
		play_music_cue = "mx_cue_epic_sacral_moment"
	}
	
	option = {
		name = pilgrimage.4001.a
		trigger = {
			NOT = { has_trait = cynical }
		}
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.4001.b
		trigger = {
			has_trait = cynical
		}
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}


### The Mystic you met on your journey is there!
# by Petter Vilberg
pilgrimage.4002 = {
	type = character_event
	title = pilgrimage.4001.t
	desc = pilgrimage.4002.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = scope:mystic
		animation = ecstasy
	}

	trigger = {
		exists = scope:activity
		exists = scope:mystic
		OR = {
			has_trait = mystic_1
			exists = local_var:debated_mystic
		}
		scope:mystic = {
			is_available_ai = yes
		}
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.4002.a
		trigger = {
			NOT = { has_trait = cynical }
		}
		progress_towards_friend_effect = {
			CHARACTER = scope:mystic
			OPINION = yes
		}
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.4002.b
		trigger = {
			has_trait = cynical
		}
		progress_towards_friend_effect = {
			CHARACTER = scope:mystic
			OPINION = yes
		}
		give_pilgrimage_reward_effect = yes
	}

	option = {
		name = pilgrimage.4002.c
		trigger = {
			has_trait = lustful
			mgr_can_seduce = yes
			scope:mystic = {
				NOR = {
					has_trait = chaste
					has_trait = celibate
				}
				is_attracted_to_gender_of = root
			}
		}
		trait = lustful
		had_sex_with_effect = {
			CHARACTER = scope:mystic
			PREGNANCY_CHANCE = pregnancy_chance
		}
		progress_towards_lover_effect = {
			CHARACTER = scope:mystic
			OPINION = yes
		}
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}


################################
# Holy Site-specific destination events
# 5001-5999
# by Sean Hughes
################################

scripted_trigger pilgrimage_is_to = {
	exists = scope:activity
	exists = scope:activity.activity_province
	scope:activity.activity_province.county = title:$DESTINATION$
}

	# Christian
# Rome
pilgrimage.5001 = {
	type = character_event
	title = pilgrimage.5001.t
	desc = pilgrimage.5001.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_roma }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5001.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5001.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

# Jerusalem
pilgrimage.5011 = {
	type = character_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_activity
	left_portrait = {
		character = root
		animation = ecstasy
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_jerusalem }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5011.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5011.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

# Constantinople
pilgrimage.5021 = {
	type = character_event
	title = pilgrimage.5021.t
	desc = pilgrimage.5021.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_byzantion }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5021.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5021.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

# Alexandria
pilgrimage.5031 = {
	type = character_event
	title = pilgrimage.5031.t
	desc = pilgrimage.5031.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_alexandria }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5031.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5031.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}


	# Jewish
# Mount Sinai
pilgrimage.5101 = {
	type = character_event
	title = pilgrimage.5101.t
	desc = pilgrimage.5101.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_sinai }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5101.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5101.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

	# Muslim
# Medina
pilgrimage.5201 = {
	type = character_event
	title = pilgrimage.5201.t
	desc = pilgrimage.5201.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_medina }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5201.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5201.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

	# Hindu
# Varanasi
pilgrimage.5301 = {
	type = character_event
	title = pilgrimage.5301.t
	desc = pilgrimage.5301.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_varanasi }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5301.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5301.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

# Ayodhya
pilgrimage.5311 = {
	type = character_event
	title = pilgrimage.5311.t
	desc = pilgrimage.5311.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_ayodhya }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5311.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5311.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

# Mathura
pilgrimage.5321 = {
	type = character_event
	title = pilgrimage.5321.t
	desc = pilgrimage.5321.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_mathura }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5321.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5321.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

# Haridwar
pilgrimage.5331 = {
	type = character_event
	title = pilgrimage.5331.t
	desc = pilgrimage.5331.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_sthanisvara }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5331.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5331.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

# Kanchipuram
pilgrimage.5341 = {
	type = character_event
	title = pilgrimage.5341.t
	desc = pilgrimage.5341.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_kanchipuram }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5341.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5341.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

# Ujjayini
pilgrimage.5351 = {
	type = character_event
	title = pilgrimage.5351.t
	desc = pilgrimage.5351.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_ujjayini }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5351.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5351.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

# Dwarka
pilgrimage.5361 = {
	type = character_event
	title = pilgrimage.5361.t
	desc = pilgrimage.5361.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_dvaraka }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5361.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5361.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

	# Buddhism
# Bodh Gaya
pilgrimage.5401 = {
	type = character_event
	title = pilgrimage.5401.t
	desc = pilgrimage.5401.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_gaya }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5401.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5401.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

# Kushinagar
pilgrimage.5411 = {
	type = character_event
	title = pilgrimage.5411.t
	desc = pilgrimage.5411.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_kusinagara }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5411.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5411.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

# Sarnath
pilgrimage.5421 = {
	type = character_event
	title = pilgrimage.5421.t
	desc = pilgrimage.5421.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_varanasi }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5421.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5421.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

	# Jainism
# Shikharj
pilgrimage.5501 = {
	type = character_event
	title = pilgrimage.5501.t
	desc = pilgrimage.5501.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_radha }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5501.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5501.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

	# Zoroastrian
# Ushi-darena
pilgrimage.5601 = {
	type = character_event
	title = pilgrimage.5601.t
	desc = pilgrimage.5601.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_baduspan }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5601.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5601.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

	# Norse Germanic
# Paderborn
pilgrimage.5901 = {
	type = character_event
	title = pilgrimage.5901.t
	desc = pilgrimage.5901.desc
	theme = pilgrimage_activity
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		pilgrimage_is_to = { DESTINATION = c_brunswick }
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
		play_music_cue = "mx_cue_sacredrite"
	}
	
	option = {
		name = pilgrimage.5901.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5901.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

	# Tengri
# Open Blue Skies
pilgrimage.5911 = {
	type = character_event
	title = pilgrimage.5911.t
	desc = pilgrimage.5911.desc
	theme = pilgrimage_activity
	override_background = {
		event_background = terrain_activity
	}
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		exists = scope:activity
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5911.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5911.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

	# Sanctity of Nature
# Sacred Groves
pilgrimage.5921 = {
	type = character_event
	title = pilgrimage.5921.t
	desc = pilgrimage.5921.desc
	theme = pilgrimage_activity
	override_background = {
		event_background = wilderness_forest
	}
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		exists = scope:activity
	}

	immediate = {
		save_holy_site_for_loc_effect = yes
	}
	
	option = {
		name = pilgrimage.5921.a
		trigger = { NOT = { has_trait = cynical } }
		give_pilgrimage_reward_effect = yes
	}
	
	option = {
		name = pilgrimage.5921.b
		trigger = { has_trait = cynical }
		give_pilgrimage_reward_effect = yes
	}

	after = {
		trigger_event = {
			on_action = pilgrimage_return_events
			days = 30
		}
	}
}

################################
# Return Events
# 9001-9999
# by Petter Vilberg
################################
pilgrimage.9001 = {
	type = character_event
	title = pilgrimage.9001.t
	desc = pilgrimage.9001.desc
	left_portrait = root
	theme = pilgrimage_activity
	override_background = {
		event_background = terrain_activity
	}
	override_icon = {
		reference = "gfx/interface/event_window/type_faith.dds"
	}

	trigger = {
		exists = scope:activity
	}
	
	option = {
		name = pilgrimage.9001.a
		scope:activity = {
			complete_activity = yes
		}
	}
}



####################
# Support events
####################
# Fallback in case no journey event fires. That shouldn't be, but just this exists just in case
pilgrimage.9999 = {
	hidden = yes

	trigger = {
		exists = scope:activity # If the Activity has been removed, the chain just dies here
	}

	immediate = {
		set_up_next_pilgrimage_event_effect = {
			DAYS = 10
		}
	}
}