# Empty scope
on_game_start = {
	events = {
		fp1_scandinavian_adventurers.0004	# FP1 - Organise Norse adventurers.
		fp1_scandinavian_adventurers.0011	# FP1 - Corral famous Norse adventurers that haven't done much yet.
		fp1_scandinavian_adventurers.0021	# FP1 - Mark game-start prioritised adventurers.
		#Guaranteed historical artifacts fixed spawning
		debug_portraits.1 					# Debug portraits for animation testing
		easteregg_event.0001				# Charna and Jakub duel.
	}

	effect = {
		##NEOW
		
		if = {
			limit = {
				government_allows = administrative
				is_house_head = yes
				trigger_if = {
					# This trigger is intentionally different from the similar effecy in on_title_gain up above. We want all direct vassals of the top liege to have a family title if they can
					limit = { government_has_flag = government_has_county_tier_noble_families }
					highest_held_title_tier >= tier_county
				}
				trigger_else = { highest_held_title_tier >= tier_duchy }
				NOR = {
					any_held_title = { is_noble_family_title = yes }
					house = {
						any_house_member = {
							any_held_title = { is_noble_family_title = yes }
						}
					}
				}
			}
			create_noble_family_effect = { GOVERNMENT_GIVER = this }
			domicile ?= { set_up_domicile_estate_effect = yes }
		}
		#Dynamic Titles
		character:benelux_oranje_nassau_weilburg_guillem = {
			if = {
				limit = {
					is_alive = yes
				}
				trigger_event = NEOW_dynamic_titles.0005
				trigger_event = NEOW_dynamic_titles.0009
				title:e_benelux = { set_coa = e_lotharingia }
			}
		}
		#title:d_piedmonte.holder = { 
		#	create_confederation = {
		#		name = holy_lombard_league
		#	}
		#	scope:new_confederation = {
		#		add_confederation_member = title:c_lombardia.holder 
		#		add_confederation_member = title:c_cuneo.holder 
		#		add_confederation_member = title:c_monferrato.holder   
		#	}
		#}
		title:d_york.holder = { 
			create_confederation = {
				name = anglian_league
			}
			scope:new_confederation = {
				add_confederation_member = title:d_norfolk.holder 
				add_confederation_member = title:d_lincoln.holder 
				add_confederation_member = title:d_lothian.holder 
				add_confederation_member = title:d_northumberland.holder 				
			}
		}
		#title:k_ireland.holder = { 
		#	create_confederation = {
		#		name = sinn_fein
		#	}
		#	scope:new_confederation = {
		#		add_confederation_member = title:k_ireland.holder 
		#		add_confederation_member = title:d_patriarch_dublin.holder			
		#	}
		#}		
		title:c_frankfurt.holder = { 
			create_confederation = {
				name = rhine_confederacy
			}
			scope:new_confederation = {
				add_confederation_member = title:d_palatinate.holder 
				add_confederation_member = title:d_trier.holder 
			}
		}		
		# Chinese Song-fashion
		if = {
			limit = {
				current_date >= 960.1.1
			}
			set_global_variable = {
				name = chinese_fashion_change
				value = 1
			}
		}
		#Epidemics 10 years grace
		set_global_variable = {
			name = start_epidemic_grace
			value = yes
			years = 10
		}
		#Set Cumania name if there is no MPO DLC
		if = {
			limit = {
				has_mpo_dlc_trigger = no
				current_date >= 1000.1.1
			}
			title:e_caspian-pontic_steppe = {
				set_title_name = cn_cumania
			}
		}
		#Rabbene Gershom outlaws polygamy
		if = {
			limit = {
				current_date >= 1000.1.1
			}
			religion:judaism_religion = {
				every_faith = {
					limit = {
						has_doctrine = temple_authority_rabbinic_doctrine
					}
					remove_doctrine = doctrine_polygamy
					add_doctrine = doctrine_monogamy
				}
			}
		}
		### 867 - RADHANITES IN KHAZARIA ###
		character:74025 = {
			if = {
				limit = {
					is_alive = yes
					is_playable_character = yes
				}
				trigger_event = bookmark.0200
			}
		}
		### 867 - WRATH OF THE NORTHMEN ###
		#Æthelred dying (probably)
		character:33358 = {
			if = {
				limit = {
					is_alive = yes
					is_playable_character = yes
				}
				trigger_event = {
					id = bookmark.0001
					days = { 365 730 }
				}
			}
		}

		#Alfred the Great becoming the Great
		character:7627 = {
			if = {
				limit = {
					is_alive = yes
					is_playable_character = yes
				}
				trigger_event = {
					id = bookmark.0002
					days = 1800 #~5 years
				}
			}
		}

		### 867 - THE GREAT ADVENTURERS ###
		character:251187 = {
			if = {
				limit = {
					is_alive = yes
					is_playable_character = yes
					AND = {
						character:251180 = { is_ai = yes }
						character:251181 = {
							is_ai = yes
							is_alive = yes
						}
					}
				}
				trigger_event = {
					id = bookmark.0101
					days = { 21 35 }
				}
			}
		}

		### 1066 - HASAN SABBAH STORY CYCLE ###
		character:41702 ?= {
			if = {
				limit = {
					is_alive = yes
					is_playable_character = yes
				}
				house = { set_house_head = prev }
				trigger_event = {
					id = hasan_sabbah.1000
					days = 1
				}
			}
		}
		### 1066 - EL CID STORY CYCLE ###
		character:107590 ?= {
			if = {
				limit = {
					cid_story_cycle_start_trigger = yes
				}
				trigger_event = {
					id = cid.0001
					days = 1
				}
			}
		}
		### 1066 - LOUIS THE GERMAN ###
		if = {
			limit = {
				exists = character:90107
				current_date >= 1066.1.1
			}
			character:90107 = { give_nickname = nick_the_german_post_mortem }
		}

		### 1178 - SIBYLLA ###
		if = {
			limit = {
				exists = character:223522
				current_date >= 1178.1.1
				character:223541 = {
					is_ai = yes
					is_alive = yes
				}
			}
			character:223522 = {
				trigger_event = {
					id = bookmark.0300
					days = { 21 28 }
				}
			}
		}
		### 1066 - LIANG LUOYAO ###
		if = {
			limit = {
				exists = character:tangut_liang_1
				current_date >= 1066.1.1
				character:tangut_liang_1.primary_spouse ?= character:206651
			}
			character:tangut_liang_1 = {
				add_gold = {
					value = {
						value = 0
						add = { 200 350 }
					}
				}
				trigger_event = {
					id = bookmark.0400
					days = { 14 21 }
				}
			}
		}

		### HRE SETUP ###
		if = {
			limit = { exists = title:e_hre.holder }
			add_to_global_variable_list = {
				name = hre_elector_list
				target = title:c_cologne
			}
			add_to_global_variable_list = {
				name = hre_elector_list
				target = title:c_mainz
			}
			add_to_global_variable_list = {
				name = hre_elector_list
				target = title:c_trier
			}
			add_to_global_variable_list = {
				name = hre_elector_list
				target = title:d_bohemia
			}
			add_to_global_variable_list = {
				name = hre_elector_list
				target = title:d_east_franconia
			}
			add_to_global_variable_list = {
				name = hre_elector_list
				target = title:d_ostmark
			}
			add_to_global_variable_list = {
				name = hre_elector_list
				target = title:d_angria
			}
			hre_elector_list_save_effect = yes
			hre_margraves_effect = yes
		}

		### Britania SETUP ###
		title:d_normandy.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 3 }
			set_subject_contract_modification_blocked = no
		}
		title:d_ile_de_france.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 3 }
			set_subject_contract_modification_blocked = no
		}
		title:d_channel_islands.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 5 }
			set_subject_contract_modification_blocked = no
		}
		title:d_galloway.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 3 }
			set_subject_contract_modification_blocked = no
		}
		title:d_strathclyde.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 3 }
			set_subject_contract_modification_blocked = no
		}
		title:d_cumbria.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 3 }
			set_subject_contract_modification_blocked = no
		}
		title:d_deheubarth.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 3 }
			set_subject_contract_modification_blocked = no
		}
		title:d_nottingham.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 3 }
			set_subject_contract_modification_blocked = no
		}
		title:d_canterbury.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 5 }
			set_subject_contract_modification_blocked = no
		}
		title:d_buckingham.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 4 }
			set_subject_contract_modification_blocked = no
		}
		title:d_somerset.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 2 }
			set_subject_contract_modification_blocked = no
		}
		title:d_leicester.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 2 }
			set_subject_contract_modification_blocked = no
		}		
		title:d_cornwall.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 1 }
			set_subject_contract_modification_blocked = no
		}
		title:d_solent.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 5 }
			set_subject_contract_modification_blocked = no
		}
		title:d_hereford.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 1 }
			set_subject_contract_modification_blocked = no
		}
		title:d_bedford.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 1 }
			set_subject_contract_modification_blocked = no
		}
		title:d_black_country.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 1 }
			set_subject_contract_modification_blocked = no
		}
		title:d_gwent.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 1 }
			set_subject_contract_modification_blocked = no
		}
		title:d_gwynedd.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 1 }
			set_subject_contract_modification_blocked = no
		}
		title:d_lancaster.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 1 }
			set_subject_contract_modification_blocked = no
		}
		title:d_southern_corsica.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 1 }
			set_subject_contract_modification_blocked = no
		}
		title:d_north_corsica.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 5 }
			set_subject_contract_modification_blocked = no
		}
		title:d_palermo.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 1 }
			set_subject_contract_modification_blocked = no
		}
		title:d_siracusa.holder ?= {
			vassal_contract_set_obligation_level = { type = administrative_themes level = 3 }
			set_subject_contract_modification_blocked = no
		}
		#title:e_arabia.holder ?= {
		#	every_vassal = {
		#		limit = {
		#			government_has_flag = government_is_feudal
		#			vassal_contract_has_modifiable_obligations = yes
		#			faith = faith:armenian_apostolic
		#		}
		#		vassal_contract_set_obligation_level = { type = feudal_government_taxes level = 3 }
		#		vassal_contract_set_obligation_level = { type = feudal_government_levies level = 2 }
		#		vassal_contract_set_obligation_level = { type = jizya_special_rights level = 1 }
		#		set_subject_contract_modification_blocked = no
		#	}
		#}

		### CORONATION LOCATION SETUP ###
		if = {
			limit = {
				current_date >= 1066.1.1
				has_dlc_feature = coronations
			}
			# London (England)
			province:1527 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Aachen (Germany)
			province:2092 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Reims (France)
			province:2390 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Rome (Italy)
			province:2575 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Milan (Italy)
			province:2482 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Gniezno (Poland)
			province:4905 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Szekesfehervar (Hungary)
			province:3805 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Scone Abbey, Gowrie (Scotland)
			province:1741 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Byzantium (Byzantines)
			province:496 = {
				add_province_modifier = coronation_long_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 10
				}
			}
			# Mahdiya (Africa)
			province:4578 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Cairo (Egypt)
			province:6042 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Damascus (Syria)
			province:5924 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Baghdad (Mesopotamia)
			province:4828 = {
				add_province_modifier = coronation_long_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 10
				}
			}
			# Rayy (Persia)
			province:4319 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Ghazna (Kabulistan)
			province:4500 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Lahur (Punjab)
			province:1362 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Samarkand (Transoxiana)
			province:4404 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Bukhara (Transoxiana)
			province:4394 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Medina (Arabia)
			province:6212 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Kutaisi (Georgia)
			province:601 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
		}
		if = {
			limit = {
				current_date >= 1178.1.1
				has_dlc_feature = coronations
			}
			# Marrakesh (Maghreb)
			province:4718 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
			# Karakorum (Mongolia)
			province:1457 = {
				add_province_modifier = coronation_tradition_modifier
				set_variable = {
					name = coronation_tradition_location
					value = 5
				}
			}
		}

		### Every nomad and herder in the Steppe Region becomes tribal if DLC not enabled, pre-lobby history setup ###
		if = {
			limit = {
				has_mpo_dlc_trigger = no
			}
			# Change Nomad and Herder Holdings to Tribal Holdings for Tribals
			every_province = {
				limit = {
					OR = {
						has_holding_type = nomad_holding
						has_holding_type = herder_holding
					}
				}
				set_holding_type = tribal_holding
				if = {
					limit = {
						county.holder.capital_province ?= this
					}
					county.holder ?= {
						if = {
							limit = {
								NOT = {
									has_government = tribal_government
								}
							}
							change_government = tribal_government
						}
					}
				}
			}
		}



		# To prevent the Season Changes event from triggering on game start
		situation:the_great_steppe ?= {
			every_participant_group = {
				every_situation_group_participant = {
					set_variable = {
						name = steppe_game_start_var
						years = 1
					}
				}
			}
		}

		#CP3 Special Buildings - Goes Before Holy Sites
		if = {
			limit = {
				has_cp3_dlc_trigger = yes
			}
	        title:b_barcelona.title_province = { add_special_building_slot = drassanes_01 } #1892
	        title:b_merv.title_province = { add_special_building = kyz_kala_01 } #4238
	        if = { limit = { game_start_date >= 1178.10.1 } title:b_cluny.title_province = { add_special_building = cluny_abbey_02 } } #2304
	        else_if = { limit = { game_start_date >= 1066.9.15 } title:b_cluny.title_province = { add_special_building = cluny_abbey_01 } }
	        else = { title:b_cluny.title_province = { add_special_building_slot = cluny_abbey_01 } }
	        title:b_york.title_province = { add_special_building = york_walls_01 } #1595
	        title:b_damascus.title_province = { add_special_building = damascus_mosque_01 } #5924
	        title:b_lhasa.title_province = { add_special_building = jokhang_01 } #9237
	        if = { limit = { game_start_date >= 1178.10.1 } title:b_schmalkalden.title_province = { add_special_building = wartburg_01 } } #3010
	        else = { title:b_schmalkalden.title_province = { add_special_building_slot = wartburg_01 } }
	        title:b_lalibela.title_province = { add_special_building_slot = beta_giyorgis_01 } #8301
	        if = { limit = { game_start_date >= 1066.9.15 } title:b_novgorod.title_province = { add_special_building = holy_wisdom_01 } } #5137
	        else = { title:b_novgorod.title_province = { add_special_building_slot = holy_wisdom_01 } }
	        title:b_kano.title_province = { add_special_building_slot = kano_walls_01 } #6519
	        title:b_somapur.title_province = { add_special_building = somapura_university_01 } #848
	        if = { limit = { game_start_date >= 1178.10.1 } title:b_firenze.title_province = { add_special_building = duomo_florence_02 } } #2543
	        else = { title:b_firenze.title_province = { add_special_building = duomo_florence_01 } }
	        title:b_konarak.title_province = { add_special_building_slot = konark_temple_01 } #928
	        title:b_fes.title_province = { add_special_building = al_qarawiyyin_university_01 } #4694
	        title:b_kairouan.title_province = { add_special_building = kairouan_basins_01 } #4594
	        title:b_al-ghaba.title_province = { add_special_building = ghana_palace_01 } #6628 #NOTE: likely existed since the 8th, but earliest (only) source on palace is from 1068
	        title:b_visegrad_hun.title_province = { add_special_building_slot = visegrad_castle_01 } #3803
	        if = { limit = { game_start_date >= 1161.9.15 } title:b_leczyca.title_province = { add_special_building = wawel_cathedral_01 } } #4924 #Date of consecreation of Archcollegiate Church of St. Mary and St. Alexius in Tum
	        else = { title:b_leczyca.title_province = { add_special_building_slot = wawel_cathedral_01 } }
	        title:b_vatapi.title_province = { add_special_building = vatapi_caves_01 } #1198
	        if = { limit = { game_start_date >= 1178.10.1 } title:b_jaisalmer.title_province = { add_special_building = jaisalmer_fort_01 } } #3387
	        else = { title:b_jaisalmer.title_province = { add_special_building_slot = jaisalmer_fort_01 } } #3387
		}

		### RELIGIOUS THINGS ###
		# Set up Holy Site Buildings to be buildable in Holy Sites
		religion:islam_religion = {
			every_faith = {
				every_holy_site = {
					limit = {
						title_province = {
							has_special_building_slot = no
						}
					}
					title_province = {
						add_special_building_slot = holy_site_mosque_01
					}
				}
			}
		}
		religion:eastern_orthodox_religion = {
			every_faith = {
				every_holy_site = {
					limit = {
						title_province = {
							has_special_building_slot = no
						}
					}
					title_province = {
						add_special_building_slot = holy_site_cathedral_01
					}
				}
			}
		}
		religion:catholic_religion = {
			every_faith = {
				every_holy_site = {
					limit = {
						title_province = {
							has_special_building_slot = no
						}
					}
					title_province = {
						add_special_building_slot = holy_site_cathedral_01
					}
				}
			}
		}
		religion:protestant_religion = {
			every_faith = {
				every_holy_site = {
					limit = {
						title_province = {
							has_special_building_slot = no
						}
					}
					title_province = {
						add_special_building_slot = holy_site_cathedral_01
					}
				}
			}
		}
		religion:zoroastrianism_religion = {
			every_faith = {
				every_holy_site = {
					limit = {
						title_province = {
							has_special_building_slot = no
						}
					}
					title_province = {
						add_special_building_slot = holy_site_fire_temple_01
					}
				}
			}
		}
		religion:buddhism_religion = {
			every_faith = {
				every_holy_site = {
					limit = {
						title_province = {
							has_special_building_slot = no
						}
					}
					title_province = {
						add_special_building_slot = holy_site_buddhist_grand_temple_01
					}
				}
			}
		}
		religion:shintoism_religion = {
			every_faith = {
				every_holy_site = {
					limit = {
						title_province = {
							has_special_building_slot = no
						}
					}
					title_province = {
						add_special_building_slot = holy_site_japanese_temple_01
					}
				}
			}
		}
		religion:taoism_religion = {
			every_faith = {
				every_holy_site = {
					limit = {
						title_province = {
							has_special_building_slot = no
						}
					}
					title_province = {
						add_special_building_slot = holy_site_chinese_temple_01
					}
				}
			}
		}
		religion:confucianism_religion = {
			every_faith = {
				every_holy_site = {
					limit = {
						title_province = {
							has_special_building_slot = no
						}
					}
					title_province = {
						add_special_building_slot = holy_site_chinese_temple_01
					}
				}
			}
		}
		every_religion_global = {
			limit = {
				OR = {
					this = religion:hinduism_religion
					this = religion:jainism_religion
					this = religion:tani_religion
					this = religion:bon_religion
				}
			}
			every_faith = {
				every_holy_site = {
					limit = {
						title_province = {
							has_special_building_slot = no
						}
					}
					title_province = {
						add_special_building_slot = holy_site_indian_grand_temple_01
					}
				}
			}
		}
		every_religion_global = {
			limit = {
				OR = {
					this = religion:satsana_phi_religion
					this = religion:dayawism_religion
					this = religion:hantuism_religion
					this = religion:satsana_phi_religion
					this = religion:kaharingan_religion
					this = religion:tolotang_religion
					this = religion:aluk_religion
					this = religion:dab_qhuas_religion
					this = religion:biliku_religion
				}
			}
			every_faith = {
				every_holy_site = {
					limit = {
						title_province = {
							has_special_building_slot = no
						}
					}
					title_province = {
						add_special_building_slot = holy_site_se_asia_pagan_temple_01
					}
				}
			}
		}
		every_religion_global = {
			limit = {
				is_in_family = rf_pagan
			}
			every_faith = {
				every_holy_site = {
					limit = {
						title_province = {
							has_special_building_slot = no
						}
					}
					title_province = {
						add_special_building_slot = holy_site_pagan_grand_temple_01
					}
				}
			}
		}
		every_religion_global = {
			every_faith = {
				every_holy_site = {
					limit = {
						title_province = {
							has_special_building_slot = no
						}
					}
					title_province = {
						add_special_building_slot = holy_site_other_grand_temple_01
					}
				}
			}
		}

		# If your capital on game start is Mecca, you get the Hajjaj trait (since you can't Hajj to your capital)
		title:b_makka.county.holder = {
			if = {
				limit = {
					faith = { has_doctrine_parameter = mandatory_hajj }
					NOT = { has_trait = hajjaj }
				}
				# Have some Hajjaj
				add_trait = hajjaj
			}
		}

		# Pagans that start pre-reformed
		## Bon has already been reformed into new bon.
		faith:old_bon = {
			set_variable = { name = has_been_reformed }
		}

		# Mark some faiths to block conversion till specific decisions are taken.
		faith:basque_pagan = {
			set_variable = { name = block_conversion_till_decision_taken }
		}
		faith:adoptionist = {
			set_variable = { name = block_conversion_till_nebulous_circumstances }
		}
		# Kuzarite cannot be reformed under normal circumstances
		faith:kabarism = {
			set_variable = { name = block_reformation_var }
		}

		### GAME RULE: EXTRA ADMINS
		apply_historic_administrative_game_rule_effect = yes

		### 1178 CRUSADE SETUP ###
		if = {
			limit = {
				game_start_date >= 1178.10.1
			}
			religion:islam_religion = {
				set_variable = {
					name = variable_ghw_unlocked
					value = yes
				}
			}
			religion:christianity_religion = {
				set_variable = {
					name = variable_ghw_unlocked
					value = yes
				}
			}
			set_global_variable = {
				name = had_first_catholic_crusade
				value = yes
			}
		}
		if = {
			limit = {
				game_start_date >= 1178.10.1
			}
			character:st_amand_1 = {
				save_scope_as = leader
			}
			character:223523 = {
				save_scope_as = founder
			}
			title:b_saida = {
				save_scope_as = barony
			}
			create_holy_order_neutral_effect = {
				LEADER = scope:leader
				CAPITAL = scope:barony
				NEW_HO_SCOPE = new_holy_order
				FOUNDER = scope:founder
			}
		}
		if = {
			limit = {
				game_start_date >= 1178.10.1
			}
			character:231000 = {
				save_scope_as = leader_1
			}
			character:223523 = {
				save_scope_as = founder_1
			}
			title:b_hebron = {
				save_scope_as = barony_1
			}
			create_holy_order_neutral_effect = {
				LEADER = scope:leader_1
				CAPITAL = scope:barony_1
				NEW_HO_SCOPE = new_holy_order
				FOUNDER = scope:founder_1
			}
		}

		### UNIVERSITIES ###
		title:b_fes.title_province = {
			if = {
				limit = {
					has_special_building_slot = no #Depends on DLC
				}
				add_special_building_slot = generic_university
			}
		}
		title:b_somapur.title_province = {
			if = {
				limit = {
					has_special_building_slot = no #Depends on DLC
				}
				add_special_building_slot = generic_university
			}
		}
		#title:b_bologna.title_province = { add_special_building_slot = generic_university } # Added in province history
		title:b_salamanca.title_province = { add_special_building_slot = generic_university }
		title:b_madrid.title_province = { add_special_building_slot = generic_university }
		#title:b_oxford.title_province = { add_special_building_slot = generic_university } # Added in province history
		title:b_cambridge.title_province = { add_special_building_slot = generic_university }
		title:b_padua.title_province = { add_special_building_slot = generic_university }
		title:b_coimbra.title_province = { add_special_building_slot = generic_university }
		title:b_napoli.title_province = { add_special_building_slot = generic_university }
		title:b_milano.title_province = { add_special_building_slot = generic_university }
		title:b_vienna.title_province = { add_special_building_slot = generic_university }
		title:b_praha.title_province = { add_special_building_slot = generic_university }
		title:b_perugia.title_province = { add_special_building_slot = generic_university }
		title:b_malappuram.title_province = { add_special_building_slot = generic_university }
		title:b_janakpur.title_province = { add_special_building_slot = generic_university }
		title:b_uppsala.title_province = { add_special_building_slot = generic_university }
		title:b_montlhery.title_province = { add_special_building_slot = generic_university } # Technically should be Paris, but that's occupied by Notre Dame
		title:b_qartajana.title_province = { add_special_building_slot = generic_university } # Technically should be Tunis, but that's occupied by a cathedral
		title:b_wazwan.title_province = { add_special_building_slot = generic_university } # Technically should be Isfahan, but that's occupied by the Friday Mosque
		title:b_sarsar.title_province = { add_special_building_slot = generic_university } # Technically should be Baghdad, but that's occupied by the House of Wisdom
		title:b_speyer.title_province = { add_special_building_slot = generic_university } # 1350ish, should be in Heidelberg but that's a church
		title:b_krakow.title_province = { add_special_building_slot = generic_university } # 1364
		title:b_pisa.title_province = { add_special_building_slot = generic_university } # 1350ish
		title:b_rostock.title_province = { add_special_building_slot = generic_university } # 1400ish
		title:b_turin.title_province = { add_special_building_slot = generic_university } # 1400ish
		title:b_ferrara.title_province = { add_special_building_slot = generic_university } # 1400ish
		title:b_leipzig.title_province = { add_special_building_slot = generic_university } # 1400ish, a city holding
		title:b_messina.title_province = { add_special_building_slot = generic_university }  # 1400ish, should be in Catania but that's a church
		if = {
			limit = {
				has_cp3_dlc_trigger = yes
			}
			title:b_sitges.title_province = { add_special_building_slot = generic_university } # Should be Barcelona but that location has another building now
		}
		else = {
			title:b_barcelona.title_province = { add_special_building_slot = generic_university } # 1450ish, but still fun to build
		}
		title:b_dumbarton.title_province = { add_special_building_slot = generic_university } # 1450ish, but still fun to build
		title:b_bidar.title_province = { add_special_building_slot = generic_university } # 1450ish, but still fun to build
		title:b_changsha.title_province = {
			add_special_building_slot = generic_university
		}

		### GREAT WALL OF CHINA ###

		title:b_wulan.title_province = { add_great_building = the_great_wall_01 }
		title:b_fengan.title_province = { add_great_building = the_great_wall_01 }
		title:b_mingsha.title_province = { add_great_building = the_great_wall_01 }
		title:b_yaode.title_province = { add_great_building = the_great_wall_01 }
		title:b_huile.title_province = { add_great_building = the_great_wall_01 }
		title:b_baojing.title_province = { add_great_building = the_great_wall_01 }
		title:b_huaiyuan.title_province = { add_great_building = the_great_wall_01 }
		title:b_shengwei.title_province = { add_great_building = the_great_wall_01 }
		title:b_hequ.title_province = { add_great_building = the_great_wall_01 }
		title:b_helan.title_province = { add_great_building = the_great_wall_01 }
		title:b_dengkou.title_province = { add_great_building = the_great_wall_01 }
		title:b_wuluhai.title_province = { add_great_building = the_great_wall_01 }
		title:b_yongfeng.title_province = { add_great_building = the_great_wall_01 }
		title:b_jiuyuan.title_province = { add_great_building = the_great_wall_01 }
		title:b_tiande.title_province = { add_great_building = the_great_wall_01 }

		title:b_jincheng.title_province = { add_great_building = the_great_wall_02 }
		title:b_huichuan.title_province = { add_great_building = the_great_wall_02 }
		title:b_huairong_2.title_province = { add_great_building = the_great_wall_02 }
		title:b_pinggao.title_province = { add_great_building = the_great_wall_02 }
		title:b_huaide.title_province = { add_great_building = the_great_wall_02 }
		title:b_fangqu.title_province = { add_great_building = the_great_wall_02 }
		title:b_huaian_2.title_province = { add_great_building = the_great_wall_02 }
		title:b_luoyuan.title_province = { add_great_building = the_great_wall_02 }
		title:b_hengshan_3.title_province = { add_great_building = the_great_wall_02 }
		title:b_wuyan.title_province = { add_great_building = the_great_wall_02 }
		title:b_ningshuo.title_province = { add_great_building = the_great_wall_02 }
		title:b_longquan.title_province = { add_great_building = the_great_wall_02 }
		title:b_rulin.title_province = { add_great_building = the_great_wall_02 }
		title:b_kaiguang.title_province = { add_great_building = the_great_wall_02 }
		title:b_linzhou_yincheng.title_province = { add_great_building = the_great_wall_02 }
		title:b_xiazhou_dejing_east.title_province = { add_great_building = the_great_wall_02 }

		title:b_xuande.title_province = { add_great_building = the_great_wall_03 }
		title:b_baishui.title_province = { add_great_building = the_great_wall_03 }
		title:b_rouxuan.title_province = { add_great_building = the_great_wall_03 }
		title:b_cirlxj_yangcheng.title_province = { add_great_building = the_great_wall_03 }

		### COA ###
		if = {
			limit = {
				game_start_date <= 1000.1.1
			}
			title:e_scandinavia = { set_coa = e_scandinavia_norse }
			title:k_sweden = { set_coa = k_sweden_norse }
			title:d_svealand = { set_coa = d_svealand_norse }
			title:c_upland = { set_coa = c_upland_norse }
			title:c_gastrikland = { set_coa = c_gastrikland_norse }
			title:c_sodermannaland = { set_coa = c_sodermannaland_norse }
			title:c_aland = { set_coa = c_aland_norse }
			title:d_bergslagen = { set_coa = d_bergslagen_norse }
			title:c_vastmanland = { set_coa = c_vastmanland_norse  }
			title:c_varmland = { set_coa = c_varmland_norse }
			title:c_dalarna = { set_coa = c_dalarna_norse }
			title:c_dalabergslagen = { set_coa = c_dalabergslagen_norse }
			title:d_vastergotland = { set_coa = d_vastergotland_norse }
			title:c_vastergotland = { set_coa = c_vastergotland_norse }
			title:c_skara = { set_coa = c_skara_norse }
			title:c_dal = { set_coa = c_dal_norse }
			title:c_nordmark = { set_coa = c_nordmark_norse }
			title:d_ostergotland = { set_coa = d_ostergotland_norse }
			title:c_ostergotland = { set_coa = c_ostergotland_norse }
			title:c_kinda = { set_coa = c_kinda_norse }
			title:c_narke = { set_coa = c_narke_norse }
			title:d_smaland = { set_coa = d_smaland_norse }
			title:c_more = { set_coa = c_more_norse }
			title:c_sevede = { set_coa = c_sevede_norse }
			title:c_varend = { set_coa = c_varend_norse }
			title:c_njudung = { set_coa = c_njudung_norse }
			title:c_finnveden = { set_coa = c_finnveden_norse }
			title:c_oland = { set_coa = c_oland_norse }
			title:d_norrland = { set_coa = d_norrland_norse }
			title:c_halsingland = { set_coa = c_halsingland_norse }
			title:c_medelpad = { set_coa = c_medelpad_norse }
			title:c_angermanland = { set_coa = c_angermanland_norse }
			title:d_gotland = { set_coa = d_gotland_norse }
			title:c_gutland = { set_coa = c_gutland_norse }
			title:k_norway = { set_coa = k_norway_norse }
			title:d_viken = { set_coa = d_viken_norse }
			title:c_vingulmork = { set_coa = c_vingulmork_norse }
			title:c_raniriki = { set_coa = c_raniriki_norse }
			title:c_vestfold = { set_coa = c_vestfold_norse }
			title:c_telemark = { set_coa = c_telemark_norse }
			title:d_agder = { set_coa = d_agder_norse }
			title:c_nedenes = { set_coa = c_nedenes_norse }
			title:c_agdeside = { set_coa = c_agdeside_norse }
			title:d_vestlandi = { set_coa = d_vestlandi_norse }
			title:c_rogalandi = { set_coa = c_rogalandi_norse }
			title:c_hordalandi = { set_coa = c_hordalandi_norse }
			title:c_sogn = { set_coa = c_sogn_norse }
			title:d_trandalog = { set_coa = d_trandalog_norse }
			title:c_trandheim = { set_coa = c_trandheim_norse }
			title:c_norwegian_more = { set_coa = c_norwegian_more_norse }
			title:c_firdafylki = { set_coa = c_firdafylki_norse }
			title:d_dalir = { set_coa = d_dalir_norse }
			title:c_hedmork = { set_coa = c_hedmork_norse }
			title:c_gudbrandsdalir = { set_coa = c_gudbrandsdalir_norse }
			title:c_eystridalir = { set_coa = c_eystridalir_norse }
			title:c_gauldala = { set_coa = c_gauldala_norse }
			title:d_halogaland = { set_coa = d_halogaland_norse }
			title:c_vastvag = { set_coa = c_vastvag_norse }
			title:c_bothin = { set_coa = c_bothin_norse }
			title:c_namdalfylki = { set_coa = c_namdalfylki_norse }
			title:d_iceland = { set_coa = d_iceland_norse }
			title:c_vestisland = { set_coa = c_vestisland_norse }
			title:c_nordrland = { set_coa = c_nordrland_norse }
			title:c_austisland = { set_coa = c_austisland_norse }
			title:c_sudurland = { set_coa = c_sudurland_norse }
			title:d_northern_isles = { set_coa = d_northern_isles_norse }
			title:c_orkney = { set_coa = c_orkney_norse }
			title:c_faereyar = { set_coa = c_faereyar_norse }
			title:c_shetland = { set_coa = c_shetland_norse }
			title:d_jamtland = { set_coa = d_jamtland_norse }
			title:c_jamtfir = { set_coa = c_jamtfir_norse }
			title:c_morarna = { set_coa = c_morarna_norse }
			title:c_helgum = { set_coa = c_helgum_norse }
			title:c_harjadalen = { set_coa = c_harjadalen_norse }
			title:k_denmark = { set_coa = k_denmark_norse }
			title:d_sjaelland = { set_coa = d_sjaelland_norse }
			title:c_sjaelland = { set_coa = c_sjaelland_norse }
			title:c_fyn = { set_coa = c_fyn_norse }
			title:c_lolland_falster = { set_coa = c_lolland_falster_norse }
			title:d_skane = { set_coa = d_skane_norse }
			title:c_skane = { set_coa = c_skane_norse }
			title:c_halland = { set_coa = c_halland_norse }
			title:c_bornholm = { set_coa = c_bornholm_norse }
			title:c_blekinge = { set_coa = c_blekinge_norse }
			title:d_jylland = { set_coa = d_jylland_norse }
			title:c_aarhus = { set_coa = c_aarhus_norse }
			title:c_viborg = { set_coa = c_viborg_norse }
			title:c_ringkobing = { set_coa = c_ringkobing_norse }
			title:c_aalborg = { set_coa = c_aalborg_norse }
			title:d_slesvig = { set_coa = d_slesvig_norse }
			title:c_slesvig = { set_coa = c_slesvig_norse }
			title:c_vorbasse = { set_coa = c_vorbasse_norse }
			title:c_ribe = { set_coa = c_ribe_norse }
			title:d_york = { set_coa = d_york_norse }
			title:c_east_riding = { set_coa = c_east_riding_norse }
			title:d_western_isles = { set_coa = d_western_isles_norse }
			title:c_inner_hebrides = { set_coa = c_inner_hebrides_norse  }
			title:c_dublin = { set_coa = c_dublin_norse }
			title:c_argyll = { set_coa = c_argyll_norse }
		}
		if = {
			limit = {
				game_start_date >= 1067.12.25
			}
			title:k_england = { set_coa = k_england_norman }
		}
		if = {
			limit = {
				game_start_date >= 938.1.1
			}
			title:k_viet = { set_coa = k_dai_viet }
		}

		### GRANDEUR ###
		#Royal Court: Set starting Grandeur to be the same as Expected
		if = {
			limit = {
				has_dlc_feature = royal_court
			}
			every_character_with_royal_court = {
				set_current_court_grandeur = court_grandeur_minimum_expected
				apply_hold_court_grace_effect = yes
				# Stops Hold Court reminders at game start
				set_variable = {
					name = last_hold_court_date
					value = current_year
				}
			}
		}

		### STRUGGLES ###
		if = {
			limit = { current_date = 867.1.1 }

			# Iberian Struggle
			if = { # If we're in 867, Aragonese should be removed from the Struggle, since they don't quite exist yet.
				limit = { exists = struggle:iberian_struggle }
				struggle:iberian_struggle = { set_culture_as_uninvolved = culture:aragonese }
			}

			# Persian Struggle
			if = { # If the load order ever changes this struggle is going to break. This must always be read before the struggle.
				limit = { exists = struggle:persian_struggle }
				debug_log = "Samarra Struggle: Gamne start data has been set"
				struggle:persian_struggle = { # Use the object explorer to debug this data (yes, the time has come to learn how to use it)

					# Struggle on_start
					fp3_remove_vassal_contract_cooldown_for_tension_effect = yes

					# Flag some titles as un-dissolutionable within the struggle.
					title:e_arabia = { set_variable = struggle_block_dissolution_faction }
					title:d_sunni = { set_variable = struggle_block_dissolution_faction }
				}
			}
		}

		### REGENCIES ###
		# Pre-defined historic regencies setup.
		## NOTE: we do these first to avoid feed messages getting weird due to regents being replaced immediately after getting their position.
		## 1066.
		if = {
			limit = { game_start_date = 1066.9.15 }
			# Designate some regents.
			## King Philippe of France & Duke Boudewijn of Flanders (friend of his dad's)
			character:214 = {
				designate_diarch = character:364
				# Baldwin of Flanders also promised the prior king he'd take care of Philippe, so we add that starting loyalty hook.
				add_hook = {
					type = predecessor_loyalty_hook
					target = character:364
					years = historic_regent_loyal_after_death_hook_duration_years_char_214_value
				}
			}
			### Plus remember who the promise was made to.
			character:364 = {
				add_opinion = {
					target = character:214
					modifier = promise_to_predecessor
					opinion = 50
				}
				set_variable = {
					name = promise_to_predecessor
					value = character:208
					years = historic_regent_loyal_after_death_hook_duration_years_char_214_value
				}
			}
			## Count Bouchard of Vendome & Guy de Bachaumont (his uncle)
			character:40905 = { designate_diarch = character:40376 }
			## Caliph al-Mustansir & Rasad (his mother)
			character:3096 = { designate_diarch = character:additional_fatimids_1 }
			## Count Ermengol of Urgell & Infanta Sancha of Aragon (his stepmother)
			character:110550 = { designate_diarch = character:110514 }
			## Duke Dirk of Holland & Count Robrecht of Zeeland (his stepfather)
			character:106520 = { designate_diarch = character:368 }
			## Duke Sven of Ostergotland & Kol Sverker (his father)
			character:100530 = { designate_diarch = character:100529 }
			## King Salamon of Hungary & Queen Mother Anastasia (his mother, in the absence of any better recorded options, and to keep other hostile relatives out of the job)
			character:476 = { designate_diarch = character:637 }
			## Prince Demetre of Georgia & Alda Oseti (his mother)
			character:9957 = { designate_diarch = character:9956 }
			## Sultan al-Muazzam Alp Arslan and Hassan "the Order of the Realm".
			character:3040 = {
				designate_diarch = character:3050
				# This is a vizierate as well, so start the diarchy manually.
				try_start_diarchy = vizierate
				# Tell Alp that he appointed Hassan so he remembers not to dismiss him.
				set_variable = {
					name = my_vizier
					value = character:3050
				}
			}
			## Constantine X & Michael Doukas.
			character:1732 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_emperorship
					set_diarch = character:1736
					set_designated_heir = character:1736
				}
			}
			# Plus remove all the generated opinions.
			## King Philippe of France & Duke Boudewijn of Flanders
			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:364
				LIEGE = character:214
			}
			## Count Bouchard of Vendome & Guy de Bachaumont
			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:40376
				LIEGE = character:40905
			}
			## Caliph al-Mustansir & Rasad
			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:additional_fatimids_1
				LIEGE = character:3096
			}
			## Count Ermengol of Urgell & Infanta Sancha of Aragon
			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:110514
				LIEGE = character:110550
			}
			## Duke Dirk of Holland & Count Robrecht of Zeeland
			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:368
				LIEGE = character:106520
			}
			## Duke Sven of Ostergotland & Kol Sverker
			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:100529
				LIEGE = character:100530
			}
			## King Salamon of Hungary & Queen Mother Anastasia
			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:637
				LIEGE = character:476
			}
			## Prince Demetre of Georgia & Alda Oseti
			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:9956
				LIEGE = character:9957
			}
			## Sultan al-Muazzam Alp Arslan and Hassan "the Order of the Realm".
			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:3050
				LIEGE = character:3040
			}
		}
		else_if = {
			limit = { game_start_date = 1178.10.1 }
			# Set up some diarchs.
			## The future Richard I of England managing Aquitaine in place of his mother (who is under house arrest)
			character:205730 = { designate_diarch = character:204510 }
			## Jahan Pahlavan Muhammad as regent for Togrul
			character:144056 = { designate_diarch = character:144052 }
			## Manuel Komnenos and Alexios Komnenos
			character:215530 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = junior_emperorship
					set_diarch = character:215531
					set_designated_heir = character:215531
				}
			}
			## Henry II of England and the Young King
			character:204500 = {
				designate_diarch = character:204508
				try_start_diarchy = co_monarchy
				set_designated_heir = character:204508
			}
			## Teresa of Portugal for Afonso the Conqueror
			character:209503 = {
				try_start_diarchy = regency
				set_diarch = character:209510
			}
			## Kara Khitai, Wolila for Zhilugu
			character:188912 = {
				try_start_diarchy = nomad_regency
				set_diarch = character:188909
			}
			## Dai Viet, Long Trat Vuong & To Hien Thanh
			character:viet_ly_2 = {
				set_diarch = character:viet_to_1
				#designate_diarch = character:viet_to_1
			}
			# Plus remove all the generated opinions.
			## Richard I and Eleanor of Aquitaine
			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:204510
				LIEGE = character:205730
			}
			## Muhammad Jahan Pahlavan and Togrul
			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:144052
				LIEGE = character:144056
			}
			## Manuel Komnenos and Alexios
			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:215531
				LIEGE = character:215530
			}
			## Henry II and Young Henry
			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:204508
				LIEGE = character:204500
			}
			## Teresa and Afonso
			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:209510
				LIEGE = character:209503
			}
			## Wolila and Zhilugu
			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:188909
				LIEGE = character:188912
			}
			## Long Trat Vuong and To Hien Thanh
			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:viet_to_1
				LIEGE = character:viet_ly_2
			}
		}
		if = {
			limit = { has_tgp_dlc_trigger = no }
			title:k_yongson_throne ?= {
				holder ?= {
					destroy_title = prev
				}
			}
		}
		every_ruler = { # PUT EVERY_RULER TYPE STUFF HERE FOR PERFORMANCE REASONS
			# Set up anyone who should be in a regency at start whether we have sources or not.
			## If you start as a child, incapable, or imprisoned, you get a regency.
			if = {
				limit = {
					OR = {
						is_adult = no
						is_incapable = yes
						is_imprisoned = yes
					}
				}
				# We don't want to check over so many characters *twice*, so we check again inside the block to determine what type of regency to put 'em in.
				## Temporary Regencies.
				if = {
					limit = { is_imprisoned = yes }
					trigger_event = {
						id = diarchy.0001
						delayed = yes
					}
				}
				## Entrenched Regencies.
				else = {
					trigger_event = {
						id = diarchy.0011
						delayed = yes
					}
				}
			}
			if = {
				limit = {
					has_mpo_dlc_trigger = no
				}
				if = {
					limit = {
						has_government = nomad_government
					}
					change_government = tribal_government
				}
				else_if = {
					limit = {
						has_government = herder_government
					}
					change_government = tribal_government
				}
			}

			# Set Coronation laws for everyone
			if = {
				limit = {
					coronation_trigger = yes
				}
				if = {
					limit = {
						highest_held_title_tier = tier_kingdom
					}
					add_realm_law_skip_effects = crowned_king
					set_variable = crowned_king_var
				}
				else_if = {
					limit = {
						highest_held_title_tier > tier_kingdom
					}
					add_realm_law_skip_effects = crowned_emperor
					set_variable = crowned_emperor_var
				}
			}

			# Admin - Let's give existing governors the Governor trait on game start
			if = {
				limit = {
					is_governor = yes
					NOT = { has_trait = governor }
					OR = {
						government_allows = administrative
						government_is_japanese_trigger = yes
					}
				}
				add_trait = governor
				add_trait_xp = {
					trait = governor
					value = {
						add = primary_title.title_held_years
						multiply = 2
						if = {
							limit = {
								age >= 50
								has_government = japan_administrative_government
							}
							add = {
								value = age
								divide = 4
							}
						}
					}
				}
			}
			# Clean up TGP governments is the Expansion is not enabled
			if = {
				limit = { has_tgp_dlc_trigger = no }
				# TGP: Clean up maritime tribal govs and revert them to non-dlc tribals
				if = {
					limit = {
						government_has_flag = government_is_wanua
					}
					change_government = tribal_government
				}
				# TGP: Clean up mandala govs and revert them to non-dlc feudals
				else_if = {
					limit = {
						government_has_flag = government_is_mandala
					}
					change_government = feudal_government
				}
				### Every Celestial/Meritocratic/Japanese Government becomes feudal if DLC not enabled, pre-lobby history setup ###
				else_if = {
					limit = {
						OR = {
							has_government = celestial_government
							has_government = meritocratic_government
							has_government = steppe_admin_government
							has_government = japan_administrative_government
							has_government = japan_feudal_government
						}
					}
					change_government = feudal_government

				}
				if = {
					limit = {
						any_held_title = {
							is_noble_family_title = yes
						}
					}
					every_held_title = {
						limit = {
							is_noble_family_title = yes
							title_domicile ?= {
								OR = {
									is_domicile_type = japanese_manor
									is_domicile_type = east_asian_estate
								}
							}
						}
						save_temporary_scope_as = family_title
						prev = { destroy_title = scope:family_title }
					}
				}
			}
			# TGP: Adjust China's starting laws
			else_if = {
				limit = {
					realm_law_use_celestial_bureaucracy = yes
				}
				if = {
					limit = {
						game_start_date >= 1066.9.15
					}
					add_realm_law_skip_effects = celestial_bureaucracy_2
					if = {
						limit = {
							top_liege != this
						}
						add_realm_law_skip_effects = celestial_army_vassal_law_2
					}
					else = {
						add_realm_law_skip_effects = celestial_army_liege_law_2 # Let's give them the matching army level as well
					}
				}
			}
			if = {
				limit = {
					has_domicile = yes
					any_held_title = {
						is_noble_family_title = yes
					}
				}
				if = {
					limit = {
						is_landed = yes
						domicile.domicile_location != this.capital_province
					}
					random_held_title = {
						limit = {
							is_noble_family_title = yes
						}
						set_capital_county = prev.capital_county
					}
					domicile ?= {
						move_domicile = prev.capital_province
					}
				}
				if = {
					limit = {
						tgp_is_any_minister = yes
					}
					random_held_title = {
						limit = {
							tier = tier_empire
						}
						set_capital_county = prev.top_liege.capital_county
					}
					random_held_title = {
						limit = {
							is_noble_family_title = yes
						}
						set_capital_county = prev.top_liege.capital_county
					}
					domicile ?= {
						move_domicile = prev.top_liege.capital_province
					}
				}
			}
		}
		# DYNASTIC CYCLE SETUP
		situation:dynastic_cycle ?= {
			title:h_china = {
				set_variable = {
					name = years_since_imperial_examination
					value = 0
				}
			}
			if = {
				limit = { game_start_date < 868.1.1 }
				tgp_set_wuking_element_effect = { ELEMENT = earth } # Tang
				every_situation_sub_region = {
					add_takeover_phase_points = {
					   phase = situation_dynastic_cycle_phase_chaos
					   points = 800
					}
				}
			}
			else = {
				tgp_set_wuking_element_effect = { ELEMENT = fire } # Song
			}
		}
		setup_tributaries_effect = yes # defined in 00_tributary_setup_effect.txt
		# Sort custom regencies.
		## Fatimid Caliphate - basically stuck in the back-end of an entrenched regencies from game start.
		if = {
			limit = { exists = character:3096 }
			character:3096 = { trigger_event = diarchy.0012 }
		}
		else_if = {
			limit = { exists = character:188912 }
			character:188912 = { trigger_event = diarchy.0012 }
		}

		### FERTILE LANDS ###
		# For deserts that are supposed to be very fertile
		title:c_taizz = { add_county_modifier = fertile_desert_mountains_modifier }
		title:c_mandab = { add_county_modifier = fertile_desert_mountains_modifier }
		title:c_zabid = { add_county_modifier = fertile_desert_mountains_modifier }
		title:c_sanaa = { add_county_modifier = fertile_desert_mountains_modifier }
		title:c_dathina = { add_county_modifier = fertile_desert_mountains_modifier }

		### HENDEKAPOLIS ###
		title:c_ionia = { add_county_modifier = dodekapolis_modifier }
		title:c_chios = { add_county_modifier = dodekapolis_modifier }
		title:c_aeolis = { add_county_modifier = dodekapolis_modifier }
		title:c_lesbos = { add_county_modifier = dodekapolis_modifier }

		### GREECE BACKWATER COUNTIES ###
		if = {
			limit = { has_ep3_dlc_trigger = yes }
			title:c_laconia = { add_county_modifier = backwater_county_modifier }
			title:c_messenia = { add_county_modifier = backwater_county_modifier }
			title:c_korinthos = { add_county_modifier = backwater_county_modifier }
			title:c_achaia = { add_county_modifier = backwater_county_modifier }
			title:c_cephalonia = { add_county_modifier = backwater_county_modifier }
			title:c_attica = { add_county_modifier = backwater_county_modifier }
			title:c_boeotia = { add_county_modifier = backwater_county_modifier }
			title:c_aetolia = { add_county_modifier = backwater_county_modifier }
			title:c_naxos = { add_county_modifier = backwater_county_modifier }
			title:c_euboea = { add_county_modifier = backwater_county_modifier }
			title:c_neopatras = { add_county_modifier = backwater_county_modifier }
			title:c_demetrias = { add_county_modifier = backwater_county_modifier }
			title:c_thessaliotis = { add_county_modifier = backwater_county_modifier }
			title:c_thessalia = { add_county_modifier = backwater_county_modifier }
			title:c_epeiros = { add_county_modifier = backwater_county_modifier }
			title:c_buthrotum = { add_county_modifier = backwater_county_modifier }
			title:c_veria = { add_county_modifier = backwater_county_modifier }
			title:c_metzovo = { add_county_modifier = backwater_county_modifier }
			title:c_chalkidike = { add_county_modifier = backwater_county_modifier }
			title:c_thessalonika = { add_county_modifier = backwater_county_modifier }
			title:c_serres = { add_county_modifier = backwater_county_modifier }
			title:c_mosynopolis = { add_county_modifier = backwater_county_modifier }
			title:c_ohrid = { add_county_modifier = backwater_county_modifier }
			title:c_antipatreia = { add_county_modifier = backwater_county_modifier }
			title:c_dyrrachion = { add_county_modifier = backwater_county_modifier }
			title:c_avlonas = { add_county_modifier = backwater_county_modifier }
		}

		### Pandidakterion IN CONSTANTINOPLE ###
		if = {
			limit = {
				has_ep3_dlc_trigger = yes
				current_date >= 1046.1.1
			}
			title:c_byzantion = { add_county_modifier = pandidakterion_university_modifier }
		}

		### Varangian Guard ###
		if = {
			limit = {
				has_ep3_dlc_trigger = yes
				current_date >= 988.1.1
			}
			title:e_byzantium = { set_variable = founded_varangian_guard }
		}

		if = {
			limit = {
				has_dlc_feature = hybridize_culture
				NOT = {
					has_dlc_feature = khans_of_the_steppe
				}
			}
			culture:mongol = {
				add_culture_tradition = tradition_malleable_invaders
			}
			culture:khitan = {
				add_culture_tradition = tradition_malleable_invaders
			}
			culture:jurchen = {
				add_culture_tradition = tradition_malleable_invaders
			}
			culture:cuman = {
				add_culture_tradition = tradition_malleable_invaders
			}
			culture:bolghar = {
				add_culture_tradition = tradition_malleable_invaders
			}
			culture:bashkir = {
				add_culture_tradition = tradition_malleable_invaders
			}
			culture:karluk = {
				add_culture_tradition = tradition_malleable_invaders
			}
			culture:shatuo = {
				add_culture_tradition = tradition_malleable_invaders
			}
		}

		if = {
			limit = {
				NOT = {
					has_dlc_feature = khans_of_the_steppe
				}
			}
			culture:hunnic = { add_culture_tradition = tradition_horse_lords add_culture_tradition = tradition_steppe_tolerance }
			culture:saka = { add_culture_tradition = tradition_horse_lords }
			culture:alan = { add_culture_tradition = tradition_horse_lords add_culture_tradition = tradition_steppe_tolerance }
			culture:mongol = { add_culture_tradition = tradition_horse_lords add_culture_tradition = tradition_steppe_tolerance }
			culture:buryat = { add_culture_tradition = tradition_horse_lords add_culture_tradition = tradition_steppe_tolerance }
			culture:oirat = { add_culture_tradition = tradition_horse_lords }
			culture:naiman = { add_culture_tradition = tradition_horse_lords add_culture_tradition = tradition_steppe_tolerance }
			culture:kerait = { add_culture_tradition = tradition_horse_lords add_culture_tradition = tradition_steppe_tolerance }
			culture:khitan = { add_culture_tradition = tradition_horse_lords }
			culture:tuyuhun = { add_culture_tradition = tradition_horse_lords }
			culture:jurchen = { add_culture_tradition = tradition_horse_lords }
			culture:cuman = { add_culture_tradition = tradition_horse_lords }
			culture:khazar = { add_culture_tradition = tradition_horse_lords add_culture_tradition = tradition_steppe_tolerance }
			culture:bolghar = { add_culture_tradition = tradition_horse_lords }
			culture:bashkir = { add_culture_tradition = tradition_horse_lords }
			culture:avar = { add_culture_tradition = tradition_horse_lords }
			culture:karluk = { add_culture_tradition = tradition_horse_lords add_culture_tradition = tradition_steppe_tolerance }
			culture:kimek = { add_culture_tradition = tradition_horse_lords }
			culture:kipchak = { add_culture_tradition = tradition_horse_lords }
			culture:laktan = { add_culture_tradition = tradition_horse_lords }
			culture:kirghiz = { add_culture_tradition = tradition_horse_lords }
			culture:yughur = { add_culture_tradition = tradition_horse_lords add_culture_tradition = tradition_steppe_tolerance }
			culture:uriankhai = { add_culture_tradition = tradition_horse_lords }
			culture:chuvash = { add_culture_tradition = tradition_horse_lords }
			culture:ongud = { add_culture_tradition = tradition_horse_lords }
			culture:turkmen = { add_culture_tradition = tradition_horse_lords }
			culture:mogyer = { add_culture_tradition = tradition_horse_lords }
			culture:pecheneg = { add_culture_tradition = tradition_horse_lords }
			culture:ongud = { add_culture_tradition = tradition_steppe_tolerance }
			culture:uyghur = { add_culture_tradition = tradition_steppe_tolerance }
			#culture:turkish = { add_culture_tradition = tradition_horse_lords }
		}

		### DEBUG GLOBAL VARIABLES ###
		# We set these here so that they present nicely and you can see when some variables register zero.

		# FP3 Struggle.
		if = {
			limit = { gather_debug_variables_for_persian_struggle_trigger = yes }
			# ENDING
			set_global_variable = {
				name = sp_end_date
				value = 0
			}
			# There's also fp3_struggle_ending; we don't track that here because it has functional usage that depends on it existing or not, so it's not a debug variable.

			# PHASES
			set_global_variable = {
				name = sp_phase_unrest
				value = 0
			}
			set_global_variable = {
				name = sp_phase_stabil
				value = 0
			}

			# UNREST
			set_global_variable = {
				name = sp_unrest_catalyst_yearly_influential_house_is_antagonistic_major
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_yearly_influential_house_is_antagonistic_medium
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_yearly_influential_house_is_antagonistic_minor
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_yearly_influential_house_is_antagonistic_minimal
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_becomes_rival_supporter_detractor
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_gain_claim_on_title_fp3
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_usurp_title_fp3
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_cadet_branch_created
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_supporter_forced_conversion
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_execute_supporter
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_imprison_supporter
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_unnatural_death_supporter
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_reveal_secret_supporter
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_turn_supporter_into_detractor
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_forming_alliance_between_detractor_uninvolved_rulers
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_detractor_win_unfair_war_within_the_region
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_detractor_win_fair_war_within_the_region
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_detractor_declare_unfair_war_within_the_region
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_detractor_declare_fair_war_within_the_region
				value = 0
			}
			set_global_variable = {
				name = sp_unrest_catalyst_became_detractor_fp3
				value = 0
			}
			# STABILISATION
			set_global_variable = {
				name = sp_stabil_catalyst_yearly_influential_house_is_harmonious_major
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_yearly_influential_house_is_harmonious_medium
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_yearly_influential_house_is_harmonious_minor
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_yearly_influential_house_is_harmonious_minimal
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_learned_new_language_important
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_vassalize_independent_ruler
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_invite_involved_as_honorary_guests_to_feast_hunt
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_supporter_win_unfair_war_within_the_region
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_supporter_win_fair_war_within_the_region
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_supporter_declare_unfair_war_within_the_region
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_supporter_declare_fair_war_within_the_region
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_install_loyalist_cb
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_imprison_detractor
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_execute_detractor
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_unnatural_death_detractor
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_reveal_secret_detractor
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_detractor_forced_conversion
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_turn_detractor_into_supporter
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_gain_struggle_titles_from_interlopers_uninvolved
				value = 0
			}
			set_global_variable = {
				name = sp_stabil_catalyst_became_supporter_fp3
				value = 0
			}
			# CONCESSION
			set_global_variable = {
				name = sp_concession_catalyst_missing_caliphate_or_arabian_empire
				value = 0
			}
			set_global_variable = {
				name = sp_concession_catalyst_caliph_or_emperor_loses_revolt_war
				value = 0
			}
			set_global_variable = {
				name = sp_concession_catalyst_caliph_or_emperor_accepts_faction_demands
				value = 0
			}
			set_global_variable = {
				name = sp_concession_catalyst_caliph_died_violently
				value = 0
			}
			set_global_variable = {
				name = sp_concession_catalyst_caliph_died_naturally
				value = 0
			}
			set_global_variable = {
				name = sp_concession_catalyst_war_ends_in_white_peace_between_supporter_detractor
				value = 0
			}
			set_global_variable = {
				name = sp_concession_catalyst_became_best_friend_soulmate_supporter_detractor
				value = 0
			}
			set_global_variable = {
				name = sp_concession_catalyst_became_friend_lover_supporter_detractor
				value = 0
			}
			set_global_variable = {
				name = sp_concession_catalyst_forming_alliance_between_supporter_detractor_rulers
				value = 0
			}
			set_global_variable = {
				name = sp_concession_catalyst_abandon_hook_on_supporter_detractor
				value = 0
			}
			set_global_variable = {
				name = sp_concession_catalyst_grants_pardon_supporter_detractor
				value = 0
			}
			set_global_variable = {
				name = sp_concession_catalyst_release_supporter_detractor
				value = 0
			}
			set_global_variable = {
				name = sp_concession_catalyst_ransom_supporter_detractor
				value = 0
			}
			set_global_variable = {
				name = sp_concession_catalyst_grants_vassal_to_de_jure_liege_supporter_detractor
				value = 0
			}
			set_global_variable = {
				name = sp_concession_catalyst_gift_supporter_detractor_ruler
				value = 0
			}
			set_global_variable = {
				name = sp_concession_catalyst_interloper_uninvolved_gain_struggle_titles
				value = 0
			}
			set_global_variable = {
				name = sp_concession_catalyst_raided_involved
				value = 0
			}
		}

		# UNITY CONFIG
		## 867.
		if = {
			limit = { game_start_date = 867.1.1 }
			# Twiddle some starting unities.
			## The Abassids are in the middle of a self-killing frenzy, so we lower theirs substantially.
			house:house_abbasid ?= {
				add_unity_value = {
					value = -100
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
			## The Samanids are juuuuust about to get started on killing each other over who gets to lead Transoxiana.
			house:house_samanid ?= {
				add_unity_value = {
					value = -40
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
			## The Afrighids (both of them) are having fairly few arguments because only one of them can speak and it's very easy to manage relations with a baby.
			dynasty:1042112.dynast.house ?= {
				add_unity_value = {
					value = 50
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
			## The Tahirids are scattered but actually get along quite well and support each other politically (mostly).
			dynasty:811.dynast.house ?= {
				add_unity_value = {
					value = 100
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
			## The Umayyads are having something of a renaissance.
			dynasty:597.dynast.house ?= {
				add_unity_value = {
					value = 100
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		# LEGITIMACY CONFIG
		## 867.
		if = {
			limit = { game_start_date = 867.1.1 }
			## Basileus Basileios was actually elected, so he's technically legitimate, but starts at level 2. With this he should be level 3.
			character:1700 = {
				add_legitimacy = major_legitimacy_gain
			}
		}

		# Cultural setup
		if = {
			limit = {
				game_start_date = 1178.10.1
			}
			culture:norman = {
				set_name_list = name_list_late_norman
			}
		}

		### EP3 BYZANTIUM IMPORTANT COUNTIES ###
		if = {
			limit = { has_ep3_dlc_trigger = yes }
			title:c_antiocheia = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_jerusalem = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_alexandria = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_abbadan = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_edessa = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_bari = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_siracusa = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_roma = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_ravenna = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_tunis = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_tangiers = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_murcia = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_lombardia = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_trier = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_cumberland = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_northumberland = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_chandax = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_tourraine = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = ep3_emperor_yearly.2000
				}
			}
			title:c_byzantion = {
				set_important_location = {
					title = title:e_byzantium
					enter_realm_event = roman_restoration.1200
				}
				set_important_location = {
					title = title:h_roman_empire
					enter_realm_event = roman_restoration.1200
				}
				set_important_location = {
					title = title:h_eastern_roman_empire
					enter_realm_event = roman_restoration.1200
				}
			}
		}

		# MPO Tribes of the North cultrad mechanic
		if = {
			limit = {
				has_dlc_feature = khans_of_the_steppe
			}
			every_county_in_region = {
				region = mpo_region_permafrost
				if = {
					limit = {
						holder.culture ?= culture
						culture = {
							has_cultural_parameter = permafrost_modifier_mechanic
						}
					}
					add_county_modifier = mpo_siberian_permafrost_modifier
				}
				else = {
					add_county_modifier = mpo_siberian_permafrost_modifier_bad
				}

			}
		}

		# Byzantine name game rule
		title:e_byzantium = {
			if = {
				limit = {
					has_game_rule = eastern_rome_name_of_byzantium
				}
				set_title_name = e_eastern_roman_empire
			}
			else_if = {
				limit = {
					has_game_rule = roman_empire_name_of_byzantium
				}
				set_title_name = h_roman_empire
			}
			else_if = {
				limit = {
					has_game_rule = romania_name_of_byzantium
				}
				set_title_name = e_romania_empire
			}
			else_if = {
				limit = {
					has_game_rule = empire_of_the_greeks_name_of_byzantium
				}
				set_title_name = e_empire_of_the_greeks
			}
			else_if = {
				limit = {
					has_game_rule = rhomaion_name_of_byzantium
				}
				set_title_name = e_rhomaion
			}
			else_if = {
				limit = {
					has_game_rule = unholy_roman_empire_name_of_byzantium
				}
				set_title_name = e_unholy_roman_empire
			}
		}

		# Remove Coronation Doctrine if you don't have the DLC
		if = {
			limit = {
				has_ach_dlc_trigger = no
			}
			every_religion_global = {
				every_faith = {
					switch = {
						trigger = has_doctrine
						doctrine_no_anointment = { remove_doctrine = doctrine_no_anointment }
						doctrine_anointment_permitted = { remove_doctrine = doctrine_anointment_permitted }
						doctrine_imperial_anointment = { remove_doctrine = doctrine_imperial_anointment }
					}
				}
			}
		}

		# Set Coronation laws for everyone
		if = {
			limit = {
				has_ach_dlc_trigger = yes
			}
			every_ruler = {
				limit = {
					coronation_trigger = yes
					age >= 12
					NOT = { this = character:1316 } # Heinrich IV was coronated in 1084
				}
				save_temporary_scope_as = ruler
				if = {
					limit = {
						highest_held_title_tier > tier_kingdom
						NOT = {
							has_any_shunned_or_criminal_trait_in_faith_trigger = {
								CHARACTER = scope:ruler
								FAITH = scope:ruler.faith
							}
							faith = { has_doctrine = doctrine_no_anointment }
						}
					}
					if = {
						limit = {
							NOT = {
								has_game_rule = coronation_laws_off
								has_realm_law = crowned_emperor
							}
						}
						add_realm_law_skip_effects = crowned_emperor
					}
					set_variable = crowned_emperor_var
				}
				else = {
					if = {
						limit = {
							NOT = {
								has_game_rule = coronation_laws_off
								has_realm_law = crowned_king
							}
						}
						add_realm_law_skip_effects = crowned_king
					}
					set_variable = crowned_king_var
				}
			}
		}

		# TGP: extra legitimacy for the Hegemon, so you don't fold over immediately
		if = {
			limit = { has_tgp_dlc_trigger = yes }
			title:h_china.holder = {
				# and even more for the Song, as they were in a pretty good shape on our start dates
				if = {
					limit = {
						situation:dynastic_cycle ?= {
							OR = {
								situation_current_phase = situation_dynastic_cycle_phase_stability_expansion
								situation_current_phase = situation_dynastic_cycle_phase_stability_advancement
							}
						}
					}
					add_legitimacy = 4500
				}
				else = {
					add_legitimacy = 3000
				}
			}
		}
		### TGP SILK ROAD INNOVATIONS
		tgp_silk_road_innovation_setup_effect = yes

		set_global_variable = {
			name = natural_disaster_initial_grace_period
			years = natural_disaster_initial_grace_period_years
		}

		### TGP Earthquake Regions
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_europe }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_europe_south }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_asia }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_asia_china }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_asia_japan }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_asia_minor }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_asia_indonesia }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_asia_philippines }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_asia_sakhalin_hokkaido }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_middle_east }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_india }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_steppe }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_siberia }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_burma }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:custom_arakan_mountains }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:custom_bactria }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_tibet }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_himalaya }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_africa }
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:world_africa_north_east }

		### TGP Flood Regions
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:amur_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:danube_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:daugava_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:dnieper_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:dniester_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:don_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:elbe_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:ganges_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:garonne_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:godavari_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:guadalquivir_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:guadiana_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:indus_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:irrawaddy_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:kaveri_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:loire_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:lovat_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:mahanadi_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:mekong_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:niger_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:nile_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:pearl_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:po_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:rhine_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:rhone_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:seine_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:tapti_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:tigris_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:vistula_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:volga_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:yangtze_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:yellow_river_region }
		##### HISTORICAL HOUSE RELATIONS - deliberately placed above blocs
		tgp_setup_historical_house_relation_effect = yes
		#####  TGP JAPAN #####
		if = {
			limit = { has_tgp_dlc_trigger = yes }
			### DYNASTIES
			tgp_dynasty_house_name_setup_effect = yes
			### BLOCS
			tgp_setup_historical_house_bloc_effect = yes
		}
		#
		if = {
			limit = {
				title:k_magyar = {
					exists = holder
				}
			}
			title:k_magyar = {
				add_title_law = confederation_elective_succession_law
			}
		}
		####3UR0P4 T0l3R4NC3######
		title:e_europa.holder ?= {
			every_vassal = {
				limit = {
					OR = {
						government_has_flag = government_is_feudal
						government_has_flag = government_is_tribal
					}	
					vassal_contract_has_modifiable_obligations = yes
					OR = {
						faith = faith:genevan
						faith = faith:anglican_england
						faith = faith:lutheran
						faith = faith:illuminated
						faith = faith:carolingian
						faith = faith:atlantean
						faith = faith:volksmarchen
					}	
				}
				vassal_contract_set_obligation_level = { type = religious_rights level = 1 }
				set_subject_contract_modification_blocked = no
			}
		}		
	}
}

# Like on_game_start, except it is called once the host (or player, in single player) exits the lobby. Good for anything where you need to know who the players are, or what the game rules are
on_game_start_after_lobby = {
	effect = {
		# To prevent the Season Changes event from triggering on game start
		situation:the_great_steppe ?= {
			every_participant_group = {
				every_situation_group_participant = {
					set_variable = {
						name = steppe_game_start_var
						years = 1
					}
				}
			}
		}
		if = {
			limit = {
				government_has_flag = government_is_prepublic
				is_landed = yes
			}
			save_scope_as = scoped_farmer
			create_nomad_title = {
				name = domicile_farmstead
				holder = scope:scoped_farmer
				government = peasantrepublic_government
				save_scope_as = new_title
			}
			scope:new_title ?= {
				add_title_law = noble_family_succession_law
			}
		}
		if = {
			limit = {
				government_has_flag = government_is_prepublic
				primary_title = {
					NOT = {
						has_title_law = saxon_elective_succession_law
					}
				}
			}
			every_held_title = {
				limit = {
					title_tier > barony
				}
				add_title_law = saxon_elective_succession_law
			}
		}
		if = {
			limit = {
				government_has_flag = government_is_urepublic
				NOT = {
					exists = domicile
				}
			}
			save_scope_as = scoped_merchant
			create_nomad_title = {
				name = domicile_palace
				holder = scope:scoped_merchant
				government = urbanrepublic_government
				save_scope_as = new_title
			}
			scope:new_title ?= {
				add_title_law = noble_family_succession_law
			}
		}
		if = {
			limit = {
				government_has_flag = government_is_urepublic
				primary_title = {
					NOT = {
						has_title_law = urban_elective_succession_law
					}
				}
			}
			every_held_title = {
				limit = {
					title_tier > barony
				}
				add_title_law = urban_elective_succession_law
			}
		}

		# Extra Nomad Regions
		#Tibet
		if = {
		    limit = {
				has_mpo_dlc_trigger = yes
				has_game_rule = tibet_nomad_region_on
			}
			start_situation = {
				type = game_rule_extra_nomads_tibet
				start_phase = situation_steppe_abundant_grazing_season
				save_scope_as = my_situation
			}
			scope:my_situation = {
				every_situation_county = {
					limit = {
						holder = {
							government_has_flag = government_is_tribal
						}
					}
					holder = {
						set_variable = {
							name = steppe_game_start_var
							years = 1
						}
						every_held_title = {
							if = {
								limit = {
									title_province = {
										has_holding_type = tribal_holding
									}
								}
								title_province = {
									set_holding_type = nomad_holding
								}
							}
						}
						change_government = nomad_government
						if = {
							limit = {
								OR = {
									domicile.domicile_culture != capital_county.culture
									domicile.domicile_faith != capital_county.faith
								}
							}
							domicile = {
								set_domicile_culture = prev.capital_county.culture
								set_domicile_faith = prev.capital_county.faith
							}
						}
					}
				}
			}
			title:k_xia ?= {
				every_in_de_jure_hierarchy = {
					limit = {
						holder ?= {
							government_has_flag = government_is_tribal
						}
					}
					holder = {
						set_variable = {
							name = steppe_game_start_var
							years = 1
						}
						every_held_title = {
							if = {
								limit = {
									title_province = {
										has_holding_type = tribal_holding
									}
								}
								title_province = {
									set_holding_type = nomad_holding
								}
							}
						}
						change_government = nomad_government
					}
				}
			}
		}
		#Sami
		if = {
		    limit = {
				has_mpo_dlc_trigger = yes
				has_game_rule = sami_nomad_region_on
			}
			start_situation = {
				type = game_rule_extra_nomads_sami
				start_phase = situation_steppe_abundant_grazing_season
				save_scope_as = my_situation
			}
			scope:my_situation = {
				every_situation_county = {
					limit = {
						holder = {
							OR = {
								culture = culture:sami
								culture = culture:karelian
								culture = culture:samoyed
								is_ai = no
							}
						}
					}
					holder = {
						set_variable = {
							name = steppe_game_start_var
							years = 1
						}
						every_held_title = {
							if = {
								limit = {
									title_province = {
										has_holding_type = tribal_holding
									}
								}
								title_province = {
									set_holding_type = nomad_holding
								}
							}
						}
						change_government = nomad_government
					}
				}
			}
		}
		#Arabia
		if = {
		    limit = {
				has_mpo_dlc_trigger = yes
				has_game_rule = arabia_nomad_region_on
			}
			start_situation = {
				type = game_rule_extra_nomads_arabs
				start_phase = situation_steppe_severe_drought_season
				save_scope_as = my_situation
				sub_region = {
					key = arabia_nomads
					start_phase = situation_steppe_severe_drought_season
					map_color = { 34 255 76 }
					geographical_regions = { arab_nomad_area }
				}
				sub_region = {
					key = egypt_nomads
					start_phase = situation_steppe_abundant_grazing_season
					map_color = { 24 155 76 }
					geographical_regions = { egypt_nomad_area }
				}
			}
			scope:my_situation = {
				every_situation_county = {
					limit = {
						holder = {
							government_has_flag = government_is_tribal
						}
					}
					holder = {
						set_variable = {
							name = steppe_game_start_var
							years = 1
						}
						every_held_title = {
							if = {
								limit = {
									title_province = {
										has_holding_type = tribal_holding
									}
								}
								title_province = {
									set_holding_type = nomad_holding
								}
							}
						}
						change_government = nomad_government
					}
				}
			}
		}
		#Sahel
		if = {
		    limit = {
				has_mpo_dlc_trigger = yes
				has_game_rule = sahel_nomad_region_on
			}
		    start_situation = {
				type = game_rule_extra_nomads_sahel
				start_phase = situation_steppe_severe_drought_season
				save_scope_as = my_situation
				sub_region = {
					key = north_africa_nomads
					start_phase = situation_steppe_abundant_grazing_season
					map_color = { 155 62 0 }
					geographical_regions = { sahel_north_africa_nomad_area }
				}
				sub_region = {
					key = sahara_nomads
					start_phase = situation_steppe_severe_drought_season
					map_color = { 255 232 100 }
					geographical_regions = { sahel_desert_nomad_area }
				}
				sub_region = {
					key = sahel_nomads
					start_phase = situation_steppe_abundant_grazing_season
					map_color = { 100 46 92 }
					geographical_regions = { sahel_sub_saharan_africa_nomad_area }
				}
			}
			scope:my_situation = {
				every_situation_county = {
					limit = {
						holder = {
							government_has_flag = government_is_tribal
							OR = {
								culture = { has_cultural_pillar = heritage_berber }
								culture = culture:bedouin
								is_ai = no
							}
						}
					}
					holder = {
						set_variable = {
							name = steppe_game_start_var
							years = 1
						}
						every_held_title = {
							if = {
								limit = {
									title_province = {
										has_holding_type = tribal_holding
									}
								}
								title_province = {
									set_holding_type = nomad_holding
								}
							}
						}
						change_government = nomad_government
					}
				}
			}
		}
		#Horn of Africa
		if = {
		    limit = {
				has_mpo_dlc_trigger = yes
				has_game_rule = horn_of_africa_nomad_region_on
			}
		    start_situation = {
				type = game_rule_extra_nomads_horn
				start_phase = situation_steppe_severe_drought_season
				save_scope_as = my_situation
			}
			scope:my_situation = {
				every_situation_county = {
					limit = {
						holder = {
							government_has_flag = government_is_tribal
							OR = {
								culture = culture:somali
								culture = culture:beja
								culture = culture:afar
								culture = culture:bedouin
								AND = {
									is_ai = no
									NOR = {
										culture = culture:welayta
										culture = culture:ethiopian
										culture = culture:nubian
										culture = culture:daju
									}
								}
							}
						}
					}
					holder = {
						set_variable = {
							name = steppe_game_start_var
							years = 1
						}
						every_held_title = {
							if = {
								limit = {
									title_province = {
										has_holding_type = tribal_holding
									}
								}
								title_province = {
									set_holding_type = nomad_holding
								}
							}
						}
						change_government = nomad_government
					}
				}
			}
		}
		### INITIAL BUDGET CALC, ONE MORE AFTER THE EVERY_RULER ASSIGNS PROVINCE TYPES ###
		if = {
			limit = {
				exists = title:h_china.holder
				has_tgp_dlc_trigger = yes
			}
			title:h_china.holder ?= {
				enact_treasury_budgets_init = yes
			}
		}
		every_ruler = { # PUT EVERY_RULER TYPE STUFF HERE FOR PERFORMANCE REASONS
			### Every nomad in the Steppe Region gets their yurt domicile goodies ###
			if = {
				limit = {
					government_has_flag = government_is_nomadic
					is_landed = yes
				}
				save_scope_as = holder
				if = {
					limit = {
						NOR = { liege = { government_has_flag = government_allows_nomad_domicile_titles } government_has_flag = government_allows_nomad_domicile_titles }
						NOT = {
							any_held_title = {
								is_nomad_title = yes
							}
						}
					}
					create_nomad_title = {
						name = nomad_title_name
						holder = scope:holder
						government = nomad_government
						save_scope_as = new_nomad_title
					}
				}
				if = {
					limit = {
						exists = situation:the_great_steppe
						any_character_situation = {
							this = situation:the_great_steppe
						}
					}
					add_trait = nomadic_philosophy
					dynasty ?= {
						every_dynasty_member = {
							limit = {
								top_liege ?= {
									government_has_flag = government_is_nomadic
								}
							}
							add_trait = nomadic_philosophy
						}
					}
				}
				if = {
					limit = {
						has_mpo_dlc_trigger = yes
						has_tgp_dlc_trigger = yes
					}
					dynasty:1045082 ?= { # Khitan Yelu
						every_dynasty_member = {
							add_trait = nomadic_philosophy
						}
					}
					dynasty:nn_dyn_shulu ?= { # Khitan Xiao
						every_dynasty_member = {
							add_trait = nomadic_philosophy
						}
					}
				}
				switch = {
					trigger = primary_title.tier
					tier_county = {
						add_gold = {
							value = {
								value = 0
								add = { 25 40 }
								multiply = gold_value_scale_by_era
							}
						}
					}
					tier_duchy = {
						add_gold = {
							value = {
								value = 0
								add = { 50 80 }
								multiply = gold_value_scale_by_era
							}
						}
						add_realm_law_skip_effects = nomadic_authority_2
						domicile ?= {
							add_domicile_building = yurt_main_02
							add_random_yurt_external_building_effect = yes
							add_random_yurt_external_building_effect = yes
							upgrade_random_yurt_external_building_effect = yes
						}
					}
					tier_kingdom = {
						add_gold = {
							value = {
								value = 0
								add = { 100 125 }
								multiply = gold_value_scale_by_era
							}
						}
						add_realm_law_skip_effects = nomadic_authority_3
						domicile ?= {
							add_domicile_building = yurt_main_02
							add_domicile_building = yurt_main_03
							add_random_yurt_external_building_effect = yes
							add_random_yurt_external_building_effect = yes
							upgrade_random_yurt_external_building_effect = yes
							upgrade_random_yurt_external_building_effect = yes
						}
					}
					tier_empire = {
						add_gold = {
							value = {
								value = 0
								add = { 150 200 }
								multiply = gold_value_scale_by_era
							}
						}
						add_realm_law_skip_effects = nomadic_authority_3
						domicile ?= {
							add_domicile_building = yurt_main_02
							add_domicile_building = yurt_main_03
							add_domicile_building = yurt_main_04
							add_random_yurt_external_building_effect = yes
							add_random_yurt_external_building_effect = yes
							add_random_yurt_external_building_effect = yes
							upgrade_random_yurt_external_building_effect = yes
							upgrade_random_yurt_external_building_effect = yes
							upgrade_random_yurt_external_building_effect = yes
							upgrade_random_yurt_external_building_effect = yes
							upgrade_random_yurt_external_building_effect = yes
							upgrade_random_yurt_external_building_effect = yes
							upgrade_random_yurt_external_building_effect = yes
							upgrade_random_yurt_external_building_effect = yes
						}
					}
				}
				if = {
					limit = {
						has_royal_court = yes
						NOT = { has_court_type = court_nomadic }
					}
					set_court_type = court_nomadic
				}
				every_councillor = {
					limit = {
						NOR = {
							has_council_position = councillor_spymaster
							has_council_position = councillor_court_chaplain
							has_council_position = councillor_spouse
						}
					}
					prev = { fire_councillor_skip_effects = prev }
					remove_opinion = {
						modifier = fired_from_council_opinion
						target = prev
					}
				}
				random_courtier = {
					limit = {
						is_adult = yes
					}
					save_scope_as = astrologer_character
					prev = {
						appoint_court_position = {
							recipient = scope:astrologer_character
							court_position = court_astrologer_court_position
						}
					}
				}
				if = {
					limit = {
						OR = {
							NOT = { exists = cp:councillor_kurultai_1 }
							NOT = { exists = cp:councillor_kurultai_2 }
							NOT = { exists = cp:councillor_kurultai_3 }
							NOT = { exists = cp:councillor_kurultai_4 }
						}
					}
					ordered_vassal = {
						order_by = current_military_strength
						limit = {
							is_councillor = no
						}
						make_councillor_start_up_effect = yes
					}
				}
				if = {
					limit = {
						OR = {
							NOT = { exists = cp:councillor_kurultai_1 }
							NOT = { exists = cp:councillor_kurultai_2 }
							NOT = { exists = cp:councillor_kurultai_3 }
							NOT = { exists = cp:councillor_kurultai_4 }
						}
					}
					every_knight = {
						limit = {
							is_councillor = no
						}
						make_councillor_start_up_effect = yes
					}
				}
				ordered_councillor = {
					order_by = stewardship
					position = 0
					limit = {
						NOR = {
							has_council_position = councillor_spymaster
							has_council_position = councillor_court_chaplain
							has_council_position = councillor_spouse
						}
					}
					switch = {
						trigger = this
						liege_or_court_owner.cp:councillor_kurultai_1 = {
							set_council_task = {
								task_type = task_kurultai_fertility_1
								target = liege_or_court_owner.capital_province
							}
						}
						liege_or_court_owner.cp:councillor_kurultai_2 = {
							set_council_task = {
								task_type = task_kurultai_fertility_2
								target = liege_or_court_owner.capital_province
							}
						}
						liege_or_court_owner.cp:councillor_kurultai_3 = {
							set_council_task = {
								task_type = task_kurultai_fertility_3
								target = liege_or_court_owner.capital_province
							}
						}
						liege_or_court_owner.cp:councillor_kurultai_4 = {
							set_council_task = {
								task_type = task_kurultai_fertility_4
								target = liege_or_court_owner.capital_province
							}
						}
					}
				}
				ordered_councillor = {
					order_by = learning
					position = 0
					limit = {
						NOR = {
							has_council_position = councillor_spymaster
							has_council_position = councillor_court_chaplain
							has_council_position = councillor_spouse
							is_performing_council_task = task_kurultai_fertility_1
							is_performing_council_task = task_kurultai_fertility_2
							is_performing_council_task = task_kurultai_fertility_3
							is_performing_council_task = task_kurultai_fertility_4
						}
					}
					switch = {
						trigger = this
						liege_or_court_owner.cp:councillor_kurultai_1 = {
							set_council_task = {
								task_type = task_kurultai_court_astrologer_1
								target = liege_or_court_owner.capital_province
							}
						}
						liege_or_court_owner.cp:councillor_kurultai_2 = {
							set_council_task = {
								task_type = task_kurultai_court_astrologer_2
								target = liege_or_court_owner.capital_province
							}
						}
						liege_or_court_owner.cp:councillor_kurultai_3 = {
							set_council_task = {
								task_type = task_kurultai_court_astrologer_3
								target = liege_or_court_owner.capital_province
							}
						}
						liege_or_court_owner.cp:councillor_kurultai_4 = {
							set_council_task = {
								task_type = task_kurultai_court_astrologer_4
								target = liege_or_court_owner.capital_province
							}
						}
					}
				}
				#Nomadic Philosophy lobby added realms
				if = {
					limit = {
						exists = situation:the_great_steppe
						any_character_situation = {
							this = situation:the_great_steppe
						}
						NOT = {
							has_trait = nomadic_philosophy
						}
					}
					add_trait = nomadic_philosophy
					dynasty ?= {
						every_dynasty_member = {
							limit = {
								top_liege ?= {
									government_has_flag = government_is_nomadic
								}
							}
							add_trait = nomadic_philosophy
						}
					}
				}
			}
			else_if = {
				limit = {
					government_has_flag = government_is_herder
				}
				if = {
					limit = { gold >= 30 }
					remove_short_term_gold = 27
				}
				else_if = {
					limit = { gold >= 25 }
					remove_short_term_gold = 22
				}
				else_if = {
					limit = { gold >= 20 }
					remove_short_term_gold = 18
				}
				else_if = {
					limit = { gold >= 15 }
					remove_short_term_gold = 11
				}
				else_if = {
					limit = { gold >= 10 }
					remove_short_term_gold = 5
				}
				# We're fine with them having 10 gold max

				if = {
					limit = {
						is_ai = no
					}
					every_held_title = {
						limit = {
							tier = tier_county
							title_province = {
								has_holding_type = herder_holding
							}
						}
						title_province = {
							set_holding_type = nomad_holding
						}
					}
					change_government = nomad_government
				}
			}
			# Make sure that Realm Priests are landed theocrats where it makes sense
			else_if = {
				limit = {
					highest_held_title_tier >= tier_duchy
				}
				if = {
					limit = {
						exists = cp:councillor_court_chaplain
						cp:councillor_court_chaplain = {
							is_ruler = no
						}
						faith = { has_doctrine = doctrine_clerical_succession_spiritual_fixed_appointment }
						any_vassal = {
							is_physically_able_adult = yes
							is_councillor = no
							government_has_flag = government_is_theocracy
							can_be_court_chaplain_trigger = { COURT_OWNER = liege }
							faith = liege.faith
						}
					}
					random_vassal = {
						limit = {
							is_physically_able_adult = yes
							is_councillor = no
							government_has_flag = government_is_theocracy
							can_be_court_chaplain_trigger = { COURT_OWNER = liege }
							faith = liege.faith
						}
						weight = {
							base = 1
							modifier = {
								add = 1000
								faith.religious_head ?= this
							}
							modifier = {
								add = learning
							}
							modifier = {
								add = primary_title.tier
							}
						}
						liege = {
							assign_councillor_type = {
								type = councillor_court_chaplain
								remove_existing_councillor = yes
								target = prev
							}
						}
					}
				}
				if = {
					limit = {
						is_landless_adventurer = yes
					}
					if = { limit = { has_realm_law = crown_authority_0 } remove_realm_law = crown_authority_0 }
				}
			}
			#Autopopulate families.
			if = {
				limit = {
					trigger_if = {
						limit = {
							has_game_rule = on_generate_families_ai_only
						}
						is_ai = yes
					}
					trigger_else = {
						has_game_rule = on_generate_families
					}
				}
				trigger_event = game_rule.1001
			}

			### CE1 LEGITIMACY SETUP ###
			if = {
				limit = {
					exists = this
					has_legitimacy = yes
				}
				add_legitimacy = base_legitimacy_value
			}

			### MANDALA SETUP ###
			if = {
				limit = { government_has_flag = government_is_mandala }

				#Triple Mandala's Legitimacy to make them not start at a negative expectation at game start
				add_legitimacy = {
					value = legitimacy
					multiply = 2
					if = {
						limit = {
							highest_held_title_tier > tier_duchy
						}
						multiply = 3
					}
					else = { multiply = 2 }
				}

				#Yer starter kit
				change_to_mandala_government_decree_effect = yes
				#No Succession for this character pls
				set_variable = {
					name = not_subject_to_succession_trials
					value = flag:started_as_mandala
				}
				if = {
					limit = { var:not_subject_to_succession_trials ?= flag:started_as_mandala }
					#To prevent 'unused except in loc' errors :catto:
				}

				#Aspect modifiers?
				house = {
					#Start counting years of peace
					if = {
						limit = { has_house_head_parameter = peaceful_rule_5_year_modifier }
						house_head = {
							#Aspect modifier
							set_variable = {
								name = mandala_house_power_accumulated_increments_of_peace
								value = 1
							}
							add_character_modifier = { modifier = mandala_increments_of_peace_modifier }
							trigger_event = {
								id = tgp_east_asia_mandala_events.0200
								years = 5
							}
							#Aspect trigger
							set_variable = {
								name = serenity_mandala_years_of_non_aggression_war
								value = 0
							}
							trigger_event = {
								id = tgp_east_asia_mandala_events.0205
								years = 1
							}
						}
					}
					#Give the initial Creator modifier
			    	if = {
						limit = { has_house_head_parameter = creator_10_year_modifier }
						house_head = {
							set_variable = {
								name = mandala_house_power_accumulated_creator
								value = 1
								years = 10
							}
							hidden_effect = {
								mandala_apply_10_year_modifier = yes
							}
						}
					}
				}
			}

			if = {
				limit = {
					title:h_china.holder ?= top_liege
					this != top_liege
				}
				### TGP MERIT AND TREASURY HANDOUT ON GAME START ###
				if = {
					limit = {
						culture = {
							has_cultural_pillar = heritage_chinese
						}
						NOR = {
							AND = {
								has_council_position = councillor_court_chaplain
								NOT = { has_title = title:e_minister_of_rites }
							}
							has_trait = devoted
						}
						government_has_flag = government_is_celestial
						is_faith_dominant_gender = yes
					}
					save_temporary_scope_as = exam_contender
					hidden_effect = {
						assign_completed_exams_based_on_merit_effect = yes
					}
					if = {
						limit = {
							any_parent = {
								OR = {
									has_trait = ambitious
									has_trait = scholar
									has_trait = diligent
									has_trait = confucian_education
								}
							}
							NOR = {
								has_trait = lazy
								has_trait = dull
								has_trait = intellect_bad
								location.county ?= {
									development_level <= bad_development_level
								}
							}
						}
						add_character_flag = passed_child_exam
					}
					if = { # We adjust Merit depending on the dynastic cycle phase
						limit = {
							situation:dynastic_cycle ?= {
								situation_current_phase = situation_dynastic_cycle_phase_stability_advancement
							}
						}
						change_merit = {
							value = merit
							multiply = 0.1
						}
					}
					if = {
						limit = {
							is_ai = no
							is_governor_or_admin_count = yes
						}
						spawn_celestial_governance_contract_effect = yes
					}
					if = {
						limit = {
							game_start_date = 867.1.1
						}
						title:k_hebei.holder = {
							hidden_effect = {
								vassal_contract_set_obligation_level = {
									type = celestial_provinces
									level = 3 # Military
								}
								if = {
									limit = {
										NOT = {
											has_realm_law = celestial_military_appointment_succession_law
										}
									}
									add_realm_law_skip_effects = celestial_military_appointment_succession_law
								}
							}
							every_vassal = {
								limit = {
									primary_title.tier >= tier_county
								}
								hidden_effect = {
									vassal_contract_set_obligation_level = {
										type = celestial_provinces
										level = 3 # Military
									}
									if = {
										limit = {
											NOT = {
												has_realm_law = celestial_military_appointment_succession_law
											}
										}
										add_realm_law_skip_effects = celestial_military_appointment_succession_law
									}
								}
								every_vassal = {
									limit = {
										primary_title.tier >= tier_county
									}
									hidden_effect = {
										vassal_contract_set_obligation_level = {
											type = celestial_provinces
											level = 3 # Military
										}
										if = {
											limit = {
												NOT = {
													has_realm_law = celestial_military_appointment_succession_law
												}
											}
											add_realm_law_skip_effects = celestial_military_appointment_succession_law
										}
									}
								}
							}
						}
						title:k_youji.holder = {
							hidden_effect = {
								vassal_contract_set_obligation_level = {
									type = celestial_provinces
									level = 3 # Military
								}
								if = {
									limit = {
										NOT = {
											has_realm_law = celestial_military_appointment_succession_law
										}
									}
									add_realm_law_skip_effects = celestial_military_appointment_succession_law
								}
							}
							every_vassal = {
								limit = {
									primary_title.tier >= tier_county
								}
								hidden_effect = {
									vassal_contract_set_obligation_level = {
										type = celestial_provinces
										level = 3 # Military
									}
									if = {
										limit = {
											NOT = {
												has_realm_law = celestial_military_appointment_succession_law
											}
										}
										add_realm_law_skip_effects = celestial_military_appointment_succession_law
									}
								}
								every_vassal = {
									limit = {
										primary_title.tier >= tier_county
									}
									hidden_effect = {
										vassal_contract_set_obligation_level = {
											type = celestial_provinces
											level = 3 # Military
										}
										if = {
											limit = {
												NOT = {
													has_realm_law = celestial_military_appointment_succession_law
												}
											}
											add_realm_law_skip_effects = celestial_military_appointment_succession_law
										}
									}
								}
							}
						}
						title:k_daibei.holder = {
							hidden_effect = {
								vassal_contract_set_obligation_level = {
									type = celestial_provinces
									level = 3 # Military
								}
								if = {
									limit = {
										NOT = {
											has_realm_law = celestial_military_appointment_succession_law
										}
									}
									add_realm_law_skip_effects = celestial_military_appointment_succession_law
								}
							}
							every_vassal = {
								limit = {
									primary_title.tier >= tier_county
								}
								hidden_effect = {
									vassal_contract_set_obligation_level = {
										type = celestial_provinces
										level = 3 # Military
									}
									if = {
										limit = {
											NOT = {
												has_realm_law = celestial_military_appointment_succession_law
											}
										}
										add_realm_law_skip_effects = celestial_military_appointment_succession_law
									}
								}
								every_vassal = {
									limit = {
										primary_title.tier >= tier_county
									}
									hidden_effect = {
										vassal_contract_set_obligation_level = {
											type = celestial_provinces
											level = 3 # Military
										}
										if = {
											limit = {
												NOT = {
													has_realm_law = celestial_military_appointment_succession_law
												}
											}
											add_realm_law_skip_effects = celestial_military_appointment_succession_law
										}
									}
								}
							}
						}
						title:k_guannei.holder = {
							hidden_effect = {
								vassal_contract_set_obligation_level = {
									type = celestial_provinces
									level = 3 # Military
								}
								if = {
									limit = {
										NOT = {
											has_realm_law = celestial_military_appointment_succession_law
										}
									}
									add_realm_law_skip_effects = celestial_military_appointment_succession_law
								}
							}
							every_vassal = {
								limit = {
									primary_title.tier >= tier_county
								}
								hidden_effect = {
									vassal_contract_set_obligation_level = {
										type = celestial_provinces
										level = 3 # Military
									}
									if = {
										limit = {
											NOT = {
												has_realm_law = celestial_military_appointment_succession_law
											}
										}
										add_realm_law_skip_effects = celestial_military_appointment_succession_law
									}
								}
								every_vassal = {
									limit = {
										primary_title.tier >= tier_county
									}
									hidden_effect = {
										vassal_contract_set_obligation_level = {
											type = celestial_provinces
											level = 3 # Military
										}
										if = {
											limit = {
												NOT = {
													has_realm_law = celestial_military_appointment_succession_law
												}
											}
											add_realm_law_skip_effects = celestial_military_appointment_succession_law
										}
									}
								}
							}
						}
						title:k_viet.holder = {
							hidden_effect = {
								vassal_contract_set_obligation_level = {
									type = celestial_provinces
									level = 3 # Military
								}
								if = {
									limit = {
										NOT = {
											has_realm_law = celestial_military_appointment_succession_law
										}
									}
									add_realm_law_skip_effects = celestial_military_appointment_succession_law
								}
							}
							every_vassal = {
								limit = {
									primary_title.tier >= tier_county
								}
								hidden_effect = {
									vassal_contract_set_obligation_level = {
										type = celestial_provinces
										level = 3 # Military
									}
									if = {
										limit = {
											NOT = {
												has_realm_law = celestial_military_appointment_succession_law
											}
										}
										add_realm_law_skip_effects = celestial_military_appointment_succession_law
									}
								}
								every_vassal = {
									limit = {
										primary_title.tier >= tier_county
									}
									hidden_effect = {
										vassal_contract_set_obligation_level = {
											type = celestial_provinces
											level = 3 # Military
										}
										if = {
											limit = {
												NOT = {
													has_realm_law = celestial_military_appointment_succession_law
												}
											}
											add_realm_law_skip_effects = celestial_military_appointment_succession_law
										}
									}
								}
							}
						}
						title:k_lingxi.holder = {
							hidden_effect = {
								vassal_contract_set_obligation_level = {
									type = celestial_provinces
									level = 3 # Military
								}
								if = {
									limit = {
										NOT = {
											has_realm_law = celestial_military_appointment_succession_law
										}
									}
									add_realm_law_skip_effects = celestial_military_appointment_succession_law
								}
							}
							every_vassal = {
								limit = {
									primary_title.tier >= tier_county
								}
								hidden_effect = {
									vassal_contract_set_obligation_level = {
										type = celestial_provinces
										level = 3 # Military
									}
									if = {
										limit = {
											NOT = {
												has_realm_law = celestial_military_appointment_succession_law
											}
										}
										add_realm_law_skip_effects = celestial_military_appointment_succession_law
									}
								}
								every_vassal = {
									limit = {
										primary_title.tier >= tier_county
									}
									hidden_effect = {
										vassal_contract_set_obligation_level = {
											type = celestial_provinces
											level = 3 # Military
										}
										if = {
											limit = {
												NOT = {
													has_realm_law = celestial_military_appointment_succession_law
												}
											}
											add_realm_law_skip_effects = celestial_military_appointment_succession_law
										}
									}
								}
							}
						}
					}
					else_if = {
						limit = {
							game_start_date = 1066.9.15
						}
						title:k_hebei.holder = {
							hidden_effect = {
								vassal_contract_set_obligation_level = {
									type = celestial_provinces
									level = 3 # Military
								}
								if = {
									limit = {
										NOT = {
											has_realm_law = celestial_military_appointment_succession_law
										}
									}
									add_realm_law_skip_effects = celestial_military_appointment_succession_law
								}
							}
							every_vassal = {
								limit = {
									primary_title.tier >= tier_county
								}
								hidden_effect = {
									vassal_contract_set_obligation_level = {
										type = celestial_provinces
										level = 3 # Military
									}
									if = {
										limit = {
											NOT = {
												has_realm_law = celestial_military_appointment_succession_law
											}
										}
										add_realm_law_skip_effects = celestial_military_appointment_succession_law
									}
								}
								every_vassal = {
									limit = {
										primary_title.tier >= tier_county
									}
									hidden_effect = {
										vassal_contract_set_obligation_level = {
											type = celestial_provinces
											level = 3 # Military
										}
										if = {
											limit = {
												NOT = {
													has_realm_law = celestial_military_appointment_succession_law
												}
											}
											add_realm_law_skip_effects = celestial_military_appointment_succession_law
										}
									}
								}
							}
						}
						title:k_hedong.holder = {
							hidden_effect = {
								vassal_contract_set_obligation_level = {
									type = celestial_provinces
									level = 3 # Military
								}
								if = {
									limit = {
										NOT = {
											has_realm_law = celestial_military_appointment_succession_law
										}
									}
									add_realm_law_skip_effects = celestial_military_appointment_succession_law
								}
							}
							every_vassal = {
								limit = {
									primary_title.tier >= tier_county
								}
								hidden_effect = {
									vassal_contract_set_obligation_level = {
										type = celestial_provinces
										level = 3 # Military
									}
									if = {
										limit = {
											NOT = {
												has_realm_law = celestial_military_appointment_succession_law
											}
										}
										add_realm_law_skip_effects = celestial_military_appointment_succession_law
									}
								}
								every_vassal = {
									limit = {
										primary_title.tier >= tier_county
									}
									hidden_effect = {
										vassal_contract_set_obligation_level = {
											type = celestial_provinces
											level = 3 # Military
										}
										if = {
											limit = {
												NOT = {
													has_realm_law = celestial_military_appointment_succession_law
												}
											}
											add_realm_law_skip_effects = celestial_military_appointment_succession_law
										}
									}
								}
							}
						}
						title:k_guannei.holder = {
							hidden_effect = {
								vassal_contract_set_obligation_level = {
									type = celestial_provinces
									level = 3 # Military
								}
								if = {
									limit = {
										NOT = {
											has_realm_law = celestial_military_appointment_succession_law
										}
									}
									add_realm_law_skip_effects = celestial_military_appointment_succession_law
								}
							}
							every_vassal = {
								limit = {
									primary_title.tier >= tier_county
								}
								hidden_effect = {
									vassal_contract_set_obligation_level = {
										type = celestial_provinces
										level = 3 # Military
									}
									if = {
										limit = {
											NOT = {
												has_realm_law = celestial_military_appointment_succession_law
											}
										}
										add_realm_law_skip_effects = celestial_military_appointment_succession_law
									}
								}
								every_vassal = {
									limit = {
										primary_title.tier >= tier_county
									}
									hidden_effect = {
										vassal_contract_set_obligation_level = {
											type = celestial_provinces
											level = 3 # Military
										}
										if = {
											limit = {
												NOT = {
													has_realm_law = celestial_military_appointment_succession_law
												}
											}
											add_realm_law_skip_effects = celestial_military_appointment_succession_law
										}
									}
								}
							}
						}
						title:k_lingxi.holder = {
							hidden_effect = {
								vassal_contract_set_obligation_level = {
									type = celestial_provinces
									level = 3 # Military
								}
								if = {
									limit = {
										NOT = {
											has_realm_law = celestial_military_appointment_succession_law
										}
									}
									add_realm_law_skip_effects = celestial_military_appointment_succession_law
								}
							}
							every_vassal = {
								limit = {
									primary_title.tier >= tier_county
								}
								hidden_effect = {
									vassal_contract_set_obligation_level = {
										type = celestial_provinces
										level = 3 # Military
									}
									if = {
										limit = {
											NOT = {
												has_realm_law = celestial_military_appointment_succession_law
											}
										}
										add_realm_law_skip_effects = celestial_military_appointment_succession_law
									}
								}
								every_vassal = {
									limit = {
										primary_title.tier >= tier_county
									}
									hidden_effect = {
										vassal_contract_set_obligation_level = {
											type = celestial_provinces
											level = 3 # Military
										}
										if = {
											limit = {
												NOT = {
													has_realm_law = celestial_military_appointment_succession_law
												}
											}
											add_realm_law_skip_effects = celestial_military_appointment_succession_law
										}
									}
								}
							}
						}
					}
					else_if = {
						limit = {
							game_start_date = 1178.10.1
						}
						title:k_huainan.holder = {
							hidden_effect = {
								vassal_contract_set_obligation_level = {
									type = celestial_provinces
									level = 3 # Military
								}
								if = {
									limit = {
										NOT = {
											has_realm_law = celestial_military_appointment_succession_law
										}
									}
									add_realm_law_skip_effects = celestial_military_appointment_succession_law
								}
							}
							every_vassal = {
								limit = {
									primary_title.tier >= tier_county
								}
								hidden_effect = {
									vassal_contract_set_obligation_level = {
										type = celestial_provinces
										level = 3 # Military
									}
									if = {
										limit = {
											NOT = {
												has_realm_law = celestial_military_appointment_succession_law
											}
										}
										add_realm_law_skip_effects = celestial_military_appointment_succession_law
									}
								}
								every_vassal = {
									limit = {
										primary_title.tier >= tier_county
									}
									hidden_effect = {
										vassal_contract_set_obligation_level = {
											type = celestial_provinces
											level = 3 # Military
										}
										if = {
											limit = {
												NOT = {
													has_realm_law = celestial_military_appointment_succession_law
												}
											}
											add_realm_law_skip_effects = celestial_military_appointment_succession_law
										}
									}
								}
							}
						}
						title:k_shannan.holder = {
							hidden_effect = {
								vassal_contract_set_obligation_level = {
									type = celestial_provinces
									level = 3 # Military
								}
								if = {
									limit = {
										NOT = {
											has_realm_law = celestial_military_appointment_succession_law
										}
									}
									add_realm_law_skip_effects = celestial_military_appointment_succession_law
								}
							}
							every_vassal = {
								limit = {
									primary_title.tier >= tier_county
								}
								hidden_effect = {
									vassal_contract_set_obligation_level = {
										type = celestial_provinces
										level = 3 # Military
									}
									if = {
										limit = {
											NOT = {
												has_realm_law = celestial_military_appointment_succession_law
											}
										}
										add_realm_law_skip_effects = celestial_military_appointment_succession_law
									}
								}
								every_vassal = {
									limit = {
										primary_title.tier >= tier_county
									}
									hidden_effect = {
										vassal_contract_set_obligation_level = {
											type = celestial_provinces
											level = 3 # Military
										}
										if = {
											limit = {
												NOT = {
													has_realm_law = celestial_military_appointment_succession_law
												}
											}
											add_realm_law_skip_effects = celestial_military_appointment_succession_law
										}
									}
								}
							}
						}
						title:k_xingyuan.holder = {
							hidden_effect = {
								vassal_contract_set_obligation_level = {
									type = celestial_provinces
									level = 3 # Military
								}
								if = {
									limit = {
										NOT = {
											has_realm_law = celestial_military_appointment_succession_law
										}
									}
									add_realm_law_skip_effects = celestial_military_appointment_succession_law
								}
							}
							every_vassal = {
								limit = {
									primary_title.tier >= tier_county
								}
								hidden_effect = {
									vassal_contract_set_obligation_level = {
										type = celestial_provinces
										level = 3 # Military
									}
									if = {
										limit = {
											NOT = {
												has_realm_law = celestial_military_appointment_succession_law
											}
										}
										add_realm_law_skip_effects = celestial_military_appointment_succession_law
									}
								}
								every_vassal = {
									limit = {
										primary_title.tier >= tier_county
									}
									hidden_effect = {
										vassal_contract_set_obligation_level = {
											type = celestial_provinces
											level = 3 # Military
										}
										if = {
											limit = {
												NOT = {
													has_realm_law = celestial_military_appointment_succession_law
												}
											}
											add_realm_law_skip_effects = celestial_military_appointment_succession_law
										}
									}
								}
							}
						}
						title:k_lingxi.holder = {
							hidden_effect = {
								vassal_contract_set_obligation_level = {
									type = celestial_provinces
									level = 3 # Military
								}
								if = {
									limit = {
										NOT = {
											has_realm_law = celestial_military_appointment_succession_law
										}
									}
									add_realm_law_skip_effects = celestial_military_appointment_succession_law
								}
							}
							every_vassal = {
								limit = {
									primary_title.tier >= tier_county
								}
								hidden_effect = {
									vassal_contract_set_obligation_level = {
										type = celestial_provinces
										level = 3 # Military
									}
									if = {
										limit = {
											NOT = {
												has_realm_law = celestial_military_appointment_succession_law
											}
										}
										add_realm_law_skip_effects = celestial_military_appointment_succession_law
									}
								}
								every_vassal = {
									limit = {
										primary_title.tier >= tier_county
									}
									hidden_effect = {
										vassal_contract_set_obligation_level = {
											type = celestial_provinces
											level = 3 # Military
										}
										if = {
											limit = {
												NOT = {
													has_realm_law = celestial_military_appointment_succession_law
												}
											}
											add_realm_law_skip_effects = celestial_military_appointment_succession_law
										}
									}
								}
							}
						}
						title:k_xichuan.holder = {
							hidden_effect = {
								vassal_contract_set_obligation_level = {
									type = celestial_provinces
									level = 3 # Military
								}
								if = {
									limit = {
										NOT = {
											has_realm_law = celestial_military_appointment_succession_law
										}
									}
									add_realm_law_skip_effects = celestial_military_appointment_succession_law
								}
							}
							every_vassal = {
								limit = {
									primary_title.tier >= tier_county
								}
								hidden_effect = {
									vassal_contract_set_obligation_level = {
										type = celestial_provinces
										level = 3 # Military
									}
									if = {
										limit = {
											NOT = {
												has_realm_law = celestial_military_appointment_succession_law
											}
										}
										add_realm_law_skip_effects = celestial_military_appointment_succession_law
									}
								}
								every_vassal = {
									limit = {
										primary_title.tier >= tier_county
									}
									hidden_effect = {
										vassal_contract_set_obligation_level = {
											type = celestial_provinces
											level = 3 # Military
										}
										if = {
											limit = {
												NOT = {
													has_realm_law = celestial_military_appointment_succession_law
												}
											}
											add_realm_law_skip_effects = celestial_military_appointment_succession_law
										}
									}
								}
							}
						}
					}
				}
				### Examination pass status and initial wave of governor candidates done after game start, in order to include generated families ###
				every_courtier = {
					limit = {
						is_lowborn = no
						culture = { has_cultural_pillar = heritage_chinese }
						NOR = {
							has_council_position = councillor_court_chaplain
							has_trait = devoted
						}
						government_has_flag = government_is_celestial # courtiers have governments, too!
						is_faith_dominant_gender = yes
						age >= 30
						static_group_filter = {
							group = ai_filter
							match = 0.5
						}
					}
					hidden_effect = {
						add_character_flag = passed_provincial_exam
						add_character_modifier = {
							modifier = tgp_passed_provincial_exam_modifier
						}
						add_character_flag = passed_metropolitan_exam
						add_character_modifier = {
							modifier = tgp_passed_metropolitan_exam_modifier
						}
						change_merit = {
							value = county_starting_merit_value
							add = age
							add = learning
						}
					}
				}
				save_scope_as = governor
			}

			if = {
				limit = {
					government_has_flag = government_has_merit
					title:h_china.holder != top_liege
				}
				### TGP MERITOCRATIC/STEPPE ADMIN SETUP ON GAME START ###
				if = {
					limit = {
						NOR = {
							AND = {
								has_council_position = councillor_court_chaplain
								NOT = { has_title = title:e_minister_of_rites }
							}
							has_trait = devoted
						}
						government_has_flag = government_has_merit
						is_faith_dominant_gender = yes
					}
					hidden_effect = {
						meritocratic_assign_completed_exams_based_on_merit_effect = yes
					}
				}
			}

			#elder/disciple setup
			if = {
				limit = {
					government_allows = merit
					top_overlord != title:h_china.holder
				}
				if = {
					limit = {
						top_liege = this
						merit_level >= merit_level_expected_kingdom_value
					}
					add_to_list = elders
				}
				else_if = {
					limit = {
						merit_level >= merit_level_expected_duchy_value
					}
					add_to_list = elders
				}
				else = {
					add_to_list = disciple
				}
			}

			# Sexualities if game rules are default
			if = {
				limit = { has_game_rule = sexuality_distribution_default }
				if = {
					limit = {
						is_adult = no
						age >= 10
					}
					game_rule_sexuality_distribution_reroll_effect = yes
				}

				every_courtier_or_guest = {
					if = {
						limit = {
							is_adult = no
							age >= 10
						}
						game_rule_sexuality_distribution_reroll_effect = yes
					}
				}
			}
		}

		if = {
			limit = { has_game_rule = sexuality_distribution_default }
			every_duchy = {
				limit = {
					exists = title_capital_county.title_province
				}
				title_capital_county.title_province = { save_scope_as = pool_province }
				# Sexualities for Pool Characters if game rules are default
				every_pool_character = {
					limit = {
						NOT = { is_in_list = pool_characters }
					}
					province = scope:pool_province
					add_to_list = pool_characters
				}
			}
			every_in_list = {
				list = pool_characters
				if = {
					limit = {
						is_adult = no
						age >= 10
					}
					game_rule_sexuality_distribution_reroll_effect = yes
				}
			}
		}

		#elder/disciple setup (continued from above)
		every_in_list = {
			list = disciple
			save_scope_as = disciple
			random_in_list = {
				list = elders
				limit = {
					top_liege = scope:disciple.top_liege
					eligible_for_elder_trigger = {
						DISCIPLE = scope:disciple
					}
				}
				save_scope_as = elder
			}
			if = {
				limit = {
					exists = scope:elder
				}
				random = {
					chance = 65
					set_relation_elder = scope:elder
				}
			}
		}

		if = {
			limit = {
				has_mpo_dlc_trigger = yes
			}
			#Fully Landlocked Nomad Cultures Setup
			every_culture_global = {
				limit = {
					OR = {
						has_cultural_pillar = heritage_mongolic
						has_cultural_pillar = heritage_ugro_permian
					}
				}
				add_to_global_variable_list = {
					name = fully_landlocked_nomad_cultures
					target = this
				}
			}
			add_to_global_variable_list = {
				name = fully_landlocked_nomad_cultures
				target = culture:kipchak
			}
			add_to_global_variable_list = {
				name = fully_landlocked_nomad_cultures
				target = culture:uyghur
			}
			add_to_global_variable_list = {
				name = fully_landlocked_nomad_cultures
				target = culture:kirghiz
			}
			add_to_global_variable_list = {
				name = fully_landlocked_nomad_cultures
				target = culture:tangut
			}
			add_to_global_variable_list = {
				name = fully_landlocked_nomad_cultures
				target = culture:bashkir
			}
			add_to_global_variable_list = {
				name = fully_landlocked_nomad_cultures
				target = culture:laktan
			}
			recalculate_cultural_heads_of_type = herd
		}

		### GAME RULE: VIEW ON SAME-SEX RELATIONS
		if = {
			limit = { has_game_rule = accepted_same_sex_relations }
			game_rule_accepted_same_sex_relations_effect = yes
		}

		### GAME RULE: RANDOM RULER PLACEMENT
		if = {
			limit = { NOT = { has_game_rule = random_ruler_placement_off } }
			game_rule_random_ruler_placement_effect = yes
		}

		### GAME RULE: RANDOMIZE FAITH
		if = {
			limit = { has_game_rule = randomized_faiths_on }
			game_rule_randomize_faith_effect = yes
		}

		### GAME RULE: FAITH ACCEPTANCE
		if = {
			limit = { has_game_rule = full_faith_acceptance }
			game_rule_faith_acceptance_effect = yes
		}

		### GAME RULE: GENDER EQUALITY ###
		if = {
			limit = { has_game_rule = full_gender_equality }
			game_rule_full_gender_equality_effect = yes
		}
		else_if = {
			limit = { has_game_rule = inversed_gender_equality }
			game_rule_inversed_gender_equality_effect = yes
		}
		else_if = {
			limit = { has_game_rule = lenient_gender_equality }
			game_rule_lenient_gender_equality_effect = yes
		}

		### GAME RULE: SEXUALITY DISTRIBUTION ###
		if = {
			limit = { NOT = { has_game_rule = sexuality_distribution_default } }
			game_rule_sexuality_distribution_effect = yes
		}

		### GAME RULE: SITUATION TOGGLES
		struggle:iberian_struggle ?= {
			if = {
				limit = { has_game_rule = struggle_iberia_toggle_off }
				end_struggle = yes
			}
		}
		struggle:persian_struggle ?= {
			if = {
				limit = { has_game_rule = struggle_persia_toggle_off }
				end_struggle = yes
			}
		}
		situation:the_great_steppe ?= {
			if = {
				limit = { has_game_rule = situation_the_great_steppe_toggle_off }
				end_situation = yes
			}
		}

		### GAME RULE: RULER OF MUNSTER
		if = {
			limit = {
				game_start_date = 1066.9.15
				has_game_rule = historicity_ruler_of_munster_historical_toirdelbach
			}
			create_title_and_vassal_change = {
				type = conquest
				save_scope_as = title_change
			}
			character:83355 = {
				every_held_title = {
					title_tier >= county
					change_title_holder = {
						holder = character:906
						change = scope:title_change
					}
				}
				pay_short_term_gold = {
					target = character:83355
					gold = gold
				}
			}
			random_player = {
				limit = { this = character:83355 }
				set_player_character = character:906
			}
			resolve_title_and_vassal_change = scope:title_change
			# Since Murchad is back to his historical self, he gets to suck.
			character:83355 = {
				add_diplomacy_skill = -10
				remove_trait = gregarious
				add_trait = craven
				# Plus, usurpation rivalry — now Toidelbach has a perfectly good claim to the kingdom and will do a lot more with it than Murchad managed in his 5m in power, but by gameplay terms, this _is_ a usurpation.
				set_relation_rival = {
					target = character:906
					reason = rival_usurper
				}
			}
			# Alright, let's give Toirdelbach his alliance.
			character:906 = {
				add_opinion = {
					modifier = perk_negotiated_alliance_opinion
					target = character:922
				}
				reverse_add_opinion = {
					modifier = event_negotiated_alliance_opinion
					target = character:922
				}
				create_alliance = {
					target = character:922
					allied_through_owner = character:906
					allied_through_target = character:922
				}
			}
		}

		### GAME RULE: DETERMINISTIC CONQUEST
		if = {
			limit = {
				OR = {
					NOT = { has_game_rule = historicity_norman_conquest_default_random }
					game_rule_rig_norman_conquest_for_hereward_trigger = yes
				}
			}
			set_global_variable = deterministic_conquest_of_england_1066
			# See if we should just teleport our combatants' armies into place.
			trigger_event = {
				id = game_rule.1151
				trigger_on_next_date = 1066.09.25
			}
			trigger_event = {
				id = game_rule.1152
				trigger_on_next_date = 1066.10.14
			}
		}

		### 867 - MISC ###
		# Basileios has just murdered Michael III.
		character:1700 ?= { trigger_event = bookmark.0211 }

		### GAME RULE: EXTRA ADMINS
		## We'll be doing some excessive triggers below in a bid to lightly future-proof + error-spam mods less, don't worry about it.
		### We handle players after the lobby.
		# Historic chars.
		apply_historic_administrative_game_rule_effect = yes
		# Players.
		if = {
			limit = { has_dlc_feature = roads_to_power }
			if = {
				limit = {
					NOT = { has_game_rule = historicity_extra_admin_player_wherever_gameplay_not_administrative }
				}
				if = {
					limit = { has_game_rule = historicity_extra_admin_player_wherever_alt_historic_always }
					every_player = {
						limit = {
							highest_held_title_tier >= tier_kingdom
							NOR = {
								government_allows = administrative
								is_landed = no
							}
						}
						convert_to_administrative_from_feudalism_game_start_effect = yes
					}
				}
				else_if = {
					limit = { has_game_rule = historicity_extra_admin_player_wherever_alt_historic_with_august_trait }
					every_player = {
						limit = {
							highest_held_title_tier >= tier_kingdom
							NOR = {
								government_allows = administrative
								is_landed = no
							}
							has_trait = august
						}
						convert_to_administrative_from_feudalism_game_start_effect = yes
					}
				}
			}
		}

		# Give Ruler Designer characters regencies.
		every_in_global_list = {
			variable = rd_chars_needing_regencies
			trigger_event = diarchy.0011
			# Aaaand clean the list.
			save_temporary_scope_as = char_temp
			remove_list_global_variable = {
				name = rd_chars_needing_regencies
				target = scope:char_temp
			}
		}

		### ACHIEVEMENT: FROM RAGS TO RICHES
		every_player = {
			limit = { highest_held_title_tier = tier_county }
			add_achievement_global_variable_effect = {
				VARIABLE = achievement_rags_to_riches_valid
				VALUE = yes
			}
		}

		### ACHIEVEMENT (FP2): Holidaying in Iberia
		every_player = {
			limit = { fp2_character_involved_in_struggle_trigger = no }
			add_achievement_global_variable_effect = {
				VARIABLE = fp2_holiday_in_iberia_achievement_unlocked
				VALUE = no # Boolean in actual usage
			}
		}

		### ACHIEVEMENT TRACKING FOR STARTING CHARACTERS
		if = {
			limit = { has_multiple_players = no }
			every_player = {
				# TGP
				if = {
					limit = {
						government_has_flag = government_is_wanua
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_ep4_15_humble_beginnings_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						has_title = title:k_chrysanthemum_throne
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_ep4_03_sword_of_japan_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						is_landed = no
						tgp_is_any_minister = no
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_ep4_05_grand_governor_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						NAND = {
							tgp_passed_children_examination = yes
							tgp_passed_provincial_examination = yes
							tgp_passed_metropolitan_examination = yes
							tgp_passed_palace_examination = yes
						}
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_ep4_16_flying_colors_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						NOT = {
							culture = {
								any_known_innovation = {
									has_innovation_parameter = silk_road_innovation_parameter
								}
							}
						}
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_ep4_17_highway_of_ideas_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						NOR = {
							tgp_passed_children_examination = yes
							tgp_passed_provincial_examination = yes
							tgp_passed_metropolitan_examination = yes
							tgp_passed_palace_examination = yes
						}
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_ep4_19_stamp_of_approval_achievement
						VALUE = yes
					}
				}
				# Base Title
				if = {
					limit = {
						exists = character:7757
						this = character:7757
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_give_a_dog_a_bone_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						exists = character:1128
						this = character:1128
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_wily_as_the_fox_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						OR = {
							AND = {
								exists = character:108501
								this = character:108501
							}
							AND = {
								exists = character:107500
								this = character:107500
							}
							AND = {
								exists = character:107501
								this = character:107501
							}
							AND = {
								exists = character:108500
								this = character:108500
							}
							AND = {
								exists = character:109500
								this = character:109500
							}
						}
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_sibling_rivalry_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						OR = {
							AND = {
								exists = character:163108
								this = character:163108
							}
							AND = {
								exists = character:163110
								this = character:163110
							}
							AND = {
								exists = character:163111
								this = character:163111
							}
							AND = {
								exists = character:163112
								this = character:163112
							}
							AND = {
								exists = character:163119
								this = character:163119
							}
						}
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_blood_eagle_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						exists = character:6448
						this = character:6448
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_kings_to_the_seventh_generation_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						exists = character:140
						this = character:140
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_norman_yoke_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						exists = character:522
						this = character:522
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_royal_dignity_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						exists = character:40605
						this = character:40605
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_land_of_the_rus_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						exists = character:251187
						this = character:251187
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_mother_of_us_all_achievement
						VALUE = yes
					}
				}
				if = { # Temüjin
					limit = {
						has_mpo_dlc_trigger = yes
						exists = character:125501
						this = character:125501
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_the_stallion_that_mounts_the_world_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						government_has_flag = government_is_nomadic
						save_temporary_scope_as = nomad_ruler
						situation:the_great_steppe ?= {
							situation_sub_region:steppe_east = {
								situation_sub_region_has_county = scope:nomad_ruler.capital_county
							}
						}
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_steppe_by_steppe_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						OR = {
							culture = { has_cultural_pillar = heritage_iberian }
							culture = culture:andalusian
						}
						OR = {
							has_religion = religion:eastern_orthodox_religion 
							has_religion = religion:catholic_religion 
							has_religion = religion:protestant_religion 
						}
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_reconquista_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						culture = culture:irish
						capital_province = { geographical_region = custom_ireland }
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_the_emerald_isle_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						OR = {
							culture = culture:castilian
							culture = culture:basque
							culture = culture:portuguese
							culture = culture:catalan
							culture = culture:andalusian
							culture = culture:visigothic
							culture = culture:suebi
						}
						has_religion = religion:islam_religion
						capital_province = { geographical_region = world_europe_west_iberia }
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_al_andalus_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						exists = character:159137
						this = character:159137
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_almost_there_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						exists = character:109607
						this = character:109607
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_last_count_first_king_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						exists = character:6878
						this = character:6878
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_going_places_achievement
						VALUE = yes
					}
				}
				# FP1
				## far_from_home_achievement
				if = {
					limit = {
						# Starting as a Norse pagan Norse-cultured character.
						fp1_achievement_culture_plus_religion_norse_trigger = yes
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_far_from_home_achievement
						VALUE = yes
					}
				}
				## miklagardariki_achievement
				if = {
					limit = {
						# Starting as a Norse pagan Norse-cultured character.
						fp1_achievement_culture_plus_religion_norse_trigger = yes
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_miklagardariki_achievement
						VALUE = yes
					}
				}
				## canute_the_greater_achievement
				add_achievement_global_variable_effect = {
					VARIABLE = started_canute_the_greater_achievement
					VALUE = yes
				}
				## king_of_all_the_isles_achievement
				if = {
					limit = {
						# Starting as a Norse pagan Norse-cultured character.
						fp1_achievement_culture_plus_religion_norse_trigger = yes
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_king_of_all_the_isles_achievement
						VALUE = yes
					}
				}
				## faster_than_the_fox_achievement
				if = {
					limit = {
						# Starting as a Norse pagan Norse-cultured character.
						fp1_achievement_culture_plus_religion_norse_trigger = yes
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_faster_than_the_fox_achievement
						VALUE = yes
					}
				}
				## volva_achievement
				if = {
					limit = {
						# Starting as a Norse pagan Norse-cultured character.
						fp1_achievement_culture_plus_religion_norse_trigger = yes
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_volva_achievement
						VALUE = yes
					}
				}
				## saga_in_stone_achievement
				add_achievement_global_variable_effect = {
					VARIABLE = started_saga_in_stone_achievement
					VALUE = yes
				}
				## first_of_the_crusader_kings_achievement
				if = {
					limit = {
						# Starting as a Norse-cultured character.
						fp1_achievement_culture_norse_trigger = yes
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_first_of_the_crusader_kings_achievement
						VALUE = yes
					}
				}
				## vladimirs_second_choice_achievement
				if = {
					limit = {
						# Starting as a Norse pagan Norse or Rus-cultured character.
						fp1_achievement_culture_norse_or_rus_trigger = yes
						fp1_achievement_religious_norse_trigger = yes
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_vladimirs_second_choice_achievement
						VALUE = yes
					}
				}
				## a_dangerous_business_achievement
				add_achievement_global_variable_effect = {
					VARIABLE = started_a_dangerous_business_achievement
					VALUE = yes
				}
				# EP1
				##1 Patronage
				add_achievement_global_variable_effect = {
					VARIABLE = started_patronage_achievement
					VALUE = yes
				}
				##2 Converging Paths
				add_achievement_global_variable_effect = {
					VARIABLE = started_converging_paths_achievement
					VALUE = yes
				}
				##3 Changing course
				add_achievement_global_variable_effect = {
					VARIABLE = started_changing_course_achievement
					VALUE = yes
				}
				##4 Hoarder
				add_achievement_global_variable_effect = {
					VARIABLE = started_hoarder_achievement
					VALUE = yes
				}
				##5 creme de la creme
				add_achievement_global_variable_effect = {
					VARIABLE = started_creme_de_la_creme_achievement
					VALUE = yes
				}
				##6 Give it back!
				add_achievement_global_variable_effect = {
					VARIABLE = started_polyglot_achievement
					VALUE = yes
				}
				##7 Inspirational
				add_achievement_global_variable_effect = {
					VARIABLE = started_inspirational_achievement
					VALUE = yes
				}
				##8 One of a Kind
				add_achievement_global_variable_effect = {
					VARIABLE = started_one_of_a_kind_achievement
						VALUE = yes
				}
				##9 True Tolerance
				add_achievement_global_variable_effect = {
					VARIABLE = started_true_tolerance_achievement
					VALUE = yes
				}
				##10 Delusions of Grandeur
				add_achievement_global_variable_effect = {
					VARIABLE = started_delusions_of_grandeur_achievement_achievement
					VALUE = yes
				}
				##11 Bod Chen Po
				if = {
					limit = {
						this.dynasty = dynasty:105800
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_bod_chen_po_achievement
						VALUE = yes
					}
				}
				##12 Turkish Eagle
				if = {
					limit = {
						this != character:3040 # Not Alp Arslan
						house = house:house_seljuk # Seljuk
						game_start_date < 1067.1.1 # 1066 only, and no Seljuks in 867
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_turkish_eagle_achievement
						VALUE = yes
					}
				}
				##13 Rise of the Ghurids
				if = {
					limit = {
						has_title = title:d_ghur
						this.dynasty = dynasty:791 #Ghurid
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_rise_of_the_ghurids_achievement
						VALUE = yes
					}
				}
				##14 Brave and Bold
				if = {
					limit = {
						game_start_date < 868.1.1
						this.dynasty = dynasty:699 #Piast
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_brave_and_bold_achievement
						VALUE = yes
					}
				}
				##15 Lingua Franca
				add_achievement_global_variable_effect = {
					VARIABLE = started_lingua_franca_achievement
					VALUE = yes
				}
				##16 Beta Israel
				add_achievement_global_variable_effect = {
					VARIABLE = started_beta_israel_achievement
					VALUE = yes
				}
				## 17 They belong in a museum!
				add_achievement_global_variable_effect = {
					VARIABLE = started_they_belong_in_a_museum_achievement
					VALUE = yes
				}
				##18 I made this!
				add_achievement_global_variable_effect = {
					VARIABLE = started_i_made_this_achievement
					VALUE = yes
				}
				##19 Nobody Comes to Fika!
				add_achievement_global_variable_effect = {
					VARIABLE = started_nobody_comes_to_fika_achievement
					VALUE = yes
				}
				## 20 The True Royal Court
				add_achievement_global_variable_effect = {
					VARIABLE = started_the_true_royal_court_achievement
						VALUE = yes
				}
				# EP2
				## 01. The Grandest Tour
				add_achievement_global_variable_effect = {
					VARIABLE = started_the_grandest_tour_achievement
					VALUE = yes
				}
				## 02. Your Eternal Reward
				add_achievement_global_variable_effect = {
					VARIABLE = started_your_eternal_reward_achievement
					VALUE = yes
				}
				## 03. Imperial March
				add_achievement_global_variable_effect = {
					VARIABLE = started_imperial_march_achievement
					VALUE = yes
				}
				## 04. Black Dinner
				add_achievement_global_variable_effect = {
					VARIABLE = started_black_dinner_achievement
					VALUE = yes
				}
				## 05. There and Back Again
				add_achievement_global_variable_effect = {
					VARIABLE = started_there_and_back_again_achievement
					VALUE = yes
				}
				## 06. The Very Best
				add_achievement_global_variable_effect = {
					VARIABLE = started_the_very_best_achievement
					VALUE = yes
				}
				## 07. Like No One Ever Was
				add_achievement_global_variable_effect = {
					VARIABLE = started_like_no_one_ever_was_achievement
					VALUE = yes
				}
				## 08. A Thousand and One Night
				add_achievement_global_variable_effect = {
					VARIABLE = started_a_thousand_and_one_nights_achievement
					VALUE = yes
				}
				## 09. A Knight's Tale
				add_achievement_global_variable_effect = {
					VARIABLE = started_a_knights_tale_achievement
					VALUE = yes
				}
				## 10. Hunting Accident
				add_achievement_global_variable_effect = {
					VARIABLE = started_hunting_accident_achievement
					VALUE = yes
				}
				## 11. Lions and Tigers and Bears, Oh My!
				add_achievement_global_variable_effect = {
					VARIABLE = started_lions_and_tigers_and_bears_oh_my_achievement
					VALUE = yes
				}
				## 12. Fly, my Pretty!
				add_achievement_global_variable_effect = {
					VARIABLE = started_fly_my_pretty_achievement
					VALUE = yes
				}
				## 13. Pathway to Heaven
				add_achievement_global_variable_effect = {
					VARIABLE = started_pathway_to_heaven_achievement
					VALUE = yes
				}
				## 14. Sir Lance-a-Lot
				add_achievement_global_variable_effect = {
					VARIABLE = started_sir_lance_a_lot_achievement
					VALUE = yes
				}
				## 15. I'm in my Element(s)
				add_achievement_global_variable_effect = {
					VARIABLE = started_im_in_my_elements_achievement
					VALUE = yes
				}
				## 16. Ahab
				add_achievement_global_variable_effect = {
					VARIABLE = started_ahab_achievement
					VALUE = yes
				}
				## 17. Little William Marshal
				add_achievement_global_variable_effect = {
					VARIABLE = started_little_william_marshal_achievement
					VALUE = 0
				}
				add_achievement_global_variable_effect = {
					VARIABLE = little_william_marshal_achievement_tally
					VALUE = 0
				}
				## 18. A True & Perfect Knight
				add_achievement_global_variable_effect = {
					VARIABLE = started_a_true_and_perfect_knight_achievement
					VALUE = yes
				}
				## 19. A.E.I.O.U & Me
				if = {
					limit = {
						# Etichonen, of whom the Hapsburgs are a cadet - we check dynasty rather than house so that an accidental cadet doesn't screw you.
						this.house ?= house:house_habsburg
					}
					add_achievement_global_variable_effect = {
						VARIABLE = started_a_e_i_o_u_and_me_achievement
						VALUE = yes
					}
				}
				## 20. The Iron and Golden King
				add_achievement_global_variable_effect = {
					VARIABLE = started_the_iron_and_golden_king_achievement
					VALUE = yes
				}

				### RULER DESIGNER ACHIEVEMENT BLOCKS ###
				if = {
					limit = {
						num_virtuous_traits >= 3
					}
					add_achievement_flag_effect = { FLAG = rd_character_blocked_paragon_of_virtue_achievement_flag	}
				}
				if = {
					limit = {
						any_child = {
							count >= 10
							is_alive = yes
						}
					}
					add_achievement_flag_effect = { FLAG = rd_character_blocked_the_succession_is_safe_achievement_flag }
				}
				if = {
					limit = {
						any_child = {
							has_trait = inbred
						}
					}
					add_achievement_flag_effect = { FLAG = rd_character_blocked_keeping_it_in_the_family_achievement_flag }
				}
				if = {
					limit = {
						highest_held_title_tier >= tier_empire
						should_be_naked_trigger = yes
					}
					add_achievement_flag_effect = { FLAG = rd_character_blocked_the_emperors_new_clothes_achievement_flag }
				}
				if = {
					limit = {
						is_from_ruler_designer = yes
						OR = {
							fp1_achievement_culture_norse_trigger = yes
							fp1_achievement_religious_norse_trigger = yes
						}
					}
					add_to_global_unavailable_achievements_list_effect = { FLAG = flag:rd_character_blocked_far_from_home_achievement }
					add_to_global_unavailable_achievements_list_effect = { FLAG = flag:rd_character_blocked_miklagardariki_achievement }
					add_to_global_unavailable_achievements_list_effect = { FLAG = flag:rd_character_blocked_faster_than_the_fox_achievement }
				}
				if = {
					limit = {
						any_ruler = {
							is_from_ruler_designer = yes
						}
					}
					add_to_global_unavailable_achievements_list_effect = { FLAG = flag:rd_character_blocked_iberia_or_iberia_achievement }
					add_to_global_unavailable_achievements_list_effect = { FLAG = flag:rd_character_blocked_el_cid_achievement }
					add_achievement_global_variable_effect = {
						VARIABLE = any_ruler_designed_character_achievement
						VALUE = yes
					}
				}
				if = {
					limit = {
						has_mpo_dlc_trigger = yes
						exists = character:125501
						character:125501 = {
							is_alive = yes
						}
					}
					character:125501 = {
						create_story = story_temujin_flavor
						trigger_event = {
							days = { 12 30 }
							id = mpo_temujin_flavor.0030 # Borte announces she's pregnant
						}
					}
				}
			}
		}

		### ACHIEVEMENT (FP3): The Ummayad Strikes Back
		every_player = {
			if = {
				limit = {
					dynasty = character:73683.dynasty
					location = { geographical_region = world_europe_west_iberia }
				}
				set_global_variable = fp3_the_umma_strikes_back_achievement_tracker # Is not removed (sad!)
			}
		}

		### ACHIEVEMENT: FROM RAGS TO RICHES TO RAGS TO RICHES
		every_player = {
			limit = { highest_held_title_tier = tier_county }
			add_achievement_global_variable_effect = {
				VARIABLE = achievement_rags_to_riches_to_rags_to_riches_valid
				VALUE = yes
			}
		}

		#Set starting cultural acceptance
		
		##### NEOW CULTURES #####
		
		
		##### BRITANNICS #####
		
		culture:soueyrneg = {
			change_cultural_acceptance = {
				target = culture:prytoneg
				value = 35
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:scouseg
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:strafclideg
				value = 10
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:welsh
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:cornish
				value = 10
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:easlander
				value = 35
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:norflander
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:souflander
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:weslander
				value = 25
				desc = cultural_acceptance_historical_relations
			}
		}

		culture:prytoneg = {
			change_cultural_acceptance = {
				target = culture:scouseg
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:strafclideg
				value = 10
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:welsh
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:cornish
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:easlander
				value = 25
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:norflander
				value = 25
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:souflander
				value = 35
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:weslander
				value = 45
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:scouseg = {
			change_cultural_acceptance = {
				target = culture:strafclideg
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:welsh
				value = 15
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:cornish
				value = 10
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:easlander
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:norflander
				value = 50
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:souflander
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:weslander
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:strafclideg = {
			change_cultural_acceptance = {
				target = culture:scottish
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:gaelic
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:welsh
				value = 5
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:easlander
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:norflander
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:souflander
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:weslander
				value = 10
				desc = cultural_acceptance_historical_relations
			}
		}
		
		##### ANGLICS #####
		
		culture:norflander = {
			change_cultural_acceptance = {
				target = culture:scottish
				value = 50
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:gaelic
				value = 15
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:welsh
				value = 25
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:cornish
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:easlander
				value = 35
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:souflander
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:weslander
				value = 10
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:easlander = {
			change_cultural_acceptance = {
				target = culture:scottish
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:gaelic
				value = 10
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:welsh
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:cornish
				value = 25
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:souflander
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:weslander
				value = 10
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:souflander = {
			change_cultural_acceptance = {
				target = culture:scottish
				value = 10
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:welsh
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:cornish
				value = 25
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:weslander
				value = 35
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:weslander = {
			change_cultural_acceptance = {
				target = culture:scottish
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:welsh
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:cornish
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:gaelic = {
			change_cultural_acceptance = {
				target = culture:scottish
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:norner
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:irish
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:high_irish
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:scottish = {
			change_cultural_acceptance = {
				target = culture:norner
				value = 50
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:irish
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:high_irish
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:norner = {
			change_cultural_acceptance = {
				target = culture:irish
				value = 25
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:high_irish
				value = 10
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:irish = {
			change_cultural_acceptance = {
				target = culture:high_irish
				value = 60
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:manx = {
			change_cultural_acceptance = {
				target = culture:high_irish
				value = 10
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:irish
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:strafclideg
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:scouseg
				value = 15
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:doggerlander = {
			change_cultural_acceptance = {
				target = culture:norflander
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:easlander
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:angler
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:dutch
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:frisian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:danish
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:dansk
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:ostsk
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:icelander
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:vestsk
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:scottish
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		#### FRENCHIES ####
		
		culture:metropolitain = {
			change_cultural_acceptance = {
				target = culture:galo
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:picard
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:bourguignon
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:axiton
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:breton
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:gascon
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:normaund
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:occitan
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:patoues
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:poitevin
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:provencal
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:pelonais
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:belge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:elsasse
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:letzebuerge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:lorin
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_sephardi
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:galo = {
			change_cultural_acceptance = {
				target = culture:picard
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:bourguignon
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:axiton
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:breton
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:gascon
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:normaund
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:occitan
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:patoues
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:poitevin
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:provencal
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:pelonais
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:belge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:elsasse
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:letzebuerge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:lorin
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_sephardi
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:picard = {
			change_cultural_acceptance = {
				target = culture:bourguignon
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:axiton
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:breton
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:gascon
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:normaund
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:occitan
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:patoues
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:poitevin
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:provencal
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:pelonais
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:belge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:elsasse
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:letzebuerge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:lorin
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_sephardi
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:bourguignon = {
			change_cultural_acceptance = {
				target = culture:axiton
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:breton
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:gascon
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:normaund
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:occitan
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:patoues
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:poitevin
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:provencal
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:pelonais
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:belge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:elsasse
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:letzebuerge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:lorin
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_sephardi
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:axiton = {
			change_cultural_acceptance = {
				target = culture:breton
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:gascon
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:normaund
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:occitan
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:patoues
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:poitevin
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:provencal
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:pelonais
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:belge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:elsasse
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:letzebuerge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:lorin
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_sephardi
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:breton = {
			change_cultural_acceptance = {
				target = culture:gascon
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:normaund
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:occitan
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:patoues
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:poitevin
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:provencal
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:pelonais
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:belge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:elsasse
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:letzebuerge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:lorin
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_sephardi
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:gascon = {
			change_cultural_acceptance = {
				target = culture:normaund
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:occitan
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:patoues
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:poitevin
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:provencal
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:pelonais
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:belge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:elsasse
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:letzebuerge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:lorin
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_sephardi
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:normaund = {
			change_cultural_acceptance = {
				target = culture:occitan
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:patoues
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:poitevin
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:provencal
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:pelonais
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:belge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:elsasse
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:letzebuerge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:lorin
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_sephardi
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:occitan = {
			change_cultural_acceptance = {
				target = culture:patoues
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:poitevin
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:provencal
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:pelonais
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:belge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:elsasse
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:letzebuerge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:lorin
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_sephardi
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:patoues = {
			change_cultural_acceptance = {
				target = culture:poitevin
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:provencal
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:pelonais
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:belge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:elsasse
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:letzebuerge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:lorin
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_sephardi
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:poitevin = {
			change_cultural_acceptance = {
				target = culture:provencal
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:pelonais
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:belge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:elsasse
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:letzebuerge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:lorin
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_sephardi
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:provencal = {
			change_cultural_acceptance = {
				target = culture:pelonais
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:belge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:elsasse
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:letzebuerge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:lorin
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_sephardi
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:rottisch = {
			change_cultural_acceptance = {
				target = culture:metropolitain
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:galo
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:picard
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:bourguignon
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:axiton
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:breton
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:gascon
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:normaund
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:occitan
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:patoues
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:poitevin
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:provencal
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:pelonais
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:belge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:elsasse
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:letzebuerge
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:lorin
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_sephardi
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		##### IBERIANS #####
		
		culture:andorra = {
			change_cultural_acceptance = {
				target = culture:aragonese
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:asturleonese
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:balearic
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:basque
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:castilian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:catalan
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:extremeno
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:galician
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:llanito
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_andalusian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:portuguese
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:valencian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}

		culture:aragonese = {
			change_cultural_acceptance = {
				target = culture:asturleonese
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:balearic
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:basque
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:castilian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:catalan
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:extremeno
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:galician
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:llanito
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_andalusian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:portuguese
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:valencian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:asturleonese = {
			change_cultural_acceptance = {
				target = culture:balearic
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:basque
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:castilian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:catalan
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:extremeno
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:galician
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:llanito
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_andalusian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:portuguese
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:valencian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:balearic = {
			change_cultural_acceptance = {
				target = culture:basque
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:castilian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:catalan
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:extremeno
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:galician
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:llanito
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_andalusian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:portuguese
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:valencian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:basque = {
			change_cultural_acceptance = {
				target = culture:castilian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:catalan
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:extremeno
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:galician
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:llanito
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_andalusian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:portuguese
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:valencian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:castilian = {
			change_cultural_acceptance = {
				target = culture:catalan
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:extremeno
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:galician
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:llanito
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_andalusian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:portuguese
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:valencian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:extremeno = {
			change_cultural_acceptance = {
				target = culture:extremeno
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:galician
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:llanito
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_andalusian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:portuguese
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:valencian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:galician = {
			change_cultural_acceptance = {
				target = culture:galician
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:llanito
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_andalusian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:portuguese
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:valencian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:llanito = {
			change_cultural_acceptance = {
				target = culture:llanito
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:NEOW_andalusian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:portuguese
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:valencian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:NEOW_andalusian = {
			change_cultural_acceptance = {
				target = culture:portuguese
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:valencian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:portuguese = {
			change_cultural_acceptance = {
				target = culture:valencian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		
		#### MOSELLIC ####
		
		culture:belge = {
			change_cultural_acceptance = {
				target = culture:elsasse
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:letzebuerge
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:lorin
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:dutch
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:frisian
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:kleverlandish
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:limburgisch
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:elsasse = {
			change_cultural_acceptance = {
				target = culture:letzebuerge
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:lorin
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:dutch
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:frisian
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:kleverlandish
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:limburgisch
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:letzebuerge = {
			change_cultural_acceptance = {
				target = culture:lorin
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:dutch
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:frisian
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:kleverlandish
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:limburgisch
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		culture:lorin = {
			change_cultural_acceptance = {
				target = culture:dutch
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:frisian
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:kleverlandish
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:limburgisch
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		
		##### VANILLA CULTURES #####
		
		culture:vlach = {
			change_cultural_acceptance = {
				target = culture:serbian
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:croatian
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:bosnian
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:bulgarian
				value = 40
				desc = cultural_acceptance_historical_relations
			}
		}
		culture:khazar = {
			change_cultural_acceptance = {
				target = culture:radhanite
				value = 25
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:mordvin
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:meshchera
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:muroma
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:russian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		culture:norse = {
			change_cultural_acceptance = {
				target = culture:sami
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:finnish
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		culture:swedish = {
			change_cultural_acceptance = {
				target = culture:sami
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:finnish
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		culture:norwegian = {
			change_cultural_acceptance = {
				target = culture:sami
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		# In 867, the Slavic cultures are still very similar to each other, so we start them off at a very high tolerance.
		if = {
			limit = { current_date = 867.1.1 }
			# West Slavic.
			culture:pommeranian = {
				change_cultural_acceptance = {
					target = culture:czech
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:polish
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:polabian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:slovien
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:carantanian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:russian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:ilmenian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:severian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:volhynian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:croatian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:bosnian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:serbian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:bulgarian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
			}
			culture:czech = {
				change_cultural_acceptance = {
					target = culture:polish
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:polabian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:slovien
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:carantanian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:russian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:ilmenian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:severian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:volhynian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:croatian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:bosnian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:serbian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:bulgarian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
			}
			culture:polish = {
				change_cultural_acceptance = {
					target = culture:polabian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:slovien
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:carantanian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:russian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:ilmenian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:severian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:volhynian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:croatian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:bosnian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:serbian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:bulgarian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
			}
			culture:polabian = {
				change_cultural_acceptance = {
					target = culture:slovien
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:carantanian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:russian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:ilmenian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:severian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:volhynian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:croatian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:bosnian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:serbian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:bulgarian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
			}
			culture:slovien = {
				change_cultural_acceptance = {
					target = culture:carantanian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:russian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:ilmenian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:severian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:volhynian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:croatian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:bosnian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:serbian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:bulgarian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
			}
			culture:carantanian = {
				change_cultural_acceptance = {
					target = culture:russian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:ilmenian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:severian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:volhynian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:croatian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:bosnian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:serbian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:bulgarian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
			}
			# South Slavic.
			culture:croatian = {
				change_cultural_acceptance = {
					target = culture:russian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:ilmenian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:severian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:volhynian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:bosnian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:serbian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:bulgarian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
			}
			culture:bosnian = {
				change_cultural_acceptance = {
					target = culture:russian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:ilmenian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:severian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:volhynian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:serbian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:bulgarian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
			}
			culture:serbian = {
				change_cultural_acceptance = {
					target = culture:russian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:ilmenian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:severian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:volhynian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:bulgarian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
			}
			culture:bulgarian = {
				change_cultural_acceptance = {
					target = culture:russian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:ilmenian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:severian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:volhynian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
			}
			# East Slavic.
			culture:russian = {
				change_cultural_acceptance = {
					target = culture:ilmenian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:severian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:volhynian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
			}
			culture:ilmenian = {
				change_cultural_acceptance = {
					target = culture:severian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:volhynian
					value = 50
					desc = cultural_acceptance_historical_relations
				}
			}
			## Volhynian doesn't get its own box, because we've already applied acceptance to it bilaterally everywhere else.
			#Splitting up Byzantine heritage means we need a little help reflecting historical relations
			culture:greek = {
				change_cultural_acceptance = {
					target = culture:armenian
					value = 20
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:georgian
					value = 20
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:alan
					value = 5
					desc = cultural_acceptance_historical_relations
				}
			}
		}
		if = {
			limit = {
				game_start_date >= 1066.1.1
				game_start_date < 1178.1.1
			}
			culture:greek = {
				change_cultural_acceptance = {
					target = culture:armenian
					value = 40
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:georgian
					value = 25
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:alan
					value = 10
					desc = cultural_acceptance_historical_relations
				}
			}
		}
		if = {
			limit = { game_start_date >= 1178.1.1 }
			culture:greek = {
				change_cultural_acceptance = {
					target = culture:armenian
					value = 30
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:georgian
					value = 15
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:alan
					value = 10
					desc = cultural_acceptance_historical_relations
				}
			}
		}
		#set up cultural acceptance between China and East Asian Empires to aid in the learning of Chinese effect for on_birthday_adulthood

		if = {
			limit = { game_start_date = 867.1.1 }
			culture:japanese = {
				change_cultural_acceptance = {
					target = culture:han
					value = 80
					desc = cultural_acceptance_historical_relations
				}
			}
			culture:goguryeo = {
				change_cultural_acceptance = {
					target = culture:han
					value = 80
					desc = cultural_acceptance_historical_relations
				}
			}
			culture:silla = {
				change_cultural_acceptance = {
					target = culture:han
					value = 80
					desc = cultural_acceptance_historical_relations
				}
			}
			culture:baekje = {
				change_cultural_acceptance = {
					target = culture:han
					value = 80
					desc = cultural_acceptance_historical_relations
				}
			}
			culture:balhae = {
				change_cultural_acceptance = {
					target = culture:han
					value = 80
					desc = cultural_acceptance_historical_relations
				}
			}
		}
		if = {
			limit = { game_start_date = 1066.9.15 }
			culture:japanese = {
				change_cultural_acceptance = {
					target = culture:han
					value = 70
					desc = cultural_acceptance_historical_relations
				}
			}
			culture:goryeo = {
				change_cultural_acceptance = {
					target = culture:han
					value = 70
					desc = cultural_acceptance_historical_relations
				}
			}
		}
		if = {
			limit = { game_start_date = 1178.10.1 }
			culture:japanese = {
				change_cultural_acceptance = {
					target = culture:han
					value = 60
					desc = cultural_acceptance_historical_relations
				}
			}
			culture:goryeo = {
				change_cultural_acceptance = {
					target = culture:han
					value = 60
					desc = cultural_acceptance_historical_relations
				}
			}
		}

		# Specific innovation unlock
		if = {
			limit = {
				game_start_date >= 1066.1.1
			}
			every_culture_global = {
				limit = {
					OR = {
						has_cultural_pillar = heritage_arabic
						this = culture:yemeni
					}
				}
				add_innovation = innovation_ghilman
			}
		}
		# Custom ruler under the HRE should have lowered feudal obligations
		if = {
			limit = { exists = title:e_hre.holder }
			title:e_hre.holder ?= {
				every_vassal = {
					limit = {
						vassal_contract_has_modifiable_obligations = yes
					}
					vassal_contract_decrease_obligation_level = feudal_government_taxes
					vassal_contract_decrease_obligation_level = feudal_government_levies
					set_subject_contract_modification_blocked = no
				}
			}
		}

		if = { # Special historical events for Matilda!
			limit = {
				character:7757 ?= { is_alive = yes }
			}
			character:7757 ?= {
				trigger_event = bookmark.1066 # Matildas marriage to her step-brother, with plausible historical options!
				trigger_event = { # Matildas suspected witchcraft, the player decides if its true or not!
					id = bookmark.1067
					years = { 1 5 }
				}
			}
		}

		if = { # Special historical events for Vratislav!
			limit = {
				character:522 ?= { is_alive = yes }
			}
			character:522 ?= {
				trigger_event = { # Vratislav and the Slavic Marches, he didn't historically get them (one briefly, but eh). The player chooses to appease the emperor or go after the coveted lands themselves!
					id = bookmark.1068
					days = { 35 120 }
				}
				trigger_event = { # Jaromir, Vratislav's brother, was a pain - this event is an opportunity for the player to handle the rivalry
					id = bookmark.1069
					days = { 1 29 }
				}
			}
		}

		if = { # Special historical events for Robert the Fox!
			limit = {
				character:1128 ?= { is_alive = yes }
			}
			character:1128 ?= {
				trigger_event = { # A Norman Sicily - Robert historically conquered quite a bit here, the player can choose how far they want to go and the risk they want to take. The more risk, the more event troops/claims.
					id = bookmark.1070
					days = { 35 120 }
				}
				trigger_event = { # The Pretender Monk - Raiktor is a historical character, a monk wo pretended to be a deposed Byzantine emperor which Robert used to beat up Byzantium. Here you can follow historical conquests (taking a bit of the coast) or go full on 'install him as emperor for real'-mode!
					id = bookmark.1071
					years = { 1 7 }
				}
			}
		}

		if = { # Special historical events for Emir Yahya!
			limit = {
				character:3924 ?= { is_alive = yes }
			}
			character:3924 ?= {
				trigger_event = { # Conquering Cordoba - Gain an opportunity to conquer Cordoba while gaining one of two buffs; one intrigue-focused, and one military. Historically he was poisoned after having conquered the city... but that's no fun for the player!
					id = bookmark.1072
					days = { 10 35 }
				}
			}
		}

		### EP3 SETUP ###
		if = {
			limit = { has_ep3_dlc_trigger = yes }
			### EP3 LAAMP SETUP ###
			# Resources.
			every_independent_ruler = {
				limit = { has_government = landless_adventurer_government }
				# Cash.
				add_gold = {
					value = {
						value = 0
						add = prestige
						add = piety
						divide = 10
					}
				}
				save_temporary_scope_as = adventurer_scope
				# Set CoA
				primary_title = { set_coa = scope:adventurer_scope.house }
				# Cleanup characters
				every_councillor = {
					if = {
						limit = {
							NOR = {
								has_council_position = councillor_court_chaplain
								has_council_position = councillor_spouse
							}
						}
						scope:adventurer_scope = {
							fire_councillor = prev
						}
						remove_opinion = {
							modifier = fired_from_council_opinion
							target = scope:adventurer_scope
						}
					}
					else_if = {
						limit = {
							NOR = {
								is_close_or_extended_family_of = prev
								has_relation_lover = prev
								has_relation_friend = prev
								is_consort_of = prev
								has_council_position = councillor_spouse
							}
						}
						death = {
							death_reason = death_vanished
						}
					}
				}
				# Evict everyone who isn't your family from your camp.
				every_courtier = {
					limit = {
						prev = { save_temporary_scope_as = char_temp }
						NOR = {
							dynasty ?= scope:char_temp.dynasty
							is_imprisoned_by = scope:char_temp
							# Plus any relations, who are presumably meant to be here.
							has_important_relationship_with_character_trigger = { CHARACTER = scope:char_temp }
							# Catch bastards and such that may be left over.
							is_close_or_extended_family_of = scope:char_temp
						}
					}
					move_to_pool = yes
				}
				# Courtiers.
				trigger_event = ep3_laamps.1001
			}
			# Starting camp purposes.
			## Hereweard the Wake
			character:90028 ?= {
				if = {
					limit = { is_alive = yes }
					add_realm_law_skip_effects = camp_purpose_brigands
					if = {
						limit = {
							character:90160 = {
								NOT = { is_courtier_of = character:90028 }
							}
						}
						add_courtier = character:90160
					}
				}
				# Setup event for his story
				trigger_event = {
					id = ep3_laamps.5999
					days = { 1 2 }
				}
			}
			## El Cid
			character:107590 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
					if = {
						limit = {
							character:71391 = {
								NOT = { is_courtier_of = character:107590 }
							}
						}
						add_courtier = character:71391
					}
					if = {
						limit = {
							character:castilian0248 = {
								NOT = { is_courtier_of = character:107590 }
							}
						}
						add_courtier = character:castilian0248
					}
					if = {
						limit = {
							character:castilian0249 = {
								NOT = { is_courtier_of = character:107590 }
							}
						}
						add_courtier = character:castilian0249
					}
				}
			}
			## Robert Crispin
			character:norman_crispin_06 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
			## Hassan Sabbah
			character:41702 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
			## Suleyman Qutalmishog
			character:3046 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
					trigger_event = bookmark.1073 # Suleyman's beef with Alp Arslan
				}
			}
			## Wallada bint al-Mustakfi
			character:andalusian_0003 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_scholars
					trigger_event = ep3_story_cycle_violet_poet.0001
				}
			}
			## Roger Raoul
			character:232504 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
			## Taylu Danişmend
			character:danishmendid_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
			## Prince Takaoka (Shinnyo)
			character:japanese_yamato_181 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_scholars
					# and because history in character file does not work...
					character:japanese_lowborn_1 = { set_employer = character:japanese_yamato_181 } # Anten
					character:japanese_lowborn_2 = { set_employer = character:japanese_yamato_181 } # Enkaku
					character:japanese_lowborn_3 = { set_employer = character:japanese_yamato_181 } # Akimaru
				}
			}
			## Ding Hui
			character:ding_hui_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
			## Zhu Quanzhong
			character:zhu_quanzhong_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
			## Miyoshi Kiyotsura
			character:japanese_miyoshi_4 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
			## Ki Hwon
			character:ki_hwon_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_brigands
				}
			}
			## Yŏn'gi Tosŏn
			character:toson_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
			## Lý Do Độc
			character:ly_do_doc_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
			## Song Jiang
			character:song_jiang_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
			## Yang Zongbao
			character:yang_zongbao_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
			character:furong_daokai_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
			character:jojin_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
			character:isawa_no_saburo_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
			character:tsukushi_no_koretaka_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_brigands
				}
			}
			character:kim_mu_che_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
			character:baekho_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_brigands
				}
			}
			character:khong_lo_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
			character:nga_yamankan_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
			character:mpu_bharada_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
			character:wang_chuyi_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
			character:jiang_kui_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
			character:lembong_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_brigands
				}
			}
			character:zhu_zhongba_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_explorers
				}
			}
			character:quach_boc_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
			character:bojo_jinul_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
			character:gochi_in_no_tajima_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
			character:shin_capata_1 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
			## Yoshitsune Minamoto
			character:japanese_minamoto_seiwa_139 ?= {
				if = {
					limit = {
						is_alive = yes
						has_government = landless_adventurer_government
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
					every_courtier = {
						limit = { dynasty = character:japanese_minamoto_seiwa_139.dynasty }
						set_employer = character:japanese_minamoto_seiwa_10 # Yoritomo
					}
					add_courtier = character:japanese_musashibo_1 # Benkei
					add_courtier = character:japanese_ise_2_1 # Yoshimori
				}
			}
			every_independent_ruler = {
				if = {
					limit = { is_landless_adventurer = yes }
					# C... food.
					domicile = { change_provisions = starting_provisions_value }
					# Contracts
					if = {
						limit = { is_ai = no }
						# Set up additional firing contracts.
						player_adventurer_contract_generation_on_wait_in_place_effect = yes
						#generate contracts if you are far away from your previous location
						player_adventurer_contract_generation_on_domicile_moved_effect = yes
					}
					else = {
						create_story = { type = story_adventurer_ai }
						trigger_event = {
							on_action = on_adventurer_ai_new_employer_arrival
							days = { 10 30 }
						}
					}
					# Sort our starting flavourisation.
					if = {
						limit = { has_realm_law = camp_purpose_mercenaries }
						set_variable = flavourise_camp_purpose_mercenaries
					}
					else_if = {
						limit = { has_realm_law = camp_purpose_wanderers }
						set_variable = flavourise_camp_purpose_wanderers
					}
					else_if = {
						limit = { has_realm_law = camp_purpose_scholars }
						set_variable = flavourise_camp_purpose_scholars
					}
					else_if = {
						limit = { has_realm_law = camp_purpose_explorers }
						set_variable = flavourise_camp_purpose_explorers
					}
					else_if = {
						limit = { has_realm_law = camp_purpose_brigands }
						set_variable = flavourise_camp_purpose_brigands
					}
					else_if = {
						limit = { has_realm_law = camp_purpose_legitimists }
						set_variable = flavourise_camp_purpose_legitimists
					}
					# And tally our numbers for performance purposes.
					add_to_global_variable_list = {
						name = laamps_tally
						target = this.primary_title
					}
				}
				### EP3 ADMIN SETUP ###
				if = {
					limit = { government_allows = administrative }
					save_scope_as = top_liege
					### EP3 NOBLE FAMILIES & DOMICILE SETUP ###
					random_held_title = { # May be removed once every_noble_family includes liege (TIT-51212)
						limit = { is_noble_family_title = yes }
						set_coa = scope:top_liege.house
					}
					every_noble_family = {
						# Ensure Noble Family CoA match House
						set_coa = holder.house
						# Ensure holders of historical noble family titles are the default house heads
						holder ?= {
							save_scope_as = nf_holder
							if = {
								limit = { is_landed = yes }
								capital_province = { save_scope_as = domicile_location }
							}
							house ?= {
								if = {
									limit = { house_head != scope:nf_holder }
									set_house_head = scope:nf_holder
								}
							}
						}
					}
				}
			}
		}
		### TGP SETUP ###
		if = {
			limit = { has_tgp_dlc_trigger = yes }
			### JAPAN

			# Special variable that UI uses to display correct title
			title:e_japan = {
				# More starting house relations
				holder = {
					every_noble_family = {
						holder.house ?= {
							save_temporary_scope_as = house_temp
							every_house_member = {
								limit = {
									is_married = yes
									exists = primary_spouse.house
									NOT = {
										primary_spouse.house = { has_house_relation_with = scope:house_temp }
									}
								}
								save_temporary_scope_as = member_temp
								primary_spouse = { save_temporary_scope_as = spouse_temp }
								house = {
									change_house_relation_effect = {
										HOUSE = scope:member_temp.primary_spouse.house
										VALUE = house_relation_improve_minor_value
										REASON = preexisting_marriage
										CHAR = scope:member_temp
										TARGET_CHAR = scope:spouse_temp
										TITLE = scope:dummy_gender
									}
								}
							}
						}
					}
				}
			}

			### IMPERIAL FAMILY
			title:k_chrysanthemum_throne.holder ?= {
				save_scope_as = japanese_emperor
				# Give him some cash
				add_gold = monumental_gold_value
				house = {
					# ENSURE MEMBERS REMAIN IN COURT OF EMPEROR
					every_house_member = {
						limit = {
							is_ruler = no
							is_married = no
							NOT = { liege = scope:japanese_emperor }
						}
						save_scope_as = imperial_family_member
						scope:japanese_emperor = { add_courtier = scope:imperial_family_member }
					}
				}
				# GET THOSE ROOKIE NUMBERS UP
				dynasty = {
					while = {
						limit = { dynasty_prestige_level < high_dynasty_prestige_level }
						add_dynasty_prestige_level = 1
					}
				}
			}

			### DYNASTY TRACKING SETUP
			japan_dynasty_tracker_setup_effect = yes


			### TGP NOBLE FAMILIES & DOMICILE SETUP ###
			# Required due to landless top liege
			title:e_japan.holder ?= {
				add_realm_law_skip_effects = japanese_bureaucracy_1
				noble_family_title_realm_setup_effect = yes
				every_vassal_or_below = { # Move Soryo domiciles to their own realm
					limit = {
						government_has_flag = government_is_japan_feudal
					}
					domicile ?= { move_domicile = owner.capital_province }
				}
				every_vassal_or_below = { # Move Ritsuryo domiciles to the capital
					limit = {
						government_has_flag = government_is_japan_administrative
					}
					domicile ?= { move_domicile = title:e_japan.holder.capital_province }
				}
			}


			### MANDALA

			#Starting Mandala Temple Complexes
			#Dvaravati
			province:10822 = {
				add_great_building = mandala_capital_01
				if = {
					limit = {
						game_start_date >= 1066.1.1
					}
					ruin_great_building = yes
				}
				add_to_global_variable_list = { # Add to list so it can be found by the PoI
					name = mandala_poi_list
					target = this
				}
			}
			#Haripunjaya
			province:11441 = {
				add_great_building = mandala_capital_01
				add_to_global_variable_list = { # Add to list so it can be found by the PoI
					name = mandala_poi_list
					target = this
				}
			}
			#Pagan
			province:9550 = {
				if = {
					limit = {
						game_start_date < 1066.1.1
					}
					add_great_building = mandala_capital_01
				}
				else_if = {
					limit = { game_start_date >= 1066.1.1 }
					add_great_building = mandala_capital_02
				}
				add_to_global_variable_list = { # Add to list so it can be found by the PoI
					name = mandala_poi_list
					target = this
				}
			}
			#Angkor
			province:10816 = {
				if = {
					limit = {
						game_start_date < 1066.1.1
					}
					add_great_building = mandala_capital_01
				}
				else_if = {
					limit = { game_start_date >= 1066.1.1 }
					add_great_building = mandala_capital_02
				}
				else = {
					add_great_building = mandala_capital_03
				}
				add_to_global_variable_list = { # Add to list so it can be found by the PoI
					name = mandala_poi_list
					target = this
				}
			}
			#Srivijaya/Palembang
			province:11296 = {
				add_great_building = mandala_capital_02
				if = {
					limit = {
						game_start_date >= 1066.1.1
					}
					ruin_great_building = yes #Could also be completely destroyed - almost nothing left today
				}
				add_to_global_variable_list = { # Add to list so it can be found by the PoI
					name = mandala_poi_list
					target = this
				}
			}
			#Mataram
			#Prambanan
			province:11343 = {
				add_great_building = mandala_capital_01
				if = {
					limit = {
						game_start_date >= 1066.1.1
					}
					ruin_great_building = yes
				}
				add_to_global_variable_list = { # Add to list so it can be found by the PoI
					name = mandala_poi_list
					target = this
				}
			}
			#Champa
			#Indrapura
			province:10830 = {
				if = {
					limit = {
						game_start_date < 1066.1.1
					}
					add_great_building = mandala_capital_01
					add_to_global_variable_list = { # Add to list so it can be found by the PoI
						name = mandala_poi_list
						target = this
					}
				}
			}
			#Vijaya
			province:10827 = {
				if = {
					limit = { game_start_date >= 1066.1.1 }
					add_great_building = mandala_capital_01
					add_to_global_variable_list = { # Add to list so it can be found by the PoI
						name = mandala_poi_list
						target = this
					}
				}
			}
			#Apply the Godking AI story to Maharajas with a temple
			every_independent_ruler = {
				limit = { government_has_flag = government_is_mandala }
				if = {
					limit = {
						is_ai = yes
						highest_held_title_tier >= tier_kingdom
						has_mandala_capital_trigger = yes
						trigger_if = {
							limit = { has_ruined_mandala_capital_trigger = yes }
							less_than_max_amount_of_mandala_capitals_trigger = yes
						}
					}
					create_story = story_mandala
				}
			}
		}
		### TGP MERIT AND TREASURY HANDOUT ON GAME START ###
		if = {
			limit = {
				has_tgp_dlc_trigger = yes
			}
			title:h_china.holder ?= {
				# If the hegemon is from the ruler designer, let's ensure we got decent starting values
				if = {
					limit = {
						is_from_ruler_designer = yes
					}
					if = {
						limit = { # If we don't have enough legitimacy, let's increase it
							legitimacy < legitimacy_level_3
						}
						add_legitimacy = {
							value = legitimacy_level_3
							add = 100 # To provide a margin and not drop down a level too quickly
							subtract = legitimacy
						}
					}
					if = {
						limit = { # If the royal court is enabled, set it to a decent default
							has_royal_court = yes
						}
						set_current_court_grandeur = court_grandeur_minimum_expected
					}
					# Let's add some starting currencies
					add_prestige = 1000
					add_piety = 500
					change_influence = 1000
					dynasty ?= { add_dynasty_prestige = 500 }
				}
				# Set Grand Chancellor as Chinese diarchy
				try_start_diarchy = grand_secretariat
			}
		}
		### TGP KOREA SETUP
		if = {
			# Special variable that UI uses to display correct title
			limit = {
				exists = title:e_goryeo.holder
				has_tgp_dlc_trigger = yes
				game_start_date >= 1066.1.1
			}
			# GORYEO GOVERNORSHIP SETUP
			title:d_bukgye = { add_to_temporary_list = goryeo_military_provinces }
			title:d_donggye = { add_to_temporary_list = goryeo_military_provinces }
			title:d_yukju = { add_to_temporary_list = goryeo_military_provinces }
			every_in_list = {
				list = goryeo_military_provinces
				limit = {
					holder ?= { is_governor = yes }
				}
				holder = {
					vassal_contract_set_obligation_level = {
						type = meritocratic_provinces
						level = meritocratic_province_military
					}
					add_realm_law_skip_effects = meritocratic_military_appointment_succession_law
				}
			}
		}
		else_if = {
			limit = {
				exists = title:k_silla.holder
				has_tgp_dlc_trigger = yes
				game_start_date = 867.1.1
			}
			# SILLA GOVERNORSHIP SETUP
			title:d_bukgye = { add_to_temporary_list = silla_military_provinces }
			title:d_donggye = { add_to_temporary_list = silla_military_provinces }
			title:d_yukju = { add_to_temporary_list = silla_military_provinces }
			every_in_list = {
				list = silla_military_provinces
				limit = {
					holder ?= { is_governor = yes }
				}
				holder = {
					vassal_contract_set_obligation_level = {
						type = meritocratic_provinces
						level = meritocratic_province_military
					}
					add_realm_law_skip_effects = meritocratic_military_appointment_succession_law
				}
			}
		}
		### TGP JAPAN SETUP
		if = {
			limit = {
				exists = title:e_japan.holder
				has_tgp_dlc_trigger = yes
			}
			title:c_chikuzen ?= { # Dazaifu
				if = {
					limit = {
						holder ?= { is_governor = yes }
					}
					holder = {
						vassal_contract_set_obligation_level = {
							type = japan_administrative_provinces
							level = japan_administrative_province_trade
						}
					}
				}
			}
			title:d_hitakami ?= { add_to_temporary_list = japan_military_provinces } # Mutsu
			title:d_nushiro ?= { add_to_temporary_list = japan_military_provinces } # Dewa
			every_in_list = {
				list = japan_military_provinces
				limit = {
					holder ?= { is_governor = yes }
				}
				holder = {
					vassal_contract_set_obligation_level = {
						type = japan_administrative_provinces
						level = japan_administrative_province_military
					}
					add_realm_law_skip_effects = japanese_military_appointment_succession_law
				}
			}
			if = {
				limit = {
					game_start_date >= 1066.1.1
					game_start_date < 1178.10.1
				}
				title:e_japan.holder = {
					trigger_event = tgp_japan_career.0001
					every_vassal = {
						trigger_event = tgp_japan_career.0001
					}
				}
			}
		}
		##TEACH CHINESE TO RELEVENT NOBLES###
		title:e_japan.holder ?= {
			add_to_list = holder_to_learn_chinese
		}
		title:e_goryeo.holder ?= {
			add_to_list = holder_to_learn_chinese
		}
		title:h_china.holder ?= {
			every_tributary = {
				add_to_list = holder_to_learn_chinese
			}
		}
		every_in_list = {
			list = holder_to_learn_chinese
			tgp_learn_chinese_effect_game_start = yes
			every_noble_family = {
				holder ?= {
					tgp_learn_chinese_effect_game_start = yes
					house = {
						every_house_member = {
							tgp_learn_chinese_effect_game_start = yes
						}
					}
				}
			}
		}
		# Byzantium naming
		title:e_byzantium = {
			if = {
				limit = {
					has_game_rule = eastern_rome_name_of_byzantium
				}
				set_title_name = e_eastern_roman_empire
			}
			else_if = {
				limit = {
					has_game_rule = roman_empire_name_of_byzantium
				}
				set_title_name = h_roman_empire
			}
			else_if = {
				limit = {
					has_game_rule = romania_name_of_byzantium
				}
				set_title_name = e_romania_empire
			}
			else_if = {
				limit = {
					has_game_rule = empire_of_the_greeks_name_of_byzantium
				}
				set_title_name = e_empire_of_the_greeks
			}
			else_if = {
				limit = {
					has_game_rule = rhomaion_name_of_byzantium
				}
				set_title_name = e_rhomaion
			}
			else_if = {
				limit = {
					has_game_rule = unholy_roman_empire_name_of_byzantium
				}
				set_title_name = e_unholy_roman_empire
			}
		}
		# Saharan stuff.
		every_county_in_region = {
			region = custom_sahara_proper
			# Every county is in the region, not every province of every county, so we go to county to avoid iterating over every world province _then_ check which ones are in the region.
			every_county_province = { apply_saharan_provisions_debuff_effect = yes }
		}
		# 1066 Buildings
		if = {
			limit = {
				game_start_date >= 2666.1.1
				game_start_date < 2784.10.1
			}
			every_province = {
				limit = {
					has_holding = yes
				}
				generate_building = yes
				brewery_counter_start_effect = yes
			}
			every_domicile = {
				limit = { exists = owner }
				switch = {
					trigger = is_domicile_type
					estate = {
						if = {
							limit = {
								NOT = { has_domicile_building_or_higher = estate_main_02 }
								owner.culture ?= { has_innovation = innovation_city_planning }
							}
							add_domicile_building = estate_main_02
							add_random_internal_estate_building = yes
						}
						fill_external_estate_building_effect = yes
					}
					japanese_manor = {
						if = {
							limit = {
								NOT = { has_domicile_building_or_higher = japanese_manor_main_02 }
								owner.culture ?= { has_innovation = innovation_city_planning }
							}
							add_domicile_building = japanese_manor_main_02
							add_random_internal_japanese_manor_building = yes
						}
						fill_external_japanese_manor_building_effect = yes
					}
					east_asian_estate = {
						if = {
							limit = {
								NOT = { has_domicile_building_or_higher = east_asian_estate_main_02 }
								owner.culture ?= { has_innovation = innovation_city_planning }
							}
							add_domicile_building = east_asian_estate_main_02
							add_random_internal_east_asian_estate_building = yes
						}
						fill_external_east_asian_estate_building_effect = yes
					}
				}
			}
		}
		# 1178 Buildings
		else_if = {
			limit = {
				game_start_date >= 2784.10.1
			}
			every_province = {
				limit = {
					has_holding = yes
				}
				generate_building = yes
				generate_building = yes
				generate_building = yes
				generate_building = yes
				generate_building = yes
				generate_building = yes
				if = {
					limit = {
						county.development_level >= 8
					}
					generate_building = yes
					generate_building = yes
				}
				if = {
					limit = {
						county.development_level >= 10
					}
					generate_building = yes
				}
				if = {
					limit = {
						county.development_level >= 12
					}
					generate_building = yes
				}
				if = {
					limit = {
						county.development_level >= 14
					}
					generate_building = yes
					generate_building = yes
				}
				if = {
					limit = {
						county.development_level >= 16
					}
					generate_building = yes
				}
				if = {
					limit = {
						county.development_level >= 18
					}
					generate_building = yes
				}
				if = {
					limit = {
						county.development_level >= 20
					}
					generate_building = yes
				}
				if = {
					limit = {
						county.development_level >= 25
					}
					generate_building = yes
					generate_building = yes
					generate_building = yes
				}
				brewery_counter_start_effect = yes
			}
			every_domicile = {
				#if = { # Left in if we want adventurers to spawn with stuff
				#	limit = {
				#		is_domicile_type = camp
				#	}
				#	add_domicile_building = camp_main_02
				#	add_domicile_building = camp_main_03
				#	random_list = {
				#		10 = {
				#			add_domicile_building = supply_tent_01
				#			add_domicile_building = supply_tent_02
				#			random_list = {
				#				10 = {
				#					add_domicile_building = supply_tent_sutler
				#				}
				#				10 = {
				#					add_domicile_building = supply_tent_mender
				#				}
				#				10 = {
				#					add_domicile_building = supply_tent_smithy
				#				}
				#				10 = {
				#					add_domicile_building = supply_tent_arsenal
				#				}
				#			}
				#		}
				#		10 = {
				#			add_domicile_building = barber_tent_01
				#			add_domicile_building = barber_tent_02
				#			random_list = {
				#				10 = {
				#					add_domicile_building = barber_tent_surgeons_tools
				#				}
				#				10 = {
				#					add_domicile_building = barber_tent_dentists_tools
				#				}
				#				10 = {
				#					add_domicile_building = barber_tent_torturers_tools
				#				}
				#			}
				#		}
				#		10 = {
				#			add_domicile_building = baggage_train_01
				#			add_domicile_building = baggage_train_02
				#			random_list = {
				#				10 = {
				#					add_domicile_building = baggage_train_ample_steeds
				#				}
				#				10 = {
				#					add_domicile_building = baggage_train_porters
				#				}
				#				10 = {
				#					add_domicile_building = baggage_train_trackers
				#				}
				#				10 = {
				#					add_domicile_building = baggage_train_kennel
				#				}
				#			}
				#		}
				#	}
				#	random_list = {
				#		10 = {
				#			add_domicile_building = mess_tent_01
				#			add_domicile_building = mess_tent_02
				#			random_list = {
				#				10 = {
				#					add_domicile_building = mess_tent_herbalists
				#				}
				#				10 = {
				#					add_domicile_building = mess_tent_brewers
				#				}
				#				10 = {
				#					add_domicile_building = mess_tent_curers
				#				}
				#				10 = {
				#					add_domicile_building = mess_tent_bakers
				#				}
				#				10 = {
				#					add_domicile_building = mess_tent_cooks
				#				}
				#			}
				#		}
				#		10 = {
				#			add_domicile_building = camp_fire_01
				#			add_domicile_building = camp_fire_02
				#			random_list = {
				#				10 = {
				#					add_domicile_building = camp_fire_trailing_musicians
				#				}
				#				10 = {
				#					add_domicile_building = camp_fire_wandering_poets
				#				}
				#				10 = {
				#					add_domicile_building = camp_fire_capering_fools
				#				}
				#				10 = {
				#					add_domicile_building = camp_fire_libations_for_the_lost
				#				}
				#			}
				#		}
				#	}
				#	random_list = {
				#		10 = {
				#			add_domicile_building = camp_perimeter_01
				#			add_domicile_building = camp_perimeter_02
				#			random_list = {
				#				10 = {
				#					add_domicile_building = camp_perimeter_good_siting
				#				}
				#				10 = {
				#					add_domicile_building = camp_perimeter_fixed_layout
				#				}
				#			}
				#		}
				#		10 = {
				#			add_domicile_building = proving_grounds_01
				#			add_domicile_building = proving_grounds_02
				#		}
				#	}
				#}
				every_domicile = {
					limit = { exists = owner }
					switch = {
						trigger = is_domicile_type
						estate = {
							if = {
								limit = {
									NOT = { has_domicile_building_or_higher = estate_main_02 }
									owner.culture ?= { has_innovation = innovation_city_planning }
								}
								add_domicile_building = estate_main_02
								add_random_internal_estate_building = yes
							}
							if = {
								limit = {
									has_domicile_building = estate_main_02
									NOT = { has_domicile_building_or_higher = estate_main_03 }
									owner.culture ?= { has_innovation = innovation_manorialism }
								}
								add_domicile_building = estate_main_03
								while = {
									count = 2
									add_random_internal_estate_building = yes
								}
							}
							fill_external_estate_building_effect = yes
						}
						japanese_manor = {
							if = {
								limit = {
									NOT = { has_domicile_building_or_higher = japanese_manor_main_02 }
									owner.culture ?= { has_innovation = innovation_city_planning }
								}
								add_domicile_building = japanese_manor_main_02
								add_random_internal_japanese_manor_building = yes
							}
							if = {
								limit = {
									has_domicile_building = japanese_manor_main_02
									NOT = { has_domicile_building_or_higher = japanese_manor_main_03 }
									owner.culture ?= { has_innovation = innovation_manorialism }
								}
								add_domicile_building = japanese_manor_main_03
								while = {
									count = 2
									add_random_internal_japanese_manor_building = yes
								}
							}
							fill_external_japanese_manor_building_effect = yes
						}
						east_asian_estate = {
							if = {
								limit = {
									NOT = { has_domicile_building_or_higher = east_asian_estate_main_02 }
									owner.culture ?= { has_innovation = innovation_city_planning }
								}
								add_domicile_building = east_asian_estate_main_02
								add_random_internal_east_asian_estate_building = yes
							}
							if = {
								limit = {
									has_domicile_building = east_asian_estate_main_02
									NOT = { has_domicile_building_or_higher = east_asian_estate_main_03 }
									owner.culture ?= { has_innovation = innovation_manorialism }
								}
								add_domicile_building = east_asian_estate_main_03
								while = {
									count = 2
									add_random_internal_east_asian_estate_building = yes
								}
							}
							fill_external_east_asian_estate_building_effect = yes
						}
					}
				}
			}
		}
		# Purge family titles if Admin isn't enabled
		if = {
			limit = {
				NOT = { has_dlc_feature = roads_to_power }
			}
			every_ruler = {
				save_temporary_scope_as = this_ruler
				every_held_title = {
					limit = {
						is_noble_family_title = yes
						title_domicile ?= {
							is_domicile_type = estate
						}
					}
					scope:this_ruler = {
						destroy_title = prev
					}
				}
			}
		}

		##### GENPEI WAR
		### 1178 - MINATOMO YORITOMO ###
		if = {
			limit = {
				character:japanese_minamoto_seiwa_10 ?= { is_alive = yes }
			}
			character:japanese_minamoto_seiwa_10 ?= { trigger_event = tgp_genpei_character.1000 }
		}
		### 1178 - MINATOMO YOSHINAKA ###
		if = {
			limit = {
				character:japanese_minamoto_seiwa_207 ?= { is_alive = yes }
			}
			character:japanese_minamoto_seiwa_207 = { trigger_event = tgp_genpei_character.1090 }
		}
		### 1178 - MINATOMO YOSHITSUNE ###
		if = {
			limit = {
				character:japanese_minamoto_seiwa_139 ?= { is_alive = yes }
			}
			character:japanese_minamoto_seiwa_139 = { trigger_event = tgp_genpei_character.1100 }
		}
		### 1178 - TAIRA KIYOMORI ###
		if = {
			limit = {
				character:japanese_taira_kanmu_34 ?= { is_alive = yes }
			}
			character:japanese_taira_kanmu_34 = {
				trigger_event = tgp_genpei_character.2000
				trigger_event = { #Delayed event
					id = tgp_genpei_character.2010
					months = 6
				}
			}
		}
		### 1178 - FUJIWARA MOTOFUSA ###
		if = {
			limit = {
				character:japanese_fujiwara_511 ?= { is_alive = yes }
			}
			character:japanese_fujiwara_511 = { trigger_event = tgp_genpei_character.3000 }
		}
		### 1178 - FUJIWARA HIDEHIRA ###
		if = {
			limit = {
				character:japanese_fujiwara_497 ?= { is_alive = yes }
			}
			character:japanese_fujiwara_497 = { trigger_event = tgp_genpei_character.3100 }
		}
		### 1178 - EMPEROR GO-SHIRAKAWA ###
		if = {
			limit = {
				character:japanese_yamato_51 ?= { is_alive = yes }
			}
			character:japanese_yamato_51 = { trigger_event = tgp_genpei_character.4000 }
		}

		every_county_in_region = {
			region = world_steppe
			limit = {
				uses_county_fertility = yes
			}

			if = {
				limit = {
					holder = {
						government_has_flag = government_is_nomadic
					}
					county_fertility > 20
					county_fertility <= 90
				}
				switch = {
					trigger = holder.primary_title.tier
					tier_empire = {
						change_county_fertility = { 16 32 }
					}
					tier_kingdom = {
						change_county_fertility = { 12 16 }
					}
					tier_duchy = {
						change_county_fertility = { 8 12 }
					}
					tier_county = {
						change_county_fertility = { 2 8 }
					}
				}
			}
			else_if = {
				limit = {
					holder = {
						government_has_flag = government_is_herder
					}
				}
				change_county_fertility = { 44 64 }
 			}
		}

		# Conquerors
		character:144133 ?= {
			if = {
				limit = {
					is_alive = yes
					NOT = { has_game_rule = no_conquerors_frequency }
				}
				create_story = story_conqueror
			}
		}
		character:144141 ?= {
			if = {
				limit = {
					is_alive = yes
					NOT = { has_game_rule = no_conquerors_frequency }
				}
				create_story = story_conqueror
			}
		}
		character:175080 ?= {
			if = {
				limit = {
					is_alive = yes
					NOT = { has_game_rule = no_conquerors_frequency }
				}
				create_story = story_conqueror
			}
		}
		character:226000 ?= {
			if = {
				limit = {
					is_alive = yes
					NOT = { has_game_rule = no_conquerors_frequency }
				}
				create_story = story_conqueror
			}
		}

		every_player = {
			limit = {
				is_landed = yes
			}
			while = {
				count = 7
				limit = {
					any_courtier = {
						count < 7
						is_adult = yes
					}
				}
				save_scope_as = player_scope
				random_list = {
					1 = {
						create_character = {
							employer = scope:player_scope
							age = { 20 30 }
							random_traits = yes
							gender_female_chance = scope:player_scope.marriage_gender_adjusted_female_chance
							culture = scope:player_scope.culture
							faith = scope:player_scope.faith
							after_creation = {
								random_list = {
									200 = {
										# Character is of average weight, nothing happens
									}
									25 = {
										change_current_weight = -25
									}
									25 = {
										change_current_weight = -75
									}
									25 = {
										change_current_weight = 25
									}
									25 = {
										change_current_weight = 75
									}
									5 = {
										change_current_weight = 150
									}
								}
							}
						}
					}
					4 = {
						create_character = {
							employer = scope:player_scope
							age = { 20 40 }
							random_traits = yes
							gender_female_chance = 15
							culture = scope:player_scope.culture
							faith = scope:player_scope.faith
							after_creation = {
								random_list = {
									200 = {
										# Character is of average weight, nothing happens
									}
									25 = {
										change_current_weight = -25
									}
									25 = {
										change_current_weight = -75
									}
									25 = {
										change_current_weight = 25
									}
									25 = {
										change_current_weight = 75
									}
									5 = {
										change_current_weight = 150
									}
								}
							}
						}
					}
				}
			}
		}

		# Sanity check the setup if in debug mode
		if = {
        	limit = {
        		debug_only = yes
        	}
	        run_setup_tests_effect = yes
    	}
		set_global_variable = game_has_started

		every_independent_ruler = {
			# Treasury setup for any government using treasury
			tgp_treasury_setup_effect = yes
		}

		# TGP China education track switch

		if = {
			limit = {
				exists = title:h_china.holder
			}
			title:h_china.holder = {
				add_to_list = realm_potential_education_flip_list
			}
		}
		if = {
			limit = {
				exists = title:e_goryeo.holder
			}
			title:e_goryeo.holder = {
				add_to_list = realm_potential_education_flip_list
			}
		}
		if = {
			limit = {
				exists = title:k_dali.holder
			}
			title:k_dali.holder = {
				add_to_list = realm_potential_education_flip_list
			}
		}
		if = {
			limit = {
				exists = title:k_viet.holder
			}
			title:k_viet.holder = {
				add_to_list = realm_potential_education_flip_list
			}
		}
		if = {
			limit = {
				exists = title:k_xia.holder
			}
			title:k_xia.holder = {
				add_to_list = realm_potential_education_flip_list
			}
		}
		if = {
			limit = {
				exists = title:e_andong.holder
			}
			title:e_andong.holder = {
				add_to_list = realm_potential_education_flip_list
			}
		}

		every_in_list = {
			list = realm_potential_education_flip_list
			every_vassal_or_below = {
				limit = {
					is_ai = yes
					OR = {
						AND = {
							OR = {
								vassal_contract_has_flag = celestial_province_military
								vassal_contract_has_flag = celestial_province_protectorate
							}
							has_trait_with_flag = civilian_province
						}
						AND = {
							OR = {
								vassal_contract_has_flag = celestial_province_standard
								vassal_contract_has_flag = celestial_province_industrial
								vassal_contract_has_flag = celestial_province_metropolitan
							}
							has_trait_with_flag = military_province
						}
					}
				}
				tgp_flip_education_track_on_game_start = yes
			}
		}
	}

	events = {
		game_rule.1011	#Hungarian Migration management.
		historical_artifacts.0023			# Historical Artifacts Generator
		coronation_events.0302 # ACH crown giveaway
	}
}

#$CHARACTER$.house = {
#			save_scope_as = character_house
#
#			add_unity_value = {
#				value = {
#					value = $VALUE$
#					if = { # House heads have a larger impact on unity
#						limit = { house_head = $CHARACTER$ }
#						multiply = unity_house_head_multiplier_value
#					}
#				}
#				character = $CHARACTER$
#				desc = $DESC$
#			}
#		}

