﻿namespace = agotma_instigator_events

######################################################
# INSTIGATOR EVENTS
######################################################

# EVENT START
agotma_instigator_events.0001 = {
	type = character_event
	title = agotma_instigator_events.0001.t
	desc = agotma_instigator_events.0001.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = idle
	}

	option = {
		name = agotma_instigator_events.0001.a

		# #TEST
		# if = {
		# 	limit = { exists = global_var:sum_of_instigations }
		# 	change_global_variable = {
		# 		name = sum_of_instigations
		# 		add = 1
		# 	}
		# }
		# else = {
		# 	set_global_variable = {
		# 		name = sum_of_instigations
		# 		value = 1
		# 	}
		# }
		# #TEST
	}
}

# CHAR DIED
agotma_instigator_events.0002 = {
	type = character_event
	title = agotma_instigator_events.0002.t
	desc = agotma_instigator_events.0002.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = idle
	}

	immediate = { agotma_instigator_story_end_effect = yes }

	option = {
		name = agotma_instigator_events.0002.a
		custom_tooltip = agotma_instigator_cancel
	}
}

# CHAR ALREADY INSTIGATED
agotma_instigator_events.0003 = {
	type = character_event
	title = agotma_instigator_events.0003.t
	desc = agotma_instigator_events.0003.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = idle
	}

	immediate = { agotma_instigator_story_end_effect = yes }

	option = {
		name = agotma_instigator_events.0003.a
		custom_tooltip = agotma_instigator_cancel
	}
}

# TARGET TITLE NO LONGER EXISTS
agotma_instigator_events.0004 = {
	type = character_event
	title = agotma_instigator_events.0004.t
	desc = agotma_instigator_events.0004.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = idle
	}

	immediate = { agotma_instigator_story_end_effect = yes }

	option = {
		name = agotma_instigator_events.0004.a
		custom_tooltip = agotma_instigator_cancel
	}
}

# INSTIGATION STAGE 1
agotma_instigator_events.0005 = {
	type = character_event
	title = agotma_instigator_events.0005.t
	desc = agotma_instigator_events.0005.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = idle
	}

	lower_left_portrait = {
		character = scope:agotma_war_target_char
	}

	immediate = {
		agot_hf_revealbastard_liege_finder = yes
		scope:story = {
			random_in_list = {
				variable = agot_hf_possible_father
				save_scope_as = suspect_a
			}
		}
	}

	# Diplomacy approach
	option = {
		name = agotma_instigator_events.0005.a
		skill = diplomacy
		add_character_flag = {
			flag = agotma_instigator_0005_diplomacy
			days = 40
		}

		ai_chance = {
			base = 1

			modifier = {
				add = {
					value = scope:instigator.diplomacy
					multiply = {
						value = scope:instigator.ai_rationality
						divide = 100
					}
				}
			}
		}
	}

	# Martial approach
	option = {
		name = agotma_instigator_events.0005.b
		skill = martial
		add_character_flag = {
			flag = agotma_instigator_0005_martial
			days = 40
		}

		ai_chance = {
			base = 1

			modifier = {
				add = {
					value = scope:instigator.martial
					multiply = {
						value = scope:instigator.ai_rationality
						divide = 100
					}
				}
			}
		}
	}

	# Stewardship approach
	option = {
		name = agotma_instigator_events.0005.c
		skill = stewardship
		add_character_flag = {
			flag = agotma_instigator_0005_stewardship
			days = 40
		}

		ai_chance = {
			base = 1

			modifier = {
				add = {
					value = scope:instigator.stewardship
					multiply = {
						value = scope:instigator.ai_rationality
						divide = 100
					}
				}
			}
		}
	}

	# Intrigue approach
	option = {
		name = agotma_instigator_events.0005.d
		skill = intrigue
		add_character_flag = {
			flag = agotma_instigator_0005_intrigue
			days = 40
		}

		ai_chance = {
			base = 1

			modifier = {
				add = {
					value = scope:instigator.intrigue
					multiply = {
						value = scope:instigator.ai_rationality
						divide = 100
					}
				}
			}
		}
	}

	# Learning approach
	option = {
		name = agotma_instigator_events.0005.e
		skill = learning
		trigger = { scope:agotma_instigated_char.faith.religion = religion:the_seven_religion }
		add_character_flag = {
			flag = agotma_instigator_0005_learning
			days = 40
		}

		ai_chance = {
			base = 1

			modifier = {
				add = {
					value = scope:instigator.learning
					multiply = {
						value = scope:instigator.ai_rationality
						divide = 100
					}
				}
			}
		}
	}

	option = {
		name = agotma_instigator_events.0005.f
		trigger = { is_ai = no }
		custom_tooltip = agotma_instigator_cancel
		add_character_flag = {
			flag = no_instigation
			days = 40
		}

		agotma_instigator_story_end_effect = yes
	}

	after = {
		if = {
			limit = { NOT = { has_character_flag = no_instigation } }
			scope:agotma_instigated_char = {
				trigger_event = {
					id = agotma_instigator_events.0500
					days = 1
				}
			}
		}
	}
}

# Main Event
agotma_instigator_events.0500 = {
	type = character_event
	title = agotma_instigator_events.0005.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_instigator_0005_diplomacy } }
				desc = agotma_instigator_events.0500.desc.diplomacy
			}
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_instigator_0005_martial } }
				desc = agotma_instigator_events.0500.desc.martial
			}
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_instigator_0005_stewardship } }
				desc = agotma_instigator_events.0500.desc.stewardship
			}
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_instigator_0005_intrigue } }
				desc = agotma_instigator_events.0500.desc.intrigue
			}
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_instigator_0005_learning } }
				desc = agotma_instigator_events.0500.desc.learning
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = idle
	}

	lower_left_portrait = {
		character = scope:agotma_war_target_char
	}

	# Accept
	option = {
		name = agotma_instigator_events.0500.a
		trigger = {
			trigger_if = {
				limit = { scope:instigator = { has_character_flag = agotma_instigator_0005_diplomacy } }
				scope:instigator.diplomacy > scope:agotma_instigated_char.diplomacy
			}
			trigger_if = {
				limit = { scope:instigator = { has_character_flag = agotma_instigator_0005_martial } }
				scope:instigator.martial > scope:agotma_instigated_char.martial
			}
			trigger_if = {
				limit = { scope:instigator = { has_character_flag = agotma_instigator_0005_stewardship } }
				scope:instigator.stewardship > scope:agotma_instigated_char.stewardship
			}
			trigger_if = {
				limit = { scope:instigator = { has_character_flag = agotma_instigator_0005_intrigue } }
				scope:instigator.intrigue > scope:agotma_instigated_char.intrigue
			}
			trigger_if = {
				limit = { scope:instigator = { has_character_flag = agotma_instigator_0005_learning } }
				scope:instigator.learning > scope:agotma_instigated_char.learning
			}
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0508
				days = 1
			}
		}

		ai_chance = {
			base = 1

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = 0.1
			}

			ai_value_modifier = {
				ai_rationality = -0.1
				ai_energy = 0.1
			}
		}
	}

	# Diplomacy approach
	option = {
		name = agotma_instigator_events.0500.b
		trigger = { scope:instigator = { has_character_flag = agotma_instigator_0005_diplomacy } }

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0503
				days = 1
			}
		}

		ai_chance = {
			base = 1

			modifier = {
				add = {
					value = scope:instigator.diplomacy
					subtract = {
						value = scope:agotma_instigated_char.diplomacy
					}
					multiply = 2
				}
			}

			ai_value_modifier = {
				ai_rationality = 0.1
				ai_compassion = 0.1
			}
		}
	}

	# Martial approach
	option = {
		name = agotma_instigator_events.0500.c
		trigger = { scope:instigator = { has_character_flag = agotma_instigator_0005_martial } }

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0504
				days = 1
			}
		}

		ai_chance = {
			base = 1

			modifier = {
				add = {
					value = scope:instigator.martial
					subtract = {
						value = scope:agotma_instigated_char.martial
					}
					multiply = 2
				}
			}

			ai_value_modifier = {
				ai_boldness = 0.1
				ai_energy = 0.1
			}
		}
	}

	# Stewardship approach
	option = {
		name = agotma_instigator_events.0500.d
		trigger = { scope:instigator = { has_character_flag = agotma_instigator_0005_stewardship } }

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0505
				days = 1
			}
		}

		ai_chance = {
			base = 1

			modifier = {
				add = {
					value = scope:instigator.stewardship
					subtract = {
						value = scope:agotma_instigated_char.stewardship
					}
					multiply = 2
				}
			}

			ai_value_modifier = {
				ai_greed = 0.1
				ai_sociability = 0.1
			}
		}
	}

	# Intrigue approach
	option = {
		name = agotma_instigator_events.0500.e
		trigger = { scope:instigator = { has_character_flag = agotma_instigator_0005_intrigue } }

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0506
				days = 1
			}
		}

		ai_chance = {
			base = 1

			modifier = {
				add = {
					value = scope:instigator.intrigue
					subtract = {
						value = scope:agotma_instigated_char.intrigue
					}
					multiply = 2
				}
			}

			ai_value_modifier = {
				ai_rationality = -0.1
				ai_boldness = 0.1
			}
		}
	}

	# Learning approach
	option = {
		name = agotma_instigator_events.0500.f
		trigger = { scope:instigator = { has_character_flag = agotma_instigator_0005_learning } }

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0507
				days = 1
			}
		}

		ai_chance = {
			base = 1

			modifier = {
				add = {
					value = scope:instigator.learning
					subtract = {
						value = scope:agotma_instigated_char.learning
					}
					multiply = 2
				}
			}

			ai_value_modifier = {
				ai_zeal = 0.1
				ai_greed = 0.1
			}
		}
	}

	# Failed
	option = {
		name = agotma_instigator_events.0500.g

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0501
				days = 1
			}
		}

		show_as_tooltip = {
			scope:instigator = {
				add_opinion = {
					target = scope:agotma_instigated_char
					modifier = insult_opinion
					opinion = -25
				}
			}
			scope:agotma_instigated_char = {
				add_opinion = {
					target = scope:instigator
					modifier = insult_opinion
					opinion = -25
				}
			}
		}

		ai_chance = {
			base = 15
		}
	}

	# Failed & reveal the instigator
	option = {
		name = agotma_instigator_events.0500.h
		trigger = {
			scope:instigator = { has_character_flag = agotma_instigator_0005_intrigue }
			scope:instigator.intrigue < scope:agotma_instigated_char.intrigue
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0502
				days = 1
			}
		}

		show_as_tooltip = {
			scope:instigator = {
				add_opinion = {
					target = scope:agotma_instigated_char
					modifier = insult_opinion
					opinion = -25
				}
			}
			scope:agotma_instigated_char = {
				add_opinion = {
					target = scope:instigator
					modifier = insult_opinion
					opinion = -25
				}
			}
			scope:agotma_war_target_char = {
				add_opinion = {
					target = scope:instigator
					modifier = insult_opinion
					opinion = -50
				}
			}
		}

		ai_chance = {
			base = 1

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = -0.15
			}
		}
	}
}

# Failed
agotma_instigator_events.0501 = {
	type = character_event
	title = agotma_instigator_events.0501.t
	desc = agotma_instigator_events.0501.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:agotma_war_target_char
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	immediate = {
		scope:instigator = {
			add_opinion = {
				target = scope:agotma_instigated_char
				modifier = insult_opinion
				opinion = -25
			}
		}
		scope:agotma_instigated_char = {
			add_opinion = {
				target = scope:instigator
				modifier = insult_opinion
				opinion = -25
			}
		}
	}

	# Oh no
	option = {
		name = agotma_instigator_events.0501.a

		agotma_instigator_story_end_effect = yes
		custom_tooltip = agotma_instigator_cancel
	}
}

# Failed & Revealed
agotma_instigator_events.0502 = {
	type = character_event
	title = agotma_instigator_events.0502.t
	desc = agotma_instigator_events.0502.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:agotma_war_target_char
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	immediate = {
		scope:instigator = {
			add_opinion = {
				target = scope:agotma_instigated_char
				modifier = insult_opinion
				opinion = -25
			}
		}
		scope:agotma_instigated_char = {
			add_opinion = {
				target = scope:instigator
				modifier = insult_opinion
				opinion = -25
			}
		}
		scope:agotma_war_target_char = {
			add_opinion = {
				target = scope:instigator
				modifier = insult_opinion
				opinion = -50
			}
		}
	}

	# Well that's bad
	option = {
		name = agotma_instigator_events.0502.a

		agotma_instigator_story_end_effect = yes
		custom_tooltip = agotma_instigator_cancel

		add_character_modifier = {
			modifier = agotma_instigator_provoked_war
			years = 10
		}
	}
}

# Diplomacy Approach
agotma_instigator_events.0503 = {
	type = character_event
	title = agotma_instigator_events.0503.t
	desc = agotma_instigator_events.0503.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:agotma_war_target_char
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	# Ok
	option = {
		name = agotma_instigator_events.0503.a

		scope:story = {
			set_variable = instigation_diplomacy_approach
		}
	}
}

# Martial Approach
agotma_instigator_events.0504 = {
	type = character_event
	title = agotma_instigator_events.0504.t
	desc = agotma_instigator_events.0504.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:agotma_war_target_char
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	# Ok
	option = {
		name = agotma_instigator_events.0504.a

		scope:story = {
			set_variable = instigation_martial_approach
		}
	}
}

# Stewardship Approach
agotma_instigator_events.0505 = {
	type = character_event
	title = agotma_instigator_events.0505.t
	desc = agotma_instigator_events.0505.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:agotma_war_target_char
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	# Ok
	option = {
		name = agotma_instigator_events.0505.a

		scope:story = {
			set_variable = instigation_stewardship_approach
		}
	}
}

# Intrigue Approach
agotma_instigator_events.0506 = {
	type = character_event
	title = agotma_instigator_events.0506.t
	desc = agotma_instigator_events.0506.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:agotma_war_target_char
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	# Ok
	option = {
		name = agotma_instigator_events.0506.a

		scope:story = {
			set_variable = instigation_intrigue_approach
		}
	}
}

# Learning Approach
agotma_instigator_events.0507 = {
	type = character_event
	title = agotma_instigator_events.0507.t
	desc = agotma_instigator_events.0507.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:agotma_war_target_char
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	# Ok
	option = {
		name = agotma_instigator_events.0507.a

		scope:story = {
			set_variable = instigation_learning_approach
		}
	}
}

# Accepted
agotma_instigator_events.0508 = {
	type = character_event
	title = agotma_instigator_events.0508.t
	desc = agotma_instigator_events.0508.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:agotma_war_target_char
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	# Ok
	option = {
		name = agotma_instigator_events.0508.a

		scope:story = {
			set_variable = instigation_accepted
		}
	}
}

# INSTIGATION STAGE 2 - Diplomacy
agotma_instigator_events.0550 = {
	type = character_event
	title = agotma_instigator_events.0550.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:potential_ally
					exists = scope:instigated_child
					exists = scope:ally_child
				}
				desc = agotma_instigator_events.0550.desc.marriage_offer
			}
			triggered_desc = {
				trigger = { exists = scope:potential_ally }
				desc = agotma_instigator_events.0550.desc.ally_offer
			}
			triggered_desc = {
				trigger = { NOT = { exists = scope:potential_ally } }
				desc = agotma_instigator_events.0550.desc.my_offer
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	left_portrait = {
		trigger = { exists = scope:potential_ally }
		character = scope:potential_ally
		animation = war_defender
	}

	lower_right_portrait = {
		trigger = { exists = scope:instigated_child }
		character = scope:instigated_child
	}

	lower_left_portrait = {
		trigger = { exists = scope:ally_child }
		character = scope:ally_child
	}

	lower_center_portrait = {
		character = scope:agotma_war_target_char
	}

	immediate = {
		if = {
			limit = {
				scope:agotma_war_target_char.liege = {
					any_vassal = {
						NOT = { this = scope:agotma_war_target_char }
						NOT = { this = scope:agotma_instigated_char }
						primary_title.tier = scope:agotma_war_target.tier
						character_is_land_realm_neighbor = scope:agotma_war_target_char
					}
				}
			}
			scope:agotma_war_target_char.liege = {
				random_vassal = {
					limit = {
						NOT = { this = scope:agotma_war_target_char }
						NOT = { this = scope:agotma_instigated_char }
						primary_title.tier = scope:agotma_war_target.tier
						character_is_land_realm_neighbor = scope:agotma_war_target_char
					}
				}
				save_scope_as = potential_ally
			}
		}

		if = {
			limit = { exists = scope:potential_ally }
			agotma_find_random_suitable_child_for_marriage = {
				OFFERING_CHARACTER = scope:agotma_instigated_char
				RECEIVING_CHARACTER = scope:potential_ally
				CHILD_OF_OFFERING_CHARACTER_SCOPE_NAME = instigated_child
				CHILD_OF_RECEIVING_CHARACTER_SCOPE_NAME = ally_child
				MARRIAGE_WILL_FAVOR_HOUSE = scope:potential_ally
				ALLOW_HEIR = no #yes/no - applied only on the non-favored house
			}
		}
	}

	# Ask for marriage and alliance
	option = {
		name = agotma_instigator_events.0550.a
		trigger = {
			exists = scope:potential_ally
			exists = scope:instigated_child
			exists = scope:ally_child
		}

		add_character_flag = {
			flag = agotma_0550_marriage_help
			days = 40
		}

		scope:potential_ally = {
			trigger_event = {
				id = agotma_instigator_events.0551
				days = 1
			}
		}
	}

	# Ask for alliance
	option = {
		name = agotma_instigator_events.0550.b
		trigger = {
			exists = scope:potential_ally
			OR = {
				NOT = { exists = scope:instigated_child }
				NOT = { exists = scope:ally_child }
			}
			agotma_valid_force_alliance = { ALLY_A = scope:potential_ally ALLY_B = scope:agotma_instigated_char }
		}

		add_character_flag = {
			flag = agotma_0550_ally_help
			days = 40
		}

		scope:potential_ally = {
			trigger_event = {
				id = agotma_instigator_events.0551
				days = 1
			}
		}
	}

	# I can offer only my alliance
	option = {
		name = agotma_instigator_events.0550.c
		trigger = {
			NOT = { exists = scope:potential_ally }
			agotma_valid_force_alliance = { ALLY_A = scope:instigator ALLY_B = scope:agotma_instigated_char }
		}

		add_character_flag = {
			flag = agotma_0550_my_help
			days = 40
		}

		show_as_tooltip = {
			agotma_force_alliance = { ALLY_A = scope:instigator ALLY_B = scope:agotma_instigated_char }
		}

		scope:agotma_instigated_char = {
			trigger_event = {
				id = agotma_instigator_events.0553
				days = 1
			}
		}

		ai_chance = {
			base = 1

			opinion_modifier = {
				who = scope:instigator
				opinion_target = scope:agotma_instigated_char
				multiplier = 1
			}
		}
	}

	# I can't help
	option = {
		name = agotma_instigator_events.0550.d

		add_character_flag = {
			flag = agotma_0550_no_help
			days = 40
		}

		scope:agotma_instigated_char = {
			trigger_event = {
				id = agotma_instigator_events.0553
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_greed = 1
			}
		}
	}
}

# Potential Ally decides
agotma_instigator_events.0551 = {
	type = character_event
	title = agotma_instigator_events.0551.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0550_marriage_help } }
				desc = agotma_instigator_events.0551.desc.marriage_offer
			}
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0550_ally_help } }
				desc = agotma_instigator_events.0551.desc.ally_offer
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	left_portrait = {
		character = scope:agotma_instigated_char
		animation = war_defender
	}

	lower_center_portrait = {
		character = scope:agotma_war_target_char
	}

	right_portrait = {
		character = scope:instigator
		animation = personality_rational
	}

	lower_right_portrait = {
		trigger = { exists = scope:instigated_child }
		character = scope:instigated_child
	}

	lower_left_portrait = {
		trigger = { exists = scope:ally_child }
		character = scope:ally_child
	}

	# Accept marriage
	option = {
		name = agotma_instigator_events.0551.a
		trigger = { scope:instigator = { has_character_flag = agotma_0550_marriage_help } }

		show_as_tooltip = {
			agotma_marry_random_suitable_child = {
				OFFERING_CHARACTER = scope:agotma_instigated_char
				RECEIVING_CHARACTER = scope:potential_ally
				OFFERING_CHARACTER_CHILD = scope:instigated_child
				RECEIVING_CHARACTER_CHILD = scope:ally_child
			}
		}

		add_character_flag = {
			flag = agotma_0551_marriage
			days = 1
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0552
				days = 1
			}
		}

		ai_chance = {
			base = 1

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = 1
			}

			opinion_modifier = {
				who = scope:agotma_war_target_char
				opinion_target = scope:instigator
				multiplier = -1
			}
		}
	}

	# Accept alliance
	option = {
		name = agotma_instigator_events.0551.b
		trigger = {
			scope:instigator = { has_character_flag = agotma_0550_ally_help }
			agotma_valid_force_alliance = { ALLY_A = scope:potential_ally ALLY_B = scope:agotma_instigated_char }
		}

		show_as_tooltip = {
			agotma_force_alliance = { ALLY_A = scope:potential_ally ALLY_B = scope:agotma_instigated_char }
		}

		add_character_flag = {
			flag = agotma_0551_ally
			days = 1
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0552
				days = 1
			}
		}

		ai_chance = {
			base = 1

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = 1
			}

			opinion_modifier = {
				who = scope:agotma_war_target_char
				opinion_target = scope:instigator
				multiplier = -1
			}
		}
	}

	# Refuse
	option = {
		name = agotma_instigator_events.0551.c

		add_character_flag = {
			flag = agotma_0551_nope
			days = 1
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0552
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_compassion = -1
				ai_sociability = -1
			}
		}
	}
}

# Instigator decides
agotma_instigator_events.0552 = {
	type = character_event
	title = agotma_instigator_events.0552.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:potential_ally = { has_character_flag = agotma_0551_marriage } }
				desc = agotma_instigator_events.0552.desc.marriage_accepted
			}
			triggered_desc = {
				trigger = { scope:potential_ally = { has_character_flag = agotma_0551_ally } }
				desc = agotma_instigator_events.0552.desc.ally_accepted
			}
			triggered_desc = {
				trigger = { scope:potential_ally = { has_character_flag = agotma_0551_nope } }
				desc = agotma_instigator_events.0552.desc.refused
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	left_portrait = {
		character = scope:agotma_instigated_char
		animation = war_defender
	}

	lower_center_portrait = {
		character = scope:agotma_war_target_char
	}

	right_portrait = {
		character = scope:potential_ally
		animation = personality_rational
	}

	lower_right_portrait = {
		trigger = { exists = scope:instigated_child }
		character = scope:instigated_child
	}

	lower_left_portrait = {
		trigger = { exists = scope:ally_child }
		character = scope:ally_child
	}

	# Ok
	option = {
		name = agotma_instigator_events.0552.a
		trigger = {
			OR = {
				scope:potential_ally = { has_character_flag = agotma_0551_marriage }
				scope:potential_ally = { has_character_flag = agotma_0551_ally }
			}
		}

		if = {
			limit = { scope:potential_ally = { has_character_flag = agotma_0551_marriage } }
			show_as_tooltip = {
				agotma_marry_random_suitable_child = {
					OFFERING_CHARACTER = scope:agotma_instigated_char
					RECEIVING_CHARACTER = scope:potential_ally
					OFFERING_CHARACTER_CHILD = scope:instigated_child
					RECEIVING_CHARACTER_CHILD = scope:ally_child
				}
			}
		}
		else_if = {
			limit = { scope:potential_ally = { has_character_flag = agotma_0551_ally } }
			show_as_tooltip = {
				agotma_force_alliance = { ALLY_A = scope:potential_ally ALLY_B = scope:agotma_instigated_char }
			}
		}


		scope:agotma_instigated_char = {
			trigger_event = {
				id = agotma_instigator_events.0553
				days = 1
			}
		}
	}

	# Accept alliance
	option = {
		name = agotma_instigator_events.0552.b
		trigger = {
			NOT = { scope:potential_ally = { has_character_flag = agotma_0551_marriage } }
			NOT = { scope:potential_ally = { has_character_flag = agotma_0551_ally } }
		}

		add_character_flag = {
			flag = agotma_0550_my_help
			days = 40
		}

		show_as_tooltip = {
			agotma_force_alliance = { ALLY_A = scope:instigator ALLY_B = scope:agotma_instigated_char }
		}

		scope:agotma_instigated_char = {
			trigger_event = {
				id = agotma_instigator_events.0553
				days = 1
			}
		}

		ai_chance = {
			base = 1

			opinion_modifier = {
				who = scope:instigator
				opinion_target = scope:agotma_instigated_char
				multiplier = 1
			}
		}
	}

	# Refuse
	option = {
		name = agotma_instigator_events.0552.c
		trigger = {
			NOT = { scope:potential_ally = { has_character_flag = agotma_0551_marriage } }
			NOT = { scope:potential_ally = { has_character_flag = agotma_0551_ally } }
		}

		add_character_flag = {
			flag = agotma_0550_no_help
			days = 40
		}

		scope:agotma_instigated_char = {
			trigger_event = {
				id = agotma_instigator_events.0553
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_greed = 1
			}
		}
	}
}

# Instigated Char notified
agotma_instigator_events.0553 = {
	type = character_event
	title = agotma_instigator_events.0553.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:potential_ally = { has_character_flag = agotma_0551_marriage } }
				desc = agotma_instigator_events.0553.desc.marriage_accepted
			}
			triggered_desc = {
				trigger = { scope:potential_ally = { has_character_flag = agotma_0551_ally } }
				desc = agotma_instigator_events.0553.desc.ally_accepted
			}
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0550_my_help } }
				desc = agotma_instigator_events.0553.desc.instigators_help
			}
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0550_no_help } }
				desc = agotma_instigator_events.0553.desc.no_help
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	left_portrait = {
		character = scope:potential_ally
		animation = war_defender
	}

	lower_center_portrait = {
		character = scope:agotma_war_target_char
	}

	right_portrait = {
		character = scope:instigator
		animation = personality_rational
	}

	lower_right_portrait = {
		trigger = { exists = scope:instigated_child }
		character = scope:instigated_child
	}

	lower_left_portrait = {
		trigger = { exists = scope:ally_child }
		character = scope:ally_child
	}

	# Good
	option = {
		name = agotma_instigator_events.0553.a
		trigger = {
			OR = {
				scope:potential_ally = { has_character_flag = agotma_0551_marriage }
				scope:potential_ally = { has_character_flag = agotma_0551_ally }
				scope:instigator = { has_character_flag = agotma_0550_my_help }
			}
		}

		if = {
			limit = { scope:potential_ally = { has_character_flag = agotma_0551_marriage } }
			agotma_marry_random_suitable_child = {
				OFFERING_CHARACTER = scope:agotma_instigated_char
				RECEIVING_CHARACTER = scope:potential_ally
				OFFERING_CHARACTER_CHILD = scope:instigated_child
				RECEIVING_CHARACTER_CHILD = scope:ally_child
			}
		}
		else_if = {
			limit = { scope:potential_ally = { has_character_flag = agotma_0551_ally } }
			agotma_force_alliance = { ALLY_A = scope:potential_ally ALLY_B = scope:agotma_instigated_char }
		}
		else = {
			agotma_force_alliance = { ALLY_A = scope:instigator ALLY_B = scope:agotma_instigated_char }
		}

		add_character_flag = {
			flag = agotma_0553_i_accept
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0554
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_boldness = 1
			}

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:potential_ally
				multiplier = 1
			}
		}
	}

	# Refuse
	option = {
		name = agotma_instigator_events.0553.b
		trigger = {
			OR = {
				scope:potential_ally = { has_character_flag = agotma_0551_marriage }
				scope:potential_ally = { has_character_flag = agotma_0551_ally }
				scope:instigator = { has_character_flag = agotma_0550_my_help }
			}
		}

		add_character_flag = {
			flag = agotma_0553_i_refuse
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0554
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_greed = -1
			}

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:potential_ally
				multiplier = -1
			}
		}
	}

	# Stop
	option = {
		name = agotma_instigator_events.0553.c
		trigger = {
			NOT = { scope:potential_ally = { has_character_flag = agotma_0551_marriage } }
			NOT = { scope:potential_ally = { has_character_flag = agotma_0551_ally } }
		}

		add_character_flag = {
			flag = agotma_0553_i_stop
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0554
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_greed = -1
			}

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = -1
			}
		}
	}

	# Continue Anyway
	option = {
		name = agotma_instigator_events.0553.d
		trigger = {
			NOT = { scope:potential_ally = { has_character_flag = agotma_0551_marriage } }
			NOT = { scope:potential_ally = { has_character_flag = agotma_0551_ally } }
		}

		add_character_flag = {
			flag = agotma_0553_i_continue
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0554
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_rationality = -0.5
				ai_energy = 0.5
			}

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = 1
			}
		}
	}
}

# Instigator notified
agotma_instigator_events.0554 = {
	type = character_event
	title = agotma_instigator_events.0554.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_accept } }
				desc = agotma_instigator_events.0554.desc.i_accept
			}
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_refuse } }
				desc = agotma_instigator_events.0554.desc.i_refuse
			}
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_stop } }
				desc = agotma_instigator_events.0554.desc.i_stop
			}
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_continue } }
				desc = agotma_instigator_events.0554.desc.i_continue
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:agotma_war_target_char
		animation = war_defender
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	# Ok
	option = {
		name = {
			trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_accept } }
			text = agotma_instigator_events.0554.a.accept
		}
		name = {
			trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_refuse } }
			text = agotma_instigator_events.0554.a.refuse
		}
		name = {
			trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_stop } }
			text = agotma_instigator_events.0554.a.stop
		}
		name = {
			trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_continue } }
			text = agotma_instigator_events.0554.a.continue
		}

		if = {
			limit = {
				OR = {
					scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_accept }
					scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_continue }
				}
			}
			scope:story = { set_variable = instigation_can_be_finished }
		}

		if = {
			limit = {
				OR = {
					scope:potential_ally = { has_character_flag = agotma_0551_marriage }
					scope:potential_ally = { has_character_flag = agotma_0551_ally }
				}
				scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_accept }
			}
			scope:potential_ally = {
				trigger_event = {
					id = agotma_instigator_events.0555
					days = 1
				}
			}
		}
		else_if = {
			limit = {
				OR = {
					scope:potential_ally = { has_character_flag = agotma_0551_marriage }
					scope:potential_ally = { has_character_flag = agotma_0551_ally }
				}
				scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_refuse }
			}

			scope:potential_ally = {
				trigger_event = {
					id = agotma_instigator_events.0555
					days = 1
				}
			}
		}
		else_if = {
			limit = {
				scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_continue }
			}
			scope:instigator = {
				add_opinion = {
					target = scope:agotma_instigated_char
					modifier = grateful_opinion
					opinion = 25
				}
			}
		}
		else_if = {
			limit = {
				scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_stop }
			}
			scope:instigator = {
				add_opinion = {
					target = scope:agotma_instigated_char
					modifier = insult_opinion
					opinion = -25
				}
			}

			agotma_instigator_story_end_effect = yes
			custom_tooltip = agotma_instigator_cancel
		}
	}
}

# Potential ally notified
agotma_instigator_events.0555 = {
	type = character_event
	title = agotma_instigator_events.0555.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_accept } }
				desc = agotma_instigator_events.0555.desc.i_accept
			}
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_refuse } }
				desc = agotma_instigator_events.0555.desc.i_refuse
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	left_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	lower_left_portrait = {
		trigger = { exists = scope:instigated_child }
		character = scope:instigated_child
	}

	lower_right_portrait = {
		trigger = { exists = scope:ally_child }
		character = scope:ally_child
	}

	# Ok
	option = {
		name = agotma_instigator_events.0555.a
		trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_accept } }

		add_opinion = {
			target = scope:agotma_instigated_char
			modifier = grateful_opinion
			opinion = 25
		}
	}

	# Ok
	option = {
		name = agotma_instigator_events.0555.b
		trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0553_i_refuse } }

		add_opinion = {
			target = scope:agotma_instigated_char
			modifier = insult_opinion
			opinion = -25
		}
	}
}

# INSTIGATION STAGE 2 - Martial
agotma_instigator_events.0560 = {
	type = character_event
	title = agotma_instigator_events.0560.t
	desc = agotma_instigator_events.0560.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	# Ok
	option = {
		name = agotma_instigator_events.0560.a
		skill = martial

		random_list = {
			0 = {
				add_character_flag = {
					flag = agotma_0560_success
					days = 40
				}
				custom_tooltip = agotma_instigator_events_0561_success
				scope:instigator = {
					trigger_event = agotma_instigator_events.0561
				}
				modifier = { add = scope:instigator.martial }
			}
			15 = {
				add_character_flag = {
					flag = agotma_0560_failure
					days = 40
				}
				custom_tooltip = agotma_instigator_events_0561_failure
				scope:instigator = {
					trigger_event = agotma_instigator_events.0561
				}
			}
		}
	}
}

# Outcome of mercenary army hire
agotma_instigator_events.0561 = {
	type = character_event
	title = agotma_instigator_events.0561.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0560_success } }
				desc = agotma_instigator_events.0561.desc.success
			}
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0560_failure } }
				desc = agotma_instigator_events.0561.desc.failure
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	# Success
	option = {
		name = agotma_instigator_events.0561.a
		trigger = { scope:instigator = { has_character_flag = agotma_0560_success } }

		show_as_tooltip = {
			scope:agotma_instigated_char = {
				spawn_army = {
					men_at_arms = {
						type = armored_footmen
						stacks = 10
					}
					men_at_arms = {
						type = light_footmen
						stacks = 25
					}
					men_at_arms = {
						type = bowmen
						stacks = 5
					}
					inheritable = no
					location = scope:agotma_instigated_char.location
					name = agotma_spawn_army_name
				}
			}
		}

		scope:agotma_instigated_char = {
			trigger_event = {
				id = agotma_instigator_events.0562
				days = 1
			}
		}
	}

	# Failure
	option = {
		name = agotma_instigator_events.0561.b
		trigger = { scope:instigator = { has_character_flag = agotma_0560_failure } }

		add_stress = medium_stress_gain

		scope:agotma_instigated_char = {
			trigger_event = {
				id = agotma_instigator_events.0562
				days = 1
			}
		}
	}
}

# Instigated char notified
agotma_instigator_events.0562 = {
	type = character_event
	title = agotma_instigator_events.0562.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0560_success } }
				desc = agotma_instigator_events.0562.desc.success
			}
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0560_failure } }
				desc = agotma_instigator_events.0562.desc.failure
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	# I accept
	option = {
		name = agotma_instigator_events.0562.a
		trigger = { scope:instigator = { has_character_flag = agotma_0560_success } }

		scope:agotma_instigated_char = {
			spawn_army = {
				men_at_arms = {
					type = armored_footmen
					stacks = 10
				}
				men_at_arms = {
					type = light_footmen
					stacks = 25
				}
				men_at_arms = {
					type = bowmen
					stacks = 5
				}
				inheritable = no
				location = scope:agotma_instigated_char.location
				name = agotma_spawn_army_name
			}
		}

		add_character_flag = {
			flag = agotma_0562_accept
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0563
				days = 1
			}
		}
	}

	# Sad, but I'll continue
	option = {
		name = agotma_instigator_events.0562.b
		trigger = { scope:instigator = { has_character_flag = agotma_0560_failure } }

		add_character_flag = {
			flag = agotma_0562_continue
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0563
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_rationality = -0.5
				ai_energy = 0.5
			}

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = 1
			}
		}
	}

	# I'll stop (refuse)
	option = {
		name = agotma_instigator_events.0562.c
		trigger = { scope:instigator = { has_character_flag = agotma_0560_failure } }

		add_character_flag = {
			flag = agotma_0562_refuse
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0563
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_greed = -1
			}

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = -1
			}
		}
	}
}

# Instigator notified
agotma_instigator_events.0563 = {
	type = character_event
	title = agotma_instigator_events.0563.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0562_accept } }
				desc = agotma_instigator_events.0563.desc.i_accept
			}
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0562_continue } }
				desc = agotma_instigator_events.0563.desc.i_continue
			}
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0562_refuse } }
				desc = agotma_instigator_events.0563.desc.i_stop
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:agotma_war_target_char
		animation = war_defender
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	# Ok
	option = {
		name = {
			trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0562_accept } }
			text = agotma_instigator_events.0563.a.accept
		}
		name = {
			trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0562_continue } }
			text = agotma_instigator_events.0563.a.continue
		}
		name = {
			trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0562_refuse } }
			text = agotma_instigator_events.0563.a.refuse
		}

		if = {
			limit = {
				OR = {
					scope:agotma_instigated_char = { has_character_flag = agotma_0562_accept }
					scope:agotma_instigated_char = { has_character_flag = agotma_0562_continue }
				}
			}
			scope:story = { set_variable = instigation_can_be_finished }
		}

		if = {
			limit = {
				scope:agotma_instigated_char = { has_character_flag = agotma_0562_continue }
			}
			scope:instigator = {
				add_opinion = {
					target = scope:agotma_instigated_char
					modifier = grateful_opinion
					opinion = 25
				}
			}
		}
		else_if = {
			limit = {
				scope:agotma_instigated_char = { has_character_flag = agotma_0562_refuse }
			}
			scope:instigator = {
				add_opinion = {
					target = scope:agotma_instigated_char
					modifier = insult_opinion
					opinion = -25
				}
			}

			agotma_instigator_story_end_effect = yes
			custom_tooltip = agotma_instigator_cancel
		}
	}
}

# INSTIGATION STAGE 2 - Stewardship
agotma_instigator_events.0570 = {
	type = character_event
	title = agotma_instigator_events.0570.t
	desc = agotma_instigator_events.0570.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	# Ok
	option = {
		name = agotma_instigator_events.0570.a
		trigger = { scope:instigator.gold >= 500 }

		add_character_flag = {
			flag = agotma_0570_has_gold
			days = 40
		}

		show_as_tooltip = {
			scope:instigator = {
				pay_short_term_gold = {
					target = scope:agotma_instigated_char
					gold = 500
				}
			}
		}

		scope:agotma_instigated_char = {
			trigger_event = {
				id = agotma_instigator_events.0571
				days = 1
			}
		}
	}

	# Ok
	option = {
		name = agotma_instigator_events.0570.b
		trigger = { scope:instigator.gold < 500 }

		add_character_flag = {
			flag = agotma_0570_no_gold
			days = 40
		}

		scope:agotma_instigated_char = {
			trigger_event = {
				id = agotma_instigator_events.0571
				days = 1
			}
		}
	}
}

# Instigated char notified
agotma_instigator_events.0571 = {
	type = character_event
	title = agotma_instigator_events.0571.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0570_has_gold } }
				desc = agotma_instigator_events.0571.desc.has_gold
			}
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0570_no_gold } }
				desc = agotma_instigator_events.0571.desc.no_gold
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	# I accept
	option = {
		name = agotma_instigator_events.0571.a
		trigger = { scope:instigator = { has_character_flag = agotma_0570_has_gold } }

		scope:instigator = {
			pay_short_term_gold = {
				target = scope:agotma_instigated_char
				gold = 500
			}
		}

		add_character_flag = {
			flag = agotma_0572_accept
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0572
				days = 1
			}
		}
	}

	# Sad, but I'll continue
	option = {
		name = agotma_instigator_events.0571.b
		trigger = { scope:instigator = { has_character_flag = agotma_0570_no_gold } }

		add_character_flag = {
			flag = agotma_0572_continue
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0572
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_rationality = -0.5
				ai_energy = 0.5
			}

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = 1
			}
		}
	}

	# I'll stop (refuse)
	option = {
		name = agotma_instigator_events.0571.c
		trigger = { scope:instigator = { has_character_flag = agotma_0570_no_gold } }

		add_character_flag = {
			flag = agotma_0572_refuse
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0572
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_greed = -1
			}

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = -1
			}
		}
	}
}

# Instigator notified
agotma_instigator_events.0572 = {
	type = character_event
	title = agotma_instigator_events.0572.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0572_accept } }
				desc = agotma_instigator_events.0572.desc.i_accept
			}
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0572_continue } }
				desc = agotma_instigator_events.0572.desc.i_continue
			}
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0572_refuse } }
				desc = agotma_instigator_events.0572.desc.i_stop
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:agotma_war_target_char
		animation = war_defender
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	# Ok
	option = {
		name = {
			trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0572_accept } }
			text = agotma_instigator_events.0572.a.accept
		}
		name = {
			trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0572_continue } }
			text = agotma_instigator_events.0572.a.continue
		}
		name = {
			trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0572_refuse } }
			text = agotma_instigator_events.0572.a.refuse
		}

		if = {
			limit = {
				OR = {
					scope:agotma_instigated_char = { has_character_flag = agotma_0572_accept }
					scope:agotma_instigated_char = { has_character_flag = agotma_0572_continue }
				}
			}
			scope:story = { set_variable = instigation_can_be_finished }
		}

		if = {
			limit = {
				scope:agotma_instigated_char = { has_character_flag = agotma_0572_continue }
			}
			scope:instigator = {
				add_opinion = {
					target = scope:agotma_instigated_char
					modifier = grateful_opinion
					opinion = 25
				}
			}
		}
		else_if = {
			limit = {
				scope:agotma_instigated_char = { has_character_flag = agotma_0572_refuse }
			}
			scope:instigator = {
				add_opinion = {
					target = scope:agotma_instigated_char
					modifier = insult_opinion
					opinion = -25
				}
			}

			agotma_instigator_story_end_effect = yes
			custom_tooltip = agotma_instigator_cancel
		}
	}
}

# INSTIGATION STAGE 2 - Intrigue
agotma_instigator_events.0580 = {
	type = character_event
	title = agotma_instigator_events.0580.t
	desc = agotma_instigator_events.0580.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	immediate = {
		if = {
			limit = { NOT = { scope:agotma_war_target_char = scope:agotma_war_target_char.liege } }
			scope:agotma_war_target_char.liege = { save_scope_as = hooked_target_char }
		}
		else_if = {
			limit = {
				scope:agotma_war_target_char.liege = {
					any_vassal = {
						NOT = { this = scope:agotma_war_target_char }
						NOT = { this = scope:agotma_instigated_char }
						primary_title.tier >= tier_county
						character_is_land_realm_neighbor = scope:agotma_war_target_char
					}
				}
			}
			scope:agotma_war_target_char.liege = {
				random_vassal = {
					limit = {
						NOT = { this = scope:agotma_war_target_char }
						NOT = { this = scope:agotma_instigated_char }
						primary_title.tier >= tier_county
						character_is_land_realm_neighbor = scope:agotma_war_target_char
					}
				}
				save_scope_as = hooked_target_char
			}
		}
	}

	# Ok
	option = {
		name = agotma_instigator_events.0580.a
		skill = intrigue

		random_list = {
			0 = {
				trigger = {
					AND = {
						exists = scope:hooked_target_char
						scope:agotma_instigated_char = {
							can_add_hook = {
								type = favor_hook
								target = scope:hooked_target_char
							}
						}
					}
				}
				add_character_flag = {
					flag = agotma_0580_success
					days = 40
				}
				custom_tooltip = agotma_instigator_events_0581_success
				scope:instigator = {
					trigger_event = agotma_instigator_events.0581
				}
				modifier = { add = scope:instigator.intrigue }
				modifier = {
					scope:hooked_target_char.primary_title.tier = tier_hegemony
					add = -10
				}
				modifier = {
					scope:hooked_target_char.primary_title.tier = tier_empire
					add = -5
				}
				modifier = {
					scope:hooked_target_char.primary_title.tier = tier_kingdom
					add = -2
				}
			}
			15 = {
				add_character_flag = {
					flag = agotma_0580_failure
					days = 40
				}
				custom_tooltip = agotma_instigator_events_0581_failure
				scope:instigator = {
					trigger_event = agotma_instigator_events.0581
				}
			}
		}
	}
}

# Outcome of hook gain
agotma_instigator_events.0581 = {
	type = character_event
	title = agotma_instigator_events.0581.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0580_success } }
				desc = agotma_instigator_events.0581.desc.success
			}
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0580_failure } }
				desc = agotma_instigator_events.0581.desc.failure
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	# Success
	option = {
		name = agotma_instigator_events.0581.a
		trigger = {
			scope:instigator = { has_character_flag = agotma_0580_success }
			scope:agotma_instigated_char = {
				can_add_hook = {
					type = favor_hook
					target = scope:hooked_target_char
				}
			}
		}
		show_as_tooltip = {
			scope:agotma_instigated_char = {
				add_hook = {
					type = favor_hook
					target = scope:hooked_target_char
				}
			}
		}

		scope:agotma_instigated_char = {
			trigger_event = {
				id = agotma_instigator_events.0582
				days = 1
			}
		}
	}

	# Failure
	option = {
		name = agotma_instigator_events.0581.b
		trigger = { scope:instigator = { has_character_flag = agotma_0580_failure } }

		add_stress = medium_stress_gain

		scope:agotma_instigated_char = {
			trigger_event = {
				id = agotma_instigator_events.0582
				days = 1
			}
		}
	}
}

# Instigated char notified
agotma_instigator_events.0582 = {
	type = character_event
	title = agotma_instigator_events.0582.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0580_success } }
				desc = agotma_instigator_events.0582.desc.success
			}
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0580_failure } }
				desc = agotma_instigator_events.0582.desc.failure
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:hooked_target_char
		animation = personality_rational
	}

	left_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_bold
	}

	# I accept
	option = {
		name = agotma_instigator_events.0582.a
		trigger = { scope:instigator = { has_character_flag = agotma_0580_success } }

		scope:agotma_instigated_char = {
			add_hook = {
				type = favor_hook
				target = scope:hooked_target_char
			}
		}

		add_character_flag = {
			flag = agotma_0582_accept
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0583
				days = 1
			}
		}
	}

	# Sad, but I'll continue
	option = {
		name = agotma_instigator_events.0582.b
		trigger = { scope:instigator = { has_character_flag = agotma_0580_failure } }

		add_character_flag = {
			flag = agotma_0582_continue
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0583
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_rationality = -0.5
				ai_energy = 0.5
			}

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = 1
			}
		}
	}

	# I'll stop (refuse)
	option = {
		name = agotma_instigator_events.0582.c
		trigger = { scope:instigator = { has_character_flag = agotma_0580_failure } }

		add_character_flag = {
			flag = agotma_0582_refuse
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0583
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_greed = -1
			}

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = -1
			}
		}
	}
}

# Instigator notified
agotma_instigator_events.0583 = {
	type = character_event
	title = agotma_instigator_events.0583.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0582_accept } }
				desc = agotma_instigator_events.0583.desc.i_accept
			}
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0582_continue } }
				desc = agotma_instigator_events.0583.desc.i_continue
			}
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0582_refuse } }
				desc = agotma_instigator_events.0583.desc.i_stop
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:agotma_war_target_char
		animation = war_defender
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	# Ok
	option = {
		name = {
			trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0582_accept } }
			text = agotma_instigator_events.0583.a.accept
		}
		name = {
			trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0582_continue } }
			text = agotma_instigator_events.0583.a.continue
		}
		name = {
			trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0582_refuse } }
			text = agotma_instigator_events.0583.a.refuse
		}

		if = {
			limit = {
				OR = {
					scope:agotma_instigated_char = { has_character_flag = agotma_0582_accept }
					scope:agotma_instigated_char = { has_character_flag = agotma_0582_continue }
				}
			}
			scope:story = { set_variable = instigation_can_be_finished }
		}

		if = {
			limit = {
				scope:agotma_instigated_char = { has_character_flag = agotma_0582_continue }
			}
			scope:instigator = {
				add_opinion = {
					target = scope:agotma_instigated_char
					modifier = grateful_opinion
					opinion = 25
				}
			}
		}
		else_if = {
			limit = {
				scope:agotma_instigated_char = { has_character_flag = agotma_0582_refuse }
			}
			scope:instigator = {
				add_opinion = {
					target = scope:agotma_instigated_char
					modifier = insult_opinion
					opinion = -25
				}
			}

			agotma_instigator_story_end_effect = yes
			custom_tooltip = agotma_instigator_cancel
		}
	}
}

# INSTIGATION STAGE 2 - Learning
agotma_instigator_events.0590 = {
	type = character_event
	title = agotma_instigator_events.0590.t
	desc = agotma_instigator_events.0590.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	immediate = { title:k_the_most_devout.holder = { save_scope_as = high_septon } }

	# Ok
	option = {
		name = agotma_instigator_events.0590.a
		skill = learning

		random_list = {
			0 = {
				add_character_flag = {
					flag = agotma_0590_success
					days = 40
				}
				custom_tooltip = agotma_instigator_events_0590_success
				scope:instigator = {
					trigger_event = agotma_instigator_events.0591
				}
				modifier = { add = scope:instigator.learning }
			}
			15 = {
				add_character_flag = {
					flag = agotma_0590_failure
					days = 40
				}
				custom_tooltip = agotma_instigator_events_0590_failure
				scope:instigator = {
					trigger_event = agotma_instigator_events.0591
				}
			}
		}
	}
}

# Outcome of asking hight septon for a meeting
agotma_instigator_events.0591 = {
	type = character_event
	title = agotma_instigator_events.0591.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0590_success } }
				desc = agotma_instigator_events.0591.desc.success
			}
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0590_failure } }
				desc = agotma_instigator_events.0591.desc.failure
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:high_septon
		animation = personality_rational
	}

	immediate = { title:k_the_most_devout.holder = { save_scope_as = high_septon } }

	# Success
	option = {
		name = agotma_instigator_events.0591.a
		trigger = { scope:instigator = { has_character_flag = agotma_0590_success } }

		scope:agotma_instigated_char = {
			trigger_event = {
				id = agotma_instigator_events.0592
				days = 1
			}
		}
	}

	# Failure
	option = {
		name = agotma_instigator_events.0581.b
		trigger = { scope:instigator = { has_character_flag = agotma_0590_failure } }

		add_stress = medium_stress_gain

		scope:agotma_instigated_char = {
			trigger_event = {
				id = agotma_instigator_events.0592
				days = 1
			}
		}
	}
}

# Instigated char notified
agotma_instigator_events.0592 = {
	type = character_event
	title = agotma_instigator_events.0592.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0590_success } }
				desc = agotma_instigator_events.0592.desc.success
			}
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0590_failure } }
				desc = agotma_instigator_events.0592.desc.failure
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:instigator
	}

	right_portrait = {
		character = scope:high_septon
		animation = personality_rational
	}

	# I accept
	option = {
		name = agotma_instigator_events.0592.a
		trigger = { scope:instigator = { has_character_flag = agotma_0590_success } }

		custom_tooltip = agotma_instigator_events.0592.a.tt

		add_character_flag = {
			flag = agotma_0592_accept
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0593
				days = 1
			}
		}
	}

	# Sad, but I'll continue
	option = {
		name = agotma_instigator_events.0592.b
		trigger = { scope:instigator = { has_character_flag = agotma_0590_failure } }

		add_character_flag = {
			flag = agotma_0592_continue
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0593
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_rationality = -0.5
				ai_energy = 0.5
			}

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = 1
			}
		}
	}

	# I'll stop (refuse)
	option = {
		name = agotma_instigator_events.0592.c
		trigger = { scope:instigator = { has_character_flag = agotma_0590_failure } }

		add_character_flag = {
			flag = agotma_0592_refuse
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0593
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_greed = -1
			}

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = -1
			}
		}
	}
}

# Instigator notified
agotma_instigator_events.0593 = {
	type = character_event
	title = agotma_instigator_events.0593.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0592_accept } }
				desc = agotma_instigator_events.0593.desc.i_accept
			}
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0592_continue } }
				desc = agotma_instigator_events.0593.desc.i_continue
			}
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0592_refuse } }
				desc = agotma_instigator_events.0593.desc.i_stop
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:agotma_war_target_char
		animation = war_defender
	}

	lower_center_portrait = {
		character = scope:high_septon
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	# Ok
	option = {
		name = {
			trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0592_accept } }
			text = agotma_instigator_events.0593.a.accept
		}
		name = {
			trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0592_continue } }
			text = agotma_instigator_events.0593.a.continue
		}
		name = {
			trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_0592_refuse } }
			text = agotma_instigator_events.0593.a.refuse
		}

		if = {
			limit = { scope:agotma_instigated_char = { has_character_flag = agotma_0592_continue } }
			scope:story = { set_variable = instigation_can_be_finished }
		}

		if = {
			limit = { scope:agotma_instigated_char = { has_character_flag = agotma_0592_accept } }
			scope:instigator = { trigger_event = agotma_instigator_events.0594 }
		}

		if = {
			limit = {
				scope:agotma_instigated_char = { has_character_flag = agotma_0592_continue }
			}
			scope:instigator = {
				add_opinion = {
					target = scope:agotma_instigated_char
					modifier = grateful_opinion
					opinion = 25
				}
			}
		}
		else_if = {
			limit = {
				scope:agotma_instigated_char = { has_character_flag = agotma_0592_refuse }
			}
			scope:instigator = {
				add_opinion = {
					target = scope:agotma_instigated_char
					modifier = insult_opinion
					opinion = -25
				}
			}

			agotma_instigator_story_end_effect = yes
			custom_tooltip = agotma_instigator_cancel
		}
	}
}

# High Septon event - Instigator
agotma_instigator_events.0594 = {
	type = character_event
	title = agotma_instigator_events.0594.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:high_septon = { has_character_flag = agotma_0590_like_piety } }
				desc = agotma_instigator_events.0594.desc.like_piety
			}
			triggered_desc = {
				trigger = { scope:high_septon = { has_character_flag = agotma_0590_like_gold } }
				desc = agotma_instigator_events.0594.desc.like_gold
			}
			triggered_desc = {
				trigger = { scope:high_septon = { has_character_flag = agotma_0590_like_claim } }
				desc = agotma_instigator_events.0594.desc.like_claim
			}
			triggered_desc = {
				trigger = { scope:high_septon = { has_character_flag = agotma_0590_sent_away } }
				desc = agotma_instigator_events.0594.desc.no_like
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	left_portrait = {
		character = scope:high_septon
		animation = chaplain
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	immediate = {
		title:k_the_most_devout.holder = { save_scope_as = high_septon }
		title:k_the_most_devout.holder = {
			save_opinion_value_as = {
				name = opinion_of_instigated
				target = scope:agotma_instigated_char
			}
		}
		random_list = {
			0 = {
				modifier = { add = scope:opinion_of_instigated }
				random_list = {
					0 = {
						modifier = { add = scope:high_septon.ai_greed }
						title:k_the_most_devout.holder = {
							add_character_flag = {
								flag = agotma_0590_like_piety
								days = 40
							}
						}
					}
					0 = {
						modifier = { add = scope:opinion_of_instigated }
						title:k_the_most_devout.holder = {
							add_character_flag = {
								flag = agotma_0590_like_gold
								days = 40
							}
						}
					}
					0 = {
						trigger = {
							NOT = { scope:agotma_war_target_char = scope:agotma_war_target_char.liege }
						}
						modifier = {
							add = {
								value = scope:agotma_instigated_char.ai_zeal
								multiply = 0.5
							}
						}
						modifier = {
							add = {
								value = scope:high_septon.ai_rationality
								multiply = -0.5
							}
						}
						scope:agotma_war_target_char.liege.primary_title = { save_scope_as = new_agotma_war_target_temp }
						title:k_the_most_devout.holder = {
							add_character_flag = {
								flag = agotma_0590_like_claim
								days = 40
							}
						}
					}
				}
			}
			50 = {
				title:k_the_most_devout.holder = {
					add_character_flag = {
						flag = agotma_0590_sent_away
						days = 40
					}
				}
			}
		}
	}

	# Good
	option = {
		name = agotma_instigator_events.0594.a
		trigger = {
			OR = {
				scope:high_septon = { has_character_flag = agotma_0590_like_piety }
				scope:high_septon = { has_character_flag = agotma_0590_like_gold }
			}
		}
		if = {
			limit = { scope:high_septon = { has_character_flag = agotma_0590_like_piety } }
			scope:agotma_instigated_char = {
				show_as_tooltip = {
					add_piety = 500
				}
				trigger_event = {
					id = agotma_instigator_events.0595
					days = 1
				}
			}
		}
		else_if = {
			limit = { scope:high_septon = { has_character_flag = agotma_0590_like_gold } }
			scope:agotma_instigated_char = {
				show_as_tooltip = {
					scope:high_septon = {
						pay_short_term_gold = {
							target = scope:agotma_instigated_char
							gold = 500
						}
					}
				}

				trigger_event = {
					id = agotma_instigator_events.0595
					days = 1
				}
			}
		}
	}

	# Huh..
	option = {
		name = agotma_instigator_events.0594.b
		trigger = {
			scope:high_septon = { has_character_flag = agotma_0590_like_claim }
		}

		scope:agotma_instigated_char = {
			show_as_tooltip = {
				add_pressed_claim = scope:agotma_war_target_char.liege.primary_title
			}
			trigger_event = {
				id = agotma_instigator_events.0595
				days = 1
			}
		}
	}

	# Oops
	option = {
		name = agotma_instigator_events.0594.c
		trigger = {
			scope:high_septon = { has_character_flag = agotma_0590_sent_away }
		}

		scope:agotma_instigated_char = {
			show_as_tooltip = {
				add_opinion = {
					target = scope:high_septon
					modifier = insult_opinion
					opinion = -25
				}
			}
			trigger_event = {
				id = agotma_instigator_events.0595
				days = 1
			}
		}
	}
}

# High Septon event - Instigated char
agotma_instigator_events.0595 = {
	type = character_event
	title = agotma_instigator_events.0595.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:high_septon = { has_character_flag = agotma_0590_like_piety } }
				desc = agotma_instigator_events.0595.desc.like_piety
			}
			triggered_desc = {
				trigger = { scope:high_septon = { has_character_flag = agotma_0590_like_gold } }
				desc = agotma_instigator_events.0595.desc.like_gold
			}
			triggered_desc = {
				trigger = { scope:high_septon = { has_character_flag = agotma_0590_like_claim } }
				desc = agotma_instigator_events.0595.desc.like_claim
			}
			triggered_desc = {
				trigger = { scope:high_septon = { has_character_flag = agotma_0590_sent_away } }
				desc = agotma_instigator_events.0595.desc.no_like
			}
		}
	}

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	left_portrait = {
		character = scope:high_septon
		animation = chaplain
	}

	right_portrait = {
		character = scope:instigator
		animation = personality_rational
	}

	# Good
	option = {
		name = agotma_instigator_events.0595.a
		trigger = {
			OR = {
				scope:high_septon = { has_character_flag = agotma_0590_like_piety }
				scope:high_septon = { has_character_flag = agotma_0590_like_gold }
			}
		}
		if = {
			limit = { scope:high_septon = { has_character_flag = agotma_0590_like_piety } }
			scope:agotma_instigated_char = {
				add_piety = 500
			}
		}
		else_if = {
			limit = { scope:high_septon = { has_character_flag = agotma_0590_like_gold } }
			scope:agotma_instigated_char = {
				scope:high_septon = {
					show_as_tooltip = {
						pay_short_term_gold = {
							target = scope:agotma_instigated_char
							gold = 500
						}
					}
				}
				hidden_effect = { add_gold = 500 }
			}
		}
	}

	# Huh..
	option = {
		name = agotma_instigator_events.0595.b
		trigger = {
			scope:high_septon = { has_character_flag = agotma_0590_like_claim }
		}

		scope:agotma_instigated_char = {
			add_pressed_claim = scope:agotma_war_target_char.liege.primary_title
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_rationality = 2
			}
		}
	}

	# Huh.. I WANT IT
	option = {
		name = agotma_instigator_events.0595.c
		trigger = {
			scope:high_septon = { has_character_flag = agotma_0590_like_claim }
		}

		scope:agotma_instigated_char = {
			add_pressed_claim = scope:agotma_war_target_char.liege.primary_title
		}

		add_character_flag = {
			flag = i_already_decided
			days = 100
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0596
				days = 1
			}
		}

		custom_tooltip = agotma_instigator_events.0595.c.tt

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_greed = 1
				ai_energy = 1
			}
		}
	}

	# Oops
	option = {
		name = agotma_instigator_events.0595.d
		trigger = {
			scope:high_septon = { has_character_flag = agotma_0590_sent_away }
		}

		scope:agotma_instigated_char = {
			add_opinion = {
				target = scope:high_septon
				modifier = insult_opinion
				opinion = -25
			}
		}
	}
}

# A higher title is claimed
agotma_instigator_events.0596 = {
	type = character_event
	title = agotma_instigator_events.0596.t
	desc = agotma_instigator_events.0596.desc

	theme = war

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = idle
	}

	immediate = {
		scope:agotma_war_target = { save_scope_as = old_agotma_war_target }
		scope:agotma_war_target_char = { save_scope_as = old_agotma_war_target_char }
		scope:story = {
			set_variable = {
				name = agotma_war_target
				value = scope:agotma_war_target_char.liege.primary_title
			}
		}
		scope:story.var:agotma_war_target = { save_scope_as = agotma_war_target }
		scope:story.var:agotma_war_target.holder = { save_scope_as = agotma_war_target_char }
	}

	# Okay..
	option = {
		name = agotma_instigator_events.0596.a
		scope:story = { set_variable = instigation_can_be_finished }
		custom_tooltip = agotma_instigator_events.0596.a.tt

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_boldness = 1
				ai_rationality = -1
			}
		}
	}

	# Hell nah.
	option = {
		name = agotma_instigator_events.0596.b

		agotma_instigator_story_end_effect = yes
		custom_tooltip = agotma_instigator_cancel

		scope:agotma_instigated_char = {
			add_character_flag = already_instigated
			trigger_event = {
				id = agotma_instigator_events.0597
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_boldness = -1
				ai_greed = -1
			}
		}
	}
}

# I'm alone
agotma_instigator_events.0597 = {
	type = character_event
	title = agotma_instigator_events.0597.t
	desc = agotma_instigator_events.0597.desc

	theme = war

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_war_target_char
		animation = idle
	}

	lower_left_portrait = {
		character = scope:instigator
	}

	# War.
	option = {
		name = agotma_instigator_events.0597.a

		agotma_start_war_effect = yes

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_boldness = 1
			}
		}
	}

	# No.
	option = {
		name = agotma_instigator_events.0597.b
		trigger = { NOT = { has_character_flag = i_already_decided } }

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_boldness = -1
			}
		}
	}

	# # I need some help.
	# option = {
	# 	name = agotma_instigator_events.0597.c
	# 	trigger = { has_government = landless_adventurer_government }

	# 	##### laamp war story addition

	# 	ai_chance = {
	# 		base = 1

	# 		ai_value_modifier = {
	# 			ai_rationality = 1
	# 		}
	# 	}
	# }
}

# INSTIGATION STAGE 2 - Accepted
agotma_instigator_events.0600 = {
	type = character_event
	title = agotma_instigator_events.0600.t
	desc = agotma_instigator_events.0600.desc

	theme = intrigue

	override_background = {
		reference = courtyard
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = idle
	}

	lower_left_portrait = {
		character = scope:agotma_war_target_char
	}

	# Ok.
	option = {
		name = agotma_instigator_events.0600.a

		scope:story = { set_variable = instigation_can_be_finished }
	}
}

# INSTIGATION STAGE 3 - War
agotma_instigator_events.0700 = {
	type = character_event
	title = agotma_instigator_events.0700.t
	desc = agotma_instigator_events.0700.desc

	theme = war

	override_background = {
		reference = courtyard
	}

	left_portrait = {
		character = scope:agotma_instigated_char
		animation = personality_rational
	}

	right_portrait = {
		character = scope:agotma_war_target_char
		animation = war_defender
	}

	# It is time.
	option = {
		name = agotma_instigator_events.0700.a

		scope:agotma_instigated_char = {
			trigger_event = {
				id = agotma_instigator_events.0701
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_boldness = 1
				ai_rationality = 1
			}
		}
	}

	# No I have to stop.
	option = {
		name = agotma_instigator_events.0700.b

		agotma_instigator_story_end_effect = yes
		custom_tooltip = agotma_instigator_cancel

		scope:agotma_instigated_char = {
			add_character_flag = already_instigated
			trigger_event = {
				id = agotma_instigator_events.0597
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_boldness = -1
				ai_rationality = -1
			}
		}
	}
}

# Instigated declares war
agotma_instigator_events.0701 = {
	type = character_event
	title = agotma_instigator_events.0701.t
	desc = agotma_instigator_events.0701.desc

	theme = war

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:instigator
	}

	right_portrait = {
		character = scope:agotma_war_target_char
		animation = war_defender
	}

	# War.
	option = {
		name = agotma_instigator_events.0701.a

		add_character_modifier = {
			modifier = agotma_instigator_provoked_war
			years = 10
		}
		agotma_start_war_effect = yes

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_boldness = 1
				ai_rationality = -1
			}
		}
	}

	# I need Instigator's help.
	option = {
		name = agotma_instigator_events.0701.b
		trigger = { scope:instigator = { NOT = { is_allied_to = scope:agotma_instigated_char } } }

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0703
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_boldness = 1
				ai_rationality = 1
			}
		}
	}

	# NO.
	option = {
		name = agotma_instigator_events.0701.c
		trigger = { is_ai = no }

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0702
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_boldness = -1
				ai_rationality = -1
			}
		}
	}
}

# Instigator has to stop
agotma_instigator_events.0702 = {
	type = character_event
	title = agotma_instigator_events.0702.t
	desc = agotma_instigator_events.0702.desc

	theme = war

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:agotma_war_target_char
	}

	right_portrait = {
		character = scope:agotma_instigated_char
		animation = war_defender
	}

	# Sad.
	option = {
		name = agotma_instigator_events.0702.a

		agotma_instigator_story_end_effect = yes
		custom_tooltip = agotma_instigator_cancel
	}
}

# Instigator has to help.
agotma_instigator_events.0703 = {
	type = character_event
	title = agotma_instigator_events.0703.t
	desc = agotma_instigator_events.0703.desc

	theme = war

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:agotma_instigated_char
	}

	right_portrait = {
		character = scope:agotma_war_target_char
		animation = war_defender
	}

	# Ok.
	option = {
		name = agotma_instigator_events.0703.a

		show_as_tooltip = {
			agotma_force_alliance = { ALLY_A = scope:instigator ALLY_B = scope:agotma_instigated_char }
		}

		add_character_flag = {
			flag = agotma_0700_ok
			days = 40
		}

		scope:agotma_instigated_char = {
			trigger_event = {
				id = agotma_instigator_events.0704
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_boldness = 1
				ai_rationality = -1
			}
		}
	}

	# No.
	option = {
		name = agotma_instigator_events.0703.b

		show_as_tooltip = {
			scope:agotma_instigated_char = {
				add_opinion = {
					target = scope:instigator
					modifier = insult_opinion
					opinion = -25
				}
			}
		}

		add_character_flag = {
			flag = agotma_0700_no
			days = 40
		}

		scope:agotma_instigated_char = {
			trigger_event = {
				id = agotma_instigator_events.0704
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_boldness = -1
				ai_rationality = 1
			}
		}
	}
}

# Instigated war
agotma_instigator_events.0704 = {
	type = character_event
	title = agotma_instigator_events.0704.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0700_ok } }
				desc = agotma_instigator_events.0704.desc.ok
			}
			triggered_desc = {
				trigger = { scope:instigator = { has_character_flag = agotma_0700_no } }
				desc = agotma_instigator_events.0704.desc.no
			}
		}
	}

	theme = war

	override_background = {
		reference = courtyard
	}

	lower_left_portrait = {
		character = scope:instigator
	}

	right_portrait = {
		character = scope:agotma_war_target_char
		animation = war_defender
	}

	immediate = {
		if = {
			limit = { scope:instigator = { has_character_flag = agotma_0700_ok } }
			agotma_force_alliance = { ALLY_A = scope:instigator ALLY_B = scope:agotma_instigated_char }
		}
		else_if = {
			limit = { scope:instigator = { has_character_flag = agotma_0700_no } }
			scope:agotma_instigated_char = {
				add_opinion = {
					target = scope:instigator
					modifier = insult_opinion
					opinion = -25
				}
			}
		}
	}

	# Good, war now.
	option = {
		name = agotma_instigator_events.0704.a
		trigger = { scope:instigator = { has_character_flag = agotma_0700_ok } }

		add_character_modifier = {
			modifier = agotma_instigator_provoked_war
			years = 10
		}
		agotma_start_war_effect = yes
	}

	# Sad, war now.
	option = {
		name = agotma_instigator_events.0704.b
		trigger = { scope:instigator = { NOT = { has_character_flag = agotma_0700_ok } } }

		add_character_modifier = {
			modifier = agotma_instigator_provoked_war
			years = 10
		}
		agotma_start_war_effect = yes
	}
}

# War Notification to the Realm
agotma_instigator_events.0750 = {
	type = character_event
	title = agotma_instigator_events.0750.t
	desc = agotma_instigator_events.0750.desc

	theme = war

	override_background = {
		reference = courtyard
	}

	left_portrait = {
		character = scope:attacker
		animation = war_attacker
	}

	lower_left_portrait = {
		trigger = { exists = scope:the_instigator }
		character = scope:the_instigator
	}

	right_portrait = {
		character = scope:defender
		animation = war_defender
	}

	immediate = {
		if = {
			limit = { exists = scope:attacker.var:agotma_the_instigator }
			scope:attacker.var:agotma_the_instigator = { save_scope_as = the_instigator }
		}
	}

	# Ok.
	option = {
		name = agotma_instigator_events.0750.a
	}
}

# POST WAR
agotma_instigator_events.0800 = {
	type = character_event
	title = agotma_instigator_events.0800.t
	desc = agotma_instigator_events.0800.desc

	theme = war

	override_background = {
		reference = courtyard
	}

	left_portrait = {
		character = scope:instigator
		animation = personality_rational
	}

	right_portrait = {
		character = scope:agotma_war_target_char
		animation = war_defender
	}

	immediate = {
		if = {
			limit = {
				OR = {
					scope:agotma_instigated_char = scope:instigator.liege
					scope:agotma_instigated_char = scope:instigator.liege.liege
					scope:agotma_instigated_char = scope:instigator.top_liege
				}
				scope:instigator.primary_title.tier >= tier_county
				scope:instigator.primary_title.tier <= tier_kingdom
				any_held_title = {
					trigger_if = {
						limit = { scope:instigator.primary_title.tier = tier_county }
						this = scope:instigator.primary_title.duchy
					}
					trigger_if = {
						limit = {
							scope:instigator.primary_title.tier = tier_duchy
							exists = scope:instigator.primary_title.kingdom.holder
						}
						this = scope:instigator.primary_title.kingdom
					}
					trigger_if = {
						limit = {
							scope:instigator.primary_title.tier = tier_duchy
							NOT = { exists = scope:instigator.primary_title.kingdom.holder }
						}
						this = scope:instigator.primary_title.empire
					}
					trigger_if = {
						limit = { scope:instigator.primary_title.tier = tier_kingdom }
						this = scope:instigator.primary_title.empire
					}
					NOT = { this = scope:agotma_war_target }
					NOT = { this = scope:agotma_war_target.title_capital_county.duchy }
					NOT = { this = scope:agotma_war_target.title_capital_county.kingdom }
				}
			}
			random_held_title = {
				limit = {
					trigger_if = {
						limit = { scope:instigator.primary_title.tier = tier_county }
						this = scope:instigator.primary_title.duchy
					}
					trigger_if = {
						limit = {
							scope:instigator.primary_title.tier = tier_duchy
							exists = scope:instigator.primary_title.kingdom.holder
						}
						this = scope:instigator.primary_title.kingdom
					}
					trigger_if = {
						limit = {
							scope:instigator.primary_title.tier = tier_duchy
							NOT = { exists = scope:instigator.primary_title.kingdom.holder }
						}
						this = scope:instigator.primary_title.empire
					}
					trigger_if = {
						limit = { scope:instigator.primary_title.tier = tier_kingdom }
						this = scope:instigator.primary_title.empire
					}
					NOT = { this = scope:agotma_war_target }
					NOT = { this = scope:agotma_war_target.title_capital_county.duchy }
					NOT = { this = scope:agotma_war_target.title_capital_county.kingdom }
				}
				save_scope_as = reward_title
			}
		}
		else_if = {
			limit = {
				OR = {
					scope:agotma_instigated_char = scope:instigator.liege
					scope:agotma_instigated_char = scope:instigator.liege.liege
					scope:agotma_instigated_char = scope:instigator.top_liege
				}
				scope:instigator.primary_title.tier >= tier_county
				scope:instigator.primary_title.tier <= tier_kingdom
				any_vassal_or_below = {
					any_held_title = {
						trigger_if = {
							limit = { scope:instigator.primary_title.tier = tier_county }
							this = scope:instigator.primary_title.duchy
						}
						trigger_if = {
							limit = {
								scope:instigator.primary_title.tier = tier_duchy
								exists = scope:instigator.primary_title.kingdom.holder
							}
							this = scope:instigator.primary_title.kingdom
						}
						trigger_if = {
							limit = {
								scope:instigator.primary_title.tier = tier_duchy
								NOT = { exists = scope:instigator.primary_title.kingdom.holder }
							}
							this = scope:instigator.primary_title.empire
						}
						trigger_if = {
							limit = { scope:instigator.primary_title.tier = tier_kingdom }
							this = scope:instigator.primary_title.empire
						}
						NOT = { this = scope:agotma_war_target }
						NOT = { this = scope:agotma_war_target.title_capital_county.duchy }
						NOT = { this = scope:agotma_war_target.title_capital_county.kingdom }
					}
				}
			}
			random_vassal_or_below = {
				limit = {
					any_held_title = {
						trigger_if = {
							limit = { scope:instigator.primary_title.tier = tier_county }
							this = scope:instigator.primary_title.duchy
						}
						trigger_if = {
							limit = {
								scope:instigator.primary_title.tier = tier_duchy
								exists = scope:instigator.primary_title.kingdom.holder
							}
							this = scope:instigator.primary_title.kingdom
						}
						trigger_if = {
							limit = {
								scope:instigator.primary_title.tier = tier_duchy
								NOT = { exists = scope:instigator.primary_title.kingdom.holder }
							}
							this = scope:instigator.primary_title.empire
						}
						trigger_if = {
							limit = { scope:instigator.primary_title.tier = tier_kingdom }
							this = scope:instigator.primary_title.empire
						}
						NOT = { this = scope:agotma_war_target }
						NOT = { this = scope:agotma_war_target.title_capital_county.duchy }
						NOT = { this = scope:agotma_war_target.title_capital_county.kingdom }
					}
				}
				save_scope_as = revoked_vassal
			}
			if = {
				limit = { exists = scope:revoked_vassal }
				scope:revoked_vassal = {
					random_held_title = {
						limit = {
							trigger_if = {
								limit = { scope:instigator.primary_title.tier = tier_county }
								this = scope:instigator.primary_title.duchy
							}
							trigger_if = {
								limit = {
									scope:instigator.primary_title.tier = tier_duchy
									exists = scope:instigator.primary_title.kingdom.holder
								}
								this = scope:instigator.primary_title.kingdom
							}
							trigger_if = {
								limit = {
									scope:instigator.primary_title.tier = tier_duchy
									NOT = { exists = scope:instigator.primary_title.kingdom.holder }
								}
								this = scope:instigator.primary_title.empire
							}
							trigger_if = {
								limit = { scope:instigator.primary_title.tier = tier_kingdom }
								this = scope:instigator.primary_title.empire
							}
							NOT = { this = scope:agotma_war_target }
							NOT = { this = scope:agotma_war_target.title_capital_county.duchy }
							NOT = { this = scope:agotma_war_target.title_capital_county.kingdom }
						}
						save_scope_as = revoked_reward_title
					}
				}
			}
		}
	}

	# Reward them - Give Title
	option = {
		name = agotma_instigator_events.0800.a
		trigger = { exists = scope:reward_title }

		show_as_tooltip = {
			scope:instigator = {
				create_title_and_vassal_change = {
					type = granted
					save_scope_as = change
					add_claim_on_loss = no
				}
				scope:reward_title = {
					change_title_holder_include_vassals = {
						holder = scope:instigator
						change = scope:change
					}
					resolve_title_and_vassal_change = scope:change
				}
			}

			scope:instigator = {
				add_opinion = {
					target = scope:agotma_instigated_char
					modifier = grateful_opinion
					opinion = 50
				}
			}
		}

		add_character_flag = {
			flag = agotma_reward_title
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0801
				days = 1
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_greed = -1
			}

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = 1
			}
		}
	}

	# Reward them - Revoke & Give Title
	option = {
		name = agotma_instigator_events.0800.b
		trigger = { exists = scope:revoked_reward_title }

		scope:agotma_instigated_char = {
			create_title_and_vassal_change = {
				type = revoked
				save_scope_as = change
				add_claim_on_loss = yes
			}
			scope:revoked_reward_title = {
				change_title_holder_include_vassals = {
					holder = scope:agotma_instigated_char
					change = scope:change
				}
				resolve_title_and_vassal_change = scope:change
			}
		}

		show_as_tooltip = {
			scope:instigator = {
				create_title_and_vassal_change = {
					type = granted
					save_scope_as = change
					add_claim_on_loss = no
				}
				scope:revoked_reward_title = {
					change_title_holder_include_vassals = {
						holder = scope:instigator
						change = scope:change
					}
					resolve_title_and_vassal_change = scope:change
				}
			}

			scope:instigator = {
				add_opinion = {
					target = scope:agotma_instigated_char
					modifier = grateful_opinion
					opinion = 50
				}
			}
		}

		add_character_flag = {
			flag = agotma_revoked_reward_title
			days = 40
		}

		scope:instigator = {
			trigger_event = {
				id = agotma_instigator_events.0801
				days = 1
			}
		}

		ai_chance = {
			base = 1

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:revoked_vassal
				multiplier = -1
			}

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = 1
			}
		}
	}

	# Nah
	option = {
		name = agotma_instigator_events.0800.c

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_greed = 1
			}

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = -1
			}
		}
	}

	# I can offer only my friendship
	option = {
		name = agotma_instigator_events.0800.d
		trigger = {
			can_set_relation_friend_trigger = { CHARACTER = scope:instigator }
			NOT = { exists = scope:reward_title }
			NOT = { exists = scope:revoked_reward_title }
		}

		show_as_tooltip = {
			scope:agotma_instigated_char = {
				set_relation_friend = {
					target = scope:instigator
					reason = friend_alliance
				}
			}
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_sociability = 1
			}

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = 1
			}
		}
	}

	# I can offer only my good word
	option = {
		name = agotma_instigator_events.0800.e
		trigger = {
			NOT = { can_set_relation_friend_trigger = { CHARACTER = scope:instigator } }
			NOT = { exists = scope:reward_title }
			NOT = { exists = scope:revoked_reward_title }
		}

		show_as_tooltip = {
			scope:agotma_instigated_char = { add_prestige = 500 }
		}

		ai_chance = {
			base = 1

			ai_value_modifier = {
				ai_honor = 1
			}

			opinion_modifier = {
				who = scope:agotma_instigated_char
				opinion_target = scope:instigator
				multiplier = 1
			}
		}
	}
}

# Instigated war
agotma_instigator_events.0801 = {
	type = character_event
	title = agotma_instigator_events.0801.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_reward_title } }
				desc = agotma_instigator_events.0801.desc.reward_title
			}
			triggered_desc = {
				trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_revoked_reward_title } }
				desc = agotma_instigator_events.0801.desc.revoked_reward_title
			}
		}
	}

	theme = war

	override_background = {
		reference = courtyard
	}

	left_portrait = {
		character = scope:instigator
		animation = personality_rational
	}

	right_portrait = {
		character = scope:agotma_war_target_char
		animation = war_defender
	}

	# Good.
	option = {
		name = agotma_instigator_events.0801.a
		trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_reward_title } }

		scope:instigator = {
			create_title_and_vassal_change = {
				type = granted
				save_scope_as = change
				add_claim_on_loss = no
			}
			scope:reward_title = {
				change_title_holder_include_vassals = {
					holder = scope:instigator
					change = scope:change
				}
				resolve_title_and_vassal_change = scope:change
			}
		}

		scope:instigator = {
			add_opinion = {
				target = scope:agotma_instigated_char
				modifier = grateful_opinion
				opinion = 50
			}
		}
	}

	# Good.
	option = {
		name = agotma_instigator_events.0801.b
		trigger = { scope:agotma_instigated_char = { has_character_flag = agotma_revoked_reward_title } }

		scope:instigator = {
			create_title_and_vassal_change = {
				type = granted
				save_scope_as = change
				add_claim_on_loss = no
			}
			scope:revoked_reward_title = {
				change_title_holder_include_vassals = {
					holder = scope:instigator
					change = scope:change
				}
				resolve_title_and_vassal_change = scope:change
			}
		}

		scope:instigator = {
			add_opinion = {
				target = scope:agotma_instigated_char
				modifier = grateful_opinion
				opinion = 50
			}
		}
	}
}

# # test
# agotma_instigator_events.9999 = {
# 	type = character_event
# 	title = agotma_instigator_events.0801.t
# 	desc = agotma_instigator_events.0801.desc.reward_title
# 	orphan = yes
# 	theme = war

# 	override_background = {
# 		reference = courtyard
# 	}

# 	left_portrait = {
# 		character = scope:my_story.var:agotma_instigated_char
# 		animation = personality_rational
# 	}

# 	right_portrait = {
# 		character = scope:my_story.var:agotma_war_target.holder
# 		animation = personality_rational
# 	}

# 	immediate = {
# 		if = {
# 			limit = {
# 				any_owned_story = {
# 					story_type = agotma_instigator_story
# 				}
# 			}
# 			random_owned_story = {
# 				limit = { story_type = agotma_instigator_story }
# 				save_scope_as = my_story
# 			}
# 		}
# 	}

# 	# Good, war now.
# 	option = {
# 		name = agotma_instigator_events.0801.a

# 		if = {
# 			limit = { exists = scope:my_story.var:agotma_instigation_plot_points }
# 			show_as_tooltip = { add_prestige = scope:my_story.var:agotma_instigation_plot_points }
# 		}
# 		if = {
# 			limit = { exists = scope:my_story.var:agotma_instigation_completed }
# 			show_as_tooltip = { add_gold = 1 }
# 		}
# 	}
# }

# # test
# agotma_instigator_events.9999 = {
# 	type = character_event
# 	title = agotma_instigator_events.9999.t
# 	desc = agotma_instigator_events.9999.desc
# 	orphan = yes
# 	theme = war

# 	override_background = {
# 		reference = courtyard
# 	}

# 	right_portrait = {
# 		character = root
# 		animation = personality_rational
# 	}

# 	# Good, war now.
# 	option = {
# 		name = agotma_instigator_events.9999.a

# 		if = {
# 			limit = { exists = global_var:sum_of_instigations }
# 			show_as_tooltip = { add_prestige = global_var:sum_of_instigations }
# 		}
# 		if = {
# 			limit = { exists = global_var:sum_of_instigation_wars }
# 			show_as_tooltip = { add_gold = global_var:sum_of_instigation_wars }
# 		}
# 	}
# }