#####################################
#
#	001 - 100: Start-up events
#
#####################################
#
#	INDEX
#
#	001: New-game set-up
#	002: Apply Plus game rules
#
#####################################

namespace = PlusStartUp

character_event = {
	id = PlusStartUp.001

	hide_window = yes
	is_triggered_only = yes # on_startup

	only_playable = yes

	trigger = {
		owns = event_target:pulse_province
		is_save_game = no
	}

	immediate = {
		log = "PlusStartUp.001"
		character_event = { id = PlusStartUp.002 } # Apply Plus game rules
		character_event = { id = CombatTraits.600 } # Hand out combat traits

		# Hand out coronation traits to independent feudal kings and emperors
		any_independent_ruler = {
			limit = {
				higher_real_tier_than = DUKE
				is_feudal = yes
				has_horde_culture = no
				is_crowned_trigger = no
				is_offmap_trigger = no
				NOT = { trait = uncrowned }
			}

			if = {
				limit = { is_adult = yes }

				if = {
					limit = { has_landed_title = e_hre }
					add_trait = crowned_by_pope
				}
				else_if = {
					limit = { has_landed_title = e_byzantium }

					random_list = {
						50 = { add_trait = strong_basileus }
						50 = { add_trait = weak_basileus }
					}
				}
				else = {
					add_trait = crowned
				}
			}
			else = {
				add_trait = uncrowned
			}
		}

		# Mark exceptions to Crown Authority destruction rule
		any_landed_title = {
			limit = {
				has_law = crown_authority_0
				NOT = { has_title_flag = do_not_destroy }
			}

			set_title_flag = do_not_destroy
		}

		# Imperial Decadence setup
		# NOTE: Needs reworked
		any_independent_ruler = {
			limit = {
				real_tier = EMPEROR
				is_offmap_trigger = no
				is_nomadic = no
				uses_decadence = no
			}

			character_event = { id = Plus.1852 days = 1 }
		}

		any_player = {
			narrative_event = { id = maintPlus.010 } # Greeting
			narrative_event = { id = maintPlus.011 } # Ironman warning
			narrative_event = { id = maintPlus.012 } # Checksum warning
		}

		# Ruler designer setup
		character_event = { id = maintPlus.013 days = 14 }

		# Offer player Aztec Invasion
		random_player = {
			limit = {
				religion = aztec_pagan
				culture = nahua

				any_demesne_province = {
					OR = {
						region = custom_north_sea_zone
						region = custom_atlantic_zone
					}

					owned_by = PREV
				}
			}

			character_event = { id = PlusSSI.201 }
		}

		# Adjust necessary CoAs for some titles
		e_byzantium = {
			if = {
				limit = { holder_scope = { culture = roman } }

				set_name = EARLY_ERE
				adjective = EARLY_ERE_ADJ
			}
			else_if = {
				limit = {
					OR = {
						has_global_flag = hre_formed
						has_global_flag = carolingian_empire_formed
					}
				}

				set_name = ""
				adjective = ""
			}
		}

		k_england = {
			if = {
				limit = { holder_scope = { dynasty = 106 } } # Plantagenet

				set_coa = k_plantagenet
				d_kent = { set_coa = d_kent_norman }
				d_cornwall = { set_coa = d_cornwall_norman }
				d_hwicce = { set_coa = d_hwicce_norman }
				d_mercia = { set_coa = d_mercia_norman }
				d_lancaster = { set_coa = d_lancaster_norman }
				d_east_anglia = { set_coa = d_east_anglia_norman }
				# d_oxford = { set_coa = d_oxford_norman }
				d_wessex = { set_coa = d_wessex_norman }
				d_york = { set_coa = d_york_norman }
			}
			else_if = {
				limit = { has_global_flag = england_is_saxon }

				set_coa = k_england_saxon
				d_kent = { set_coa = d_kent_saxon }
				d_cornwall = { set_coa = d_cornwall_saxon }
				d_hwicce = { set_coa = d_hwicce_saxon }
				d_mercia = { set_coa = d_mercia_saxon }
				d_lancaster = { set_coa = d_lancaster_saxon }
				d_east_anglia = { set_coa = d_east_anglia_saxon }
				# d_oxford = { set_coa = d_oxford_saxon }
				d_wessex = { set_coa = d_wessex_saxon }
				d_york = { set_coa = d_york_saxon }
			}
			else_if = {
				limit = { has_global_flag = england_is_norman }

				set_coa = k_england_norman
				d_kent = { set_coa = d_kent_norman }
				d_cornwall = { set_coa = d_cornwall_norman }
				d_hwicce = { set_coa = d_hwicce_norman }
				d_mercia = { set_coa = d_mercia_norman }
				d_lancaster = { set_coa = d_lancaster_norman }
				d_east_anglia = { set_coa = d_east_anglia_norman }
				# d_oxford = { set_coa = d_oxford_norman }
				d_wessex = { set_coa = d_wessex_norman }
				d_york = { set_coa = d_york_norman }
			}
			else_if = {
				limit = { has_global_flag = england_is_norwegian }

				set_coa = k_englandnorwegian
				d_kent = { set_coa = d_kent_saxon }
				d_cornwall = { set_coa = d_cornwall_saxon }
				d_hwicce = { set_coa = d_hwicce_saxon }
				d_mercia = { set_coa = d_mercia_saxon }
				d_lancaster = { set_coa = d_lancaster_saxon }
				d_east_anglia = { set_coa = d_east_anglia_saxon }
				# d_oxford = { set_coa = d_oxford_saxon }
				d_wessex = { set_coa = d_wessex_saxon }
				d_york = { set_coa = d_york_saxon }
			}
		}

		k_carpathia = {
			if = {
				limit = { has_global_flag = carpathia_is_avaria }
				set_coa = k_avaria
			}
		}

		d_finland = {
			if = {
				limit = { has_global_flag = finland_is_satakunta }
				set_coa = d_satakunta
			}
		}

		# Global set-up of religion flags and variables
		if = {
			limit = {
				has_alternate_start_setting = {
					setting = religion
					option = historical
				}

				NOT = { has_global_flag = religions_initialized }
			}

			set_global_flag = religions_initialized

			## Used for lord spiritual event 903
			# Christian
			apostolic = {
				set_flag = accuse_of_heresy
			}

			paulician = {
				set_flag = accuse_of_heresy
			}

			tondrakian = {
				set_flag = accuse_of_heresy
			}

			catholic = {
				set_flag = accuse_of_heresy
			}

			adoptionist = {
				set_flag = accuse_of_heresy
			}

			cathar = {
				set_flag = accuse_of_heresy
			}

			fraticelli = {
				set_flag = accuse_of_heresy
			}

			lollard = {
				set_flag = accuse_of_heresy
			}

			waldensian = {
				set_flag = accuse_of_heresy
			}

			chalcedonian = {
				set_flag = accuse_of_heresy
			}

			miaphysite = {
				set_flag = accuse_of_heresy
			}

			monophysite = {
				set_flag = accuse_of_heresy
			}

			nestorian = {
				set_flag = accuse_of_heresy
			}

			messalian = {
				set_flag = accuse_of_heresy
			}

			orthodox = {
				set_flag = accuse_of_heresy
			}

			bogomilist = {
				set_flag = accuse_of_heresy
			}

			iconoclast = {
				set_flag = accuse_of_heresy
			}

			monothelite = {
				set_flag = accuse_of_heresy
			}

			# Muslim
			ibadi = {
				set_flag = accuse_of_heresy
			}

			kharijite = {
				set_flag = accuse_of_heresy
			}

			shiite = {
				set_flag = accuse_of_heresy
			}

			bektashi = {
				set_flag = accuse_of_heresy
			}

			druze = {
				set_flag = accuse_of_heresy
			}

			hurufi = {
				set_flag = accuse_of_heresy
			}

			qarmatian = {
				set_flag = accuse_of_heresy
			}

			sunni = {
				set_flag = accuse_of_heresy
			}

			quranist = {
				set_flag = accuse_of_heresy
			}

			zikri = {
				set_flag = accuse_of_heresy
			}

			# Jewish
			jewish = {
				set_flag = accuse_of_heresy
			}

			karaite = {
				set_flag = accuse_of_heresy
			}

			samaritan = {
				set_flag = accuse_of_heresy
			}
		}

		any_character = {
			# Remove undesirable claims
			any_claim = {
				limit = {
					has_holder = no
					controls_religion = no
				}

				log = "Unheld title: Removed [Prev.GetBestName]'s ([Prev.GetID]) claim on the [This.GetFullBaseName] ([This.GetID])"
				remove_claim = PREV
			}

			if = {
				limit = {
					is_female = yes
					is_ruler = no
				}

				any_claim = {
					limit = {
						succ_law_title = { has_law = agnatic_succession }

						OR = {
							is_tribal = yes
							is_nomadic = yes
						}
					}

					log = "Agnatic title: Removed [Prev.GetBestName]'s ([Prev.GetID]) claim on the [This.GetFullBaseName] ([This.GetID])"
					remove_claim = PREV
				}
			}

			add_cousin_opinion_effect = yes
			bloodlust_control_effect = yes
			indian_caste_fix_effect = yes
		}

		# State of the empire
		e_byzantium = {
			holder_scope = {
				narrative_event = { id = Plus.1300 }
			}
		}

		# Apply Imperial government to all historical Roman/Byzantine Emperors
		# Doesn't work well based on title history and government potential
		# and `any_previous_holder` is not an effect scope
		# and `any_character` only target living characters
		c_1000094084 = { set_government_type = imperial_government } # Olybrius
		c_1000094088 = { set_government_type = imperial_government } # Anthemius
		c_1000094514 = { set_government_type = imperial_government } # Petronius Maximus
		c_1000094525 = { set_government_type = imperial_government } # Avitus
		c_1000094526 = { set_government_type = imperial_government } # Majorianus
		c_1000094527 = { set_government_type = imperial_government } # Libius Severus
		c_1000094533 = { set_government_type = imperial_government } # Glycerius
		c_1000094534 = { set_government_type = imperial_government } # Julius Nepos
		c_1000094535 = { set_government_type = imperial_government } # Romulus Augustulus
		c_1000094557 = { set_government_type = imperial_government } # Nicolas
		c_125710 = { set_government_type = imperial_government } # Alexios V
		c_125741 = { set_government_type = imperial_government } # John III
		c_125742 = { set_government_type = imperial_government } # Theodore II
		c_125743 = { set_government_type = imperial_government } # John IV
		c_145068 = { set_government_type = imperial_government } # Philippikos
		c_145069 = { set_government_type = imperial_government } # Tiberius III
		c_145070 = { set_government_type = imperial_government } # Heraklonas
		c_145071 = { set_government_type = imperial_government } # Heraclius
		c_145072 = { set_government_type = imperial_government } # Phocas
		c_145073 = { set_government_type = imperial_government } # Tiberius II
		c_145075 = { set_government_type = imperial_government } # Tiberius
		c_145223 = { set_government_type = imperial_government } # Stephanos Lekapenos
		c_145225 = { set_government_type = imperial_government } # Artavasdos
		c_145226 = { set_government_type = imperial_government } # Zeno
		c_145227 = { set_government_type = imperial_government } # Honorius
		c_145228 = { set_government_type = imperial_government } # Constantius IV
		c_145229 = { set_government_type = imperial_government } # Valentinianus III
		c_145231 = { set_government_type = imperial_government } # Valentinianus I
		c_145232 = { set_government_type = imperial_government } # Valens
		c_145233 = { set_government_type = imperial_government } # Gratian
		c_145234 = { set_government_type = imperial_government } # Valentinianus II
		c_145235 = { set_government_type = imperial_government } # Jovianus
		c_145237 = { set_government_type = imperial_government } # Julianus
		c_145239 = { set_government_type = imperial_government } # Maximinus
		c_145240 = { set_government_type = imperial_government } # Severus
		c_145241 = { set_government_type = imperial_government } # Diocletianus
		c_145242 = { set_government_type = imperial_government } # Carus
		c_145243 = { set_government_type = imperial_government } # Numerianus
		c_145244 = { set_government_type = imperial_government } # Carinus
		c_145245 = { set_government_type = imperial_government } # Probus
		c_145247 = { set_government_type = imperial_government } # Tacitus
		c_145248 = { set_government_type = imperial_government } # Florianus
		c_145249 = { set_government_type = imperial_government } # Severina
		c_145250 = { set_government_type = imperial_government } # Aurelianus
		c_145252 = { set_government_type = imperial_government } # Claudius Gothicus
		c_145253 = { set_government_type = imperial_government } # Quintillus
		c_145254 = { set_government_type = imperial_government } # Valerianus
		c_145255 = { set_government_type = imperial_government } # Gallienus
		c_145256 = { set_government_type = imperial_government } # Aemilianus
		c_145257 = { set_government_type = imperial_government } # Trebonianus Gallus
		c_145258 = { set_government_type = imperial_government } # Decius
		c_145259 = { set_government_type = imperial_government } # Gordianus
		c_145260 = { set_government_type = imperial_government } # Gordianus II
		c_145262 = { set_government_type = imperial_government } # Gordianus III
		c_145263 = { set_government_type = imperial_government } # Balbinus
		c_145264 = { set_government_type = imperial_government } # Pupienus
		c_145265 = { set_government_type = imperial_government } # Maximinus
		c_145266 = { set_government_type = imperial_government } # Severus Alexander
		c_145267 = { set_government_type = imperial_government } # Heliogabalus
		c_145268 = { set_government_type = imperial_government } # Macrinus
		c_145269 = { set_government_type = imperial_government } # Septimius Severus
		c_145270 = { set_government_type = imperial_government } # Caracalla
		c_145271 = { set_government_type = imperial_government } # Geta
		c_145272 = { set_government_type = imperial_government } # Didius Julianus
		c_145273 = { set_government_type = imperial_government } # Pertinax
		c_145274 = { set_government_type = imperial_government } # Marcus Aurelius
		c_145275 = { set_government_type = imperial_government } # Commodus
		c_145276 = { set_government_type = imperial_government } # Lucius Verus
		c_145277 = { set_government_type = imperial_government } # Antoninus Pius
		c_145278 = { set_government_type = imperial_government } # Hadrianus
		c_145279 = { set_government_type = imperial_government } # Trajanus
		c_145280 = { set_government_type = imperial_government } # Nerva
		c_145281 = { set_government_type = imperial_government } # Vespasianus
		c_145282 = { set_government_type = imperial_government } # Titus
		c_145283 = { set_government_type = imperial_government } # Domitianus
		c_145284 = { set_government_type = imperial_government } # Vitellius
		c_145285 = { set_government_type = imperial_government } # Otho
		c_145286 = { set_government_type = imperial_government } # Galba
		c_145287 = { set_government_type = imperial_government } # Nero
		c_145288 = { set_government_type = imperial_government } # Claudius
		c_145289 = { set_government_type = imperial_government } # Caligula
		c_145290 = { set_government_type = imperial_government } # Augustus
		c_145293 = { set_government_type = imperial_government } # Maximianus
		c_1700 = { set_government_type = imperial_government } # Basileios I
		c_1702 = { set_government_type = imperial_government } # Leo VI
		c_1704 = { set_government_type = imperial_government } # Alexander I
		c_1706 = { set_government_type = imperial_government } # Romanos I
		c_1708 = { set_government_type = imperial_government } # Constantine VII - first reign
		c_1710 = { set_government_type = imperial_government } # Romanos II
		c_1712 = { set_government_type = imperial_government } # Nikephoros II
		c_1714 = { set_government_type = imperial_government } # John I
		c_1716 = { set_government_type = imperial_government } # Basil II
		c_1717 = { set_government_type = imperial_government } # Zo� Porphyrogenita
		c_1718 = { set_government_type = imperial_government } # Constantine VIII
		c_1719 = { set_government_type = imperial_government } # Theodora Porphyrogenita
		c_1720 = { set_government_type = imperial_government } # Romanos III
		c_1722 = { set_government_type = imperial_government } # Michael IV
		c_1724 = { set_government_type = imperial_government } # Michael V
		c_1726 = { set_government_type = imperial_government } # Constantine IX
		c_1730 = { set_government_type = imperial_government } # Isaac I
		c_1732 = { set_government_type = imperial_government } # Constantine X
		c_1733 = { set_government_type = imperial_government } # Eudokia Makrembolites
		c_1734 = { set_government_type = imperial_government } # Romanos IV
		c_1736 = { set_government_type = imperial_government } # Michael VII
		c_1740 = { set_government_type = imperial_government } # Nikephoros III
		c_1742 = { set_government_type = imperial_government } # Alexios I
		c_215500 = { set_government_type = imperial_government } # Isaac II
		c_215503 = { set_government_type = imperial_government } # Alexios III
		c_215507 = { set_government_type = imperial_government } # Alexios IV
		c_215529 = { set_government_type = imperial_government } # Andronikos
		c_215530 = { set_government_type = imperial_government } # Manuel I
		c_215531 = { set_government_type = imperial_government } # Alexios I
		c_215674 = { set_government_type = imperial_government } # Theodore I
		c_223023 = { set_government_type = imperial_government } # John II
		c_465500 = { set_government_type = imperial_government } # Andronikos III
		c_465501 = { set_government_type = imperial_government } # Michel IX
		c_465521 = { set_government_type = imperial_government } # Andronikos II
		c_465527 = { set_government_type = imperial_government } # Michael VIII
		c_70432 = { set_government_type = imperial_government } # Michael VI
		c_70490 = { set_government_type = imperial_government } # Michael III
		c_70491 = { set_government_type = imperial_government } # Theophilos
		c_70492 = { set_government_type = imperial_government } # Michel II
		c_70493 = { set_government_type = imperial_government } # Leo V
		c_70494 = { set_government_type = imperial_government } # Michael I
		c_70496 = { set_government_type = imperial_government } # Staurakios
		c_70497 = { set_government_type = imperial_government } # Nikephoros I
		c_70498 = { set_government_type = imperial_government } # Irene
		c_70499 = { set_government_type = imperial_government } # Constantine VI
		c_70500 = { set_government_type = imperial_government } # Leo IV
		c_70501 = { set_government_type = imperial_government } # Constantine V
		c_70502 = { set_government_type = imperial_government } # Leo III
		c_70504 = { set_government_type = imperial_government } # Anastasios II
		c_70505 = { set_government_type = imperial_government } # Lentios
		c_70506 = { set_government_type = imperial_government } # Justinian II
		c_70507 = { set_government_type = imperial_government } # Constantine IV
		c_70508 = { set_government_type = imperial_government } # Constans II
		c_70509 = { set_government_type = imperial_government } # Constantine III
		c_70510 = { set_government_type = imperial_government } # Maurice
		c_70511 = { set_government_type = imperial_government } # Justin II
		c_70512 = { set_government_type = imperial_government } # Justinian I
		c_70513 = { set_government_type = imperial_government } # Justin I
		c_70514 = { set_government_type = imperial_government } # Anastasios I
		c_70515 = { set_government_type = imperial_government } # Basiliscus
		c_70516 = { set_government_type = imperial_government } # Leo II
		c_70517 = { set_government_type = imperial_government } # Leo I
		c_70518 = { set_government_type = imperial_government } # Marcian
		c_70519 = { set_government_type = imperial_government } # Arcadius
		c_70520 = { set_government_type = imperial_government } # Constantinus II
		c_70521 = { set_government_type = imperial_government } # Constantius II
		c_70522 = { set_government_type = imperial_government } # Constans I
		c_70523 = { set_government_type = imperial_government } # Constantinus I
		c_70524 = { set_government_type = imperial_government } # Constantius I
		c_70526 = { set_government_type = imperial_government } # Philip I
		c_70532 = { set_government_type = imperial_government } # Theodosios III
		c_70533 = { set_government_type = imperial_government } # Theodosius II
		c_70534 = { set_government_type = imperial_government } # Theodosius

		set_global_flag = plus_startup
	}
}

character_event = { # Apply Plus game rules
	id = PlusStartUp.002

	is_triggered_only = yes
	hide_window = yes

	trigger = {
		NOT = { has_global_flag = plus_rules_applied }
	}

	immediate = {
		set_global_flag = plus_rules_applied
		log = "Applying Plus game rules"

		### GREAT SCHISM ###

		# Applying Great Schism normally pre-1054
		if = {
			limit = {
				OR = {
					has_game_rule = {
						name = great_schism
						value = historical
					}

					has_game_rule = {
						name = great_schism
						value = joined
					}
				}

				NOT = { has_global_flag = great_schism_happened }
			}

			log = "APPLYING DEFAULT GREAT SCHISM SETUP"
			character_event = { id = PlusGreatSchism.001 } # Set-up Great Schism
		}

		# Trigger Great Schism
		else_if = {
			limit = {
				# Great Schism hasn't happened already, i.e. post 1054 starts.
				has_game_rule = {
					name = great_schism
					value = split
				}

				NOT = { has_global_flag = great_schism_happened }
			}

			# Required in order for the event to bypass normal checks
			log = "OVERRIDING GREAT SCHISM BY GAME RULE"
			set_global_flag = great_schism_manual_override
			character_event = { id = PlusGreatSchism.006 } # Trigger Great Schism
		}

		# Revert Great Schism
		else_if = {
			limit = {
				# Great Schism has happened, but we want it reverted (not mended) immediately
				has_global_flag = great_schism_happened

				has_game_rule = {
					name = great_schism
					value = joined
				}
			}

			log = "REVERTING GREAT SCHISM"
			clr_global_flag = great_schism_happened
			set_global_flag = great_schism_reverted
			character_event = { id = PlusGreatSchism.001 } # Set-up Great Schism
		}

		# Revert and Disable Great Schism
		else_if = {
			limit = {
				# Great Schism has happened, but we want it reverted (and disabled) immediately
				has_game_rule = {
					name = great_schism
					value = disabled
				}

				has_global_flag = great_schism_happened
			}

			log = "REVERTING AND DISABLING GREAT SCHISM BY GAME RULE"
			clr_global_flag = great_schism_happened
			set_global_flag = great_schism_reverted
			set_global_flag = great_schism_disabled
			character_event = { id = PlusGreatSchism.001 } # Set-up Great Schism
		}

		# Disable Great Schism
		else_if = {
			limit = {
				# Great Schism has not happened, and we want to disable it
				has_game_rule = {
					name = great_schism
					value = disabled
				}

				NOT = { has_global_flag = great_schism_happened }
			}

			log = "DISABLING GREAT SCHISM BY GAME RULE"
			set_global_flag = great_schism_disabled
			character_event = { id = PlusGreatSchism.001 } # Set-up Great Schism
		}

		### DE JURE EMPIRES ###

		if = {
			limit = {
				has_game_rule = {
					name = vanilla_empires
					value = no
				}
			}

			any_landed_title = {
				limit = {
					real_tier = EMPEROR
					is_titular = no
					has_holder = no

					NOR = {
						any_claimant = { always = yes }
						title = e_byzantium
						title = e_karling
						title = e_hre
					}
				}

				any_direct_de_jure_vassal_title = {
					de_jure_liege = e_placeholder
				}
			}

			# Manual adjustments
			k_brittany = { de_jure_liege = e_placeholder }
			k_armenia = { de_jure_liege = e_placeholder }
			k_georgia = { de_jure_liege = e_placeholder }
			k_serbia = { de_jure_liege = e_placeholder }

			if = {
				limit = { start_date < 843.8.10 } # Treaty of Verdun
				k_germany = { de_jure_liege = e_francia }
			}

			if = {
				limit = { start_date >= 962.2.2 } # HRE formed
				k_burgundy = { de_jure_liege = e_placeholder }
			}

			if = {
				limit = { e_bulgaria = { is_titular = yes } }
				k_bulgaria = { de_jure_liege = e_placeholder }
			}

			if = {
				limit = { start_date >= 1204.1.1 }
				k_anatolia = { de_jure_liege = e_placeholder }
			}

			if = {
				limit = { start_date >= 1326.1.1 }
				k_trebizond = { de_jure_liege = e_placeholder }
			}
		}

		### CRUSADE DELAY ###

		if = {
			limit = {
				has_game_rule = {
					name = crusade_rules
					value = activate_immediately
				}
			}

			set_global_flag = muslim_jihads_unlocked
			set_global_flag = christian_crusades_unlocked
			set_global_flag = pagan_ghws_unlocked
		}

		### GOVERNMENT CONVERSION

		if = {
			limit = {
				has_game_rule = {
					name = government_conversion
					value = gofeudal
				}
			}

			any_province = {
				limit = { has_tribal = yes }

				any_province_holding = {
					limit = { holding_type = tribal }
					convert_to = castle
					refill_holding_levy = yes
				}

				add_province_modifier = {
					name = new_buildings_timer
					years = 100
					hidden = yes
				}

				owner = {
					if = {
						limit = { is_tribal = yes }
						set_correct_feudal_government_type_effect = yes
					}

					any_demesne_title = {
						if = {
							limit = { is_crown_law_title = yes }
							set_title_flag = do_not_destroy
						}
					}
				}
			}
		}
		else_if = {
			limit = {
				has_game_rule = {
					name = government_conversion
					value = gotribal
				}
			}

			any_province = {
				limit = { has_tribal = no }

				capital_holding = {
					convert_to = tribal
					refill_holding_levy = yes
				}

				any_province_holding = {
					limit = {
						OR = {
							holding_type = castle
							holding_type = city
						}
					}

					destroy_settlement = THIS
				}

				owner = {
					if = {
						limit = { is_theocracy = no }
						set_government_type = tribal_government
					}
				}
			}
		}

		### NEW WORLD ORDER
		if = {
			limit = {
				has_game_rule = {
					name = new_world_order
					value = yes
				}
			}

			character_event = { id = emf_nwo.0 }
		}

		### ANCIENT RELIGIONS - Handled through NWO if NWO is enabled
		else_if = {
			limit = {
				NOT = {
					has_game_rule = {
						name = ancient_religions
						value = no
					}
				}
			}

			character_event = { id = Plus.2702 }
		}

		### BABY PORTRAITS ###
		if = {
			limit = {
				has_game_rule = {
					name = baby_portraits
					value = yes
				}
			}

			any_character = {
				limit = {
					age < 3

					NOR = {
						trait = baby_boy_fair
						trait = baby_boy_tanned
						trait = baby_boy_dark
						trait = baby_boy_darker
						trait = baby_girl_fair
						trait = baby_girl_tanned
						trait = baby_girl_dark
						trait = baby_girl_darker
					}
				}

				assign_baby_portrait_effect = yes # Automatically choses the proper trait based on gender & ethnicity
			}
		}
	}
}