﻿activity_adult_education = {
	is_shown = {
		has_bp2_dlc_trigger = yes
		highest_held_title_tier > tier_barony
		is_playable_character = yes
		trigger_if = {
			limit = {
				is_ai = yes
			}
			is_adult = yes
			is_at_war = no
			ai_should_focus_on_building_in_their_capital = no
			gold >= adult_education_activity_cost
			NOT = { has_variable = conqueror }
			trigger_if = { # Throttle Counts
				limit = {
					highest_held_title_tier = tier_county
				}
				ai_energy >= 100
			}
		}
		#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_adult_education }
		is_available_adult = yes

		# Can you improve?
		trigger_if = {
			limit = {
				OR = {
					has_trait = education_diplomacy_5
					has_trait = education_martial_5
					has_trait = education_stewardship_5
					has_trait = education_intrigue_5
					has_trait = education_learning_5
					has_trait = education_nht_prowess_5
					has_trait = education_nht_leadership_5
				}
			}
			custom_tooltip = {
				text = activity_education_done_that
				NOR = {
					has_trait = education_diplomacy_5
					has_trait = education_martial_5
					has_trait = education_stewardship_5
					has_trait = education_intrigue_5
					has_trait = education_learning_5
					has_trait = education_nht_prowess_5
					has_trait = education_nht_leadership_5
				}
			}
		}

		# Are you a diarch forbidden from leaving the realm?
		trigger_if = {
			limit = { bannable_serving_diarch_trigger = yes }
			custom_tooltip = {
				text = activity_pilgrimage.serving_diarch				
				any_realm_province = {
					is_higher_studies_location = no
				}
			}
		}
	}

	is_valid = {
		scope:host = {
			#Getting imprisoned will invalidate
			is_imprisoned = no
			#Getting unlanded will invalidate
			is_playable_character = yes 
			#Becoming incapable will invalidate
			NOT = { is_incapable = yes }
		}
	}

	on_invalidated = {
		# Host becomes unlanded
		if = {
			limit = {
				scope:host = { is_playable_character = no }
			}
			scope:activity = {
				activity_type = { save_scope_as = activity_type }
			}
			every_attending_character = {
				trigger_event = activity_system.0320
			}
		}
		# Host becomes incapable
		else_if = {
			limit = {
				scope:host = { is_incapable = yes }
			}
			scope:activity = {
				activity_type = { save_scope_as = activity_type }
			}
			scope:host = {
				trigger_event = activity_system.0330
			}
			every_attending_character = {
				limit = { this != scope:host }
				trigger_event = activity_system.0331
			}
		}
		# Host is imprisoned
		else_if = {
			limit = {
				scope:host = { is_imprisoned = yes } 
			}
			scope:host = { trigger_event = bp2_adult_education.0005 }
		}
		if = {
			limit = {
				scope:host = { is_ai = yes }
			}
			scope:activity = {
				every_attending_character = {
					limit = {
						OR = {
							has_character_flag = teacher_1
							has_character_flag = teacher_2
							has_character_flag = student_1
							has_character_flag = student_2
						}
					}
					if = {
						limit = {
							is_alive = yes
							has_character_flag = created
							# avoid triggering successions...
							is_ruler = no
						}
						death = {
							death_reason = death_disappearance
						}
					}
				}
			}
		}
	}

	on_host_death = {
		if = {
			limit = {
				scope:host = { is_ai = yes }
			}
			scope:activity = {
				every_attending_character = {
					limit = {
						OR = {
							has_character_flag = teacher_1
							has_character_flag = teacher_2
							has_character_flag = student_1
							has_character_flag = student_2
						}
					}
					if = {
						limit = {
							is_alive = yes
							has_character_flag = created
							# avoid triggering successions...
							is_ruler = no
						}
						death = {
							death_reason = death_disappearance
						}
					}
				}
			}
		}
		#cancel the activity by not setting a new host
		#free the students
		scope:activity = {
			every_attending_character = {
				limit = {
					has_character_flag = student_1
				}
				remove_character_flag = student_1
			}
			every_attending_character = {
				limit = {
					has_character_flag = student_2
				}
				remove_character_flag = student_2
			}
			every_attending_character = {
				limit = {
					has_character_flag = generated_character_uni
				}
				remove_character_flag = generated_character_uni
			}
		}
		# Send your entourage home
		scope:host = {
			current_travel_plan = {
				every_entourage_character = { set_location_to_default = yes }
			}
		}
	}

	is_location_valid = {
		custom_tooltip = {
			text = activity_education_no_culture_center
			has_special_building_slot = yes
			is_higher_studies_location = yes
		}
		#You only get to visit any particular university once in your life
		custom_tooltip = { 
			text = activity_education_been_there
			NOT = {
				scope:host = {
					any_memory = {
						memory_type = completed_adult_education
						has_variable = education_destination
						var:education_destination = root #root is the province we're checking
					}
				}
			}
		}
		# If you are supposed to be the realm's reserve ruler, then you can't take a multi-year foreign trip.
		trigger_if = {
			limit = {
				scope:host = { bannable_serving_diarch_trigger = yes }
			}
			custom_tooltip = {
				text = activity_pilgrimage.serving_diarch
				county.holder = {
					any_liege_or_above = { this = scope:host.liege }
				}
			}
		}
		trigger_if = {
			limit = {
				scope:host = {
					is_ai = yes
					has_title = title:h_china
				}
			}
			county.holder.top_liege = scope:host
		}
	}

	province_description = {
		desc = activity_adult_education_province_desc
		#Is it a University?
		triggered_desc = {
			trigger = {
				has_university_building_trigger = yes
			}
			desc = adult_education_has_university_desc
		}
		#Is it a Cathedral?
		triggered_desc = {
			trigger = {
				is_religious_studies_location = yes
			}
			desc = adult_education_has_religious_center_desc
		}
		#Is it the capital of h_china?
		triggered_desc = {
			trigger = {
				title:h_china.holder.capital_province ?= root
			}
			desc = adult_education_celestial_capital_desc
		}
		#Is the capital of h_china improved?
		triggered_desc = {
			trigger = {
				county = { has_county_modifier = tgp_strengthen_capital_modifier }
			}
			desc = adult_education_improved_celestial_capital_desc
		}
		#Does it have a hostile faith?
		triggered_desc = {
			trigger = {
				this.faith ?= {
					faith_hostility_level = {
						target = scope:host.faith
						value >= faith_hostile_level
					}
				}
			}
			desc = adult_education_has_hostile_faith_desc
		}
		# EP3: Does it have the Pandidakterion?
		triggered_desc = {
			trigger = {
				county = { has_county_modifier = pandidakterion_university_modifier }
			}
			desc = adult_education_has_pandidakterion_desc
		}
		# Will it yield Confucian Education XP?
		triggered_desc = {
			trigger = {
				is_province_valid_confucian_education_trigger = yes
			}
			desc = adult_education_has_confucian_scholars_desc
		}
	}

	province_score = {
		value = 0
		if = {
			limit = { has_university_building_trigger = yes }
			add = 100
		}
		if = {
			limit = { is_religious_studies_location = yes }
			add = 100
		}
		if = {
			limit = {
				title:h_china.holder.capital_province ?= {
					this = root
				}
			}
			add = 25
		}
		if = {
			limit = {
				title:h_china.holder.capital_province ?= {
					this = root
					county = { has_county_modifier = tgp_strengthen_capital_modifier }
				}
			}
			add = 100
		}
		if = {
			limit = {
				this.faith ?= {
					faith_hostility_level = {
						target = scope:host.faith
						value >= faith_hostile_level
					}
				}
			}
			add = -75
		}
		if = {
			limit = {
				county ?= { has_county_modifier = pandidakterion_university_modifier }
			}
			add = 100
		}
	}

	# desc is only shown in debug AI watch window
	ai_will_do = {
		value = 20
		add = learning
		add = {
            value = ai_greed
            multiply = -0.25
            desc = "ai_greed"
        }
        add = {
        	value = ai_sociability
        	multiply = 0.25
        	desc = "ai_sociability"
        }
        add = {
        	value = ai_rationality
        	multiply = 0.25
        	desc = "ai_rationality"
        }
		if = {
			limit = {
				ai_energy < 0
			}
			add = {
				add = ai_energy
				desc = "ai_energy"
			}
		}
		if = {
			limit = {
				liege = { has_ongoing_grand_activity_trigger = yes }
			}
			desc = "Liege grand activities"
			add = -1000
		}
		if = {
			limit = {
				highest_held_title_tier >= tier_kingdom
			}
			desc = "Kings/Emperors more likely"
			add = 20
		}
		# Personality
		if = {
			limit = { has_trait = greedy }
			add = {
				value = -20
				desc = greedy
			}
		}
		if = {
			limit = { has_trait = impatient }
			add = {
				value = -20
				desc = impatient
			}
		}
		if = {
			limit = { has_trait = lazy }
			add = {
				value = -100
				desc = lazy
			}
		}
		if = {
			limit = {
				government_has_flag = government_is_tribal
			}
			add = {
				value = -50
				desc = government_is_tribal
			}
		}
		if = {
			limit = { has_trait = reclusive }
			add = {
				value = -100
				desc = lazy
			}
		}
		if = { # Likes to socialize
			limit = { has_trait = gregarious }
			add = {
				value = 20
				desc = gregarious
			}
		}
		if = {
			limit = { has_trait = shy }
			add = {
				value = -10
				desc = shy
			}
		}
		if = {
			limit = { has_trait = diligent }
			add = {
				value = 50
				desc = diligent
			}
		}
		if = {
			limit = { has_trait = humble }
			add = {
				value = 10
				desc = humble
			}
		}
		if = {
			limit = { has_trait = gregarious }
			add = {
				value = 20
				desc = gregarious
			}
		}
		if = {
			limit = { has_trait = ambitious }
			add = {
				value = 20
				desc = ambitious
			}
		}
		if = {
			limit = { has_trait = content }
			add = {
				value = -10
				desc = content
			}
		}
		if = {
			limit = { has_trait = zealous }
			add = {
				value = 20
				desc = zealous
			}
		}
		if = {
			limit = { has_trait = stubborn }
			add = {
				value = 20
				desc = stubborn
			}
		}
		# Lifestyle
		if = {
			limit = {
				OR = {
					has_focus = diplomacy_foreign_affairs_focus
					has_focus = martial_strategy_focus
					has_focus = intrigue_skulduggery_focus
					has_focus = stewardship_domain_focus
					has_focus = learning_scholarship_focus
					has_focus = learning_theology_focus
					has_focus = nht_prowess_commanding_focus
					has_focus = nht_traditions_focus
					has_focus = nht_sovereign_focus
				}
			}
			add = {
				value = 20
				desc = focus
			}
		}
		if = {
			limit = { has_trait = strategist }
			add = {
				value = 10
				desc = strategist
			}
		}
		if = {
			limit = { has_trait = overseer }
			add = {
				value = 10
				desc = overseer
			}
		}
		if = {
			limit = { has_trait = architect }
			add = {
				value = 10
				desc = architect
			}
		}
		if = {
			limit = { has_trait = administrator }
			add = {
				value = 10
				desc = administrator
			}
		}
		if = {
			limit = { has_trait = scholar }
			add = {
				value = 50
				desc = scholar
			}
		}
		if = {
			limit = { has_trait = theologian }
			add = {
				value = 50
				desc = theologian
			}
		}
		if = {
			limit = { has_trait = nht_commander }
			add = {
				value = 20
				desc = nht_commander
			}
		}
		if = {
			limit = { has_trait = nht_visionary }
			add = {
				value = 20
				desc = nht_visionary
			}
		}
		if = {
			limit = { has_trait = nht_cosmopolitan }
			add = {
				value = 20
				desc = nht_cosmopolitan
			}
		}
		# Education
		if = {
			limit = { has_trait = education_diplomacy }
			add = {
				value = 20
				desc = education_diplomacy
			}
		}
		if = {
			limit = { has_trait = education_stewardship }
			add = {
				value = 20
				desc = education_stewardship
			}
		}
		if = {
			limit = { has_trait = education_nht_leadership }
			add = {
				value = 20
				desc = education_nht_leadership
			}
		}
		if = {
			limit = { has_trait = education_learning }
			add = {
				value = 50
				desc = education_learning
			}
		}
		if = {
			limit = {
				OR = {
					has_trait = education_diplomacy_1
					has_trait = education_martial_1
					has_trait = education_stewardship_1
					has_trait = education_intrigue_1
					has_trait = education_learning_1
					has_trait = education_nht_prowess_1
					has_trait = education_nht_leadership_1
				}
			}
			add = {
				value = 100
				desc = "more to improve"
			}
		}
		if = {
			limit = {
				OR = {
					has_trait = education_diplomacy_2
					has_trait = education_martial_2
					has_trait = education_stewardship_2
					has_trait = education_intrigue_2
					has_trait = education_learning_2
					has_trait = education_nht_prowess_2
					has_trait = education_nht_leadership_2
				}
			}
			add = {
				value = 70
				desc = "more to improve"
			}
		}
		if = {
			limit = {
				OR = {
					has_trait = education_diplomacy_3
					has_trait = education_martial_3
					has_trait = education_stewardship_3
					has_trait = education_intrigue_3
					has_trait = education_learning_3
					has_trait = education_nht_prowess_3
					has_trait = education_nht_leadership_3
				}
			}
			add = {
				value = 30
				desc = "more to improve"
			}
		}
		if = {
			limit = {
				OR = {
					has_trait = education_diplomacy_4
					has_trait = education_martial_4
					has_trait = education_stewardship_4
					has_trait = education_intrigue_4
					has_trait = education_learning_4
					has_trait = education_nht_prowess_4
					has_trait = education_nht_leadership_4
				}
				OR = {
					has_trait = ambitious
					has_trait = diligent
					has_trait = arrogant
					has_trait = shrewd
					has_trait = intellect_good
				}
			}
			add = {
				value = 50
				desc = "wants to be the very best"
			}
		}
		# Culture
		culture = {
			if = {
				limit = { 
					has_cultural_tradition = tradition_legalistic
				}
				add = {
					value = 25
					desc = tradition_legalistic_name
				}
			}
			if = {
				limit = { 
					has_cultural_tradition = tradition_astute_diplomats
				}
				add = {
					value = 10
					desc = tradition_astute_diplomats_name
				}
			}
			if = {
				limit = { 
					has_cultural_tradition = tradition_roman_legacy
				}
				add = {
					value = 50
					desc = tradition_roman_legacy_name
				}
			}
			if = {
				limit = { 
					has_cultural_tradition = tradition_visigothic_codes
				}
				add = {
					value = 20
					desc = tradition_visigothic_codes_name
				}
			}
			if = {
				limit = { 
					has_cultural_tradition = tradition_language_scholars
				}
				add = {
					value = 20
					desc = tradition_language_scholars_name
				}
			}
			if = {
				limit = { 
					has_cultural_tradition = tradition_music_theory
				}
				add = {
					value = 10
					desc = tradition_music_theory_name
				}
			}
			if = {
				limit = { 
					has_cultural_parameter = poet_trait_gives_bonuses
				}
				add = {
					value = 10
					desc = tradition_poetry_name
				}
			}
			if = {
				limit = { 
					has_cultural_tradition = tradition_philosopher_culture
				}
				add = {
					value = 50
					desc = tradition_philosopher_culture_name
				}
			}
			if = {
				limit = { 
					has_cultural_tradition = tradition_zealous_people
				}
				add = {
					value = 10
					desc = tradition_zealous_people_name
				}
			}
		}
        # Economic Archetypes
        if = {
        	limit = {
				ai_has_warlike_personality = yes
			}
        	add = {
            	value = -25
            	desc = "Warlike"
            }
        }
        if = {
        	limit = {
				ai_has_warlike_personality = yes
				war_chest_gold < war_chest_gold_maximum
			}
        	multiply = {
            	value = -50
            	desc = "Warlike, no war chest"
            }
        }
		if = {
            limit = {
                OR = {
                    ai_has_economical_boom_personality = yes
                    has_character_flag = ai_boom
                }
            }
            add = {
            	value = -50
            	desc = "Builder"
            }
        }
        if = {
        	limit = {
				ai_has_pious_builder_personality = yes
			}
        	add = {
            	value = -25
            	desc = "Pious Builder"
            }
        }
	}

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

	ai_will_select_province = {
		value = 50
		if = {
			limit = { "scope:host.capital_province.squared_distance(root)" <= squared_distance_small }
			multiply = {
				value = 8
				desc = "super close 8"
			}
		}
		else_if = {
			limit = {
				"scope:host.capital_province.squared_distance(root)" > squared_distance_small
				"scope:host.capital_province.squared_distance(root)" <= squared_distance_medium
			}
			multiply = {
				value = 7
				desc = "pretty close 7"
			}
		}
		else_if = {
			limit = {
				"scope:host.capital_province.squared_distance(root)" > squared_distance_medium
				"scope:host.capital_province.squared_distance(root)" <= squared_distance_large
			}
			multiply = {
				value = 6
				desc = "OK close 6"
			}
		}
		else_if = {
			limit = {
				"scope:host.capital_province.squared_distance(root)" > squared_distance_large
				"scope:host.capital_province.squared_distance(root)" <= squared_distance_huge
			}
			multiply = {
				value = 5
				desc = "intermediately far away 5"
			}
		}
		else_if = {
			limit = {
				"scope:host.capital_province.squared_distance(root)" > squared_distance_huge
				"scope:host.capital_province.squared_distance(root)" <= squared_distance_almost_massive
			}
			multiply = {
				value = 4
				desc = "quite far away 4"
			}
		}
		else_if = {
			limit = {
				"scope:host.capital_province.squared_distance(root)" > squared_distance_almost_massive
				"scope:host.capital_province.squared_distance(root)" <= squared_distance_massive
			}
			multiply = {
				value = 3
				desc = "far away 3"
			}
		}
		#Klingenberg -> Jerusalem
		else_if = {
			limit = {
				"scope:host.capital_province.squared_distance(root)" > squared_distance_massive
				"scope:host.capital_province.squared_distance(root)" <= squared_distance_monstrous
			}
			multiply = {
				value = 2
				desc = "very far away 2"
			}
		}
		#Klingenberg -> Kanchipuram
		else_if = {
			limit = { "scope:host.capital_province.squared_distance(root)" > squared_distance_monstrous }
			multiply = {
				value = 1
				desc = "super far away 1"
			}
		}
		#Hostile faith
		if = {
			limit = { 
				this.faith = {
					faith_hostility_level = {
						target = scope:host.faith
						value >= faith_hostile_level
					}
				}
			}
			multiply = {
				value = -1
				desc = "hostile faith"
			}
		}
	}

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

	is_single_location = yes

	province_filter = all

	ai_province_filter = holy_sites

	cooldown = {
		years = 20
	}

	max_route_deviation_mult = 3.0

	cost = {
		gold = {
			add = {
				value = root.adult_education_activity_cost
				desc = pilgrimage_base_cost
			}
			add = {
				value = root.adult_education_activity_cost
				multiply = activity_cost_scale_by_era
				subtract = root.adult_education_activity_cost
				desc = activity_cost_scale_by_era_desc
			}
		}
		piety = {
			add = {
				value = 0
				if = {
					limit = {
						scope:province ?= {
							faith = {
								faith_hostility_level = {
									target = root.faith
									value >= faith_hostile_level
								}
							}
						}
					}
					add = {
						value = 0
						add = {
							value = medium_piety_value
							add = {
								value = medium_piety_value
								multiply = university_visit_activity_cost_scale_by_tier
								subtract = medium_piety_value
							}
						}
						desc = activity_cost_hostile_faith_desc
					}
				}
			}
		}
	}

	ui_predicted_cost = {
		gold = {
			add = { # Base Cost, scaled by era
				value = adult_education_activity_cost
				multiply = activity_cost_scale_by_era
			}
			
			# Options 
			add = { # Books Option 
				value = 0
				subtract = minor_gold_value_static_max
				add = {
					value = medium_gold_value_static_max
					min = 150
				}
				add = {
					value = major_gold_value_static_max
					min = 300
				}
				# Scale option costs by era
				multiply = activity_cost_scale_by_era
				# Divide by the number of option levels to get an average option cost
				divide = 4
			}
			
			# Make it a multiple of 5 (rounded up)
			divide = 5
			ceiling = yes 
			multiply = 5
		}
	}

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

	options = {
		#########
		
		#########
		adult_education_option_books = {
			adult_education_books_bad = {
				is_shown = { has_dlc_feature = advanced_activities }

				is_valid = {
					
				}

				cost = {
					gold = {
						value = 0
						add = {
							desc = adult_education_books_bad
							subtract = {
								value = minor_gold_value_static_max
								desc = adult_education_books_bad
							}
							subtract = {
								value = minor_gold_value_static_max
								multiply = activity_cost_scale_by_era
								subtract = minor_gold_value_static_max
								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
							}
						}
					}
				}

				ai_will_do = {
					value = 100
					if = {
						limit = { has_trait = lazy }
						add = 50
					}
					if = {
						limit = { has_trait = greedy }
						add = 100
					}
					if = {
						limit = { has_trait = fickle }
						add = 25
					}
					if = {
						limit = { has_trait = impatient }
						add = 25
					}
					if = {
						limit = { has_trait = gregarious }
						add = 50
					}
					if = {
						limit = { has_trait = humble }
						add = 25
					}
				}
			}

			adult_education_books_normal = {
				default = yes

				cost = {
					gold = {
						value = 0
						add = {
							desc = adult_education_books_normal
							add = {
								value = medium_gold_value_static_max
								desc = adult_education_books_normal
								min = 150
							}
							add = {
								value = medium_gold_value_static_max
								multiply = activity_cost_scale_by_era
								subtract = medium_gold_value_static_max
								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
							}
						}
					}
				}

				ai_will_do = {
					# Default to this.
					value = 100
				}
			}

			adult_education_books_good = {
				is_shown = { has_dlc_feature = advanced_activities }

				is_valid = {
					
				}

				cost = {
					gold = {
						value = 0
						add = {
							desc = adult_education_books_good
							add = {
								value = major_gold_value_static_max
								desc = adult_education_books_good
								min = 300
							}
							add = {
								value = major_gold_value_static_max
								multiply = activity_cost_scale_by_era
								subtract = major_gold_value_static_max
								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
							}
						}
					}
				}


				ai_will_do = {
					value = 0
					if = {
						limit = { has_trait = diligent }
						add = 50
					}
					if = {
						limit = { has_trait = generous }
						add = 50
					}
					if = {
						limit = { has_trait = stubborn }
						add = 25
					}
					if = {
						limit = { has_trait = patient }
						add = 25
					}
					if = {
						limit = { has_trait = shy }
						add = 50
					}
					if = {
						limit = { has_trait = arrogant }
						add = 50
					}
				}
			}
		}
	}

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

	phases = {
		#Study!
		education_study_phase = {
			is_predefined = yes

			ai_will_do = {
				value = 0
				add = {
					value = 30
					desc = "Base test value"
				}
			}

			#This is when you arrive at the university
			on_phase_active = {
				if = {
					limit = { this = scope:host }
					scope:activity = {
						#Phase progression
						progress_activity_phase_after = { months = 6 }
						#Loc
						activity_location = { save_scope_as = location }
					}

					#Set up recurring characters: teachers
					bp2_university_teacher_setup = yes
					#Set up recurring characters: students
					bp2_university_student_setup = yes
					
					#Arrival event
					trigger_event = { on_action = adult_education_arrival_events }
				}
			}

			#Events that happen while we're on site
			on_monthly_pulse = {
				if = {
					limit = { this = scope:host }
					# Let's check that we still have the required teachers and students, and if not let's create them again
					#Set up recurring characters: teachers
					bp2_university_teacher_setup = yes
					#Set up recurring characters: students
					bp2_university_student_setup = yes
					trigger_event = { on_action = adult_education_destination_events }				
				}
			}

			on_end = {
				if = {
					limit = { this = scope:host }
					create_character_memory = {
						type = completed_adult_education
					}
					scope:new_memory = {
						set_variable = {
							name = education_destination
							value = scope:activity.activity_location
						}
					}
					#Resolve how how successful we were so we can bake that into the total reward
					resolve_adult_education_success_reward_effect = yes 
					#Conclusion event
					trigger_event = bp2_adult_education.0009			
				}
			}
		}
	}

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

	allow_zero_guest_invites = yes

	can_be_activity_guest = {
		is_adult = yes
		# exclude travel leaders, travel companions, mercenaries, and sea captains
		OR = {
			NOT = { current_travel_plan ?= scope:host.current_travel_plan }
			has_character_flag = peasant_adult_edu
		}
	}

	max_guests = 20

	host_intents = {
		intents = { study_hard_intent university_revelry_intent }
		default = study_hard_intent
	}

	guest_intents = {
		intents = { study_hard_intent university_revelry_intent }
		default = study_hard_intent
	}

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

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

	pulse_actions = {
		entries = {
			apa_leveraging_language_skills 
			apa_procrastination
			apa_sight_seeing_group #Traveller trait
			apa_studying_scripture #Learning Focus
			apa_visited_markets #Stewardship Focus
			apa_foreign_custom #Diplomacy Focus
			apa_university_discussions
			apa_night_on_books
			apa_student_disagreement
			apa_rowdy_student
			apa_impromptu_poetry
			apa_impressed_teacher
			apa_revelry_hangover
			apa_local_food
			apa_aced_homework
			apa_pangur_ban
			apa_studied_confucian_classics
		}
		chance_of_no_event = 5
	}

	on_start = {
		# Activity count debugging, left in for QA purposes
			#if = { 
			#	limit = {
			#		debug_only = yes
			#	}
			#	if = {
			#		limit = {
			#			NOT = {
			#				exists = global_var:university_visit_count
			#			}
			#		}
			#		set_global_variable = {
			#			name = university_visit_count
			#			value = 1
			#		}
			#	}
			#	else = {
			#		change_global_variable = {
			#			name = university_visit_count
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host = {
			#				OR = {
			#					has_trait = education_diplomacy_1
			#					has_trait = education_martial_1
			#					has_trait = education_stewardship_1
			#					has_trait = education_intrigue_1
			#					has_trait = education_learning_1
			#				}
			#			}
			#			NOT = {
			#				exists = global_var:university_visit_edu_1
			#			}
			#		}
			#		set_global_variable = {
			#			name = university_visit_edu_1
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host = {
			#				OR = {
			#					has_trait = education_diplomacy_1
			#					has_trait = education_martial_1
			#					has_trait = education_stewardship_1
			#					has_trait = education_intrigue_1
			#					has_trait = education_learning_1
			#				}
			#			}
			#		}
			#		change_global_variable = {
			#			name = university_visit_edu_1
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host = {
			#				OR = {
			#					has_trait = education_diplomacy_2
			#					has_trait = education_martial_2
			#					has_trait = education_stewardship_2
			#					has_trait = education_intrigue_2
			#					has_trait = education_learning_2
			#				}
			#			}
			#			NOT = {
			#				exists = global_var:university_visit_edu_2
			#			}
			#		}
			#		set_global_variable = {
			#			name = university_visit_edu_2
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host = {
			#				OR = {
			#					has_trait = education_diplomacy_2
			#					has_trait = education_martial_2
			#					has_trait = education_stewardship_2
			#					has_trait = education_intrigue_2
			#					has_trait = education_learning_2
			#				}
			#			}
			#		}
			#		change_global_variable = {
			#			name = university_visit_edu_2
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host = {
			#				OR = {
			#					has_trait = education_diplomacy_3
			#					has_trait = education_martial_3
			#					has_trait = education_stewardship_3
			#					has_trait = education_intrigue_3
			#					has_trait = education_learning_3
			#				}
			#			}
			#			NOT = {
			#				exists = global_var:university_visit_edu_3
			#			}
			#		}
			#		set_global_variable = {
			#			name = university_visit_edu_3
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host = {
			#				OR = {
			#					has_trait = education_diplomacy_3
			#					has_trait = education_martial_3
			#					has_trait = education_stewardship_3
			#					has_trait = education_intrigue_3
			#					has_trait = education_learning_3
			#				}
			#			}
			#		}
			#		change_global_variable = {
			#			name = university_visit_edu_3
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host = {
			#				OR = {
			#					has_trait = education_diplomacy_4
			#					has_trait = education_martial_4
			#					has_trait = education_stewardship_4
			#					has_trait = education_intrigue_4
			#					has_trait = education_learning_4
			#				}
			#			}
			#			NOT = {
			#				exists = global_var:university_visit_edu_4
			#			}
			#		}
			#		set_global_variable = {
			#			name = university_visit_edu_4
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host = {
			#				OR = {
			#					has_trait = education_diplomacy_4
			#					has_trait = education_martial_4
			#					has_trait = education_stewardship_4
			#					has_trait = education_intrigue_4
			#					has_trait = education_learning_4
			#				}
			#			}
			#		}
			#		change_global_variable = {
			#			name = university_visit_edu_4
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_middle_east }
			#			NOT = {
			#				exists = global_var:university_visit_world_middle_east
			#			}
			#		}
			#		set_global_variable = {
			#			name = university_visit_world_middle_east
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_middle_east }
			#		}
			#		change_global_variable = {
			#			name = university_visit_world_middle_east
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_europe }
			#			NOT = {
			#				exists = global_var:university_visit_world_europe
			#			}
			#		}
			#		set_global_variable = {
			#			name = university_visit_world_europe
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_europe }
			#		}
			#		change_global_variable = {
			#			name = university_visit_world_europe
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_steppe }
			#			NOT = {
			#				exists = global_var:university_visit_world_steppe
			#			}
			#		}
			#		set_global_variable = {
			#			name = university_visit_world_steppe
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_steppe }
			#		}
			#		change_global_variable = {
			#			name = university_visit_world_steppe
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_africa }
			#			NOT = {
			#				exists = global_var:university_visit_world_africa
			#			}
			#		}
			#		set_global_variable = {
			#			name = university_visit_world_africa
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_africa }
			#		}
			#		change_global_variable = {
			#			name = university_visit_world_africa
			#			add = 1
			#		}
			#	}
			#	
			#	if = {
			#		limit = {
			#			scope:host.location = {
			#				OR = {
			#					geographical_region = world_india
			#					geographical_region = world_burma
			#				}
			#			}
			#			NOT = {
			#				exists = global_var:university_visit_world_india
			#			}
			#		}
			#		set_global_variable = {
			#			name = university_visit_world_india
			#			value = 1
			#		}
			#	}
			#	else_if = {
			#		limit = {
			#			scope:host.location = { geographical_region = world_india }
			#		}
			#		change_global_variable = {
			#			name = university_visit_world_india
			#			add = 1
			#		}
			#	}
			#}
			#	
			#if = {
			#	limit = {
			#		scope:host = { highest_held_title_tier = tier_county }
			#		NOT = {
			#			exists = global_var:university_visit_c
			#		}
			#	}
			#	set_global_variable = {
			#		name = university_visit_c
			#		value = 1
			#	}
			#}
			#else_if = {
			#	limit = {
			#		scope:host = { highest_held_title_tier = tier_county }
			#	}
			#	change_global_variable = {
			#		name = university_visit_c
			#		add = 1
			#	}
			#}
			#
			#if = {
			#	limit = {
			#		scope:host = { highest_held_title_tier = tier_duchy }
			#		NOT = {
			#			exists = global_var:university_visit_d
			#		}
			#	}
			#	set_global_variable = {
			#		name = university_visit_d
			#		value = 1
			#	}
			#}
			#else_if = {
			#	limit = {
			#		scope:host = { highest_held_title_tier = tier_duchy }
			#	}
			#	change_global_variable = {
			#		name = university_visit_d
			#		add = 1
			#	}
			#}
			#
			#if = {
			#	limit = {
			#		scope:host = { highest_held_title_tier >= tier_kingdom }
			#		NOT = {
			#			exists = global_var:university_visit_k
			#		}
			#	}
			#	set_global_variable = {
			#		name = university_visit_k
			#		value = 1
			#	}
			#}
			#else_if = {
			#	limit = {
			#		scope:host = { highest_held_title_tier >= tier_kingdom }
			#	}
			#	change_global_variable = {
			#		name = university_visit_k
			#		add = 1
			#	}
			#}
		
		scope:host = {
			if = {
				limit = {
					has_character_flag = teacher_1
				}
				remove_character_flag = teacher_1
			}
			if = {
				limit = {
					has_character_flag = teacher_2
				}
				remove_character_flag = teacher_2
			}
			if = {
				limit = {
					has_character_flag = student_1
				}
				remove_character_flag = student_1
			}
			if = {
				limit = {
					has_character_flag = student_2
				}
				remove_character_flag = student_2
			}
		}
		scope:activity ?= {
			#Counter for the Activity Success Progress bar
			activity_setup_special_type_progression_effect = yes
			if = {
				limit = {
					has_activity_option = {
						category = adult_education_option_books
						option = adult_education_books_normal
					}
				}
				activity_special_type_progression_tiny = yes
			}
			else_if = {
				limit = {
					has_activity_option = {
						category = adult_education_option_books
						option = adult_education_books_good
					}
				}
				activity_special_type_progression_major = yes
			}
			if = { # EP3: If you attend the Pandidakterion, and is from the same realm, you get a starting success bonus
				limit = {
					activity_location.county = { has_county_modifier = pandidakterion_university_modifier }
					scope:host.top_liege = scope:activity.activity_location.county.holder.top_liege
				}
				activity_special_type_progression_major = yes
			}
			if = { # TGP: If you educate yourself at the capital while it is improved, you get a starting success bonus
				limit = {
					activity_location.county = { has_county_modifier = tgp_strengthen_capital_modifier }
				}
				activity_special_type_progression_major = yes
			}
			activity_location = { save_scope_as = location }
		}
	}
	
	on_enter_travel_state = {
	
	}

	on_travel_state_pulse = {
		
	}

	on_enter_passive_state = {
		
	}

	on_passive_state_pulse = { }

	on_enter_active_state = {
		surveyor_no_stone_unturned_perk_effect = yes
	}

	on_active_state_pulse = { }

	on_complete = {
		#Conclusion/reward event is run in the phase on_end
		hidden_effect = {
			if = {
				limit = {
					scope:host = { is_ai = yes }
				}
				# To reduce inflaction of generic characters
				scope:activity = {
					every_attending_character = {
						limit = {
							OR = {
								has_character_flag = student_1
								has_character_flag = student_2
							}
							has_character_flag = generated_character_uni
						}
						silent_disappearance_effect = yes
					}
				}
			}
			else = {
				scope:activity = {
					every_attending_character = {
						limit = {
							has_character_flag = student_1
						}
						remove_character_flag = student_1
					}
					every_attending_character = {
						limit = {
							has_character_flag = student_2
						}
						remove_character_flag = student_2
					}
				}
			}
		}
	}

	###################
	# GRAPHICS
	###################

	# 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 = { #Rice Fields - If we have Paddy fields AND/or terraced hills
	#This goes before other terrain since it can override in many different terrains if built
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				terrain = farmlands
				OR = {
					terrain = terraced_hills
					has_building_or_higher = paddy_fields_01
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/tgp_rice_fields.dds"
		environment = "environment_tgp_rice_fields"
		ambience = "event:/DLC/EP4/SFX/Events/Event_Backgrounds/tgp_rice_fields"
	}

	background = { #Farmlands - East Asia
		trigger = {
			scope:host.location != scope:activity.activity_location
			scope:host.location = {
				terrain = farmlands
				culture = { has_graphical_east_asia_culture_group_trigger = yes }
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/tgp_farm_asia.dds"
		environment = "environment_tgp_farm_asia"
		ambience = "event:/DLC/EP4/SFX/Events/Event_Backgrounds/tgp_farm_asia"
	}
	
	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
	background = {	#Western-ish University
		trigger = {
			scope:host.location = scope:activity.activity_location
			scope:host.location = {
				OR = {
					culture = { has_graphical_western_culture_group_trigger = yes }
					culture = { has_graphical_norse_culture_group_trigger = yes }
					culture = { has_graphical_iberian_culture_group_trigger = yes }
					culture = { has_graphical_mediterranean_culture_group_trigger = yes }
					steppe_building_gfx_use_mediterranean_trigger = yes
					steppe_building_gfx_use_western_trigger = yes
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/bp2_university.dds"
		environment = "environment_bp2_university"
		ambience = "event:/SFX/Events/Backgrounds/BP2/bp2_university"
	}
	background = {	#East Asia - uses the examination picture
		trigger = {
			scope:host.location = scope:activity.activity_location
			scope:host.location = {
				OR = {
					culture = { has_graphical_east_asia_or_southeast_asia_group_trigger = yes }
					steppe_building_gfx_use_east_asian_trigger = yes
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/tgp_examination_room.dds"
		environment = "environment_tgp_examination_room"
		ambience = "event:/DLC/EP4/SFX/Events/Event_Backgrounds/tgp_examination_room"
	}
	background = {	#Indian garden
		trigger = {
			scope:host.location = scope:activity.activity_location
			scope:host.location = {
				OR = {
					culture ?= { has_graphical_india_culture_group_trigger = yes }
					steppe_building_gfx_use_indian_trigger = yes
				}
			}
		}
		texture = "gfx/interface/illustrations/event_scenes/bp2_indian_garden.dds"
		environment = "environment_bp2_garden_india_day"
		ambience = "event:/SFX/Events/Backgrounds/castle_garden_day"
	}
	background = {	#Fallback: Madrasa
		texture = "gfx/interface/illustrations/event_scenes/bp2_university_mena.dds"
		environment = environment_bp2_university_mena
		ambience = "event:/SFX/Events/Backgrounds/meetingchamber_western"
	}

	### Plug in widgets
	activity_window_widgets = {
		activity_special_type_progression = "activity_plugin_widgets_summary"
		artifact_rewards = "activity_plugin_widgets_conclusion"
		trait_rewards = "activity_plugin_widgets_conclusion"
	}

	window_characters = {
		
		teacher = {
			camera = camera_event_very_left_activity

			effect = {
				if = {
					limit = {
						scope:host.location = scope:activity.activity_location
					}
					every_attending_character = {
						limit = {
							has_character_flag = teacher_1
						}
						add_to_list = characters
					}
				}
			}

			scripted_animation = {
				triggered_animation = {
					trigger = {
						scope:host = {
							has_activity_intent = university_revelry_intent
						}
						scope:character = {
							NOR = {
								has_trait = lifestyle_reveler
								has_trait = drunkard
							}
						}
					}
					animation = { stress disapproval eyeroll }
				}
				triggered_animation = {
					trigger = {
						scope:host = {
							has_activity_intent = university_revelry_intent
						}
						scope:character = {
							OR = {
								has_trait = lifestyle_reveler
								has_trait = drunkard
							}
						}
					}
					animation = { laugh happiness }
				}
				#Fallback
				animation = happy_teacher
			}
		}
		
		student = {
			camera = camera_event_left

			effect = {
				if = {
					limit = {
						scope:host.location = scope:activity.activity_location
					}
					every_attending_character = {
						limit = {
							has_character_flag = student_1
						}
						add_to_list = characters
					}
				}
			}

			scripted_animation = {
				triggered_animation = {
					trigger = {
						OR = {
							scope:host = {
								has_activity_intent = university_revelry_intent
							}
							scope:character = {
								OR = {
									has_trait = drunkard
									has_trait = lifestyle_reveler
								}
							}
						}
					}
					animation = { wedding_drunk drink }
				}
				triggered_animation = {
					trigger = {
						scope:character = {
							NOR = {
								has_trait = drunkard
								has_trait = lifestyle_reveler
							}
						}
					}
					animation = { worry admiration beg }
				}
				#Fallback
				animation = chancellor
			}
		}
		
		noble_student = {
			camera = camera_event_center
			
			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:host = {
							has_activity_intent = university_revelry_intent
						}
					}
					animation = toast_goblet
				}			
				#Fallback
				animation = reading
			}
		}

		travel_noble_student = {
			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
			}
		}
		
		student = {
			camera = camera_event_left_forward

			effect = {
				if = {
					limit = {
						scope:host.location = scope:activity.activity_location
					}
					every_attending_character = {
						limit = {
							has_character_flag = student_2
						}
						add_to_list = characters
					}
				}
			}

			scripted_animation = {
				triggered_animation = {
					trigger = {
						OR = {
							scope:host = {
								has_activity_intent = university_revelry_intent
							}
							scope:character = {
								OR = {
									has_trait = drunkard
									has_trait = lifestyle_reveler
								}
							}
						}
					}
					animation = { flirtation drink_goblet }
				}
				triggered_animation = {
					trigger = {
						scope:character = {
							NOR = {
								has_trait = drunkard
								has_trait = lifestyle_reveler
							}
						}
					}
					animation = { stress happiness shame }
				}
				#Fallback
				animation = chancellor
			}
		}
		
		teacher = {
			camera = camera_event_very_right_activity

			effect = {
				if = {
					limit = {
						scope:host.location = scope:activity.activity_location
					}
					every_attending_character = {
						limit = {
							has_character_flag = teacher_2
						}
						add_to_list = characters
					}
				}
			}

			scripted_animation = {
				triggered_animation = {
					trigger = {
						scope:host = {
							has_activity_intent = university_revelry_intent
						}
						scope:character = {
							NOR = {
								has_trait = lifestyle_reveler
								has_trait = drunkard
							}
						}
					}
					animation = stressed_teacher
				}
				triggered_animation = {
					trigger = {
						scope:host = {
							has_activity_intent = university_revelry_intent
						}
						scope:character = {
							OR = {
								has_trait = lifestyle_reveler
								has_trait = drunkard
							}
						}
					}
					animation = { happy_teacher }
				}
				#Fallback
				animation = throne_room_writer
			}
		}
	}
}
