# ROOT is the creating character, FROM is the title
on_create_title = {
	events = {
		PlusGreatSchism.043 # Check relations between Greek and Latin Chalcedonian realms
		PlusGreatSchism.052 # Update pentarch on title
	}
}

# ROOT is the title holder, FROM is the title, FROMFROM is the old holder
on_new_holder = {
	events = {
		PlusGreatSchism.052 # Update pentarch on title
		PlusGreatSchism.058 # Pentarch re-established
		PlusGreatSchism.059 # Pentarch disestablished
		PlusGreatSchism.045 # Assign rites trait to generated characters when granting away baronies by right-click
	}
}

# ROOT is the character, FROM is the title, FROMFROM is the old holder
on_new_holder_inheritance = {
	events = {
		PlusGreatSchism.043 # Check relations between Greek and Latin Chalcedonian realms
		PlusGreatSchism.052 # Update pentarch on title
		PlusGreatSchism.058 # Pentarch re-established
		PlusGreatSchism.059 # Pentarch disestablished
		PlusGreatSchism.046 # Assign rites trait to generated characters when titles with open elective are inherited
	}
}

# ROOT is the character, FROM is the title, FROMFROM is the old holder
on_new_holder_usurpation = {
	events = {
		PlusGreatSchism.043 # Check relations between Greek and Latin Chalcedonian realms
		PlusGreatSchism.052 # Update pentarch on title
		PlusGreatSchism.058 # Pentarch re-established
		PlusGreatSchism.059 # Pentarch disestablished
	}
}

# Character converts religion, for whatever reason. ROOT is the character after conversion and the FROM scope has the old religion.
on_character_convert_religion = {
	events = {
		PlusGreatSchism.041 # Choose Chalcedonian rites
		PlusGreatSchism.053 # Update pentarch on held titles
	}
}

# Character converts secret religion, for whatever reason. ROOT is the character after conversion and the FROM scope has the old religion. Note that this fires even when the secret religion is reset as a result of the character converting to it, or if the character didn't previously have a secret religion
on_character_convert_secret_religion = {
	events = {
		PlusGreatSchism.054 # Update pentarch on held titles
	}
}

# When a character accepts religious conversion (the diplomatic action)
# FROMFROM is the demander. FROM is the vassal. ROOT is the character. Fires for the vassal and each of his courtiers and vassals.
on_vassal_accepts_religious_conversion = {
	effect = {
	#	set_pentarch_choice_CK2Plus_effect = yes # Always fires before vanilla event 39700
	}
	events = {
	}
}

# When the religion changes in a county, ROOT is province. FROM has the old religion.
on_county_religion_change = {
	events = {
		PlusGreatSchism.057 # Update pentarch on province after religion change
	}
}

# FROM = Attacker, ROOT = Defender
on_war_started = {
	events = {
		PlusGreatSchism.072 # Carolingian/HRE Emperor fights the Byzantine Empire
	}
}

# Character scope
on_birth = {
	events = {
		PlusGreatSchism.043 # Assign rites trait
	}
}

# Triggers when a change of host has been detected. Note that the FROM scope is empty for newly created characters. "on_employer_change" is triggered first if a character has had both their employer and host changed since the last check was made.
# ROOT is the character that got a new host
# FROM is the previous host
# FROMFROM is new employer
on_host_change = {
	events = {
		PlusGreatSchism.044 # Assign rites trait to generated characters
	}
}

###########################
# DIPLOMATIC NOTIFICATIONS
###########################

# FROM is the character recieving the event
# FROMFROM is the person sending the event
# ROOT is empty or a third party
# new_character is empty or a third party
# Starting scope is equal to FROMFROM

OFFER_VASSALIZATION_INTERACTION_ACCEPT_EVENT = {
	events = {
		PlusGreatSchism.055 # Update pentarch on titles of new vassal's realm
	}
}

ASK_FOR_VASSALIZATION_INTERACTION_ACCEPT_EVENT = {
	events = {
		PlusGreatSchism.056 # Update pentarch on titles of new vassal's realm
	}
}

TRANSFER_VASSAL_INTERACTION_ACCEPT_EVENT = {
	events = {
		# Check if transferred from non-autocephalous realm to autocephalous realm, adjust pentarch assignment accordingly?
	}
}

RELEASE_VASSAL_INTERACTION_ACCEPT_EVENT = {
	events = {
		# Apply autocephalous if a king is granted independence from an empire without autocephalous patriarchs?
	}
}