﻿### EK EDIT: Removed references to vanilla religions cultures and characters, and disabled the achievements tracking

# Called from code after history generation
# Empty scope
on_game_start = {
	###EK ADDITION: Plugged our own on_actions
	on_actions = {
		db_on_game_start_effects
		ek_on_game_start_culture
		ek_on_game_start_religion
		#ek_on_game_start_laws #EK NOTE: this is commented out for unknown reason
		ek_on_game_start_history
		ek_on_game_start_events
		ek_on_game_start_effects
		ek_on_game_start_dynamic_coa
		ek_on_game_start_praxis
		ek_on_game_start_flavourise
		ek_narrative_events_start
		on_game_start_lunar_cycle
		on_game_start_initialize_patron_status
		ek_on_game_start_fix_history_parents
		ek_on_game_start_gh_de_jure
	}
	#EK ADDITION END
	
	events = {
		#EK DISABLED
		#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 = {
		#EK DISABLED
		# 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
		}
		#EK DISABLED: vanilla specific setup
		#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 }
		#		}
		#	}
		#}

		#character:bookmark_huang_chao = {
		#	if = {
		#		limit = {
		#			is_alive = yes
		#			is_playable_character = yes
		#		}
		#		trigger_event = {
		#			id = bookmark.0500
		#			days = 1
		#		}
		#	}
		#}

		### 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
		#}
		
		### ARMENIAN SETUP ###
		#title:e_byzantium.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 = religious_rights level = 1 }
		#		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 ###
		#EK DISABLED (what is an England?)
		#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
					}
				}
			}
		}

		#EK DISABLED
		#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
		#}

		#CP6 Special Buildings - Goes Before Holy Sites
		#if = {
		#	limit = {
		#		has_cp6_dlc_trigger = yes
		#	}
			#remove
	    #    title:b_vaticano.title_province = { remove_building = holy_site_cathedral_01 } #2577
		#	title:b_indraprastha.title_province = { remove_building = iron_pillar_of_delhi_01 } #1365
			
			#always exists
	    #    title:b_vaticano.title_province = { add_special_building = holy_site_st_peters_basilica_01 } #2577
	    #    title:b_kathmandu.title_province = { add_special_building = boudhanath_01 } #9116
	    #    title:b_indraprastha.title_province = { add_special_building = qutb_minar_01 } #1365
	    #    title:b_sanchi.title_province = { add_special_building = sanchi_stupa_01 } #3323
			
			#only buildable
	    #    title:b_yazd.title_province = { add_special_building_slot = yazd_mosque_01 } #4053
			
			#different by start date
	    #    if = { 
		#		limit = {
		#			game_start_date >= 1066.9.15
		#		} 
		#		title:b_avranches.title_province = { add_special_building = mont_st_michel_02 } 
		#	} #2167
	    #    else = { 
		#		title:b_avranches.title_province = { add_special_building = mont_st_michel_01 } 
		#	}
			
		#}
		### 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:christianity_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 }
		#}
		#EK DISABLED: we don't use this rule
		### GAME RULE: EXTRA ADMINS
		#apply_historic_administrative_game_rule_effect = yes
		#EK DISABLED: vanilla stuff
		### 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
		#	}
		#}
		#EK TODO COMP 1-13: adapt our holy order event creations to vanilla system
		#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
		#	}
		#}
		#EK DISABLED: removed vanilla universities and coas
		### 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
			#}
		#}
		#EK DISABLED
		#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
						#EK DISABLED
						#trigger_if = { # Heinich IV crowned April 1st 1084 by Pope Clement III
						#	limit = { has_title = title:e_hre }
						#	NOT = { game_start_date = 1066.9.15 }
						#}
					}
					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
					}
					#EK EDIT: autocracy is default for us
					#change_government = feudal_government
					change_government = autocracy_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
						}
					}
					#EK EDIT
					#change_government = feudal_government
					change_government = autocracy_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
					}
				}
			}
		}
		#EK DISABLED
		# 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

		#EK DISABLED
		# 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 }
		#}

		#EK DISABLED: vanilla counties
		### 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 }
		#}

		#EK NOTE: our Pandidakterion (Imperial university) would be probably only be refounded by Tiber at the end of 2E
		### 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 }
		#}

		#EK DISABLED: references to vanilla
		#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:e_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:e_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:e_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:e_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:e_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:e_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:e_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:e_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:e_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:e_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:e_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:e_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:e_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:e_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:e_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:e_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:e_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:e_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:e_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
					#EK EDIT
					#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
		#EK DISABLED
		#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
		}
		
		#EK TODO: add our regions, kept few as example
		### TGP Earthquake Regions
		add_to_global_variable_list = { name = earthquake_region_list target = geographical_region:mundus_tamriel_yokuda_northern }

		### TGP Flood Regions
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:xylo_river_region }
		add_to_global_variable_list = { name = flood_region_list target = geographical_region:eshita_river_region }
		
		##### HISTORICAL HOUSE RELATIONS - deliberately placed above blocs
		#tgp_setup_historical_house_relation_effect = yes
		#####  TGP JAPAN #####
		#EK DISABLED
		#if = {
		#	limit = { has_tgp_dlc_trigger = yes }
			### DYNASTIES
		#	tgp_dynasty_house_name_setup_effect = yes
			### BLOCS
		#	tgp_setup_historical_house_bloc_effect = yes
		#}
		#
		#EK DISABLED: no magyars
		#if = {
		#	limit = {
		#		title:k_magyar = {
		#			exists = holder
		#		}
		#	}
		#	title:k_magyar = {
		#		add_title_law = confederation_elective_succession_law
		#	}
		#}
	}
}

# 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 = {
	#EK ADDITION
	on_actions = {
		on_game_start_players_initialize_patrons
		ek_on_game_start_to_elc
		#on_start_birthsign
		ek_on_game_start_after_lobby
	}
	#EK ADDITION END
	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
					}
				}
			}
		}

		#EK DISABLED
		# 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 ###
		#EK DISABLED
		#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 = {
						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
						}
					}
				}
				#EK DISABLED
				#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
							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
						if = {
							limit = {
								current_year >= 1100
							}
							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
							}
						}
						else = {
							domicile ?= {
								add_domicile_building = yurt_main_02
								add_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
						if = {
							limit = {
								current_year >= 1100
							}
							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
							}
						}
						else = {
							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
							}
						}
					}
				}
				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 }	

				#EK EDIT: Mane in 440/450 is not doing great, nerfed these values
				#Triple Mandala's Legitimacy to make them not start at a negative expectation at game start
				add_legitimacy = {
					value = legitimacy
					multiply = 2
					#EK TODO: maybe actually use this for later dates
					#EK EDIT
					#if = {
					#	limit = {
					#		highest_held_title_tier > tier_duchy
					#	}
					#	multiply = 3
					#}
					#else = { multiply = 2 }
					#EK EDIT END
				}

				#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 = {
				#EK DISABLED: this is for chinese specifically
				#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
				#						}
				#					}
				#				}
				#			}
				#		}
				#	}
					#EK DISABLED: deleted chinese military governorships
				#}
				### Examination pass status and initial wave of governor candidates done after game start, in order to include generated families ###
				#EK TODO: reuse if we use meritocratic/celestial
				#EK DISABLED
				#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
					#EK EDIT
					#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
					#EK EDIT
					#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
				}
			}
		}

		#EK DISABLED: irl cultures
		#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
		}
		#EK DISABLED
		### 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
		#	}
		#}

		#EK DISABLED
		### 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 = {
		#			limit = { tier >= 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.
		#EK DISABLED: we don't use this rule
		#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
			}
		}
		# EK EDIT: commented out history-related achievement tracking. kept generic achievements
		### 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
				#		}
				#		has_religion = religion:christianity_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 = {
				#		has_title = title:c_samosata
				#		this.house = house:house_seljuk # Seljuk
				#	}
				#	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
		# EK EDIT: cleared out vanilla ones, added some of our own. NOTE: these are bilateral, don't apply them both ways

		# values are intended to mostly make up for lack of good relations due to baseline factors. Cultures that should be very friendly but already share faith for example get reduced values therefore
		# I wanna reflect long historical coexistence, cousinship between separate heritages as well as "recent events" - Reins note

		## Akaviri
		if = { #Rim-Men don't exist in 440
			limit = {
				game_start_date > 3362.1.1
			}
			culture:rimmen = {
				# +40
				# Rim-men have good relations with Anequinans and Rimmenese who accepted them
				change_cultural_acceptance = {
					target = culture:anequinan
					value = 40
					desc = cultural_acceptance_historical_relations
				}
				change_cultural_acceptance = {
					target = culture:rimmenese
					value = 40
					desc = cultural_acceptance_historical_relations
				}
			}
		}
		culture:ilniviri = {
			# +30
			## The Ilniviri however have good relations with the Pellitinians
			change_cultural_acceptance = {
				target = culture:pellitinian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			# Also Mountain Orcs. The Potentates were very impressed with the loyalty and bravery of Orc Legionaires
			change_cultural_acceptance = {
				target = culture:mountain_orc
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			# +20
			# Heartlanders and Nibenese make up the power base of the Potentate
			change_cultural_acceptance = {
				target = culture:heartlander
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:nibenese
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		## These progenitor Nedes would have good ties to Bretons
		culture:galen = {
			# +40
			change_cultural_acceptance = {
				target = culture:glenumbran
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:iliac
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:northmen
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:wrothgarian
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:bjoule
				value = 40
				desc = cultural_acceptance_historical_relations
			}
		}
		## Empire of Men: Cyrodiilics with others
		# Heartlanders
		culture:heartlander = {
			# +40
			# all bretons
			change_cultural_acceptance = {
				target = culture:glenumbran
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:iliac
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:northmen
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:wrothgarian
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:bjoule
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# mainland Nords
			change_cultural_acceptance = {
				target = culture:eastmarcher
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:westmarcher
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:cyro_nord
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# +30
			# forebears - slightly reduced as they weren't as enthusiastic to the various Empires
			change_cultural_acceptance = {
				target = culture:forebear
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			# +20
			# Scions: Ojel and Cyroboiche, somewhat lower
			change_cultural_acceptance = {
				target = culture:ojel
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:cyrobosmer
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		# Colovians
		culture:colovian = {
			# +40
			# all bretons
			change_cultural_acceptance = {
				target = culture:glenumbran
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:iliac
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:northmen
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:wrothgarian
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:bjoule
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# mainland Nords
			change_cultural_acceptance = {
				target = culture:eastmarcher
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:westmarcher
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:cyro_nord
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# +30
			# forebears - slightly reduced as they weren't as enthusiastic to the various Empires
			change_cultural_acceptance = {
				target = culture:forebear
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			# +20
			# Scions: Ojel and Cyroboiche, somewhat lower
			change_cultural_acceptance = {
				target = culture:ojel
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:cyrobosmer
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		# Nibenese
		culture:nibenese = {
			# +40
			# all bretons
			change_cultural_acceptance = {
				target = culture:glenumbran
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:iliac
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:northmen
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:wrothgarian
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:bjoule
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# mainland Nords
			change_cultural_acceptance = {
				target = culture:eastmarcher
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:westmarcher
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:cyro_nord
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# +30
			# forebears - slightly reduced as they weren't as enthusiastic to the various Empires
			change_cultural_acceptance = {
				target = culture:forebear
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			# +20
			# Scions: Ojel and Cyroboiche, somewhat lower
			change_cultural_acceptance = {
				target = culture:ojel
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:cyrobosmer
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		# Strident
		culture:strident = {
			# +40
			# all bretons
			change_cultural_acceptance = {
				target = culture:glenumbran
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:iliac
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:northmen
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:wrothgarian
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:bjoule
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# mainland Nords
			change_cultural_acceptance = {
				target = culture:eastmarcher
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:westmarcher
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:cyro_nord
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# forebears - Strident get +40 compared to the +30 of other Cyrodiilics due to close proximity
			change_cultural_acceptance = {
				target = culture:forebear
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# Strident are additionally in good standing with Abeceans
			change_cultural_acceptance = {
				target = culture:abecean
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# +20
			# Scions: Ojel and Cyroboiche, somewhat lower
			change_cultural_acceptance = {
				target = culture:ojel
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:cyrobosmer
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		# Nibenu - I guess these guys can get it too
		culture:nibenu = {
			# +40
			# all bretons
			change_cultural_acceptance = {
				target = culture:glenumbran
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:iliac
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:northmen
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:wrothgarian
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:bjoule
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# mainland Nords
			change_cultural_acceptance = {
				target = culture:eastmarcher
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:westmarcher
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:cyro_nord
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# +30
			# forebears - slightly reduced as they weren't as enthusiastic to the various Empires
			change_cultural_acceptance = {
				target = culture:forebear
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			# +20
			# Scions: Ojel and Cyroboiche
			change_cultural_acceptance = {
				target = culture:ojel
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:cyrobosmer
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		## Yokudans
		# Silverhoof have intermarried with their neighbours in Tamriel since their arrival
		culture:silverhoof = {
			# +40
			# especially these guys who also like horsies
			change_cultural_acceptance = {
				target = culture:bjoule
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# +30
			# the rest of Bretons
			change_cultural_acceptance = {
				target = culture:glenumbran
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:iliac
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:northmen
				value = 30
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:wrothgarian
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		## Altmer with others
		# Alinori
		culture:alinor = {
			# +40
			# Bosmer except Cyroboiche
			change_cultural_acceptance = {
				target = culture:morathi
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:altmeribosmer
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:arenthi
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:silvenari
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:etarani
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# The Falmer - should they return
			change_cultural_acceptance = {
				target = culture:falmer
				value = 40
				desc = cultural_acceptance_historical_relations
			}
		}
		# Auridoni
		culture:auridon = {
			# +40
			# Bosmer except Cyroboiche
			change_cultural_acceptance = {
				target = culture:morathi
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:altmeribosmer
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:arenthi
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:silvenari
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:etarani
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# The Falmer - should they return
			change_cultural_acceptance = {
				target = culture:falmer
				value = 40
				desc = cultural_acceptance_historical_relations
			}
		}
		# Balfieri - same as the others but also +20 with Bretons
		culture:balfiera = {
			# +40
			# Bosmer except Cyroboiche
			change_cultural_acceptance = {
				target = culture:morathi
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:altmeribosmer
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:arenthi
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:silvenari
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:etarani
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# The Falmer - should they return
			change_cultural_acceptance = {
				target = culture:falmer
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# +20
			# The Balfieri have coexisted alongside Bretons for millennia - more or less in peace
			change_cultural_acceptance = {
				target = culture:glenumbran
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:iliac
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:northmen
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:wrothgarian
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:bjoule
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		# Corelanya
		culture:corelanya = {
			# +40
			# Bosmer except Cyroboiche
			change_cultural_acceptance = {
				target = culture:morathi
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:altmeribosmer
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:arenthi
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:silvenari
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:etarani
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# The Falmer - should they return
			change_cultural_acceptance = {
				target = culture:falmer
				value = 40
				desc = cultural_acceptance_historical_relations
			}
		}
		## Bosmer
		# Boiche
		culture:morathi = {
			# +40
			# The Mathmeldi largely integrated into Bosmer society and were eventually fully absorbed
			change_cultural_acceptance = {
				target = culture:mathmeldi
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# The Imga have lived in Valenwood alongside the Bosmer since forever
			change_cultural_acceptance = {
				target = culture:imga
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# +20
			# Bosmer, as distant cousins, have a somewhat decent relationship with Khajiit - when they aren't busy killing each other that is (looking at you, Arenthi)
			change_cultural_acceptance = {
				target = culture:pellitinian
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:anequinan
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:baandari
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:malapiit
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			# Wood Orcs also make their home in Valenwood, and sometimes trade with the Bosmer
			change_cultural_acceptance = {
				target = culture:wood_orc
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		# Salaboiche
		culture:altmeribosmer = {
			# +40
			# The Mathmeldi largely integrated into Bosmer society and were eventually fully absorbed
			change_cultural_acceptance = {
				target = culture:mathmeldi
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# The Imga have lived in Valenwood alongside the Bosmer since forever
			change_cultural_acceptance = {
				target = culture:imga
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# +20
			# Bosmer, as distant cousins, have a somewhat decent relationship with Khajiit - when they aren't busy killing each other that is (looking at you, Arenthi)
			change_cultural_acceptance = {
				target = culture:pellitinian
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:anequinan
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:baandari
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:malapiit
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			# Wood Orcs also make their home in Valenwood, and sometimes trade with the Bosmer
			change_cultural_acceptance = {
				target = culture:wood_orc
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		# Cyroboiche
		culture:cyrobosmer = {
			# +40
			# The Mathmeldi largely integrated into Bosmer society and were eventually fully absorbed
			change_cultural_acceptance = {
				target = culture:mathmeldi
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# The Imga have lived in Valenwood alongside the Bosmer since forever
			change_cultural_acceptance = {
				target = culture:imga
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# +20
			# Bosmer, as distant cousins, have a somewhat decent relationship with Khajiit - when they aren't busy killing each other that is (looking at you, Arenthi)
			change_cultural_acceptance = {
				target = culture:pellitinian
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:anequinan
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:baandari
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:malapiit
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			# Wood Orcs also make their home in Valenwood, and sometimes trade with the Bosmer
			change_cultural_acceptance = {
				target = culture:wood_orc
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		# Silvenari
		culture:silvenari = {
			# +40
			# The Mathmeldi largely integrated into Bosmer society and were eventually fully absorbed
			change_cultural_acceptance = {
				target = culture:mathmeldi
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# The Imga have lived in Valenwood alongside the Bosmer since forever
			change_cultural_acceptance = {
				target = culture:imga
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# +20
			# Bosmer, as distant cousins, have a somewhat decent relationship with Khajiit - when they aren't busy killing each other that is (looking at you, Arenthi)
			change_cultural_acceptance = {
				target = culture:pellitinian
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:anequinan
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:baandari
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:malapiit
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			# Wood Orcs also make their home in Valenwood, and sometimes trade with the Bosmer
			change_cultural_acceptance = {
				target = culture:wood_orc
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		# Etarani
		culture:etarani = {
			# +40
			# The Mathmeldi largely integrated into Bosmer society and were eventually fully absorbed
			change_cultural_acceptance = {
				target = culture:mathmeldi
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# The Imga have lived in Valenwood alongside the Bosmer since forever
			change_cultural_acceptance = {
				target = culture:imga
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# +20
			# Bosmer, as distant cousins, have a somewhat decent relationship with Khajiit - when they aren't busy killing each other that is (looking at you, Arenthi)
			change_cultural_acceptance = {
				target = culture:pellitinian
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:anequinan
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:baandari
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:malapiit
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			# Wood Orcs also make their home in Valenwood, and sometimes trade with the Bosmer
			change_cultural_acceptance = {
				target = culture:wood_orc
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		# Arenthi - these guys aren't very friendly with Khajiit
		culture:arenthi = {
			# +40
			# The Mathmeldi largely integrated into Bosmer society and were eventually fully absorbed
			change_cultural_acceptance = {
				target = culture:mathmeldi
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# The Imga have lived in Valenwood alongside the Bosmer since forever
			change_cultural_acceptance = {
				target = culture:imga
				value = 40
				desc = cultural_acceptance_historical_relations
			}
			# +20
			# Wood Orcs also make their home in Valenwood, and sometimes trade with the Bosmer
			change_cultural_acceptance = {
				target = culture:wood_orc
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		## Cantemirics
		culture:cantemiric = {
			# +20
			# While distant cousins now, the Cantemirics nurture some respect with the Dunmer - except those of Great House Dres who are rivals
			change_cultural_acceptance = {
				target = culture:gah_julan
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			# The Imga have lived in Valenwood alongside the Bosmer since forever
			change_cultural_acceptance = {
				target = culture:armun_an
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			# +20
			change_cultural_acceptance = {
				target = culture:chuzei
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:chi_addun
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:ashlander
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		## Orcs
		# Mountain Orc
		culture:mountain_orc = {
			# +20
			# Orcs get the Pariah baseline bonus with other goblinken, but let's give them a little more on top
			change_cultural_acceptance = {
				target = culture:goblin
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:riekling
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:riekr
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			# Mountain Orcs also have some dealings with the Reachfolk. one of the few peoples in TES who do not actively persecute them for being Pariah
			change_cultural_acceptance = {
				target = culture:reachfolk
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		# Iron Orc
		culture:iron_orc = {
			# +20
			# Orcs get the Pariah baseline bonus with other goblinken, but let's give them a little more on top
			change_cultural_acceptance = {
				target = culture:goblin
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:riekling
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:riekr
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		# Wood Orc
		culture:wood_orc = {
			# +20
			# Orcs get the Pariah baseline bonus with other goblinken, but let's give them a little more on top
			change_cultural_acceptance = {
				target = culture:goblin
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:riekling
				value = 20
				desc = cultural_acceptance_historical_relations
			}
			change_cultural_acceptance = {
				target = culture:riekr
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		### EK EDIT: The hell is an HRE?!
		# Custom ruler under the HRE should have lowered feudal obligations
		# if = {
			# limit = { exists = title:e_hre.holder }
			# title:e_hre.holder = {
				# every_vassal = {
					# limit = {
						# is_ai = no
						# 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
				# }
			# }
		# }

		#EK DISABLED: Vanilla historical characters. we could take a look at their events for our own narrative stuff tho
		#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
				if = {	#EK EDIT: Allows for exceptions where we don't want laamps to share CoA with their leader's house
					limit = {
						NOR = {
							has_title = title:d_dusksabers
							has_title = title:d_laamp_young_pilots
							has_title = title:d_laamp_south_argonia
							has_title = title:d_laamp_ayleid_chroniclers
							has_title = title:d_laamp_wayward_column
							has_title = title:d_laamp_battlelords
							has_title = title:d_laamp_elendarie
							has_title = title:d_blades_tenmar
							has_title = title:d_moonsingers
							has_title = title:d_laamp_ulver
							has_title = title:d_laamp_reachbreakers
						}
					}
					primary_title = { set_coa = scope:adventurer_scope.house }
				}	#EK EDIT END
				# 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
				# EK EDIT: if you're using RD to start as a dead culture, we trigger an equivalent to this event later
				if = {
					limit = {
						culture = {
							culture_is_alive = yes
						}
					}
					trigger_event = ep3_laamps.1001
				}
			}
			#EK NOTE: kept Hereweard as example
			# Starting camp purposes.
			## Hereweard the Wake
			#character:90028 ?= {
			#if = {
			#	limit = { is_alive = yes }
			#		add_realm_law_skip_effects = camp_purpose_brigands
			#	}
			# Setup event for his story
			#	trigger_event = {
			#		id = ep3_laamps.5999
			#		days = { 1 2 }
			#	}
			#}
			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
								}
							}
						}
					}
				}
			}
		}
		#EK DISABLED
		### 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
				}
			}
			#Tai Migrations
			#EK DISABLED
			#every_county_in_region = { # save all migration counties to variable list
			#	region = custom_tai_migration_target
			#	add_to_global_variable_list = {
			#		name = tai_migration_target_counties
			#		target = this
			#	}
			#}
			#every_in_global_list = { # give all saved migration county holders the story
			#	variable = tai_migration_target_counties
			#	holder = {
			#		if = {
			#			limit = {
			#				NOT = {
			#					any_owned_story = {
			#						type = story_tai_migrations
			#					}
			#				}
			#				has_tgp_dlc_trigger = yes
			#				any_realm_province = {
			#					culture = {
			#						NOT = {
			#							has_cultural_pillar = heritage_tai
			#						}
			#					}
			#				}
			#			}
			#			create_story = story_tai_migrations
			#		}
			#	}
			#}
		}
		### 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
		#				}
		#			}
		#		}	
		#	}
		#}
		#EK DISABLED
		# 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
		#	}
		#}
		#EK DISABLED
		#EK EDIT: changed Sahara into Alikr
		# Saharan stuff.
		every_county_in_region = {
			region = mundus_tamriel_hammerfell_alikr_desert
			# 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 }
		}
		#EK TODO: plug in our values appropriate for our bookmarks
		# 440/450 Buildings
		if = {
			limit = {
				game_start_date >= 3360.1.1 #EK EDIT - was 1066
				game_start_date < 3371.10.1 #EK EDIT - was 1178
			}
			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
					}
					#EK EDIT
					#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
					}
				}
			}
		}
		# Post-450 Buildings
		else_if = {
			limit = {
				game_start_date >= 3371.10.1 #EK TODO: change to something else when we get more bookmarks
			}
			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
						}
						#EK EDIT
						#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 }
			}
		}
			
			# EK EDIT: cut vanilla conquerors
			
		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
		#EK DISABLED: irl titles. Can be reusde for our titles later
		#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 = {
		#EK ADDITION
		ek_holy_orders.1
		ek_holy_orders.2
		ek_holy_orders.3
		#EK ADDITION END
		# 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$
#			}
#		}

