###########################################
#
# Holy Order Events
#
# ID SoA 1000-2999 is reserved
#
###########################################
# Written by Henrik Fåhraeus
###########################################

namespace = SoA

# Son of a ruler volunteers to join a holy order
character_event = {
	id = SoA.1030
	
	hide_window = yes
	
	only_men = yes
	min_age = 16
	max_age = 45
	only_capable = yes
	prisoner = no
	has_dlc = "Sons of Abraham"

	trigger = {		
		is_ruler = no
		NOT = { dynasty = none }
		liege = { religion = ROOT }
		martial = 5
		OR = {
			martial = 10
			trait = humble
			trait = celibate
			trait = homosexual
			trait = zealous
			trait = lunatic
			trait = possessed
			trait = crusader
			trait = mujahid
			trait = holy_crusader
			is_priest = yes
			has_called_crusade = yes
		}
		OR = {
			father_even_if_dead = {
				primary_title = { higher_tier_than = BARON }
			}
			mother_even_if_dead = {
				primary_title = { higher_tier_than = BARON }
			}
		}
		#celts only go permanently if their parent is not their liege
		OR = {
			NOR = {
				religion = celtic_pagan
				religion = celtic_pagan_reformed
			}
			NOT = { culture_group = celtic }
			NOR = {
				father = { is_liege_of = ROOT }
				mother = { is_liege_of = ROOT }
			}
		}
		#won't go if married unless zealous/lunatic/possessed or he hates his wife
		OR = {
			is_married = no
			trait = zealous
			trait = lunatic
			trait = possessed
			has_called_crusade = yes
			NOT = { any_spouse = { reverse_opinion = { who = ROOT value = 0 } } }
		}
		#won't go if he has a legit child unless lunatic/possessed		
		OR = {
			NOR = {
				any_child = {
					is_alive = yes
					is_adult = no
					NOT = { trait = bastard }
				}
			}
			trait = lunatic
			trait = possessed
		}
		#won't go if heir unless very pious
		OR = {
			NOT = { any_heir_title = { always = yes } }
			AND = {
				calc_true_if = {
					amount = 2
					trait = zealous
					trait = humble
					trait = content
					trait = possessed
					has_character_modifier = voice_of_jesus
				}
				NOR = {
					trait = ambitious
					trait = envious
					trait = greedy
					trait = proud
				}
			}
			NOR = {
				religion_group = indian_group
				religion_group = christian
			}
		}
		#won't go if pretender unless pious
		OR = {
			NOT = { any_pretender_title = { always = yes } }
			AND = {
				OR = {
					trait = zealous
					trait = humble
					trait = content
					trait = possessed
				}
				NOR = {
					trait = ambitious
					trait = envious
					trait = greedy
				}
			}
			NOR = {
				religion_group = indian_group
				religion_group = christian
			}
		}
		#won't go if lustful/hedonist unless not christian
		OR = {
			NOR = {
				trait = lustful
				trait = hedonist
			}
			NOT = { religion_group = christian }
		}
		NOR = {
			trait = cynical
			trait = sympathy_christendom
			trait = sympathy_islam
			trait = sympathy_pagans
			trait = sympathy_zoroastrianism
			trait = sympathy_judaism
			trait = sympathy_indian
			any_liege = { holy_order = yes }
			any_liege = { mercenary = yes }
			any_spouse = {
				trait = pregnant
				father_of_unborn = { character = ROOT }
			}
			has_character_modifier = voice_of_satan
			has_character_modifier = planning_claimant_adventure
			has_character_modifier = planning_new_temple
			has_opinion_modifier = { who = ROOT modifier = opinion_refused_request_holy_order }
		}
	}

	mean_time_to_happen = {
		years = 100
		modifier = {
			factor = 0.25
			trait = zealous
		}
		modifier = {
			factor = 0.25
			has_character_modifier = voice_of_jesus
		}
		modifier = {
			factor = 0.5
			OR = {
				has_called_crusade = yes
				trait = crusader
				trait = mujahid
				trait = holy_crusader
			}
		}
		modifier = {
			factor = 0.5
			trait = celibate
		}
		modifier = {
			factor = 0.5
			trait = homosexual
		}
		modifier = {
			factor = 0.75
			trait = content
		}
		modifier = {
			factor = 0.75
			trait = humble
		}
		modifier = {
			factor = 0.75
			trait = brave
		}
		modifier = {
			factor = 0.75
			trait = chaste
			religion_group = christian
		}
		modifier = {
			factor = 0.75
			NOT = { age = 25 }
		}
		modifier = {
			factor = 1.5
			trait = slothful
		}
		modifier = {
			factor = 2.0
			trait = lustful
			religion_group = christian
		}
		modifier = {
			factor = 2.0
			trait = hedonist
		}
		modifier = {
			factor = 2.0
			trait = ambitious
		}
		modifier = {
			factor = 2.0
			trait = craven
		}
		modifier = {
			factor = 2.0
			any_heir_title = { always = yes }
		}
		modifier = {
			factor = 2.0
			is_primary_heir = yes
		}
		modifier = {
			factor = 2
			any_spouse = {
				reverse_opinion = { who = ROOT value = 100 }
			}
		}
		modifier = {
			factor = 1.25
			has_character_modifier = estates_1
		}
		modifier = {
			factor = 1.25
			has_character_modifier = estates_2
		}
		modifier = {
			factor = 1.25
			has_character_modifier = estates_3
		}
		modifier = {
			factor = 1.25
			has_character_modifier = estates_4
		}
		modifier = {
			factor = 1.25
			has_character_modifier = estates_5
		}
	}
	
	immediate = {
		#pick a holy order to join
		random_independent_ruler = {
			limit = {
				dynasty = ROOT
				religion = ROOT
				holy_order_not_expelled_trigger = yes
				random = 75
			}
			random_demesne_title = {
				limit = { holy_order = yes }
				save_event_target_as = join_holy_order
				ROOT = { set_character_flag = no_more_checking }
			}
		}
		random_independent_ruler = {
			limit = {
				ROOT = { NOT = { has_character_flag = no_more_checking } }
				any_realm_lord = {
					dynasty = ROOT
					religion = ROOT
					holy_order_not_expelled_trigger = yes
				}
				random = 75
			}
			random_realm_lord = {
				limit = {
					dynasty = ROOT
					religion = ROOT
					holy_order_not_expelled_trigger = yes
				}
				random_demesne_title = {
					limit = { holy_order = yes }
					save_event_target_as = join_holy_order
					ROOT = { set_character_flag = no_more_checking }
				}
			}
		}
		if = {
			limit = {
				ROOT = { NOT = { has_character_flag = no_more_checking } }
				OR = {
					culture_group = north_germanic
					culture_group = central_germanic
					culture_group = magyar
					culture_group = south_slavic
					culture_group = west_slavic
				}
				is_title_active = d_teutonic_order
				d_teutonic_order = { holder_scope = { religion = ROOT } }
				NOT = { any_liege = { has_character_modifier = expelled_d_teutonic_order } }
				random = 75
			}
			ROOT = { set_character_flag = no_more_checking }
			d_teutonic_order = { save_event_target_as = join_holy_order }
		}
		if = {
			limit = {
				ROOT = { NOT = { has_character_flag = no_more_checking } }
				OR = {
					culture_group = iberian
					culture = andalusian_arabic
				}
				OR = {
					AND = {
						is_title_active = d_knights_calatrava
						d_knights_calatrava = { holder_scope = { religion = ROOT } }
						NOT = { any_liege = { has_character_modifier = expelled_d_knights_calatrava } }
					}
					AND = {
						is_title_active = d_knights_santiago
						d_knights_santiago = { holder_scope = { religion = ROOT } }
						NOT = { any_liege = { has_character_modifier = expelled_d_knights_santiago } }
					}
				}
				random = 75
			}
			ROOT = { set_character_flag = no_more_checking }
			random_list = {
				50 = {
					modifier = {
						factor = 0
						OR = {
							NOT = { is_title_active = d_knights_calatrava }
							d_knights_calatrava = { holder_scope = { NOT = { religion = ROOT } } }
							any_liege = { has_character_modifier = expelled_d_knights_calatrava }
						}
					}
					d_knights_calatrava = { save_event_target_as = join_holy_order }
				}
				50 = {
					modifier = {
						factor = 0
						OR = {
							NOT = { is_title_active = d_knights_santiago }
							d_knights_santiago = { holder_scope = { NOT = { religion = ROOT } } }
							any_liege = { has_character_modifier = expelled_d_knights_santiago }
						}
					}
					d_knights_santiago = { save_event_target_as = join_holy_order }
				}
			}
		}
		random_independent_ruler = {
			limit = {
				ROOT = { NOT = { has_character_flag = no_more_checking } }
				religion = ROOT
				holy_order_not_expelled_trigger = yes
				random = 75
			}
			random_demesne_title = {
				limit = { holy_order = yes }
				save_event_target_as = join_holy_order
				ROOT = { set_character_flag = no_more_checking }
			}
		}
		random_independent_ruler = {
			limit = {
				ROOT = { NOT = { has_character_flag = no_more_checking } }
				any_realm_lord = {
					religion = ROOT
					holy_order_not_expelled_trigger = yes
				}
				random = 75
			}
			random_realm_lord = {
				limit = {
					religion = ROOT
					holy_order_not_expelled_trigger = yes
				}
				random_demesne_title = {
					limit = { holy_order = yes }
					save_event_target_as = join_holy_order
					ROOT = { set_character_flag = no_more_checking }
				}
			}
		}
		
		#ask liege to go
		if = {
			limit = { ROOT = { has_character_flag = no_more_checking } }
			clr_character_flag = no_more_checking
			liege = { character_event = { id = SoA.1031 } }
		}
	}
}

# Liege is asked for permission to join the holy order
character_event = {
	id = SoA.1031
	picture = GFX_evt_crusaders
	border = GFX_event_normal_frame_religion
	
	desc = {
		trigger = {
			FROM = {
				OR = {
					religion_group = christian
					religion_group = indian_group
				}
			}
		}
		text = EVTDESC_SOA_1031A
	}
	desc = {
		trigger = {
			FROM = {
				NOR = {
					religion_group = christian
					religion_group = indian_group
				}
			}
		}
		text = EVTDESC_SOA_1031B
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SOA_1031 # Agree
		ai_chance = {
			factor = 100
			modifier = {
				factor = 0.1
				OR = {
					religion_group = indian_group
					religion_group = christian
				}
				FROM = { is_primary_heir = yes }
			}
		}
		if = {
			limit = { FROM = { is_child_of = ROOT } }
			piety = 100
		}
		if = {
			limit = {
				FROM = {
					NOT = { is_child_of = ROOT }
					is_close_relative = ROOT
				}
			}
			piety = 50
		}
		if = {
			limit = {
				FROM = {
					NOT = { is_child_of = ROOT }
					NOT = { is_close_relative = ROOT }
				}
			}
			piety = 20
		}
		FROM = {
			opinion = {
				who = ROOT
				modifier = opinion_grateful
			}
			character_event = {
				id = SoA.1032
				tooltip = EVTTOOLTIP_SOA_1032
			}
		}
	}
	option = {
		name = EVTOPTB_SOA_1031 # Refuse
		ai_chance = {
			factor = 10
			modifier = {
				factor = 5
				OR = {
					religion_group = indian_group
					religion_group = christian
				}
				FROM = { is_primary_heir = yes }
			}
			modifier = {
				factor = 0
				OR = {
					NOR = {
						religion_group = indian_group
						religion_group = christian
					}
					FROM = { is_primary_heir = no }
				}
			}
		}		
		if = {
			limit = { FROM = { is_child_of = ROOT } }
			piety = -100
		}
		if = {
			limit = {
				FROM = {
					NOT = { is_child_of = ROOT }
					is_close_relative = ROOT
				}
			}
			piety = -50
		}
		if = {
			limit = {
				FROM = {
					NOT = { is_child_of = ROOT }
					NOT = { is_close_relative = ROOT }
				}
			}
			piety = -20
		}		
		FROM = {
			opinion = {
				who = ROOT
				modifier = opinion_refused_request_holy_order
			}
		}
	}
}

# Liege agrees to let him join the holy order
character_event = {
	id = SoA.1032
	
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		if = {
			limit = { is_married = yes }
			any_spouse = {
				remove_spouse = ROOT
				character_event = { id = SoA.2863 }
				opinion = { who = ROOT modifier = opinion_divorced }
				any_dynasty_member = {
					limit = {
						is_close_relative = PREV
						NOR = {
							character = ROOT
							is_liege_of = ROOT
							trait = zealous
							holy_order = yes
							any_liege = { holy_order = yes }
						}
					}
					opinion = { who = ROOT modifier = opinion_divorced_relative }
				}
			}
		}
		if = {
			limit = { religion_group = christian }
			add_trait = celibate
		}
		if = {
			limit = { has_character_modifier = estates_1 }
			remove_character_modifier = estates_1
			wealth = 40
		}
		if = {
			limit = { has_character_modifier = estates_2 }
			remove_character_modifier = estates_2
			wealth = 80
		}
		if = {
			limit = { has_character_modifier = estates_3 }
			remove_character_modifier = estates_3
			wealth = 120
		}
		if = {
			limit = { has_character_modifier = estates_4 }
			remove_character_modifier = estates_4
			wealth = 160
		}
		if = {
			limit = { has_character_modifier = estates_5 }
			remove_character_modifier = estates_5
			wealth = 200
		}
		if = {
			limit = {
				has_minor_title = title_commander
			}
			remove_title = title_commander
		}
		if = {
			limit = {
				has_minor_title = title_appointed_regent
			}
			remove_title = title_appointed_regent
		}
		if = {
			limit = {
				has_minor_title = title_patrician_heir
			}
			remove_title = title_patrician_heir
		}
		event_target:join_holy_order = {
			holder_scope = {
				ROOT = {
					move_character = PREV
					transfer_scaled_wealth = { to = PREV value = all }
					end_inaccessibility_effect = yes #removes in_hiding or in_seclusion
					any_child = {
						limit = {
							is_adult = no
							at_location = ROOT
						}
						end_inaccessibility_effect = yes #removes in_hiding or in_seclusion
						move_character = FROM
					}
				}
			}
		}
		if = {
			limit = {
				OR = {
					religion_group = christian
					religion_group = indian_group
				}
			}
			FROM = { recalc_succession = yes }
		}
	}
}
	
# Holy order decides to ask to build a castle in someone's demesne
character_event = {
	id = SoA.1050
	
	hide_window = yes
	
	only_rulers = yes
	
	trigger = {
		has_dlc = "Sons of Abraham"
		holy_order = yes
		primary_title = { holy_order = yes }
		war = no
		wealth = 600
		NOR = {
			realm_size = 10
			num_of_count_titles = 1
			has_character_flag = cannot_build_castle
		}
	}
	
	mean_time_to_happen = {
		months = 240
		modifier = {
			factor = 0.5
			NOT = { demesne_size = 1 }
		}
		modifier = {
			factor = 0.5
			NOT = { demesne_size = 2 }
		}
		modifier = {
			factor = 2.0
			realm_size = 5
		}
	}
	
	immediate = {
		primary_title = { save_event_target_as = holy_order_name }
		random_playable_ruler = {
			limit = {
				war = no
				religion = ROOT
				NOR = {
					has_character_flag = holy_order_request_castle
					trait = excommunicated
				}
				OR = {
					AND = {
						event_target:holy_order_name = { title = d_knights_templar }
						NOR = {
							has_character_modifier = expelled_d_knights_templar
							any_liege = { has_character_modifier = expelled_d_knights_templar }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_knights_hospitaler }
						NOR = {
							has_character_modifier = expelled_d_knights_hospitaler
							any_liege = { has_character_modifier = expelled_d_knights_hospitaler }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_teutonic_order }
						NOR = {
							has_character_modifier = expelled_d_teutonic_order
							any_liege = { has_character_modifier = expelled_d_teutonic_order }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_jomsvikings }
						NOR = {
							has_character_modifier = expelled_d_jomsvikings
							any_liege = { has_character_modifier = expelled_d_jomsvikings }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_braedralag }
						NOR = {
							has_character_modifier = expelled_d_braedralag
							any_liege = { has_character_modifier = expelled_d_braedralag }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_ansar }
						NOR = {
							has_character_modifier = expelled_d_ansar
							any_liege = { has_character_modifier = expelled_d_ansar }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_hashshashin }
						NOR = {
							has_character_modifier = expelled_d_hashshashin
							any_liege = { has_character_modifier = expelled_d_hashshashin }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_holy_sepulchre }
						NOR = {
							has_character_modifier = expelled_d_holy_sepulchre
							any_liege = { has_character_modifier = expelled_d_holy_sepulchre }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_immortals }
						NOR = {
							has_character_modifier = expelled_d_immortals
							any_liege = { has_character_modifier = expelled_d_immortals }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_zealots }
						NOR = {
							has_character_modifier = expelled_d_zealots
							any_liege = { has_character_modifier = expelled_d_zealots }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_saint_anthony }
						NOR = {
							has_character_modifier = expelled_d_saint_anthony
							any_liege = { has_character_modifier = expelled_d_saint_anthony }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_sky_lords }
						NOR = {
							has_character_modifier = expelled_d_sky_lords
							any_liege = { has_character_modifier = expelled_d_sky_lords }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_spirit_guardians }
						NOR = {
							has_character_modifier = expelled_d_spirit_guardians
							any_liege = { has_character_modifier = expelled_d_spirit_guardians }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_warriors_perun }
						NOR = {
							has_character_modifier = expelled_d_warriors_perun
							any_liege = { has_character_modifier = expelled_d_warriors_perun }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_chosen_perkunas }
						NOR = {
							has_character_modifier = expelled_d_chosen_perkunas
							any_liege = { has_character_modifier = expelled_d_chosen_perkunas }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_sons_kaleva }
						NOR = {
							has_character_modifier = expelled_d_sons_kaleva
							any_liege = { has_character_modifier = expelled_d_sons_kaleva }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_huitzilopochtli }
						NOR = {
							has_character_modifier = expelled_d_huitzilopochtli
							any_liege = { has_character_modifier = expelled_d_huitzilopochtli }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_knights_santiago }
						NOR = {
							has_character_modifier = expelled_d_knights_santiago
							any_liege = { has_character_modifier = expelled_d_knights_santiago }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_knights_calatrava }
						NOR = {
							has_character_modifier = expelled_d_knights_calatrava
							any_liege = { has_character_modifier = expelled_d_knights_calatrava }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_saint_addai }
						NOR = {
							has_character_modifier = expelled_d_saint_addai
							any_liege = { has_character_modifier = expelled_d_saint_addai }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_zun_warriors }
						NOR = {
							has_character_modifier = expelled_d_zun_warriors
							any_liege = { has_character_modifier = expelled_d_zun_warriors }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_haruriyyah }
						NOR = {
							has_character_modifier = expelled_d_haruriyyah
							any_liege = { has_character_modifier = expelled_d_haruriyyah }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_harii }
						NOR = {
							has_character_modifier = expelled_d_harii
							any_liege = { has_character_modifier = expelled_d_harii }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_army_light }
						NOR = {
							has_character_modifier = expelled_d_army_light
							any_liege = { has_character_modifier = expelled_d_army_light }
						}
					}
					AND = {
						event_target:holy_order_name = { title = d_army_lucifer }
						NOR = {
							has_character_modifier = expelled_d_army_lucifer
							any_liege = { has_character_modifier = expelled_d_army_lucifer }
						}
					}
				}
				any_demesne_province = {
					has_empty_holding = yes
					any_province_holding = { holding_type = castle }
					any_province_holding = { holding_type = city }
					any_province_holding = { holding_type = temple }
					NOT = {
						any_province_holding = {
							holder_scope = {
								OR = {
									character = ROOT
									is_liege_or_above = ROOT
								}
							}
						}
					}
					county = {
						is_occupied = no
						is_contested = no
					}
					OR = {
						port = yes
						ROOT = { any_realm_title = { location = { port = yes } } }
					}
					OR = {
						event_target:holy_order_name = {
							NOR = {
								title = d_knights_templar
								title = d_knights_hospitaler
								title = d_teutonic_order
								title = d_knights_santiago
								title = d_knights_calatrava
								title = d_saint_addai
							}
						}
						AND = {
							event_target:holy_order_name = { title = d_knights_templar }
							OR = {
								region = world_europe_west_francia
								region = world_europe_south
								region = world_asia_minor
								region = world_europe_west_iberia
								region = world_persia
								region = custom_khwarizm
								region = world_middle_east
								region = custom_egypt
								region = custom_africa
								region = world_africa_east
								region = world_europe_west_brittania
							}
						}
						AND = {
							event_target:holy_order_name = { title = d_knights_hospitaler }
							OR = {
								region = world_europe_south_east
								region = world_asia_minor
								region = custom_sicily
								region = custom_arabia
								region = custom_egypt
								region = world_middle_east_jerusalem
								region = custom_africa
								region = world_africa_east
							}
						}
						AND = {
							event_target:holy_order_name = { title = d_teutonic_order }
							OR = {
								region = world_europe_east
								region = custom_pomerania
								region = custom_bohemia
								region = world_steppe_west
								region = custom_cuman
								region = custom_khwarizm
							}
						}
						AND = {
							event_target:holy_order_name = { title = d_knights_santiago }
							region = world_europe_west_iberia
						}
						AND = {
							event_target:holy_order_name = { title = d_knights_calatrava }
							region = world_europe_west_iberia
						}
						AND = {
							event_target:holy_order_name = { title = d_saint_addai }
							OR = {
								region = world_europe_south_east
								region = world_asia_minor
								region = world_persia
								region = custom_khwarizm
								region = world_middle_east
								region = custom_egypt
								region = custom_africa
								region = world_india_rajastan
							}
						}
					}
				}
			}
			random_demesne_province = {
				limit = {
					has_empty_holding = yes
					any_province_holding = { holding_type = castle }
					any_province_holding = { holding_type = city }
					any_province_holding = { holding_type = temple }
					NOT = {
						any_province_holding = {
							holder_scope = {
								OR = {
									character = ROOT
									is_liege_or_above = ROOT
								}
							}
						}
					}
					county = {
						is_occupied = no
						is_contested = no
					}
					OR = {
						port = yes
						ROOT = { any_realm_title = { location = { port = yes } } }
					}
					OR = {
						event_target:holy_order_name = {
							NOR = {
								title = d_knights_templar
								title = d_knights_hospitaler
								title = d_teutonic_order
								title = d_knights_santiago
								title = d_knights_calatrava
								title = d_saint_addai
							}
						}
						AND = {
							event_target:holy_order_name = { title = d_knights_templar }
							OR = {
								region = world_europe_west_francia
								region = world_europe_south
								region = world_asia_minor
								region = world_europe_west_iberia
								region = world_persia
								region = custom_khwarizm
								region = world_middle_east
								region = custom_egypt
								region = custom_africa
								region = world_africa_east
								region = world_europe_west_brittania
							}
						}
						AND = {
							event_target:holy_order_name = { title = d_knights_hospitaler }
							OR = {
								region = world_europe_south_east
								region = world_asia_minor
								region = custom_sicily
								region = custom_arabia
								region = custom_egypt
								region = world_middle_east_jerusalem
								region = custom_africa
								region = world_africa_east
							}
						}
						AND = {
							event_target:holy_order_name = { title = d_teutonic_order }
							OR = {
								region = world_europe_east
								region = custom_pomerania
								region = custom_bohemia
								region = world_steppe_west
								region = custom_cuman
								region = custom_khwarizm
							}
						}
						AND = {
							event_target:holy_order_name = { title = d_knights_santiago }
							region = world_europe_west_iberia
						}
						AND = {
							event_target:holy_order_name = { title = d_knights_calatrava }
							region = world_europe_west_iberia
						}
						AND = {
							event_target:holy_order_name = { title = d_saint_addai }
							OR = {
								region = world_europe_south_east
								region = world_asia_minor
								region = world_persia
								region = custom_khwarizm
								region = world_middle_east
								region = custom_egypt
								region = custom_africa
								region = world_india_rajastan
							}
						}
					}
				}
				save_event_target_as = desired_province
			}
			set_character_flag = holy_order_request_castle
			letter_event = { id = SoA.1051 }
			break = yes
		}
		set_character_flag = cannot_build_castle
	}
}

# Holy order humbly requests to build a castle in your demesne
letter_event = {
	id = SoA.1051
	desc = EVTDESC_SOA_1051
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes	

	option = {
		name = EVTOPTA_SOA_1023 # Agree
		ai_chance = {
			factor = 80
			modifier = {
				factor = 0.5
				trait = cynical
			}
			modifier = {
				factor = 0.5
				event_target:desired_province = { is_capital = yes }
			}
		}	
		hidden_tooltip = { FROM = { wealth = -600 } }
		event_target:desired_province = {
			build_holding = {
			   type = castle
			   holder = FROM
			}
		}
		piety = 200
		wealth = 100
	}
	
	option = {
		name = EVTOPTB_SOA_1031 # Refuse
		ai_chance = {
			factor = 20
			modifier = {
				factor = 0
				trait = zealous
			}
			modifier = {
				factor = 2.0
				event_target:desired_province = { is_capital = yes }
			}
		}	
		piety = -100
	}
}	


########################################
# The Knights Templar
########################################

# Ping event when vassalizing the Templars
character_event = {
	id = SoA.1015
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		set_defacto_liege = FROM
		FROM = {
			letter_event = {
				id = SoA.1016
			}
		}
	}
}

# Notification event when vassalizing the Templars
letter_event = {
	id = SoA.1016
	desc = EVTDESC_SOA_1016
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

# Ping event when expelling a Christian Holy Order
character_event = {
	id = SoA.1060
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		any_title_under = {
			limit = {
				tier = BARON
				location = {
					owner = {
						OR = {
							character = FROM
							is_liege_or_above = FROM
						}
					}
				}
			}
			usurp_title = FROM
		}
		
		if = {
			limit = {
				is_liege_or_above = FROM
			}
			set_defacto_liege = THIS
		}
	
		FROM = {
			letter_event = {
				id = SoA.1061
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_expelled_from_realm
		}
	}
}

# Notification event when expelling a Christian Holy Order
letter_event = {
	id = SoA.1061
	desc = EVTDESC_SOA_1061
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		remove_character_modifier = donated_to_holy_order
	}
	
	option = {
		name = EVTOPTB_SOA_1061
	}
}

########################################
# The Knights of St John
########################################

# Ping event when vassalizing the Hospitallers
character_event = {
	id = SoA.1115
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		set_defacto_liege = FROM
		FROM = {
			letter_event = {
				id = SoA.1116
			}
		}
	}
}

# Notification event when vassalizing the Hospitallers
letter_event = {
	id = SoA.1116
	desc = EVTDESC_SOA_1116
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

# Ping event when donating money to the Hospitallers
character_event = {
	id = SoA.1140
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		wealth = 300
		if = {
			limit = { religion_group = christian }
			FROM = {
				letter_event = {
					id = SoA.1141
				}
			}
		}
		if = {
			limit = { religion_group = muslim }
			FROM = {
				letter_event = {
					id = CM.4399
				}
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_generous_donation
		}
	}
}

# Notification event when donating money to the Hospitallers
letter_event = {
	id = SoA.1141
	desc = EVTDESC_SOA_1141
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

########################################
# The Ansar Order
########################################

# Birth of the Ansar Order
narrative_event = {
	id = SoA.1209
	title = EVTTITLE_SOA_1209
	desc = EVTDESC_SOA_1209
	picture = GFX_evt_moors
	
	major = yes
	hide_from = yes
	
	only_playable = yes
	only_men = yes
	religion_group = muslim
	has_dlc = "Sons of Abraham"
	has_global_flag = muslim_jihads_unlocked
	
	trigger = {		
		OR = {
			religion = sunni
			religion = zikri
			religion = quranist
		}
		is_heretic = no
		NOT = {
			is_title_active = d_ansar
		}
		OR = {
			year = 1228	# Historical
			
			693 = { # Baghdad
				NOT = { owner = { religion_group = muslim } }
			}
			728 = { # Damascus
				NOT = { owner = { religion_group = muslim } }
			}
			796 = { # Cairo
				NOT = { owner = { religion_group = muslim } }
			}
			774 = { # Jerusalem
				NOT = { owner = { religion_group = muslim } }
			}
			719 = { # Mecca
				NOT = { owner = { religion_group = muslim } }
			}
		}
	}
	
	mean_time_to_happen = {
		months = 6
	}
	
	immediate = {
		activate_title = { title = d_ansar status = yes }
		create_character = {
			random_traits = no
			name = Bektash
			dynasty = random
			religion = ROOT
			culture = persian
			female = no
			age = 25
			attributes = {
				martial = 10
				diplomacy = 9
				stewardship = 9
				intrigue = 7
				learning = 9
			}
			health = 6
			fertility = 0.5
			trait = brilliant_strategist
			trait = sayyid
			trait = hajjaj
			trait = hafiz
			trait = patient
			trait = zealous
			trait = scholar
			trait = temperate
		}
		new_character = {
			wealth = 500
			d_ansar = {
				grant_title = PREV
				religion = PREV
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = persian
				female = no
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = persian
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = persian
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = persian
				female = no
				age = 20
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = persian
				female = no
				age = 25
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = persian
				female = no
				age = 26
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = persian
				female = no
				age = 28
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = persian
				female = yes
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = persian
				female = yes
				age = 17
			}
		}
	}
	
	option = {
		name = EVTOPTA_SOA_1209
		trigger = {
			religion = ROOT
		}
	}
	option = {
		name = EVTOPTB_SOA_1209
		trigger = {
			NOT = { religion = ROOT }
		}
	}
}

########################################
# The Teutonic Order
########################################

# Ping event when donating money to the Teutonic Order
character_event = {
	id = SoA.1340
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		wealth = 300
		FROM = {
			letter_event = {
				id = SoA.1141 # We can just reuse this
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_generous_donation
		}
	}
}

########################################
# The Hashshashin
########################################

# Ping event when expelling a Muslim Holy Order
character_event = {
	id = SoA.1460
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		any_title_under = {
			limit = {
				tier = BARON
				location = {
					owner = {
						OR = {
							character = FROM
							is_liege_or_above = FROM
						}
					}
				}
			}
			usurp_title = FROM
		}
		
		if = {
			limit = {
				is_liege_or_above = FROM
			}
			set_defacto_liege = THIS
		}
	
		FROM = {
			letter_event = {
				id = SoA.1461
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_expelled_from_realm
		}
	}
}

# Notification event when expelling a Muslim Holy Order
letter_event = {
	id = SoA.1461
	desc = EVTDESC_SOA_1461
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		remove_character_modifier = donated_to_holy_order
	}
	
	option = {
		name = EVTOPTB_SOA_1061
	}
}


########################################
# The Jomsvikings
########################################

# Ping event when donating money to the Jomsvikings
character_event = {
	id = SoA.1540
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		wealth = 300
		FROM = {
			letter_event = {
				id = SoA.1541
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_generous_donation
		}
	}
}

# Notification event when donating money to the Jomsvikings
letter_event = {
	id = SoA.1541
	desc = EVTDESC_SOA_1541
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

# Ping event when expelling a Pagan Holy Order
character_event = {
	id = SoA.1560
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		any_title_under = {
			limit = {
				tier = BARON
				location = {
					owner = {
						OR = {
							character = FROM
							is_liege_or_above = FROM
						}
					}
				}
			}
			usurp_title = FROM
		}
		
		if = {
			limit = {
				is_liege_or_above = FROM
			}
			set_defacto_liege = THIS
		}
	
		FROM = {
			letter_event = {
				id = SoA.1561
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_expelled_from_realm
		}
	}
}

# Notification event when expelling a Pagan Holy Order
letter_event = {
	id = SoA.1561
	desc = EVTDESC_SOA_1561
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		remove_character_modifier = donated_to_holy_order
	}
	
	option = {
		name = EVTOPTB_SOA_1061
	}
}

########################################
# The Brotherhood of the Holy Sepulchre
########################################

# Brotherhood of the Holy Sepulchre becomes a Chivalric Order
narrative_event = {
	id = SoA.1609
	title = EVTTITLE_SOA_1609
	desc = EVTDESC_SOA_1609
	major = yes
	
	picture = GFX_evt_western_knights_byzantine
	
	only_playable = yes
	hide_from = yes
	religion_group = christian
	
	trigger = {
		OR = {
			religion = chalcedonian
			religion = orthodox
			religion = bogomilist
			religion = monothelite
			religion = iconoclast
		}
		is_heretic = no
		764 = { # Antioch is Orthodox
			holder_scope = { religion = ROOT }
			religion = ROOT
		}
		774 = { # Jeruslaem is Orthodox
			holder_scope = { religion = ROOT }
			religion = ROOT
		}
			
		NOT = {
			is_title_active = d_holy_sepulchre
		}
	}
	
	mean_time_to_happen = {
		months = 36
	}
	
	immediate = {
		activate_title = { title = d_holy_sepulchre status = yes }
		create_character = {
			random_traits = yes
			dynasty = random
			religion = ROOT
			culture = greek
			female = no
			age = 31
		}
		new_character = {
			wealth = 500
			d_holy_sepulchre = {
				religion = PREV
				grant_title = PREV
				religion = PREV
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = greek
				female = no
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = greek
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = greek
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = greek
				female = no
				age = 20
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = greek
				female = no
				age = 25
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = greek
				female = no
				age = 26
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = greek
				female = no
				age = 28
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = greek
				female = yes
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = greek
				female = yes
				age = 17
			}
		}
	}
	
	option = {
		name = EVTOPTA_SOA_1609
		trigger = {
			religion = ROOT
		}
	}
	option = {
		name = EVTOPTB_SOA_1609
		trigger = {
			NOT = { religion = ROOT }
		}
	}
}

# Ping event when donating money to the Brotherhood
character_event = {
	id = SoA.1640
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		wealth = 300
		FROM = {
			letter_event = {
				id = SoA.1641
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_generous_donation
		}
	}
}

# Notification event when donating money to the Brotherhood
letter_event = {
	id = SoA.1641
	desc = EVTDESC_SOA_1141
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

# Ping event when expelling the Brotherhood
character_event = {
	id = SoA.1660
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		any_title_under = {
			limit = {
				tier = BARON
				location = {
					owner = {
						OR = {
							character = FROM
							is_liege_or_above = FROM
						}
					}
				}
			}
			usurp_title = FROM
		}
	
		FROM = {
			letter_event = {
				id = SoA.1661
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_expelled_from_realm
		}
	}
}

# Notification event when expelling the Brotherhood
letter_event = {
	id = SoA.1661
	desc = EVTDESC_SOA_1661
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTB_SOA_1061
	}
}

########################################
# The Order of Saint Anthony
########################################

# The Order of Saint Anthony is reborn
narrative_event = {
	id = SoA.1709
	title = EVTTITLE_SOA_1709
	desc = EVTDESC_SOA_1709
	major = yes
	
	picture = GFX_evt_western_knights_byzantine
	
	only_playable = yes
	hide_from = yes
	religion_group = christian
	
	trigger = {
		OR = {
			AND = {
				875 = { # Aksum is Miaphysite-controlled
					holder_scope = { religion = miaphysite }
					religion = miaphysite 
				}
				793 = { # Makuria is Miaphysite-controlled
					holder_scope = { religion = miaphysite }
					religion = miaphysite 
				}
				802 = { # Alexandria is Miaphysite-controlled
					holder_scope = { religion = miaphysite }
					religion = miaphysite 
				}
				religion = miaphysite
			}
			AND = {
				875 = { # Aksum is monophysite-controlled
					holder_scope = { religion = monophysite }
					religion = monophysite 
				}
				793 = { # Makuria is monophysite-controlled
					holder_scope = { religion = monophysite }
					religion = monophysite 
				}
				802 = { # Alexandria is monophysite-controlled
					holder_scope = { religion = monophysite }
					religion = monophysite 
				}
				religion = monophysite
			}
			AND = {
				875 = { # Aksum is tondrakian-controlled
					holder_scope = { religion = tondrakian }
					religion = tondrakian 
				}
				793 = { # Makuria is tondrakian-controlled
					holder_scope = { religion = tondrakian }
					religion = tondrakian 
				}
				802 = { # Alexandria is tondrakian-controlled
					holder_scope = { religion = tondrakian }
					religion = tondrakian 
				}
				religion = tondrakian
			}
		}
		is_heretic = no
		
		NOT = {
			is_title_active = d_saint_anthony
		}
	}
	
	mean_time_to_happen = {
		months = 36
	}
	
	immediate = {
		activate_title = { title = d_saint_anthony status = yes }
		create_character = {
			random_traits = yes
			dynasty = random
			religion = ROOT
			culture = ROOT
			female = no
			age = 33
		}
		new_character = {
			wealth = 500
			d_saint_anthony = {
				grant_title = PREV
				religion = PREV
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ROOT
				female = no
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ROOT
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ROOT
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ROOT
				female = no
				age = 20
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ROOT
				female = no
				age = 25
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ROOT
				female = no
				age = 26
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ROOT
				female = no
				age = 28
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ROOT
				female = yes
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ROOT
				female = yes
				age = 17
			}
		}
	}
	
	option = {
		name = EVTOPTA_SOA_1709
		trigger = {
			religion = ROOT
		}
	}
	option = {
		name = EVTOPTB_SOA_1709
		trigger = {
			NOT = { religion = ROOT }
		}
	}
}

# Ping event when donating money to the Order
character_event = {
	id = SoA.1740
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		wealth = 300
		FROM = {
			letter_event = {
				id = SoA.1741
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_generous_donation
		}
	}
}

# Notification event when donating money to the Order
letter_event = {
	id = SoA.1741
	desc = EVTDESC_SOA_1141
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

# Ping event when expelling the Order
character_event = {
	id = SoA.1760
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		any_title_under = {
			limit = {
				tier = BARON
				location = {
					owner = {
						OR = {
							character = FROM
							is_liege_or_above = FROM
						}
					}
				}
			}
			usurp_title = FROM
		}
	
		FROM = {
			letter_event = {
				id = SoA.1761
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_expelled_from_realm
		}
	}
}

# Notification event when expelling the Order
letter_event = {
	id = SoA.1761
	desc = EVTDESC_SOA_1061
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTB_SOA_1061
	}
}

########################################
# The Immortals
########################################

# The Immortals are reborn
narrative_event = {
	id = SoA.1809
	title = "EVTNAME_GoPagan_215"
	desc = "EVTDESC_GoPagan_215"
	picture = "GFX_evt_zhayedan"
	border = "GFX_event_narrative_frame_religion"
	
	major = yes	
	only_playable = yes
	hide_from = yes
	religion_group = zoroastrian_group	
	has_global_flag = zoroastrian_priesthood_founded
	is_triggered_only = yes	
	
	
	option = {
		name = EVTOPTA_SOA_1809		
		trigger = {
			has_character_flag = event_1000182157
		}
		clr_character_flag = event_11000182157
	}
	
	option = {
		name = "EVTOPTA_GoPagan_210"
		trigger = {
			NOT = { has_character_flag = event_1000182157 }
		}
	}
}

# Ping event when donating money to the Immortals
character_event = {
	id = SoA.1840
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		wealth = 300
		FROM = {
			letter_event = {
				id = SoA.1841
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_generous_donation
		}
	}
}

# Notification event when donating money to the Immortals
letter_event = {
	id = SoA.1841
	desc = EVTDESC_SOA_1841
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

# Ping event when expelling the Immortals
character_event = {
	id = SoA.1860
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		any_title_under = {
			limit = {
				tier = BARON
				location = {
					owner = {
						OR = {
							character = FROM
							is_liege_or_above = FROM
						}
					}
				}
			}
			usurp_title = FROM
		}
	
		FROM = {
			letter_event = {
				id = SoA.1861
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_expelled_from_realm
		}
	}
}

# Notification event when expelling the Immortals
letter_event = {
	id = SoA.1861
	desc = EVTDESC_SOA_1861
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTB_SOA_1061
	}
}

########################################
# The Zealots
########################################

# The Zealots are reborn
narrative_event = {
	id = SoA.1909
	title = EVTTITLE_SOA_1909
	desc = EVTDESC_SOA_1909
	major = yes
	
	picture = GFX_evt_melee
	
	only_playable = yes
	religion_group = jewish_group
	hide_from = yes
	has_global_flag = jewish_priesthood_founded
	
	trigger = {		
		is_heretic = no
		NOT = {
			is_title_active = d_zealots
		}
	}
	
	mean_time_to_happen = {
		months = 36
	}
	
	immediate = {
		activate_title = { title = d_zealots status = yes }
		create_character = {
			random_traits = yes
			dynasty = random
			religion = ROOT
			culture = ashkenazi
			female = no
			age = 29
		}
		new_character = {
			wealth = 500
			d_zealots = {
				grant_title = PREV
				religion = PREV
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ashkenazi
				female = no
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ashkenazi
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ashkenazi
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ashkenazi
				female = no
				age = 20
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ashkenazi
				female = no
				age = 25
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ashkenazi
				female = no
				age = 26
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ashkenazi
				female = no
				age = 28
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ashkenazi
				female = yes
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = ashkenazi
				female = yes
				age = 17
			}
		}
	}
	
	option = {
		name = EVTOPTA_SOA_1909
		trigger = {
			religion = ROOT
		}
	}
	option = {
		name = EVTOPTB_SOA_1909
		trigger = {
			NOT = { religion = ROOT }
		}
	}
}

# Ping event when donating money to the Zealots
character_event = {
	id = SoA.1940
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		wealth = 300
		FROM = {
			letter_event = {
				id = SoA.1941
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_generous_donation
		}
	}
}

# Notification event when donating money to the Zealots
letter_event = {
	id = SoA.1941
	desc = EVTDESC_SOA_1941
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

# Ping event when expelling the Zealots
character_event = {
	id = SoA.1960
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		any_title_under = {
			limit = {
				tier = BARON
				location = {
					owner = {
						OR = {
							character = FROM
							is_liege_or_above = FROM
						}
					}
				}
			}
			usurp_title = FROM
		}
	
		FROM = {
			letter_event = {
				id = SoA.1961
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_expelled_from_realm
		}
	}
}

# Notification event when expelling the Zealots
letter_event = {
	id = SoA.1961
	desc = EVTDESC_SOA_1961
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTB_SOA_1061
	}
}

########################################
# The Lords of the Sky
########################################

# The birth of the Lords of the Sky
narrative_event = {
	id = SoA.2009
	title = EVTTITLE_SOA_2009
	desc = EVTDESC_SOA_2009
	major = yes
	
	picture = GFX_evt_mongols_pillage_oldgods
	
	only_playable = yes
	hide_from = yes
	religion = miaphysite
	has_dlc = "Sons of Abraham"
	has_global_flag = tengri_reformation
	
	trigger = {		
		controls_religion = yes # Let it happen for the Coptic Pope - he's always around
		NOT = {
			is_title_active = d_sky_lords
		}
	}
	
	mean_time_to_happen = {
		months = 36
	}
	
	immediate = {
		activate_title = { title = d_sky_lords status = yes }
		create_character = {
			random_traits = yes
			dynasty = random
			religion = tengri_pagan_reformed
			culture = cuman
			female = no
			age = 28
		}
		new_character = {
			wealth = 500
			d_sky_lords = {
				grant_title = PREV
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = tengri_pagan_reformed
				culture = cuman
				female = no
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = tengri_pagan_reformed
				culture = cuman
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = tengri_pagan_reformed
				culture = cuman
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = tengri_pagan_reformed
				culture = cuman
				female = no
				age = 20
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = tengri_pagan_reformed
				culture = cuman
				female = no
				age = 25
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = tengri_pagan_reformed
				culture = cuman
				female = no
				age = 26
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = tengri_pagan_reformed
				culture = cuman
				female = no
				age = 28
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = tengri_pagan_reformed
				culture = cuman
				female = yes
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = tengri_pagan_reformed
				culture = cuman
				female = yes
				age = 17
			}
		}
	}
	
	option = {
		name = EVTOPTA_SOA_2009
		trigger = {
			religion = tengri_pagan_reformed
		}
	}
	option = {
		name = EVTOPTB_SOA_2009
		trigger = {
			NOT = { religion = tengri_pagan_reformed }
		}
	}
}

# Ping event when donating money to the Lords of the Sky
character_event = {
	id = SoA.2040
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		wealth = 300
		FROM = {
			letter_event = {
				id = SoA.2041
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_generous_donation
		}
	}
}

# Notification event when donating money to the Lords of the Sky
letter_event = {
	id = SoA.2041
	desc = EVTDESC_SOA_2041
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

# Ping event when expelling the Lords of the Sky
character_event = {
	id = SoA.2060
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		any_title_under = {
			limit = {
				tier = BARON
				location = {
					owner = {
						OR = {
							character = FROM
							is_liege_or_above = FROM
						}
					}
				}
			}
			usurp_title = FROM
		}
	
		FROM = {
			letter_event = {
				id = SoA.2061
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_expelled_from_realm
		}
	}
}

# Notification event when expelling the Lords of the Sky
letter_event = {
	id = SoA.2061
	desc = EVTDESC_SOA_2061
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTB_SOA_1061
	}
}

########################################
# The Spirit Guardians
########################################

# The birth of the Spirit Guardians
narrative_event = {
	id = SoA.2109
	title = EVTTITLE_SOA_2109
	desc = EVTDESC_SOA_2109
	major = yes
	
	picture = GFX_evt_melee
	
	only_playable = yes
	hide_from = yes
	religion = miaphysite
	has_dlc = "Sons of Abraham"
	has_global_flag = west_african_reformation
	
	trigger = {
		controls_religion = yes # Let it happen for the Coptic Pope - he's always around
		NOT = {
			is_title_active = d_spirit_guardians
		}
	}
	
	mean_time_to_happen = {
		months = 36
	}
	
	immediate = {
		activate_title = { title = d_spirit_guardians status = yes }
		create_character = {
			random_traits = yes
			dynasty = random
			religion = west_african_pagan_reformed
			culture = manden
			female = no
			age = 32
		}
		new_character = {
			wealth = 500
			d_spirit_guardians = {
				grant_title = PREV
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = west_african_pagan_reformed
				culture = manden
				female = no
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = west_african_pagan_reformed
				culture = manden
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = west_african_pagan_reformed
				culture = manden
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = west_african_pagan_reformed
				culture = manden
				female = no
				age = 20
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = west_african_pagan_reformed
				culture = manden
				female = no
				age = 25
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = west_african_pagan_reformed
				culture = manden
				female = no
				age = 26
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = west_african_pagan_reformed
				culture = manden
				female = no
				age = 28
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = west_african_pagan_reformed
				culture = manden
				female = yes
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = west_african_pagan_reformed
				culture = manden
				female = yes
				age = 17
			}
		}
	}
	
	option = {
		name = EVTOPTA_SOA_2109
		trigger = {
			religion = west_african_pagan_reformed
		}
	}
	option = {
		name = EVTOPTB_SOA_2009
		trigger = {
			NOT = { religion = west_african_pagan_reformed }
		}
	}
}

# Ping event when donating money to the Spirit Guardians
character_event = {
	id = SoA.2140
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		wealth = 300
		FROM = {
			letter_event = {
				id = SoA.2141
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_generous_donation
		}
	}
}

# Notification event when donating money to the Spirit Guardians
letter_event = {
	id = SoA.2141
	desc = EVTDESC_SOA_2141
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

# Ping event when expelling the Spirit Guardians
character_event = {
	id = SoA.2160
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		any_title_under = {
			limit = {
				tier = BARON
				location = {
					owner = {
						OR = {
							character = FROM
							is_liege_or_above = FROM
						}
					}
				}
			}
			usurp_title = FROM
		}
	
		FROM = {
			letter_event = {
				id = SoA.2161
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_expelled_from_realm
		}
	}
}

# Notification event when expelling the Spirit Guardians
letter_event = {
	id = SoA.2161
	desc = EVTDESC_SOA_2161
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTB_SOA_1061
	}
}

########################################
# The Warriors of Perun
########################################

# The birth of the Warriors of Perun
narrative_event = {
	id = SoA.2209
	title = EVTTITLE_SOA_2209
	desc = EVTDESC_SOA_2209
	major = yes
	
	picture = GFX_evt_throne_room_norse_pagan
	
	only_playable = yes
	hide_from = yes
	religion = miaphysite
	has_dlc = "Sons of Abraham"
	has_global_flag = slavic_reformation
	
	trigger = {
		has_dlc = "Sons of Abraham"
		controls_religion = yes # Let it happen for the Coptic Pope - he's always around
		NOT = {
			is_title_active = d_warriors_perun
		}
	}
	
	mean_time_to_happen = {
		months = 36
	}
	
	immediate = {
		activate_title = { title = d_warriors_perun status = yes }
		create_character = {
			random_traits = yes
			dynasty = random
			religion = slavic_pagan_reformed
			culture = russian
			female = no
			age = 35
		}
		new_character = {
			wealth = 500
			d_warriors_perun = {
				grant_title = PREV
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = slavic_pagan_reformed
				culture = russian
				female = no
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = slavic_pagan_reformed
				culture = russian
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = slavic_pagan_reformed
				culture = russian
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = slavic_pagan_reformed
				culture = russian
				female = no
				age = 20
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = slavic_pagan_reformed
				culture = russian
				female = no
				age = 25
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = slavic_pagan_reformed
				culture = russian
				female = no
				age = 26
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = slavic_pagan_reformed
				culture = russian
				female = no
				age = 28
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = slavic_pagan_reformed
				culture = russian
				female = yes
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = slavic_pagan_reformed
				culture = russian
				female = yes
				age = 17
			}
		}
	}
	
	option = {
		name = EVTOPTA_SOA_2209
		trigger = {
			religion = slavic_pagan_reformed
		}
	}
	option = {
		name = EVTOPTB_SOA_2009
		trigger = {
			NOT = { religion = slavic_pagan_reformed }
		}
	}
}

# Ping event when donating money to the Warriors of Perun
character_event = {
	id = SoA.2240
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		wealth = 300
		FROM = {
			letter_event = {
				id = SoA.2241
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_generous_donation
		}
	}
}

# Notification event when donating money to the Warriors of Perun
letter_event = {
	id = SoA.2241
	desc = EVTDESC_SOA_2241
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

# Ping event when expelling the Warriors of Perun
character_event = {
	id = SoA.2260
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		any_title_under = {
			limit = {
				tier = BARON
				location = {
					owner = {
						OR = {
							character = FROM
							is_liege_or_above = FROM
						}
					}
				}
			}
			usurp_title = FROM
		}
	
		FROM = {
			letter_event = {
				id = SoA.2261
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_expelled_from_realm
		}
	}
}

# Notification event when expelling the Warriors of Perun
letter_event = {
	id = SoA.2261
	desc = EVTDESC_SOA_2261
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTB_SOA_1061
	}
}

########################################
# The Chosen of Perkunas
########################################

# The birth of the Chosen of Perkunas
narrative_event = {
	id = SoA.2309
	title = EVTTITLE_SOA_2309
	desc = EVTDESC_SOA_2309
	major = yes
	
	picture = GFX_evt_throne_room_norse_pagan
	
	only_playable = yes
	hide_from = yes
	religion = miaphysite
	has_dlc = "Sons of Abraham"
	has_global_flag = baltic_reformation
	
	trigger = {
		controls_religion = yes # Let it happen for the Coptic Pope - he's always around
		NOT = {
			is_title_active = d_chosen_perkunas
		}
	}
	
	mean_time_to_happen = {
		months = 36
	}
	
	immediate = {
		activate_title = { title = d_chosen_perkunas status = yes }
		create_character = {
			random_traits = yes
			dynasty = random
			religion = baltic_pagan_reformed
			culture = lettigallish
			female = no
			age = 26
		}
		new_character = {
			wealth = 500
			d_chosen_perkunas = {
				grant_title = PREV
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = baltic_pagan_reformed
				culture = lettigallish
				female = no
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = baltic_pagan_reformed
				culture = lettigallish
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = baltic_pagan_reformed
				culture = lettigallish
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = baltic_pagan_reformed
				culture = lettigallish
				female = no
				age = 20
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = baltic_pagan_reformed
				culture = lettigallish
				female = no
				age = 25
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = baltic_pagan_reformed
				culture = lettigallish
				female = no
				age = 26
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = baltic_pagan_reformed
				culture = lettigallish
				female = no
				age = 28
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = baltic_pagan_reformed
				culture = lettigallish
				female = yes
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = baltic_pagan_reformed
				culture = lettigallish
				female = yes
				age = 17
			}
		}
	}
	
	option = {
		name = EVTOPTA_SOA_2309
		trigger = {
			religion = baltic_pagan_reformed
		}
	}
	option = {
		name = EVTOPTB_SOA_2009
		trigger = {
			NOT = { religion = baltic_pagan_reformed }
		}
	}
}

# Ping event when donating money to the Chosen of Perkunas
character_event = {
	id = SoA.2340
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		wealth = 300
		FROM = {
			letter_event = {
				id = SoA.2341
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_generous_donation
		}
	}
}

# Notification event when donating money to the Chosen of Perkunas
letter_event = {
	id = SoA.2341
	desc = EVTDESC_SOA_2341
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

# Ping event when expelling the Chosen of Perkunas
character_event = {
	id = SoA.2360
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		any_title_under = {
			limit = {
				tier = BARON
				location = {
					owner = {
						OR = {
							character = FROM
							is_liege_or_above = FROM
						}
					}
				}
			}
			usurp_title = FROM
		}
	
		FROM = {
			letter_event = {
				id = SoA.2361
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_expelled_from_realm
		}
	}
}

# Notification event when expelling the Chosen of Perkunas
letter_event = {
	id = SoA.2361
	desc = EVTDESC_SOA_2361
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTB_SOA_1061
	}
}

########################################
# The Sons of Kaleva
########################################

# The birth of the Sons of Kaleva
narrative_event = {
	id = SoA.2409
	title = EVTTITLE_SOA_2409
	desc = EVTDESC_SOA_2409
	major = yes
	
	picture = GFX_evt_throne_room_norse_pagan
	
	only_playable = yes
	religion = miaphysite
	hide_from = yes
	has_dlc = "Sons of Abraham"
	has_global_flag = finnish_reformation
	
	trigger = {
		controls_religion = yes # Let it happen for the Coptic Pope - he's always around
		NOT = {
			is_title_active = d_sons_kaleva
		}
	}
	
	mean_time_to_happen = {
		months = 36
	}
	
	immediate = {
		activate_title = { title = d_sons_kaleva status = yes }
		create_character = {
			random_traits = yes
			dynasty = random
			religion = finnish_pagan_reformed
			culture = finnish
			female = no
			age = 31
		}
		new_character = {
			wealth = 500
			d_sons_kaleva = {
				grant_title = PREV
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = finnish_pagan_reformed
				culture = finnish
				female = no
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = finnish_pagan_reformed
				culture = finnish
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = finnish_pagan_reformed
				culture = finnish
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = finnish_pagan_reformed
				culture = finnish
				female = no
				age = 20
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = finnish_pagan_reformed
				culture = finnish
				female = no
				age = 25
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = finnish_pagan_reformed
				culture = finnish
				female = no
				age = 26
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = finnish_pagan_reformed
				culture = finnish
				female = no
				age = 28
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = finnish_pagan_reformed
				culture = finnish
				female = yes
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = finnish_pagan_reformed
				culture = finnish
				female = yes
				age = 17
			}
		}
	}
	
	option = {
		name = EVTOPTA_SOA_2409
		trigger = {
			religion = finnish_pagan_reformed
		}
	}
	option = {
		name = EVTOPTB_SOA_2009
		trigger = {
			NOT = { religion = finnish_pagan_reformed }
		}
	}
}

# Ping event when donating money to the Sons of Kaleva
character_event = {
	id = SoA.2440
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		wealth = 300
		FROM = {
			letter_event = {
				id = SoA.2441
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_generous_donation
		}
	}
}

# Notification event when donating money to the Sons of Kaleva
letter_event = {
	id = SoA.2441
	desc = EVTDESC_SOA_2441
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

# Ping event when expelling the Sons of Kaleva
character_event = {
	id = SoA.2460
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		any_title_under = {
			limit = {
				tier = BARON
				location = {
					owner = {
						OR = {
							character = FROM
							is_liege_or_above = FROM
						}
					}
				}
			}
			usurp_title = FROM
		}
	
		FROM = {
			letter_event = {
				id = SoA.2461
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_expelled_from_realm
		}
	}
}

# Notification event when expelling the Sons of Kaleva
letter_event = {
	id = SoA.2461
	desc = EVTDESC_SOA_2461
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTB_SOA_1061
	}
}

########################################
# The Cult of Huitzilopochtli
########################################

# The birth of the Cult of Huitzilopochtli
narrative_event = {
	id = SoA.2509
	title = EVTTITLE_SOA_2509
	desc = EVTDESC_SOA_2509
	major = yes
	
	picture = GFX_evt_bishop_aztec
	
	only_playable = yes
	religion = miaphysite
	hide_from = yes
	has_dlc = "Sons of Abraham"	
	
	trigger = {
		controls_religion = yes # Let it happen for the Coptic Pope - he's always around
		has_global_flag = aztec_reformation #TODO: figure out new condition, since Aztec is pre-reformed in Plus
		NOT = {
			is_title_active = d_huitzilopochtli
		}
	}
	
	mean_time_to_happen = {
		months = 36
	}
	
	immediate = {
		activate_title = { title = d_huitzilopochtli status = yes }
		create_character = {
			random_traits = yes
			dynasty = random
			religion = aztec
			culture = nahuatl
			female = no
			age = 37
		}
		new_character = {
			wealth = 500
			d_huitzilopochtli = {
				grant_title = PREV
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = aztec
				culture = nahuatl
				female = no
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = aztec
				culture = nahuatl
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = aztec
				culture = nahuatl
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = aztec
				culture = nahuatl
				female = no
				age = 20
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = aztec
				culture = nahuatl
				female = no
				age = 25
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = aztec
				culture = nahuatl
				female = no
				age = 26
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = aztec
				culture = nahuatl
				female = no
				age = 28
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = aztec
				culture = nahuatl
				female = yes
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = aztec
				culture = nahuatl
				female = yes
				age = 17
			}
		}
	}
	
	option = {
		name = EVTOPTA_SOA_2509
		trigger = {
			religion = aztec
		}
	}
	option = {
		name = EVTOPTB_SOA_2009
		trigger = {
			NOT = { religion = aztec }
		}
	}
}

# Ping event when donating money to the Cult of Huitzilopochtli
character_event = {
	id = SoA.2540
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		wealth = 300
		FROM = {
			letter_event = {
				id = SoA.2541
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_generous_donation
		}
	}
}

# Notification event when donating money to the Cult of Huitzilopochtli
letter_event = {
	id = SoA.2541
	desc = EVTDESC_SOA_2541
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

# Ping event when expelling the Cult of Huitzilopochtli
character_event = {
	id = SoA.2560
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		any_title_under = {
			limit = {
				tier = BARON
				location = {
					owner = {
						OR = {
							character = FROM
							is_liege_or_above = FROM
						}
					}
				}
			}
			usurp_title = FROM
		}
	
		FROM = {
			letter_event = {
				id = SoA.2561
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_expelled_from_realm
		}
	}
}

# Notification event when expelling the Cult of Huitzilopochtli
letter_event = {
	id = SoA.2561
	desc = EVTDESC_SOA_2561
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTB_SOA_1061
	}
}

########################################
# The Order of Santiago
########################################

# The birth of the Order of Santiago
narrative_event = {
	id = SoA.2609
	title = EVTTITLE_SOA_2609
	desc = EVTDESC_SOA_2609
	major = yes
	
	picture = GFX_evt_knight_kneeling
	
	only_playable = yes
	hide_from = yes
	religion_group = christian
	has_dlc = "Sons of Abraham"
	has_global_flag = christian_crusades_unlocked
	
	trigger = {
		OR = {
			religion = chalcedonian
			religion = catholic
			religion = cathar
			religion = fraticelli
			religion = waldensian
			religion = lollard
			religion = adoptionist
		}
		is_heretic = no
		
		NOT = { is_title_active = d_knights_santiago }
		OR = {
			year = 1175	# Historical
			221 = { # Provence
				NOT = { owner = { religion_group = christian } }
			}
			214 = { # Toulouse
				NOT = { owner = { religion_group = christian } }
			}
			112 = { # Paris
				NOT = { owner = { religion_group = christian } }
			}
			119 = { # Cologne
				NOT = { owner = { religion_group = christian } }
			}
			257 = { # Braunschweig
				NOT = { owner = { religion_group = christian } }
			}
			149 = { # Bordeaux
				NOT = { owner = { religion_group = christian } }
			}
		}
	}
	
	mean_time_to_happen = {
		months = 36
	}
	
	immediate = {
		activate_title = { title = d_knights_santiago status = yes }
		create_character = {
			random_traits = yes
			dynasty = random
			religion = ROOT
			culture = castillan
			female = no
			age = 31
		}
		new_character = {
			wealth = 500
			d_knights_santiago = {
				religion = PREV
				grant_title = PREV
				religion = PREV
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = no
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = no
				age = 20
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = no
				age = 25
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = no
				age = 26
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = no
				age = 28
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = yes
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = yes
				age = 17
			}
		}
	}
	
	option = {
		name = EVTOPTA_SOA_2609
		trigger = {
			religion = ROOT
		}
	}
	option = {
		name = EVTOPTB_SOA_2609
		trigger = {
			NOT = { religion = ROOT }
		}
	}
}

# Ping event when donating money to the Order
character_event = {
	id = SoA.2640
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		wealth = 300
		FROM = {
			letter_event = {
				id = SoA.2641
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_generous_donation
		}
	}
}

# Notification event when donating money to the Order
letter_event = {
	id = SoA.2641
	desc = EVTDESC_SOA_1141
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

# Ping event when expelling the Order
character_event = {
	id = SoA.2660
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		any_title_under = {
			limit = {
				tier = BARON
				location = {
					owner = {
						OR = {
							character = FROM
							is_liege_or_above = FROM
						}
					}
				}
			}
			usurp_title = FROM
		}
	
		FROM = {
			letter_event = {
				id = SoA.2661
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_expelled_from_realm
		}
	}
}

# Notification event when expelling the Order
letter_event = {
	id = SoA.2661
	desc = EVTDESC_SOA_1061
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTB_SOA_1061
	}
}

########################################
# The Order of Calatrava
########################################

# The birth of the Order of Calatrava
narrative_event = {
	id = SoA.2709
	title = EVTTITLE_SOA_2709
	desc = EVTDESC_SOA_2709
	major = yes
	
	picture = GFX_evt_knight_kneeling
	
	only_playable = yes
	hide_from = yes
	religion_group = christian
	has_dlc = "Sons of Abraham"
	has_global_flag = christian_crusades_unlocked
	
	trigger = {
		OR = {
			religion = chalcedonian
			religion = catholic
			religion = cathar
			religion = fraticelli
			religion = waldensian
			religion = lollard
			religion = adoptionist
		}
		is_heretic = no
		NOT = { is_title_active = d_knights_calatrava }
		OR = {
			year = 1164	# Historical
			221 = { # Provence
				NOT = { owner = { religion_group = christian } }
			}
			214 = { # Toulouse
				NOT = { owner = { religion_group = christian } }
			}
			112 = { # Paris
				NOT = { owner = { religion_group = christian } }
			}
			119 = { # Cologne
				NOT = { owner = { religion_group = christian } }
			}
			257 = { # Braunschweig
				NOT = { owner = { religion_group = christian } }
			}
			149 = { # Bordeaux
				NOT = { owner = { religion_group = christian } }
			}
		}
	}
	
	mean_time_to_happen = {
		months = 36
	}
	
	immediate = {
		activate_title = { title = d_knights_calatrava status = yes }
		create_character = {
			random_traits = yes
			dynasty = random
			religion = ROOT
			culture = castillan
			female = no
			age = 31
		}
		new_character = {
			wealth = 500
			d_knights_calatrava = {
				religion = PREV
				grant_title = PREV
				religion = PREV
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = no
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = no
				age = 20
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = no
				age = 25
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = no
				age = 26
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = no
				age = 28
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = yes
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = castillan
				female = yes
				age = 17
			}
		}
	}
	
	option = {
		name = EVTOPTA_SOA_2709
		trigger = {
			religion = ROOT
		}
	}
	option = {
		name = EVTOPTB_SOA_2709
		trigger = {
			NOT = { religion = ROOT	}
		}
	}
}

# Ping event when donating money to the Order
character_event = {
	id = SoA.2740
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		wealth = 300
		FROM = {
			letter_event = {
				id = SoA.2741
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_generous_donation
		}
	}
}

# Notification event when donating money to the Order
letter_event = {
	id = SoA.2741
	desc = EVTDESC_SOA_1141
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

# Ping event when expelling the Order
character_event = {
	id = SoA.2760
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		any_title_under = {
			limit = {
				tier = BARON
				location = {
					owner = {
						OR = {
							character = FROM
							is_liege_or_above = FROM
						}
					}
				}
			}
			usurp_title = FROM
		}
	
		FROM = {
			letter_event = {
				id = SoA.2761
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_expelled_from_realm
		}
	}
}

# Notification event when expelling the Order
letter_event = {
	id = SoA.2761
	desc = EVTDESC_SOA_1061
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTB_SOA_1061
	}
}

########################################
# The Order of Saint Addai
########################################

# The birth of the Order of St Addai
narrative_event = {
	id = SoA.2809
	title = EVTTITLE_SOA_2809
	desc = EVTDESC_SOA_2809
	major = yes
	
	picture = GFX_evt_knight_kneeling
	
	only_playable = yes
	hide_from = yes
	religion_group = christian
	has_dlc = "Sons of Abraham"		
	
	trigger = {
		OR = {
			religion = nestorian
			religion = messalian
		}
		
		is_heretic = no
		
		NOT = { is_title_active = d_saint_addai }
		
		OR = {
			AND = {
				religion = nestorian
				693 = { # Baghdad is Nestorian
					holder_scope = { religion = nestorian }
					religion = nestorian 
				}
				774 = { # Jerusalem is Nestorian
					holder_scope = { religion = nestorian }
					religion = nestorian 
				}
			}
			AND = {
				religion = messalian
				693 = { # Baghdad is Messalian
					holder_scope = { religion = messalian }
					religion = messalian 
				}
				774 = { # Jerusalem is Messalian
					holder_scope = { religion = messalian }
					religion = messalian 
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 36
	}
	
	immediate = {
		activate_title = { title = d_saint_addai status = yes }
		create_character = {
			random_traits = yes
			dynasty = random
			religion = ROOT
			culture = persian
			female = no
			age = 31
		}
		new_character = {
			wealth = 500
			d_saint_addai = {
				grant_title = PREV
				religion = PREV
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = persian
				female = no
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = persian
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = persian
				female = no
				age = 18
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = persian
				female = no
				age = 20
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = persian
				female = no
				age = 25
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = persian
				female = no
				age = 26
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = kurdish
				female = no
				age = 28
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = kurdish
				female = yes
				age = 16
			}
			create_character = {
				random_traits = yes
				dynasty = random
				religion = ROOT
				culture = kurdish
				female = yes
				age = 17
			}
		}
	}
	
	option = {
		name = EVTOPTA_SOA_2809
		trigger = {
			religion = ROOT
		}
	}
	option = {
		name = EVTOPTB_SOA_2809
		trigger = {
			NOT = { religion = ROOT	}
		}
	}
}

# Ping event when donating money to the Order
character_event = {
	id = SoA.2840
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		wealth = 300
		FROM = {
			letter_event = {
				id = SoA.2841
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_generous_donation
		}
	}
}

# Notification event when donating money to the Order
letter_event = {
	id = SoA.2841
	desc = EVTDESC_SOA_1141
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

# Ping event when expelling the Order
character_event = {
	id = SoA.2860
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		any_title_under = {
			limit = {
				tier = BARON
				location = {
					owner = {
						OR = {
							character = FROM
							is_liege_or_above = FROM
						}
					}
				}
			}
			usurp_title = FROM
		}
	
		FROM = {
			letter_event = {
				id = SoA.2861
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_expelled_from_realm
		}
	}
}

# Notification event when expelling the Order
letter_event = {
	id = SoA.2861
	desc = EVTDESC_SOA_1061
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTB_SOA_1061
	}
}

# Spouse notified of character joining holy order
character_event = {
	id = SoA.2863
	desc = EVTDESC_SoA_2863
	picture = GFX_evt_melee
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes
	
	option = {
		name = ALAS
		trigger = {
			opinion = { who = FROM value = 0 }
		}
		tooltip = { remove_spouse = FROM }
	}
	option = {
		name = GOOD_RIDDANCE
		trigger = {
			NOT = { opinion = { who = FROM value = 0 } }
		}
		tooltip = { remove_spouse = FROM }
	}
}

# Expelling a Holy Order confirmation event
character_event = {
	id = SoA.2990
	desc = "EVTDESC_SOA_2990"
	picture = "GFX_evt_crusaders"
	border = "GFX_event_normal_frame_religion"
	
	desc = {
		trigger = {
			religion_group = christian
		}
		text = EVTDESC_SOA_2990
		picture = "GFX_evt_crusaders"
	}
	desc = {
		trigger = {
			OR = {
				religion_group = muslim
				religion_group = zoroastrian_group
			}
		}
		text = EVTDESC_SOA_2990
		picture = "GFX_evt_moors"
	}
	desc = {
		trigger = {
			is_pagan_religion = yes
			NOT = {
				religion = aztec				
			}
		}
		text = EVTDESC_SOA_2990
		picture = "GFX_evt_vikings_arriving_oldgods"
	}
	desc = {
		trigger = {			
			religion = aztec			
		}
		text = EVTDESC_SOA_2990
		picture = "GFX_evt_battle_mesoamerican"
	}
	desc = {
		trigger = {
			religion_group = jewish_group
		}
		text = EVTDESC_SOA_2990
		picture = "GFX_evt_synagogue"
	}
	
	title = { # Knights Templar
		trigger = {
			has_character_flag = expel_the_knights_templar_check
		}
		text = expel_the_knights_templar
	}
	title = { # Knights Hospitaler
		trigger = {
			has_character_flag = expel_the_knights_hospitaler_check
		}
		text = expel_the_knights_hospitaler
	}
	title = { # Teutonic Order
		trigger = {
			has_character_flag = expel_the_teutonic_order_check
		}
		text = expel_the_teutonic_order
	}
	title = { # Jomsvikings
		trigger = {
			has_character_flag = expel_the_jomsvikings_check
		}
		text = expel_the_jomsvikings
	}
	title = { # Hashshashin
		trigger = {
			has_character_flag = expel_the_assassins_check
		}
		text = expel_the_assassins
	}
	title = { # Bektashi
		trigger = {
			has_character_flag = expel_the_bektashi_check
		}
		text = expel_the_bektashi
	}
	title = { # Haruriyyah
		trigger = {
			has_character_flag = expel_the_haruriyyah_check
		}
		text = expel_the_haruriyyah
	}
	title = { # Holy Sepulchre
		trigger = {
			has_character_flag = expel_the_holy_sepulchre_check
		}
		text = expel_the_holy_sepulchre
	}
	title = { # Saint Anthony
		trigger = {
			has_character_flag = expel_saint_anthony_check
		}
		text = expel_saint_anthony
	}
	title = { # Immortals
		trigger = {
			has_character_flag = expel_immortals_check
		}
		text = expel_immortals
	}
	title = { # Zealots
		trigger = {
			has_character_flag = expel_zealots_check
		}
		text = expel_zealots
	}
	title = { # Sky Lords
		trigger = {
			has_character_flag = expel_sky_lords_check
		}
		text = expel_sky_lords
	}
	title = { # Spirit Guardians
		trigger = {
			has_character_flag = expel_spirit_guardians_check
		}
		text = expel_spirit_guardians
	}
	title = { # Warriors of Perun
		trigger = {
			has_character_flag = expel_warriors_perun_check
		}
		text = expel_warriors_perun
	}
	title = { # Chosen of Perkunas
		trigger = {
			has_character_flag = expel_chosen_perkunas_check
		}
		text = expel_chosen_perkunas
	}
	title = { # Sons of Kaleva
		trigger = {
			has_character_flag = expel_sons_kaleva_check
		}
		text = expel_sons_kaleva
	}
	title = { # Huitzilopochtli
		trigger = {
			has_character_flag = expel_huitzilopochtli_check
		}
		text = expel_huitzilopochtli
	}
	title = { # Knights of Santiago
		trigger = {
			has_character_flag = expel_knights_santiago_check
		}
		text = expel_knights_santiago
	}
	title = { # Knights of Calatrava
		trigger = {
			has_character_flag = expel_knights_calatrava_check
		}
		text = expel_knights_calatrava
	}
	title = { # Order of St Addai
		trigger = {
			has_character_flag = expel_order_of_addai_check
		}
		text = expel_order_of_addai
	}
	title = { # Zun Warriors
		trigger = {
			has_character_flag = expel_zun_warriors_check
		}
		text = expel_zun_warriors
	}
	#CK2+ Holy Orders
	title = { # Army of Light
		trigger = {
			has_character_flag = expel_army_of_light_check
		}
		text = expel_army_of_light
	}
	title = { # Ansar
		trigger = {
			has_character_flag = expel_the_ansar_check
		}
		text = expel_the_ansar
	}
	title = { # Army of Lucifer
		trigger = {
			has_character_flag = expel_army_of_lucifer_check
		}
		text = expel_army_of_lucifer
	}
	title = { # Braedralag
		trigger = {
			has_character_flag = expel_the_braedralag_check
		}
		text = expel_the_braedralag
	}
	title = { # Fianna
		trigger = {
			has_character_flag = expel_fianna_check
		}
		text = expel_fianna
	}
	title = { # Sons of Gwydion
		trigger = {
			has_character_flag = expel_gwydion_check
		}
		text = expel_gwydion
	}
	title = { # Knights of Saint Mark
		trigger = {
			has_character_flag = expel_knights_of_saint_mark_check
		}
		text = expel_knights_of_saint_mark
	}
	title = { # Order of Saint Blaise
		trigger = {
			has_character_flag = expel_order_of_saint_blaise_check
		}
		text = expel_order_of_saint_blaise
	}
	title = { # Red Dragon Knights
		trigger = {
			has_character_flag = expel_red_dragons_check
		}
		text = expel_red_dragons
	}
	title = { # Harii
		trigger = {
			has_character_flag = expel_the_harii_check
		}
		text = expel_the_harii
	}
	
	only_rulers = yes
	
	is_triggered_only = yes
	
	option = { # Knights Templar
		trigger = {
			has_character_flag = expel_the_knights_templar_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_knights_templar = {
				holder_scope = {
					character_event = {
						id = SoA.1060
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_knights_templar
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_the_knights_templar_check
		}
	}
	option = { # Knights Hospitaler
		trigger = {
			has_character_flag = expel_the_knights_hospitaler_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_knights_hospitaler = {
				holder_scope = {
					character_event = {
						id = SoA.1060
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_knights_hospitaler
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_the_knights_hospitaler_check
		}
	}
	option = { # Teutonic Order
		trigger = {
			has_character_flag = expel_the_teutonic_order_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			add_character_modifier = {
				name = expelled_d_teutonic_order
				duration = -1
				inherit = yes
			}
			d_teutonic_order = {
				holder_scope = {
					character_event = {
						id = SoA.1060
					}
				}
			}
			clr_character_flag = expel_the_teutonic_order_check
		}
	}
	option = { # Jomsvikings
		trigger = {
			has_character_flag = expel_the_jomsvikings_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_jomsvikings = {
				holder_scope = {
					character_event = {
						id = SoA.1560
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_jomsvikings
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_the_jomsvikings_check
		}
	}
	option = { # Hashshashin
		trigger = {
			has_character_flag = expel_the_assassins_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_hashshashin = {
				holder_scope = {
					character_event = {
						id = SoA.1460
					}
				}
			}
			
			add_character_modifier = {
				name = expelled_d_hashshashin
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_the_assassins_check
		}
	}
	option = { # Bektashi
		trigger = {
			has_character_flag = expel_the_bektashi_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_hashshashin = {
				holder_scope = {
					character_event = {
						id = SoA.1460
					}
				}
			}
			
			add_character_modifier = {
				name = expelled_d_hashshashin
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_the_bektashi_check
		}
	}
	option = { # Haruriyyah
		trigger = {
			has_character_flag = expel_the_haruriyyah_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_haruriyyah = {
				holder_scope = {
					character_event = {
						id = SoA.1460
					}
				}
			}
			
			add_character_modifier = {
				name = expelled_d_haruriyyah
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_the_haruriyyah_check
		}
	}
	option = { # Holy Sepulchre
		trigger = {
			has_character_flag = expel_the_holy_sepulchre_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_holy_sepulchre = {
				holder_scope = {
					character_event = {
						id = SoA.1660
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_holy_sepulchre
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_the_holy_sepulchre_check
		}
	}
	option = { # Saint Anthony
		trigger = {
			has_character_flag = expel_saint_anthony_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_saint_anthony = {
				holder_scope = {
					character_event = {
						id = SoA.1760
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_saint_anthony
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_saint_anthony_check
		}
	}
	option = { # Immortals
		trigger = {
			has_character_flag = expel_immortals_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_immortals = {
				holder_scope = {
					character_event = {
						id = SoA.1860
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_immortals
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_immortals_check
		}
	}
	option = { # Zealots
		trigger = {
			has_character_flag = expel_zealots_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_zealots = {
				holder_scope = {
					character_event = {
						id = SoA.1960
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_zealots
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_zealots_check
		}
	}
	option = { # Sky Lords
		trigger = {
			has_character_flag = expel_sky_lords_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_sky_lords = {
				holder_scope = {
					character_event = {
						id = SoA.2060
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_sky_lords
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_sky_lords_check
		}
	}
	option = { # Spirit Guardians
		trigger = {
			has_character_flag = expel_spirit_guardians_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_spirit_guardians = {
				holder_scope = {
					character_event = {
						id = SoA.2160
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_spirit_guardians
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_spirit_guardians_check
		}
	}
	option = { # Warriors of Perun
		trigger = {
			has_character_flag = expel_warriors_perun_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_warriors_perun = {
				holder_scope = {
					character_event = {
						id = SoA.2260
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_warriors_perun
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_warriors_perun_check
		}
	}
	option = { # Chosen of Perkunas
		trigger = {
			has_character_flag = expel_chosen_perkunas_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_chosen_perkunas = {
				holder_scope = {
					character_event = {
						id = SoA.2360
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_chosen_perkunas
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_chosen_perkunas_check
		}
	}
	option = { # Sons of Kaleva
		trigger = {
			has_character_flag = expel_sons_kaleva_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_sons_kaleva = {
				holder_scope = {
					character_event = {
						id = SoA.2460
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_sons_kaleva
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_sons_kaleva_check
		}
	}
	option = { # Huitzilopochtli
		trigger = {
			has_character_flag = expel_huitzilopochtli_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_huitzilopochtli = {
				holder_scope = {
					character_event = {
						id = SoA.2560
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_huitzilopochtli
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_huitzilopochtli_check
		}
	}
	option = { # Knights of Santiago
		trigger = {
			has_character_flag = expel_knights_santiago_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_knights_santiago = {
				holder_scope = {
					character_event = {
						id = SoA.2660
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_knights_santiago
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_knights_santiago_check
		}
	}
	option = { # Knights of Calatrava
		trigger = {
			has_character_flag = expel_knights_calatrava_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_knights_calatrava = {
				holder_scope = {
					character_event = {
						id = SoA.2760
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_knights_calatrava
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_knights_calatrava_check
		}
	}
	option = { # Order of St Addai
		trigger = {
			has_character_flag = expel_order_of_addai_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_saint_addai = {
				holder_scope = {
					character_event = {
						id = SoA.2860
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_saint_addai
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_order_of_addai_check
		}
	}
	option = { # Zun Warriors
		trigger = {
			has_character_flag = expel_zun_warriors_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_a
		}
		hidden_tooltip = {
			d_zun_warriors = {
				holder_scope = {
					character_event = {
						id = CM.4012
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_zun_warriors
				duration = -1
				inherit = yes
			}
			clr_character_flag = expel_zun_warriors_check
		}
	}
	#CK2+ Holy Orders
	option = { # Army of Light
		trigger = {
			has_character_flag = expel_army_of_light_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		hidden_tooltip = {
			d_army_light = {
				holder_scope = {
					character_event = {
						id = GoPagan.232
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_army_light
				duration = -1
				inherit = yes
			}
		}
	}
	option = { # Ansar
		trigger = {
			has_character_flag = expel_the_ansar_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		hidden_tooltip = {
			d_ansar = {
				holder_scope = {
					character_event = {
						id = SoA.1460
					}
				}
			}
			
			add_character_modifier = {
				name = expelled_d_ansar
				duration = -1
				inherit = yes
			}
		}
	}
	option = { # Army of Lucifer
		trigger = {
			has_character_flag = expel_army_of_lucifer_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		hidden_tooltip = {
			d_army_lucifer = {
				holder_scope = {
					character_event = {
						id = Plus.2060
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_army_lucifer
				duration = -1
				inherit = yes
			}
		}
	}
	option = { # Braedralag
		trigger = {
			has_character_flag = expel_the_braedralag_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000			
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}			
		hidden_tooltip = {
			d_braedralag = {
				holder_scope = {
					character_event = {
						id = SoA.1560
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_braedralag
				duration = -1
				inherit = yes
			}
		}
	}
	option = { # Fianna
		trigger = {
			has_character_flag = expel_fianna_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		hidden_tooltip = {
			d_fianna = {
				holder_scope = {
					character_event = {
						id = Plus.2060
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_fianna
				duration = -1
				inherit = yes
			}
		}
	}
	option = { # Sons of Gwydion
		trigger = {
			has_character_flag = expel_gwydion_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		hidden_tooltip = {
			d_gwydion = {
				holder_scope = {
					character_event = {
						id = Plus.2060
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_gwydion
				duration = -1
				inherit = yes
			}
		}
	}
	option = { # Knights of Saint Mark
		trigger = {
			has_character_flag = expel_knights_of_saint_mark_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		hidden_tooltip = {
			d_knights_saint_mark = {
				holder_scope = {
					character_event = {
						id = Plus.2060
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_knights_saint_mark
				duration = -1
				inherit = yes
			}
		}
	}
	option = { # Order of Saint Blaise
		trigger = {
			has_character_flag = expel_order_of_saint_blaise_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		hidden_tooltip = {
			d_saint_blaise = {
				holder_scope = {
					character_event = {
						id = Plus.2060
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_saint_blaise
				duration = -1
				inherit = yes
			}
		}
	}
	option = { # Red Dragon Knights
		trigger = {
			has_character_flag = expel_red_dragons_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000		
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}
		hidden_tooltip = {
			d_red_dragons = {
				holder_scope = {
					character_event = {
						id = Plus.2060
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_red_dragons
				duration = -1
				inherit = yes
			}
		}
	}
	option = { # Harii
		trigger = {
			has_character_flag = expel_the_harii_check
		}
		name = "EVTOPTA_SOA_2990"
		piety = -1000			
		religion_authority = {
			modifier = holy_order_expelled
			years = 20
		}			
		hidden_tooltip = {
			d_harii = {
				holder_scope = {
					character_event = {
						id = SoA.1560
					}
				}
			}
			add_character_modifier = {
				name = expelled_d_harii
				duration = -1
				inherit = yes
			}
		}
	}	
	option = { # Allow them to stay
		name = "EVTOPTB_SOA_2990"
		custom_tooltip = {
			text = expelling_holy_order_event_tooltip_b
		}
		hidden_tooltip = {
			clr_character_flag = expel_the_knights_templar_check
			clr_character_flag = expel_the_knights_hospitaler_check
			clr_character_flag = expel_the_teutonic_order_check
			clr_character_flag = expel_the_jomsvikings_check
			clr_character_flag = expel_the_assassins_check
			clr_character_flag = expel_the_bektashi_check
			clr_character_flag = expel_the_haruriyyah_check
			clr_character_flag = expel_the_holy_sepulchre_check
			clr_character_flag = expel_saint_anthony_check
			clr_character_flag = expel_immortals_check
			clr_character_flag = expel_zealots_check
			clr_character_flag = expel_sky_lords_check
			clr_character_flag = expel_spirit_guardians_check
			clr_character_flag = expel_warriors_perun_check
			clr_character_flag = expel_chosen_perkunas_check
			clr_character_flag = expel_sons_kaleva_check
			clr_character_flag = expel_huitzilopochtli_check
			clr_character_flag = expel_knights_santiago_check
			clr_character_flag = expel_knights_calatrava_check
			clr_character_flag = expel_order_of_addai_check
			clr_character_flag = expel_army_of_light_check
			clr_character_flag = expel_army_of_lucifer_check
			clr_character_flag = expel_the_ansar_check
			clr_character_flag = expel_the_braedralag_check
			clr_character_flag = expel_fianna_check
			clr_character_flag = expel_gwydion_check
			clr_character_flag = expel_red_dragons_check
			clr_character_flag = expel_knights_of_saint_mark_check
			clr_character_flag = expel_order_of_saint_blaise_check
			clr_character_flag = expel_the_harii_check
			clr_character_flag = expel_zun_warriors_check
		}
	}
}