namespace = Plus

#reserved: Plus.2200 to Plus.2299

################################################
# SCHISM EVENTS
# Originally written by Hansol "LumberKing" Lee
# Adapted/Revised by Rylock
################################################

### Papacy of Rome

# Rome Re-Established
character_event = { 
	id = Plus.2200

	hide_window = yes
	is_triggered_only = yes

	only_rulers = yes
	religion_group = christian
	
	trigger = {
		has_landed_title = b_roma
		is_theocracy = yes
		NOT = { has_landed_title = d_pentarch_rome }
		OR = {
			religion = chalcedonian
			religion = orthodox
			religion = monothelite
			religion = iconoclast
			religion = miaphysite
			religion = monophysite
			religion = nestorian
			religion = messalian
			religion = apostolic
			religion = paulician
		}
		OR = {
			independent = yes
			top_liege = {
				higher_real_tier_than = DUKE
				religion = ROOT
			}
		}
	}
	
	immediate = {
		any_liege = {
			limit = { tier = EMPEROR }
			save_event_target_as = new_liege
		}
		any_liege = {
			limit = { tier = KING }
			save_event_target_as = new_liege
		}
		d_pentarch_rome = {
			holder_scope = { save_event_target_as = old_holder }
			grant_title_no_opinion = ROOT
			remove_claim = event_target:old_holder
		}
		b_roma = { ROOT = { capital = PREV } }
		if = {
			limit = { event_target:new_liege = { is_alive = yes } }
			set_defacto_liege = event_target:new_liege
			pf_liege_change_effect = yes
		}
		
		#for Chalcedonian Popes
		if = {
			limit = {
				has_global_flag = chalcedonians_joined
			}
			k_papal_chalcedon = {
				copy_title_history = k_papal_state
			}
			clr_global_flag = chalcedonians_joined
		}
		if = {
			limit = { religion = chalcedonian }
			character_event = { id = Plus.2275 }
		}
		if = {
			limit = {
				has_landed_title = k_papal_chalcedon
			}
			d_miaphysite = { owner = { character_event = { id = Plus.2297 days = 3} } }
		}
		if = {
			limit = {
				religion = chalcedonian
				k_papal_chalcedon = { has_holder = no }
				NOT = { has_global_flag = patriarch_supreme_created }
			}
			any_liege = {
				limit = { tier = EMPEROR }
				save_event_target_as = new_liege
			}
			k_papal_chalcedon = { grant_title_no_opinion = ROOT }
			if = {
				limit = { event_target:new_liege = { is_alive = yes } }
				set_defacto_liege = event_target:new_liege
				pf_liege_change_effect = yes
			}
		}
		any_character = {
			limit = { has_character_flag = pope_is_my_liege }
			set_defacto_liege = ROOT
			clr_character_flag = pope_is_my_liege
		}
	}
}

# Rome De-Established
character_event = {
	id = Plus.2201

	hide_window = yes
	is_triggered_only = yes
	
	only_rulers = yes

	trigger = {
		has_landed_title = d_pentarch_rome
		OR = {
			NOT = { has_landed_title = b_roma }
			is_theocracy = no
			NOR = {
				religion = chalcedonian
				religion = orthodox
				religion = monothelite
				religion = iconoclast
				religion = miaphysite
				religion = monophysite
				religion = nestorian
				religion = messalian
				religion = apostolic
				religion = paulician
			}
		}
	}
	
	immediate = {
		d_pentarch_rome = { unsafe_destroy_landed_title = THIS }
	}
}

### Patriarchate of Constantinople

# Constantinople Re-Established
character_event = { 
	id = Plus.2202

	is_triggered_only = yes
	hide_window = yes
	
	only_rulers = yes
	religion_group = christian
	
	trigger = {
		has_landed_title = b_hagiasophia
		is_theocracy = yes
		NOT = { has_landed_title = d_pentarch_constantinople }
		OR = {
			religion = chalcedonian
			religion = orthodox
			religion = monothelite
			religion = iconoclast
		}
		OR = {
			independent = yes
			top_liege = {
				higher_real_tier_than = DUKE
				religion = ROOT
			}
		}
	}
	
	immediate = {
		any_liege = {
			limit = { tier = EMPEROR }
			save_event_target_as = new_liege
		}
		any_liege = {
			limit = { tier = KING }
			save_event_target_as = new_liege
		}
		d_pentarch_constantinople = {
			holder_scope = { save_event_target_as = old_holder }
			grant_title_no_opinion = ROOT
			remove_claim = event_target:old_holder
		}
		if = {
			limit = { event_target:new_liege = { is_alive = yes } }
			set_defacto_liege = event_target:new_liege
			pf_liege_change_effect = yes
		}
		
		#for Chalcedonian Patriarchs
		if = {
			limit = { religion = chalcedonian }
			character_event = { id = Plus.2275 }
		}
		
		#for Orthodox emperors
		if = {
			limit = {
				religion = orthodox
				is_title_active = k_orthodox
				any_liege = { tier = EMPEROR }
			}
			any_liege = {
				limit = { tier = EMPEROR }
				save_event_target_as = new_liege
			}
			k_orthodox = { usurp_title = ROOT }
			if = {
				limit = { event_target:new_liege = { is_alive = yes } }
				set_defacto_liege = event_target:new_liege
				pf_liege_change_effect = yes
			}
		}
	}
}

# Constantinople De-Established
character_event = {
	id = Plus.2203

	is_triggered_only = yes
	hide_window = yes
	only_rulers = yes

	trigger = {
		has_landed_title = d_pentarch_constantinople
		OR = {
			NOT = { has_landed_title = b_hagiasophia }
			is_theocracy = no
			NOR = {
				religion = chalcedonian
				religion = orthodox
				religion = monothelite
				religion = iconoclast
			}
		}
	}
	
	immediate = {
		d_pentarch_constantinople = { unsafe_destroy_landed_title = THIS }
	}
}

# Constantinople Reformed
character_event = {
	id = Plus.2204

	hide_window = yes
	is_triggered_only = yes
	
	only_rulers = yes
	religion_group = christian
	
	trigger = {
		OR = {
			has_landed_title = k_orthodox
			has_landed_title = d_iconoclast
		}
		NOT = { has_landed_title = b_hagiasophia }
		b_hagiasophia = {
			has_holder = yes
			holder_scope = {
				religion = ROOT
				ai = yes
				NOT = { character = ROOT }
				NOT = { any_liege = { ai = no } }
			}
		}
	}
	
	immediate = {
		b_hagiasophia = {
			holder_scope = {
				save_event_target_as = old_holder
				any_liege = {
					limit = { tier = EMPEROR }
					save_event_target_as = new_liege
				}
				any_liege = {
					limit = {
						tier = KING
						higher_tier_than = ROOT
					}
					save_event_target_as = new_liege
				}
			}
			grant_title = ROOT
			ROOT = { capital = PREV }
			remove_claim = event_target:old_holder
		}
		if = {
			limit = { event_target:new_liege = { is_alive = yes } }
			set_defacto_liege = event_target:new_liege
			pf_liege_change_effect = yes
		}
	}
}

### Papacy of Alexandria

# Alexandria Re-Established
character_event = { 
	id = Plus.2205

	hide_window = yes
	is_triggered_only = yes

	only_rulers = yes
	religion_group = christian
	
	trigger = {
		has_landed_title = b_alexandria
		is_theocracy = yes
		NOT = { has_landed_title = d_pentarch_alexandria }
		OR = {
			religion = chalcedonian
			religion = orthodox
			religion = monothelite
			religion = iconoclast
			religion = miaphysite
			religion = monophysite
			religion = nestorian
			religion = messalian
			religion = apostolic
			religion = paulician
		}
		OR = {
			independent = yes
			top_liege = {
				higher_real_tier_than = DUKE
				religion = ROOT
			}
		}
	}
	
	immediate = {
		any_liege = {
			limit = { tier = EMPEROR }
			save_event_target_as = new_liege
		}
		any_liege = {
			limit = { tier = KING }
			save_event_target_as = new_liege
		}
		d_pentarch_alexandria = {
			holder_scope = { save_event_target_as = old_holder }
			grant_title_no_opinion = ROOT
			remove_claim = event_target:old_holder
		}
		if = {
			limit = { event_target:new_liege = { is_alive = yes } }
			set_defacto_liege = event_target:new_liege
			pf_liege_change_effect = yes
		}
		
		#for Chalcedonian Popes
		if = {
			limit = { religion = chalcedonian }
			character_event = { id = Plus.2275 }
		}
	}
}

# Alexandria De-Established
character_event = {
	id = Plus.2206

	hide_window = yes
	is_triggered_only = yes

	only_rulers = yes

	trigger = {
		has_landed_title = d_pentarch_alexandria
		OR = {
			NOT = { has_landed_title = b_alexandria }
			is_theocracy = no
			NOR = {
				religion = chalcedonian
				religion = orthodox
				religion = monothelite
				religion = iconoclast
				religion = miaphysite
				religion = monophysite
				religion = nestorian
				religion = messalian
				religion = apostolic
				religion = paulician
			}
		}
	}
	
	immediate = {
		d_pentarch_alexandria = { unsafe_destroy_landed_title = THIS }
	}
}

# Alexandria Reformed
character_event = {
	id = Plus.2207

	hide_window = yes
	is_triggered_only = yes
	
	only_rulers = yes
	religion_group = christian
	
	trigger = {
		OR = {
			has_landed_title = d_miaphysite
			has_landed_title = d_monophysite
		}
		NOT = { has_landed_title = b_alexandria }
		b_alexandria = {
			has_holder = yes
			holder_scope = {
				religion = ROOT
				ai = yes
				NOT = { character = ROOT }
				NOT = { any_liege = { ai = no } }
			}
		}
	}
	
	immediate = {
		b_alexandria = {
			holder_scope = {
				save_event_target_as = old_holder
				any_liege = {
					limit = { tier = EMPEROR }
					save_event_target_as = new_liege
				}
				any_liege = {
					limit = { tier = KING }
					save_event_target_as = new_liege
				}
			}
			grant_title = ROOT
			ROOT = { capital = PREV }
			remove_claim = event_target:old_holder
		}
		if = {
			limit = { event_target:new_liege = { is_alive = yes } }
			set_defacto_liege = event_target:new_liege
			pf_liege_change_effect = yes
		}
	}
}

### Patriarchate of Antioch

# Antioch Re-Established
character_event = { 
	id = Plus.2208

	hide_window = yes
	is_triggered_only = yes
	
	only_rulers = yes
	religion_group = christian
	
	trigger = {
		has_landed_title = b_antiocheia
		is_theocracy = yes
		NOT = { has_landed_title = d_pentarch_antioch }
		OR = {
			religion = chalcedonian
			religion = orthodox
			religion = monothelite
			religion = iconoclast
			religion = miaphysite
			religion = monophysite
			religion = nestorian
			religion = messalian
			religion = apostolic
			religion = paulician
		}
		OR = {
			independent = yes
			top_liege = {
				higher_real_tier_than = DUKE
				religion = ROOT
			}
		}
	}
	
	immediate = {
		any_liege = {
			limit = { tier = EMPEROR }
			save_event_target_as = new_liege
		}
		any_liege = {
			limit = { tier = KING }
			save_event_target_as = new_liege
		}
		d_pentarch_antioch = {
			holder_scope = { save_event_target_as = old_holder }
			grant_title_no_opinion = ROOT
			remove_claim = event_target:old_holder
		}
		if = {
			limit = { event_target:new_liege = { is_alive = yes } }
			set_defacto_liege = event_target:new_liege
			pf_liege_change_effect = yes
		}
		
		#for Chalcedonian Patriarchs
		if = {
			limit = { religion = chalcedonian }
			character_event = { id = Plus.2275 }
		}
	}
}

# Antioch De-Established
character_event = {
	id = Plus.2209

	hide_window = yes
	is_triggered_only = yes

	only_rulers = yes

	trigger = {
		has_landed_title = d_pentarch_antioch
		OR = {
			NOT = { has_landed_title = b_antiocheia }
			is_theocracy = no
			NOR = {
				religion = chalcedonian
				religion = orthodox
				religion = monothelite
				religion = iconoclast
				religion = miaphysite
				religion = monophysite
				religion = nestorian
				religion = messalian
				religion = apostolic
				religion = paulician
			}
		}
	}

	immediate = {
		d_pentarch_antioch = { unsafe_destroy_landed_title = THIS }
	}
}

# Antioch Reformed
character_event = {
	id = Plus.2210

	hide_window = yes
	is_triggered_only = yes
	
	only_rulers = yes
	religion_group = christian

	trigger = {
		OR = {
			has_landed_title = d_monothelite
			has_landed_title = d_apostolic
			has_landed_title = d_paulician
			has_landed_title = d_nestorian
			has_landed_title = d_messalian
		}
		is_theocracy = yes
		NOT = { has_landed_title = b_antiocheia }
		b_antiocheia = {
			has_holder = yes
			holder_scope = {
				religion = ROOT
				ai = yes
				NOT = { character = ROOT }
				NOT = { any_liege = { ai = no } }
			}
		}
	}
	
	immediate = {
		b_antiocheia = {
			holder_scope = {
				save_event_target_as = old_holder
				any_liege = {
					limit = { tier = EMPEROR }
					save_event_target_as = new_liege
				}
				any_liege = {
					limit = { tier = KING }
					save_event_target_as = new_liege
				}
			}
			grant_title = ROOT
			ROOT = { capital = PREV }
			remove_claim = event_target:old_holder
		}
		if = {
			limit = { event_target:new_liege = { is_alive = yes } }
			set_defacto_liege = event_target:new_liege
			pf_liege_change_effect = yes
		}
	}
}

### Patriarchate of Jerusalem

# Jerusalem Re-Established
character_event = { 
	id = Plus.2211

	hide_window = yes
	is_triggered_only = yes
	
	only_rulers = yes
	religion_group = christian

	trigger = {
		has_landed_title = b_jerusalem
		is_theocracy = yes
		NOT = { has_landed_title = d_pentarch_jerusalem }
		OR = {
			religion = chalcedonian
			religion = orthodox
			religion = monothelite
			religion = iconoclast
		}
		OR = {
			independent = yes
			top_liege = {
				higher_real_tier_than = DUKE
				religion = ROOT
			}
		}
	}
	
	immediate = {
		any_liege = {
			limit = { tier = EMPEROR }
			save_event_target_as = new_liege
		}
		any_liege = {
			limit = { tier = KING }
			save_event_target_as = new_liege
		}
		d_pentarch_jerusalem = {
			holder_scope = { save_event_target_as = old_holder }
			grant_title_no_opinion = ROOT
			remove_claim = event_target:old_holder
		}
		if = {
			limit = { event_target:new_liege = { is_alive = yes } }
			set_defacto_liege = event_target:new_liege
			pf_liege_change_effect = yes
		}
		
		#for Chalcedonian Patriarchs
		if = {
			limit = { religion = chalcedonian }
			character_event = { id = Plus.2275 }
		}
	}
}

# Jerusalem De-Established
character_event = {
	id = Plus.2212

	hide_window = yes
	is_triggered_only = yes
	only_rulers = yes

	trigger = {
		has_landed_title = d_pentarch_jerusalem
		OR = {
			NOT = { has_landed_title = b_jerusalem }
			is_theocracy = no
			NOR = {
				religion = chalcedonian
				religion = orthodox
				religion = monothelite
				religion = iconoclast
			}
		}
	}
	
	immediate = {
		d_pentarch_jerusalem = { unsafe_destroy_landed_title = THIS }
	}
}

# Establishing Liege for the Pentarchs
character_event = {
	id = Plus.2213

	hide_window = yes
	is_triggered_only = yes

	only_independent = yes
	only_rulers = yes
	religion_group = christian

	trigger = {
		lower_tier_than = KING
		OR = {
			has_landed_title = d_pentarch_rome
			has_landed_title = d_pentarch_constantinople
			has_landed_title = d_pentarch_alexandria
			has_landed_title = d_pentarch_antioch
			has_landed_title = d_pentarch_jerusalem	
			has_landed_title = d_latin_constantinople
			has_landed_title = d_latin_alexandria
			has_landed_title = d_latin_antioch
			has_landed_title = d_latin_jerusalem				
		}
		NOT = { trait = pf_rebel }
		capital_holding = {
			dejure_liege_title = {
				holder_scope = {
					OR = {
						AND = {
							religion = ROOT
							higher_tier_than = ROOT
						}
						any_liege = {
							religion = ROOT
							higher_tier_than = ROOT
						}
					}
				}
			}
		}
	}
	
	immediate = {
		capital_holding = {
			dejure_liege_title = {
				holder_scope = {
					if = {
						limit = {
							religion = ROOT
							higher_tier_than = ROOT
						}
						set_defacto_vassal = ROOT
						ROOT = { pf_liege_change_effect = yes }
						break = yes
					}
					liege = {
						if = {
							limit = {
								religion = ROOT
								higher_tier_than = ROOT
							}
							set_defacto_vassal = ROOT
							ROOT = { pf_liege_change_effect = yes }
							break = yes
						}
						liege = {
							if = {
								limit = {
									religion = ROOT
									higher_tier_than = ROOT
								}
								set_defacto_vassal = ROOT
								ROOT = { pf_liege_change_effect = yes }
								break = yes
							}
							liege = {
								if = {
									limit = {
										religion = ROOT
										higher_tier_than = ROOT
									}
									set_defacto_vassal = ROOT
									ROOT = { pf_liege_change_effect = yes }
									break = yes
								}
							}
						}
					}
				}
			}
		}
	}
}

### Latin Patriarchate of Constantinople

# Constantinople Re-Established
character_event = { 
	id = Plus.2214

	hide_window = yes
	is_triggered_only = yes

	only_rulers = yes
	religion_group = christian

	trigger = {
		has_landed_title = b_hagiasophia
		is_theocracy = yes
		NOT = { has_landed_title = d_latin_constantinople }
		OR = {
			religion = catholic
			religion = fraticelli
			religion = adoptionist
		}
		OR = {
			independent = yes
			any_liege = { higher_real_tier_than = DUKE }
		}
	}
	
	immediate = {
		any_liege = {
			limit = { tier = EMPEROR }
			save_event_target_as = new_liege
		}
		any_liege = {
			limit = { tier = KING }
			save_event_target_as = new_liege
		}
		d_latin_constantinople = {
			holder_scope = { save_event_target_as = old_holder }
			grant_title_no_opinion = ROOT
			remove_claim = event_target:old_holder
		}
		if = {
			limit = { event_target:new_liege = { is_alive = yes } }
			set_defacto_liege = event_target:new_liege
			pf_liege_change_effect = yes
		}
	}
}

# Constantinople De-Established
character_event = {
	id = Plus.2215

	hide_window = yes
	is_triggered_only = yes
	
	only_rulers = yes

	trigger = {
		has_landed_title = d_latin_constantinople
		OR = {
			NOT = { has_landed_title = b_hagiasophia }
			is_theocracy = no
			NOR = {
				religion = catholic
				religion = fraticelli
				religion = adoptionist
			}
		}
	}
	
	immediate = {
		d_latin_constantinople = { unsafe_destroy_landed_title = THIS }
	}
}

### Latin Patriachate of Alexandria

# Alexandria Re-Established
character_event = { 
	id = Plus.2216

	hide_window = yes
	is_triggered_only = yes
	
	only_rulers = yes
	religion_group = christian

	trigger = {
		has_landed_title = b_alexandria
		is_theocracy = yes
		NOT = { has_landed_title = d_latin_alexandria }
		OR = {
			religion = catholic
			religion = fraticelli
			religion = adoptionist
		}
		OR = {
			independent = yes
			top_liege = {
				higher_real_tier_than = DUKE
				religion = ROOT
			}
		}
	}
	
	immediate = {
		any_liege = {
			limit = { tier = EMPEROR }
			save_event_target_as = new_liege
		}
		any_liege = {
			limit = { tier = KING }
			save_event_target_as = new_liege
		}
		d_latin_alexandria = {
			holder_scope = { save_event_target_as = old_holder }
			grant_title_no_opinion = ROOT
			remove_claim = event_target:old_holder
		}
		if = {
			limit = { event_target:new_liege = { is_alive = yes } }
			set_defacto_liege = event_target:new_liege
			pf_liege_change_effect = yes
		}
	}
}

# Alexandria De-Established
character_event = {
	id = Plus.2217

	hide_window = yes
	is_triggered_only = yes
	only_rulers = yes

	trigger = {
		has_landed_title = d_latin_alexandria
		OR = {
			NOT = { has_landed_title = b_alexandria }
			is_theocracy = no
			NOR = {
				religion = catholic
				religion = fraticelli
				religion = adoptionist
			}
		}
	}
	
	immediate = {
		d_latin_alexandria = { unsafe_destroy_landed_title = THIS }
	}
}

### Latin Patriarchate of Antioch

# Antioch Re-Established
character_event = { 
	id = Plus.2218

	hide_window = yes
	is_triggered_only = yes
	
	only_rulers = yes
	religion_group = christian

	trigger = {
		has_landed_title = b_antiocheia
		is_theocracy = yes
		NOT = { has_landed_title = d_latin_antioch }
		OR = {
			religion = catholic
			religion = fraticelli
			religion = adoptionist
		}
		OR = {
			independent = yes
			top_liege = {
				higher_real_tier_than = DUKE
				religion = ROOT
			}
		}
	}

	immediate = {
		any_liege = {
			limit = { tier = EMPEROR }
			save_event_target_as = new_liege
		}
		any_liege = {
			limit = { tier = KING }
			save_event_target_as = new_liege
		}
		d_latin_antioch = {
			holder_scope = { save_event_target_as = old_holder }
			grant_title_no_opinion = ROOT
			remove_claim = event_target:old_holder
		}
		if = {
			limit = { event_target:new_liege = { is_alive = yes } }
			set_defacto_liege = event_target:new_liege
			pf_liege_change_effect = yes
		}
	}
}

# Antioch De-Established
character_event = {
	id = Plus.2219

	hide_window = yes
	is_triggered_only = yes
	only_rulers = yes

	trigger = {
		has_landed_title = d_latin_antioch
		OR = {
			NOT = { has_landed_title = b_antiocheia }
			is_theocracy = no
			NOR = {
				religion = catholic
				religion = fraticelli
				religion = adoptionist
			}
		}
	}

	immediate = {
		d_latin_antioch = { unsafe_destroy_landed_title = THIS }
	}
}

### Latin Patriarchate of Jerusalem

# Jerusalem Re-Established
character_event = { 
	id = Plus.2220

	hide_window = yes
	is_triggered_only = yes
	
	only_rulers = yes
	religion_group = christian

	trigger = {
		has_landed_title = b_jerusalem
		is_theocracy = yes
		NOT = { has_landed_title = d_latin_jerusalem }
		OR = {
			religion = catholic
			religion = fraticelli
			religion = adoptionist
		}
		OR = {
			independent = yes
			top_liege = {
				higher_real_tier_than = DUKE
				religion = ROOT
			}
		}
	}

	immediate = {
		any_liege = {
			limit = { tier = EMPEROR }
			save_event_target_as = new_liege
		}
		any_liege = {
			limit = { tier = KING }
			save_event_target_as = new_liege
		}
		d_latin_jerusalem = {
			holder_scope = { save_event_target_as = old_holder }
			grant_title_no_opinion = ROOT
			remove_claim = event_target:old_holder
		}
		if = {
			limit = { event_target:new_liege = { is_alive = yes } }
			set_defacto_liege = event_target:new_liege
			pf_liege_change_effect = yes
		}
	}
}

# Jerusalem De-Established
character_event = {
	id = Plus.2221

	hide_window = yes
	is_triggered_only = yes
	only_rulers = yes

	trigger = {
		has_landed_title = d_latin_jerusalem
		OR = {
			NOT = { has_landed_title = b_jerusalem }
			is_theocracy = no
			NOR = {
				religion = catholic
				religion = fraticelli
				religion = adoptionist
			}
		}
	}

	immediate = {
		d_latin_jerusalem = { unsafe_destroy_landed_title = THIS }
	}
}

# Restore Rome to the Pope
character_event = {
	id = Plus.2222

	hide_window = yes
	
	only_rulers = yes
	religion_group = christian

	trigger = {
		OR = {
			AND = {
				has_landed_title = k_chalcedonian
				trait = latin_rites
				has_global_flag = patriarch_supreme_is_latin
			}
			has_landed_title = k_papal_chalcedon
			has_landed_title = k_papal_state
			has_landed_title = d_fraticelli
		}
		is_theocracy = yes
		NOT = { has_landed_title = b_roma }
		b_roma = {
			has_holder = yes
			holder_scope = {
				religion = ROOT
				ai = yes
				NOT = { any_liege = { ai = no } }
				NOT = { character = ROOT }
			}
		}
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	immediate = {
		b_roma = {
			holder_scope = {
				save_event_target_as = old_holder
				any_liege = {
					limit = {
						tier = EMPEROR
						ROOT = {
							liege = {
								NOT = { tier = EMPEROR }
							}
						}
					}
					save_event_target_as = new_liege
				}
			}
			grant_title = ROOT
			ROOT = { capital = PREV }
			remove_claim = event_target:old_holder
		}
		if = {
			limit = { 
				NOT = { has_landed_title = d_pentarch_rome }
				religion = chalcedonian
			}
			d_pentarch_rome = { grant_title_no_opinion = ROOT }
		}
		if = {
			limit = { event_target:new_liege = { is_alive = yes } }
			set_defacto_liege = event_target:new_liege
			pf_liege_change_effect = yes
		}
	}
}

### MENDING THE GREAT SCHISM

# Ecumenical Council Called
narrative_event = {
	id = Plus.2230
	title = EVTNAME_Plus_2230
	desc = EVTDESC_Plus_2230
	picture = GFX_evt_great_schism
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		save_event_target_as = council_holder
		capital_holding = { location = { save_event_target_as = council_location } }
		if = {
			limit = {
				OR = {
					religion = catholic
					religion = fraticelli
					religion = cathar
				}
			}
			any_title = {
				limit = {
					OR = {
						title = k_orthodox
						title = d_monothelite
						title = d_iconoclast
						title = d_bogomilist
					}
					has_holder = yes
					holder_scope = { is_heretic = no }
				}
				holder_scope = {
					save_event_target_as = target_religion
				}
			}
		}
		if = {
			limit = {
				OR = {
					religion = orthodox
					religion = monothelite
					religion = iconoclast
					religion = bogomilist
				}
			}
			any_title = {
				limit = {
					OR = {
						title = k_papal_state
						title = d_fraticelli
						title = d_cathar
					}
					has_holder = yes
					holder_scope = { is_heretic = no }
				}
				holder_scope = {
					save_event_target_as = target_religion
				}
			}
		}
		if = {
			limit = { controls_religion = no }
			religion_head = { save_event_target_as = mender_religion }
		}
		if = {
			limit = { controls_religion = yes }
			save_event_target_as = mender_religion
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2230
		set_global_flag = schism_mending
		add_character_modifier = {
			modifier = do_not_disturb
			hidden = yes
			duration = 30
		}
		hidden_tooltip = {
			any_demesne_title = {
				limit = {
					tier = COUNT
					location = { mend_schism_religion_trigger = yes }
				}
				location = { set_province_flag = change_religion }
			}
			any_courtier = {
				limit = {
					mend_schism_religion_trigger = yes
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = ROOT
			}
			any_vassal = {
				limit = {
					mend_schism_religion_trigger = yes
					NOT = { trait = zealous }
					is_playable = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = ROOT
				any_courtier = {
					limit = {
						mend_schism_religion_trigger = yes
						NOT = { trait = zealous }
						is_ruler = no
						controls_religion = no
						mercenary = no
						holy_order = no
						can_change_religion = yes
					}
					religion = ROOT
				}
			}
			any_vassal = {
				limit = { is_playable = yes }
				narrative_event = { id = Plus.2231 days = 1 random = 4 } #choose whether to convert
			}
			any_title = {
				limit = {
					has_holder = yes
					holder_scope = {
						top_liege = { character = PREV }
						NOT = { character = ROOT }
						is_playable = yes
					}
				}
				holder_scope = {
					narrative_event = { id = Plus.2231 days = 1 random = 4 } #choose whether to convert
				}
			}
			event_target:council_location = {
				province_event = { id = Plus.2232 days = 30 } #council is over
			}
		}
	}
}

# Rulers informed about the Ecumenical Council - Convert or Not?
narrative_event = {
	id = Plus.2231
	title = EVTNAME_Plus_2230
	desc = EVTDESC_Plus_2230
	picture = GFX_evt_great_schism
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	hide_from = yes
	
	immediate = {
		any_vassal = {
			limit = { is_playable = yes }
			narrative_event = { id = Plus.2231 days = 1 random = 4 } #choose whether to convert
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2231 # Convert
		trigger = {
			controls_religion = no
			mercenary = no
			holy_order = no
			can_change_religion = yes
			mend_schism_religion_trigger = yes
		}
		ai_chance = {
			factor = 75
			modifier = {
				factor = 0
				OR = {
					trait = zealous
					has_character_modifier = voice_of_jesus
					has_character_modifier = voice_of_satan
				}
			}
			modifier = {
				factor = 1.5
				trait = humble
			}
			modifier = {
				factor = 1.5
				trait = craven
			}
			modifier = {
				factor = 1.5
				trait = content
			}
			modifier = {
				factor = 1.5
				independent = no
				liege = { religion = event_target:mender_religion }
			}
		}
		religion = event_target:mender_religion
		any_demesne_title = {
			limit = {
				tier = COUNT
				location = { mend_schism_religion_trigger = yes }
			}
			location = { set_province_flag = change_religion }
		}
		any_courtier = {
			limit = {
				mend_schism_religion_trigger = yes
				NOT = { trait = zealous }
				is_ruler = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
		}
		any_vassal = {
			limit = {
				mend_schism_religion_trigger = yes
				NOT = { trait = zealous }
				is_playable = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
			any_courtier = {
				limit = {
					mend_schism_religion_trigger = yes
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = event_target:mender_religion
			}
		}
	}
	option = {
		name = EVTOPTB_Plus_2231 # Don't Convert
		trigger = {
			controls_religion = no
			mercenary = no
			holy_order = no
			can_change_religion = yes
			mend_schism_religion_trigger = yes
		}
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0
				NOR = {
					trait = zealous
					trait = lunatic
					trait = proud
					trait = detached_priest
					trait = martial_cleric
					trait = scholarly_theologian
					trait = mastermind_theologian
					has_character_modifier = voice_of_jesus
					has_character_modifier = voice_of_satan
					capital_holding = { holding_type = temple }
					liege = { NOT = { religion = event_target:mender_religion } }
					real_tier = EMPEROR
				}
			}
			modifier = {
				factor = 0
				OR = {
					trait = cynical
					has_character_modifier = defied_church
				}
			}
			modifier = {
				factor = 3
				trait = lunatic
			}
			modifier = {
				factor = 1.5
				trait = proud
			}
			modifier = {
				factor = 1.5
				trait = brave
			}
			modifier = {
				factor = 1.5
				trait = detached_priest
			}
			modifier = {
				factor = 2
				trait = martial_cleric
			}
			modifier = {
				factor = 2.5
				trait = scholarly_theologian
			}
			modifier = {
				factor = 3
				trait = mastermind_theologian
			}
			modifier = {
				factor = 3
				independent = no
				liege = { NOT = { religion = event_target:mender_religion } }
			}
			modifier = {
				factor = 2
				independent = yes
				real_tier = KING
			}
			modifier = {
				factor = 3
				independent = yes
				real_tier = EMPEROR
			}
		}
		if = {
			limit = { NOT = { trait = zealous } }
			random = {
				chance = 25
				add_trait = zealous
			}
		}
	}
	option = {
		name = EVTOPTC_Plus_2231 # This is of great concern...
		trigger = {
			NAND = {
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
				mend_schism_religion_trigger = yes
			}
			NOT = { religion = event_target:mender_religion }
			religion_group = christian
		}
	}
	option = {
		name = {
			text = EVTOPTD_Plus_2231 # A wonderful day!
			trigger = { religion = event_target:mender_religion }
		}
		name = {
			text = EVTOPTE_Plus_2231 # Nothing to do with me
			trigger = {
				NAND = {
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
					mend_schism_religion_trigger = yes
				}
				NOT = { religion = event_target:mender_religion }
				NOT = { religion_group = christian }
			}
		}
		any_demesne_title = {
			limit = {
				tier = COUNT
				location = { mend_schism_religion_trigger = yes }
			}
			location = { set_province_flag = change_religion }
		}
		any_courtier = {
			limit = {
				mend_schism_religion_trigger = yes
				NOT = { trait = zealous }
				is_ruler = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
		}
		any_vassal = {
			limit = {
				mend_schism_religion_trigger = yes
				NOT = { trait = zealous }
				is_playable = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
			any_courtier = {
				limit = {
					mend_schism_religion_trigger = yes
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = event_target:mender_religion
			}
		}
	}
}

# Province bounce event
province_event = {
	id = Plus.2232
	
	is_triggered_only = yes
	hide_window = yes
	
	immediate = {
		owner = {
			narrative_event = { id = Plus.2233 }
		}
	}
}

# Ecumenical Council Over
narrative_event = {
	id = Plus.2233
	title = EVTNAME_Plus_2230
	desc = EVTDESC_Plus_2232
	picture = GFX_evt_great_schism
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	major = yes
	
	immediate = {
		clr_global_flag = schism_mending
		set_global_flag = schism_mended	
		event_target:mender_religion = {
			event_target:target_religion = {
				set_parent_religion = { religion = THIS parent = PREV }
			}
		}
		any_title = {
			limit = {
				has_holder = yes
				is_primary_holder_title = yes
				holder_scope = {
					top_liege = { character = PREV }
					is_landed = yes
				}
			}
			holder_scope = {
				any_realm_province = {
					limit = { has_province_flag = change_religion }
					clr_province_flag = change_religion
					religion = event_target:mender_religion
				}
			}
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2232
		trigger = { religion = event_target:mender_religion }
		if = {
			limit = { character = event_target:council_holder }
			prestige = 1000
			set_character_flag = schism_mender
			give_nickname = nick_the_saint
		}
	}
	option = {
		name = EVTOPTB_Plus_2232
		trigger = {
			NOT = { religion = event_target:mender_religion }
			religion_group = christian
		}
	}
	option = {
		name = EVTOPTC_Plus_2232
		trigger = {
			NOT = { religion = event_target:mender_religion }
			NOT = { religion_group = christian }
		}
	}
}

### ENFORCING THE COUNCIL OF EPHESUS

# Ecumenical Council Called
narrative_event = {
	id = Plus.2234
	title = EVTNAME_Plus_2230
	desc = EVTDESC_Plus_2234
	picture = GFX_evt_ecumenical_council
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		save_event_target_as = council_holder
		if = {
			limit = { controls_religion = no }
			random_realm_title = {
				limit = {
					tier = BARON
					holder_scope = { religion = ROOT }
					holding_type = temple
				}
				location = { save_event_target_as = council_location }
			}
		}
		if = {
			limit = { controls_religion = yes }
			capital_holding = { location = { save_event_target_as = council_location } }
		}
		if = {
			limit = { d_nestorian = { holder_scope = { is_heretic = no } } }
			d_nestorian = { holder_scope = { save_event_target_as = target_religion1 } }
		}
		if = {
			limit = { d_messalian = { holder_scope = { is_heretic = no } } }
			d_messalian = { holder_scope = { save_event_target_as = target_religion1 } }
		}
		if = {
			limit = { controls_religion = no }
			religion_head = { save_event_target_as = mender_religion }
		}
		if = {
			limit = { controls_religion = yes }
			save_event_target_as = mender_religion
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2230
		set_global_flag = enforcing_ephesus
		add_character_modifier = {
			modifier = do_not_disturb
			hidden = yes
			duration = 30
		}
		hidden_tooltip = {
			any_demesne_title = {
				limit = {
					tier = COUNT
					location = { 
						OR = {
							religion = nestorian
							religion = messalian
						}
						is_heretic = no
					}
				}
				location = { set_province_flag = change_religion }
			}
			any_courtier = {
				limit = {
					OR = {
						religion = nestorian
						religion = messalian
					}
					is_heretic = no
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = ROOT
			}
			any_vassal = {
				limit = {
					is_heretic = no
					OR = {
						religion = nestorian
						religion = messalian
					}
					NOT = { trait = zealous }
					is_playable = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = ROOT
				any_courtier = {
					limit = {
						is_heretic = no
						OR = {
							religion = nestorian
							religion = messalian
						}
						NOT = { trait = zealous }
						is_ruler = no
						controls_religion = no
						mercenary = no
						holy_order = no
						can_change_religion = yes
					}
					religion = ROOT
				}
			}
			any_vassal = {
				limit = { is_playable = yes }
				narrative_event = { id = Plus.2235 days = 1 random = 4 } #choose whether to convert
			}
			any_title = {
				limit = {
					has_holder = yes
					holder_scope = {
						top_liege = { character = PREV }
						NOT = { character = ROOT }
						is_playable = yes
					}
				}
				holder_scope = {
					narrative_event = { id = Plus.2235 days = 1 random = 4 } #choose whether to convert
				}
			}
			event_target:council_location = {
				province_event = { id = Plus.2236 days = 30 } #council is over
			}
		}
	}
}

# Rulers informed about the Ecumenical Council - Convert or Not?
narrative_event = {
	id = Plus.2235
	title = EVTNAME_Plus_2230
	desc = EVTDESC_Plus_2234
	picture = GFX_evt_ecumenical_council
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	hide_from = yes
	
	immediate = {
		any_vassal = {
			limit = { is_playable = yes }
			narrative_event = { id = Plus.2235 days = 1 random = 4 } #choose whether to convert
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2231 # Convert
		trigger = {
			controls_religion = no
			mercenary = no
			holy_order = no
			can_change_religion = yes
			OR = {
				religion = nestorian
				religion = messalian
			}
			is_heretic = no
		}
		ai_chance = {
			factor = 75
			modifier = {
				factor = 0
				OR = {
					trait = zealous
					has_character_modifier = voice_of_jesus
					has_character_modifier = voice_of_satan
				}
			}
			modifier = {
				factor = 1.5
				trait = humble
			}
			modifier = {
				factor = 1.5
				trait = craven
			}
			modifier = {
				factor = 1.5
				trait = content
			}
			modifier = {
				factor = 1.5
				independent = no
				liege = { religion = event_target:mender_religion }
			}
		}
		religion = event_target:mender_religion
		any_demesne_title = {
			limit = {
				tier = COUNT
				location = { 
					OR = {
						religion = nestorian
						religion = messalian
					}
					is_heretic = no
				}
			}
			location = { set_province_flag = change_religion }
		}
		any_courtier = {
			limit = {
				is_heretic = no
				OR = {
					religion = nestorian
					religion = messalian
				}
				NOT = { trait = zealous }
				is_ruler = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
		}
		any_vassal = {
			limit = {
				is_heretic = no
				OR = {
					religion = nestorian
					religion = messalian
				}
				NOT = { trait = zealous }
				is_playable = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
			any_courtier = {
				limit = {
					is_heretic = no
					OR = {
						religion = nestorian
						religion = messalian
					}
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = event_target:mender_religion
			}
		}
	}
	option = {
		name = EVTOPTB_Plus_2231 # Don't Convert
		trigger = {
			controls_religion = no
			mercenary = no
			holy_order = no
			can_change_religion = yes
			is_heretic = no
			OR = {
				religion = nestorian
				religion = messalian
			}
		}
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0
				NOR = {
					trait = zealous
					trait = lunatic
					trait = proud
					trait = detached_priest
					trait = martial_cleric
					trait = scholarly_theologian
					trait = mastermind_theologian
					has_character_modifier = voice_of_jesus
					has_character_modifier = voice_of_satan
					capital_holding = { holding_type = temple }
					liege = { NOT = { religion = event_target:mender_religion } }
					real_tier = EMPEROR
				}
			}
			modifier = {
				factor = 0
				OR = {
					trait = cynical
					has_character_modifier = defied_church
				}
			}
			modifier = {
				factor = 3
				trait = lunatic
			}
			modifier = {
				factor = 1.5
				trait = proud
			}
			modifier = {
				factor = 1.5
				trait = brave
			}
			modifier = {
				factor = 1.5
				trait = detached_priest
			}
			modifier = {
				factor = 2
				trait = martial_cleric
			}
			modifier = {
				factor = 2.5
				trait = scholarly_theologian
			}
			modifier = {
				factor = 3
				trait = mastermind_theologian
			}
			modifier = {
				factor = 3
				independent = no
				liege = { NOT = { religion = event_target:mender_religion } }
			}
			modifier = {
				factor = 2
				independent = yes
				real_tier = KING
			}
			modifier = {
				factor = 3
				independent = yes
				real_tier = EMPEROR
			}
		}
		if = {
			limit = { NOT = { trait = zealous } }
			random = {
				chance = 25
				add_trait = zealous
			}
		}
	}
	option = {
		name = EVTOPTC_Plus_2231 # This is of great concern...
		trigger = {
			NAND = {
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
				religion = nestorian
				religion = messalian
			}
			NOT = { religion = event_target:mender_religion }
			religion_group = christian
		}
	}
	option = {
		name = {
			text = EVTOPTD_Plus_2231 # A wonderful day!
			trigger = { religion = event_target:mender_religion }
		}
		name = {
			text = EVTOPTE_Plus_2231 # Nothing to do with me
			trigger = {
				NAND = {
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
					religion = nestorian
					religion = messalian
				}
				NOT = { religion = event_target:mender_religion }
				NOT = { religion_group = christian }
			}
		}
		any_demesne_title = {
			limit = {
				tier = COUNT
				location = { 
					is_heretic = no
					OR = {
						religion = nestorian
						religion = messalian
					}
				}
			}
			location = { set_province_flag = change_religion }
		}
		any_courtier = {
			limit = {
				is_heretic = no
				OR = {
					religion = nestorian
					religion = messalian
				}
				NOT = { trait = zealous }
				is_ruler = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
		}
		any_vassal = {
			limit = {
				is_heretic = no
				OR = {
					religion = nestorian
					religion = messalian
				}
				NOT = { trait = zealous }
				is_playable = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
			any_courtier = {
				limit = {
					is_heretic = no
					OR = {
						religion = nestorian
						religion = messalian
					}
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = event_target:mender_religion
			}
		}
	}
}

# Province bounce event
province_event = {
	id = Plus.2236
	
	is_triggered_only = yes
	hide_window = yes
	
	immediate = {
		owner = {
			narrative_event = { id = Plus.2237 }
		}
	}
}

# Ecumenical Council Over
narrative_event = {
	id = Plus.2237
	title = EVTNAME_Plus_2230
	desc = EVTDESC_Plus_2237
	picture = GFX_evt_ecumenical_council
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	major = yes
	
	immediate = {
		clr_global_flag = enforcing_ephesus
		set_global_flag = ephesus_enforced	
		event_target:mender_religion = {
			event_target:target_religion1 = {
				set_parent_religion = { religion = THIS parent = PREV }
			}
		}
		any_title = {
			limit = {
				has_holder = yes
				is_primary_holder_title = yes
				holder_scope = {
					top_liege = { character = PREV }
					is_landed = yes
				}
			}
			holder_scope = {
				any_realm_province = {
					limit = { has_province_flag = change_religion }
					clr_province_flag = change_religion
					religion = event_target:mender_religion
				}
			}
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2232
		trigger = { religion = event_target:mender_religion }
		if = {
			limit = { character = event_target:council_holder }
			prestige = 1000
			set_character_flag = schism_mender
			give_nickname = nick_the_saint
		}
	}
	option = {
		name = EVTOPTB_Plus_2237
		trigger = {
			NOT = { religion = event_target:mender_religion }
			religion_group = christian
		}
	}
	option = {
		name = EVTOPTC_Plus_2237
		trigger = {
			NOT = { religion = event_target:mender_religion }
			NOT = { religion_group = christian }
		}
	}
}

### ENFORCING THE COUNCIL OF CHALCEDON

# Ecumenical Council Called
narrative_event = {
	id = Plus.2238
	title = EVTNAME_Plus_2230
	desc = EVTDESC_Plus_2238
	picture = GFX_evt_ecumenical_council
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		save_event_target_as = council_holder
		if = {
			limit = { controls_religion = no }
			random_realm_title = {
				limit = {
					tier = BARON
					holder_scope = { religion = ROOT }
					holding_type = temple
				}
				location = { save_event_target_as = council_location }
			}
		}
		if = {
			limit = { controls_religion = yes }
			capital_holding = { location = { save_event_target_as = council_location } }
		}
		if = {
			limit = { d_miaphysite = { holder_scope = { is_heretic = no } } }
			d_miaphysite = { holder_scope = { save_event_target_as = target_religion1 } }
		}
		if = {
			limit = { d_monophysite = { holder_scope = { is_heretic = no } } }
			d_monophysite = { holder_scope = { save_event_target_as = target_religion1 } }
		}
		if = {
			limit = { d_apostolic = { holder_scope = { is_heretic = no } } }
			d_apostolic = { holder_scope = { save_event_target_as = target_religion2 } }
		}
		if = {
			limit = { d_paulician = { holder_scope = { is_heretic = no } } }
			d_paulician = { holder_scope = { save_event_target_as = target_religion2 } }
		}
		if = {
			limit = { controls_religion = no }
			religion_head = { save_event_target_as = mender_religion }
		}
		if = {
			limit = { controls_religion = yes }
			save_event_target_as = mender_religion
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2230
		set_global_flag = enforcing_chalcedon
		add_character_modifier = {
			modifier = do_not_disturb
			hidden = yes
			duration = 30
		}
		hidden_tooltip = {
			any_demesne_title = {
				limit = {
					tier = COUNT
					location = { enforce_ephesus_religion_trigger = yes }
				}
				location = { set_province_flag = change_religion }
			}
			any_courtier = {
				limit = {
					enforce_ephesus_religion_trigger = yes
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = ROOT
			}
			any_vassal = {
				limit = {
					enforce_ephesus_religion_trigger = yes
					NOT = { trait = zealous }
					is_playable = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = ROOT
				any_courtier = {
					limit = {
						enforce_ephesus_religion_trigger = yes
						NOT = { trait = zealous }
						is_ruler = no
						controls_religion = no
						mercenary = no
						holy_order = no
						can_change_religion = yes
					}
					religion = ROOT
				}
			}
			any_vassal = {
				limit = { is_playable = yes }
				narrative_event = { id = Plus.2239 days = 1 random = 4 } #choose whether to convert
			}
			any_title = {
				limit = {
					has_holder = yes
					holder_scope = {
						top_liege = { character = PREV }
						NOT = { character = ROOT }
						is_playable = yes
					}
				}
				holder_scope = {
					narrative_event = { id = Plus.2239 days = 1 random = 4 } #choose whether to convert
				}
			}
			event_target:council_location = {
				province_event = { id = Plus.2240 days = 30 } #council is over
			}
		}
	}
}

# Rulers informed about the Ecumenical Council - Convert or Not?
narrative_event = {
	id = Plus.2239
	title = EVTNAME_Plus_2230
	desc = EVTDESC_Plus_2238
	picture = GFX_evt_ecumenical_council
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	hide_from = yes
	
	immediate = {
		any_vassal = {
			limit = { is_playable = yes }
			narrative_event = { id = Plus.2239 days = 1 random = 4 } #choose whether to convert
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2231 # Convert
		trigger = {
			controls_religion = no
			mercenary = no
			holy_order = no
			can_change_religion = yes
			enforce_ephesus_religion_trigger = yes
		}
		ai_chance = {
			factor = 75
			modifier = {
				factor = 0
				OR = {
					trait = zealous
					has_character_modifier = voice_of_jesus
					has_character_modifier = voice_of_satan
				}
			}
			modifier = {
				factor = 1.5
				trait = humble
			}
			modifier = {
				factor = 1.5
				trait = craven
			}
			modifier = {
				factor = 1.5
				trait = content
			}
			modifier = {
				factor = 1.5
				independent = no
				liege = { religion = event_target:mender_religion }
			}
		}
		religion = event_target:mender_religion
		any_demesne_title = {
			limit = {
				tier = COUNT
				location = { enforce_ephesus_religion_trigger = yes }
			}
			location = { set_province_flag = change_religion }
		}
		any_courtier = {
			limit = {
				enforce_ephesus_religion_trigger = yes
				NOT = { trait = zealous }
				is_ruler = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
		}
		any_vassal = {
			limit = {
				enforce_ephesus_religion_trigger = yes
				NOT = { trait = zealous }
				is_playable = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
			any_courtier = {
				limit = {
					enforce_ephesus_religion_trigger = yes
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = event_target:mender_religion
			}
		}
	}
	option = {
		name = EVTOPTB_Plus_2231 # Don't Convert
		trigger = {
			controls_religion = no
			mercenary = no
			holy_order = no
			can_change_religion = yes
			enforce_ephesus_religion_trigger = yes
		}
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0
				NOR = {
					trait = zealous
					trait = lunatic
					trait = proud
					trait = detached_priest
					trait = martial_cleric
					trait = scholarly_theologian
					trait = mastermind_theologian
					has_character_modifier = voice_of_jesus
					has_character_modifier = voice_of_satan
					capital_holding = { holding_type = temple }
					liege = { NOT = { religion = event_target:mender_religion } }
					real_tier = EMPEROR
				}
			}
			modifier = {
				factor = 0
				OR = {
					trait = cynical
					has_character_modifier = defied_church
				}
			}
			modifier = {
				factor = 3
				trait = lunatic
			}
			modifier = {
				factor = 1.5
				trait = proud
			}
			modifier = {
				factor = 1.5
				trait = brave
			}
			modifier = {
				factor = 1.5
				trait = detached_priest
			}
			modifier = {
				factor = 2
				trait = martial_cleric
			}
			modifier = {
				factor = 2.5
				trait = scholarly_theologian
			}
			modifier = {
				factor = 3
				trait = mastermind_theologian
			}
			modifier = {
				factor = 3
				independent = no
				liege = { NOT = { religion = event_target:mender_religion } }
			}
			modifier = {
				factor = 2
				independent = yes
				real_tier = KING
			}
			modifier = {
				factor = 3
				independent = yes
				real_tier = EMPEROR
			}
		}
		if = {
			limit = { NOT = { trait = zealous } }
			random = {
				chance = 25
				add_trait = zealous
			}
		}
	}
	option = {
		name = EVTOPTC_Plus_2231 # This is of great concern...
		trigger = {
			NAND = {
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
				enforce_ephesus_religion_trigger = yes
			}
			NOT = { religion = event_target:mender_religion }
			religion_group = christian
		}
	}
	option = {
		name = {
			text = EVTOPTD_Plus_2231 # A wonderful day!
			trigger = { religion = event_target:mender_religion }
		}
		name = {
			text = EVTOPTE_Plus_2231 # Nothing to do with me
			trigger = {
				NAND = {
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
					enforce_ephesus_religion_trigger = yes
				}
				NOT = { religion = event_target:mender_religion }
				NOT = { religion_group = christian }
			}
		}
		any_demesne_title = {
			limit = {
				tier = COUNT
				location = { enforce_ephesus_religion_trigger = yes }
			}
			location = { set_province_flag = change_religion }
		}
		any_courtier = {
			limit = {
				enforce_ephesus_religion_trigger = yes
				NOT = { trait = zealous }
				is_ruler = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
		}
		any_vassal = {
			limit = {
				enforce_ephesus_religion_trigger = yes
				NOT = { trait = zealous }
				is_playable = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
			any_courtier = {
				limit = {
					enforce_ephesus_religion_trigger = yes
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = event_target:mender_religion
			}
		}
	}
}

# Province bounce event
province_event = {
	id = Plus.2240
	
	is_triggered_only = yes
	hide_window = yes
	
	immediate = {
		owner = {
			narrative_event = { id = Plus.2241 }
		}
	}
}

# Ecumenical Council Over
narrative_event = {
	id = Plus.2241
	title = EVTNAME_Plus_2230
	desc = EVTDESC_Plus_2241
	picture = GFX_evt_ecumenical_council
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	major = yes
	
	immediate = {
		clr_global_flag = enforcing_chalcedon
		set_global_flag = chalcedon_enforced	
		event_target:mender_religion = {
			event_target:target_religion1 = {
				set_parent_religion = { religion = THIS parent = PREV }
			}
		}
		event_target:mender_religion = {
			event_target:target_religion2 = {
				set_parent_religion = { religion = THIS parent = PREV }
			}
		}
		any_title = {
			limit = {
				has_holder = yes
				is_primary_holder_title = yes
				holder_scope = {
					top_liege = { character = PREV }
					is_landed = yes
				}
			}
			holder_scope = {
				any_realm_province = {
					limit = { has_province_flag = change_religion }
					clr_province_flag = change_religion
					religion = event_target:mender_religion
				}
			}
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2232
		trigger = { religion = event_target:mender_religion }
		if = {
			limit = { character = event_target:council_holder }
			prestige = 1000
			set_character_flag = schism_mender
			give_nickname = nick_the_saint
		}
	}
	option = {
		name = EVTOPTB_Plus_2238
		trigger = {
			NOT = { religion = event_target:mender_religion }
			religion_group = christian
		}
	}
	option = {
		name = EVTOPTC_Plus_2237
		trigger = {
			NOT = { religion = event_target:mender_religion }
			NOT = { religion_group = christian }
		}
	}
}

### REPUDIATING THE COUNCIL OF EPHESUS

# Ecumenical Council Called
narrative_event = {
	id = Plus.2242
	title = EVTNAME_Plus_2230
	desc = EVTDESC_Plus_2242
	picture = GFX_evt_ecumenical_council
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		save_event_target_as = council_holder
		if = {
			limit = { controls_religion = no }
			random_realm_title = {
				limit = {
					tier = BARON
					holder_scope = { religion = ROOT }
					holding_type = temple
				}
				location = { save_event_target_as = council_location }
			}
		}
		if = {
			limit = { controls_religion = yes }
			capital_holding = { location = { save_event_target_as = council_location } }
		}
		any_title = {
			limit = {
				OR = {
					title = k_orthodox
					title = d_monothelite
					title = d_iconoclast
					title = d_bogomilist
				}
				has_holder = yes
				holder_scope = { is_heretic = no }
			}
			holder_scope = {
				save_event_target_as = target_religion
			}
		}
		if = {
			limit = { controls_religion = no }
			religion_head = { save_event_target_as = mender_religion }
		}
		if = {
			limit = { controls_religion = yes }
			save_event_target_as = mender_religion
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2230
		set_global_flag = repudiating_ephesus
		add_character_modifier = {
			modifier = do_not_disturb
			hidden = yes
			duration = 30
		}
		hidden_tooltip = {
			any_demesne_title = {
				limit = {
					tier = COUNT
					location = { repudiate_ephesus_religion_trigger = yes }
				}
				location = { set_province_flag = change_religion }
			}
			any_courtier = {
				limit = {
					repudiate_ephesus_religion_trigger = yes
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = ROOT
			}
			any_vassal = {
				limit = {
					repudiate_ephesus_religion_trigger = yes
					NOT = { trait = zealous }
					is_playable = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = ROOT
				any_courtier = {
					limit = {
						repudiate_ephesus_religion_trigger = yes
						NOT = { trait = zealous }
						is_ruler = no
						controls_religion = no
						mercenary = no
						holy_order = no
						can_change_religion = yes
					}
					religion = ROOT
				}
			}
			any_vassal = {
				limit = { is_playable = yes }
				narrative_event = { id = Plus.2243 days = 1 random = 4 } #choose whether to convert
			}
			any_title = {
				limit = {
					has_holder = yes
					holder_scope = {
						top_liege = { character = PREV }
						NOT = { character = ROOT }
						is_playable = yes
					}
				}
				holder_scope = {
					narrative_event = { id = Plus.2243 days = 1 random = 4 } #choose whether to convert
				}
			}
			event_target:council_location = {
				province_event = { id = Plus.2244 days = 30 } #council is over
			}
		}
	}
}

# Rulers informed about the Ecumenical Council - Convert or Not?
narrative_event = {
	id = Plus.2243
	title = EVTNAME_Plus_2230
	desc = EVTDESC_Plus_2242
	picture = GFX_evt_ecumenical_council
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	hide_from = yes
	
	immediate = {
		any_vassal = {
			limit = { is_playable = yes }
			narrative_event = { id = Plus.2243 days = 1 random = 4 } #choose whether to convert
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2231 # Convert
		trigger = {
			controls_religion = no
			mercenary = no
			holy_order = no
			can_change_religion = yes
			repudiate_ephesus_religion_trigger = yes
		}
		ai_chance = {
			factor = 75
			modifier = {
				factor = 0
				OR = {
					trait = zealous
					has_character_modifier = voice_of_jesus
					has_character_modifier = voice_of_satan
				}
			}
			modifier = {
				factor = 1.5
				trait = humble
			}
			modifier = {
				factor = 1.5
				trait = craven
			}
			modifier = {
				factor = 1.5
				trait = content
			}
			modifier = {
				factor = 1.5
				independent = no
				liege = { religion = event_target:mender_religion }
			}
		}
		religion = event_target:mender_religion
		any_demesne_title = {
			limit = {
				tier = COUNT
				location = { repudiate_ephesus_religion_trigger = yes }
			}
			location = { set_province_flag = change_religion }
		}
		any_courtier = {
			limit = {
				repudiate_ephesus_religion_trigger = yes
				NOT = { trait = zealous }
				is_ruler = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
		}
		any_vassal = {
			limit = {
				repudiate_ephesus_religion_trigger = yes
				NOT = { trait = zealous }
				is_playable = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
			any_courtier = {
				limit = {
					repudiate_ephesus_religion_trigger = yes
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = event_target:mender_religion
			}
		}
	}
	option = {
		name = EVTOPTB_Plus_2231 # Don't Convert
		trigger = {
			controls_religion = no
			mercenary = no
			holy_order = no
			can_change_religion = yes
			repudiate_ephesus_religion_trigger = yes
		}
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0
				NOR = {
					trait = zealous
					trait = lunatic
					trait = proud
					trait = detached_priest
					trait = martial_cleric
					trait = scholarly_theologian
					trait = mastermind_theologian
					has_character_modifier = voice_of_jesus
					has_character_modifier = voice_of_satan
					capital_holding = { holding_type = temple }
					liege = { NOT = { religion = event_target:mender_religion } }
					real_tier = EMPEROR
				}
			}
			modifier = {
				factor = 0
				OR = {
					trait = cynical
					has_character_modifier = defied_church
				}
			}
			modifier = {
				factor = 3
				trait = lunatic
			}
			modifier = {
				factor = 1.5
				trait = proud
			}
			modifier = {
				factor = 1.5
				trait = brave
			}
			modifier = {
				factor = 1.5
				trait = detached_priest
			}
			modifier = {
				factor = 2
				trait = martial_cleric
			}
			modifier = {
				factor = 2.5
				trait = scholarly_theologian
			}
			modifier = {
				factor = 3
				trait = mastermind_theologian
			}
			modifier = {
				factor = 3
				independent = no
				liege = { NOT = { religion = event_target:mender_religion } }
			}
			modifier = {
				factor = 2
				independent = yes
				real_tier = KING
			}
			modifier = {
				factor = 3
				independent = yes
				real_tier = EMPEROR
			}
		}
		if = {
			limit = { NOT = { trait = zealous } }
			random = {
				chance = 25
				add_trait = zealous
			}
		}
	}
	option = {
		name = EVTOPTC_Plus_2231 # This is of great concern...
		trigger = {
			NAND = {
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
				repudiate_ephesus_religion_trigger = yes
			}
			NOT = { religion = event_target:mender_religion }
			religion_group = christian
		}
	}
	option = {
		name = {
			text = EVTOPTD_Plus_2231 # A wonderful day!
			trigger = { religion = event_target:mender_religion }
		}
		name = {
			text = EVTOPTE_Plus_2231 # Nothing to do with me
			trigger = {
				NAND = {
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
					repudiate_ephesus_religion_trigger = yes
				}
				NOT = { religion = event_target:mender_religion }
				NOT = { religion_group = christian }
			}
		}
		any_demesne_title = {
			limit = {
				tier = COUNT
				location = { repudiate_ephesus_religion_trigger = yes }
			}
			location = { set_province_flag = change_religion }
		}
		any_courtier = {
			limit = {
				repudiate_ephesus_religion_trigger = yes
				NOT = { trait = zealous }
				is_ruler = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
		}
		any_vassal = {
			limit = {
				repudiate_ephesus_religion_trigger = yes
				NOT = { trait = zealous }
				is_playable = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
			any_courtier = {
				limit = {
					repudiate_ephesus_religion_trigger = yes
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = event_target:mender_religion
			}
		}
	}
}

# Province bounce event
province_event = {
	id = Plus.2244
	
	is_triggered_only = yes
	hide_window = yes
	
	immediate = {
		owner = {
			narrative_event = { id = Plus.2245 }
		}
	}
}

# Ecumenical Council Over
narrative_event = {
	id = Plus.2245
	title = EVTNAME_Plus_2230
	desc = EVTDESC_Plus_2245
	picture = GFX_evt_ecumenical_council
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	major = yes
	
	immediate = {
		clr_global_flag = repudiating_ephesus
		set_global_flag = ephesus_repudiated	
		event_target:mender_religion = {
			event_target:target_religion = {
				set_parent_religion = { religion = THIS parent = PREV }
			}
		}
		any_title = {
			limit = {
				has_holder = yes
				is_primary_holder_title = yes
				holder_scope = {
					top_liege = { character = PREV }
					is_landed = yes
				}
			}
			holder_scope = {
				any_realm_province = {
					limit = { has_province_flag = change_religion }
					clr_province_flag = change_religion
					religion = event_target:mender_religion
				}
			}
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2232
		trigger = { religion = event_target:mender_religion }
		if = {
			limit = { character = event_target:council_holder }
			prestige = 1000
			set_character_flag = schism_mender
			give_nickname = nick_the_saint
		}
	}
	option = {
		name = EVTOPTB_Plus_2245
		trigger = {
			NOT = { religion = event_target:mender_religion }
			religion_group = christian
		}
	}
	option = {
		name = EVTOPTC_Plus_2245
		trigger = {
			NOT = { religion = event_target:mender_religion }
			NOT = { religion_group = christian }
		}
	}
}

### REPUDIATING THE COUNCIL OF CHALCEDON

# Ecumenical Council Called
narrative_event = {
	id = Plus.2246
	title = EVTNAME_Plus_2230
	picture = GFX_evt_ecumenical_council
	border = GFX_event_narrative_frame_religion
	
	desc = {
		text = EVTDESC_Plus_2246
		trigger = { event_target:target_religion2 = { is_alive = yes } }
	}
	desc = {
		text = EVTDESC_Plus_2246_no_second
		trigger = { NOT = { event_target:target_religion2 = { is_alive = yes } } }
	}
	
	is_triggered_only = yes
	
	immediate = {
		save_event_target_as = council_holder
		if = {
			limit = { controls_religion = no }
			random_realm_title = {
				limit = {
					tier = BARON
					holder_scope = { religion = ROOT }
					holding_type = temple
				}
				location = { save_event_target_as = council_location }
			}
		}
		if = {
			limit = { controls_religion = yes }
			capital_holding = { location = { save_event_target_as = council_location } }
		}
		any_title = {
			limit = {
				OR = {
					title = k_orthodox
					title = d_monothelite
					title = d_iconoclast
					title = d_bogomilist
				}
				has_holder = yes
				holder_scope = { is_heretic = no }
			}
			holder_scope = {
				save_event_target_as = target_religion1
			}
		}
		if = {
			limit = {
				OR = {
					religion = miaphysite
					religion = monophysite
				}
			}
			any_title = {
				limit = {
					OR = {
						title = d_apostolic
						title = d_paulician
					}
					has_holder = yes
					holder_scope = { is_heretic = no }
				}
				holder_scope = {
					save_event_target_as = target_religion2
				}
			}
		}
		if = {
			limit = {
				OR = {
					religion = apostolic
					religion = paulician
				}
			}
			any_title = {
				limit = {
					OR = {
						title = d_miaphysite
						title = d_monophysite
					}
					has_holder = yes
					holder_scope = { is_heretic = no }
				}
				holder_scope = {
					save_event_target_as = target_religion2
				}
			}
		}
		if = {
			limit = { controls_religion = no }
			religion_head = { save_event_target_as = mender_religion }
		}
		if = {
			limit = { controls_religion = yes }
			save_event_target_as = mender_religion
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2230
		set_global_flag = repudiating_chalcedon
		add_character_modifier = {
			modifier = do_not_disturb
			hidden = yes
			duration = 30
		}
		hidden_tooltip = {
			any_demesne_title = {
				limit = {
					tier = COUNT
					location = { repudiate_chalcedon_religion_trigger = yes }
				}
				location = { set_province_flag = change_religion }
			}
			any_courtier = {
				limit = {
					repudiate_chalcedon_religion_trigger = yes
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = ROOT
			}
			any_vassal = {
				limit = {
					repudiate_chalcedon_religion_trigger = yes
					NOT = { trait = zealous }
					is_playable = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = ROOT
				any_courtier = {
					limit = {
						repudiate_chalcedon_religion_trigger = yes
						NOT = { trait = zealous }
						is_ruler = no
						controls_religion = no
						mercenary = no
						holy_order = no
						can_change_religion = yes
					}
					religion = ROOT
				}
			}
			any_vassal = {
				limit = { is_playable = yes }
				narrative_event = { id = Plus.2247 days = 1 random = 4 } #choose whether to convert
			}
			any_title = {
				limit = {
					has_holder = yes
					holder_scope = {
						top_liege = { character = PREV }
						NOT = { character = ROOT }
						is_playable = yes
					}
				}
				holder_scope = {
					narrative_event = { id = Plus.2247 days = 1 random = 4 } #choose whether to convert
				}
			}
			event_target:council_location = {
				province_event = { id = Plus.2248 days = 30 } #council is over
			}
		}
	}
}

# Rulers informed about the Ecumenical Council - Convert or Not?
narrative_event = {
	id = Plus.2247
	title = EVTNAME_Plus_2230
	desc = EVTDESC_Plus_2246
	picture = GFX_evt_ecumenical_council
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	hide_from = yes
	
	immediate = {
		any_vassal = {
			limit = { is_playable = yes }
			narrative_event = { id = Plus.2247 days = 1 random = 4 } #choose whether to convert
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2231 # Convert
		trigger = {
			controls_religion = no
			mercenary = no
			holy_order = no
			can_change_religion = yes
			repudiate_chalcedon_religion_trigger = yes
		}
		ai_chance = {
			factor = 75
			modifier = {
				factor = 0
				OR = {
					trait = zealous
					has_character_modifier = voice_of_jesus
					has_character_modifier = voice_of_satan
				}
			}
			modifier = {
				factor = 1.5
				trait = humble
			}
			modifier = {
				factor = 1.5
				trait = craven
			}
			modifier = {
				factor = 1.5
				trait = content
			}
			modifier = {
				factor = 1.5
				independent = no
				liege = { religion = event_target:mender_religion }
			}
		}
		religion = event_target:mender_religion
		any_demesne_title = {
			limit = {
				tier = COUNT
				location = { repudiate_chalcedon_religion_trigger = yes }
			}
			location = { set_province_flag = change_religion }
		}
		any_courtier = {
			limit = {
				repudiate_chalcedon_religion_trigger = yes
				NOT = { trait = zealous }
				is_ruler = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
		}
		any_vassal = {
			limit = {
				repudiate_chalcedon_religion_trigger = yes
				NOT = { trait = zealous }
				is_playable = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
			any_courtier = {
				limit = {
					repudiate_chalcedon_religion_trigger = yes
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = event_target:mender_religion
			}
		}
	}
	option = {
		name = EVTOPTB_Plus_2231 # Don't Convert
		trigger = {
			controls_religion = no
			mercenary = no
			holy_order = no
			can_change_religion = yes
			repudiate_chalcedon_religion_trigger = yes
		}
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0
				NOR = {
					trait = zealous
					trait = lunatic
					trait = proud
					trait = detached_priest
					trait = martial_cleric
					trait = scholarly_theologian
					trait = mastermind_theologian
					has_character_modifier = voice_of_jesus
					has_character_modifier = voice_of_satan
					capital_holding = { holding_type = temple }
					liege = { NOT = { religion = event_target:mender_religion } }
					real_tier = EMPEROR
				}
			}
			modifier = {
				factor = 0
				OR = {
					trait = cynical
					has_character_modifier = defied_church
				}
			}
			modifier = {
				factor = 3
				trait = lunatic
			}
			modifier = {
				factor = 1.5
				trait = proud
			}
			modifier = {
				factor = 1.5
				trait = brave
			}
			modifier = {
				factor = 1.5
				trait = detached_priest
			}
			modifier = {
				factor = 2
				trait = martial_cleric
			}
			modifier = {
				factor = 2.5
				trait = scholarly_theologian
			}
			modifier = {
				factor = 3
				trait = mastermind_theologian
			}
			modifier = {
				factor = 3
				independent = no
				liege = { NOT = { religion = event_target:mender_religion } }
			}
			modifier = {
				factor = 2
				independent = yes
				real_tier = KING
			}
			modifier = {
				factor = 3
				independent = yes
				real_tier = EMPEROR
			}
		}
		if = {
			limit = { NOT = { trait = zealous } }
			random = {
				chance = 25
				add_trait = zealous
			}
		}
	}
	option = {
		name = EVTOPTC_Plus_2231 # This is of great concern...
		trigger = {
			NAND = {
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
				repudiate_chalcedon_religion_trigger = yes
			}
			NOT = { religion = event_target:mender_religion }
			religion_group = christian
		}
	}
	option = {
		name = {
			text = EVTOPTD_Plus_2231 # A wonderful day!
			trigger = { religion = event_target:mender_religion }
		}
		name = {
			text = EVTOPTE_Plus_2231 # Nothing to do with me
			trigger = {
				NAND = {
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
					repudiate_chalcedon_religion_trigger = yes
				}
				NOT = { religion = event_target:mender_religion }
				NOT = { religion_group = christian }
			}
		}
		any_demesne_title = {
			limit = {
				tier = COUNT
				location = { repudiate_chalcedon_religion_trigger = yes }
			}
			location = { set_province_flag = change_religion }
		}
		any_courtier = {
			limit = {
				repudiate_chalcedon_religion_trigger = yes
				NOT = { trait = zealous }
				is_ruler = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
		}
		any_vassal = {
			limit = {
				repudiate_chalcedon_religion_trigger = yes
				NOT = { trait = zealous }
				is_playable = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
			any_courtier = {
				limit = {
					repudiate_chalcedon_religion_trigger = yes
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = event_target:mender_religion
			}
		}
	}
}

# Province bounce event
province_event = {
	id = Plus.2248
	
	is_triggered_only = yes
	hide_window = yes
	
	immediate = {
		owner = {
			narrative_event = { id = Plus.2249 }
		}
	}
}

# Ecumenical Council Over
narrative_event = {
	id = Plus.2249
	title = EVTNAME_Plus_2230
	desc = EVTDESC_Plus_2249
	picture = GFX_evt_ecumenical_council
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	major = yes
	
	immediate = {
		clr_global_flag = repudiating_chalcedon
		set_global_flag = chalcedon_repudiated	
		event_target:mender_religion = {
			event_target:target_religion1 = {
				set_parent_religion = { religion = THIS parent = PREV }
			}
		}
		event_target:mender_religion = {
			event_target:target_religion2 = {
				set_parent_religion = { religion = THIS parent = PREV }
			}
		}
		any_title = {
			limit = {
				has_holder = yes
				is_primary_holder_title = yes
				holder_scope = {
					top_liege = { character = PREV }
					is_landed = yes
				}
			}
			holder_scope = {
				any_realm_province = {
					limit = { has_province_flag = change_religion }
					clr_province_flag = change_religion
					religion = event_target:mender_religion
				}
			}
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2232
		trigger = { religion = event_target:mender_religion }
		if = {
			limit = { character = event_target:council_holder }
			prestige = 1000
			set_character_flag = schism_mender
			give_nickname = nick_the_saint
		}
	}
	option = {
		name = EVTOPTB_Plus_2245
		trigger = {
			NOT = { religion = event_target:mender_religion }
			religion_group = christian
		}
	}
	option = {
		name = EVTOPTC_Plus_2245
		trigger = {
			NOT = { religion = event_target:mender_religion }
			NOT = { religion_group = christian }
		}
	}
}

### UNITING CHRISTIANITY

# Ecumenical Council Called
narrative_event = {
	id = Plus.2250
	title = EVTNAME_Plus_2230
	desc = EVTDESC_Plus_2250
	picture = GFX_evt_great_schism
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		save_event_target_as = council_holder
		capital_holding = { location = { save_event_target_as = council_location } }
		any_title = {
			limit = {
				OR = {
					title = k_papal_state
					title = d_cathar
					title = d_fraticelli
				}
				has_holder = yes
				holder_scope = { is_heretic = no }
			}
			holder_scope = {
				save_event_target_as = target_religion
			}
		}
		if = {
			limit = { controls_religion = no }
			religion_head = { save_event_target_as = mender_religion }
		}
		if = {
			limit = { controls_religion = yes }
			save_event_target_as = mender_religion
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2230
		set_global_flag = uniting_christianity
		add_character_modifier = {
			modifier = do_not_disturb
			hidden = yes
			duration = 30
		}
		hidden_tooltip = {
			any_demesne_title = {
				limit = {
					tier = COUNT
					location = { unite_christianity_religion_trigger = yes }
				}
				location = { set_province_flag = change_religion }
			}
			any_courtier = {
				limit = {
					unite_christianity_religion_trigger = yes
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = ROOT
			}
			any_vassal = {
				limit = {
					unite_christianity_religion_trigger = yes
					NOT = { trait = zealous }
					is_playable = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = ROOT
				any_courtier = {
					limit = {
						unite_christianity_religion_trigger = yes
						NOT = { trait = zealous }
						is_ruler = no
						controls_religion = no
						mercenary = no
						holy_order = no
						can_change_religion = yes
					}
					religion = ROOT
				}
			}
			any_vassal = {
				limit = { is_playable = yes }
				narrative_event = { id = Plus.2251 days = 1 random = 4 } #choose whether to convert
			}
			any_title = {
				limit = {
					has_holder = yes
					holder_scope = {
						top_liege = { character = PREV }
						NOT = { character = ROOT }
						is_playable = yes
					}
				}
				holder_scope = {
					narrative_event = { id = Plus.2251 days = 1 random = 4 } #choose whether to convert
				}
			}
			event_target:council_location = {
				province_event = { id = Plus.2252 days = 30 } #council is over
			}
		}
	}
}

# Rulers informed about the Ecumenical Council - Convert or Not?
narrative_event = {
	id = Plus.2251
	title = EVTNAME_Plus_2230
	desc = EVTDESC_Plus_2250
	picture = GFX_evt_great_schism
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	hide_from = yes
	
	immediate = {
		any_vassal = {
			limit = { is_playable = yes }
			narrative_event = { id = Plus.2251 days = 1 random = 4 } #choose whether to convert
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2231 # Convert
		trigger = {
			controls_religion = no
			mercenary = no
			holy_order = no
			can_change_religion = yes
			unite_christianity_religion_trigger = yes
		}
		ai_chance = {
			factor = 75
			modifier = {
				factor = 0
				OR = {
					trait = zealous
					has_character_modifier = voice_of_jesus
					has_character_modifier = voice_of_satan
				}
			}
			modifier = {
				factor = 1.5
				trait = humble
			}
			modifier = {
				factor = 1.5
				trait = craven
			}
			modifier = {
				factor = 1.5
				trait = content
			}
			modifier = {
				factor = 1.5
				independent = no
				liege = { religion = event_target:mender_religion }
			}
		}
		religion = event_target:mender_religion
		any_demesne_title = {
			limit = {
				tier = COUNT
				location = { unite_christianity_religion_trigger = yes }
			}
			location = { set_province_flag = change_religion }
		}
		any_courtier = {
			limit = {
				unite_christianity_religion_trigger = yes
				NOT = { trait = zealous }
				is_ruler = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
		}
		any_vassal = {
			limit = {
				unite_christianity_religion_trigger = yes
				NOT = { trait = zealous }
				is_playable = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
			any_courtier = {
				limit = {
					unite_christianity_religion_trigger = yes
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = event_target:mender_religion
			}
		}
	}
	option = {
		name = EVTOPTB_Plus_2231 # Don't Convert
		trigger = {
			controls_religion = no
			mercenary = no
			holy_order = no
			can_change_religion = yes
			unite_christianity_religion_trigger = yes
		}
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0
				NOR = {
					trait = zealous
					trait = lunatic
					trait = proud
					trait = detached_priest
					trait = martial_cleric
					trait = scholarly_theologian
					trait = mastermind_theologian
					has_character_modifier = voice_of_jesus
					has_character_modifier = voice_of_satan
					capital_holding = { holding_type = temple }
					liege = { NOT = { religion = event_target:mender_religion } }
					real_tier = EMPEROR
				}
			}
			modifier = {
				factor = 0
				OR = {
					trait = cynical
					has_character_modifier = defied_church
				}
			}
			modifier = {
				factor = 3
				trait = lunatic
			}
			modifier = {
				factor = 1.5
				trait = proud
			}
			modifier = {
				factor = 1.5
				trait = brave
			}
			modifier = {
				factor = 1.5
				trait = detached_priest
			}
			modifier = {
				factor = 2
				trait = martial_cleric
			}
			modifier = {
				factor = 2.5
				trait = scholarly_theologian
			}
			modifier = {
				factor = 3
				trait = mastermind_theologian
			}
			modifier = {
				factor = 3
				independent = no
				liege = { NOT = { religion = event_target:mender_religion } }
			}
			modifier = {
				factor = 2
				independent = yes
				real_tier = KING
			}
			modifier = {
				factor = 3
				independent = yes
				real_tier = EMPEROR
			}
		}
		if = {
			limit = { NOT = { trait = zealous } }
			random = {
				chance = 25
				add_trait = zealous
			}
		}
	}
	option = {
		name = EVTOPTC_Plus_2231 # This is of great concern...
		trigger = {
			NAND = {
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
				unite_christianity_religion_trigger = yes
			}
			NOT = { religion = event_target:mender_religion }
			religion_group = christian
		}
	}
	option = {
		name = {
			text = EVTOPTD_Plus_2231 # A wonderful day!
			trigger = { religion = event_target:mender_religion }
		}
		name = {
			text = EVTOPTE_Plus_2231 # Nothing to do with me
			trigger = {
				NAND = {
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
					unite_christianity_religion_trigger = yes
				}
				NOT = { religion = event_target:mender_religion }
				NOT = { religion_group = christian }
			}
		}
		any_demesne_title = {
			limit = {
				tier = COUNT
				location = { unite_christianity_religion_trigger = yes }
			}
			location = { set_province_flag = change_religion }
		}
		any_courtier = {
			limit = {
				unite_christianity_religion_trigger = yes
				NOT = { trait = zealous }
				is_ruler = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
		}
		any_vassal = {
			limit = {
				unite_christianity_religion_trigger = yes
				NOT = { trait = zealous }
				is_playable = no
				controls_religion = no
				mercenary = no
				holy_order = no
				can_change_religion = yes
			}
			religion = event_target:mender_religion
			any_courtier = {
				limit = {
					unite_christianity_religion_trigger = yes
					NOT = { trait = zealous }
					is_ruler = no
					controls_religion = no
					mercenary = no
					holy_order = no
					can_change_religion = yes
				}
				religion = event_target:mender_religion
			}
		}
	}
}

# Province bounce event
province_event = {
	id = Plus.2252
	
	is_triggered_only = yes
	hide_window = yes
	
	immediate = {
		owner = {
			narrative_event = { id = Plus.2253 }
		}
	}
}

# Ecumenical Council Over
narrative_event = {
	id = Plus.2253
	title = EVTNAME_Plus_2230
	desc = EVTDESC_Plus_2253
	picture = GFX_evt_great_schism
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	major = yes
	
	immediate = {
		clr_global_flag = uniting_christianity
		set_global_flag = christianity_united	
		event_target:mender_religion = {
			event_target:target_religion = {
				set_parent_religion = { religion = THIS parent = PREV }
			}
		}
		any_title = {
			limit = {
				has_holder = yes
				is_primary_holder_title = yes
				holder_scope = {
					top_liege = { character = PREV }
					is_landed = yes
				}
			}
			holder_scope = {
				any_realm_province = {
					limit = { has_province_flag = change_religion }
					clr_province_flag = change_religion
					religion = event_target:mender_religion
				}
			}
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2232
		trigger = { religion = event_target:mender_religion }
		if = {
			limit = { character = event_target:council_holder }
			prestige = 1000
			set_character_flag = schism_mender
			give_nickname = nick_the_saint
		}
	}
	option = {
		name = EVTOPTB_Plus_2232
		trigger = {
			NOT = { religion = event_target:mender_religion }
			religion_group = christian
		}
	}
	option = {
		name = EVTOPTC_Plus_2232
		trigger = {
			NOT = { religion = event_target:mender_religion }
			NOT = { religion_group = christian }
		}
	}
}

################################################
# CHALCEDONIAN EVENTS
# Written by Rylock
################################################

### MAINTENANCE

# Switch Catholic/Orthodox characters which appear before Schism
character_event = {
	id = Plus.2270
	
	hide_window = yes
	is_triggered_only = yes
	
	religion_group = christian
	
	trigger = {
		OR = {
			religion = catholic
			religion = orthodox
		}
		NOR = {
			is_title_active = k_papal_state
			k_papal_state = { has_title_flag = schism_happened }
		}
	}
	
	immediate = {
		religion = chalcedonian
	}
}
	
# Switch Chalcedonian characters which appear after Schism
character_event = {
	id = Plus.2271
	
	hide_window = yes
	is_triggered_only = yes
	
	religion = chalcedonian
	
	trigger = {
		religion = chalcedonian
		k_papal_state = { has_title_flag = schism_happened }
	}
	
	immediate = {
		if = {
			limit = { independent = yes }
			religion = catholic
		}
		if = {
			limit = { independent = no }
			liege = { reverse_religion = ROOT }
		}
	}
}

# Remove Papal title for non-Chalcedonians
character_event = {
	id = Plus.2272
	
	hide_window = yes
	is_triggered_only = yes
	
	only_playable = yes
	
	trigger = {
		has_landed_title = k_papal_chalcedon
		OR = {
			NOT = { religion = chalcedonian }
			is_theocracy = no
		}
	}

	immediate = {
		k_papal_chalcedon = { unsafe_destroy_landed_title = THIS }
	}
}

### GREEK/LATIN RITES

# Choosing Latin/Greek Rites for Chalcedonian priests
character_event = {
	id = Plus.2275
	desc = EVTDESC_Plus_2275
	picture = GFX_evt_bishop
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	only_rulers = yes
	religion = chalcedonian
	capable_only = yes
	prisoner = no
	
	trigger = {
		is_theocracy = yes
		NOR = {
			trait = greek_rites
			trait = latin_rites
		}
	}

	immediate = {
		set_character_flag = chalcedonian_bishop
	}
	
	option = {
		name = EVTOPTA_Plus_2275 # Latin Rites
		trigger = {
			NOT = { religion_head = { trait = greek_rites } }
			OR = {
				is_italian_trigger = yes
				culture = longobard
			}
		}
		add_trait = latin_rites
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0
				capital_scope = {
					NOR = {
						region = world_europe_west
						region = world_europe_north
						region = world_europe_south_italy
						region = world_africa_west
						region = custom_morocco
						region = custom_algiers
						region = custom_africa
						region = custom_croatia
						region = custom_poland
						region = custom_carpathia
					}
				}
			}
		}
	}
	option = {
		name = EVTOPTB_Plus_2275 # Greek Rites
		trigger = {
			NOT = { religion_head = { trait = greek_rites } }
			culture = greek
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0
				capital_scope = {
					OR = {
						region = world_europe_west
						region = world_europe_north
						region = world_europe_south_italy
						region = world_africa_west
						region = custom_morocco
						region = custom_algiers
						region = custom_africa
						region = custom_croatia
						region = custom_poland
						region = custom_carpathia
					}
				}
			}
		}
		add_trait = greek_rites
	}
	option = {
		name = EVTOPTA_Plus_2275 # Latin Rites
		trigger = {
			OR = {
				religion_head = { trait = latin_rites }
				NOR = {
					is_italian_trigger = yes
					culture = longobard
					culture = greek
				}
			}
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0
				OR = {
					primary_title = { title = d_pentarch_constantinople }
					liege = { has_landed_title = e_byzantium }
					any_liege = { trait = greek_rites }
				}
				NOR = {
					primary_title = { title = k_papal_chalcedon }
					primary_title = { title = d_pentarch_rome }
					any_liege = { has_landed_title = e_karling }
					any_liege = { has_landed_title = e_hre }
					any_liege = { has_landed_title = e_latin_empire }
					any_liege = { has_landed_title = e_roman_empire }
					any_liege = { trait = latin_rites }
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					culture_group = byzantine
					culture_group = arabic
					culture_group = altaic
					culture_group = east_slavic
					AND = {
						culture_group = south_slavic
						NOT = { culture = croatian }
					}
					culture_group = iranian
				}
			}
			modifier = {
				factor = 0.1
				rightful_religious_head = ROOT
				primary_title = { any_previous_holder = { trait = greek_rites } }
			}
			modifier = {
				factor = 0.25
				NOT = { rightful_religious_head = ROOT }
				primary_title = { any_previous_holder = { trait = greek_rites } }
			}
			modifier = {
				factor = 2
				rightful_religious_head_scope = {
					NOT = { character = ROOT }
					trait = latin_rites
				}
			}
			modifier = {
				factor = 1.5
				location = { region = world_europe_west }
			}
		}
		add_trait = latin_rites
	}
	option = {
		name = EVTOPTB_Plus_2275 # Greek Rites
		trigger = {
			OR = {
				religion_head = { trait = greek_rites }
				NOR = {
					culture = italian
					culture = longobard
					culture = greek
				}
			}
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0
				OR = {
					primary_title = { title = k_papal_chalcedon }
					primary_title = { title = d_pentarch_rome }
					any_liege = { trait = latin_rites }
					any_liege = { has_landed_title = e_karling }
					any_liege = { has_landed_title = e_hre }
					any_liege = { has_landed_title = e_latin_empire }
					any_liege = { has_landed_title = e_roman_empire }
				}
				NOR = {
					primary_title = { title = d_pentarch_constantinople }
					any_liege = { has_landed_title = e_byzantium }
					any_liege = { trait = greek_rites }
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					culture_group = latin
					culture_group = iberian
					culture_group = magyar
					culture_group = west_slavic
					culture_group = north_germanic
					culture_group = central_germanic
					culture_group = west_germanic
					culture_group = celtic
					culture = croatian
				}
			}
			modifier = {
				factor = 0.1
				rightful_religious_head = ROOT
				primary_title = { any_previous_holder = { trait = latin_rites } }
			}
			modifier = {
				factor = 0.25
				NOT = { rightful_religious_head = ROOT }
				primary_title = { any_previous_holder = { trait = latin_rites } }
			}
			modifier = {
				factor = 2
				rightful_religious_head_scope = {
					NOT = { character = ROOT }
					trait = greek_rites
				}
			}
			modifier = {
				factor = 2
				trait = varangian
			}
			modifier = {
				factor = 1.5
				location = { region = world_europe_south_east }
			}
		}
		add_trait = greek_rites
	}
}

# Removing Latin/Greek Rites for non-priests
character_event = {
	id = Plus.2276
	
	hide_window = yes
	
	is_triggered_only = yes
	
	religion = chalcedonian
	has_character_flag = chalcedonian_bishop
	
	trigger = {
		is_theocracy = no
	}

	immediate = {
		clr_character_flag = chalcedonian_bishop
		remove_trait = latin_rites
		remove_trait = greek_rites
	}
}

# Patriarch demands that a priest switch rites
character_event = {
	id = Plus.2277
	picture = GFX_evt_bishop
	border = GFX_event_normal_frame_religion
	
	desc = {
		text = EVTDESC_Plus_2277_latin
		trigger = { trait = greek_rites }
	}
	desc = {
		text = EVTDESC_Plus_2277_greek
		trigger = { trait = latin_rites }
	}
	
	only_rulers = yes
	religion = chalcedonian
	min_age = 16
	capable_only = yes
	prisoner = no
	
	trigger = {
		religion_authority = 0.50
		is_theocracy = yes
		has_regent = no
		rightful_religious_head_scope = {
			has_regent = no
			NOT = { character = ROOT }
			NOT = { has_opinion_modifier = { who = ROOT modifier = refused_to_change_rite } }
			OR = {
				NOT = { ROOT = { religion_head = { always = yes } } }
				controls_religion = yes
			}
			OR = {
				NOT = { opinion = { who = ROOT value = 0 } }
				is_vassal_or_below = ROOT
			}
			OR = {
				AND = {
					trait = latin_rites
					ROOT = { trait = greek_rites }
				}
				AND = {
					trait = greek_rites
					ROOT = { trait = latin_rites }
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 120
		modifier = {
			factor = 0.5
			rightful_religious_head_scope = {
				is_vassal_or_below = ROOT
			}
		}
		modifier = {
			factor = 0.8
			rightful_religious_head_scope = {
				NOT = { opinion = { who = ROOT value = -20 } }
			}
		}
		modifier = {
			factor = 0.8
			rightful_religious_head_scope = {
				NOT = { opinion = { who = ROOT value = -40 } }
			}
		}
		modifier = {
			factor = 0.8
			rightful_religious_head_scope = {
				NOT = { opinion = { who = ROOT value = -60 } }
			}
		}
		modifier = {
			factor = 0.8
			rightful_religious_head_scope = {
				NOT = { opinion = { who = ROOT value = -80 } }
			}
		}
	}
	
	immediate = {
		rightful_religious_head_scope = { save_event_target_as = rightful_relhead }
		if = {
			limit = { NOT = { religion_head = { always = yes } } }
			religion_authority = {
				modifier = greek-latin_conflict
			}
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2277 # Refuse
		ai_chance = {
			factor = 30
			modifier = {
				factor = 0.5
				rightful_religious_head_scope = {
					is_vassal_or_below = ROOT
					NOT = { is_liege_of = ROOT }
				}
			}
			modifier = {
				factor = 0.1
				rightful_religious_head_scope = {
					is_liege_of = ROOT
				}
			}
			modifier = {
				factor = 1.25
				rightful_religious_head_scope = {
					reverse_opinion = { who = ROOT value = 0 }
				}
			}
			modifier = {
				factor = 1.25
				rightful_religious_head_scope = {
					reverse_opinion = { who = ROOT value = 20 }
				}
			}
			modifier = {
				factor = 1.5
				rightful_religious_head_scope = {
					reverse_opinion = { who = ROOT value = 40 }
				}
			}
			modifier = {
				factor = 1.5
				rightful_religious_head_scope = {
					reverse_opinion = { who = ROOT value = 60 }
				}
			}
			modifier = {
				factor = 2
				rightful_religious_head_scope = {
					reverse_opinion = { who = ROOT value = 80 }
				}
			}
		}
		rightful_religious_head_scope = {
			opinion = { who = ROOT modifier = refused_to_change_rite years = 10 }
			prestige = -25
		}
		piety = -25
	}
	option = {
		name = EVTOPTB_Plus_2277 # Agree
		ai_chance = {
			factor = 70
			modifier = {
				factor = 1.25
				rightful_religious_head_scope = {
					NOT = { reverse_opinion = { who = ROOT value = 0 } }
				}
			}
			modifier = {
				factor = 1.25
				rightful_religious_head_scope = {
					NOT = { reverse_opinion = { who = ROOT value = -20 } }
				}
			}
			modifier = {
				factor = 1.5
				rightful_religious_head_scope = {
					NOT = { reverse_opinion = { who = ROOT value = -40 } }
				}
			}
			modifier = {
				factor = 1.5
				rightful_religious_head_scope = {
					NOT = { reverse_opinion = { who = ROOT value = -60 } }
				}
			}
			modifier = {
				factor = 2
				rightful_religious_head_scope = {
					NOT = { reverse_opinion = { who = ROOT value = -80 } }
				}
			}
		}
		if = {
			limit = { rightful_religious_head_scope = { trait = greek_rites } }
			add_trait = greek_rites
			rightful_religious_head_scope = {
				any_independent_ruler = {
					if = {
						limit = { trait = latin_rites }
						opinion = { who = PREV modifier = opinion_disappointed years = 10 }
					}
					any_realm_lord = {
						if = {
							limit = { trait = latin_rites }
							opinion = { who = PREVPREV modifier = opinion_disappointed years = 10 }
						}
					}
				}
			}
		}
		if = {
			limit = { rightful_religious_head_scope = { trait = latin_rites } }
			add_trait = latin_rites
			rightful_religious_head_scope = {
				any_independent_ruler = {
					if = {
						limit = { trait = greek_rites }
						opinion = { who = PREV modifier = opinion_disappointed years = 10 }
					}
					any_realm_lord = {
						if = {
							limit = { trait = greek_rites }
							opinion = { who = PREVPREV modifier = opinion_disappointed years = 10 }
						}
					}
				}
			}
		}
	}
}

### LEAD UP TO THE SCHISM

# Pope anoints an Emperor as the new Roman Emperor
narrative_event = {
	id = Plus.2278
	title = EVTNAME_Plus_2278
	desc = EVTDESC_Plus_2278
	picture = GFX_evt_found_hre
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	hide_from = yes
	show_ROOT = yes
	major = yes
	
	trigger = {
		NOT = { has_global_flag = disabled_schism }
	}
	
	option = {
		name = EVTOPTA_Plus_2278
		trigger = {
			religion = chalcedonian
			rightful_religious_head_scope = { trait = greek_rites }
		}
	}
	option = {
		name = EVTOPTB_Plus_2278
		trigger = {
			religion = chalcedonian
			rightful_religious_head_scope = { trait = latin_rites }
		}
	}
	option = {
		name = EVTOPTC_Plus_2278
		trigger = {
			religion = chalcedonian
			NOR = {
				rightful_religious_head_scope = { trait = greek_rites }
				rightful_religious_head_scope = { trait = latin_rites }
			}
		}
	}
	option = {
		name = EVTOPTC_Plus_2278
		trigger = {
			NOT = { religion = chalcedonian }
			religion_group = christian
		}
	}
	option = {
		name = EVTOPTD_Plus_2278
		trigger = {
			NOT = { religion_group = christian }
		}
	}
}

# Pope-anointed Emperor wars with the Byzantine Empire
narrative_event = {
	id = Plus.2279
	title = EVTNAME_Plus_2279
	desc = EVTDESC_Plus_2279
	picture = GFX_evt_melee
	border = GFX_event_narrative_frame_religion
	
	major = yes
	hide_from = yes
	
	only_independent = yes
	only_playable = yes
	religion = chalcedonian
	has_character_flag = was_byzantine_emperor
	
	trigger = {
		has_landed_title = e_byzantium
		e_byzantium = { is_primary_holder_title = yes }
		is_heretic = no
		OR = {
			any_war = {
				defender = { character = ROOT }
				attacker = {
					religion = ROOT
					NOT = { trait = excommunicated }
					trait = crowned_by_pope
				}
			}
			any_war = {
				attacker = { character = ROOT }
				defender = {
					religion = ROOT
					NOT = { trait = excommunicated }
					trait = crowned_by_pope
				}
			}
		}
		NOR = {
			trait = excommunicated
			has_global_flag = attacked_by_papal_emperor
			k_papal_state = { has_title_flag = schism_happened }
			has_global_flag = patriarch_supreme_created
			has_global_flag = disabled_schism
		}
	}
	
	major_trigger = {
		religion_group = christian
	}
	
	mean_time_to_happen = {
		days = 30
	}
	
	immediate = {
		log = "SCHISM LEAD-UP: WAR BETWEEN BYZANTIUM AND POPE'S CHAMPION"
		set_global_flag = attacked_by_papal_emperor
		496 = { change_variable = { which = "schism_tracker" value = 1 } }
		random_current_enemy = {
			limit = { trait = crowned_by_pope }
			save_event_target_as = papal_emperor
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2279
		trigger = {
			religion = chalcedonian
			rightful_religious_head_scope = { trait = greek_rites }
		}
	}
	option = {
		name = EVTOPTB_Plus_2279
		trigger = {
			religion = chalcedonian
			rightful_religious_head_scope = { trait = latin_rites }
		}
	}
	option = {
		name = EVTOPTC_Plus_2279
		trigger = {
			religion = chalcedonian
			NOR = {
				rightful_religious_head_scope = { trait = greek_rites }
				rightful_religious_head_scope = { trait = latin_rites }
			}
		}
	}
	option = {
		name = EVTOPTC_Plus_2279
		trigger = {
			NOT = { religion = chalcedonian }
			religion_group = christian
		}
	}
}

# Rome adopts Filioque
narrative_event = {
	id = Plus.2280
	title = EVTNAME_Plus_2280
	desc = EVTDESC_Plus_2280
	picture = GFX_evt_pope
	border = GFX_event_narrative_frame_religion
	
	major = yes
	hide_from = yes
	show_ROOT = yes
	
	only_rulers = yes
	religion = chalcedonian
	
	trigger = {
		year = 900
		has_landed_title = d_pentarch_rome
		is_heretic = no
		trait = latin_rites
		NOR = {
			religion_authority = 0.75
			has_global_flag = filioque_adopted
			k_papal_state = { has_title_flag = schism_happened }
			has_global_flag = patriarch_supreme_created
			has_global_flag = disabled_schism
		}
	}
	
	major_trigger = {
		religion = chalcedonian
	}
	
	mean_time_to_happen = {
		years = 100
		modifier = {
			factor = 0.75
			year = 950
		}
		modifier = {
			factor = 0.5
			year = 1000
		}
		modifier = {
			factor = 0.5
			year = 1025
		}
		modifier = {
			factor = 0.25
			year = 1050
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.45 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.40 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.35 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.30 }
		}
	}
	
	immediate = {
		log = "SCHISM LEAD-UP: FILIOQUE ADOPTED"
		set_global_flag = filioque_adopted
		496 = { change_variable = { which = "schism_tracker" value = 1 } }
	}
	
	option = {
		name = EVTOPTA_Plus_2280
		trigger = {
			religion = chalcedonian
			rightful_religious_head_scope = { trait = greek_rites }
		}
	}
	option = {
		name = EVTOPTB_Plus_2280
		trigger = {
			religion = chalcedonian
			rightful_religious_head_scope = { trait = latin_rites }
		}
	}
	option = {
		name = EVTOPTC_Plus_2280
		trigger = {
			religion = chalcedonian
			NOR = {
				rightful_religious_head_scope = { trait = greek_rites }
				rightful_religious_head_scope = { trait = latin_rites }
			}
		}
	}
}

# Jurisdictional dispute over the Balkans
narrative_event = {
	id = Plus.2281
	title = EVTNAME_Plus_2281
	desc = EVTDESC_Plus_2281
	picture = GFX_evt_pope
	border = GFX_event_narrative_frame_religion
	
	major = yes
	hide_from = yes
	show_ROOT = yes
	
	only_rulers = yes
	religion = chalcedonian
	
	trigger = {
		has_landed_title = d_pentarch_rome
		is_heretic = no
		d_pentarch_constantinople = {
			holder_scope = {
				trait = greek_rites
				religion = ROOT
			}
		}
		any_independent_ruler = {
			religion = ROOT
			lower_real_tier_than = EMPEROR
			higher_real_tier_than = COUNT
			is_playable = yes
			mercenary = no
			holy_order = no
			is_landed = yes
			capital_scope = {
				religion = ROOT
				NOT = { empire = { title = e_byzantium } }
				kingdom = {
					OR = {
						title = k_bulgaria
						title = k_serbia
						title = k_croatia
						title = k_wallachia
					}
				}
			}
		}
		NOR = {
			has_global_flag = papal_jurisdiction_dispute
			k_papal_state = { has_title_flag = schism_happened }
			has_global_flag = patriarch_supreme_created
			has_global_flag = disabled_schism
		}
	}
	
	major_trigger = {
		religion = chalcedonian
	}
	
	mean_time_to_happen = {
		years = 50
		modifier = {
			factor = 0.5
			year = 950
		}
		modifier = {
			factor = 0.5
			year = 1000
		}
		modifier = {
			factor = 0.5
			year = 1050
		}
		modifier = {
			factor = 1.25
			religion_authority = 0.70
		}
		modifier = {
			factor = 1.25
			religion_authority = 0.80
		}
		modifier = {
			factor = 1.25
			religion_authority = 0.90
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.50 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.40 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.30 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.20 }
		}
	}
	
	immediate = {
		set_global_flag = papal_jurisdiction_dispute
		496 = { change_variable = { which = "schism_tracker" value = 1 } }
		d_pentarch_constantinople = {
			holder_scope = { save_event_target_as = current_patriarch }
		}
		random_independent_ruler = {
			limit = {
				religion = ROOT
				lower_real_tier_than = EMPEROR
				higher_real_tier_than = COUNT
				is_playable = yes
				mercenary = no
				holy_order = no
				is_landed = yes
				capital_scope = {
					religion = ROOT
					NOT = { empire = { title = e_byzantium } }
					kingdom = {
						OR = {
							title = k_bulgaria
							title = k_serbia
							title = k_croatia
							title = k_wallachia
						}
					}
				}
			}
			primary_title = { save_event_target_as = jurisdiction_realm }
		}
		log = "SCHISM LEAD-UP: PAPAL JURISDICTION DISPUTE OVER [jurisdiction_realm.GetName]"
	}
	
	option = {
		name = EVTOPTA_Plus_2281
		trigger = {
			religion = chalcedonian
			rightful_religious_head_scope = { trait = greek_rites }
		}
	}
	option = {
		name = EVTOPTB_Plus_2281
		trigger = {
			religion = chalcedonian
			rightful_religious_head_scope = { trait = latin_rites }
		}
	}
	option = {
		name = EVTOPTC_Plus_2281
		trigger = {
			religion = chalcedonian
			NOR = {
				rightful_religious_head_scope = { trait = greek_rites }
				rightful_religious_head_scope = { trait = latin_rites }
			}
		}
	}
}

# Conflict over the Eucharist
narrative_event = {
	id = Plus.2282
	title = EVTNAME_Plus_2282
	picture = GFX_evt_bishop
	border = GFX_event_narrative_frame_religion
	
	desc = {
		text = EVTDESC_Plus_2282_greek
		trigger = { ROOT = { trait = greek_rites } }
	}
	desc = {
		text = EVTDESC_Plus_2282_latin
		trigger = { ROOT = { trait = latin_rites } }
	}
	
	major = yes
	hide_from = yes
	show_ROOT = yes
	
	only_rulers = yes
	religion = chalcedonian
	min_age = 16
	capable_only = yes
	war = no
	
	trigger = {
		year = 900
		rightful_religious_head = ROOT
		is_heretic = no
		NOR = {
			has_landed_title = d_pentarch_constantinople
			has_landed_title = d_pentarch_rome
		}
		NOR = {
			liege = { war = yes }
			trait = excommunicated
			is_inaccessible_trigger = yes
			has_global_flag = eucharist_conflict
			k_papal_state = { has_title_flag = schism_happened }
			has_global_flag = patriarch_supreme_created
			has_global_flag = disabled_schism
		}
	}
	
	major_trigger = {
		religion = chalcedonian
	}
	
	mean_time_to_happen = {
		years = 50
		modifier = {
			factor = 0.5
			year = 1000
		}
		modifier = {
			factor = 0.5
			year = 1025
		}
		modifier = {
			factor = 0.5
			year = 1050
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.45 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.40 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.35 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.30 }
		}
	}
	
	immediate = {
		log = "SCHISM LEAD-UP: CONFLICT OVER THE EUCHARIST"
		set_global_flag = eucharist_conflict
		496 = { change_variable = { which = "schism_tracker" value = 1 } }
	}
	
	option = {
		name = EVTOPTA_Plus_2282
		trigger = {
			religion = chalcedonian
			rightful_religious_head_scope = { trait = greek_rites }
		}
	}
	option = {
		name = EVTOPTB_Plus_2282
		trigger = {
			religion = chalcedonian
			rightful_religious_head_scope = { trait = latin_rites }
		}
	}
	option = {
		name = EVTOPTC_Plus_2282
		trigger = {
			religion = chalcedonian
			NOR = {
				rightful_religious_head_scope = { trait = greek_rites }
				rightful_religious_head_scope = { trait = latin_rites }
			}
		}
	}
}

# Wicked Pope or Patriarch
narrative_event = {
	id = Plus.2283
	title = EVTNAME_Plus_2283
	desc = EVTDESC_Plus_2283
	picture = GFX_evt_pope
	border = GFX_event_narrative_frame_religion
	
	major = yes
	hide_from = yes
	show_ROOT = yes
	
	only_rulers = yes
	religion = chalcedonian
	
	trigger = {
		OR = {
			has_landed_title = d_pentarch_rome
			has_landed_title = d_pentarch_constantinople
		}
		is_heretic = no
		trait = bad_priest_christian
		d_pentarch_rome = {
			has_holder = yes
			holder_scope = {
				religion = ROOT
				OR = {
					character = ROOT
					NOT = { trait = bad_priest_christian }
				}
			}
		}
		d_pentarch_constantinople = {
			has_holder = yes
			holder_scope = {
				religion = ROOT
				OR = {
					character = ROOT
					NOT = { trait = bad_priest_christian }
				}
			}
		}
		NOR = {
			intrigue = 12
			496 = { check_variable = { which = "schism_tracker" value = 4 } }
			has_global_flag = wicked_pope_patriarch
			k_papal_state = { has_title_flag = schism_happened }
			has_global_flag = patriarch_supreme_created
			has_global_flag = disabled_schism
		}
	}
	
	major_trigger = {
		religion_group = christian
	}
	
	mean_time_to_happen = {
		years = 10
		modifier = {
			factor = 2
			religion_authority = 0.70
		}
		modifier = {
			factor = 2
			religion_authority = 0.80
		}
		modifier = {
			factor = 2
			religion_authority = 0.90
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.50 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.45 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.40 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.35 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.30 }
		}
	}
	
	immediate = {
		log = "SCHISM LEAD-UP: [Root.GetTitledName] IS WICKED"
		set_global_flag = wicked_pope_patriarch
		496 = { change_variable = { which = "schism_tracker" value = 1 } }
		if = {
			limit = { has_landed_title = d_pentarch_rome }
			d_pentarch_constantinople = {
				holder_scope = { save_event_target_as = other_patriarch }
			}
		}
		if = {
			limit = { has_landed_title = d_pentarch_constantinople }
			d_pentarch_rome = {
				holder_scope = { save_event_target_as = other_patriarch }
			}
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2283
	}
}
	
# Call for Ecumenical Council refused
narrative_event = {
	id = Plus.2284
	title = EVTNAME_Plus_2284
	desc = EVTDESC_Plus_2284
	picture = GFX_evt_rival_rulers
	border = GFX_event_narrative_frame_religion
	
	major = yes
	hide_from = yes
	show_ROOT = yes
	
	only_rulers = yes
	religion = chalcedonian
	
	trigger = {
		has_landed_title = d_pentarch_rome
		is_heretic = no
		war = no
		year = 1000
		496 = { is_variable_equal = { which = "schism_tracker" value = 3 } }
		d_pentarch_constantinople = {
			holder_scope = {
				war = no
				trait = greek_rites
				religion = ROOT
				NOT = { trait = excommunicated }
				NOT = { is_inaccessible_trigger = yes }
			}
		}
		NOR = {
			trait = excommunicated
			is_inaccessible_trigger = yes
			has_global_flag = ecumenical_council_refused
			k_papal_state = { has_title_flag = schism_happened }
			has_global_flag = patriarch_supreme_created
			has_global_flag = disabled_schism
		}
	}
	
	mean_time_to_happen = {
		years = 25
		modifier = {
			factor = 0.5
			year = 1025
		}
		modifier = {
			factor = 0.5
			year = 1050
		}
		modifier = {
			factor = 1.5
			religion_authority = 0.70
		}
		modifier = {
			factor = 1.5
			religion_authority = 0.80
		}
		modifier = {
			factor = 1.5
			religion_authority = 0.90
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.50 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.45 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.40 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.35 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.30 }
		}
	}
	
	immediate = {
		log = "SCHISM LEAD-UP: CALL FOR ECUMENICAL COUNCIL REFUSED"
		set_global_flag = ecumenical_council_refused
		496 = { change_variable = { which = "schism_tracker" value = 1 } }
		d_pentarch_constantinople = {
			holder_scope = { save_event_target_as = current_patriarch }
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2284
		trigger = {
			religion = chalcedonian
			rightful_religious_head_scope = { trait = greek_rites }
		}
	}
	option = {
		name = EVTOPTB_Plus_2284
		trigger = {
			religion = chalcedonian
			rightful_religious_head_scope = { trait = latin_rites }
		}
	}
	option = {
		name = EVTOPTC_Plus_2284
		trigger = {
			religion = chalcedonian
			NOR = {
				rightful_religious_head_scope = { trait = greek_rites }
				rightful_religious_head_scope = { trait = latin_rites }
			}
		}
	}
	option = {
		name = EVTOPTD_Plus_2284
		trigger = {
			NOT = { religion = chalcedonian }
			religion_group = christian
		}
	}
}

# Byzantium overrun by iconoclast or monothelite
narrative_event = {
	id = Plus.2260
	title = EVTNAME_Plus_2260
	desc = EVTDESC_Plus_2260
	picture = GFX_evt_rival_rulers
	border = GFX_event_narrative_frame_religion
	
	major = yes
	hide_from = yes
	show_ROOT = yes
	
	only_rulers = yes
	religion = chalcedonian
	war = no
	
	trigger = {
		has_landed_title = d_pentarch_rome
		is_heretic = no
		year = 850
		d_pentarch_constantinople = {
			holder_scope = {
				war = no
				OR = {
					religion = monothelite
					religion = iconoclast
				}
				top_liege = {
					tier = EMPEROR
					religion = PREV
				}
				NOT = { trait = excommunicated }
				NOT = { is_inaccessible_trigger = yes }
				religion_authority = 0.75
			}
		}
		NOR = {
			trait = excommunicated
			is_inaccessible_trigger = yes
			has_global_flag = byzantium_overrun
			k_papal_state = { has_title_flag = schism_happened }
			has_global_flag = patriarch_supreme_created
			has_global_flag = disabled_schism
		}
	}
	
	mean_time_to_happen = {
		years = 25
		modifier = {
			factor = 0.5
			year = 900
		}
		modifier = {
			factor = 0.5
			year = 950
		}
		modifier = {
			factor = 1.5
			religion_authority = 0.70
		}
		modifier = {
			factor = 1.5
			religion_authority = 0.80
		}
		modifier = {
			factor = 1.5
			religion_authority = 0.90
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.50 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.45 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.40 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.35 }
		}
		modifier = {
			factor = 0.75
			NOT = { religion_authority = 0.30 }
		}
	}
	
	immediate = {
		log = "SCHISM LEAD-UP: BYZANTIUM OVERRUN"
		set_global_flag = byzantium_overrun
		# force schism
		496 = { change_variable = { which = "schism_tracker" value = 3 } }
		d_pentarch_constantinople = {
			holder_scope = { save_event_target_as = current_patriarch }
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2260
		trigger = {
			OR = {
				AND = {
					religion = chalcedonian
					rightful_religious_head_scope = { trait = greek_rites }
				}
				religion = monothelite
				religion = iconoclast
			}
		}
	}
	option = {
		name = EVTOPTB_Plus_2260
		trigger = {
			religion = chalcedonian
			rightful_religious_head_scope = { trait = latin_rites }
		}
	}
	option = {
		name = EVTOPTC_Plus_2260
		trigger = {
			religion = chalcedonian
			NOR = {
				rightful_religious_head_scope = { trait = greek_rites }
				rightful_religious_head_scope = { trait = latin_rites }
			}
		}
	}
	option = {
		name = EVTOPTD_Plus_2260
		trigger = {
			NOT = {
				religion = chalcedonian
				religion = monothelite
				religion = iconoclast
			}
			religion_group = christian
		}
	}
}

### THE SCHISM OCCURS

# Check for the Schism
character_event = {
	id = Plus.2285
	
	hide_window = yes
	
	only_rulers = yes
	religion = chalcedonian
	
	trigger = {
		OR = {
			AND = {
				year = 950
				has_landed_title = d_pentarch_rome
				is_heretic = no
				trait = latin_rites
				d_pentarch_constantinople = {
					holder_scope = {
						OR = {
							AND = {
								trait = greek_rites
								religion = ROOT
							}
							AND = {
								has_global_flag = byzantium_overrun
								religion = monothelite
							}
							AND = {
								has_global_flag = byzantium_overrun
								religion = iconoclast
							}
						}
					}
				}
				496 = { check_variable = { which = "schism_tracker" value = 3.9 } }
				NOR = {
					k_papal_state = { has_title_flag = schism_happened }
					has_global_flag = schism_happening
					has_global_flag = patriarch_supreme_created
					has_global_flag = disabled_schism
				}
			}
			has_global_flag = schism_manual_override
		}
	}
	
	mean_time_to_happen = {
		years = 100
		modifier = {
			factor = 0.5
			year = 1000
		}
		modifier = {
			factor = 0.5
			year = 1050
		}
		modifier = {
			factor = 0.5
			year = 1100
		}	
		modifier = {
			factor = 0.5
			496 = { check_variable = { which = "schism_tracker" value = 4.9 } }
		}
		modifier = {
			factor = 0.5
			496 = { check_variable = { which = "schism_tracker" value = 5.9 } }
		}
		modifier = {
			factor = 0.5
			496 = { check_variable = { which = "schism_tracker" value = 6.9 } }
		}
		modifier = {
			factor = 0.5
			has_global_flag = byzantium_overrun
		}
	}
	
	immediate = {
		set_global_flag = schism_happening
		if = {
			# Required for NWO's "Schismatic Christians" start. Creates a new Pope entirely
			limit = {
				has_global_flag = schism_manual_override
				d_pentarch_rome = { has_holder = no }
			}
			create_character = {
				random_traits = yes
				age = 60
				female = no
				culture = italian
				religion = catholic
				dynasty = random
				trait = latin_rites
			}
			new_character = {
				b_roma = {
					grant_title = PREV
				}
				d_pentarch_rome = {
					grant_title = PREV
				}
			}
		}
		if = {
			# Required for NWO's "Schismatic Christians" start. Creates a new Patriarch entirely
			limit = {
				has_global_flag = schism_manual_override
				d_pentarch_constantinople = { has_holder = no }
			}
			create_character = {
				random_traits = yes
				age = 60
				female = no
				culture = greek
				religion = orthodox
				dynasty = random
				trait = greek_rites
			}
			new_character = {
				b_hagiasophia = {
					grant_title = PREV
				}
				d_pentarch_constantinople = {
					grant_title = PREV
				}
			}
		}
		d_pentarch_rome = {
			holder_scope = {
				save_event_target_as = schism_pope
				add_character_modifier = {
					modifier = do_not_disturb
					hidden = yes
					duration = 5
				}
			}
		}
		d_pentarch_constantinople = {
			holder_scope = {
				save_event_target_as = current_patriarch
				add_character_modifier = {
					modifier = do_not_disturb
					hidden = yes
					duration = 5
				}
			}
		}
		any_character = {
			limit = {
				is_ruler = yes
				top_liege = { character = PREV }
			}
			narrative_event = { id = Plus.2286 } #choose whether to convert
		}
		496 = {
			province_event = { id = Plus.2287 days = 5 } # Actually convert all the religions
		}
	}
}

# Rulers informed - become Catholic or Orthodox?
narrative_event = {
	id = Plus.2286
	title = EVTNAME_Plus_2286
	desc = EVTDESC_Plus_2286
	picture = GFX_evt_great_schism
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes
	hide_from = yes
	
	immediate = {
		any_vassal = {
			limit = { is_playable = yes }
			narrative_event = { id = Plus.2286 days = 1 } #conversion choice
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2286 #Become Catholic
		trigger = {
			OR = {
				religion = chalcedonian
				secret_religion = chalcedonian
			}			
			NOR = {
				trait = greek_rites
				trait = latin_rites
			}
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0
				OR = {
					rightful_religious_head_scope = { trait = greek_rites }
					has_landed_title = e_byzantium
				}
			}
			modifier = {
				factor = 0.15
				liege = { religion = orthodox }
			}
			modifier = {
				factor = 0.15
				liege = { secret_religion = orthodox }
			}
			modifier = {
				factor = 0.25
				NOT = { liege = { religion = orthodox } }
				capital_scope = {
					NOR = {
						region = world_europe_west
						region = world_europe_north
						region = world_europe_south_italy
						region = world_africa_west
						region = custom_morocco
						region = custom_algiers
						region = custom_africa
						region = custom_croatia
						region = custom_poland
						region = custom_carpathia
					}
				}
			}
			modifier = {
				factor = 0.25
				trait = varangian
			}
			modifier = {
				factor = 0.1
				OR = {
					any_liege = { trait = greek_rites }
					culture = greek
				}
			}
		}
		
		if = {
			limit = {
				religion = chalcedonian
			}
			religion = catholic
		}
		if = {
			limit = {
				secret_religion = chalcedonian
			}
			set_secret_religion = catholic
		}
		hidden_tooltip = {
			any_demesne_title = {
				limit = {
					tier = COUNT
					location = { religion = chalcedonian }
				}
				location = { set_province_flag = convert_to_catholic }
			}
			any_demesne_title = {
				limit = {
					tier = COUNT
					location = { has_province_modifier = secret_chalcedonian_community }
				}
				location = {
					remove_province_modifier = secret_chalcedonian_community
					add_province_modifier = { name = secret_catholic_community duration = -1 }
				}
			}
			any_courtier = {
				limit = {
					religion = chalcedonian
					is_ruler = no
					NOT = { trait = greek_rites }
					NOT = { trait = latin_rites }
				}
				religion = catholic
			}
			any_courtier = {
				limit = {
					secret_religion = chalcedonian
					is_ruler = no
					NOT = { trait = greek_rites }
					NOT = { trait = latin_rites }
				}
				set_secret_religion = catholic
				
			}
			any_vassal = {
				limit = {
					religion = chalcedonian
					is_playable = no
				}
				if = {
					limit = {
						NOT = { trait = greek_rites }
						NOT = { trait = latin_rites }
					}
					religion = catholic
				}
				any_courtier = {
					limit = {
						religion = chalcedonian
						NOT = { trait = greek_rites }
						NOT = { trait = latin_rites }
					}
					religion = catholic
				}
			}
			any_vassal = {
				limit = {
					secret_religion = chalcedonian
					is_playable = no
				}
				if = {
					limit = {
						NOT = { trait = greek_rites }
						NOT = { trait = latin_rites }
					}
					set_secret_religion = catholic
					
				}
				any_courtier = {
					limit = {
						secret_religion = chalcedonian
						NOT = { trait = greek_rites }
						NOT = { trait = latin_rites }
					}
					set_secret_religion = catholic
					
				}
			}
		}
	}
	option = {
		name = EVTOPTB_Plus_2286 #Become Orthodox
		trigger = {
			OR = {
				religion = chalcedonian
				secret_religion = chalcedonian
			}
			NOR = {
				trait = greek_rites
				trait = latin_rites
			}
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0
				rightful_religious_head_scope = { trait = latin_rites }
				has_landed_title = e_hre
			}
			modifier = {
				factor = 0.15
				liege = { religion = catholic }
			}
			modifier = {
				factor = 0.15
				liege = { secret_religion = catholic }
			}
			modifier = {
				factor = 0.25
				NOT = { liege = { religion = catholic } }
				capital_scope = {
					OR = {
						region = world_europe_west
						region = world_europe_north
						region = world_europe_south_italy
						region = world_africa_west
						region = custom_morocco
						region = custom_algiers
						region = custom_africa
						region = custom_croatia
						region = custom_poland
						region = custom_carpathia
					}
				}
			}
			modifier = {
				factor = 0.1
				OR = {
					any_liege = { trait = latin_rites }
					culture = italian
					culture = longobard
				}
			}
		}
		
		if = {
			limit = {
				religion = chalcedonian
			}
			religion = orthodox
		}
		if = {
			limit = {
				secret_religion = chalcedonian
			}
			set_secret_religion = orthodox
			
		}
		hidden_tooltip = {
			any_demesne_title = {
				limit = {
					tier = COUNT
					location = { religion = chalcedonian }
				}
				location = { set_province_flag = convert_to_orthodox }
			}
			any_demesne_title = {
				limit = {
					tier = COUNT
					location = { has_province_modifier = secret_chalcedonian_community }
				}
				location = {
					remove_province_modifier = secret_chalcedonian_community
					add_province_modifier = { name = secret_orthodox_community duration = -1 }
				}
			}
			any_courtier = {
				limit = {
					religion = chalcedonian
					is_ruler = no
					NOT = { trait = greek_rites }
					NOT = { trait = latin_rites }
				}
				religion = orthodox
			}
			any_courtier = {
				limit = {
					secret_religion = chalcedonian
					is_ruler = no
					NOT = { trait = greek_rites }
					NOT = { trait = latin_rites }
				}
				set_secret_religion = orthodox
				
			}
			any_vassal = {
				limit = {
					religion = chalcedonian
					is_playable = no
				}
				if = {
					limit = {
						NOT = { trait = greek_rites }
						NOT = { trait = latin_rites }
					}
					religion = orthodox
				}
				any_courtier = {
					limit = {
						religion = chalcedonian
						NOT = { trait = greek_rites }
						NOT = { trait = latin_rites }
					}
					religion = orthodox
				}
			}
			any_vassal = {
				limit = {
					secret_religion = chalcedonian
					is_playable = no
				}
				if = {
					limit = {
						NOT = { trait = greek_rites }
						NOT = { trait = latin_rites }
					}
					set_secret_religion = orthodox
					
				}
				any_courtier = {
					limit = {
						secret_religion = chalcedonian
						NOT = { trait = greek_rites }
						NOT = { trait = latin_rites }
					}
					set_secret_religion = orthodox
					
				}
			}
		}
	}
	option = {
		name = EVTOPTC_Plus_2286 #This is of great concern...
		trigger = {
			religion = chalcedonian
			OR = {
				trait = greek_rites
				trait = latin_rites
			}
		}
		if = {
			limit = { trait = latin_rites }
			hidden_tooltip = {
				any_demesne_title = {
					limit = {
						tier = COUNT
						location = { religion = chalcedonian }
					}
					location = { set_province_flag = convert_to_catholic }
				}
				any_demesne_title = {
					limit = {
						tier = COUNT
						location = { has_province_modifier = secret_chalcedonian_community }
					}
					location = {
						remove_province_modifier = secret_chalcedonian_community
						add_province_modifier = { name = secret_catholic_community duration = -1 }
					}
				}
				any_courtier = {
					limit = {
						religion = chalcedonian
						is_ruler = no
						NOT = { trait = greek_rites }
						NOT = { trait = latin_rites }
					}
					religion = catholic
				}
				any_courtier = {
					limit = {
						secret_religion = chalcedonian
						is_ruler = no
						NOT = { trait = greek_rites }
						NOT = { trait = latin_rites }
					}
					set_secret_religion = catholic
					
				}
				any_vassal = {
					limit = {
						religion = chalcedonian
						is_playable = no
					}
					if = {
						limit = {
							NOT = { trait = greek_rites }
							NOT = { trait = latin_rites }
						}
						religion = catholic
					}
					any_courtier = {
						limit = {
							religion = chalcedonian
							NOT = { trait = greek_rites }
							NOT = { trait = latin_rites }
						}
						religion = catholic
					}
				}
				any_vassal = {
					limit = {
						secret_religion = chalcedonian
						is_playable = no
					}
					if = {
						limit = {
							NOT = { trait = greek_rites }
							NOT = { trait = latin_rites }
						}
						set_secret_religion = catholic
						
					}
					any_courtier = {
						limit = {
							secret_religion = chalcedonian
							NOT = { trait = greek_rites }
							NOT = { trait = latin_rites }
						}
						set_secret_religion = catholic
						
					}
				}
			}
		}
		if = {
			limit = { trait = greek_rites }
			hidden_tooltip = {
				any_demesne_title = {
					limit = {
						tier = COUNT
						location = { religion = chalcedonian }
					}
					location = { set_province_flag = convert_to_orthodox }
				}
				any_demesne_title = {
					limit = {
						tier = COUNT
						location = { has_province_modifier = secret_chalcedonian_community }
					}
					location = {
						remove_province_modifier = secret_chalcedonian_community
						add_province_modifier = { name = secret_orthodox_community duration = -1 }
					}
				}
				any_courtier = {
					limit = {
						religion = chalcedonian
						is_ruler = no
						NOT = { trait = greek_rites }
						NOT = { trait = latin_rites }
					}
					religion = orthodox
				}
				any_courtier = {
					limit = {
						secret_religion = chalcedonian
						is_ruler = no
						NOT = { trait = greek_rites }
						NOT = { trait = latin_rites }
					}
					set_secret_religion = orthodox
					
				}
				any_vassal = {
					limit = {
						religion = chalcedonian
						is_playable = no
					}
					if = {
						limit = {
							NOT = { trait = greek_rites }
							NOT = { trait = latin_rites }
						}
						religion = orthodox
					}
					any_courtier = {
						limit = {
							religion = chalcedonian
							NOT = { trait = greek_rites }
							NOT = { trait = latin_rites }
						}
						religion = orthodox
					}
				}
				any_vassal = {
					limit = {
						secret_religion = chalcedonian
						is_playable = no
					}
					if = {
						limit = {
							NOT = { trait = greek_rites }
							NOT = { trait = latin_rites }
						}
						set_secret_religion = orthodox
						
					}
					any_courtier = {
						limit = {
							secret_religion = chalcedonian
							NOT = { trait = greek_rites }
							NOT = { trait = latin_rites }
						}
						set_secret_religion = orthodox
						
					}
				}
			}
		}
	}
	option = {
		name = EVTOPTD_Plus_2286 #Nothing to do with me
		trigger = {
			NOR = {
				religion = chalcedonian
				secret_religion = chalcedonian
			}
		}
		hidden_tooltip = {
			any_demesne_title = {
				limit = {
					tier = COUNT
					location = {
						religion = chalcedonian
						OR = {
							region = world_europe_west
							region = world_europe_north
							region = world_europe_south_italy
							region = world_africa_west
							region = custom_morocco
							region = custom_algiers
							region = custom_africa
							region = custom_croatia
							region = custom_poland
							region = custom_carpathia
						}
					}
				}
				location = { set_province_flag = convert_to_catholic }
			}
			any_demesne_title = {
				limit = {
					tier = COUNT
					location = {
						OR = {
							region = world_europe_west
							region = world_europe_north
							region = world_europe_south_italy
							region = world_africa_west
							region = custom_morocco
							region = custom_algiers
							region = custom_africa
							region = custom_croatia
							region = custom_poland
							region = custom_carpathia
						}
						has_province_modifier = secret_chalcedonian_community
					}
				}
				location = {
					remove_province_modifier = secret_chalcedonian_community
					add_province_modifier = { name = secret_catholic_community duration = -1 }
				}
			}
			any_courtier = {
				limit = {
					religion = chalcedonian
					is_ruler = no
					NOT = { trait = greek_rites }
					NOT = { trait = latin_rites }
					OR = {
						rightful_religious_head_scope = { trait = latin_rites }
						AND = {
							NOT = { rightful_religious_head_scope = { trait = latin_rites } }
							NOT = { rightful_religious_head_scope = { trait = greek_rites } }
							location = {
								OR = {
									region = world_europe_west
									region = world_europe_north
									region = world_europe_south_italy
									region = world_africa_west
									region = custom_morocco
									region = custom_algiers
									region = custom_africa
									region = custom_croatia
									region = custom_poland
									region = custom_carpathia
								}
							}
						}
					}
				}
				religion = catholic
			}
			any_courtier = {
				limit = {
					secret_religion = chalcedonian
					is_ruler = no
					location = {
						OR = {
							region = world_europe_west
							region = world_europe_north
							region = world_europe_south_italy
							region = world_africa_west
							region = custom_morocco
							region = custom_algiers
							region = custom_africa
							region = custom_croatia
							region = custom_poland
							region = custom_carpathia
							has_province_modifier = secret_catholic_community
						}
					}
				}
				set_secret_religion = catholic
				
			}
			any_vassal = {
				limit = {
					religion = chalcedonian
					is_playable = no
				}
				if = {
					limit = {
						OR = {
							rightful_religious_head_scope = { trait = latin_rites }
							AND = {
								NOT = { rightful_religious_head_scope = { trait = latin_rites } }
								NOT = { rightful_religious_head_scope = { trait = greek_rites } }
								location = {
									OR = {
										region = world_europe_west
										region = world_europe_north
										region = world_europe_south_italy
										region = world_africa_west
										region = custom_morocco
										region = custom_algiers
										region = custom_africa
										region = custom_croatia
										region = custom_poland
										region = custom_carpathia
									}
								}
							}
						}
					}
					if = {
						limit = {
							NOT = { trait = greek_rites }
							NOT = { trait = latin_rites }
						}
						religion = catholic
					}
					any_courtier = {
						limit = {
							religion = chalcedonian
							NOT = { trait = greek_rites }
							NOT = { trait = latin_rites }
						}
						religion = catholic
					}
					any_courtier = {
						limit = {
							secret_religion = chalcedonian
						}
						set_secret_religion = catholic
							
					}
				}
			}
			any_vassal = {
				limit = {
					secret_religion = chalcedonian
					is_playable = no
				}
				if = {
					limit = {
						location = {
							OR = {
								region = world_europe_west
								region = world_europe_north
								region = world_europe_south_italy
								region = world_africa_west
								region = custom_morocco
								region = custom_algiers
								region = custom_africa
								region = custom_croatia
								region = custom_poland
								region = custom_carpathia
								has_province_modifier = secret_catholic_community
							}
						}
					}
					set_secret_religion = catholic
						
					any_courtier = {
						limit = {
							secret_religion = chalcedonian
						}
						set_secret_religion = catholic
					}
					any_courtier = {
						limit = {
							religion = chalcedonian
							NOT = { trait = greek_rites }
							NOT = { trait = latin_rites }
						}
						religion = catholic
					}
				}
			}
			any_demesne_title = {
				limit = {
					tier = COUNT
					location = {
						religion = chalcedonian
						NOR = {
							region = world_europe_west
							region = world_europe_north
							region = world_europe_south_italy
							region = world_africa_west
							region = custom_morocco
							region = custom_algiers
							region = custom_africa
							region = custom_croatia
							region = custom_poland
							region = custom_carpathia
						}
					}
				}
				location = { set_province_flag = convert_to_orthodox }
			}
			any_demesne_title = {
				limit = {
					tier = COUNT
					location = {
						NOR = {
							region = world_europe_west
							region = world_europe_north
							region = world_europe_south_italy
							region = world_africa_west
							region = custom_morocco
							region = custom_algiers
							region = custom_africa
							region = custom_croatia
							region = custom_poland
							region = custom_carpathia
						}
						has_province_modifier = secret_chalcedonian_community
					}
				}
				location = {
					remove_province_modifier = secret_chalcedonian_community
					add_province_modifier = { name = secret_orthodox_community duration = -1 }
				}
			}
			any_courtier = {
				limit = {
					religion = chalcedonian
					is_ruler = no
					NOT = { trait = greek_rites }
					NOT = { trait = latin_rites }
					OR = {
						rightful_religious_head_scope = { trait = greek_rites }
						AND = {
							NOT = { rightful_religious_head_scope = { trait = latin_rites } }
							NOT = { rightful_religious_head_scope = { trait = greek_rites } }
							location = {
								NOR = {
									region = world_europe_west
									region = world_europe_north
									region = world_europe_south_italy
									region = world_africa_west
									region = custom_morocco
									region = custom_algiers
									region = custom_africa
									region = custom_croatia
									region = custom_poland
									region = custom_carpathia
								}
							}
						}
					}
				}
				religion = orthodox
			}
			any_courtier = {
				limit = {
					secret_religion = chalcedonian
					is_ruler = no
					location = {
						OR = {
							NOR = {
								region = world_europe_west
								region = world_europe_north
								region = world_europe_south_italy
								region = world_africa_west
								region = custom_morocco
								region = custom_algiers
								region = custom_africa
								region = custom_croatia
								region = custom_poland
								region = custom_carpathia
							}
							has_province_modifier = secret_orthodox_community
						}
					}
				}
				set_secret_religion = orthodox
				
			}
			any_vassal = {
				limit = {
					religion = chalcedonian
					is_playable = no
				}
				if = {
					limit = {
						OR = {
							rightful_religious_head_scope = { trait = greek_rites }
							AND = {
								NOT = { rightful_religious_head_scope = { trait = latin_rites } }
								NOT = { rightful_religious_head_scope = { trait = greek_rites } }
								location = {
									NOR = {
										region = world_europe_west
										region = world_europe_north
										region = world_europe_south_italy
										region = world_africa_west
										region = custom_morocco
										region = custom_algiers
										region = custom_africa
										region = custom_croatia
										region = custom_poland
										region = custom_carpathia
									}
								}
							}
						}
					}
					if = {
						limit = {
							NOT = { trait = greek_rites }
							NOT = { trait = latin_rites }
						}
						religion = orthodox
					}
					any_courtier = {
						limit = {
							religion = chalcedonian
							NOT = { trait = greek_rites }
							NOT = { trait = latin_rites }
						}
						religion = orthodox
					}
					any_courtier = {
						limit = {
							secret_religion = chalcedonian
						}
						set_secret_religion = orthodox
							
					}
				}
			}
			any_vassal = {
				limit = {
					secret_religion = chalcedonian
					is_playable = no
				}
				if = {
					limit = {
						location = {
							OR = {
								NOR = {
									region = world_europe_west
									region = world_europe_north
									region = world_europe_south_italy
									region = world_africa_west
									region = custom_morocco
									region = custom_algiers
									region = custom_africa
									region = custom_croatia
									region = custom_poland
									region = custom_carpathia
								}
								has_province_modifier = secret_orthodox_community
							}
						}
					}
					set_secret_religion = orthodox
					
					any_courtier = {
						limit = {
							secret_religion = chalcedonian
						}
						set_secret_religion = orthodox
							
					}
					any_courtier = {
						limit = {
							religion = chalcedonian
							NOT = { trait = greek_rites }
							NOT = { trait = latin_rites }
						}
						religion = orthodox
					}
				}
			}
		}
	}
}

# Finish the Schism
province_event = {
	id = Plus.2287
	
	is_triggered_only = yes
	hide_window = yes
	
	immediate = {
		log = "GREAT SCHISM HAPPENED"
		clr_global_flag = schism_happening
		clr_global_flag = attacked_by_papal_emperor
		clr_global_flag = filioque_adopted
		clr_global_flag = papal_jurisdiction_dispute
		clr_global_flag = eucharist_conflict
		clr_global_flag = wicked_pope_patriarch
		clr_global_flag = ecumenical_council_refused
		clr_global_flag = schism_manual_override
		k_papal_state = { set_title_flag = schism_happened }
		
		# reset catholic/orthodox heresies
		set_parent_religion = { religion = cathar parent = catholic }
		set_parent_religion = { religion = waldensian parent = catholic }
		set_parent_religion = { religion = lollard parent = catholic }
		set_parent_religion = { religion = adoptionist parent = catholic }
		set_parent_religion = { religion = iconoclast parent = orthodox }
		set_parent_religion = { religion = monothelite parent = orthodox }
		if = {
			limit = {
				NOT = { is_title_active = d_bogomilist }
			}
			set_parent_religion = { religion = bogomilist parent = orthodox }
		}
		set_parent_religion = { religion = chalcedonian parent = 0 }
		
		# reset catholic/orthodox holy orders
		if = {
			limit = { d_knights_calatrava = { has_holder = yes } }
			d_knights_calatrava = {
				religion = catholic
				holder_scope = {
					religion = catholic
					any_courtier = { religion = catholic }
				}
			}
		}
		if = {
			limit = { d_knights_hospitaler = { has_holder = yes } }
			d_knights_hospitaler = {
				religion = catholic
				holder_scope = {
					religion = catholic
					any_courtier = { religion = catholic }
				}
			}
		}
		if = {
			limit = { d_knights_santiago = { has_holder = yes } }
			d_knights_santiago = {
				religion = catholic
				holder_scope = {
					religion = catholic
					any_courtier = { religion = catholic }
				}
			}
		}
		if = {
			limit = { d_knights_templar = { has_holder = yes } }
			d_knights_templar = {
				religion = catholic
				holder_scope = {
					religion = catholic
					any_courtier = { religion = catholic }
				}
			}
		}
		if = {
			limit = { d_teutonic_order = { has_holder = yes } }
			d_teutonic_order = {
				religion = catholic
				holder_scope = {
					religion = catholic
					any_courtier = { religion = catholic }
				}
			}
		}
		if = {
			limit = { d_holy_sepulchre = { has_holder = yes } }
			d_holy_sepulchre = {
				religion = orthodox
				holder_scope = {
					religion = orthodox
					any_courtier = { religion = orthodox }
				}
			}
		}
		
		#add new religion heads, destroy old titles
		activate_title = { title = k_papal_state status = yes }
		activate_title = { title = k_orthodox status = yes }
		d_pentarch_rome = {
			holder_scope = {
				any_liege = {
					limit = { tier = EMPEROR }
					save_event_target_as = new_liege
				}
				religion = catholic
				remove_trait = latin_rites
				unsafe_destroy_landed_title = THIS
				k_papal_state = {
					copy_title_history = k_papal_chalcedon
					gain_title = PREV
				}
				if = {
					limit = { event_target:new_liege = { is_alive = yes } }
					set_defacto_liege = event_target:new_liege
					pf_liege_change_effect = yes
				}
			}
		}
		if = {
			limit = {
				d_pentarch_constantinople = {
					holder_scope = { religion = chalcedonian }
					NOT = { has_global_flag = byzantium_overrun }
				}
			}
			d_pentarch_constantinople = {
				holder_scope = {
					any_liege = {
						limit = { tier = EMPEROR }
						save_event_target_as = new_liege
					}
					religion = orthodox
					remove_trait = greek_rites
					k_orthodox = {
						copy_title_history = d_pentarch_constantinople
						gain_title = PREV
					}
					event_target:new_liege = { set_defacto_vassal = PREV }
					pf_liege_change_effect = yes
				}
			}
		}
		
		k_papal_chalcedon = {
			unsafe_destroy_landed_title = THIS
			activate_title = { title = THIS status = no }
		}
		
		#convert provinces and remaining Chalcedonians
		any_title = {
			limit = {
				has_holder = yes
				mercenary = no
				is_primary_holder_title = yes
				holder_scope = { top_liege = { character = PREV } }
			}
			holder_scope = {
				if = {
					limit = { trait = greek_rites }
					remove_trait = greek_rites
					religion = orthodox
				}
				if = {
					limit = { trait = latin_rites }
					remove_trait = latin_rites
					religion = catholic
				}
				if = {
					limit = { religion = chalcedonian }
					religion = catholic
				}
				any_realm_character = {
					limit = {
						OR = {
							trait = greek_rites
							trait = latin_rites
						}
					}
					if = {
						limit = { trait = greek_rites }
						remove_trait = greek_rites
						religion = orthodox
					}
					if = {
						limit = { trait = latin_rites }
						remove_trait = latin_rites
						religion = catholic
					}
				}
				any_realm_character = {
					limit = { religion = chalcedonian }
					liege = { reverse_religion = PREV }
				}
				any_realm_province = {
					if = {
						limit = { has_province_flag = convert_to_catholic }
						clr_province_flag = convert_to_catholic
						if = {
							limit = { religion = chalcedonian }
							religion = catholic
						}
					}
					if = {
						limit = { has_province_flag = convert_to_orthodox }
						clr_province_flag = convert_to_orthodox
						if = {
							limit = { religion = chalcedonian }
							religion = orthodox
						}
					}
				}
			}
		}
			
		#adjust mercenaries
		any_title = {
			limit = {
				mercenary = yes
				capital_scope = { religion = orthodox }
				holder_scope = { religion = chalcedonian }
			}
			religion = orthodox
			holder_scope = {
				religion = orthodox
				any_courtier = { religion = orthodox }
			}
		}
		any_title = {
			limit = {
				mercenary = yes
				holder_scope = { religion = chalcedonian }
			}
			religion = catholic
			holder_scope = {
				religion = catholic
				any_courtier = { religion = catholic }
			}
		}
	}
}

### PATRIARCH SUPREME

# Patriarch Supreme appointed
narrative_event = {
	id = Plus.2288
	title = EVTNAME_Plus_2288
	picture = GFX_evt_pope
	border = GFX_event_narrative_frame_religion
	
	desc = {
		text = EVTDESC_Plus_2288_pope1
		trigger = {
			ROOT = { trait = latin_rites }
			FROM = { NOT = { character = ROOT } }
		}
	}
	desc = {
		text = EVTDESC_Plus_2288_pope2
		trigger = {
			ROOT = { trait = latin_rites }
			FROM = { character = ROOT }
		}
	}
	desc = {
		text = EVTDESC_Plus_2288_patriarch1
		trigger = {
			ROOT = { trait = greek_rites }
			FROM = { NOT = { character = ROOT } }
		}
	}
	desc = {
		text = EVTDESC_Plus_2288_patriarch2
		trigger = {
			ROOT = { trait = greek_rites }
			FROM = { character = ROOT }
		}
	}
	
	major = yes
	hide_from = yes
	show_ROOT = yes	
	is_triggered_only = yes
	
	immediate = {
		log = "[Root.GetTitledName] has been appointed Supreme Patriarch"
		k_papal_chalcedon = {
			conquest_culture = FROM
			activate_title = { title = THIS status = no }
			unsafe_destroy_landed_title = THIS
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2288
		trigger = {
			religion = chalcedonian
		}
	}
	option = {
		name = EVTOPTB_Plus_2288
		trigger = {
			religion_group = christian
			NOT = { religion = chalcedonian }
		}
	}
	option = {
		name = EVTOPTC_Plus_2288
		trigger = {
			NOT = { religion_group = christian }
		}
	}
}

# Relations between Greek/Latin realms
character_event = {
	id = Plus.2289
	
	hide_window = yes
	is_triggered_only = yes
	
	only_independent = yes
	religion = chalcedonian
	
	trigger = {
		OR = {
			NOT = { has_character_flag = check_greek_latin }
			had_character_flag = { flag = check_greek_latin days = 365 }
		}
		NOR = {
			k_papal_state = { has_title_flag = schism_happened }
			has_global_flag = patriarch_supreme_created
		}
	}
	
	immediate = {
		set_character_flag = check_greek_latin
		if = {
			limit = { rightful_religious_head_scope = { trait = greek_rites } }
			any_independent_ruler = {
				limit = { rightful_religious_head_scope = { trait = latin_rites } }
				if = {
					limit = { NOT = { has_opinion_modifier = { who = ROOT modifier = greek_latin_relations } } }
					opinion = { who = ROOT modifier = greek_latin_relations years = 100 }
				}
				if = {
					limit = { NOT = { reverse_has_opinion_modifier = { who = ROOT modifier = greek_latin_relations } } }
					reverse_opinion = { who = ROOT modifier = greek_latin_relations years = 100 }
				}
			}
			any_independent_ruler = {
				limit = { rightful_religious_head_scope = { trait = greek_rites } }
				if = {
					limit = { has_opinion_modifier = { who = ROOT modifier = greek_latin_relations } }
					remove_opinion = { who = ROOT modifier = greek_latin_relations }
				}
				if = {
					limit = { reverse_has_opinion_modifier = { who = ROOT modifier = greek_latin_relations } }
					reverse_remove_opinion = { who = ROOT modifier = greek_latin_relations }
				}
			}
		}
		if = {
			limit = { rightful_religious_head_scope = { trait = latin_rites } }
			any_independent_ruler = {
				limit = { rightful_religious_head_scope = { trait = greek_rites } }
				if = {
					limit = { NOT = { has_opinion_modifier = { who = ROOT modifier = greek_latin_relations } } }
					opinion = { who = ROOT modifier = greek_latin_relations years = 100 }
				}
				if = {
					limit = { NOT = { reverse_has_opinion_modifier = { who = ROOT modifier = greek_latin_relations } } }
					reverse_opinion = { who = ROOT modifier = greek_latin_relations years = 100 }
				}
			}
			any_independent_ruler = {
				limit = { rightful_religious_head_scope = { trait = latin_rites } }
				if = {
					limit = { has_opinion_modifier = { who = ROOT modifier = greek_latin_relations } }
					remove_opinion = { who = ROOT modifier = greek_latin_relations }
				}
				if = {
					limit = { reverse_has_opinion_modifier = { who = ROOT modifier = greek_latin_relations } }
					reverse_remove_opinion = { who = ROOT modifier = greek_latin_relations }
				}
			}
		}
	}
}
	
# Chalcedonian Pope/Patriarch dies
character_event = {
	id = Plus.2290
	
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		is_theocracy = yes
		OR = {
			has_landed_title = d_pentarch_rome
			has_landed_title = d_pentarch_constantinople
			has_landed_title = d_pentarch_jerusalem
			has_landed_title = d_pentarch_antioch
			has_landed_title = d_pentarch_alexandria
		}
		OR = {
			NOT = { has_landed_title = k_papal_chalcedon }
			NOT = {
				chalc_cardinal = {
					is_alive = yes
					prisoner = no
					NOT = { trait = incapable }
				}
			}
		}
		current_heir = {
			ai = yes
			NOT = { religion = ROOT }
		}
	}
	
	immediate = {
		current_heir = {
			religion = ROOT
		}
	}
}

### CHALCEDONIAN CARDINALS

# Notification that a vassal has been appointed Cardinal
character_event = {
	id = Plus.2291
	desc = EVTDESC_Plus_2291
	picture = GFX_evt_bishop
	
	is_triggered_only = yes
	notification = yes

	option = {
		name = OK
	}
}

# Notification that a Cardinal has been appointed
character_event = {
	id = Plus.2292
	desc = EVTDESC_Plus_2292
	picture = GFX_evt_bishop
	
	is_triggered_only = yes
	notification = yes

	option = {
		name = OK
	}
	
	after = {
		clear_event_target = current_pope
	}
}

# Cardinal loses title
character_event = {
	id = Plus.2293
	
	hide_window = yes
	has_character_flag = is_chalcedonian_cardinal
	
	trigger = {
		OR = {
			NOT = { trait = chalc_cardinal }
			NOT = { religion = chalcedonian }
			is_theocracy = no
			is_ruler = no
			trait = incapable
			k_chalcedonian = { has_holder = yes }
			AND = {
				k_papal_chalcedon = { has_holder = yes }
				NOT = { rightful_religious_head_scope = { has_landed_title = k_papal_chalcedon } }
			}
		}
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	immediate = {
		clr_character_flag = is_chalcedonian_cardinal
		remove_special_character_title = CHALCEDONIAN_CARDINAL
		remove_trait = chalc_cardinal
	}
}

# Pope dies, there is a cardinal
character_event = {
	id = Plus.2294
	
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		has_landed_title = k_papal_chalcedon
		chalc_cardinal = {
			is_alive = yes
			prisoner = no
			NOT = { trait = incapable }
		}
	}
	
	immediate = {
		log = "[Root.GetTitledName] has died - Chalcedonian Pope succession"
	
		#save titles to be taken by the new pope
		any_demesne_title = { set_title_flag = to_new_pope }
		
		#pick successor randomly
		chalc_cardinal = {
			limit = {
				is_alive = yes
				prisoner = no
				NOT = { trait = incapable }
			}

			any_demesne_title = { set_title_flag = former_pope_titles }
			abdicate = yes
			
			#remove cardinal status
			clr_character_flag = is_chalcedonian_cardinal
			remove_special_character_title = CHALCEDONIAN_CARDINAL
			remove_trait = chalc_cardinal
			
			#remove claims to old titles
			any_title = {
				limit = { has_title_flag = former_pope_titles }
				clr_title_flag = former_pope_titles
				remove_claim = PREV
			}
			#Create temp title to keep pope's portrait nice.
			activate_title = { title = k_interim_papacy status = yes }
			k_interim_papacy = {
				copy_title_history = k_papal_chalcedon
				grant_title_no_opinion = PREV
			}
			set_government_type = theocracy_government
		}
		
		#notify the player
		any_playable_ruler = {
			limit = {
				ai = no
				religion = chalcedonian
				rightful_religious_head = ROOT
			}
			character_event = { id = Plus.2296 days = 2 }
		}
		d_miaphysite = { owner = { character_event = { id = Plus.2295 days = 1 } } }
	}
}

# Bounce event for new Pope
character_event = {
	id = Plus.2295
	
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		k_interim_papacy = {
			owner = {
				k_papal_chalcedon = {					
					owner = {
						any_demesne_title = {
							limit = { has_title_flag = to_new_pope }
							clr_title_flag = to_new_pope
							grant_title_no_opinion = PREVPREVPREV
						}
					}
					PREV = { set_government_type = theocracy_government }
					make_primary_title = yes
					copy_title_history = k_interim_papacy
				}
				if = {
					limit = { has_landed_title = c_roma }
					c_roma = { PREV = { capital = PREV } }
				}
				
				#give the proper pope title
				if = {
					limit = { has_landed_title = d_pentarch_rome }
					set_special_character_title = POPE
					set_character_flag = has_title_pope
				}

				#give the pope the papal dynasty, if they have none
				if = {
					limit = { dynasty = none }
					dynasty = 1000037003
				}
			}
		}
		character_event = { id = Plus.2298 days = 3 }
		#k_interim_papacy = {
		#	unsafe_destroy_landed_title = THIS
		#}
		#activate_title = { title = k_interim_papacy status = no }
	}
}
	
# Notification that a new Pope has risen
character_event = {
	id = Plus.2296
	desc = EVTDESC_Plus_2296
	picture = GFX_evt_bishop
	
	is_triggered_only = yes
	notification = yes

	option = {
		name = OK
	}
}

# Copy papal title history
character_event = {
	id = Plus.2297
	
	is_triggered_only = yes
	hide_window = yes
	
	immediate = {
		d_pentarch_rome = {
			copy_title_history = k_papal_chalcedon
		}
	}
}

# Remove and disable Sancta Sedes
character_event = {
	id = Plus.2298
	
	is_triggered_only = yes
	hide_window = yes
	
	immediate = {
		k_interim_papacy = {
			unsafe_destroy_landed_title = THIS
		}
		activate_title = { title = k_interim_papacy status = no }
	}
}