﻿activity_tour = {
	is_shown = {
		highest_held_title_tier > tier_barony
		is_landed = yes
		trigger_if = {
			limit = {
				is_ai = yes
			}
			is_at_war = no
		}
		has_dlc_feature = tours_and_tournaments
		has_dlc_feature = advanced_activities
		NOT = { government_has_flag = government_is_administrative }
		#Every other activity must be blocked until an uncrowned AI crowns themselves
		trigger_if = {
			limit = {
				is_ai = yes
			}
			NOT = {
				has_realm_law = uncrowned
			}
		}
	}

	can_start_showing_failures_only = {
		NOT = { is_activity_type_on_cooldown = activity_tour }
		highest_held_title_tier >= tier_duchy
		is_available = yes
		age >= 12
		custom_tooltip = {
			text = 3_vassals_or_more
			vassal_count >= 3
		}
		custom_tooltip = {
			text = 5_courtiers_or_more
			any_courtier_or_guest = { count >= 5 }
		}
		is_in_civil_war = no
	}

	is_valid = {
		scope:host = {
			is_landed = yes
			NOT = { is_incapable = yes }
			is_in_civil_war = no
		}
	}

	on_invalidated = {
		# Host becomes unlanded
		if = {
			limit = {
				scope:host = { is_landed = no }
			}
			scope:activity = {
				activity_type = { save_scope_as = activity_type }
			}
			every_in_list = {
				variable = tour_vassals_to_visit
				trigger_event = activity_system.0320
			}
		}
		if = {
			limit = {
				scope:host = { is_incapable = yes }
			}
			scope:activity = {
				activity_type = { save_scope_as = activity_type }
			}
			scope:host = {
				trigger_event = activity_system.0330
			}
			every_in_list = {
				variable = tour_vassals_to_visit
				trigger_event = activity_system.0331
			}
		}
		# Clean up character flag preventing visited vassals from starting other activities
		every_in_list = {
			variable = tour_vassals_to_visit
			if = {
				limit = {
					has_character_flag = being_visited_on_tour 
				}
				remove_character_flag = being_visited_on_tour
				trigger_event = {
					id = tour_general.9998
				}
			}
		}
	}

	on_host_death = {
		# Send your entourage home
		scope:host = {
			current_travel_plan = {
				every_entourage_character = {
					set_location_to_default = yes 
				}
			}
			# saving the title for loc
			primary_title = { save_scope_as = host_title }
			# Inform your heir if you have one
			player_heir ?= {
				trigger_event = activity_system.1010
			}
		}
		# Inform all the other attendees
		scope:activity = {
			every_in_list = {
				variable = tour_vassals_to_visit
				limit = {
					this != scope:host.player_heir
				}
				trigger_event = activity_system.1011
			}
		}
	}

	ai_will_do = {
		value = 30
		if = {
			limit = {
				liege = { has_ongoing_grand_activity_trigger = yes }
			}
			desc = "Liege grand activities"
			add = -1000
		}
		if = {
			limit = {
				highest_held_title_tier >= tier_kingdom
				NOT = { has_character_flag = had_tour }
			}
			desc = "I am a king and should go on at least one tour"
			add = 200
		}
		if = {
			limit = {
				highest_held_title_tier >= tier_kingdom
				has_character_flag = had_tour
			}
			desc = "I am a king and have gone on one tour already"
			add = -10
		}
		if = {
			limit = {
				highest_held_title_tier <= tier_duchy
				has_character_flag = had_tour
			}
			desc = "I am a duke and have gone on one tour already"
			add = -30
		}
		if = {
			limit = {
				gold <= major_gold_value
				OR = {
					has_trait = sadistic
					has_trait = arbitrary
					has_trait = greedy
					ai_greed >= 75
				}
				NOR = {
					has_trait = generous
					ai_greed <= -75
				}
			}
			desc = "I am poor and likely to go on a taxation tour!"
			add = 30
		}
		if = {
			limit = {
				ai_has_warlike_personality = yes
				war_chest_gold < war_chest_gold_maximum
			}
			desc = "I am warlike and want to fill my war chest"
			add = 30
		}
		if = {
			limit = {
				ai_has_economical_boom_personality = yes
				gold < major_gold_value
			}
			desc = "I am a builder and want more gold to build building with!"
			add = 30
		}
		if = {
			limit = {
				gold <= major_gold_value
			}
			desc = "I am very poor"
			add = -20
		}
		if = {
			limit = {
				gold <= massive_gold_value
			}
			desc = "I am poor"
			add = -10
		}
		if = {
			limit = {
				any_powerful_vassal = {
					opinion = {
						target = root
						value <= -25
					}
				}
			}
			desc = "Vassals hate me"
			add = 10
		}
		if = {
			limit = {
				any_sub_realm_county = {
					count >= 3
					culture = {
						cultural_acceptance = {
							target = root.culture
							value <= 25
						}
					}
				}
			}
			desc = "Foreign subjects hate me"
			add = 10
		}
		if = {
			limit = {
				any_vassal = {
					count >= 5
				}
			}
			desc = "I have many vassals"
			add = 10
		}
		if = {
			limit = {
				OR = {
					gold >= 1000
					gold >= massive_gold_value
				}
			}
			desc = "I have a lot of money"
			add = 10
		}
		# Plague
		if = {
        	limit = {
        	    any_sub_realm_county = {
        	        has_province_with_epidemic = { intensity < apocalyptic }
        	    }
        	    would_follow_social_distancing_value >= -1
        	}
        	add = {
        	    value = -60
        	    desc = "Plague in Realm"
        	}
    	}
    	if = {
    	    limit = {
    	        any_sub_realm_county = {
    	            has_province_with_epidemic = { intensity = apocalyptic }
    	        }
    	    }
    	    add = {
    	        value = -200
    	        desc = "Apocalyptic Plague in Realm"
    	    }
    	}
    	if = {
    		limit = {
    			government_has_flag = government_is_celestial
    			highest_held_title_tier >= tier_empire
    			is_independent_ruler = yes
    		}
    		add = {
    			value = -500
    			desc = "I have people for that"
    		}
    	}
	}

	ai_check_interval_by_tier = {
		barony = 0
		county = 0
		duchy = 60
		kingdom = 60
		empire = 60
		hegemony = 60
	}

	ai_select_num_provinces = {
		value = 0
		if = {
			limit = {
				highest_held_title_tier <= tier_duchy
			}
			add = {
				value = 3
				desc = "Duchy base value"
			}
		}
		else = {
			add = {
				value = 4
				desc = "King+ base value"
			}
		}
		
		if = {
			limit = {
				gold >= medium_gold_value
			}
			add = {
				value = 1
				desc = "Medium gold +1"
			}
		}
		if = {
			limit = {
				gold >= major_gold_value
			}
			add = {
				value = 2
				desc = "Major gold +2"
			}
		}
		if = {
			limit = {
				OR = {
					gold >= 1000
					gold >= massive_gold_value
				}
			}
			add = {
				value = 5
				desc = "Massive gold +5"
			}
		}
		if = {
			limit = {
				has_variable = conqueror
			}
			add = {
				value = 10
				desc = "Conquerors"
			}
		}
		if = {
			limit = {
				ai_should_focus_on_building_in_their_capital = yes
			}
			add = {
				value = 10
				desc = "Needs gold for focused building"
			}
		}
	}

	ai_will_select_province = {
		value = scope:score
	}

	province_score = {
		value = 0
		# General reasons
		if = {
			limit = {
				scope:host ?= { has_relation_friend = root.county.holder }
			}
			desc = "The host is my friend"
			add = 20
		}
		if = {
			limit = {
				scope:host ?= { has_relation_lover = root.county.holder }
			}
			desc = "The host is my lover"
			add = 20
		}
		if = {
			limit = {
				county.holder ?= { is_ai = no }
			}
			desc = "The host is a player"
			add = 50
		}
		# Tour grounds reasons
		if = {
			limit = {
				county ?= {
					county_control <= 100
				}
			}
			desc = "I do not completely control this province"
			add = 20
		}
		if = {
			limit = {
				county ?= {
					county_control <= 75
				}
			}
			desc = "Control is below average"
			add = 20
		}
		if = {
			limit = {
				county ?= {
					county_control <= 50
				}
			}
			desc = "Control is quite low"
			add = 20
		}
		if = {
			limit = {
				county ?= {
					county_control <= 20
				}
			}
			desc = "Control is catastrophically low"
			add = 20
		}
		if = {
			limit = {
				county ?= {
					county_control <= 5
				}
			}
			desc = "Control is nonexistent"
			add = 20
		}
		# Culture festival reasons
		if = {
			limit = {
				culture != scope:host.culture
			}
			desc = "They're a different culture from me"
			add = 20
		}
		if = {
			limit = {
				culture = {
					cultural_acceptance = {
						target = scope:host.culture
						value <= 25
					}
				}
			}
			desc = "They're a different culture who actively dislike me"
			add = 20
		}
		if = {
			limit = {
				culture = {
					cultural_acceptance = {
						target = scope:host.culture
						value <= 50
					}
				}
			}
			desc = "They're a different culture who are lukewarm to me"
			add = 10
		}
		if = {
			limit = {
				county = { county_opinion < 0 }
			}
			desc = "They have low popular opinion"
			add = 20
		}
		if = {
			limit = {
				county = { county_opinion < -20 }
			}
			desc = "They have very low popular opinion"
			add = 20
		}
		# Hosted dinner reasons
		if = {
			limit = {
				county.holder = { is_powerful_vassal = yes }
			}
			desc = "The host is a powerful vassal"
			add = 50
		}
		if = {
			limit = {
				county.holder = {
					opinion = {
						target = scope:host
						value <= 10
					}
				}
			}
			desc = "The host doesn't like me"
			add = 20
		}
		if = {
			limit = {
				county.holder = {
					opinion = {
						target = scope:host
						value <= -15
					}
				}
			}
			desc = "The host actively dislikes me"
			add = 20
		}
		if = {
			limit = {
				county.holder = {
					opinion = {
						target = scope:host
						value <= -50
					}
				}
			}
			desc = "The host hates me"
			add = 20
		}
		if = {
			limit = {
				county.holder = {
					opinion = {
						target = scope:host
						value <= -75
					}
				}
			}
			desc = "The host really hates me"
			value = 50
		}
	}

	###################
	# PARAMETERS
	###################

	activity_group_type = grand

	province_filter = realm
	is_single_location = no
	planner_type = holder

	is_location_valid = {
		ep2_phase_general_location_checks = yes
	}

	cost = {
		gold = {
			value = 0
			if = {
				limit = {
					has_treasury = no
				}
				add = {
					add = {
						value = 50
						desc = tour_base_cost
					}
					add = {
						value = 50
						multiply = activity_cost_scale_by_era
						subtract = 50
						desc = activity_cost_scale_by_era_desc
					}
					# Some people get one free.
					if = {
						limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
						multiply = 0
					}
					if = {
						limit = {
							confederation ?= { has_cohesion_level_parameter = any_member_activity_cost_reduced }
						}
						multiply = {
							value = 0.9
							desc = CB_COHESION_PARAMETER_DISCOUNT
						}
					}
				}
			}
		}
		treasury = {
			value = 0
			if = {
				limit = {
					has_treasury = yes
				}
				add = {
					add = {
						value = 50
						desc = tour_base_cost
					}
					add = {
						value = 50
						multiply = activity_cost_scale_by_era
						subtract = 50
						desc = activity_cost_scale_by_era_desc
					}
					# Some people get one free.
					if = {
						limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
						multiply = 0
					}
				}
				if = {
					limit = {
						is_ai = yes
						has_game_rule = hard_difficulty
					}
					multiply = 0.5
				}
				else_if = {
					limit = {
						is_ai = yes
						has_game_rule = very_hard_difficulty
					}
					multiply = 0.25
				}
			}
		}
	}

	ui_predicted_cost = {
		gold = {
			value = 0
			if = {
				limit = {
					has_treasury = no
				}
				# Base Cost
				add = {
					value = 50
					# Scale by Era
					multiply = activity_cost_scale_by_era
				}

				# Options 
				# Entourage Option
				add = {
					value = { # Calculate the average of the 3 option costs
						value = 0 
						add = 20 # Small Cost
						add = 60 # Modest Cost
						add = 180 # Grand Cost
						# Divide by total number of option level to get an average option cost
						divide = 3
						# Scale Option costs by era
						multiply = activity_cost_scale_by_era
					}
				}
				# Luxuries Option
				add = {
					value = { # Calculate the average of the 5 option costs
						value = 0 
						add = 20 # No Luxuries Cost
						add = 40 # Essential Luxuries Cost
						add = 60 # Extravagant Luxuries Cost
						add = 120 # Luxurious Furniture Cost
						add = 180 # Extravagant Furniture Cost
						# Divide by total number of option level to get an average option cost
						divide = 5
						# Scale Option costs by era
						multiply = activity_cost_scale_by_era
					}
				}

				# Tour Stops 
				if = {
					limit = { primary_title.tier = tier_empire }
					add = {
						value = 114 # derived from testing 
						multiply = activity_cost_scale_by_era
						multiply = 5 # median number of tour stops (min = 1, max = 10)
					}
				}
				else_if = {
					limit = { primary_title.tier = tier_kingdom }
					add = {
						value = 44 # derived from testing 
						multiply = activity_cost_scale_by_era
						multiply = 5 # median number of tour stops (min = 1, max = 10)
					}
				}
				else_if = {
					limit = { primary_title.tier = tier_duchy }
					add = {
						value = 36 # derived from testing 
						multiply = activity_cost_scale_by_era
						multiply = 5 # median number of tour stops (min = 1, max = 10)
					}
				}
				if = {
					limit = {
						confederation ?= { has_cohesion_level_parameter = any_member_activity_cost_reduced }
					}
					multiply = {
						value = 0.9
						desc = CB_COHESION_PARAMETER_DISCOUNT
					}
				}

				# Some people get one free.
				if = {
					limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
					multiply = 0
				}

				# Make it a multiple of 5 (rounded up)
				divide = 5
				ceiling = yes 
				multiply = 5
			}
		}
		treasury = {
			value = 0
			if = {
				limit = {
					has_treasury = yes
				}
				# Base Cost
				add = {
					value = 50
					# Scale by Era
					multiply = activity_cost_scale_by_era
				}

				# Options 
				# Entourage Option
				add = {
					value = { # Calculate the average of the 3 option costs
						value = 0 
						add = 20 # Small Cost
						add = 60 # Modest Cost
						add = 180 # Grand Cost
						# Divide by total number of option level to get an average option cost
						divide = 3
						# Scale Option costs by era
						multiply = activity_cost_scale_by_era
					}
				}
				# Luxuries Option
				add = {
					value = { # Calculate the average of the 5 option costs
						value = 0 
						add = 20 # No Luxuries Cost
						add = 40 # Essential Luxuries Cost
						add = 60 # Extravagant Luxuries Cost
						add = 120 # Luxurious Furniture Cost
						add = 180 # Extravagant Furniture Cost
						# Divide by total number of option level to get an average option cost
						divide = 5
						# Scale Option costs by era
						multiply = activity_cost_scale_by_era
					}
				}

				# Tour Stops 
				if = {
					limit = { primary_title.tier = tier_empire }
					add = {
						value = 114 # derived from testing 
						multiply = activity_cost_scale_by_era
						multiply = 5 # median number of tour stops (min = 1, max = 10)
					}
				}
				else_if = {
					limit = { primary_title.tier = tier_kingdom }
					add = {
						value = 44 # derived from testing 
						multiply = activity_cost_scale_by_era
						multiply = 5 # median number of tour stops (min = 1, max = 10)
					}
				}
				else_if = {
					limit = { primary_title.tier = tier_duchy }
					add = {
						value = 36 # derived from testing 
						multiply = activity_cost_scale_by_era
						multiply = 5 # median number of tour stops (min = 1, max = 10)
					}
				}

				# Some people get one free.
				if = {
					limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
					multiply = 0
				}

				# Make it a multiple of 5 (rounded up)
				divide = 5
				ceiling = yes 
				multiply = 5
			}
		}
	}

	cooldown = { years = 10 }

	###################
	# OPTIONS
	###################

	options = {
		#Tour types
		special_type = {
			tour_type_majesty = {
				default = yes
				ai_will_do = {
					value = 50
					if = { # Cautious AI's want stability
						limit = {
							OR = {
								ai_has_cautious_personality = yes
								ai_has_pious_builder_personality = yes #Legitimacy, ho!
							}
							war_chest_gold > cautious_ai_minimum_war_chest_gold
						}
						add = 50
					}
					if = {
						limit = {
							OR = {
								has_trait = gregarious
								has_trait = arrogant
								has_trait = arbitrary
								has_trait = brave
								has_trait = just
							}
						}
						add = 50
					}
					if = {
						limit = {
							OR = {
								has_trait = shy
								has_trait = humble
								has_trait = callous
								has_trait = sadistic
							}
						}
						subtract = 50
					}
					if = {
						limit = {
							has_variable = conqueror
							prestige >= 500
						}
						subtract = 500
					}
					if = {
						limit = {
							ai_should_focus_on_building_in_their_capital = yes
						}
						subtract = 500
					}
				}
			}
			tour_type_intimidation = {
				ai_will_do = {
					value = 0
					if = { # Cautious AI's want stability
						limit = {
							ai_has_cautious_personality = yes
							war_chest_gold > cautious_ai_minimum_war_chest_gold
							NOR = {
								has_trait = compassionate
								has_trait = generous
								has_trait = forgiving
							}
						}
						add = 50
					}
					if = {
						limit = {
							OR = {
								has_trait = callous
								has_trait = sadistic
								has_trait = arbitrary
								has_trait = vengeful
								has_trait = torturer
							}
						}
						add = 50
					}
					if = {
						limit = {
							OR = {
								has_trait = just
								has_trait = honest
								has_trait = compassionate
								has_trait = generous
								has_trait = forgiving
							}
						}
						subtract = 50
					}
					if = {
						limit = {
							has_variable = conqueror
						}
						subtract = 500
					}
					if = {
						limit = {
							ai_should_focus_on_building_in_their_capital = yes
						}
						subtract = 500
					}
				}
			}
			tour_type_taxation = {
				is_valid = {
					custom_tooltip = {
						text = CB_TRIBAL_COST
						NOT = {
							government_has_flag = government_is_tribal
						}
					}
				}
				ai_will_do = {
					value = 50
					if = { # Warlike AI's want to fill their coffers
						limit = {
							ai_has_warlike_personality = yes
							war_chest_gold < war_chest_gold_maximum
						}
						add = 50
					}
					if = { # Very appropriate for Builders/Economical Boom personalities
						limit = {
							ai_has_economical_boom_personality = yes
						}
						add = 50
					}
					if = {
						limit = {
							OR = {
								has_trait = sadistic
								has_trait = arbitrary
								has_trait = greedy
								ai_greed >= 75
							}
						}
						add = 50
					}
					if = {
						limit = {
							gold < major_gold_value
						}
						add = 200
					}
					if = {
						limit = {
							OR = {
								has_trait = just
								has_trait = honest
								has_trait = compassionate
								has_trait = generous
								has_trait = forgiving
							}
						}
						subtract = 50
					}
					if = {
						limit = {
							OR = {
								has_trait = generous
								ai_greed <= -75
							}
						}
						subtract = 5000
					}
					if = {
						limit = {
							has_variable = conqueror
						}
						add = 10000
					}
					if = {
						limit = {
							ai_should_focus_on_building_in_their_capital = yes
						}
						add = 10000
					}
				}
			}
		}
		tour_entourage = {
			tour_entourage_small = {
				cost = {
					gold = {
						value = 0
						if = {
							limit = {
								has_treasury = no
							}
							add = {
								desc = tour_entourage_small
								add = {
									value = 20
									desc = tour_entourage_small
								}
								add = {
									value = 20
									multiply = activity_cost_scale_by_era
									subtract = 20
									desc = activity_cost_scale_by_era_desc
								}
								if = {
									limit = {
										has_perk = journey_planner_perk
									}
									multiply = {
										value = voyager_journey_planner_value
										desc = journey_planner_perk_name
									}
								}
								# Some people get one free.
								if = {
									limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
									multiply = 0
								}
							}
						}
					}
					treasury = {
						value = 0
						if = {
							limit = {
								has_treasury = yes
							}
							add = {
								desc = tour_entourage_small
								add = {
									value = 20
									desc = tour_entourage_small
								}
								add = {
									value = 20
									multiply = activity_cost_scale_by_era
									subtract = 20
									desc = activity_cost_scale_by_era_desc
								}
								if = {
									limit = {
										has_perk = journey_planner_perk
									}
									multiply = {
										value = voyager_journey_planner_value
										desc = journey_planner_perk_name
									}
								}
								# Some people get one free.
								if = {
									limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
									multiply = 0
								}
							}
							if = {
								limit = {
									is_ai = yes
									has_game_rule = hard_difficulty
								}
								multiply = 0.5
							}
							else_if = {
								limit = {
									is_ai = yes
									has_game_rule = very_hard_difficulty
								}
								multiply = 0.25
							}
						}
					}
				}
				
				travel_entourage_selection = {
					weight = tour_entourage_weight_value
					max = 5
					invite_rule_order = 1
				}

				ai_will_do = {
					value = 0
					add = { #Base amount
						value = 30
					}
					if = {
						limit = {
							has_trait = greedy
						}
						add = 30
					}
					if = {
						limit = {
							OR = {
								has_trait = lazy
								has_trait = temperate
								has_trait = content
							}
						}
						add = 15
					}
					if = {
						limit = {
							has_trait = humble
						}
						add = 10
					}
					if = {
						limit = {
							gold <= major_gold_value
						}
						add = 100
					}
				}
			}
			tour_entourage_normal = {
				default = yes
				travel_entourage_selection = {
					weight = tour_entourage_weight_value
					max = 10
					invite_rule_order = 1
				}

				on_start = {
					scope:host = {
						add_prestige = medium_prestige_gain
					}
				}
				is_valid = {
					custom_tooltip = {
						text = more_than_5_courtiers
						any_courtier_or_guest = { count > 5 }
					}
				}

				ai_will_do = {
					value = 50
				}

				cost = {
					gold = {
						value = 0
						if = {
							limit = {
								has_treasury = no
							}
							add = {
								desc = tour_entourage_normal
								add = {
									value = 60
									desc = tour_entourage_normal
								}
								add = {
									value = 60
									multiply = activity_cost_scale_by_era
									subtract = 60
									desc = activity_cost_scale_by_era_desc
								}
								if = {
									limit = {
										has_perk = journey_planner_perk
									}
									multiply = {
										value = voyager_journey_planner_value
										desc = journey_planner_perk_name
									}
								}
								# Some people get one free.
								if = {
									limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
									multiply = 0
								}
							}
						}
					}
					treasury = {
						value = 0
						if = {
							limit = {
								has_treasury = yes
							}
							add = {
								desc = tour_entourage_normal
								add = {
									value = 60
									desc = tour_entourage_normal
								}
								add = {
									value = 60
									multiply = activity_cost_scale_by_era
									subtract = 60
									desc = activity_cost_scale_by_era_desc
								}
								if = {
									limit = {
										has_perk = journey_planner_perk
									}
									multiply = {
										value = voyager_journey_planner_value
										desc = journey_planner_perk_name
									}
								}
								# Some people get one free.
								if = {
									limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
									multiply = 0
								}
							}
							if = {
								limit = {
									is_ai = yes
									has_game_rule = hard_difficulty
								}
								multiply = 0.5
							}
							else_if = {
								limit = {
									is_ai = yes
									has_game_rule = very_hard_difficulty
								}
								multiply = 0.25
							}
						}
					}
				}
			}
			tour_entourage_grand = {
				is_valid = {
					custom_tooltip = {
						text = more_than_10_courtiers
						any_courtier_or_guest = { count > 10 }
					}
				}

				travel_entourage_selection = {
					weight = tour_entourage_weight_value
					max = 40
					ai_max = 20
					invite_rule_order = 1
				}

				on_start = {
					scope:host = {
						add_prestige = major_prestige_gain
					}
				}

				ai_will_do = {
					value = 0
					add = { #Base amount
						value = 30
					}
					if = {
						limit = {
							has_trait = generous
						}
						add = 30
					}
					if = {
						limit = {
							OR = {
								has_trait = diligent
								has_trait = gluttonous
								has_trait = ambitious
							}
						}
						add = 15
					}
					if = {
						limit = {
							has_trait = arrogant
						}
						add = 10
					}
				}

				cost = {
					gold = {
						value = 0
						if = {
							limit = {
								has_treasury = no
							}
							add = {
								desc = tour_entourage_grand
								add = {
									value = 180
									desc = tour_entourage_grand
								}
								add = {
									value = 180
									multiply = activity_cost_scale_by_era
									subtract = 180
									desc = activity_cost_scale_by_era_desc
								}
								if = {
									limit = {
										has_perk = journey_planner_perk
									}
									multiply = {
										value = voyager_journey_planner_value
										desc = journey_planner_perk_name
									}
								}
								# Some people get one free.
								if = {
									limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
									multiply = 0
								}
							}
						}
					}
					treasury = {
						value = 0
						if = {
							limit = {
								has_treasury = yes
							}
							add = {
								desc = tour_entourage_grand
								add = {
									value = 180
									desc = tour_entourage_grand
								}
								add = {
									value = 180
									multiply = activity_cost_scale_by_era
									subtract = 180
									desc = activity_cost_scale_by_era_desc
								}
								if = {
									limit = {
										has_perk = journey_planner_perk
									}
									multiply = {
										value = voyager_journey_planner_value
										desc = journey_planner_perk_name
									}
								}
								# Some people get one free.
								if = {
									limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
									multiply = 0
								}
							}
							if = {
								limit = {
									is_ai = yes
									has_game_rule = hard_difficulty
								}
								multiply = 0.5
							}
							else_if = {
								limit = {
									is_ai = yes
									has_game_rule = very_hard_difficulty
								}
								multiply = 0.25
							}
						}
					}
				}
			}
		}
		tour_luxuries = {
			tour_luxuries_bad = {
				cost = {
					gold = {
						value = 0
						if = {
							limit = {
								has_treasury = no
							}
							add = {
								desc = tour_luxuries_bad
								add = {
									value = 20
									desc = tour_luxuries_bad
								} 
								add = {
									value = 20
									multiply = activity_cost_scale_by_era
									subtract = 20
									desc = activity_cost_scale_by_era_desc
								}
								if = {
									limit = {
										has_perk = journey_planner_perk
									}
									multiply = {
										value = voyager_journey_planner_value
										desc = journey_planner_perk_name
									}
								}
								# Some people get one free.
								if = {
									limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
									multiply = 0
								}
							}
						}
					}
					treasury = {
						value = 0
						if = {
							limit = {
								has_treasury = yes
							}
							add = {
								desc = tour_luxuries_bad
								add = {
									value = 20
									desc = tour_luxuries_bad
								} 
								add = {
									value = 20
									multiply = activity_cost_scale_by_era
									subtract = 20
									desc = activity_cost_scale_by_era_desc
								}
								if = {
									limit = {
										has_perk = journey_planner_perk
									}
									multiply = {
										value = voyager_journey_planner_value
										desc = journey_planner_perk_name
									}
								}
								# Some people get one free.
								if = {
									limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
									multiply = 0
								}
							}
							if = {
								limit = {
									is_ai = yes
									has_game_rule = hard_difficulty
								}
								multiply = 0.5
							}
							else_if = {
								limit = {
									is_ai = yes
									has_game_rule = very_hard_difficulty
								}
								multiply = 0.25
							}
						}
					}
				}

				ai_will_do = {
					value = 0
					add = { #Base amount
						value = 30
					}
					if = {
						limit = {
							has_trait = greedy
						}
						add = 30
					}
					if = {
						limit = {
							OR = {
								has_trait = lazy
								has_trait = temperate
								has_trait = content
							}
						}
						add = 15
					}
					if = {
						limit = {
							has_trait = humble
						}
						add = 10
					}
					if = {
						limit = {
							gold <= major_gold_value
						}
						add = 100
					}
				}
			}
			tour_luxuries_normal = {
				default = yes
				cost = {
					gold = {
						value = 0
						if = {
							limit = {
								has_treasury = no
							}
							add = {
								desc = tour_luxuries_normal
								add = {
									value = 40
									desc = tour_luxuries_normal
								}
								add = {
									value = 40
									multiply = activity_cost_scale_by_era
									subtract = 40
									desc = activity_cost_scale_by_era_desc
								}
								if = {
									limit = {
										has_perk = journey_planner_perk
									}
									multiply = {
										value = voyager_journey_planner_value
										desc = journey_planner_perk_name
									}
								}
								# Some people get one free.
								if = {
									limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
									multiply = 0
								}
							}
						}
					}
					treasury = {
						value = 0
						if = {
							limit = {
								has_treasury = yes
							}
							add = {
								desc = tour_luxuries_normal
								add = {
									value = 40
									desc = tour_luxuries_normal
								}
								add = {
									value = 40
									multiply = activity_cost_scale_by_era
									subtract = 40
									desc = activity_cost_scale_by_era_desc
								}
								if = {
									limit = {
										has_perk = journey_planner_perk
									}
									multiply = {
										value = voyager_journey_planner_value
										desc = journey_planner_perk_name
									}
								}
								# Some people get one free.
								if = {
									limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
									multiply = 0
								}
							}
							if = {
								limit = {
									is_ai = yes
									has_game_rule = hard_difficulty
								}
								multiply = 0.5
							}
							else_if = {
								limit = {
									is_ai = yes
									has_game_rule = very_hard_difficulty
								}
								multiply = 0.25
							}
						}
					}
				}

				ai_will_do = {
					value = 0
					add = { #Base amount
						value = 50
					}
				}
			}
			tour_luxuries_good = {
				is_valid = {
					custom_tooltip = {
						text = government_is_tribal_tt
						NOT = { government_has_flag = government_is_tribal }
					}
				}

				on_start = {
					scope:host = {
						add_prestige = 30
					}
				}

				ai_will_do = {
					value = 0
					add = { #Base amount
						value = 30
					}
					if = {
						limit = {
							has_trait = generous
						}
						add = 30
					}
					if = {
						limit = {
							OR = {
								has_trait = diligent
								has_trait = gluttonous
								has_trait = ambitious
							}
						}
						add = 15
					}
					if = {
						limit = {
							has_trait = arrogant
						}
						add = 10
					}
				}

				cost = {
					gold = {
						value = 0
						if = {
							limit = {
								has_treasury = no
							}
							add = {
								desc = tour_luxuries_good
								add = {
									value = 60
									desc = tour_luxuries_good
								}
								add = {
									value = 60
									multiply = activity_cost_scale_by_era
									subtract = 60
									desc = activity_cost_scale_by_era_desc
								}
								if = {
									limit = {
										has_perk = journey_planner_perk
									}
									multiply = {
										value = voyager_journey_planner_value
										desc = journey_planner_perk_name
									}
								}
								# Some people get one free.
								if = {
									limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
									multiply = 0
								}
							}
						}
					}
					treasury = {
						value = 0
						if = {
							limit = {
								has_treasury = yes
							}
							add = {
								desc = tour_luxuries_good
								add = {
									value = 60
									desc = tour_luxuries_good
								}
								add = {
									value = 60
									multiply = activity_cost_scale_by_era
									subtract = 60
									desc = activity_cost_scale_by_era_desc
								}
								if = {
									limit = {
										has_perk = journey_planner_perk
									}
									multiply = {
										value = voyager_journey_planner_value
										desc = journey_planner_perk_name
									}
								}
								# Some people get one free.
								if = {
									limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
									multiply = 0
								}
							}
							if = {
								limit = {
									is_ai = yes
									has_game_rule = hard_difficulty
								}
								multiply = 0.5
							}
							else_if = {
								limit = {
									is_ai = yes
									has_game_rule = very_hard_difficulty
								}
								multiply = 0.25
							}
						}
					}
				}
			}
			tour_furniture_normal = {
				default = yes
				is_valid = {
					custom_tooltip = {
						text = government_is_tribal_tt
						NOT = { government_has_flag = government_is_tribal }
					}
				}

				on_start = {
					scope:host = {
						add_prestige = medium_prestige_gain
					}
				}

				ai_will_do = {
					value = 0
					add = { #Base amount
						value = 50
					}
				}
				cost = {
					gold = {
						value = 0
						if = {
							limit = {
								has_treasury = no
							}
							add = {
								desc = tour_furniture_normal
								add = {
									value = 120
									desc = tour_furniture_normal
								}
								add = {
									value = 120
									multiply = activity_cost_scale_by_era
									subtract = 120
									desc = activity_cost_scale_by_era_desc
								}
								if = {
									limit = {
										has_perk = journey_planner_perk
									}
									multiply = {
										value = voyager_journey_planner_value
										desc = journey_planner_perk_name
									}
								}
								# Some people get one free.
								if = {
									limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
									multiply = 0
								}
							}
						}
					}
					treasury = {
						value = 0
						if = {
							limit = {
								has_treasury = yes
							}
							add = {
								desc = tour_furniture_normal
								add = {
									value = 120
									desc = tour_furniture_normal
								}
								add = {
									value = 120
									multiply = activity_cost_scale_by_era
									subtract = 120
									desc = activity_cost_scale_by_era_desc
								}
								if = {
									limit = {
										has_perk = journey_planner_perk
									}
									multiply = {
										value = voyager_journey_planner_value
										desc = journey_planner_perk_name
									}
								}
								# Some people get one free.
								if = {
									limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
									multiply = 0
								}
							}
							if = {
								limit = {
									is_ai = yes
									has_game_rule = hard_difficulty
								}
								multiply = 0.5
							}
							else_if = {
								limit = {
									is_ai = yes
									has_game_rule = very_hard_difficulty
								}
								multiply = 0.25
							}
						}
					}
				}
			}
			tour_furniture_good = {
				is_valid = {
					custom_tooltip = {
						text = government_is_tribal_tt
						NOT = { government_has_flag = government_is_tribal }
					}
				}

				on_start = {
					scope:host = {
						add_prestige = major_prestige_gain
					}
				}

				ai_will_do = {
					value = 0
					add = { #Base amount
						value = 30
					}
					if = {
						limit = {
							has_trait = ambitious
						}
						add = 15
					}
					if = {
						limit = {
							has_trait = arrogant
						}
						add = 10
					}
				}

				cost = {
					gold = {
						value = 0
						if = {
							limit = {
								has_treasury = no
							}
							add = {
								desc = tour_furniture_good
								add = {
									value = 180
									desc = tour_furniture_good
								}
								add = {
									value = 180
									multiply = activity_cost_scale_by_era
									subtract = 180
									desc = activity_cost_scale_by_era_desc
								}
								if = {
									limit = {
										has_perk = journey_planner_perk
									}
									multiply = {
										value = voyager_journey_planner_value
										desc = journey_planner_perk_name
									}
								}
								# Some people get one free.
								if = {
									limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
									multiply = 0
								}
							}
						}
					}
					treasury = {
						value = 0
						if = {
							limit = {
								has_treasury = yes
							}
							add = {
								desc = tour_furniture_good
								add = {
									value = 180
									desc = tour_furniture_good
								}
								add = {
									value = 180
									multiply = activity_cost_scale_by_era
									subtract = 180
									desc = activity_cost_scale_by_era_desc
								}
								if = {
									limit = {
										has_perk = journey_planner_perk
									}
									multiply = {
										value = voyager_journey_planner_value
										desc = journey_planner_perk_name
									}
								}
								# Some people get one free.
								if = {
									limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
									multiply = 0
								}
							}
							if = {
								limit = {
									is_ai = yes
									has_game_rule = hard_difficulty
								}
								multiply = 0.5
							}
							else_if = {
								limit = {
									is_ai = yes
									has_game_rule = very_hard_difficulty
								}
								multiply = 0.25
							}
						}
					}
				}
			}
		}
	}
	
	special_option_category = special_type

	###################
	# PHASES
	###################

	phases = {
		# tour the grounds
		tour_phase_tour_grounds = {
			order = 1
		
			number_of_picks = 10

			# desc is only shown in debug AI watch window
			ai_will_do = {
				value = 0
				add = scope:province.county.development_level
				if = {
					limit = {
						scope:province.county = { county_control <= 100 }
					}
					desc = "I do not completely control this province"
					add = 20
				}
				if = {
					limit = {
						scope:province.county = { county_control <= 75 }
					}
					desc = "Control is below average"
					add = 20
				}
				if = {
					limit = {
						scope:province.county = { county_control <= 50 }
					}
					desc = "Control is quite low"
					add = 20
				}
				if = {
					limit = {
						scope:province.county = { county_control <= 20 }
					}
					desc = "Control is catastrophically low"
					add = 20
				}
				if = {
					limit = {
						scope:province.county = { county_control <= 5 }
					}
					desc = "Control is nonexistent"
					add = 20
				}
			}

			is_shown = {
			
			}

			# Is this phase valid to execute for this ongoing activity
			# root = the activity
			# scope:host = activity host
			# scope:province = current phase location
			is_valid = {
				ep2_tour_phase_invalidation_check = yes
			}

			# Run if this phase is invalidated by its is_valid trigger 
			# root = character in this phase
			# scope:activity = the activity
			# scope:host = host of the activity
			# scope:province = current phase location
			on_invalidated = {
				scope:province.province_owner = { save_scope_as = stop_host_scope }
				scope:province = { save_scope_as = tour_location }
				if = {
					limit = {
						this = scope:host
					}
					trigger_event = {
						id = tour_general.0500
					}
				}
				if = {
					limit = {
						# If I just inherited this title, don't send me two letter events
						this != scope:host
						# Send it to the province owner
						this = scope:province.province_owner
					}
					if = {
						limit = { has_character_flag = being_visited_on_tour }
						remove_character_flag = being_visited_on_tour
					}
					trigger_event = {
						id = tour_general.9998
					}
				}
				if = {
					limit = {
						scope:activity = { exists = var:months_of_stop }
					}
					remove_variable = months_of_stop
				}
				# Achievements.
				process_tour_achievement_tallies_effect = yes
				if = {
					limit = {
						this = scope:host
					}
					remove_variable = having_end_event
				}
			}

			cost = {
				gold = {
					value = 0
					if = {
						limit = {
							has_treasury = no
						}
						add = {
							value = tour_stop_value
							desc = tour_phase_tour_grounds_cost_desc
						}
						# Some people get one free.
						if = {
							limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
							multiply = 0
						}
					}
				}
				treasury = {
					value = 0
					if = {
						limit = {
							has_treasury = yes
						}
						add = {
							value = tour_stop_value
							desc = tour_phase_tour_grounds_cost_desc
						}
						# Some people get one free.
						if = {
							limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
							multiply = 0
						}
					}
					if = {
						limit = {
							is_ai = yes
							has_game_rule = hard_difficulty
						}
						multiply = 0.5
					}
					else_if = {
						limit = {
							is_ai = yes
							has_game_rule = very_hard_difficulty
						}
						multiply = 0.25
					}
				}
			}

			on_phase_active = {
				if = {
					limit = { this = scope:host }
					scope:activity = {
						tour_stop_host_effect = yes
						add_activity_log_entry = {
							key = tour_stop_tour_grounds_log
							character = scope:host
							target = scope:stop_host_scope
							score = 50
							show_in_conclusion = yes
						}
					}
					scope:activity.var:stop_host = {
						trigger_event = tour_general.0001 #event to see tell you that your liege is about to arrive, turn them away? - vassal
					}
					# Achievements.
					process_tour_achievement_tallies_effect = yes
					#fires hostage reunion event, if hostage giver is also present
					scope:activity = {
						every_attending_character = {
							limit = {
								is_hostage_warden = yes
								has_bp2_dlc_trigger = yes
							}
							trigger_event = {
								id = bp2_yearly.6120
								days = 2
							}
						}
					}
				}
			}

			on_monthly_pulse = {
				if = {
					limit = {
						this = scope:host
					}
					scope:activity = {
						if = { # Migrate the heir to the tour activity
							limit = {
								OR = {
									NOT = { exists = var:stop_host }
									var:stop_host = { is_alive = no }
									NOT = { activity_location.county.holder = var:stop_host }
								}
							}
							remove_variable = stop_host
							tour_stop_host_effect = yes
							add_to_variable_list = {
								name = tour_vassals_to_visit
								target = var:stop_host
							}
						}
					}
					tour_progress_effect = yes
				}
				scope:host.location.barony = {
					save_scope_as = touring_grounds_scope
				}
				tour_monthly_pulse_effect = {
					ON_ACTION_POOL = on_tour_grounds
				}
			}

			on_end = {
				if = {
					limit = {
						this = scope:host
					}
					remove_variable = having_end_event
				}
			}
		}
		# Attend a Dinner
		tour_phase_dinner = {
			order = 1
		
			number_of_picks = 10
			
			# desc is only shown in debug AI watch window
			ai_will_do = {
				value = 0
				if = {
					limit = {
						scope:province.county.holder = { is_powerful_vassal = yes }
					}
					desc = "The host is a powerful vassal"
					add = 50
				}
				if = {
					limit = {
						scope:province.county.holder = {
							opinion = {
								target = scope:province.county.holder.liege
								value <= 10
							}
						}
					}
					desc = "The host doesn't like me"
					add = 20
				}
				if = {
					limit = {
						scope:province.county.holder = {
							opinion = {
								target = scope:province.county.holder.liege
								value <= -15
							}
						}
					}
					desc = "The host actively dislikes me"
					add = 20
				}
				if = {
					limit = {
						scope:province.county.holder = {
							opinion = {
								target = scope:province.county.holder.liege
								value <= -50
							}
						}
					}
					desc = "The host hates me"
					add = 20
				}
				if = {
					limit = {
						scope:province.county.holder = {
							opinion = {
								target = scope:province.county.holder.liege
								value <= -75
							}
						}
					}
					desc = "The host really hates me"
					add = 50
				}
			}

			is_shown = {
			
			}

			can_pick = {
				#scope:province.province_owner = { is_adult = yes } Commenting out for now since there's been an event audit, we'll see if issues prop up
				scope:province.province_owner = { age >= 12 }
			}

			# Is this phase valid to execute for this ongoing activity
			# root = the activity
			# scope:host = activity host
			# scope:province = current phase location
			is_valid = {
				ep2_tour_phase_invalidation_check = yes
				#scope:province.province_owner = { is_adult = yes }
				scope:province.province_owner = { age >= 12 }
			}

			# Run if this phase is invalidated by its is_valid trigger 
			# root = character in this phase
			# scope:activity = the activity
			# scope:host = host of the activity
			# scope:province = current phase location
			on_invalidated = {
				scope:province.province_owner = { save_scope_as = stop_host_scope }
				scope:province = { save_scope_as = tour_location }
				if = {
					limit = {
						this = scope:host
					}
					trigger_event = {
						id = tour_general.0500
					}
				}
				if = {
					limit = {
						# If I just inherited this title, don't send me two letter events
						this != scope:host
						# Send it to the province owner
						this = scope:province.province_owner
					}
					if = {
						limit = { has_character_flag = being_visited_on_tour }
						remove_character_flag = being_visited_on_tour
					}
					trigger_event = {
						id = tour_general.9998
					}
				}
				if = {
					limit = {
						scope:activity = { exists = var:months_of_stop }
					}
					remove_variable = months_of_stop
				}
				# Achievements.
				process_tour_achievement_tallies_effect = yes
				if = {
					limit = {
						this = scope:host
					}
					remove_variable = having_end_event
				}
			}

			cost = {
				gold = {
					value = 0
					if = {
						limit = {
							has_treasury = no
						}
						add = {
							value = tour_stop_value
							desc = tour_phase_dinner_cost_desc
						}
						# Some people get one free.
						if = {
							limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
							multiply = 0
						}
					}
				}
				treasury = {
					value = 0
					if = {
						limit = {
							has_treasury = yes
						}
						add = {
							value = tour_stop_value
							desc = tour_phase_dinner_cost_desc
						}
						# Some people get one free.
						if = {
							limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
							multiply = 0
						}
					}
					if = {
						limit = {
							is_ai = yes
							has_game_rule = hard_difficulty
						}
						multiply = 0.5
					}
					else_if = {
						limit = {
							is_ai = yes
							has_game_rule = very_hard_difficulty
						}
						multiply = 0.25
					}
				}
			}

			on_phase_active = {
				if = {
					limit = { this = scope:host }
					scope:activity = {
						tour_stop_host_effect = yes
						add_activity_log_entry = {
							key = tour_stop_dinner_log
							character = scope:host
							target = scope:stop_host_scope
							score = 50
							show_in_conclusion = yes
						}
					}
					scope:activity.var:stop_host = {
						trigger_event = tour_general.0001 #event to see tell you that your liege is about to arrive, turn them away? - vassal
						}
					# Achievements.
					process_tour_achievement_tallies_effect = yes
					#fires hostage reunion event, if hostage giver is also present
					scope:activity = {
						every_attending_character = {
							limit = {
								is_hostage_warden = yes
								has_bp2_dlc_trigger = yes
							}
							trigger_event = {
								id = bp2_yearly.6120
								days = 2
							}
						}
					}
				}
			}

			on_monthly_pulse = {
				if = {
					limit = {
						this = scope:host
					}
					scope:activity = {
						if = { # Migrate the heir to the tour activity
							limit = {
								OR = {
									NOT = { exists = var:stop_host }
									var:stop_host = { is_alive = no }
									NOT = { activity_location.county.holder = var:stop_host }
								}
							}
							remove_variable = stop_host
							tour_stop_host_effect = yes
							add_to_variable_list = {
								name = tour_vassals_to_visit
								target = var:stop_host
							}
						}
					}
					tour_progress_effect = yes
				}
				tour_monthly_pulse_effect = {
					ON_ACTION_POOL = on_tour_dinner
				}
			}

			on_end = {
				if = {
					limit = {
						this = scope:host
					}
					remove_variable = having_end_event
				}
			}
		}
		# Observe a Cultural Festival
		tour_phase_cultural_festival = {
			order = 1
		
			number_of_picks = 10
			
			# desc is only shown in debug AI watch window
			ai_will_do = {
				value = 0
				if = {
					limit = {
						scope:province.culture != root.culture
					}
					desc = "They're a different culture from me"
					add = 20
				}
				if = {
					limit = {
						scope:province.culture = {
							cultural_acceptance = {
								target = root.culture
								value <= 25
							}
						}
					}
					desc = "They're a different culture who actively dislike me"
					add = 20
				}
				if = {
					limit = {
						scope:province.culture = {
							cultural_acceptance = {
								target = root.culture
								value <= 50
							}
						}
					}
					desc = "They're a different culture who are lukewarm to me"
					add = 10
				}
				if = {
					limit = {
						scope:province.county = { county_opinion < 0 }
					}
					desc = "They have low popular opinion"
					add = 20
				}
				if = {
					limit = {
						scope:province.county = { county_opinion < -20 }
					}
					desc = "They have very low popular opinion"
					add = 20
				}
			}

			is_shown = {
			
			}

			# Is this phase valid to execute for this ongoing activity
			# root = the activity
			# scope:host = activity host
			# scope:province = current phase location
			is_valid = {
				ep2_tour_phase_invalidation_check = yes
			}

			# Run if this phase is invalidated by its is_valid trigger 
			# root = character in this phase
			# scope:activity = the activity
			# scope:host = host of the activity
			# scope:province = current phase location
			on_invalidated = {
				scope:province.province_owner = { save_scope_as = stop_host_scope }
				scope:province = { save_scope_as = tour_location }
				if = {
					limit = {
						this = scope:host
					}
					trigger_event = {
						id = tour_general.0500
					}
				}
				if = {
					limit = {
						# If I just inherited this title, don't send me two letter events
						this != scope:host
						# Send it to the province owner
						this = scope:province.province_owner
					}
					if = {
						limit = { has_character_flag = being_visited_on_tour }
						remove_character_flag = being_visited_on_tour
					}
					trigger_event = {
						id = tour_general.9998
					}
				}
				if = {
					limit = {
						scope:activity = { exists = var:months_of_stop }
					}
					remove_variable = months_of_stop
				}
				# Achievements.
				process_tour_achievement_tallies_effect = yes
				if = {
					limit = {
						this = scope:host
					}
					remove_variable = having_end_event
				}
			}
			
			cost = {
				gold = {
					value = 0
					if = {
						limit = {
							has_treasury = no
						}
						add = {
							value = tour_stop_value
							desc = tour_phase_cultural_festival_cost_desc
						}
						# Some people get one free.
						if = {
							limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
							multiply = 0
						}
					}
				}
				treasury = {
					value = 0
					if = {
						limit = {
							has_treasury = yes
						}
						add = {
							value = tour_stop_value
							desc = tour_phase_cultural_festival_cost_desc
						}
						# Some people get one free.
						if = {
							limit = { factor_zero_if_entitled_to_freebie_activity_trigger = yes }
							multiply = 0
						}
					}
					if = {
						limit = {
							is_ai = yes
							has_game_rule = hard_difficulty
						}
						multiply = 0.5
					}
					else_if = {
						limit = {
							is_ai = yes
							has_game_rule = very_hard_difficulty
						}
						multiply = 0.25
					}
				}
			}

			on_phase_active = {
				if = {
					limit = { this = scope:host }
					scope:activity = {
						tour_stop_host_effect = yes
						add_activity_log_entry = {
							key = tour_stop_cultural_festival_log
							character = scope:host
							target = scope:stop_host_scope
							score = 50
							show_in_conclusion = yes
						}
					}
					scope:activity.var:stop_host = {
						trigger_event = tour_general.0001 #event to see tell you that your liege is about to arrive, turn them away? - vassal
					}
					# Achievements.
					process_tour_achievement_tallies_effect = yes
					#fires hostage reunion event, if hostage giver is also present
					scope:activity = {
						every_attending_character = {
							limit = {
								is_hostage_warden = yes
								has_bp2_dlc_trigger = yes
							}
							trigger_event = {
								id = bp2_yearly.6120
								days = 2
							}
						}
					}
				}
			}

			on_monthly_pulse = {
				if = {
					limit = {
						this = scope:host
					}
					scope:activity = {
						if = { # Migrate the heir to the tour activity
							limit = {
								OR = {
									NOT = { exists = var:stop_host }
									var:stop_host = { is_alive = no }
									NOT = { activity_location.county.holder = var:stop_host }
								}
							}
							remove_variable = stop_host
							tour_stop_host_effect = yes
							add_to_variable_list = {
								name = tour_vassals_to_visit
								target = var:stop_host
							}
						}
					}
					tour_progress_effect = yes
				}
				scope:host.location.county = { #remember in events that this is a county scope
					save_scope_as = cultural_festival_scope
				}
				tour_monthly_pulse_effect = {
					ON_ACTION_POOL = on_tour_festival
				}
			}

			on_end = {
				if = {
					limit = {
						this = scope:host
					}
					remove_variable = having_end_event
				}
			}
		}
		# Go home
		tour_phase_journey_home = {
			# No effects, exists entirely as a buffer between the final parting demand and the tour conclusion event
			is_predefined = yes
			order = 2

			select_scripted_location = { # Every tour should end where it began
				root.capital_province = { save_scope_as = province }
			}

			# Once you arrive we instantly end this phase since now you are home and happy
			on_phase_active = {
				if = {
					limit = { this = scope:host }
					# Run conclusion stuff here
					set_variable = {
						name = tour_success_var
						value = scope:activity.var:tour_success_var
					}
					disburse_tour_activity_rewards = yes
					scope:activity = { progress_activity_phase_after = { days = 1 } }
				}
			}

			location_source = scripted
		}
	}

	num_pickable_phases = 10

	max_pickable_phases_per_province = 1

	max_guest_arrival_delay_time = { months = 1 } # Note: The tour stops' rulers are not guests

	###################
	# GUEST HANDLING
	###################

	max_guests = 100

	host_intents = {
		intents = {
			reduce_stress_intent
			lechery_intent
			altruism_intent
			justice_intent
			spread_legend_intent
			legitimacy_intent
		}
		default = justice_intent
	}

	guest_intents = {
		intents = { reduce_stress_intent }
		default = reduce_stress_intent
	}

	guest_join_chance = {
		base = 10
		base_activity_modifier = yes

		# Scripted Modifiers
		activity_guest_shared_ai_accept_modifier = yes 
	}

	travel_entourage_selection = {
		weight = standard_travel_entourage_additions
		max = 10
		invite_rule_order = 1
	}

	###################
	# ACTIVITY-SPECIFIC PULSES
	###################

	pulse_actions = {
		entries = {
			courtiers_became_lovers courtier_friendship
			courtier_improved_skill courtier_learned_language
			courtiers_got_into_fight courtiers_became_rivals
			
			liege_intimidated_courtier
			
			liege_visited_benevolence liege_local_benevolence increased_control
			
			liege_local_tax levied_tax local_mayor_tax tax_rich_local church_tax local_baron_tax
		}
		chance_of_no_event = 5
	}

	# Need to fire an activity welcome event when the first active phase starts
	on_start = {
		# Activity count debugging
			#if = { 
			#	limit = {
			#		debug_only = yes
			#	}
			#	if = {
			#		limit = {
			#			NOT = {
			#				exists = global_var:tour_count
			#			}
			#		}
			#		set_global_variable = {
			#			name = tour_count
			#			value = 1
			#		}
			#	}
			#	else = {
			#		change_global_variable = {
			#			name = tour_count
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host = { highest_held_title_tier = tier_county }
			#			NOT = {
			#				exists = global_var:tour_c
			#			}
			#		}
			#		set_global_variable = {
			#			name = tour_c
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host = { highest_held_title_tier = tier_county }
			#		}
			#		change_global_variable = {
			#			name = tour_c
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host = { highest_held_title_tier = tier_duchy }
			#			NOT = {
			#				exists = global_var:tour_d
			#			}
			#		}
			#		set_global_variable = {
			#			name = tour_d
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host = { highest_held_title_tier = tier_duchy }
			#		}
			#		change_global_variable = {
			#			name = tour_d
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host = { highest_held_title_tier = tier_kingdom }
			#			NOT = {
			#				exists = global_var:tour_k
			#			}
			#		}
			#		set_global_variable = {
			#			name = tour_k
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host = { highest_held_title_tier = tier_kingdom }
			#		}
			#		change_global_variable = {
			#			name = tour_k
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host = { highest_held_title_tier = tier_empire }
			#			NOT = {
			#				exists = global_var:tour_e
			#			}
			#		}
			#		set_global_variable = {
			#			name = tour_e
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host = { highest_held_title_tier = tier_empire }
			#		}
			#		change_global_variable = {
			#			name = tour_e
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_middle_east }
			#			NOT = {
			#				exists = global_var:tour_world_middle_east
			#			}
			#		}
			#		set_global_variable = {
			#			name = tour_world_middle_east
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_middle_east }
			#		}
			#		change_global_variable = {
			#			name = tour_world_middle_east
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_europe }
			#			NOT = {
			#				exists = global_var:tour_world_europe
			#			}
			#		}
			#		set_global_variable = {
			#			name = tour_world_europe
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_europe }
			#		}
			#		change_global_variable = {
			#			name = tour_world_europe
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_steppe }
			#			NOT = {
			#				exists = global_var:tour_world_steppe
			#			}
			#		}
			#		set_global_variable = {
			#			name = tour_world_steppe
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_steppe }
			#		}
			#		change_global_variable = {
			#			name = tour_world_steppe
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_africa }
			#			NOT = {
			#				exists = global_var:tour_world_africa
			#			}
			#		}
			#		set_global_variable = {
			#			name = tour_world_africa
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_africa }
			#		}
			#		change_global_variable = {
			#			name = tour_world_africa
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_india }
			#			NOT = {
			#				exists = global_var:tour_world_india
			#			}
			#		}
			#		set_global_variable = {
			#			name = tour_world_india
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_india }
			#		}
			#		change_global_variable = {
			#			name = tour_world_india
			#			add = 1
			#		}
			#	}
			#}
		set_variable = {
			name = tour_success_var
			value = 0
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = tour_luxuries
						option = tour_luxuries_bad
					}
				}
			}
			change_variable = {
				name = tour_success_var
				add = 5
			}
		}
		else_if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = tour_luxuries
						option = tour_luxuries_normal
					}
				}
			}
			change_variable = {
				name = tour_success_var
				add = 10
			}
		}
		else_if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = tour_luxuries
						option = tour_luxuries_good
					}
				}
			}
			change_variable = {
				name = tour_success_var
				add = 15
			}
		}
		else_if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = tour_luxuries
						option = tour_furniture_normal
					}
				}
			}
			change_variable = {
				name = tour_success_var
				add = 20
			}
		}
		else_if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = tour_luxuries
						option = tour_furniture_good
					}
				}
			}
			change_variable = {
				name = tour_success_var
				add = 25
			}
		}

		# Creates a list of every vassal you plan to visit and sets a character flag on them so they are unavailable and cannot plan activities/travel
		every_activity_phase_location = {
			limit = {
				NOT = { # Don't tell yourself that you're coming to visit
					county.holder = scope:host
				}
			}
			scope:activity = {
				# Using a variable list saved on the activity so we can reference it elsewhere, like for removing the character flag upon invalidation or completion
				add_to_variable_list = {
					name = tour_vassals_to_visit
					target = prev.county.holder
				}
			}
		}
		every_in_list = {
			variable = tour_vassals_to_visit
			add_character_flag = being_visited_on_tour
			# Send them an event to let them know they will be visited by their liege on tour
			trigger_event = {
				id = tour_general.9999
				days = 1 # delay so we can test that the event is firing correctly
			}
		}
		# Add activity logs / Type is secret to the guests
		scope:host = {
			add_character_flag = had_tour
			if = {
				limit = {
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = tour_type_majesty
						}
					}
				}
				scope:activity = {
					add_activity_log_entry = {
						key = tour_start_majesty_log
						character = scope:host
						score = 10
					}
				}
			}
			else_if = {
				limit = {
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = tour_type_intimidation
						}
					}
				}
				scope:activity = {
					add_activity_log_entry = {
						key = tour_start_intimidation_log
						character = scope:host
						score = 10
					}
				}
			}
			else = { #Taxation
				scope:activity = {
					add_activity_log_entry = {
						key = tour_start_taxation_log
						character = scope:host
						score = 10
					}
				}
			}
		}
	}

	# Effects run when a character enters a passive state after travel
	# root = character in this phase
	# scope:activity = the activity
	# scope:host = host of the activity
	on_enter_passive_state = {
		#If you arrive early we just start early
		if = {
			limit = {
				root = scope:host
			}
			scope:activity = { progress_activity_phase_after = { days = 1 } }
		}
	}

	on_enter_active_state = {
		surveyor_no_stone_unturned_perk_effect = yes
	}

	# Effects run when the activity completes after its last phase
	# root = character in this phase
	# scope:activity = the activity
	# scope:host = host of the activity
	on_complete = {
		# Clean up character flag preventing visited vassals from starting other activities
		if = {
			limit = {
				scope:host = this
			}
			scope:activity = {
				every_in_list = {
					variable = tour_vassals_to_visit
					if = {
						limit = {
							has_character_flag = being_visited_on_tour
						}
						remove_character_flag = being_visited_on_tour
					}
				}
			}
		}
		# Dynasty Legacy
		if = {
			limit = {
				this = scope:host
				dynasty ?= { has_dynasty_perk = ep2_activities_legacy_3 }
			}
			# Apply our new modifiers.
			## Majesty.
			if = {
				limit = {
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = tour_type_majesty
						}
					}
				}
				add_character_modifier = {
					modifier = ep2_activities_legacy_3_tours_majesty_modifier
					years = ep2_activities_legacy_3_tours_modifier_duration_value
				}
				# Do we need to refresh the other modifiers?
				hidden_effect = {
					# Intimidation.
					if = {
						limit = { has_character_modifier = ep2_activities_legacy_3_tours_intimidation_modifier }
						add_character_modifier = {
							modifier = ep2_activities_legacy_3_tours_intimidation_modifier
							years = ep2_activities_legacy_3_tours_modifier_duration_value
						}
					}
					# Taxation.
					if = {
						limit = { has_character_modifier = ep2_activities_legacy_3_tours_taxation_modifier }
						add_character_modifier = {
							modifier = ep2_activities_legacy_3_tours_taxation_modifier
							years = ep2_activities_legacy_3_tours_modifier_duration_value
						}
					}
				}
			}
			## Intimidation.
			if = {
				limit = {
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = tour_type_intimidation
						}
					}
				}
				add_character_modifier = {
					modifier = ep2_activities_legacy_3_tours_intimidation_modifier
					years = ep2_activities_legacy_3_tours_modifier_duration_value
				}
				# Do we need to refresh the other modifiers?
				hidden_effect = {
					# Majesty.
					if = {
						limit = { has_character_modifier = ep2_activities_legacy_3_tours_majesty_modifier }
						add_character_modifier = {
							modifier = ep2_activities_legacy_3_tours_majesty_modifier
							years = ep2_activities_legacy_3_tours_modifier_duration_value
						}
					}
					# Taxation.
					if = {
						limit = { has_character_modifier = ep2_activities_legacy_3_tours_taxation_modifier }
						add_character_modifier = {
							modifier = ep2_activities_legacy_3_tours_taxation_modifier
							years = ep2_activities_legacy_3_tours_modifier_duration_value
						}
					}
				}
			}
			## Taxation.
			if = {
				limit = {
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = tour_type_taxation
						}
					}
				}
				add_character_modifier = {
					modifier = ep2_activities_legacy_3_tours_taxation_modifier
					years = ep2_activities_legacy_3_tours_modifier_duration_value
				}
				# Do we need to refresh the other modifiers?
				hidden_effect = {
					# Majesty.
					if = {
						limit = { has_character_modifier = ep2_activities_legacy_3_tours_majesty_modifier }
						add_character_modifier = {
							modifier = ep2_activities_legacy_3_tours_majesty_modifier
							years = ep2_activities_legacy_3_tours_modifier_duration_value
						}
					}
					# Intimidation.
					if = {
						limit = { has_character_modifier = ep2_activities_legacy_3_tours_intimidation_modifier }
						add_character_modifier = {
							modifier = ep2_activities_legacy_3_tours_intimidation_modifier
							years = ep2_activities_legacy_3_tours_modifier_duration_value
						}
					}
				}
			}
		}
		host_has_taken_freebie_activity_effect = yes

		# Achievements.
		if = {
			limit = {
				scope:host = this
			}
			scope:host = {
				if = {
					limit = {
						highest_held_title_tier >= tier_empire
						scope:activity = {
							has_variable_list = imperial_march_achievement_list
							variable_list_size = {
								name = imperial_march_achievement_list
								value >= achievement_imperial_march_achievement_powerful_vassal_tally_value
							}
						}
					}
					set_global_variable = {
						name = finished_imperial_march_achievement
						value = yes
					}
				}
				if = {
					limit = {
						scope:activity = {
							has_variable_list = the_grandest_tour_achievement_tally_list
							variable_list_size = {
								name = the_grandest_tour_achievement_tally_list
								value >= 10
							}
						}
					}
					set_global_variable = {
						name = finished_the_grandest_tour_achievement
						value = yes
					}
				}
			}
		}
	}

	### Graphics
	map_entity = {
		trigger = {
			activity_location.culture = {
				OR = {
					has_graphical_iranian_culture_group_trigger = yes
					has_graphical_mena_culture_group_trigger = yes
					has_graphical_steppe_culture_group_trigger = yes
					has_graphical_african_culture_group_trigger = yes
				}
			}
		}
		reference = "building_mena_feast_01_entity"
	}

	map_entity = {
		trigger = {
			activity_location.culture = {
				has_graphical_india_culture_group_trigger = yes
			}
		}
		reference = "building_indian_feast_01_entity"
	}
	
	map_entity = "building_western_feast_01_entity"

	# Travel
	background = { # Bridge
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				is_riverside_province = yes
				geographical_region = world_europe
				OR = {
					terrain = farmlands
					terrain = plains
					terrain = mountains
					terrain = hills
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_travel_bridge.dds"
		environment = "environment_travel_bridge"
		ambience = "event:/SFX/Events/Backgrounds/mountains_day"
	}
	
	background = { # Farmland, settled
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				terrain = farmlands
				exists = province_owner
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_travel_farm.dds"
		environment = "environment_travel_farmlands"
		ambience = "event:/SFX/Events/Backgrounds/fields_farms_day"
	}
	background = { # Farmland, unsettled
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				terrain = farmlands
				NOT = { exists = province_owner }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/farms.dds"
		environment = "environment_event_farms"
		ambience = "event:/SFX/Events/Backgrounds/fields_farms_day"
	}

	background = { #Desert, settled
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				graphical_wilderness_desert_trigger = yes
				exists = province_owner
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_travel_desert.dds"
		environment = "environment_travel_desert"
		ambience = "event:/SFX/Events/Backgrounds/desert_day"
	}
	background = { #Desert, unsettled
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				graphical_wilderness_desert_trigger = yes
				NOT = { exists = province_owner }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/desert.dds"
		environment = "environment_event_bp1_desert"
		ambience = "event:/SFX/Events/Backgrounds/desert_day"
	}

	background = { #forest snowy
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location ?= { hunt_snowy_forest_trigger = yes }
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_hunt_snowy_forest.dds"
		environment = "environment_hunt_snowy_forest"
		ambience = "event:/SFX/Events/Backgrounds/mountains_day"
	}

	background = { #forest_pine
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				graphical_wilderness_forest_pine_trigger = yes
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/forest_pine.dds"
		environment = "environment_event_forest_pine"
		ambience = "event:/SFX/Events/Backgrounds/coniferous_forest_day"
	}

	background = { #forest
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				graphical_wilderness_forest_trigger = yes
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/forest.dds"
		environment = "environment_event_forest"
		ambience = "event:/SFX/Events/Backgrounds/deciduous_forest_day"
	}

	background = { #mountains, settled
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				graphical_wilderness_mountains_trigger = yes
				exists = province_owner
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_travel_mountains.dds"
		environment = "environment_travel_mountain_settlement"
		ambience = "event:/SFX/Events/Backgrounds/mountains_day"
	}
	background = { #mountains, unsettled
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				graphical_wilderness_mountains_trigger = yes
				NOT = { exists = province_owner }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/mountains.dds"
		environment = "environment_event_mountains"
		ambience = "event:/SFX/Events/Backgrounds/mountains_day"
	}

	background = { #steppe, settled
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				graphical_wilderness_steppe_trigger = yes
				exists = province_owner
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_travel_steppe.dds"
		environment = "environment_travel_steppe_settlement"
		ambience = "event:/SFX/Events/Backgrounds/steppe_day"
	}
	background = { #steppe, unsettled
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				graphical_wilderness_steppe_trigger = yes
				NOT = { exists = province_owner }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/steppe.dds"
		environment = "environment_event_steppe"
		ambience = "event:/SFX/Events/Backgrounds/steppe_day"
	}

	background = { #drylands (formerly desert)
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				graphical_drylands_trigger = yes
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/drylands.dds"
		environment = "environment_event_desert"
		ambience = "event:/SFX/Events/Backgrounds/desert_day"
	}

	background = { #wetlands
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				graphical_wilderness_wetlands_trigger = yes
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/bp1_wetlands.dds"
		environment = "environment_event_bp1_wetlands" 
		ambience = "event:/SFX/Events/Backgrounds/deciduous_forest_day"
	}

	background = { #jungle
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				graphical_wilderness_jungle_trigger = yes
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/bp1_jungle.dds"
		environment = "environment_event_bp1_jungle"
		ambience = "event:/SFX/Events/Backgrounds/deciduous_forest_day"
	}

	background = { #plains, settled
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				graphical_plains_trigger = yes
				exists = province_owner
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_travel_hills.dds"
		environment = "environment_travel_hills_settlement"
		ambience = "event:/SFX/Events/Backgrounds/fields_farms_day"
	}
	background = { #plains, unsettled
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				graphical_plains_trigger = yes
				NOT = { exists = province_owner }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/bp1_plains.dds"
		environment = "environment_event_bp1_plains"
		ambience = "event:/SFX/Events/Backgrounds/fields_farms_day"
	}

	background = { #hills, settled
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				graphical_hills_trigger = yes
				exists = province_owner
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_travel_hills.dds"
		environment = "environment_travel_hills_settlement"
		ambience = "event:/SFX/Events/Backgrounds/fields_farms_day"
	}
	background = { #hills, unsettled
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				graphical_hills_trigger = yes
				NOT = { exists = province_owner }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/bp1_hills.dds"
		environment = "environment_event_bp1_hills"
		ambience = "event:/SFX/Events/Backgrounds/fields_farms_day"
	}

	background = { #sea
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				is_sea_province = yes
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/fp1_ocean.dds"
		environment = "environment_event_fp1_ocean"
		ambience = "event:/DLC/FP1/SFX/Events/event_ocean_longship"
	}
	# End Travel
	
	# Tour the Grounds
	background = {	#FP2
		trigger = {
			has_current_phase = tour_phase_tour_grounds
			OR = {
				activity_location.culture ?= { has_building_gfx = iberian_building_gfx }
				activity_location = { geographical_region = world_europe_west_iberia }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/fp2_courtyard.dds"
		environment = "environment_event_fp2_courtyard" 
		ambience = "event:/DLC/FP2/SFX/Events/courtyard" 
	}
	
	background = {	#Indian Courtyard
		trigger = {
			has_current_phase = tour_phase_tour_grounds
			activity_location ?= {
				OR = {
					culture = { has_graphical_india_culture_group_trigger = yes }
					steppe_building_gfx_use_indian_trigger = yes
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/bp1_courtyard_indian.dds"
		environment = "environment_event_bp1_courtyard_indian" 
		ambience = "event:/SFX/Events/Backgrounds/castle_courtyard_western"
	}
	background = {	#MENA Courtyard
		trigger = {
			has_current_phase = tour_phase_tour_grounds
			activity_location ?= {
				OR = {
					culture = { has_graphical_iranian_culture_group_trigger = yes }
					culture = { has_graphical_mena_culture_group_trigger = yes }
					steppe_building_gfx_use_mena_trigger = yes
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/bp1_courtyard_mena.dds"
		environment = "environment_event_bp1_courtyard_mena"
		ambience = "event:/SFX/Events/Backgrounds/castle_courtyard_western"
	}
	background = { #East Asian Courtyard
		trigger = {
			has_current_phase = tour_phase_tour_grounds
			activity_location ?= {
				OR = {
					culture = { has_graphical_east_asia_culture_group_trigger = yes }
					steppe_building_gfx_use_east_asian_trigger = yes
				}
			}	
		}
		texture = "gfx/interface/illustrations/event_scenes/tgp_courtyard_asia.dds"
		environment = "environment_tgp_courtyard_asia"
		ambience = "event:/DLC/EP4/SFX/Events/Event_Backgrounds/tgp_courtyard_asia"
	}

	background = { #Fallback
		trigger = {
			has_current_phase = tour_phase_tour_grounds
		}
		texture = "gfx/interface/illustrations/event_scenes/courtyard.dds"
		environment = "environment_event_courtyard"
		ambience = "event:/SFX/Events/Backgrounds/castle_courtyard_western"
	}
	
	# Hosted Dinner
	background = {
		trigger = {
			has_current_phase = tour_phase_dinner
			activity_location.county.holder = {
				OR = {
					government_has_flag = government_is_nomadic
					AND = {
						government_has_flag = government_is_tribal
						culture ?= { has_building_gfx = steppe_building_gfx }
					}
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_feast_steppe.dds"
		environment = "environment_steppe_feast"
		ambience = "event:/SFX/Events/Backgrounds/feasthall"
	}
	background = {	# FP1
		trigger = {
			has_current_phase = tour_phase_dinner
			activity_location.culture = { has_building_gfx = norse_building_gfx }
		}
		texture = "gfx/interface/illustrations/event_scenes/fp1_viking_feast.dds"
		environment = "environment_event_fp1_viking_feast"
		ambience = "event:/DLC/FP1/SFX/Events/event_viking_feast"
	}
	background = { #East Asia
		trigger = {
			has_current_phase = tour_phase_dinner
			activity_location ?= {
				OR = {
					culture = { has_graphical_east_asia_culture_group_trigger = yes }
					steppe_building_gfx_use_east_asian_trigger = yes
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/tgp_feast_asia.dds"
		environment = "environment_tgp_feast_asia"
		ambience = "event:/DLC/EP4/SFX/Events/Event_Backgrounds/tgp_feast_asia"
	}
	background = {
		trigger = {
			has_current_phase = tour_phase_dinner
			activity_location ?= {
				OR = {
					culture = { has_graphical_india_culture_group_trigger = yes }
					steppe_building_gfx_use_indian_trigger = yes
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_feast_indian.dds"
		environment = "environment_indian_feast"
		ambience = "event:/SFX/Events/Backgrounds/feasthall"
	}
	background = {
		trigger = {
			has_current_phase = tour_phase_dinner
			OR = {
				activity_location.culture = { has_building_gfx = arabic_group_building_gfx }
				activity_location.culture = { has_building_gfx = berber_group_building_gfx }
				activity_location.culture = { has_building_gfx = iberian_building_gfx }
				activity_location = { steppe_building_gfx_use_mena_trigger = yes }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_feast_mena.dds"
		environment = "environment_mena_feast"
		ambience = "event:/SFX/Events/Backgrounds/feasthall"
	}
	background = {
		trigger = {
			has_current_phase = tour_phase_dinner
			activity_location.culture = { has_building_gfx = african_building_gfx }
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_feast_sub_saharan.dds"
		environment = "environment_sub-saharan_feast"
		ambience = "event:/SFX/Events/Backgrounds/feasthall"
	}
	background = {
		trigger = {
			has_current_phase = tour_phase_dinner
		}
		texture = "gfx/interface/illustrations/event_scenes/feast.dds"
		environment = "environment_event_feast"
		ambience = "event:/SFX/Events/Backgrounds/feasthall"
	}
	
	# Cultural Festival
	background = {
		trigger = {
			has_current_phase = tour_phase_cultural_festival
			activity_location = {
				is_coastal = yes
				province_owner ?= {
					government_has_flag = government_is_tribal
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/bp1_docks_tribal.dds"
		environment = "environment_event_bp1_docks_tribal"
		ambience = "event:/SFX/Events/Backgrounds/docks_day"
	}
	background = {
		trigger = {
			has_current_phase = tour_phase_cultural_festival
			activity_location = {
				is_coastal = yes
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/docks.dds"
		environment = "environment_event_docks"
		ambience = "event:/SFX/Events/Backgrounds/docks_day"
	}
	background = { #Eastern
		trigger = {
			has_current_phase = tour_phase_cultural_festival
			activity_location = {
				OR = {
					geographical_region = graphical_mena
					geographical_region = graphical_india
					AND = {
			 			geographical_region = world_europe_west_iberia
			 			faith ?= { religion = religion:islam_religion }
			 		}
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/market_east.dds"
		environment = "environment_event_market_east"
		ambience = "event:/SFX/Events/Backgrounds/town_market_middleeastern_day"
	}
	background = { #East Asia
		trigger = {
			has_current_phase = tour_phase_cultural_festival
			activity_location.culture = {has_graphical_east_asia_culture_group_trigger = yes }
		}
		texture = "gfx/interface/illustrations/event_scenes/tgp_market_asia.dds"
		environment = "environment_tgp_market_asia"
		ambience = "event:/DLC/EP4/SFX/Events/Event_Backgrounds/tgp_market_asia"
	}
	background = { #Steppe
		trigger = {
			has_current_phase = tour_phase_cultural_festival
			activity_location.culture = { has_building_gfx = steppe_building_gfx }
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_feast_steppe.dds"
		environment = "environment_steppe_feast"
		ambience = "event:/DLC/EP2/SFX/Events/Backgrounds/evn_background_steppe"
	}
	background = { #Western (standard/fallback)
		trigger = {
			has_current_phase = tour_phase_cultural_festival
		}
		texture = "gfx/interface/illustrations/event_scenes/ep2_village_festival_western.dds"
		environment = "environment_village_festival"
		ambience = "event:/SFX/Events/Backgrounds/corner_of_tavern"
	}
	
	# Tour end/conclusion
	background = { # MPO - Nomads
		trigger = {
			activity_host = {
				OR = {
					government_has_flag = government_is_nomadic
					AND = {
						government_has_flag = government_is_tribal
						culture ?= { has_graphical_steppe_culture_group_trigger = yes }
					}
					AND = {
						is_landless_adventurer = yes
						culture ?= { has_graphical_steppe_culture_group_trigger = yes }
					}
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/mpo_tent_interior_mongol.dds"
		environment = "environment_mpo_tent_interior_mongol"
		ambience = "event:/DLC/CE2/Events/Event_Images/mpo_tent_interior_mongol"
	}
	background = {	#FP2
		trigger = {
			OR = {
				activity_location.culture ?= { has_building_gfx = iberian_building_gfx }
				activity_location = { geographical_region = world_europe_west_iberia }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/fp2_throneroom.dds"
		environment = "environment_event_fp2_throneroom"
		ambience = "event:/DLC/FP2/SFX/Events/throneroom" 
	}	

	background = { #FP1 Tribal
		trigger = {
			activity_location.culture ?= { has_building_gfx = norse_building_gfx }
			activity_location.barony.holder = { government_has_flag = government_is_tribal }
		}
		texture = "gfx/interface/illustrations/event_scenes/fp1_throneroom_tribal.dds"
		environment = "environment_event_fp1_throneroom_tribal"
		ambience = "event:/DLC/FP1/SFX/Events/event_throneroom"
	}

	background = { #Tribal
		trigger = { activity_location.barony.holder = { should_use_tribal_realm_palace_graphics_trigger = yes } }
		texture = "gfx/interface/illustrations/event_scenes/throneroom_tribal.dds"
		environment = "environment_frontend_tribal_main"
		ambience = "event:/SFX/Events/Backgrounds/throneroom_tribal_pagan"
	}

	background = {	#FP1 Non-Tribal
		trigger = {
			activity_location.culture ?= { has_building_gfx = norse_building_gfx }
			activity_location.barony.holder = { NOT = { government_has_flag = government_is_tribal } }
		}
		texture = "gfx/interface/illustrations/event_scenes/fp1_throneroom_nontribal.dds"
		environment = "environment_event_fp1_throneroom_nontribal"
		ambience = "event:/DLC/FP1/SFX/Events/event_throneroom_nontribal"
	}

	background = { #iranian
		trigger = {
			activity_location.culture ?= { has_graphical_iranian_culture_group_trigger = yes }
		}
		texture = "gfx/interface/illustrations/event_scenes/fp3_throneroom.dds"
		environment = "environment_event_temple"
		ambience = "event:/SFX/Events/Backgrounds/throneroom_middleeastern_african" 
	}

	background = { #MENA
		trigger = { 
			activity_location ?= {
				OR = {
					culture ?= { has_graphical_mena_culture_group_trigger = yes }
					steppe_building_gfx_use_mena_trigger = yes
				}	
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/throneroom_east.dds"
		environment = "environment_frontend_east_main"
		ambience = "event:/SFX/Events/Backgrounds/throneroom_middleeastern_african"
	}

	background = { #India
		trigger = {
			activity_location ?= {
				OR = {
					culture ?= { has_graphical_india_culture_group_trigger = yes }
					steppe_building_gfx_use_indian_trigger = yes
				}	
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/throneroom_india.dds"
		environment = "environment_frontend_india_main"
		ambience = "event:/SFX/Events/Backgrounds/throneroom_middleeastern_african"
	}

	background = {	#Mediterranean
		trigger = {
			activity_location ?= {
				OR = {
					culture ?= { has_graphical_mediterranean_culture_group_trigger = yes }
					steppe_building_gfx_use_mediterranean_trigger = yes
				}	
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/throneroom_mediterranean.dds"
		environment = "environment_frontend_mediterranean_main"
		ambience = "event:/SFX/Events/Backgrounds/throneroom_mediterranean"
	}
	background = {	#Eas Asia
		trigger = {
			activity_location ?= {
				OR = {
					culture ?= { has_graphical_east_asia_culture_group_trigger = yes }
					steppe_building_gfx_use_east_asian_trigger = yes
				}	
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/tgp_asia_throne_room.dds"
		environment = "environment_tgp_frontend_celestial_main"
		ambience = "event:/DLC/EP4/SFX/Events/Event_Backgrounds/tgp_study_asia"
	}

	background = {
		texture = "gfx/interface/illustrations/event_scenes/throneroom_west.dds"
		environment = "environment_frontend_west_main"
		ambience = "event:/SFX/Events/Backgrounds/throneroom_western"
	}

	activity_window_widgets = {
		tour_conclusion_stops = "activity_plugin_widgets_conclusion"
		tour_success_bar = "activity_plugin_widgets_summary"
	}

	window_characters = {
		tour_host = {
			camera = camera_body_right
			
			effect = {
				if = {
					limit = {
						OR = {
							scope:host.location = scope:activity.activity_location
							scope:host.location = { is_sea_province = yes }
						}
					}
					scope:host = {
						add_to_list = characters
					}
				}
			}

			scripted_animation = {
				triggered_animation = {
					trigger = {
						scope:character.location = { is_sea_province = yes }
					}
					animation = { survey }
				}
				triggered_animation = {
					trigger = {
						scope:activity = {
							has_activity_option = {
								category = special_type
								option = tour_type_majesty
							}
						}
					}
					animation = { toast_goblet war_over_win personality_honorable thinking }
				}
				triggered_animation = {
					trigger = {
						scope:activity = {
							has_activity_option = {
								category = special_type
								option = tour_type_intimidation
							}
						}
					}
					animation = { celebrate_dagger personality_cynical personality_vengeful scheme personality_callous }
				}
				triggered_animation = {
					trigger = {
						scope:activity = {
							has_activity_option = {
								category = special_type
								option = tour_type_taxation
							}
						}
					}
					animation = { steward drink_goblet toast personality_greedy }
				}
			}
		}
		
		travel_tour_host = {
			camera = camera_event_horse_left
			
			effect = {
				if = {
					limit = {
						NOR = {
							scope:host.location = scope:activity.activity_location
							scope:host.location = { is_sea_province = yes }
						}
					}
					scope:host = {
						add_to_list = characters
					}
				}
			}

			scripted_animation = {
				triggered_animation = {
					trigger = { scope:character = { has_trait = impatient } }
					animation = { jockey_gallop }
				}
				animation = jockey_walk
			}
		}

		visited_vassal = {
			camera = camera_body_left_slight
			
			effect = {
				every_in_list = {
					variable = tour_vassals_to_visit
					limit = {
						is_alive = yes
						location = scope:host.location
					}
					this ?= {
						add_to_list = characters
					}
				}
			}

			scripted_animation = {
				triggered_animation = {
					trigger = {
						always = yes
					}
					animation = { idle drink_goblet toast personality_greedy happiness admiration personality_honorable personality_cynical personality_vengeful personality_callous
					}
				}
			}
		}
	}
}
