namespace = bp3_survey

### Setup Events 
# Arrival Event
bp3_survey.0005 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.0005.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { root != root }
				desc = bp3_survey.0005.desc.holder
			}
			desc = bp3_survey.0005.desc.no_holder
		}
	}
	theme = survey_activity

	override_background = {
		reference = study
	}
	
	left_portrait = {
		character = scope:host
		triggered_animation = {
			trigger = {
				government_allows = merit
			}
			animation = holding_scrolls
		}
		animation = pondering
		camera = camera_event_group_talking_left_left
	}

	right_portrait = {
		trigger = { scope:host != scope:county_holder }
		character = scope:county_holder
		animation = obsequious_bow
	}

	immediate = {
		if = {
			limit = {
				location.county.holder != root
			}
			location.county.holder = {
				save_scope_as = county_holder
				save_opinion_value_as = {
					name = county_holder_opinion
					target = root
				}
				trigger_event = bp3_survey.0050
			}
		}
		else = { save_scope_as = county_holder }
	}

	option = { 
		name = bp3_survey.0005.a
		trigger = {
			location.county = {
				any_neighboring_county = {
					exists = holder
					holder.top_liege != root.location.county.holder.top_liege
				}
			}
		}
		custom_tooltip = bp3_survey.0005.a.tt
		set_variable = inspection_activity_border_focus
	}

	option = {
		name = bp3_survey.0005.b
		custom_tooltip = bp3_survey.0005.b.tt
		set_variable = inspection_activity_bureaucracy_focus
	}

	option = {
		name = bp3_survey.0005.c
		custom_tooltip = bp3_survey.0005.c.tt
		set_variable = inspection_activity_domain_focus
	}
}

# Ending Event
bp3_survey.0010 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.0010.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:success
					has_variable = inspection_activity_border_focus
				}
				desc = bp3_survey.0010.desc.border.success
			}
			triggered_desc = {
				trigger = {
					has_variable = inspection_activity_border_focus
				}
				desc = bp3_survey.0010.desc.border.failure
			}
			triggered_desc = {
				trigger = {
					exists = scope:success
					has_variable = inspection_activity_bureaucracy_focus
				}
				desc = bp3_survey.0010.desc.bureaucracy.success
			}
			triggered_desc = {
				trigger = {
					has_variable = inspection_activity_bureaucracy_focus
				}
				desc = bp3_survey.0010.desc.bureaucracy.failure
			}
			triggered_desc = {
				trigger = {
					exists = scope:success
					has_variable = inspection_activity_domain_focus
				}
				desc = bp3_survey.0010.desc.people.success
			}
			triggered_desc = {
				trigger = {
					has_variable = inspection_activity_domain_focus
				}
				desc = bp3_survey.0010.desc.people.failure
			}
		}
	}
	theme = survey_activity

	override_background = {
		reference = study
	}
	
	left_portrait = {
		character = scope:host
		triggered_animation = {
			trigger = {
				exists = scope:success
				government_allows = merit
			}
			animation = toast_goblet
		}
		triggered_animation = {
			trigger = {
				exists = scope:success
			}
			animation = toast
		}
		triggered_animation = {
			trigger = {
				NOT = { exists = scope:success }
			}
			animation = disapproval
		}
	}

	right_portrait = {
		character = scope:county_holder
		triggered_animation = {
			trigger = {
				exists = scope:success
			}
			animation = drink
		}
		triggered_animation = {
			trigger = {
				NOT = { exists = scope:success }
			}
			animation = disappointed
		}
	}

	immediate = {
		location = { save_scope_as = inspection_province }
		location.county = { save_scope_as = inspection_location }
		random = { # Check if Activity was a success or not
			chance = root.involved_activity.var:inspection_success_chance

			save_scope_value_as = {
				name = success
				value = yes
			}
		}
		scope:inspection_location.holder = { # Save the holder, if not liege, for Opinion check and for animation
			if = {
				limit = {
					this != root
				}
				save_scope_as = county_holder
			}
		}
		if = { # Save data needed for Claims/Vassal Acceptance, if you have the border focus
			limit = {
				has_variable = inspection_activity_border_focus
			}
			scope:inspection_location = {
				random_neighboring_county = {
					limit = {
						exists = holder
						holder.top_liege = root.location.county.holder.top_liege
						NOT = {
							holder = { 
								OR = {
									is_vassal_of = root
									this = root
								}
							}
						}
					}
					save_scope_as = claim_location
				}
				every_neighboring_county = {
					limit = {
						holder.top_liege != root.top_liege
						holder.top_liege.highest_held_title_tier < root.highest_held_title_tier
					}
					holder = { add_to_list = independent_rulers }
				}
			}
		}
	}

	option = {
		name = bp3_survey.0010.a
		trigger = {
			exists = scope:success
		}
		add_legitimacy_effect = { LEGITIMACY = minor_legitimacy_gain }
		inspection_survey_intent_development = { VALUE = 15 }
		if = { # If you have a Border Focus (Claims/Acceptance)
			limit = {
				has_variable = inspection_activity_border_focus
			}
			### Claims
			if = { # Focused on Claims
				limit = {
					has_variable = inspection_activity_border_claim_focus
				}
				scope:inspection_location = {
					every_neighboring_county = {
						limit = {
							holder.top_liege != root.top_liege
							OR = {
								NOT = { root = { has_claim_on = prev } }
								NOT = { root = { has_claim_on = prev.duchy } }
							}
						}
						scope:activity = {
							add_activity_log_entry = {
								key = inspection_conclusion_success_claim_key
								show_in_conclusion = yes
								character = root
								prev = {
									inspection_claim_effects = {
										ACTOR = root
										TARGET = prev
										TYPE = pressed
									}
									inspection_claim_effects = {
										ACTOR = root
										TARGET = prev.duchy
										TYPE = pressed
									}
								}
							}
						}
					}
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_conclusion_expansionist_mindset_key
						show_in_conclusion = yes
						character = root
						root = {
							add_character_modifier = {
								modifier = inspection_reward_focused_claims_modifier
								years = 15
							}
						}
					}
				}
			}
			else = { # Not focused on Claims
				scope:claim_location.duchy = {
					if = {
						limit = {
							NOT = {
								root = { has_claim_on = prev }
							}
						}
						scope:activity = {
							add_activity_log_entry = {
								key = inspection_conclusion_success_claim_key
								show_in_conclusion = yes
								character = root
								prev = {
									inspection_claim_effects = {
										ACTOR = root
										TARGET = prev
										TYPE = unpressed
									}
								}
							}
						}
					}
				}
			}
			### Vassal Acceptance
			if = { # Focused on Vassal Acceptance
				limit = {
					has_variable = inspection_activity_border_vassal_focus
					any_in_list = {
						list = independent_rulers
						count > 0
					}
				}
				every_in_list = {
					list = independent_rulers
					scope:activity = {
						add_activity_log_entry = {
							key = inspection_conclusion_success_acceptance_key
							show_in_conclusion = yes
							character = root
							prev = { custom_tooltip = bp3_survey.0010.acceptance.success }
						}
					}
					add_to_variable_list = {
						name = inspection_reward
						target = root
						years = 15
					}
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_conclusion_impressed_neighbors_key
						show_in_conclusion = yes
						character = root
						root = {
							add_character_modifier = {
								modifier = inspection_reward_focused_vassal_acceptance
								years = 15
							}
						}
					}
				}
			}
			else_if = { # Not focused on Vassal Acceptance
				limit = {
					any_in_list = {
						list = independent_rulers
						count > 0
					}
				}
				random_in_list = {
					list = independent_rulers
					scope:activity = {
						add_activity_log_entry = {
							key = inspection_conclusion_success_acceptance_key
							show_in_conclusion = yes
							character = root
							prev = { custom_tooltip = bp3_survey.0010.acceptance.success }
						}
					}
					add_to_variable_list = {
						name = inspection_reward
						target = root
						years = 15
					}
				}
			}
		}
		else_if = { # If you have Bureaucracy Focus (Tax/Development/Control)
			limit = {
				has_variable = inspection_activity_bureaucracy_focus
			}
			if = { # Focused on Taxes
				limit = {
					has_variable = inspection_activity_bureaucracy_tax_focus
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_conclusion_success_tax_key
						show_in_conclusion = yes
						character = root
						scope:inspection_province = {
							add_province_modifier = {
								modifier = inspection_reward_focused_tax_modifier
								years = 15
							}
						}
						root = { add_treasury_or_gold = medium_treasury_or_gold_value }
					}
				}
				inspection_survey_local_message_province_modifier = {
					TYPE = message_good
					MODIFIER = inspection_reward_focused_tax_modifier
					YEARS = 15
				}
			}
			else = { # Not focused on Taxes
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_conclusion_success_tax_key
						show_in_conclusion = yes
						character = root
						scope:inspection_province = {
							add_province_modifier = {
								modifier = inspection_reward_average_tax_modifier
								years = 15
							}
						}
					}
				}
				inspection_survey_local_message_province_modifier = {
					TYPE = message_good
					MODIFIER = inspection_reward_average_tax_modifier
					YEARS = 15
				}
			}
			if = { # Focused on Development
				limit = {
					has_variable = inspection_activity_bureaucracy_development_focus
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_conclusion_success_development_key
						show_in_conclusion = yes
						character = root
						scope:inspection_location = {
							add_county_modifier = {
								modifier = inspection_reward_focused_development_modifier
								years = 15
							}
							change_development_progress_with_overflow = 50 
						}
					}
				}
				inspection_survey_local_message_county_modifier = {
					TYPE = message_good
					MODIFIER = inspection_reward_focused_development_modifier
					YEARS = 15
				}
			}
			else = { # Not focused on Development
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_conclusion_success_development_key
						show_in_conclusion = yes
						character = root
						scope:inspection_location = { 
							change_development_progress_with_overflow = 25 
						}
					}
				}
			}
			if = { # Focused on Control
				limit = {
					has_variable = inspection_activity_bureaucracy_control_focus
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_conclusion_success_control_key
						show_in_conclusion = yes
						character = root
						scope:inspection_location = {
							add_county_modifier = {
								modifier = inspection_reward_focused_control_modifier
								years = 15
							}
							change_county_control = 10
						}
					}
				}
				inspection_survey_local_message_county_modifier = {
					TYPE = message_good
					MODIFIER = inspection_reward_focused_control_modifier
					YEARS = 15
				}
			}
			else_if = { # Not focused on Control
				limit = {
					scope:inspection_location.county_control < 100
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_conclusion_success_control_key
						show_in_conclusion = yes
						character = root
						scope:inspection_location = { change_county_control = 5 }
					}
				}
			}
		}
		else_if = { # If you have People Focus (Levy/Opinion/Popular Opinion)
			limit = {
				has_variable = inspection_activity_domain_focus
			}
			if = { # Focused on Levies
				limit = {
					has_variable = inspection_activity_domain_levy_focus
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_conclusion_success_levy_key
						show_in_conclusion = yes
						character = root
						scope:inspection_location = {
							add_county_modifier = {
								modifier = inspection_reward_focused_levy_modifier
								years = 15
							}
						}
						root = {
							spawn_army = {
								name = local_militia_name_default
								levies = inspection_levy_reward_value
								location = scope:inspection_location.title_province
								inheritable = no
								war_keep_on_attacker_victory = yes
							}
						}
					}
				}
				inspection_survey_local_message_county_modifier = {
					TYPE = message_good
					MODIFIER = inspection_reward_focused_levy_modifier
					YEARS = 15
				}
			}
			else = { # Not focused on Levies
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_conclusion_success_levy_key
						show_in_conclusion = yes
						character = root
						scope:inspection_location = {
							add_county_modifier = {
								modifier = inspection_reward_average_levy_modifier
								years = 15
							}
						}
					}
				}
				inspection_survey_local_message_county_modifier = {
					TYPE = message_good
					MODIFIER = inspection_reward_average_levy_modifier
					YEARS = 15
				}
			}
			if = { # Focused on Opinion
				limit = {
					has_variable = inspection_activity_domain_opinion_focus
				}
				if = {
					limit = {
						exists = root
					}
					scope:activity = {
						add_activity_log_entry = {
							key = inspection_conclusion_success_opinion_key
							show_in_conclusion = yes
							character = root
							root = {
								add_opinion = {
									modifier = friendliness_opinion
									target = root
									opinion = 20
								}
							}
							root = {
								add_character_modifier = {
									modifier = inspection_reward_focused_opinion_modifier
									years = 15
								}
							}
						}
					}
				}
				else = {
					scope:activity = {
						add_activity_log_entry = {
							key = inspection_conclusion_success_opinion_key
							show_in_conclusion = yes
							character = root
							root = {
								add_character_modifier = {
									modifier = inspection_reward_focused_opinion_modifier
									years = 15
								}
							}
						}
					}
				}
			}
			else_if = { # Not focused on Opinion
				limit = {
					exists = root
					exists = scope:county_holder
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_conclusion_success_opinion_key
						show_in_conclusion = yes
						character = root
						root = {
							reverse_add_opinion = {
								modifier = friendliness_opinion
								target = scope:county_holder
								opinion = 10
							}
						}
					}
				}
			}
			if = { # Focused on Popular Opinion
				limit = {
					has_variable = inspection_activity_domain_popular_focus
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_conclusion_success_popular_opinion_key
						show_in_conclusion = yes
						character = root
						scope:inspection_location = {
							add_county_modifier = {
								modifier = inspection_reward_focused_popular_opinion_modifier
								years = 15
							}
						}
						root = {
							add_character_modifier = {
								modifier = inspection_reward_focused_popular_opinion_character_modifier
								years = 15
							}
						}
					}
				}
			}
			else = { # Not focused on Popular Opinion
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_conclusion_success_popular_opinion_key
						show_in_conclusion = yes
						character = root
						scope:inspection_location = {
							add_county_modifier = {
								modifier = inspection_reward_average_popular_opinion_modifier
								years = 15
							}
						}
					}
				}
			}
		}
		
		# As an admin governor, gain some governor trait XP
		if = {
			limit = { is_governor = yes }
			scope:activity = {
				add_activity_log_entry = {
					key = inspection_conclusion_success_governor_experience_key
					show_in_conclusion = yes
					character = root
					root = { increase_governance_effect = { VALUE = 10 } }
				}
			}
		}

		# If you have Merit we give Merit
		if = {
			limit = { government_allows = merit }
			scope:activity = {
				add_activity_log_entry = {
					key = inspection_conclusion_success_merit_key
					show_in_conclusion = yes
					character = root
					root = {
						change_merit = {
							value = major_merit_gain
							house ?= {
								if = {
									limit = { has_house_power_parameter = inspection_activity_merit_bonus_5 }
									multiply = {
										value = 1
										add = inspection_activity_merit_bonus_5_value
									}
								}
								else_if = {
									limit = { has_house_power_parameter = inspection_activity_merit_bonus_4 }
									multiply = {
										value = 1
										add = inspection_activity_merit_bonus_4_value
									}
								}
								else_if = {
									limit = { has_house_power_parameter = inspection_activity_merit_bonus_3 }
									multiply = {
										value = 1
										add = inspection_activity_merit_bonus_3_value
									}
								}
								else_if = {
									limit = { has_house_power_parameter = inspection_activity_merit_bonus_2 }
									multiply = {
										value = 1
										add = inspection_activity_merit_bonus_2_value
									}
								}
								else_if = {
									limit = { has_house_power_parameter = inspection_activity_merit_bonus_1 }
									multiply = {
										value = 1
										add = inspection_activity_merit_bonus_1_value
									}
								}
							}
						}
					}
				}
			}
		}

		# If you have the governance aspiration, you gain some gold and a higher salary
		if = {
			limit = {
				house ?= { has_house_power_parameter = inspection_activity_increases_salary }
			}
			scope:activity = {
				add_activity_log_entry = {
					key = inspection_conclusion_success_salary_key
					show_in_conclusion = yes
					character = root
					root = {
						add_gold = medium_gold_value
						add_character_modifier = {
							modifier = tgp_aspiration_great_salary_modifier
							years = 15
						}
						hidden_effect = {
							if = {
								limit = {
									has_character_modifier = tgp_aspiration_modest_salary_modifier
								}
								remove_character_modifier = tgp_aspiration_modest_salary_modifier
							}
						}
					}
				}
			}
		}

		if = { #Devotion for tenet
			limit = {
				faith = { has_doctrine_parameter = inspection_gives_devotion }
			}
			scope:activity = {
				add_activity_log_entry = {
					key = inspection_conclusion_success_piety_key
					show_in_conclusion = yes
					character = root
					root = {
						add_piety_experience = medium_piety_value
					}
				}
			}
		}
		
		hidden_effect = {
			scope:province = {
				remove_province_modifier = inspection_second_try_modifier
				remove_province_modifier = inspection_third_try_modifier
				remove_province_modifier = inspection_fourth_try_modifier
			}
		}
	}

	option = {
		name = bp3_survey.0010.b
		trigger = {
			NOT = { exists = scope:success }
		}
		add_legitimacy_effect = { LEGITIMACY = miniscule_legitimacy_gain }
		scope:province = {
			if = {
				limit = {
					root = { is_ai = no }
					NOT = {
						has_province_modifier = inspection_fourth_try_modifier
					}
				}
				if = {
					limit = {
						has_province_modifier = inspection_third_try_modifier
						NOT = { has_province_modifier = inspection_fourth_try_modifier }
					}
					add_province_modifier = inspection_fourth_try_modifier
					hidden_effect = {
						remove_province_modifier = inspection_third_try_modifier
					}
				}
				else_if = {
					limit = {
						has_province_modifier = inspection_second_try_modifier
						NOT = { has_province_modifier = inspection_third_try_modifier }
					}
					add_province_modifier = inspection_third_try_modifier
					hidden_effect = {
						remove_province_modifier = inspection_second_try_modifier
					}
				}
				else_if = {
					limit = {
						NOT = { has_province_modifier = inspection_second_try_modifier }
					}
					add_province_modifier = inspection_second_try_modifier
				}
			}
		}

		if = {
			limit = {
				faith = { has_doctrine_parameter = inspection_gives_devotion } #Devotion for tenet
			}
			scope:activity = {
				add_activity_log_entry = {
					key = inspection_conclusion_failure_devotion_key
					show_in_conclusion = yes
					character = root
					root = {
						add_piety_experience = minor_piety_value
					}
				}
			}
		}
		
		# If you have Merit we give Merit - but you gain less than if you were successful
		if = {
			limit = { government_allows = merit }
			scope:activity = {
				add_activity_log_entry = {
					key = inspection_conclusion_failure_merit_key
					show_in_conclusion = yes
					character = root
					root = {
						change_merit = {
							value = minor_merit_gain
							house ?= {
								if = {
									limit = { has_house_power_parameter = inspection_activity_merit_bonus_5 }
									multiply = {
										value = 1
										add = inspection_activity_merit_bonus_5_value
									}
								}
								else_if = {
									limit = { has_house_power_parameter = inspection_activity_merit_bonus_4 }
									multiply = {
										value = 1
										add = inspection_activity_merit_bonus_4_value
									}
								}
								else_if = {
									limit = { has_house_power_parameter = inspection_activity_merit_bonus_3 }
									multiply = {
										value = 1
										add = inspection_activity_merit_bonus_3_value
									}
								}
								else_if = {
									limit = { has_house_power_parameter = inspection_activity_merit_bonus_2 }
									multiply = {
										value = 1
										add = inspection_activity_merit_bonus_2_value
									}
								}
								else_if = {
									limit = { has_house_power_parameter = inspection_activity_merit_bonus_1 }
									multiply = {
										value = 1
										add = inspection_activity_merit_bonus_1_value
									}
								}
							}
						}
					}
				}
			}
		}

		# If you have the governance aspiration, you gain some gold and a higher salary - but less than if you were successful
		if = {
			limit = {
				house ?= { has_house_power_parameter = inspection_activity_increases_salary }
			}
			scope:activity = {
				add_activity_log_entry = {
					key = inspection_conclusion_failure_salary_key
					show_in_conclusion = yes
					character = root
					root = {
						add_gold = minor_gold_value
						add_character_modifier = {
							modifier = tgp_aspiration_modest_salary_modifier
							years = 15
						}
						hidden_effect = {
							if = {
								limit = {
									has_character_modifier = tgp_aspiration_great_salary_modifier
								}
								remove_character_modifier = tgp_aspiration_great_salary_modifier
							}
						}
					}
				}
			}
		}
	}
}

### Mid Events
# Border Focus
bp3_survey.0020 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.0020.t
	desc = {
		desc = bp3_survey.0020.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:neighboring_lord
				}
				desc = bp3_survey.0020.desc_weak_neighbor
			}
			desc = bp3_survey.0020.desc_no_neighbor
		}
	}
	theme = survey_activity

	override_background = {
		reference = terrain_activity
	}
	
	left_portrait = {
		character = scope:host
		animation = survey
	}

	right_portrait = {
		character = scope:neighboring_lord
		animation = worry
	}

	trigger = {
		has_variable = inspection_activity_border_focus
	}

	immediate = {
		scope:province.county = {
			random_neighboring_county = {
				limit = {
					holder.top_liege != prev.holder.top_liege
				}
				weight = {
					base = 1
					modifier = {
						factor = 100
						holder.top_liege = {
							highest_held_title_tier < root.highest_held_title_tier
						}
					}
				}
				save_scope_as = neighboring_county
				if = {
					limit = {
						holder.top_liege = {
							highest_held_title_tier < root.highest_held_title_tier
						}
					}
					holder = { save_scope_as = neighboring_lord }
				}
			}
		}
	}

	option = { 
		name = bp3_survey.0020.a
		trigger = {
			exists = scope:neighboring_lord
		}
		skill = diplomacy
		custom_tooltip = bp3_survey.0020.a.tt
		set_variable = inspection_activity_border_vassal_focus
		duel = {
			skill = diplomacy
			value = 8
			20 = {
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1.5
					min = -19
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_border_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_survey_intent_development = { VALUE = 10 }
							inspection_success_chance_change_effect = { CHANGE = increase_medium }
							custom_tooltip = bp3_survey.0020.acceptance.great_success
						}
					}
				}
				scope:neighboring_lord = {
					add_to_variable_list = {
						name = inspection_bonus
						target = root
						years = 5
					}
				}
			}
			40 = {
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -39
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_border_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_survey_intent_development = { VALUE = 5 }
							inspection_success_chance_change_effect = { CHANGE = increase_minor }
							custom_tooltip = bp3_survey.0020.acceptance.success
						}
					}
				}
				scope:neighboring_lord = {
					add_to_variable_list = {
						name = lesser_inspection_bonus
						target = root
						years = 5
					}
				}
			}
			40 = {
				inspection_activity_options_negative_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -29
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_border_fail_key
						show_in_conclusion = yes
						character = root
						inspection_success_chance_change_effect = { CHANGE = decrease_minor }
					}
				}
			}
		}
	}

	option = {
		name = bp3_survey.0020.b
		skill = intrigue
		custom_tooltip = bp3_survey.0020.b.tt
		set_variable = inspection_activity_border_claim_focus
		duel = {
			skill = intrigue
			value = 8
			20 = {
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1.5
					min = -19
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_border_key
						show_in_conclusion = yes
						character = root
						inspection_success_chance_change_effect = { CHANGE = increase_medium }
						root = { 
							inspection_survey_intent_development = { VALUE = 10 }
							add_pressed_claim = scope:neighboring_county 
						}
					}
				}
			}
			40 = {
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -39
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_border_key
						show_in_conclusion = yes
						character = root
						inspection_success_chance_change_effect = { CHANGE = increase_minor }
						root = { 
							inspection_survey_intent_development = { VALUE = 5 }
							add_unpressed_claim = scope:neighboring_county 
						}
					}
				}
			}
			40 = {
				inspection_activity_options_negative_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -29
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_border_fail_key
						show_in_conclusion = yes
						character = root
						inspection_success_chance_change_effect = { CHANGE = decrease_minor }
					}
				}
			}
		}
	}
}

# Bureaucracy Focus
bp3_survey.0030 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.0030.t
	desc = bp3_survey.0030.desc
	theme = survey_activity

	override_background = {
		reference = study
	}
	
	left_portrait = {
		character = scope:host
		animation = writing
	}

	trigger = {
		has_variable = inspection_activity_bureaucracy_focus
	}

	option = { 
		name = bp3_survey.0030.a
		skill = stewardship
		custom_tooltip = bp3_survey.0030.a.tt
		set_variable = inspection_activity_bureaucracy_tax_focus
		duel = {
			skill = stewardship
			value = 8
			20 = {
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1.5
					min = -19
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_domain_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_survey_intent_development = { VALUE = 10 }
							inspection_success_chance_change_effect = { CHANGE = increase_medium }
						}
						scope:province.county = {
							add_county_modifier = {
								modifier = inspection_mid_activity_tax_great_modifier
								years = 10
							}
						}
					}
				}
				inspection_survey_local_message_county_modifier = {
					TYPE = message_good
					MODIFIER = inspection_mid_activity_tax_great_modifier
					YEARS = 10
				}
			}
			40 = {
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -39
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_domain_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_survey_intent_development = { VALUE = 5 }
							inspection_success_chance_change_effect = { CHANGE = increase_minor }
						}
						scope:province.county = {
							add_county_modifier = {
								modifier = inspection_mid_activity_tax_average_modifier
								years = 10
							}
						}
					}
				}
				inspection_survey_local_message_county_modifier = {
					TYPE = message_good
					MODIFIER = inspection_mid_activity_tax_average_modifier
					YEARS = 10
				}
			}
			40 = {
				inspection_activity_options_negative_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -29
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_domain_fail_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_success_chance_change_effect = { CHANGE = decrease_minor }
						}
					}
				}
			}
		}
	}

	option = {
		name = bp3_survey.0030.b
		skill = learning
		custom_tooltip = bp3_survey.0030.b.tt
		set_variable = inspection_activity_bureaucracy_development_focus
		duel = {
			skill = learning
			value = 8
			20 = {
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1.5
					min = -19
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_domain_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_survey_intent_development = { VALUE = 10 }
							inspection_success_chance_change_effect = { CHANGE = increase_medium }
						}
						scope:province.county = {
							add_county_modifier = {
								modifier = inspection_mid_activity_development_great_modifier
								years = 10
							}
						}
					}
				}
				inspection_survey_local_message_county_modifier = {
					TYPE = message_good
					MODIFIER = inspection_mid_activity_development_great_modifier
					YEARS = 10
				}
			}
			40 = {
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -39
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_domain_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_survey_intent_development = { VALUE = 5 }
							inspection_success_chance_change_effect = { CHANGE = 
							increase_minor }
						}
						scope:province.county = {
							add_county_modifier = {
								modifier = inspection_mid_activity_development_average_modifier
								years = 10
							}
						}
					}
				}
				inspection_survey_local_message_county_modifier = {
					TYPE = message_good
					MODIFIER = inspection_mid_activity_development_average_modifier
					YEARS = 10
				}
			}
			40 = {
				inspection_activity_options_negative_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -29
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_domain_fail_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_success_chance_change_effect = { CHANGE = decrease_minor }
						}
					}
				}
			}
		}
	}

	option = {
		name = bp3_survey.0030.c
		trigger = {
			scope:province.county = {
				county_control < 100
			}
		}
		skill = martial
		custom_tooltip = bp3_survey.0030.c.tt
		set_variable = inspection_activity_bureaucracy_control_focus
		duel = {
			skill = martial
			value = 8
			20 = {
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1.5
					min = -19
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_domain_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_survey_intent_development = { VALUE = 10 }
							inspection_success_chance_change_effect = { CHANGE = increase_medium }
						}
						scope:province.county = {
							add_county_modifier = {
								modifier = inspection_mid_activity_control_great_modifier
								years = 10
							}
						}
					}
				}
				inspection_survey_local_message_county_modifier = {
					TYPE = message_good
					MODIFIER = inspection_mid_activity_control_great_modifier
					YEARS = 10
				}
			}
			40 = {
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -39
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_domain_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_survey_intent_development = { VALUE = 5 }
							inspection_success_chance_change_effect = { CHANGE = increase_minor }
						}
						scope:province.county = {
							add_county_modifier = {
								modifier = inspection_mid_activity_control_average_modifier
								years = 10
							}
						}
					}
				}
				inspection_survey_local_message_county_modifier = {
					TYPE = message_good
					MODIFIER = inspection_mid_activity_control_average_modifier
					YEARS = 10
				}
			}
			40 = {
				inspection_activity_options_negative_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -29
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_domain_fail_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_success_chance_change_effect = { CHANGE = decrease_minor }
						}
					}
				}
			}
		}
	}

	option = {
		name = bp3_survey.0030.d
		scope:activity = {
			add_activity_log_entry = {
				key = inspection_mid_domain_selfish_key
				show_in_conclusion = yes
				character = root
				inspection_success_chance_change_effect = { CHANGE = decrease_minor }
				root = { add_gold = minor_gold_value }
			}
		}
	}
}

# Domain Focus
bp3_survey.0040 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.0040.t
	desc = {
		desc = bp3_survey.0040.desc
		triggered_desc = {
			trigger = {
				exists = scope:county_holder
			}
			desc = bp3_survey.0040.mid
		}
		desc = bp3_survey.0040.outro
	}
	theme = survey_activity

	override_background = {
		reference = market
	}

	center_portrait = {
		character = scope:county_holder
		animation = boredom
	}

	left_portrait = {
		character = scope:host
		animation = debating
	}

	right_portrait = {
		character = scope:peasant
		animation = thinking
		hide_info = yes
	}

	override_effect_2d = {
		reference = legend_glow
	}

	trigger = {
		has_variable = inspection_activity_domain_focus
	}

	immediate = {
		if = {
			limit = {
				scope:province.province_owner != root
			}
			scope:province.province_owner = {
				save_scope_as = county_holder
			}
		}
		create_character = {
			location = scope:province
			template = generic_peasant_character
			save_scope_as = peasant
		}
	}

	option = { 
		name = bp3_survey.0040.a
		skill = martial
		custom_tooltip = bp3_survey.0040.a.tt
		set_variable = inspection_activity_domain_levy_focus
		duel = {
			skill = martial
			value = 8
			20 = {
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1.5
					min = -19
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_people_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_survey_intent_development = { VALUE = 10 }
							inspection_success_chance_change_effect = { CHANGE = increase_medium }
						}
						scope:province.county = {
							add_county_modifier = {
								modifier = inspection_mid_activity_levy_great_modifier
								years = 10
							}
						}
					}
				}
				inspection_survey_local_message_county_modifier = {
					TYPE = message_good
					MODIFIER = inspection_mid_activity_levy_great_modifier
					YEARS = 10
				}
			}
			40 = {
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -39
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_people_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_survey_intent_development = { VALUE = 5 }
							inspection_success_chance_change_effect = { CHANGE = increase_minor }
						}
						scope:province.county = {
							add_county_modifier = {
								modifier = inspection_mid_activity_levy_average_modifier
								years = 10
							}
						}
					}
				}
				inspection_survey_local_message_county_modifier = {
					TYPE = message_good
					MODIFIER = inspection_mid_activity_levy_average_modifier
					YEARS = 10
				}
			}
			40 = {
				inspection_activity_options_negative_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -29
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_people_fail_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_success_chance_change_effect = { CHANGE = decrease_minor }
						}
					}
				}
			}
		}
	}

	option = {
		name = bp3_survey.0040.b
		trigger = {
			exists = scope:county_holder
		}
		skill = diplomacy
		custom_tooltip = bp3_survey.0040.b.tt
		set_variable = inspection_activity_domain_opinion_focus
		duel = {
			skill = diplomacy
			value = 8
			20 = {
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1.5
					min = -19
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_people_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_survey_intent_development = { VALUE = 10 }
							inspection_success_chance_change_effect = { CHANGE = increase_medium }
						}
						root = {
							add_opinion = {
								modifier = compliment_opinion
								target = root
								opinion = 20
							}
						}
					}
				}
			}
			40 = {
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -39
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_people_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_survey_intent_development = { VALUE = 5 }
							inspection_success_chance_change_effect = { CHANGE = increase_minor }
						}
						root = {
							add_opinion = {
								modifier = compliment_opinion
								target = root
								opinion = 10
							}
						}
					}
				}
			}
			40 = {
				inspection_activity_options_negative_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -29
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_people_fail_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_success_chance_change_effect = { CHANGE = decrease_minor }
						}
					}
				}
			}
		}
	}

	option = {
		name = bp3_survey.0040.c
		skill = stewardship
		custom_tooltip = bp3_survey.0040.c.tt
		set_variable = inspection_activity_domain_popular_focus
		duel = {
			skill = stewardship
			value = 8
			20 = {
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1.5
					min = -19
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_people_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_survey_intent_development = { VALUE = 10 }
							inspection_success_chance_change_effect = { CHANGE = increase_medium }
						}
						scope:province.county = {
							add_county_modifier = {
								modifier = inspection_mid_activity_opinion_great_modifier
								years = 10
							}
						}
					}
				}
				inspection_survey_local_message_county_modifier = {
					TYPE = message_good
					MODIFIER = inspection_mid_activity_opinion_great_modifier
					YEARS = 10
				}
			}
			40 = {
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -39
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_people_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_survey_intent_development = { VALUE = 5 }
							inspection_success_chance_change_effect = { CHANGE = increase_minor }
						}
						scope:province.county = {
							add_county_modifier = {
								modifier = inspection_mid_activity_opinion_average_modifier
								years = 10
							}
						}
					}
				}
				inspection_survey_local_message_county_modifier = {
					TYPE = message_good
					MODIFIER = inspection_mid_activity_opinion_average_modifier
					YEARS = 10
				}
			}
			40 = {
				inspection_activity_options_negative_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -29
				}
				scope:activity = {
					add_activity_log_entry = {
						key = inspection_mid_people_fail_key
						show_in_conclusion = yes
						character = root
						root = {
							inspection_success_chance_change_effect = { CHANGE = decrease_minor }
						}
					}
				}
			}
		}
	}

	after = {
		scope:peasant = {
			silent_disappear_ai_if_not_hired = yes
		}
	}
}

### Vassal Event
bp3_survey.0050 = {
	type = character_event
	content_source = dlc_015
	title = bp3_survey.0050.t
	desc = bp3_survey.0050.desc
	theme = survey_activity

	override_background = {
		reference = study
	}
	
	left_portrait = {
		character = scope:host
		animation = thinking
	}

	right_portrait = {
		character = root
		animation = obsequious_bow
	}

	immediate = {
		
	}

	option = { 
		name = bp3_survey.0050.a
		custom_tooltip = "bp3_survey.0050.a.tt"
	}
}

### Random Events ###
# Empty Lands
bp3_survey.1000 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.1000.t
	desc = {
		triggered_desc = {
			trigger = {
				exists = scope:guest_1
			}
			desc = bp3_survey.1000.desc
		}
		triggered_desc = {
			trigger = {
				NOT = { exists = scope:guest_1 }
			}
			desc = bp3_survey.1000.desc_lonely
		}
		desc = bp3_survey.1000.desc_continuation
		triggered_desc = {
			trigger = {
				has_variable = inspection_activity_border_focus
			}
			desc = bp3_survey.1000.desc_border
		}
		triggered_desc = {
			trigger = {
				has_variable = inspection_activity_bureaucracy_focus
			}
			desc = bp3_survey.1000.desc_bureaucracy
		}
		triggered_desc = {
			trigger = {
				has_variable = inspection_activity_domain_focus
			}
			desc = bp3_survey.1000.desc_domain
		}
	}
	theme = survey_activity

	override_background = {
		reference = terrain_scope
	}

	cooldown = { years = 1 }

	left_portrait = {
		character = root
		animation = survey
	}

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

	trigger = {
		scope:province.county = {
			any_county_province = {
				has_holding = no
				NOR = {
					has_province_modifier = inspection_empty_lands_border_modifier
					has_province_modifier = inspection_empty_lands_domain_modifier
				}
			}
		}
	}

	immediate = {
		inspection_survey_intent_county_modifier = { MODIFIER = inspection_survey_new_goods_modifier }
		scope:province.county = {
			random_county_province = {
				limit = {
					has_holding = no
				}
				save_scope_as = empty_province
				save_scope_as = background_terrain_scope
			}
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					this != root
				}
				weight = {
					base = 1
					modifier = {
						factor = 20
						OR = {
							is_close_family_of = root
							is_spouse_of = root
						}
					}
				}
				save_scope_as = guest_1
			}
		}
	}

	option = {
		name = bp3_survey.1000.a
		remove_treasury_or_gold = inspection_minor_gold
		scope:empty_province = {
			add_province_modifier = inspection_empty_lands_border_modifier
		}
		inspection_survey_local_message_permanent_province_modifier = {
			TYPE = message_good
			MODIFIER = inspection_empty_lands_border_modifier
		}

		# Success Chance changes
		inspection_success_chance_change_focus_effect = {
			FOCUS = border
			CHANGE = increase_medium
		}
		inspection_success_chance_change_focus_effect = {
			FOCUS = bureaucracy
			CHANGE = increase_minor
		}
		inspection_success_chance_change_focus_effect = {
			FOCUS = domain
			CHANGE = increase_minor
		}

		stress_impact = {
			greedy = minor_stress_gain
			overseer = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = greedy
			}
			modifier = {
				factor = 10
				has_variable = inspection_activity_border_focus
			}
			modifier = {
				factor = 5
				has_trait = overseer
			}
		}
	}

	option = {
		name = bp3_survey.1000.b
		remove_treasury_or_gold = tiny_treasury_or_gold_value
		scope:empty_province = {
			add_province_modifier = inspection_empty_lands_domain_modifier
		}
		inspection_survey_local_message_permanent_province_modifier = {
			TYPE = message_good
			MODIFIER = inspection_empty_lands_domain_modifier
		}

		# Success Chance changes
		inspection_success_chance_change_focus_effect = {
			FOCUS = bureaucracy
			CHANGE = increase_medium
		}
		inspection_success_chance_change_not_focus_effect = {
			FOCUS = bureaucracy
			CHANGE = decrease_minor
		}

		stress_impact = {
			greedy = minor_stress_gain
			administrator = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = greedy
			}
			modifier = {
				factor = 10
				has_variable = inspection_activity_bureaucracy_focus
			}
			modifier = {
				factor = 5
				has_trait = administrator
			}
		}
	}

	option = {
		name = bp3_survey.1000.c
		add_prestige = minor_prestige_gain
		scope:empty_province = {
			add_province_modifier = {
				modifier = inspection_empty_lands_populace_modifier
				years = 5
			}
		}
		inspection_survey_local_message_province_modifier = {
			TYPE = message_good
			MODIFIER = inspection_empty_lands_populace_modifier
			YEARS = 5
		}

		# Success Chance changes
		inspection_success_chance_change_focus_effect = {
			FOCUS = domain
			CHANGE = increase_medium
		}
		inspection_success_chance_change_focus_effect = {
			FOCUS = border
			CHANGE = increase_minor
		}
		inspection_success_chance_change_focus_effect = {
			FOCUS = bureaucracy
			CHANGE = decrease_minor
		}

		stress_impact = {
			gregarious = minor_stress_impact_loss
			reclusive = medium_stress_gain
			shy = medium_stress_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = reclusive
					has_trait = shy
				}
			}
			modifier = {
				factor = 10
				has_variable = inspection_activity_domain_focus
			}
			modifier = {
				factor = 5
				has_trait = gregarious
			}
		}
	}
}

# Bandits in <X>
bp3_survey.1010 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.1010.t
	desc = bp3_survey.1010.desc
	theme = survey_activity

	override_background = {
		reference = alley_day
	}
	
	cooldown = { years = 1 }

	left_portrait = {
		character = root
		animation = go_to_your_room
	}

	center_portrait = {
		character = scope:peasant_character
		animation = fear
		hide_info = yes
	}	

	right_portrait = {
		character = scope:bandit_character
		animation = celebrate_sword
		hide_info = yes
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 3
			scope:province.county = {
				county_control < 80
			}
		}
	}

	immediate = {
		inspection_survey_intent_control = { VALUE = 5 }
		create_character = {
			template = mercenary
			location = scope:province
			gender = root
			culture = scope:province.culture
			faith = scope:province.faith
			save_scope_as = bandit_character
		}
		create_character = {
			template = peasant_character
			location = scope:province
			gender = female
			culture = scope:province.culture
			faith = scope:province.faith
			save_scope_as = peasant_character
		}
	}

	option = {
		name = bp3_survey.1010.a
		duel = {
			skill = martial
			value = 12
			50 = {
				inspection_activity_options_positive_modifier = yes
				desc = bp3_survey.1010.a.win
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_message = {
					type = event_generic_good
					title = bp3_survey.1010.a.win_short

					add_prestige = medium_prestige_gain
					scope:province.county = {
						if = {
							limit = {
								has_county_modifier = inspection_bandits_in_x_border_negative_modifier
							}
							remove_county_modifier = inspection_bandits_in_x_border_negative_modifier
						}
						add_county_modifier = {
							modifier = inspection_bandits_in_x_border_positive_modifier
							years = 10
						}
					}
					# Success chance
					inspection_success_chance_change_focus_effect = {
						FOCUS = border
						CHANGE = increase_medium
					}
					inspection_success_chance_change_focus_effect = {
						FOCUS = bureaucracy
						CHANGE = increase_minor
					}
					inspection_success_chance_change_focus_effect = {
						FOCUS = domain
						CHANGE = increase_minor
					}
				}

				inspection_survey_local_message_county_modifier = {
					TYPE = message_good
					MODIFIER = inspection_bandits_in_x_border_positive_modifier
					YEARS = 10
				}
			}
			50 = {
				inspection_activity_options_negative_modifier = yes
				desc = bp3_survey.1010.a.lose_short
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -39
				}
				send_interface_message = {
					type = event_generic_bad
					title = bp3_survey.1010.a.lose

					scope:province.county = {
						add_county_modifier = {
							modifier = inspection_bandits_in_x_border_negative_modifier
							years = 10
						}
					}
					# Success chance
					inspection_success_chance_change_effect = {
						CHANGE = decrease_minor
					}
				}

				inspection_survey_local_message_county_modifier = {
					TYPE = message_bad
					MODIFIER = inspection_bandits_in_x_border_negative_modifier
					YEARS = 10
				}
			}
		}

		stress_impact = {
			craven = minor_stress_gain
			brave = minor_stress_impact_loss
			diligent = minor_stress_impact_loss
			overseer = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = craven
			}
			modifier = {
				factor = 10
				has_variable = inspection_activity_border_focus
			}
			modifier = {
				factor = 5
				OR = {
					has_trait = overseer
					has_trait = diligent
					has_trait = brave
				}
			}
		}
	}

	option = {
		name = bp3_survey.1010.b
		flavor = bp3_survey.1010.b.flavor
		remove_short_term_gold = inspection_medium_gold
		scope:province.county = {
			add_county_modifier = {
				modifier = inspection_bandits_in_x_domain_modifier
				years = 10
			}
		}
		inspection_survey_local_message_county_modifier = {
			TYPE = message
			MODIFIER = inspection_bandits_in_x_domain_modifier
			YEARS = 10
		}

		# Success chance
		inspection_success_chance_change_focus_effect = {
			FOCUS = bureaucracy
			CHANGE = increase_medium
		}
		inspection_success_chance_change_not_focus_effect = {
			FOCUS = bureaucracy
			CHANGE = decrease_minor
		}

		stress_impact = {
			callous = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
			compassionate = medium_stress_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = compassionate
			}
			modifier = {
				factor = 10
				has_variable = inspection_activity_bureaucracy_focus
			}
			modifier = {
				factor = 5
				OR = {
					has_trait = callous
					has_trait = sadistic
				}
			}
		}
	}

	option = {
		name = bp3_survey.1010.c
		duel = {
			skill = prowess
			value = 18
			50 = {
				desc = bp3_survey.1010.c.win
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_message = {
					type = event_generic_good
					title = bp3_survey.1010.c.win_short

					add_prestige = medium_prestige_gain
					add_character_modifier = {
						modifier = inspection_bandits_in_x_populace_modifier
						years = 10
					}
					# Success chance
					inspection_success_chance_change_focus_effect = {
						FOCUS = domain
						CHANGE = increase_medium
					}
					inspection_success_chance_change_focus_effect = {
						FOCUS = border
						CHANGE = increase_minor
					}
				}
			}
			50 = {
				desc = bp3_survey.1010.c.lose
				inspection_activity_options_negative_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -39
				}
				send_interface_message = {
					type = event_generic_bad
					title = bp3_survey.1010.c.lose

					increase_wounds_no_death_effect = { REASON = fight }
					inspection_success_chance_change_effect = {
						CHANGE = decrease_minor
					}
				}
			}
		}

		stress_impact = {
			craven = minor_stress_gain
			brave = minor_stress_impact_loss
			compassionate = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = craven
			}
			modifier = {
				factor = 10
				has_variable = inspection_activity_domain_focus
			}
			modifier = {
				factor = 5
				OR = {
					has_trait = brave
					has_trait = compassionate
				}
			}
		}
	}

	option = {
		name = bp3_survey.1010.d
		flavor = bp3_survey.1010.d.flavor
		add_prestige = minor_prestige_loss

		# Success chance
		inspection_success_chance_change_effect = {
			CHANGE = decrease_minor
		}

		stress_impact = {
			craven = minor_stress_impact_loss
			brave = minor_stress_gain
			compassionate = medium_stress_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = brave
					has_trait = compassionate
				}
			}
			modifier = {
				factor = 5
				has_trait = craven
			}
		}
	}

	after = {
		scope:bandit_character = {
			silent_disappear_ai_if_not_hired = yes
		}
		scope:peasant_character = {
			silent_disappear_ai_if_not_hired = yes
		}
	}
}

# Old Roads of <X>
bp3_survey.1020 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.1020.t
	desc = bp3_survey.1020.desc
	theme = survey_activity

	override_background = {
		reference = terrain_scope
	}
	
	cooldown = { years = 1 }

	left_portrait = {
		character = scope:soldier_character
		hide_info = yes
		animation = throne_room_two_handed_passive_1
	}

	center_portrait = {
		character = root
		animation = survey
	}

	trigger = {
		scope:province.county = {
			NOR = {
				has_county_modifier = governance_excellent_new_road_modifier
				has_county_modifier = governance_good_new_road_modifier
				has_county_modifier = governance_standard_new_road_modifier
				has_county_modifier = governance_poor_new_road_modifier
			}
		}
	}

	immediate = {
		inspection_survey_intent_development = { VALUE = 5 }
		scope:province = { save_scope_as = background_terrain_scope }
		create_character = {
			template = soldier_friend_character
			culture = root.culture
			faith = root.faith
			gender = root
			location = scope:province
			save_scope_as = soldier_character

			after_creation = {
				add_character_flag = {
					flag = need_military_outfit
				}
			}
		}
	}

	option = {
		name = bp3_survey.1020.a
		scope:province.county = {
			add_county_modifier = {
				modifier = inspection_old_roads_of_x_border_modifier
				years = 10
			}
		}
		inspection_survey_local_message_county_modifier = {
			TYPE = message_good
			MODIFIER = inspection_old_roads_of_x_border_modifier
			YEARS = 10
		}

		remove_treasury_or_gold = inspection_minor_gold
		# Success chance
		inspection_success_chance_change_focus_effect = {
			FOCUS = border
			CHANGE = increase_medium
		}
		inspection_success_chance_change_focus_effect = {
			FOCUS = bureaucracy
			CHANGE = increase_minor
		}
		inspection_success_chance_change_focus_effect = {
			FOCUS = domain
			CHANGE = increase_minor
		}

		stress_impact = {
			greedy = minor_stress_gain
			generous = minor_stress_impact_loss
			profligate = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = greedy
			}
			modifier = {
				factor = 5
				OR = {
					has_trait = generous
					has_trait = profligate
				}
			}
		}
	}

	option = {
		name = bp3_survey.1020.b
		scope:province.county = {
			add_county_modifier = {
				modifier = inspection_old_roads_of_x_populace_modifier
				years = 10
			}
		}
		inspection_survey_local_message_county_modifier = {
			TYPE = message
			MODIFIER = inspection_old_roads_of_x_populace_modifier
			YEARS = 10
		}

		inspection_success_chance_change_focus_effect = {
			FOCUS = border
			CHANGE = increase_minor
		}
		inspection_success_chance_change_focus_effect = {
			FOCUS = bureaucracy
			CHANGE = increase_medium
		}
		inspection_success_chance_change_focus_effect = {
			FOCUS = domain
			CHANGE = decrease_minor
		}

		ai_chance = {
			base = 100
		}
	}

	option = {
		name = bp3_survey.1020.c
		scope:province.county = {
			add_county_modifier = {
				modifier = inspection_old_roads_of_x_domain_modifier
				years = 10
			}
		}
		inspection_survey_local_message_county_modifier = {
			TYPE = message
			MODIFIER = inspection_old_roads_of_x_domain_modifier
			YEARS = 10
		}

		inspection_success_chance_change_focus_effect = {
			FOCUS = border
			CHANGE = decrease_minor
		}
		inspection_success_chance_change_focus_effect = {
			FOCUS = bureaucracy
			CHANGE = decrease_minor
		}
		inspection_success_chance_change_focus_effect = {
			FOCUS = domain
			CHANGE = increase_medium
		}

		ai_chance = {
			base = 100
		}
	}

	option = {
		name = bp3_survey.1020.d
		scope:province.county = {
			add_county_modifier = {
				modifier = inspection_old_roads_negative_modifier
				years = 10
			}
		}
		inspection_survey_local_message_county_modifier = {
			TYPE = message_bad
			MODIFIER = inspection_old_roads_negative_modifier
			YEARS = 10
		}

		# Success chance
		inspection_success_chance_change_effect = {
			CHANGE = decrease_minor
		}

		stress_impact = {
			generous = minor_stress_gain
			profligate = minor_stress_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = generous
					has_trait = profligate
				}
			}
		}
	}

	after = {
		scope:soldier_character = {
			silent_disappear_ai_if_not_hired = yes
		}
	}
}

scripted_effect bp3_survey_1030_character_effect = {
	create_character = {
		template = merchant_template
		faith = scope:city_province.faith
		culture = scope:city_province.culture
		gender = root
		location = scope:city_province
		save_scope_as = merchant_$VALUE$
		after_creation = {
			if = {
				limit = {
					scope:city_province = {
						has_variable = fighting_guilds_option_$VALUE$
						var:fighting_guilds_option_$VALUE$ = {
							OR = {
								this = 12
								this = 14
								this = 15
							}
						}
					}
				}
				add_trait = giant
			}
		}
	}
}

# Fighting Guilds
bp3_survey.1030 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.1030.t
	desc = bp3_survey.1030.desc
	theme = survey_activity

	override_background = {
		reference = market
	}
	
	cooldown = { years = 1 }

	left_portrait = {
		character = scope:merchant_1
		animation = disapproval
		hide_info = yes
	}

	center_portrait = {
		character = root
		animation = debating
	}

	right_portrait = {
		character = scope:merchant_2
		animation = rage
		hide_info = yes
	}

	trigger = {
		NOR = {
			government_has_flag = government_is_tribal
			government_has_flag = government_is_nomadic
		}
		scope:province.county = {
			any_county_province = {
				has_holding_type = city_holding
				NOR = {
					has_province_modifier = inspection_fighting_guilds_innkeepers_guild_modifier
					has_province_modifier = inspection_fighting_guilds_artists_guild_modifier
				}
				free_building_slots >= 1
			}
		}
	}

	immediate = {
		inspection_survey_intent_county_modifier = { MODIFIER = inspection_learning_intent_local_guilds_modifier }
		scope:province.county = {
			random_county_province = {
				limit = {
					has_holding_type = city_holding
					NOR = {
						has_province_modifier = inspection_fighting_guilds_innkeepers_guild_modifier
						has_province_modifier = inspection_fighting_guilds_artists_guild_modifier
					}
					free_building_slots >= 1
				}
				weight = {
					base = 1
					modifier = {
						factor = 10
						free_building_slots >= 2
					}
				}
				save_scope_as = city_province
			}
		}
		inspection_fighting_guilds_effect = { VALUE = 1 }
		inspection_fighting_guilds_effect = { VALUE = 2 }
		bp3_survey_1030_character_effect = { VALUE = 1 }
		bp3_survey_1030_character_effect = { VALUE = 2 }
	}

	option = {
		name = bp3_survey.1030.a
		trigger = {
			scope:city_province = {
				free_building_slots >= 2
			}
		}
		duel = {
			skills = { diplomacy stewardship }
			value = 25
			50 = {
				desc = bp3_survey.1030.a.win
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_message = {
					type = event_generic_good
					title = bp3_survey.1030.a.win

					add_prestige = medium_prestige_gain
					scope:city_province = {
						inspection_fighting_guilds_setup_reward_effect = { VALUE = 1 }
						inspection_fighting_guilds_setup_reward_effect = { VALUE = 2 }
					}
					# Success chance
					inspection_success_chance_change_effect = {
						CHANGE = increase_medium
					}
				}

				hidden_effect = {
					if = {
						limit = {
							scope:province.county.holder != scope:host
						}
						scope:province.county.holder = {
							send_interface_message = {
								type = send_interface_message_good
								title = bp3_survey_liege_intervention

								show_as_tooltip = {
									scope:city_province = {
										inspection_fighting_guilds_setup_reward_effect = { VALUE = 1 }
										inspection_fighting_guilds_setup_reward_effect = { VALUE = 2 }
									}
								}
							}
						}
					}
				}
			}
			50 = {
				desc = bp3_survey.1030.a.loss
				inspection_activity_options_negative_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -39
				}
				send_interface_message = {
					type = event_generic_bad
					title = bp3_survey.1030.a.loss_short

					# Success chance
					inspection_success_chance_change_effect = {
						CHANGE = decrease_medium
					}
				}
			}
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = bp3_survey.1030.b
		scope:city_province = {
			inspection_fighting_guilds_setup_reward_effect = { VALUE = 1 }
		}
		hidden_effect = {
			if = {
				limit = {
					scope:province.county.holder != scope:host
				}
				scope:province.county.holder = {
					send_interface_message = {
						type = send_interface_message_good
						title = bp3_survey_liege_intervention

						show_as_tooltip = {
							scope:city_province = {
								inspection_fighting_guilds_setup_reward_effect = { VALUE = 1 }
							}
						}
					}
				}
			}
		}

		# Success chance
		inspection_success_chance_change_effect = {
			CHANGE = increase_minor
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = bp3_survey.1030.c
		scope:city_province = {
			inspection_fighting_guilds_setup_reward_effect = { VALUE = 2 }
		}
		hidden_effect = {
			if = {
				limit = {
					scope:province.county.holder != scope:host
				}
				scope:province.county.holder = {
					send_interface_message = {
						type = send_interface_message_good
						title = bp3_survey_liege_intervention

						show_as_tooltip = {
							scope:city_province = {
								inspection_fighting_guilds_setup_reward_effect = { VALUE = 2 }
							}
						}
					}
				}
			}
		}

		# Success chance
		inspection_success_chance_change_effect = {
			CHANGE = increase_minor
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = bp3_survey.1030.d
		add_gold = medium_gold_value
		# Success chance
		inspection_success_chance_change_effect = {
			CHANGE = decrease_minor
		}
		stress_impact = {
			greedy = minor_stress_impact_loss
			generous = minor_stress_gain
			profligate = minor_stress_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = generous
					has_trait = profligate
				}
			}
			modifier = {
				factor = 5
				has_trait = greedy
			}
		}
	}

	after = {
		scope:merchant_1 = {
			silent_disappear_ai_if_not_hired = yes
		}
		scope:merchant_2 = {
			silent_disappear_ai_if_not_hired = yes
		}
		remove_variable = fighting_guilds_option_1
		remove_variable = fighting_guilds_option_2
	}
}

# The Fire Spreading
bp3_survey.1040 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.1040.t
	desc = bp3_survey.1040.desc
	theme = survey_activity

	override_background = {
		reference = burning_building
	}
	
	cooldown = { years = 1 }

	left_portrait = {
		character = scope:soldier_character
		hide_info = yes
		animation = throne_room_two_handed_passive_1
	}

	center_portrait = {
		character = root
		animation = fear
	}

	right_portrait = {
		character = scope:merchant_character
		hide_info = yes
		animation = crying
	}

	lower_right_portrait = {
		character = scope:county_owner
	}

	override_effect_2d = {
		reference = smoke
	}

	immediate = {
		inspection_survey_intent_development = { VALUE = 5 }
		create_character = {
			template = soldier_friend_character
			culture = root.culture
			faith = root.faith
			gender = root
			location = scope:province
			save_scope_as = soldier_character

			after_creation = {
				add_character_flag = {
					flag = need_military_outfit
				}
			}
		}
		create_character = {
			template = merchant_template
			faith = scope:province.faith
			culture = scope:province.culture
			gender = root
			location = scope:province
			save_scope_as = merchant_character
		}
		scope:province = {
			destroy_random_building_variable_effect = yes
			if = {
				limit = {
					province_owner != root
				}
				province_owner = {
					save_scope_as = county_owner
				}
			}
		}
	}

	option = {
		name = bp3_survey.1040.a
		inspection_success_chance_change_focus_effect = {
			FOCUS = domain
			CHANGE = increase_minor
		}
		duel = {
			skill = prowess
			value = 14
			50 = {
				desc = bp3_survey.1040.a.win
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				send_interface_message = {
					type = event_generic_good
					title = bp3_survey.1040.a.win
					
					add_prestige = medium_prestige_gain
					inspection_success_chance_change_effect = {
						CHANGE = increase_medium
					}
					add_character_modifier = {
						modifier = inspection_selfless_ruler_modifier
						years = 10
					}
				}
			}
			45 = {
				desc = bp3_survey.1040.a.loss
				inspection_activity_options_negative_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -34
				}
				hidden_effect = {
					if = {
						limit = {
							scope:province.county.holder != scope:host
						}
						scope:province.county.holder = {
							send_interface_message = {
								type = send_interface_message_bad
								title = bp3_survey_liege_intervention

								show_as_tooltip = {
									scope:province = { destroy_random_building_effect = yes }
								}
							}
						}
					}
				}

				send_interface_message = {
					type = event_generic_bad
					title = bp3_survey.1040.a.loss
					
					increase_wounds_no_death_effect = { REASON = burned }
					scope:province = { destroy_random_building_effect = yes }
				}
			}
			5 = {
				desc = bp3_survey.1040.a.death
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -4
				}
				death = {
					death_reason = death_burned
				}
			}
		}
		stress_impact = {
			brave = minor_stress_impact_loss
			compassionate = medium_stress_impact_loss
			craven = minor_stress_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = craven
			}
			modifier = {
				factor = 5
				OR = {
					has_trait = brave
					has_trait = compassionate
				}
			}
		}
	}

	option = {
		name = bp3_survey.1040.b
		remove_treasury_or_gold = inspection_medium_gold
		scope:province.county = {
			add_county_modifier = {
				modifier = inspection_fire_spreading_modifier
				years = 10
			}
		}
		inspection_success_chance_change_focus_effect = {
			FOCUS = bureaucracy
			CHANGE = increase_minor
		}
		inspection_success_chance_change_focus_effect = {
			FOCUS = domain
			CHANGE = decrease_minor
		}
		random = {
			chance = 25
			hidden_effect = {
				if = {
					limit = {
						scope:province.county.holder != scope:host
					}
					scope:province.county.holder = {
						send_interface_message = {
							type = send_interface_message_bad
							title = bp3_survey_liege_intervention

							show_as_tooltip = {
								scope:province = { destroy_random_building_effect = yes }
							}
						}
					}
				}
			}
			scope:province = { destroy_random_building_effect = yes }
		}
		stress_impact = {
			generous = minor_stress_impact_loss
			greedy = minor_stress_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = greedy
			}
			modifier = {
				factor = 5
				has_trait = generous
			}
		}
	}

	option = {
		name = bp3_survey.1040.c
		trigger = {
			exists = scope:county_owner
			NOR = {
				scope:county_owner = root 
				scope:county_owner = { is_ai = yes }
			}
			OR = {
				has_trait = callous
				has_trait = sadistic
				AND = {
					has_relation_rival = scope:province.province_owner
					has_trait = vengeful
				}
			}
		}
		duel = {
			skill = intrigue
			value = 15
			50 = {
				desc = bp3_survey.1040.c.win
				inspection_activity_options_positive_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_message = {
					type = event_generic_good
					title = bp3_survey.1040.c.win

					scope:county_owner = {
						add_opinion = {
							modifier = respect_opinion
							target = root
							opinion = 25
						}
					}
					inspection_success_chance_change_focus_effect = {
						FOCUS = domain
						CHANGE = increase_minor
					}
				}
			}
			50 = {
				desc = bp3_survey.1040.c.loss
				inspection_activity_options_negative_modifier = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -39
				}
				send_interface_message = {
					type = event_generic_bad
					title = bp3_survey.1040.c.loss

					scope:county_owner = {
						add_opinion = {
							modifier = hate_opinion
							target = root
							opinion = -50
						}
					}
					inspection_success_chance_change_effect = {
						CHANGE = decrease_medium
					}
				}
			}
		}
		hidden_effect = {
			if = {
				limit = {
					scope:province.county.holder != scope:host
				}
				scope:province.county.holder = {
					send_interface_message = {
						type = send_interface_message_bad
						title = bp3_survey_liege_intervention

						show_as_tooltip = {
							scope:province = { 
								destroy_random_building_effect = yes 
								county = { change_development_level = -2 }
							}
						}
					}
				}
			}
		}
		scope:province = { 
			destroy_random_building_effect = yes 
			county = { change_development_level = -2 }
		}
		stress_impact = {
			callous = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
			vengeful = minor_stress_impact_loss
			compassionate = major_stress_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = compassionate
			}
			modifier = {
				factor = 5
				OR = {
					has_trait = callous
					has_trait = sadistic
					has_trait = vengeful
				}
			}
		}
	}

	option = {
		name = bp3_survey.1040.d
		random = {
			chance = 50
			hidden_effect = {
				if = {
					limit = {
						scope:province.county.holder != scope:host
					}
					scope:province.county.holder = {
						send_interface_message = {
							type = send_interface_message_bad
							title = bp3_survey_liege_intervention

							show_as_tooltip = {
								scope:province = { 
									destroy_random_building_effect = yes 
									county = { change_development_level = -1 }
								}
							}
						}
					}
				}
			}
			send_interface_message = {
				type = event_generic_bad
				title = bp3_survey.1040.destroyed_building

				scope:province = { 
					destroy_random_building_effect = yes 
					county = { change_development_level = -1 }
				}
			}
		}
		inspection_success_chance_change_effect = {
			CHANGE = decrease_medium
		}
		stress_impact = {
			compassionate = medium_stress_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = compassionate
			}
		}
	}

	after = {
		scope:merchant_character = {
			silent_disappear_ai_if_not_hired = yes
		}
		scope:soldier_character = {
			silent_disappear_ai_if_not_hired = yes
		}
	}
}

# Expanding the Town Walls
bp3_survey.1050 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.1050.t
	desc = bp3_survey.1050.desc
	theme = survey_activity

	override_background = {
		reference = market
	}
	
	cooldown = { years = 1 }

	left_portrait = {
		character = scope:soldier_character
		hide_info = yes
		animation = disapproval
	}

	center_portrait = {
		character = root
		animation = thinking
	}

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

	immediate = {
		inspection_survey_intent_county_modifier = { MODIFIER = inspection_learning_intent_building_modifier }
		create_character = {
			template = soldier_friend_character
			culture = root.culture
			faith = root.faith
			gender = root
			location = scope:province
			save_scope_as = soldier_character

			after_creation = {
				add_character_flag = {
					flag = need_military_outfit
				}
			}
		}
		create_character = {
			template = merchant_template
			faith = scope:province.faith
			culture = scope:province.culture
			gender = root
			location = scope:province
			save_scope_as = merchant_character
		}
	}

	option = {
		name = bp3_survey.1050.a
		remove_treasury_or_gold = {
			value = {
				value = minor_treasury_or_gold_value
				min = 50
			}
			multiply = inspection_activity_option_multiplier
		}
		scope:province = {
			add_province_modifier = {
				modifier = inspection_expanding_walls_new_modifier
				years = 10
			}
		}
		inspection_survey_local_message_province_modifier = {
			TYPE = message_good
			MODIFIER = inspection_expanding_walls_new_modifier
			YEARS = 10
		}

		inspection_success_chance_change_effect = {
			CHANGE = increase_minor
		}

		stress_impact = {
			greedy = minor_stress_gain
			generous = minor_stress_impact_loss
			profligate = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = greedy
			}
			modifier = {
				factor = 5
				OR = {
					has_trait = generous
					has_trait = profligate
				}
			}
		}
	}

	option = {
		name = bp3_survey.1050.b
		remove_treasury_or_gold = {
			value = {
				value = minor_treasury_or_gold_value
				min = 50
			}
			multiply = inspection_activity_option_multiplier
		}
		scope:province = {
			add_province_modifier = {
				modifier = inspection_expanding_walls_old_modifier
				years = 10
			}
		}
		inspection_survey_local_message_province_modifier = {
			TYPE = message_good
			MODIFIER = inspection_expanding_walls_old_modifier
			YEARS = 10
		}

		inspection_success_chance_change_effect = {
			CHANGE = increase_minor
		}

		stress_impact = {
			greedy = minor_stress_gain
			generous = minor_stress_impact_loss
			profligate = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = greedy
			}
			modifier = {
				factor = 5
				OR = {
					has_trait = generous
					has_trait = profligate
				}
			}
		}
	}

	option = {
		name = bp3_survey.1050.c
		inspection_success_chance_change_effect = {
			CHANGE = decrease_minor
		}

		stress_impact = {
			greedy = minor_stress_impact_loss
			generous = minor_stress_gain
			profligate = minor_stress_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = generous
					has_trait = profligate
				}
			}
			modifier = {
				factor = 5
				has_trait = greedy
			}
		}
	}

	after = {
		scope:merchant_character = {
			silent_disappear_ai_if_not_hired = yes
		}
		scope:soldier_character = {
			silent_disappear_ai_if_not_hired = yes
		}
	}
}

# Mine Your Own Business
bp3_survey.1060 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.1060.t
	desc = {
		desc = bp3_survey.1060.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:mine_type = 1
				}
				desc = bp3_survey.1060.desc.copper
			}
			triggered_desc = {
				trigger = {
					scope:mine_type = 2
				}
				desc = bp3_survey.1060.desc.silver
			}
			triggered_desc = {
				trigger = {
					scope:mine_type = 3
				}
				desc = bp3_survey.1060.desc.gold
			}
		}
	}
	theme = survey_activity

	override_background = {
		reference = fp3_cave
	}
	
	cooldown = { years = 1 }

	left_portrait = {
		character = scope:soldier_character
		hide_info = yes
		animation = throne_room_two_handed_passive_1
	}

	center_portrait = {
		character = root
		animation = survey
	}

	right_portrait = {
		character = scope:guest_1
		animation = ecstasy
	}

	trigger = {
		scope:province = { has_special_building_slot = no }
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 10
			scope:province = {
				OR = {
					later_historical_gold_mine_trigger = yes
					later_historical_silver_mine_trigger = yes
					later_historical_copper_mine_trigger = yes
				}
			}
		}
	}

	immediate = {
		inspection_survey_intent_province_modifier = { MODIFIER = inspection_learning_intent_flourishing_metal_trade_modifier }
		create_character = {
			template = soldier_friend_character
			culture = root.culture
			faith = root.faith
			gender = root
			location = scope:province
			save_scope_as = soldier_character

			after_creation = {
				add_character_flag = {
					flag = need_military_outfit
				}
			}
		}

		scope:activity = {
			random_attending_character = {
				limit = {
					this != root
				}
				weight = {
					base = 1
					modifier = {
						factor = 20
						OR = {
							is_close_family_of = root
							is_spouse_of = root
						}
					}
				}
				save_scope_as = guest_1
			}
		}

		random_list = {
			60 = {
				trigger = {
					scope:province = {
						NOR = {
							later_historical_gold_mine_trigger = yes
							later_historical_silver_mine_trigger = yes
						}
					}
				}
				save_scope_value_as = {
					name = mine_type
					value = 1
				}
			}
			35 = {
				trigger = {
					scope:province = {
						NOR = {
							later_historical_gold_mine_trigger = yes
							later_historical_copper_mine_trigger = yes
						}
					}
				}
				save_scope_value_as = {
					name = mine_type
					value = 2
				}
			}
			5 = {
				trigger = {
					scope:province = {
						NOR = {
							later_historical_silver_mine_trigger = yes
							later_historical_copper_mine_trigger = yes
						}
					}
				}
				save_scope_value_as = {
					name = mine_type
					value = 3
				}
			}
		}
	}

	option = {
		name = bp3_survey.1060.a
		scope:province = {
			switch = {
				trigger = scope:mine_type
				3 = { 
					hidden_effect = { add_special_building_slot = generic_gold_mines_01 }
					add_special_building = generic_gold_mines_01
				}
				2 = { 
					hidden_effect = { add_special_building_slot = generic_silver_mines_01 }
					add_special_building = generic_silver_mines_01
				}
				1 = { 
					hidden_effect = { add_special_building_slot = generic_copper_mines_01 }
					add_special_building = generic_copper_mines_01
				}
			}
		}
		hidden_effect = {
			if = {
				limit = {
					scope:province.county.holder != scope:host
				}
				scope:province.county.holder = {
					send_interface_message = {
						type = send_interface_message_good
						title = bp3_survey_liege_intervention

						show_as_tooltip = {
							scope:province = {
								switch = {
									trigger = scope:mine_type
									3 = { 
										hidden_effect = { add_special_building_slot = generic_gold_mines_01 }
										add_special_building = generic_gold_mines_01
									}
									2 = { 
										hidden_effect = { add_special_building_slot = generic_silver_mines_01 }
										add_special_building = generic_silver_mines_01
									}
									1 = { 
										hidden_effect = { add_special_building_slot = generic_copper_mines_01 }
										add_special_building = generic_copper_mines_01
									}
								}
							}
						}
					}
				}
			}
		}

		inspection_success_chance_change_effect = {
			CHANGE = increase_medium
		}
	}

	after = {
		scope:soldier_character = {
			silent_disappear_ai_if_not_hired = yes
		}
	}
}

# Regular Irregularities
bp3_survey.1070 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.1070.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = scope:county_owner }
				}
				desc = bp3_survey.1070.desc.intro.personal
			}
			triggered_desc = {
				trigger = {
					exists = scope:county_owner
				}
				desc = bp3_survey.1070.desc.intro.vassal
			}
		}
		desc = bp3_survey.1070.desc
	}
	theme = survey_activity

	override_background = {
		reference = study
	}
	
	cooldown = { years = 1 }

	left_portrait = {
		character = root
		animation = reading
	}

	right_portrait = {
		character = scope:county_owner
		animation = shame
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			scope:province.province_owner != root
			scope:province.province_owner.stewardship < 10
		}
	}

	immediate = {
		inspection_survey_intent_control = { VALUE = 5 }
		if = {
			limit = {
				scope:province.province_owner != root
			}
			scope:province.province_owner = { save_scope_as = county_owner }
		}
	}

	option = {
		name = bp3_survey.1070.a
		flavor = bp3_survey.1070.a.flavor

		scope:county_owner ?= {
			add_opinion = {
				modifier = frustrated_opinion
				target = root
				opinion = -10
			}
		}
		add_dread = 10
		add_treasury_or_gold = minor_treasury_or_gold_value
		add_character_modifier = {
			modifier = inspection_regular_irregularities_modifier
			years = 10
		}
		
		inspection_success_chance_change_focus_effect = {
			FOCUS = domain
			CHANGE = decrease_minor
		}
		inspection_success_chance_change_not_focus_effect = {
			FOCUS = domain
			CHANGE = increase_minor
		}

		stress_impact = {
			just = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = just
			}
		}
	}

	option = {
		name = bp3_survey.1070.b
		flavor = bp3_survey.1070.b.flavor
		add_treasury_or_gold = minor_treasury_or_gold_value
		add_character_modifier = {
			modifier = inspection_regular_irregularities_local_modifier
			years = 5
		}
		inspection_success_chance_change_focus_effect = {
			FOCUS = domain
			CHANGE = decrease_minor
		}
		inspection_success_chance_change_not_focus_effect = {
			FOCUS = domain
			CHANGE = increase_minor
		}

		stress_impact = {
			greedy = minor_stress_impact_loss
			arbitrary = minor_stress_impact_loss
			just = minor_stress_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = just
			}
			modifier = {
				factor = 5
				OR = {
					has_trait = arbitrary
					has_trait = greedy
				}
			}
		}
	}

	option = {
		name = bp3_survey.1070.c
		flavor = bp3_survey.1070.c.flavor

		scope:county_owner ?= {
			add_opinion = {
				modifier = grateful_opinion
				target = root
				opinion = 10
			}
		}

		inspection_success_chance_change_focus_effect = {
			FOCUS = domain
			CHANGE = increase_minor
		}
		inspection_success_chance_change_not_focus_effect = {
			FOCUS = domain
			CHANGE = decrease_minor
		}

		stress_impact = {
			greedy = minor_stress_gain
			wrathful = minor_stress_gain
			just = minor_stress_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = wrathful
					has_trait = greedy
					has_trait = just
				}
			}
		}
	}
}

scripted_trigger place_worth_visiting_modifier_trigger = {
	NOR = {
		has_province_modifier = inspection_proteted_poi_levy_modifier
		has_province_modifier = inspection_protected_holy_site_levy_modifier
		has_province_modifier = inspection_protected_holy_poi_levy_modifier
		has_province_modifier = inspection_protected_poi_gold_modifier
		has_province_modifier = inspection_protected_holy_site_gold_modifier
		has_province_modifier = inspection_protected_holy_poi_gold_modifier
	}
}

# A Place Worth Visiting
bp3_survey.1080 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.1080.t
	desc = {
		desc = bp3_survey.1080.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:holy_poi_location
				}
				desc = bp3_survey.1080.desc.holy_poi
			}
			triggered_desc = {
				trigger = {
					exists = scope:poi_location
				}
				desc = bp3_survey.1080.desc.poi
			}
			triggered_desc = {
				trigger = {
					exists = scope:holy_site_location
				}
				desc = bp3_survey.1080.desc.holy_site
			}
		}
		desc = bp3_survey.1080.desc.outro
	}
	theme = survey_activity

	override_background = {
		reference = market
	}
	
	cooldown = { years = 1 }

	left_portrait = {
		character = scope:soldier_character
		hide_info = yes
		animation = throne_room_two_handed_passive_1
	}

	center_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:traveler_character
		hide_info = yes
		animation = debating
	}

	trigger = {
		scope:province.county = {
			any_county_province = {
				OR = {
					barony = { is_holy_site_of = root.faith }
					has_special_building = yes
				}
				place_worth_visiting_modifier_trigger = yes
			}
		}
	}

	immediate = {
		inspection_survey_intent_control = { VALUE = 5 }
		create_character = {
			template = soldier_friend_character
			culture = root.culture
			faith = root.faith
			gender = root
			location = scope:province
			save_scope_as = soldier_character

			after_creation = {
				add_character_flag = {
					flag = need_military_outfit
				}
			}
		}
		create_character = {
			template = travel_leader_court_position_template
			faith = root.faith
			culture = root.culture
			gender = root
			location = scope:province
			save_scope_as = traveler_character
		}
		scope:province.county = {
			random_county_province = {
				limit = {
					OR = {
						any_journey_point_of_interest_trigger = yes
						AND = {
							barony = { is_holy_site_of = root.faith }
							barony.title_province = scope:province.county.title_province
						}
					}
					place_worth_visiting_modifier_trigger = yes
				}
				alternative_limit = {
					OR = {
						any_journey_point_of_interest_trigger = yes
						barony = { is_holy_site_of = root.faith }
					}
					place_worth_visiting_modifier_trigger = yes
				}
				weight = {
					base = 1
					modifier = {
						factor = 100
						barony = { is_holy_site_of = root.faith }
					}
				}
				if = {
					limit = {
						any_journey_point_of_interest_trigger = yes
						barony = { is_holy_site_of = root.faith }
					}
					save_scope_as = holy_poi_location
				}
				else_if = {
					limit = {
						any_journey_point_of_interest_trigger = yes
					}
					save_scope_as = poi_location
				}
				else_if = {
					limit = {
						barony = { is_holy_site_of = root.faith }
					}
					save_scope_as = holy_site_location
				}
				save_scope_as = location_province
			}
		}
	}

	option = {
		name = bp3_survey.1080.a
		remove_treasury_or_gold = inspection_minor_gold
		scope:poi_location ?= {
			add_province_modifier = {
				modifier = inspection_protected_poi_gold_modifier
				years = 25
			}
			inspection_survey_local_message_specific_location_province_modifier = {
				TYPE = message_good
				MODIFIER = inspection_protected_poi_gold_modifier
				YEARS = 25
			}
		}
		scope:holy_site_location ?= {
			add_province_modifier = {
				modifier = inspection_protected_holy_site_gold_modifier
				years = 25
			}
			inspection_survey_local_message_specific_location_province_modifier = {
				TYPE = message_good
				MODIFIER = inspection_protected_holy_site_gold_modifier
				YEARS = 25
			}
		}
		scope:holy_poi_location ?= {
			add_province_modifier = {
				modifier = inspection_protected_holy_poi_gold_modifier
				years = 25
			}
			inspection_survey_local_message_specific_location_province_modifier = {
				TYPE = message_good
				MODIFIER = inspection_protected_holy_poi_gold_modifier
				YEARS = 25
			}
		}

		inspection_success_chance_change_effect = {
			CHANGE = increase_medium
		}

		stress_impact = {
			compassionate = minor_stress_impact_loss
			diligent = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				OR = {
					has_trait = compassionate
					has_trait = diligent
				}
			}
		}
	}

	option = {
		name = bp3_survey.1080.b
		scope:poi_location ?= {
			add_province_modifier = {
				modifier = inspection_proteted_poi_levy_modifier
				years = 25
			}
			inspection_survey_local_message_specific_location_province_modifier = {
				TYPE = message
				MODIFIER = inspection_proteted_poi_levy_modifier
				YEARS = 25
			}
		}
		scope:holy_site_location ?= {
			add_province_modifier = {
				modifier = inspection_protected_holy_site_levy_modifier
				years = 25
			}
			inspection_survey_local_message_specific_location_province_modifier = {
				TYPE = message
				MODIFIER = inspection_protected_holy_site_levy_modifier
				YEARS = 25
			}
		}
		scope:holy_poi_location ?= {
			add_province_modifier = {
				modifier = inspection_protected_holy_poi_levy_modifier
				years = 25
			}
			inspection_survey_local_message_specific_location_province_modifier = {
				TYPE = message
				MODIFIER = inspection_protected_holy_poi_levy_modifier
				YEARS = 25
			}
		}

		inspection_success_chance_change_focus_effect = {
			FOCUS = domain
			CHANGE = decrease_minor
		}
		inspection_success_chance_change_not_focus_effect = {
			FOCUS = domain
			CHANGE = increase_minor
		}

		stress_impact = {
			arrogant = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = arrogant
			}
		}
	}

	option = {
		name = bp3_survey.1080.c
		inspection_success_chance_change_effect = {
			CHANGE = decrease_minor
		}

		stress_impact = {
			compassionate = minor_stress_gain
			diligent = minor_stress_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = diligent
				}
			}
		}
	}

	after = {
		scope:soldier_character = {
			silent_disappear_ai_if_not_hired = yes
		}
		scope:traveler_character = {
			silent_disappear_ai_if_not_hired = yes
		}
	}
}

scripted_trigger bp3_survey_1090_terrain_trigger = {
	OR = {
		has_holding = no
		terrain = hills
		terrain = mountains
		terrain = steppe
		terrain = forest
		terrain = desert_mountains
		terrain = desert
		terrain = drylands
	}
}

# The Hidden Hinterlands
bp3_survey.1090 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.1090.t
	desc = bp3_survey.1090.desc
	theme = survey_activity

	override_background = {
		trigger = {
			scope:poaching_province = {
				OR = {
					terrain = forest
					terrain = hills
					terrain = mountains
				}
			}
		}
		reference = ep2_hunt_poachers_camp
	}

	override_background = {
		reference = wilderness
	}
	
	cooldown = { years = 1 }

	left_portrait = {
		character = scope:soldier_character
		hide_info = yes
		animation = throne_room_two_handed_passive_1
	}

	center_portrait = {
		character = root
		animation = survey
	}

	right_portrait = {
		character = scope:hunter_character
		hide_info = yes
		animation = hunting_carcass_start
	}

	trigger = {
		scope:province.county = {
			any_county_province = {
				bp3_survey_1090_terrain_trigger = yes
				NOR = {
					has_province_modifier = inspection_hidden_hinterlands_recruit_modifier
					has_province_modifier = inspection_hidden_hinterlands_hunters_modifier
				}
			}
		}
	}

	immediate = {
		inspection_survey_intent_control = { VALUE = 5 }
		create_character = {
			template = soldier_friend_character
			culture = root.culture
			faith = root.faith
			gender = root
			location = scope:province
			save_scope_as = soldier_character

			after_creation = {
				add_character_flag = {
					flag = need_military_outfit
				}
			}
		}
		create_character = {
			template = hunter_template
			faith = root.faith
			culture = root.culture
			gender = root
			location = scope:province
			save_scope_as = hunter_character
		}
		scope:province.county = {
			random_county_province = {
				limit = {
					bp3_survey_1090_terrain_trigger = yes
				}
				save_scope_as = poaching_province
			}
		}
	}

	option = {
		name = bp3_survey.1090.a
		remove_treasury_or_gold = inspection_minor_gold
		scope:poaching_province = {
			add_province_modifier = {
				modifier = inspection_hidden_hinterlands_recruit_modifier
				years = 25
			}
			inspection_survey_local_message_specific_location_province_modifier = {
				TYPE = message_good
				MODIFIER = inspection_hidden_hinterlands_recruit_modifier
				YEARS = 25
			}
		}

		inspection_success_chance_change_focus_effect = {
			FOCUS = domain
			CHANGE = decrease_minor
		}
		inspection_success_chance_change_not_focus_effect = {
			FOCUS = domain
			CHANGE = increase_medium
		}

		stress_impact = {
			diligent = minor_stress_impact_loss
			wrathful = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				OR = {
					has_trait = diligent
					has_trait = wrathful
				}
			}
		}
	}

	option = {
		name = bp3_survey.1090.b
		scope:poaching_province = {
			add_province_modifier = {
				modifier = inspection_hidden_hinterlands_hunters_modifier
				years = 25
			}
			inspection_survey_local_message_specific_location_province_modifier = {
				TYPE = message
				MODIFIER = inspection_hidden_hinterlands_hunters_modifier
				YEARS = 25
			}
		}

		inspection_success_chance_change_focus_effect = {
			FOCUS = border
			CHANGE = decrease_minor
		}
		inspection_success_chance_change_not_focus_effect = {
			FOCUS = border
			CHANGE = increase_minor
		}

		stress_impact = {
			lifestyle_hunter = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 5
				has_trait = lifestyle_hunter
			}
		}
	}

	option = {
		name = bp3_survey.1090.c

		inspection_success_chance_change_focus_effect = {
			FOCUS = domain
			CHANGE = increase_minor
		}
		inspection_success_chance_change_not_focus_effect = {
			FOCUS = domain
			CHANGE = decrease_minor
		}

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

	after = {
		scope:soldier_character = {
			silent_disappear_ai_if_not_hired = yes
		}
		scope:hunter_character = {
			silent_disappear_ai_if_not_hired = yes
		}
	}
}

### Progression Events ###
bp3_survey.1200 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.1200.t
	desc = bp3_survey.1200.desc
	theme = survey_activity

	override_background = { reference = study }

	left_portrait = {
		character = root
		animation = writing
	}

	cooldown = { years = 1 }

	option = {
		name = bp3_survey.1200.a
		inspection_success_chance_change_effect = {
			CHANGE = increase_medium
		}
	}
}

bp3_survey.1210 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.1210.t
	desc = bp3_survey.1210.desc
	theme = survey_activity

	override_background = { reference = study }

	left_portrait = {
		character = root
		animation = writing
	}

	cooldown = { years = 1 }

	option = {
		name = bp3_survey.1210.a
		inspection_success_chance_change_effect = {
			CHANGE = increase_minor
		}
	}
}

bp3_survey.1220 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.1220.t
	desc = bp3_survey.1220.desc
	theme = survey_activity

	override_background = { reference = study }

	left_portrait = {
		character = root
		animation = disapproval
	}

	cooldown = { years = 1 }

	option = {
		name = bp3_survey.1220.a
		inspection_success_chance_change_effect = {
			CHANGE = decrease_minor
		}
	}
}

bp3_survey.1230 = {
	type = activity_event
	content_source = dlc_015
	title = bp3_survey.1230.t
	desc = bp3_survey.1230.desc
	theme = survey_activity

	override_background = { reference = study }

	left_portrait = {
		character = root
		animation = rage
	}

	cooldown = { years = 1 }

	option = {
		name = bp3_survey.1230.a
		inspection_success_chance_change_effect = {
			CHANGE = decrease_medium
		}
	}
}
