﻿##########################################################More Bookmarks Game Start Effects##########################################################

#The effects in this file set up much of the map for various bookmarks

on_game_start = {

	on_actions = {
		MB_on_game_start							# Overall game start effect
		on_game_start_MB							# Setup the mods global variable MBP_is_loaded

		MB_struggle_setup							# Setup struggle phases/cultures/religions
		MB_culture_traditions						# Setup culture traditions
		MB_culture_innovations						# Setup culture innovations
		MB_religion_setup							# Setup faiths for characters/counties by script
		MB_holy_site_fix							# Setup church holdings in holy sites
		MB_succexpstart								# Setup succession laws that aren't otherwise properly setup
		MB_add_syncretic_doctrines					# Setup syncretic doctrines for various faiths
		MB_set_ablution_doctrines					# Setup ablution doctrine for various faiths that ME does not
		MB_set_clan_unity							# Setup clan unity
		MB_set_landless_adventurers					# Setup adventurers
		MB_set_regencies							# Setup regencies/viziers/co-emperors
		MB_set_government							# Setup governments by script
		MB_set_de_jure								# Setup de_jure changes by script
		MB_set_buildings							# Setup special buildings and add building slots
		lutici_rename_effect_setup					# Re-named Lutici after set date
	}		
			
	events = {		
		shogunate_alliance.0001						# Setup Alliances on game start for marriages as these are otherwise not set in the base game
		shogunate_startup.0001						# Setup Living Characters
		# CEIintro.0001								# CE innovation setup for new cultures in this mod
	}
	
}

#Moved to game_start but the on_actions are in this file
#on_game_start_after_lobby = {
#    on_actions = {
#		MB_culture_setup							# Setup cultures for characters/counties, culture languages and cultural acceptance by script
#       MB_set_court_languages						# Setup court languages for Kingdoms/Empires
#		MB_set_catholic_doctrines					# Removes unavailable_doctrine at historical dates for historical faiths
#		MB_contracts								# Setup contracts for themata, marches, palatinates, and other contracts like levies, taxes, and title revocation
#		MB_set_noble_families						# Setup for admin government noble families
#		MB_set_legitimacy							# Setup legitimacy and splendor
#		KOH_holy_orders								# Setup the mods scripted Holy Orders
#
#		#set_global_variablesMB
#		#on_yearly_assign_culture_faith				# In MB_on_actions - Related to RoA minority system
#
#		MB_setup_after_game_start_on_actions
#
#    }
#
#}

on_title_gain = {

	on_actions = {
		asdac_on_title_gain							# Setup nickname for Black Prince and makes sure holy order members get their trait
		on_gain_holy_order							# Setup the Order Member Trait
		sea_title_event.5000						# Choose a new dynastic name for China (REMOVE AUH)
		usurp_nanzhao_action
		establish_dali_action
	}
	
}

on_birth_child = {

	on_actions = {
		asdac_on_birth_child
	}
	
}

on_birth_mother = {

	events = {
		shogunate_birth.0001 						# Name a child using the letter unique to each clan (Tori-ji system) (Shogunate)
	}
	
}

yearly_global_pulse = {

	on_actions = {
		on_persia_struggle_821						# Setup Persia struggle in 821
		MB_languages_monthly

		delay = { days = { 30 330 } }
		start_nanzhao_collapse
	}
	
}

MB_on_game_start = {

	effect = {
		
	########################################################################################### BOOKMARK SETUP ###########################################################################################
		
		#To fix a Paradox bug
		
		add_to_global_variable_list = {
                name = laamps_tally
                target = title:dummy_title
            }
			
			
		#Murder characters that shouldn't exist
		
		#ZGC - removed from MB+
		# every_living_character = {
		# 	limit = {
		# 		age > 100
		# 	}
		# 	death = {
		# 		death_reason = death_natural_causes
		# 	}
		# }	
		
	########################################################################################### CRUSADES SETUP ###########################################################################################
		
		if = {
			limit = {
				game_start_date > 1095.11.27
			}
			religion:christianity_religion = {
				every_faith = {
					religion = {
						set_variable = {
							name = variable_ghw_unlocked # Crusades
							value = yes
						}
					}
				}
			}
			religion:islam_religion = {
				every_faith = {
					religion = {
						set_variable = {
							name = variable_ghw_unlocked # Crusades
							value = yes
						}
					}
				}
			}
			set_global_variable = {
				name = had_first_catholic_crusade
				value = yes
			}
		}
		

	########################################################################################### 1000 SETUP ###########################################################################################
	
		if = {
			limit = { game_start_date < 1000.1.1 }
			title:k_italy = { set_capital_county = title:c_pavia }
			title:k_italy.holder = { set_realm_capital = title:c_pavia }
		}
		
		
	########################################################################################### 1067 SETUP ###########################################################################################
		
		if = {
			limit = { game_start_date > 1067.1.1 }
			title:k_sakya_trizin.holder = { add_realm_law_skip_effects = male_preference_law }
		}
		
	
	########################################################################################### 1187 SETUP ###########################################################################################
	
		if = {
			limit = {
				game_start_date = 1187.8.31
			}
			character:230000 = { set_realm_capital = title:c_gurganj }
			character:204500 = {
				if = {
					limit = {
						is_alive = yes
						is_playable_character = yes
					}
				}
				house = {
					add_house_modifier = {
						modifier = ireland_laudabiliter_modifier
						days = 25101
					}
				}
			}
			faith:catholic = {
				change_fervor = {
					value = 24
					desc = cultural_acceptance_historical_relations#test_interaction_fervor_gain
				}
			}
			faith:ashari = {
				change_fervor = {
					value = 25
					desc = cultural_acceptance_historical_relations#test_interaction_fervor_gain
				}
			}
			faith:masmudi = {
				change_fervor = {
					value = 25
					desc = cultural_acceptance_historical_relations#test_interaction_fervor_gain
				}
			}
			faith:slavic_pagan = {
				change_fervor = {
					value = -30
					desc = cultural_acceptance_historical_relations#test_interaction_fervor_gain
				}
			}
			
			character:226000 = { #Saladin
			if = {
				limit = {
					is_alive = yes
					is_playable_character = yes
				}
				trigger_event = {
					id = asdac_bookmark.1101
					days = 71
					}
				}
			}
		
		}
	
		
		
	########################################################################################### 1204 SETUP ###########################################################################################
		
		if = {
			limit = {
				game_start_date = 1204.5.16
			}
			character:93052 = { set_realm_capital = title:c_gurganj }
			faith:orthodox = {
				change_fervor = {
					value = 25
					desc = cultural_acceptance_historical_relations#test_interaction_fervor_gain
				}
			}
			faith:ashari = {
				change_fervor = {
					value = 25
					desc = cultural_acceptance_historical_relations#test_interaction_fervor_gain
				}
			}
			faith:masmudi = {
				change_fervor = {
					value = 25
					desc = cultural_acceptance_historical_relations#test_interaction_fervor_gain
				}
			}
			faith:slavic_pagan = {
				change_fervor = {
					value = -30
					desc = cultural_acceptance_historical_relations#test_interaction_fervor_gain
				}
			}
			character:204514 = {
				if = {
					limit = {
						is_alive = yes
						is_playable_character = yes
					}
				}
				house = {
					add_house_modifier = {
						modifier = ireland_laudabiliter_modifier
						days = 18761
					}
				}
			}
		}
	
	########################################################################################### 1235 SETUP ###########################################################################################
		
		if = {
			limit = {
				game_start_date > 1235.1.1
			}
			faith:bosnian_church = { remove_doctrine = special_doctrine_ecumenical_christian }
		}
		
	########################################################################################### 1337 SETUP ###########################################################################################
		
		if = {
			limit = {
				game_start_date >= 1337.1.1
			}
			title:d_ryazan.holder = { set_realm_capital = title:c_ryazan }
			title:e_golden_horde.holder = { set_realm_capital = title:c_itil }
			faith:slavic_pagan = {
				change_fervor = {
					value = -30
					desc = cultural_acceptance_historical_relations#test_interaction_fervor_gain
				}
			}
			character:170258 = {
				set_realm_capital = title:c_delhi
			}
			title:d_opsikion = { set_capital_county = title:c_prusa } #Nicaea was irrelevant during the Ottoman period
			title:d_opsikion.holder = { set_realm_capital = title:c_prusa }
			title:c_nikaea = { set_color_from_title = title:c_nikaea }
						
			title:d_charsianon.holder = { set_realm_capital = title:c_kaisereia }

		}
		
		if = {
			limit = { game_start_date >= 1337.1.1 }
			if = {
				limit = {
					OR = {
						has_game_rule = matrilineal_marriages_never
						AND = {
							has_game_rule = matrilineal_marriages_female_and_equal
							has_game_rule = default_gender_equality
						}
					}
				}
				character:461703 = {
					create_betrothal = character:469513
				}
			} 
			else = {
				character:461703 = {
					create_betrothal_matrilineal = character:469513
				}
			}
		}
		
		if = {
			limit = {
				exists = title:k_italy.holder
				has_dlc_feature = royal_court
			}
			title:k_italy.holder = {
				create_artifact_pedestal_crown_iron_effect = { OWNER = title:k_italy.holder }
			}
		}
	}
}

##################################################################################

on_game_start_MB = {

    effect = {
			set_global_variable = {
			name = MBP_is_loaded
			value = yes
		}
    }
	
}

MB_struggle_setup = {

	effect = {
	
		#IBERIAN STRUGGLE 
		
		if = {
			limit = {
				has_fp2_dlc_trigger = yes
			}
			start_struggle = { struggle_type = iberian_struggle start_phase = struggle_iberia_phase_opportunity }
		}
		if = {
			limit = {
				game_start_date >= 1098.1.1
				game_start_date < 1234.1.1
				has_fp2_dlc_trigger = yes
			}
			struggle:iberian_struggle = {
				change_struggle_phase = struggle_iberia_phase_hostility # Change to hostility. The Almoravids were not as tolerant of Christians and did invade the Peninsula several times. They collapsed in the late 1140's and were replaced with the Almohads who actually reversed part of the reconquista for a short time. They suffered a decisive defeat in 1212 which marked the end of any further Islamic conquests in Iberia
				set_faith_as_involved = faith:masmudi
			}
		}
		if = {
			limit = {
				game_start_date >= 1235.1.1
				game_start_date < 1266.1.1
				has_fp2_dlc_trigger = yes
			}
			struggle:iberian_struggle = {
				change_struggle_phase = struggle_iberia_phase_compromise # Change to compromise phase. Almohads no longer control any of al-Andalus
				set_culture_as_involved = culture:french
			}
		}
		
		if = {
			limit = {
				game_start_date >= 1267.1.1
				has_fp2_dlc_trigger = yes
			}
			struggle:iberian_struggle = {
				change_struggle_phase = struggle_iberia_phase_conciliation # Change to final phase which is conciliation. Marked by the only remaining Emirate, the Emirate of Granada, being a tributary of Castile. This would be how things would continue till it was finally conquered in 1492
			}
		}
	
		#GREENLAND STRUGGLE - RICE
		
		if = {
			limit = {
				has_global_variable = is_RICE_loaded_global_variable
				RICE_setup_north_atlantic_flavor_pack_effect = yes
			}
			struggle:RICE_greenland_struggle = {
				set_culture_as_involved = culture:anglo_norse
				set_culture_as_involved = culture:northerner
			}
		}
		
		#SICILY STRUGGLE - RICE4
		
		if = {
			limit = {
				has_global_variable = is_RICE_loaded_global_variable
				RICE_setup_sicily_flavor_pack_effect = yes
			}
			struggle:RICE_sicily_struggle = {
				set_culture_as_involved = culture:neapolitan
				set_culture_as_involved = culture:maltese
				set_culture_as_involved = culture:tuscan_ce
				set_culture_as_involved = culture:dalmatian_ce
				set_culture_as_involved = culture:aragonese
				set_culture_as_involved = culture:venetian_ce
				set_culture_as_involved = culture:arpitan
				set_culture_as_involved = culture:masmuda
				set_culture_as_involved = culture:zanata
				set_culture_as_involved = culture:tagelmust
				set_culture_as_involved = culture:piedmontese
				set_culture_as_involved = culture:romagnol
				set_culture_as_involved = culture:romansh
				set_culture_as_involved = culture:corsican
				set_culture_as_involved = culture:friulian
				set_culture_as_involved = culture:emilian
				set_culture_as_involved = culture:libyan
				
				#I'm not concerned about adding all the new Christian faiths here just like how RICE didn't add all the vanilla ones either but will add the religions that are 'nearby' at various dates
				set_faith_as_involved = faith:african_church
				set_faith_as_involved = faith:ambrosian
				set_faith_as_involved = faith:aquileian_church
				set_faith_as_involved = faith:bohemian_catholic
				set_faith_as_involved = faith:bosnian_church
				set_faith_as_involved = faith:mozarabic_church
				set_faith_as_involved = faith:cathar
				set_faith_as_involved = faith:bulgarian_orthodox
				set_faith_as_involved = faith:cyprus_orthodox
				set_faith_as_involved = faith:serbian_orthodox
				set_faith_as_involved = faith:iconoclast
				set_faith_as_involved = faith:coptic
				set_faith_as_involved = faith:bogomilist
				set_faith_as_involved = faith:waldensian
				
				set_faith_as_involved = faith:african_folk_islam
				set_faith_as_involved = faith:kutama_pagan
				set_faith_as_involved = faith:ghomara_pagan
				set_faith_as_involved = faith:masmudi
				
				
			}
		}
	}
	
}

MB_culture_traditions = {

	effect = {
		
		if = {
			limit = { game_start_date >= 400.1.1 }
			#add isolationist to cultures that generally didn't marry far and wide
			#culture:pictish = { remove_culture_tradition = tradition_isolationist }
			#culture:welsh = { remove_culture_tradition = tradition_isolationist }
			#culture:cornish = { remove_culture_tradition = tradition_isolationist }
			#culture:dumnonian = { remove_culture_tradition = tradition_isolationist }
			culture:cumbrian = { add_culture_tradition = tradition_isolationist }
			culture:irish = { add_culture_tradition = tradition_isolationist }
			culture:gaelic = { add_culture_tradition = tradition_isolationist }
			culture:arberian = { add_culture_tradition = tradition_isolationist }
		}
		if = {
			limit = { game_start_date > 1080.1.1 }
			culture:greek = { add_culture_tradition = tradition_zealous_people }
			culture:castilian = { add_culture_tradition = tradition_toledo_steel }
			culture:asturleonese = { add_culture_tradition = tradition_toledo_steel }
		}
		if = {
			limit = { game_start_date >= 1100.1.1 }
			#Mainly just to make the major cultures that don't have 4 traditions have the 4 by the later bookmarks. This is an area that's always seemed imbalanced with there being cultures with 3 traditions and then others with 5. 
			culture:irish = { remove_culture_tradition = tradition_polygamous }
			culture:gaelic = { remove_culture_tradition = tradition_concubines }
			culture:welsh = { remove_culture_tradition = tradition_concubines }
			culture:cumbrian = { remove_culture_tradition = tradition_concubines }
			
			culture:occitan = { remove_culture_tradition = tradition_poetry }
			culture:russian = { add_culture_tradition = tradition_pravda_russkaya }
			culture:novgorodian = { add_culture_tradition = tradition_hereditary_hierarchy }
			culture:hungarian = { add_culture_tradition = tradition_ruling_caste }
			culture:bavarian = { add_culture_tradition = tradition_welcoming }
			culture:swabian = { add_culture_tradition = tradition_swords_for_hire }
			culture:franconian = { add_culture_tradition = tradition_loyal_soldiers }
			culture:saxon = { add_culture_tradition = tradition_fervent_temple_builders }
			culture:polish = { add_culture_tradition = tradition_stalwart_defenders }
			culture:masmuda = { add_culture_tradition = tradition_zealous_people }
			culture:tumed = { add_culture_tradition = tradition_dryland_dwellers }
		}
		if = {
			limit = { game_start_date >= 1250.1.1 }
			culture:catalan = { add_culture_tradition = tradition_almogavars }
			culture:aragonese = { add_culture_tradition = tradition_almogavars }
		}

		culture:severian = { add_culture_tradition = tradition_agrarian }
		culture:severian = { add_culture_tradition = tradition_polygamous }
		
		culture:daylamite = {
			remove_culture_tradition = tradition_isolationist
			add_culture_tradition = tradition_tabari_isolation
		}
		
		culture:mazandarani = {
			remove_culture_tradition = tradition_isolationist
			add_culture_tradition = tradition_tabari_isolation
		}
		culture:gilani = {
			remove_culture_tradition = tradition_isolationist
			add_culture_tradition = tradition_tabari_isolation
		}
	}
	
}

MB_culture_innovations = {

	effect = {
	
		#Innovations - Mainly diverged cultures that you don't want to use a Heritage tag for ie:heritage_iberian not covering an andalusian derived iqritis 
		#A lot of this is just to clean up the /history/cultures folder from having so many files that all have the same exact thing and in turn meaning I need to edit less files
		
		
		# Scopes
		culture:andalusian = { save_scope_as = andalusian }
		culture:croatian = { save_scope_as = croatian }
		culture:occitan = { save_scope_as = occitan }
		culture:french = { save_scope_as = french }
		culture:anglo_saxon = { save_scope_as = anglo_saxon }
		culture:polish = { save_scope_as = polish }
		culture:saxon = { save_scope_as = saxon }
		culture:bengali = { save_scope_as = bengali }
		culture:senufo = { save_scope_as = senufo }
		culture:polabian = { save_scope_as = polabian }
		culture:egyptian = { save_scope_as = egyptian }
		culture:vepsian = { save_scope_as = vepsian }
		culture:daylamite = { save_scope_as = daylamite }
		culture:bjarmian = { save_scope_as = bjarmian }
		culture:norwegian = { save_scope_as = norwegian }
		culture:sicilian = { save_scope_as = sicilian }
		culture:welsh = { save_scope_as = welsh }
		culture:english = { save_scope_as = english }
		culture:danish = { save_scope_as = danish }
		culture:franconian = { save_scope_as = franconian }
		culture:dutch = { save_scope_as = dutch }
		culture:swabian = { save_scope_as = swabian }
		culture:cisalpine = { save_scope_as = cisalpine }
		culture:italian = { save_scope_as = italian }
		culture:russian = { save_scope_as = russian }
		culture:aramean = { save_scope_as = aramean }

		#BAP
		culture:akan = { save_scope_as = akan }
		culture:gaw = { save_scope_as = gaw }
		culture:ethiopian = { save_scope_as = ethiopian }
		culture:sidama = { save_scope_as = sidama }
		culture:daju = { save_scope_as = daju }
		
		culture:baranis = { save_scope_as = baranis }
		culture:wolof = { save_scope_as = wolof }	
		culture:gur = { save_scope_as = gur }
		
		culture:mandaic = {
			get_all_innovations_from = scope:aramean
		}
		
		culture:iqritis = {
			get_all_innovations_from = scope:andalusian
		}
		culture:slavonian = {
			get_all_innovations_from = scope:croatian
		}
		culture:arpitan = {
			get_all_innovations_from = scope:occitan
		}
		culture:provencal = {
			get_all_innovations_from = scope:occitan
		}
		culture:gascon = {
			get_all_innovations_from = scope:occitan
		}
		culture:angevin = {
			get_all_innovations_from = scope:french
		}
		culture:burgundian_oil = {
			get_all_innovations_from = scope:french
		}
		culture:poitevin = {
			get_all_innovations_from = scope:french
		}
		culture:picard = {
			get_all_innovations_from = scope:french
		}
		culture:walloon = {
			get_all_innovations_from = scope:french
		}
		culture:lorrainian = {
			get_all_innovations_from = scope:french
		}
		culture:anglo_norse = {
			get_all_innovations_from = scope:anglo_saxon
		}
		culture:kentish = {
			get_all_innovations_from = scope:anglo_saxon
		}
		culture:mercian = {
			get_all_innovations_from = scope:anglo_saxon
		}
		culture:northumbrian = {
			get_all_innovations_from = scope:anglo_saxon
		}
		culture:east_anglian = {
			get_all_innovations_from = scope:anglo_saxon
		}
		culture:west_saxon = {
			get_all_innovations_from = scope:anglo_saxon
		}
		culture:masovian = {
			get_all_innovations_from = scope:polish
		}
		culture:polans = {
			get_all_innovations_from = scope:polish
		}
		culture:opolan = {
			get_all_innovations_from = scope:polish
		}
		culture:vistulan = {
			get_all_innovations_from = scope:polish
		}
		culture:silesian = {
			get_all_innovations_from = scope:polish
		}
		culture:golensizi = {
			get_all_innovations_from = scope:polish
		}
		culture:lendian = {
			get_all_innovations_from = scope:polish
		}
		culture:dravehnian = {
			get_all_innovations_from = scope:polish
		}
		culture:old_saxon = {
			get_all_innovations_from = scope:saxon
		}
		culture:east_elbian = {
			get_all_innovations_from = scope:saxon
		}
		culture:westphalian = {
			get_all_innovations_from = scope:saxon
		}
		culture:assamese = {
			get_all_innovations_from = scope:bengali
		}
		culture:lutici = {
			get_all_innovations_from = scope:polabian
		}
		culture:sorbian = {
			get_all_innovations_from = scope:polabian
		}
		culture:obotrite = {
			get_all_innovations_from = scope:polabian
		}
		culture:egyptian_coptic = {
			get_all_innovations_from = scope:egyptian
		}
		culture:sami = {
			get_all_innovations_from = scope:vepsian
		}
		culture:gilani = {
			get_all_innovations_from = scope:daylamite
		}
		culture:karelian = {
			get_all_innovations_from = scope:bjarmian
		}
		culture:norse = {
			get_all_innovations_from = scope:norwegian
		}
		culture:neapolitan = {
			get_all_innovations_from = scope:sicilian
		}
		culture:breton = {
			get_all_innovations_from = scope:welsh
		}
		culture:cornish = {
			get_all_innovations_from = scope:welsh
		}
		culture:northerner = {
			get_all_innovations_from = scope:english
		}
		culture:scanian = {
			get_all_innovations_from = scope:danish
		}
		culture:flemish = {
			get_all_innovations_from = scope:dutch
		}
		culture:frisian = {
			get_all_innovations_from = scope:dutch
		}
		culture:brabantian = {
			get_all_innovations_from = scope:franconian
		}
		culture:thuringian = {
			get_all_innovations_from = scope:franconian
		}
		culture:high_alemannic = {
			get_all_innovations_from = scope:swabian
		}
		culture:alsatian = {
			get_all_innovations_from = scope:swabian
		}
		culture:emilian = {
			get_all_innovations_from = scope:cisalpine
		}
		culture:romagnol = {
			get_all_innovations_from = scope:cisalpine
		}
		culture:venetian_ce = {
			get_all_innovations_from = scope:cisalpine
		}
		culture:ligurian = {
			get_all_innovations_from = scope:italian
		}
		culture:tuscan_ce = {
			get_all_innovations_from = scope:italian
		}
		culture:romagnol = {
			get_all_innovations_from = scope:italian
		}
		culture:belocroat = {
			get_all_innovations_from = scope:russian
		}

		###BAP Stuff###
		
		##Cultural innovation inheritance
		
		# Innovations
		culture:argobba = {
			get_all_innovations_from = scope:ethiopian
		}
		culture:agaw = {
			get_all_innovations_from = scope:ethiopian
		}
		culture:tigray = {
			get_all_innovations_from = scope:ethiopian
		}
		culture:harla = {
			get_all_innovations_from = scope:ethiopian
		}
		culture:oromo = {
			get_all_innovations_from = scope:sidama
		}
		culture:maban = {
			get_all_innovations_from = scope:daju
		}
		culture:fur = {
			get_all_innovations_from = scope:daju
		}
		culture:nuba = {
			get_all_innovations_from = scope:daju
		}
		culture:dinka = {
			get_all_innovations_from = scope:daju
		}
		culture:kwama = {
			get_all_innovations_from = scope:daju
		}
		culture:berta = {
			get_all_innovations_from = scope:daju
		}	
		culture:african_roman = {
			get_all_innovations_from = scope:baranis
		}
		culture:haratin = {
			get_all_innovations_from = scope:wolof
		}
		culture:zarma = {
			get_all_innovations_from = scope:gur
		}
		culture:konkomba = {
			get_all_innovations_from = scope:gur
		}
		culture:kurumba = {
			get_all_innovations_from = scope:gur
		}
		culture:senufo = {
			get_all_innovations_from = scope:gur
		}
		culture:kulango = {
			get_all_innovations_from = scope:gur
		}
		
		##Cultural innovation inheritance

		
		# Innovations
		culture:marka = {
			get_all_innovations_from = scope:akan
		}
		culture:gur = {
			get_all_innovations_from = scope:akan
		}
		culture:tuareg = {
			get_all_innovations_from = scope:gaw
		}
		
		
		# RICE innovations and traditions when RICE is loaded. Traditions here just since I don't want to break up RICE stuff
		
		if = {
			limit = {
				has_global_variable = is_RICE_loaded_global_variable
			}
			
			culture:syriac = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:iraqi = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:madan = {
				add_innovation = innovation_RICE_qanats		
			}
			
			culture:luri = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:aschomi = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:semnani = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:mazandarani = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:hazara = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:turkmeni = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:qufs = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:brahui = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:khalaj = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:pamiri = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:nuristani = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:bahraini = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:omani = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:south_arabian = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:hadhrami = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:hejazi = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:saidi = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:libyan = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:masmuda = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:maltese = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:chagatai = {
				add_innovation = innovation_RICE_qanats		
			}
			culture:talysh = {
				add_innovation = innovation_RICE_qanats		
			}
			
			culture:afghan = {
				add_innovation = innovation_RICE_irrigation_tanks		
			}
			culture:kachari = {
				add_innovation = innovation_RICE_irrigation_tanks		
			}
			culture:tripuri = {
				add_innovation = innovation_RICE_irrigation_tanks		
			}
			culture:ahom = {
				add_innovation = innovation_RICE_irrigation_tanks		
			}
			culture:kochinim = {
				add_innovation = innovation_RICE_irrigation_tanks		
			}
			culture:hindustani_proper = {
				add_innovation = innovation_RICE_irrigation_tanks		
			}
			
			culture:komi = {
				add_innovation = innovation_RICE_dog_sleds		
			}
			culture:udmurt = {
				add_innovation = innovation_RICE_dog_sleds		
			}
			culture:gilyak = {
				add_innovation = innovation_RICE_dog_sleds		
			}
			
			culture:kannada = {
				add_innovation = innovation_RICE_velakkara_guards		
			}
			culture:malayali = {
				add_innovation = innovation_RICE_velakkara_guards		
			}
			culture:kochinim = {
				add_innovation = innovation_RICE_velakkara_guards		
			}
			
			culture:gallo_f = { add_culture_tradition = bao_tradition_breizh_collective_lands }	
			
			culture:egyptian_coptic = { add_culture_tradition = tradition_RICE_children_of_the_nile }				
			culture:saidi = { add_culture_tradition = tradition_RICE_children_of_the_nile }		

			culture:obotrite = {
				add_culture_tradition = tradition_RICE_wendish_confederations
				remove_variable = tradition_cooldown
			}
			culture:dravehnian = {
				add_culture_tradition = tradition_RICE_wendish_confederations
				remove_variable = tradition_cooldown
			}
			culture:ranian = {
				add_culture_tradition = tradition_RICE_wendish_confederations
				remove_variable = tradition_cooldown
			}
			culture:lutici = {
				add_culture_tradition = tradition_RICE_wendish_confederations
				remove_variable = tradition_cooldown
			}			
			
		
		}
	}
	
}

MB_culture_setup = {

	effect = {
		
		########################################################################################### CULTURE NAMES ###########################################################################################
		
		if = {
			limit = {
				game_start_date > 1065.1.1
			}
			# Culture Name Changes
			culture:nitravan = {
				set_culture_name = {
					noun = "slovak"
					collective_noun = "slovak_collective_noun"
					prefix = "slovak_prefix"
				}
			}
			culture:slovien = {
				set_culture_name = {
					noun = "moravian_noun"
					collective_noun = "moravian_c_noun"
					prefix = "moravian_prefix"
				}
			}
			culture:slavonian = {
				set_culture_name = {
					noun = "n_slavonian_noun"
					collective_noun = "n_slavonian_collective_noun"
					prefix = "n_slavonian_prefix"
				}
			}
			culture:carantanian = {
				set_culture_name = {
					noun = "slovene"
					collective_noun = "slovene_collective_noun"
					prefix = "slovene_prefix"
				}
			}
		}

		if = {
			limit = {
				game_start_date < 1206.1.1
			}
			# Culture Name Changes
			culture:mongol = {
				set_culture_name = {
					noun = "khamag"
					collective_noun = "khamag_collective_noun"
					prefix = "khamag_prefix"
				}
			}
		}
	
		########################################################################################### CULTURE LANGUAGES/NAMELISTS ###########################################################################################
		
		culture:old_saxon = {
			set_heritage_from = culture:saxon
			set_language_from = culture:saxon
		}
		culture:ilmenian = {
			set_name_list = name_list_old_east_slavic
		}
		culture:severian = {
			set_name_list = name_list_old_east_slavic
		}
		culture:volhynian = {
			set_name_list = name_list_old_east_slavic
		}
		
		if = {
			limit = {
				game_start_date >= 990.1.1
			}
		
			culture:catalan = {
				set_culture_pillar = language_catalan
			}
		}
		
		if = {
			limit = {
				game_start_date >= 1005.1.1
			}
		
			culture:geat = {
				set_name_list = name_list_geatish 
			}
		}
		
		if = {
			limit = {
				game_start_date >= 1050.1.1
			}
		
			culture:argobba = {
				set_culture_pillar = language_argobba
			}
		}

		if = {
			limit = {
				game_start_date >= 1150.1.1
			}
		
			culture:english = {
				set_culture_pillar = language_middle_english
			}
			culture:scottish = {
				set_culture_pillar = language_scots
			}
			culture:anglo_norse = {
				set_culture_pillar = language_northern_english
			}
			culture:hindustani = {
				set_culture_pillar = language_old_hindi
			}
			culture:tigray = {
				set_culture_pillar = language_tigray
			}
			culture:ethiopian = {
				set_culture_pillar = language_amharic
			}
			culture:swedish = {
				set_culture_pillar = language_old_swedish
			}
			culture:geat = {
				set_culture_pillar = language_old_swedish
			}
			culture:scanian = {
				set_culture_pillar = language_old_danish
			}
			culture:danish = {
				set_culture_pillar = language_old_danish
			}
			culture:norwegian = {
				set_culture_pillar = language_old_norwegian
			}
			culture:icelandic = {
				set_culture_pillar = language_old_icelandic
			}
			culture:jamts = {
				set_culture_pillar = language_jamt
			}
		}
		
		if = {
			limit = {
				game_start_date >= 1250.1.1
			}
		
			culture:chutia = {
				set_culture_pillar = language_assamese
			}
		}
		
		if = {
			limit = {
				game_start_date >= 1300.1.1
			}
		
			culture:azeri = {
				set_culture_pillar = language_azeri_turk
			}
		}
		
		########################################################################################### CULTURAL ACCEPTANCE ###########################################################################################
		
		if = {
			limit = {
				game_start_date > 760.1.1
			}
			#Mainly cultural acceptance for empires/kingdoms that had multiple unrelated cultures or where cultures are broken up and need an extra push along with CCU
			setup_german_friendship = yes
			setup_italian_friendship = yes
			setup_polish_friendship = yes
			setup_french_friendship = yes
			setup_greek_friendship = yes
			setup_anglo_saxons_friendship = yes
			setup_mongol_friendship = yes
			setup_lithuania_friendship = yes
		}
		
		if = {
			limit = {
				game_start_date > 936.1.1
			}
			#Mainly cultural acceptance for empires/kingdoms that had multiple unrelated cultures or where cultures are broken up and need an extra push along with CCU
			setup_cumania_friendship = yes
			setup_hungary_friendship = yes
			setup_perso_turks_friendship = yes
		}
		
		
		culture:egyptian_coptic = {
			change_cultural_acceptance = {
				target = culture:egyptian
				value = 20
				desc = cultural_acceptance_historical_relations
			}
		}
		culture:hindustani_proper = {
			change_cultural_acceptance = {
				target = culture:hindustani
				value = 50
				desc = cultural_acceptance_historical_relations
			}
		}
		culture:gothic = {
			change_cultural_acceptance = {
				target = culture:greek
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		culture:russian = {
			change_cultural_acceptance = {
				target = culture:belocroat
				value = 50
				desc = cultural_acceptance_historical_relations
			}
		}
		culture:tajik = {
			change_cultural_acceptance = {
				target = culture:persian
				value = 70
				desc = cultural_acceptance_historical_relations
			}
		}
		culture:baloch = {
			change_cultural_acceptance = {
				target = culture:sindhi
				value = 10
				desc = cultural_acceptance_historical_relations
			}
		}
		culture:arberian = {
			change_cultural_acceptance = {
				target = culture:serbian
				value = 15
				desc = cultural_acceptance_historical_relations
			}
		}
		culture:gothic = {
			change_cultural_acceptance = {
				target = culture:greek
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		culture:chagatai = {
			change_cultural_acceptance = {
				target = culture:mongol
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		culture:mongol = {
			change_cultural_acceptance = {
				target = culture:chagatai
				value = 30
				desc = cultural_acceptance_historical_relations
			}
		}
		if = {
			limit = {
				game_start_date > 1140.1.1
			}
			culture:han = {
				change_cultural_acceptance = {
					target = culture:jurchen
					value = 20
					desc = cultural_acceptance_historical_relations
				}
			}
			culture:jurchen = {
				change_cultural_acceptance = {
					target = culture:han
					value = 20
					desc = cultural_acceptance_historical_relations
				}
			}
		}	
		
		if = {
			limit = {
				game_start_date = 1337.1.1
			}
			culture:dalmatian_ce = {
				change_cultural_acceptance = {
					target = culture:croatian
					value = 20
					desc = cultural_acceptance_historical_relations
				}
			}
			culture:arberian = {
				change_cultural_acceptance = {
					target = culture:sicilian
					value = 15
					desc = cultural_acceptance_historical_relations
				}
			}
		}
		
		########################################################################################### CULTURE/CHARACTER LANGUAGES ###########################################################################################
		
		## Coptic for Coptic priests
		every_living_character = { 
			limit = { 
				OR = {
					is_clergy = yes
					learning >= 20
				}
				OR = {
					has_faith = faith:ethiopian_orthodox
					has_faith = faith:nubian_orthodox
					has_faith = faith:coptic
				}
				NOT = { 
					knows_language = language_coptic
				}
			} 
			learn_language = language_coptic
		}
		
		#Doctrine changes for Coptic
		faith:coptic = {
			if = {
				limit = { has_doctrine = doctrine_consanguinity_aunt_nephew_and_uncle_niece }
				remove_doctrine = doctrine_consanguinity_aunt_nephew_and_uncle_niece
				add_doctrine = doctrine_consanguinity_restricted
			}
		}
		
		## Greek for highly educated nubians likely to or potential to serve in the church or bureaucracy
		every_living_character = { 
			limit = { 
				OR = {
					learning >= 20
					has_trait = scholar
					has_trait = theologian
					has_trait = education_intrigue_4
					has_trait = education_diplomacy_4
					has_trait = education_stewardship_4
					has_trait = education_learning_4
					has_trait = diplomat
					has_trait = intellect_good_3
					has_trait = administrator
				}
				has_culture = culture:nubian
				NOT = { 
					knows_language = language_greek
				}
			} 
			learn_language = language_greek
		}
		
		every_living_character = { 
			limit = { 
				OR = {
					is_clergy = yes
					learning >= 20
				}
				OR = {
					has_faith = faith:catholic 
					has_faith = faith:bosnian_church
					has_faith = faith:insular_celtic
					has_faith = faith:mozarabic_church
				}
				NOT = { 
					knows_language = language_latin 
				}
			} 
			learn_language = language_latin 
		}
		
		
		#Other Languages 
		
		## Arabs - Make all Arabic cultures have language_arabic on top of their cultural language
		every_living_character = { 
			limit = {
				has_religion = religion:islam_religion
				NOT = { 
					knows_language = language_arabic
				}
				culture = {
					OR = {
						has_cultural_pillar = heritage_arabic
						has_cultural_pillar = heritage_iberian # Andalusian
						has_cultural_pillar = heritage_berber # Islamic Berbers
					}
				}
			}
			learn_language = language_arabic
		}
		
		# Mamluks
		every_living_character = {
			limit = {
				OR = {
					dynasty = dynasty:7276
					dynasty = dynasty:7277
					dynasty = dynasty:762
					dynasty = dynasty:7272
					dynasty = dynasty:7271
					dynasty = dynasty:7270
					dynasty = dynasty:7267
					dynasty = dynasty:7269
					dynasty = dynasty:7268
				}
				NOT = { 
					knows_language = language_arabic
				}
			}
			learn_language = language_arabic
		}
		every_living_character = {
			limit = {
				OR = {
					dynasty = dynasty:762
					dynasty = dynasty:7272
					dynasty = dynasty:7271
					dynasty = dynasty:7270
					dynasty = dynasty:7267
					dynasty = dynasty:7269
					dynasty = dynasty:7268
				}
				NOT = { 
					knows_language = language_egyptian
				}
			}
			learn_language = language_egyptian
		}
		
		every_living_character = {
			limit = {
				culture = culture:english
				game_start_date > 1150.1.1
				NOT = { 
					knows_language = language_middle_english
				}
			}
			unlearn_language = language_anglic
			learn_language = language_middle_english
		}
		
		every_living_character = {
			limit = {
				culture = culture:old_saxon
				NOT = { 
					knows_language = language_saxon
				}
			}
			unlearn_language = language_anglic
			learn_language = language_saxon
		}
		every_living_character = {
			limit = {
				house = house:house_Plant
				NOT = { 
					knows_language = language_french
				}
			}
			learn_language = language_french
		}
		every_living_character = {
			limit = {
				house = house:house_anjou_hongrie
				NOT = { 
					knows_language = language_magyar
				}
			}
			learn_language = language_magyar
		}
		every_living_character = {
			limit = {
				dynasty = dynasty:1000102400
				NOT = { house = house:house_quglugh }
				NOT = { 
					knows_language = language_chinese
				}
			}
			learn_language = language_chinese
		}
		every_living_character = {
			limit = {
				house = house:house_Bagrationi
				NOT = { 
					knows_language = language_greek
				}
			}
			learn_language = language_greek
		}
		every_living_character = {
			limit = {
				dynasty = dynasty:727
				NOT = { 
					knows_language = language_french
				}
			}
			learn_language = language_french
		}
	

		########################################################################################### DYNASTY CULTURES/RELIGIONS ###########################################################################################
		
		
		#For setting dynasties to the new cultures that exist in later bookmarks
		#If you set a parent house to get a culture that's different then a cadet branch then make sure that the parent houses culture is set BEFORE the cadets
		
		#Note on religions. The game sets religious titles prior to this so dynasties that hold a HoF title need their religion manually set no matter what or the HoF title is destroyed
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					house = house:house_von_der_marck
					house = house:house_cleve
					dynasty = dynasty:7168
					dynasty = dynasty:12462
					dynasty = dynasty:7126
					dynasty = dynasty:432
				}
			}
			set_culture = culture:westphalian
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					dynasty = dynasty:7154
					dynasty = dynasty:101893
				}
			}
			set_culture = culture:german_pommeranian
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					dynasty = dynasty:177
					dynasty = dynasty:7163
				}
			}
			set_culture = culture:kashubian
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					dynasty = dynasty:1000103324
					dynasty = dynasty:1000103714
					dynasty = dynasty:226
					house = house:house_anhalt
				}
			}
			set_culture = culture:east_elbian
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					house = house:house_silesia #Maybe questionable to make the Silesian Piasts this but then again they were the ones that ended up under the HRE and the only nobility that ever hold Silesia for almost the entire game and into EU4's time period
				}
			}
			set_culture = culture:german_silesian 
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					dynasty = dynasty:88
					dynasty = dynasty:101558
					house = house:house_baden
					house = house:house_leining
				}
			}
			set_culture = culture:alsatian
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					dynasty = dynasty:12447
					dynasty = dynasty:101718
					dynasty = dynasty:100245
					dynasty = dynasty:7257
					house = house:house_habsurg
					house = house:house_hupoldinger
				}
			}
			set_culture = culture:high_alemannic
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					dynasty = dynasty:1000035155
					dynasty = dynasty:13059
					dynasty = dynasty:1000020094
					dynasty = dynasty:13068
					dynasty = dynasty:1042027
					dynasty = dynasty:1000020115
					dynasty = dynasty:101851
				}
			}
			set_culture = culture:romagnol
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					house = house:house_este
					dynasty = dynasty:1000020105
					dynasty = dynasty:101841
					dynasty = dynasty:1000035411
					house = house:house_canossa
					dynasty = dynasty:101820
					dynasty = dynasty:13064
					dynasty = dynasty:8726
					dynasty = dynasty:1000020071
					dynasty = dynasty:1000020081
					dynasty = dynasty:1000020076
				}
			}
			set_culture = culture:emilian
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					house = house:house_vasto
					dynasty = dynasty:206
					dynasty = dynasty:1000035309
					dynasty = dynasty:1000035413
					dynasty = dynasty:1000035412
					dynasty = dynasty:1000035324
					dynasty = dynasty:1000020087
					dynasty = dynasty:1000035311
				}
			}
			set_culture = culture:piedmontese
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					house = house:house_cinarca
					house = house:house_cozzi
					dynasty = dynasty:1000036007
				}
			}
			set_culture = culture:corsican
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					house = house:house_megas_komnenos
					dynasty = dynasty:634
					dynasty = dynasty:101274
				}
			}
			set_culture = culture:pontic
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					dynasty = dynasty:7335
				}
			}
			set_culture = culture:luri
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					dynasty = dynasty:1042081
					dynasty = dynasty:1044390
				}
			}
			set_culture = culture:harauti
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					dynasty = dynasty:1042091
					dynasty = dynasty:1044391
					house = house:house_ChahamanasofJalor
					house = house:house_ChauhanofSatyapura
					house = house:house_ChauhanofSirohi
				}
			}
			set_culture = culture:marwari
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					dynasty = dynasty:1042079
					house = house:house_sisodia
				}
			}
			set_culture = culture:mewari
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					dynasty = dynasty:1044383
					dynasty = dynasty:1044382
				}
			}
			set_culture = culture:dhundari
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					house = house:house_ChahamanaofDadrewa
				}
			}
			set_culture = culture:ahirwati
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1170.1.1
				OR = {
					dynasty = dynasty:1000027683
					dynasty = dynasty:1000027675
					dynasty = dynasty:taid021
					dynasty = dynasty:1000027686
					dynasty = dynasty:1000027686
				}
			}
			set_culture = culture:lao
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1280.1.1
				OR = {
					dynasty = dynasty:1000028222
					dynasty = dynasty:1000027680
				}
			}
			set_culture = culture:lanna
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1230.1.1
				OR = {
					dynasty = dynasty:1000027677
					dynasty = dynasty:1000027684
				}
			}
			set_culture = culture:siamese
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1150.1.1
				OR = {
					dynasty = dynasty:762
				}
			}
			set_culture = culture:kipchak
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1210.1.1
				game_start_date < 1249.1.1
				OR = {
					culture = culture:qitai
				}
			}
			set_culture = culture:khitan
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1250.1.1
				OR = {
					culture = culture:khitan
					culture = culture:qitai
				}
				capital_county.title_province = { geographical_region = world_manchuria }
			}
			set_culture = culture:daur
		}
		
		every_living_character = {
			limit = {
				game_start_date < 926.1.1
				culture = culture:jurchen
			}
			set_culture = culture:sumo
		}
		
		########################################################################################### MASS CULTURE CHANGES ###########################################################################################
		
		#every_living_character = {
		#	limit = {
		#		game_start_date > 1330.1.1
		#		culture = {
		#			has_cultural_pillar = heritage_east_slavic
		#		}
		#
		#		any_realm_county = {
		#			any_county_province = { geographical_region = custom_ruthenian_culture }
		#		}
		#	}
		#	set_culture = culture:ruthenian
		#}
		#
		#every_living_character = {
		#	limit = {
		#		game_start_date > 1330.1.1
		#		culture = {
		#			has_cultural_pillar = heritage_east_slavic
		#		}
		#
		#		any_realm_county = {
		#			any_county_province = { geographical_region = custom_greatrus_culture }
		#		}
		#	}
		#	set_culture = culture:great_russian
		#}
		
		# CE Rus' Cultures
		
		every_living_character = {
			limit = {
				game_start_date > 1100.1.1
				culture = {
					has_cultural_pillar = heritage_east_slavic
				}

				any_realm_county = {
					any_county_province = { geographical_region = custom_novgorod_culture }
				}
				
			}
			
			set_culture = culture:novgorodian
			
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1100.1.1
				#game_start_date < 1330.1.1
				culture = {
					has_cultural_pillar = heritage_east_slavic
				}

				any_realm_county = {
					any_county_province = { geographical_region = custom_polotsk_culture }
				}
				
			}
			
			set_culture = culture:byelorusian
			
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1100.1.1
				#game_start_date < 1330.1.1
				culture = {
					has_cultural_pillar = heritage_east_slavic
				}

				any_realm_county = {
					any_county_province = { geographical_region = custom_volyn_culture }
				}
				
			}
			
			set_culture = culture:volyn_
			
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1100.1.1
				#game_start_date < 1330.1.1
				culture = {
					has_cultural_pillar = heritage_east_slavic
				}

				any_realm_county = {
					any_county_province = { geographical_region = custom_kyivian_culture }
				}
				
			}
			
			set_culture = culture:proto_ruthenian
			
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1100.1.1
				#game_start_date < 1330.1.1
				culture = {
					has_cultural_pillar = heritage_east_slavic
				}

				any_realm_county = {
					any_county_province = { geographical_region = custom_chernigovian_culture }
				}
				
			}
			
			set_culture = culture:chernigovan
			
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1100.1.1
				#game_start_date < 1330.1.1
				culture = {
					has_cultural_pillar = heritage_east_slavic
				}

				any_realm_county = {
					any_county_province = { geographical_region = custom_ryazanian_culture }
				}
				
			}
			
			set_culture = culture:ryazanian
			
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1100.1.1
				#game_start_date < 1330.1.1
				culture = {
					has_cultural_pillar = heritage_east_slavic
				}

				any_realm_county = {
					any_county_province = { geographical_region = custom_vladimir_culture }
				}
				
			}
			
			set_culture = culture:vladimirian
			
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1140.1.1
				game_start_date < 1290.1.1
				culture = {
					has_cultural_pillar = heritage_frankish
				}

				any_realm_county = {
					any_county_province = { geographical_region = custom_outremar_culture }
				}
				
			}
			
			set_culture = culture:outremer
			
		}
		
		every_living_character = {
			limit = {
				game_start_date > 1000.1.1
				game_start_date < 1050.1.1
				culture = culture:dane
			}
			set_culture = culture:danish
		}
		
		# A script without the heritage limit to convert Turkish dynasties that were made 'Persian'
		every_living_character = {
			limit = {
				game_start_date > 1050.1.1
				NOT = { culture = culture:hindustani_proper }
				NOT = { culture = culture:anatolian_turkish }
				NOT = { religion = religion:tengrism_religion }
				OR = {
					dynasty = dynasty:790			#Ghaznavid
					dynasty = dynasty:7336			#Ghuzz
					dynasty = dynasty:101876		#Eldiguzids
					house = house:house_anushtigar	#Anushtegin 

				}
			}
			set_culture = culture:persian_turkish
		}
		
		#Persian Turks
		every_living_character = {
			limit = {
				game_start_date > 1050.1.1
				culture = {
					has_cultural_pillar = heritage_turkic
				}
				NOT = { culture = culture:hindustani_proper }
				NOT = { culture = culture:anatolian_turkish }
				NOT = { culture = culture:karluk } # They weren't really Turco-Persian like the others further south
				NOT = { religion = religion:tengrism_religion }
				NOT = {
					any_realm_county = {
						OR = {
							any_county_province = { geographical_region = world_steppe_tarim }
							any_county_province = { geographical_region = world_steppe_west }
							any_county_province = { geographical_region = world_steppe_east }
							any_county_province = { geographical_region = ghw_region_anatolia }
						}
					}
				}
				any_realm_county = {
					OR = {
						any_county_province = { geographical_region = ghw_region_caucasus }
						any_county_province = { geographical_region = world_middle_east_persia }
						any_county_province = { geographical_region = world_middle_east_arabia }
						any_county_province = { geographical_region = world_middle_east_jerusalem }
						any_county_province = { geographical_region = world_india_rajastan }
						any_county_province = { geographical_region = world_india_bengal }
						any_county_province = { geographical_region = ghw_region_egypt }
					}
				}
			}
			set_culture = culture:persian_turkish
		}
		
		#Anatolian Turks
		every_living_character = {
			limit = {
				game_start_date > 1080.1.1
				culture = culture:turkish
				#NOT = {
				#	any_realm_county = {
				#		OR = {
				#			empire = title:e_egypt
				#			empire = title:e_persia
				#			empire = title:e_bengal
				#			empire = title:e_rajastan
				#		}
				#	}
				#}
				any_realm_county = {
					empire = title:e_byzantium
				}
			}
			set_culture = culture:anatolian_turkish
		}
		
		#Tunisian Arabic
		
		every_living_character = {
			limit = {
				game_start_date > 1150.1.1
				OR = {
					culture = culture:bedouin
					culture = culture:maghrebi
				}
				any_realm_county = {
					any_county_province = { geographical_region = custom_tunisia_culture }
				}
			}
			set_culture = culture:tunisian
		}
		
		#Algerian Arabic
		
		every_living_character = {
			limit = {
				game_start_date > 1150.1.1
				OR = {
					culture = culture:bedouin
					culture = culture:maghrebi
				}
				any_realm_county = {
					any_county_province = { geographical_region = custom_algeria_culture }
				}
			}
			set_culture = culture:algerian
		}
		
		#Moroccan Arabic
		
		every_living_character = {
			limit = {
				game_start_date > 1150.1.1
				OR = {
					culture = culture:bedouin
					culture = culture:maghrebi
				}
				any_realm_county = {
					any_county_province = { geographical_region = custom_morocco_culture }
				}
			}
			set_culture = culture:moroccan
		}
		
		
		if = {
            limit = {
                exists = title:e_cathay.holder
            }
            title:e_cathay.holder = {
                every_vassal = {
                    if = {
                        limit = {
                            NOT = { this = character:303267 }
                            NOT = { culture = culture:khitan }
                        }

                        set_culture = capital_province.culture
                        set_character_faith = capital_province.faith

                        every_close_or_extended_family_member = {
                            set_culture = prev.capital_province.culture
                            set_character_faith = prev.capital_province.faith
                        }
                    }
                }
            }
        }
		
        # Flip Kara-Khitans to Qitai culture
		# Much simpler script than what RoA used
		
		every_living_character = {
			limit = {
				game_start_date >= 1140.1.1
				culture = culture:khitan
				any_realm_county = {
					any_county_province = { geographical_region = chagatai_de_jure_region }
				}
			}
			set_culture = culture:qitai
		}
		
		# Mongols post-1204
		every_living_character = {
			limit = {
				game_start_date > 1204.1.1
				OR = {
					culture = culture:tataric
					culture = culture:jadran
					culture = culture:tajiuud
				}
			}
			set_culture = culture:mongol
		}
		
		
		
		########################################################################################### COUNTY CULTURE CHANGES ###########################################################################################
		
		title:c_socotra = {
			set_county_culture = culture:soqotri
		}	
		
		if = {
			limit = {
				game_start_date > 867.1.1
			}
			
			title:c_ghazna = {
				set_county_culture = culture:afghan
			}	
			title:c_zabulistan = {
				set_county_culture = culture:khalaj
			}	
			title:c_zamindawar = {
				set_county_culture = culture:khalaj
			}	
			title:c_bost = {
				set_county_culture = culture:khalaj
			}	
			title:c_wasit = {
				set_county_culture = culture:mandaic
			}	
			title:c_tib = {
				set_county_culture = culture:mandaic
			}	
			title:c_east-tokharestan = {
				set_county_culture = culture:tajik
			}	
			title:c_west-tokharestan = {
				set_county_culture = culture:tajik
			}	
			title:c_turan = {
				set_county_culture = culture:brahui
			}
			title:c_sibi = {
				set_county_culture = culture:brahui
			}			
		}

		if = {
			limit = {
				game_start_date > 1250.1.1
			}
			
			title:c_zaila = {
				set_county_culture = culture:harar
			}	
			title:c_dakkar = {
				set_county_culture = culture:harar
			}	
			title:c_harar = {
				set_county_culture = culture:harar
			}		
		}
		if = {
			limit = {
				title:c_socotra.holder = {
					highest_held_title_tier = tier_duchy
					culture = { has_cultural_pillar = heritage_arabic }
				}
			}
			title:c_socotra.holder = {
				make_socotra_culture_effect = yes
			}
		}
	}
	
}

MB_languages_monthly = {

	on_actions = {
		delay = { months = 10 }
		MB_languages_monthly
	}
	
	effect = {
	
		every_living_character = { 
			limit = { 
				OR = {
					learning >= 20
					has_trait = scholar
					has_trait = theologian
					has_trait = education_intrigue_4
					has_trait = education_diplomacy_4
					has_trait = education_stewardship_4
					has_trait = education_learning_4
					has_trait = diplomat
					has_trait = intellect_good_3
					has_trait = administrator
				}
				has_culture = culture:nubian
				NOT = { 
					knows_language = language_greek
				}
			} 
			learn_language = language_greek
		}
		
		every_living_character = { 
			limit = { 
				OR = {
					is_clergy = yes
					learning >= 20
				}
				OR = {
					has_faith = faith:catholic 
					has_faith = faith:bosnian_church
					has_faith = faith:insular_celtic
					has_faith = faith:mozarabic_church
				}
				NOT = { 
					knows_language = language_latin 
				}
			} 
			learn_language = language_latin 
		}
		
		
		#Other Languages 
		
		#For this let's do only rulers instead of everyone like the initial game start action since going through every character may impact performance but this at least ensures the languages persist past the initial rulers
		
		## Arabs - Make all Arabic cultures have language_arabic on top of their cultural language
		every_ruler = {
			limit = {
				has_religion = religion:islam_religion
				NOT = { 
					knows_language = language_arabic
				}
				culture = {
					OR = {
						has_cultural_pillar = heritage_arabic
						has_cultural_pillar = heritage_iberian # Andalusian
						has_cultural_pillar = heritage_berber # Islamic Berbers
					}
				}
			}
			learn_language = language_arabic
		}
		
		# Mamluks
		every_ruler = {
			limit = {
				exists = dynasty
				OR = {
					dynasty = dynasty:7276
					dynasty = dynasty:7277
					dynasty = dynasty:762
					dynasty = dynasty:7272
					dynasty = dynasty:7271
					dynasty = dynasty:7270
					dynasty = dynasty:7267
					dynasty = dynasty:7269
					dynasty = dynasty:7268
				}
				NOT = { 
					knows_language = language_arabic
				}
			}
			learn_language = language_arabic
		}
		every_ruler = {
			limit = {
				exists = dynasty
				OR = {
					dynasty = dynasty:762
					dynasty = dynasty:7272
					dynasty = dynasty:7271
					dynasty = dynasty:7270
					dynasty = dynasty:7267
					dynasty = dynasty:7269
					dynasty = dynasty:7268
				}
				NOT = { 
					knows_language = language_egyptian
				}
			}
			learn_language = language_egyptian
		}
		
		every_ruler = {
			limit = {
				culture = culture:english
				game_start_date > 1150.1.1
				NOT = { 
					knows_language = language_middle_english
				}
			}
			unlearn_language = language_anglic
			learn_language = language_middle_english
		}
		
		every_ruler = {
			limit = {
				culture = culture:old_saxon
				NOT = { 
					knows_language = language_saxon
				}
			}
			unlearn_language = language_anglic
			learn_language = language_saxon
		}
		every_ruler = {
			limit = {
				exists = dynasty
				house = house:house_Plant
				NOT = { 
					knows_language = language_french
				}
			}
			learn_language = language_french
		}
		every_ruler = {
			limit = {
				exists = dynasty
				house = house:house_anjou_hongrie
				NOT = { 
					knows_language = language_magyar
				}
			}
			learn_language = language_magyar
		}
		every_ruler = {
			limit = {
				exists = dynasty
				dynasty = dynasty:1000102400
				NOT = { house = house:house_quglugh }
				NOT = { 
					knows_language = language_chinese
				}
			}
			learn_language = language_chinese
		}
		every_ruler = {
			limit = {
				exists = dynasty
				house = house:house_Bagrationi
				NOT = { 
					knows_language = language_greek
				}
			}
			learn_language = language_greek
		}
		every_ruler = {
			limit = {
				exists = dynasty
				dynasty = dynasty:727
				NOT = { 
					knows_language = language_french
				}
			}
			learn_language = language_french
		}
	}
	
}

MB_religion_setup = {

	effect = {
		
		## Block conversion for Non-sectarian Islam
		faith:ns_islam = {
			set_variable = { name = block_conversion_ALB }
		}
		faith:ns_islam_shia = {
			set_variable = { name = block_conversion_ALB }
		}
	
		if = {
            limit = { game_start_date >= 995.1.1 }
			#The Polabians were unique in that their slavic faith was 'reformed' and was much more organized which made them more resistant to conversion. I'm not going to further split the slavic faiths so just going to do this with west slavic. Don't want to do it in 936 since the Poles, who did convert pretty 'quickly' (they did still have revolts), would actually be impacted then
			faith:slavic_west = {
				set_variable = { name = has_been_reformed }
			}
        }
		
		
		#Bulgarian Orthodox in 1066 start date

		every_ruler = {
			if = {
				limit = {
					AND = {
						game_start_date >= 1066.9.15
						faith = faith:orthodox
						culture = culture:bulgarian
					}
				}
				set_character_faith_with_conversion = faith:bulgarian_orthodox
			}
		}
		
		# Vlach Orthodoxy - If I'm using all the other ones there's no reason to not have this in later dates while being in communion similar to how Slavic Orthodoxy is and it gets rid of the awkward Greek Orthodoxy in the area when everywhere else is an ethnic church by the 1200's
		every_ruler = {
			if = {
				limit = {
					AND = {
						game_start_date >= 1210.1.1
						faith = faith:orthodox
						OR = {
							culture = culture:vlach
							culture = culture:bolokhovens
						}
					}
				}
				set_character_faith_with_conversion = faith:vlach_orthodox
			}
		}
		
		#Georgian Orthodox, notwithstanding changes to province history
		
		every_ruler = {
			if = {
				limit = {
					AND = {
						faith = faith:orthodox
						OR = {
							culture = culture:georgian
							culture = culture:alan #Give them their own faith?
						}
					}
				}
				set_character_faith_with_conversion = faith:georgian_orthodox
			}
		}
		
		##Antiochene Melkite, notwithstanding changes to province history
		every_county = {
			if = {
				limit = {
					AND = { 
						NOT = { culture = culture:armenian } #Armenians have their own system
						faith = faith:orthodox
						county.title_province = { geographical_region = antioch_pentarch_region }
					}
				}
				set_county_faith = faith:melkite
			}
		}
		every_ruler = {
			if = {
				limit = {
					AND = {
						faith = faith:orthodox
						capital_province = { geographical_region = antioch_pentarch_region }
					}
				}
				set_character_faith_with_conversion = faith:melkite
			}
		}
		
		#Jerusalem Melkites
		every_county = {
			if = {
				limit = {
					AND = {
						faith = faith:orthodox
						county.title_province = { geographical_region = jerusalem_pentarch_region }
					}
				}
				set_county_faith = faith:jerusalem_melkite
			}
		}
		#No characters begin in this region with the Orthodox faith
		
		#Alexandrian Melkites
		every_county = {
			if = {
				limit = {
					AND = {
						faith = faith:orthodox
						county.title_province = { geographical_region = alexandria_pentarch_region }
					}
				}
				set_county_faith = faith:alexandrian_melkite
			}
		}
		#No characters begin in this region with the Orthodox faith
		
		#Armenian Melkites
		every_county = {
			if = {
				limit = {
					AND = {
						culture = culture:armenian
						faith = faith:orthodox
						county.title_province = { geographical_region = antioch_pentarch_region }
					}
				}
				set_county_faith = faith:tsat
			}
		}
		
		every_county = {
			if = {
				limit = {
					AND = {
						culture = culture:armenian
						faith = faith:orthodox
						county.title_province = { geographical_region = constantinople_pentarch_region }
					}
				}
				set_county_faith = faith:horoms
			}
		}
		
		#Cypriot Melkites
		every_ruler = {
			if = {
				limit = {
					AND = {
						faith = faith:orthodox
						capital_province = { geographical_region = cyprus_heresy_region }
					}
				}
				set_character_faith_with_conversion = faith:cyprus_orthodox
			}
		}
		
		#Bohemian Catholics, rulers only
		every_ruler = {
			if = {
				limit = {
					AND = {
						game_start_date <= 936.1.1
						game_start_date >= 867.1.1
						faith = faith:catholic
						capital_province.faith = faith:bohemian_catholic
					}
				}
				set_character_faith_with_conversion = faith:bohemian_catholic
			}
		}
		
		#Albanian Apostolics, rulers only
		every_ruler = {
			if = {
				limit = {
					AND = {
						faith = faith:armenian_apostolic
						capital_province = { geographical_region = caucasian_albania_region }
					}
				}
				set_character_faith_with_conversion = faith:albanian_apostolic
			}
		}
		
		##Ambrosian Catholics, rulers only
		#every_ruler = {
		#	if = {
		#		limit = {
		#			AND = {
		#				faith = faith:catholic
		#				capital_province.faith = faith:ambrosian
		#				highest_held_title_tier < 4 #Will prevent Italy from becoming Ambrosian outright
		#			}
		#		}
		#		set_character_faith_with_conversion = faith:ambrosian
		#	}
		#}
		#
		##Ethiopian Orthodox
		#every_ruler = {
		#	if = {
		#		limit = {
		#			AND = { 
		#				faith = faith:coptic
		#				capital_province.faith = faith:ethiopian_orthodox
		#			}
		#		}
		#		set_character_faith_with_conversion = faith:ethiopian_orthodox
		#	}
		#}
		#
		#
		#Changes to specific faiths

		faith:bulgarian_orthodox = {
			if = {
				limit = { game_start_date >= 867.1.1 }
				#remove_doctrine = orthodox_autocephaly_autocephalous
				#add_doctrine = unavailable_doctrine
				remove_doctrine = tenet_adaptive
				add_doctrine = tenet_communion
				add_doctrine = tenet_monasticism
			}
		}
		
		faith:maphrianate = {
			if = {
				limit = { game_start_date >= 867.1.1 }
				remove_doctrine = special_doctrine_council_capharthutha
			}
		}
		
		faith:jacobite = {
			if = {
				limit = { game_start_date >= 867.1.1 }
				remove_doctrine = special_doctrine_council_capharthutha
			}
		}
		
		#Convert all the Slavic counties to separate faiths
		#To basically handle the one area where there'd be meaningful compatibility issues with 'Children of Perun'
		every_county = {
			#East
			if = {
				limit = {
					culture = {
						OR = {
							has_cultural_pillar = heritage_east_slavic
							has_cultural_pillar = heritage_north_germanic #To convert counties where Nordic rulers are
							has_cultural_pillar = heritage_magyar
							has_cultural_pillar = heritage_baltic
							has_cultural_pillar = heritage_iranian
							has_cultural_pillar = heritage_volga_finnic
						}
					}
					religion = religion:slavic_religion
				}
				set_county_faith = faith:slavic_east
			}
			#South
			if = {
				limit = {
					culture = {
						OR = {
							has_cultural_pillar = heritage_south_slavic
							has_cultural_pillar = heritage_vlach
						}
					}
					religion = religion:slavic_religion
				}
				set_county_faith = faith:slavic_south
			}
			#West
			if = {
				limit = {
					culture = { has_cultural_pillar = heritage_west_slavic }
					religion = religion:slavic_religion
				}
				set_county_faith = faith:slavic_west
			}
		}
		faith:slavic_pagan = {
			#Do the same for characters. Need more cultures for various weird courtiers
			every_faith_character = {
				#East
				if = {
					limit = {
						NOT = { religion = religion:tengrism_religion }
						culture = {
							OR = {
								has_cultural_pillar = heritage_east_slavic
								has_cultural_pillar = heritage_volga_finnic
								has_cultural_pillar = heritage_north_germanic
								has_cultural_pillar = heritage_iranian
							}
						}
					}
					set_character_faith = faith:slavic_east
				}
				#South
				if = {
					limit = {
						NOT = { religion = religion:tengrism_religion }
						culture = {
							OR = {
								has_cultural_pillar = heritage_south_slavic
								has_cultural_pillar = heritage_turkic
								has_cultural_pillar = heritage_vlach
							}
						}
					}
					set_character_faith = faith:slavic_south
				}
				#West
				if = {
					limit = {
						culture = { has_cultural_pillar = heritage_west_slavic }
					}
					set_character_faith = faith:slavic_west
				}
			}
		}
		
		#Serbian Orthodox
		faith:orthodox = {
			every_faith_character = {
				if = {
					limit = {
						game_start_date >= 1211.1.1
						culture = {
							OR = {
								has_cultural_pillar = language_serbo
							}
						}
					}
					set_character_faith = faith:serbian_orthodox
				}

			}
		}
		
		#Patriarchs of Aquileia 
		faith:catholic = {
			every_faith_character = {
				if = {
					limit = {
						has_title = title:c_aquileia
					}
					set_character_faith = faith:aquileian_church
				}

			}
		}
		
		#Eryas
		
		faith:mordvin_pagan = {
			every_faith_character = {
				if = {
					limit = {
						has_title = title:d_khopyor
					}
					set_character_faith = faith:erzya_pagan
				}

			}
		}
		
		#Moksha 
		
		faith:mordvin_pagan = {
			every_faith_character = {
				if = {
					limit = {
						has_title = title:d_mordvinia
					}
					set_character_faith = faith:moksha_pagan
				}

			}
		}
		
		# African Ibadi's
		
		faith:ibadi = {
			every_faith_character = {
				if = {
					limit = {
						OR = {
							culture = { has_cultural_pillar = heritage_berber }
							culture = { has_cultural_pillar = heritage_central_african }
						}
					}
					set_character_faith = faith:wahbiya
				}

			}
		}
		
		#DYNASTY FAITHS
		
		#Korean Dynasties
		
		every_living_character = {
			limit = {
				game_start_date > 1090.1.1
				OR = {
					dynasty = dynasty:1000062009
					dynasty = dynasty:1000062005
					dynasty = dynasty:1000062003
				}
			}
			set_character_faith = faith:zenzong
		}
		every_living_character = {
			limit = {
				game_start_date > 1090.1.1
				OR = {
					dynasty = dynasty:1000062027
				}
			}
			set_character_faith = faith:kegon
		}
		
		
		#Xi Xia
		
		every_living_character = {
			limit = {
				game_start_date > 1015.1.1
				OR = {
					house = house:house_weiming
					house = house:house_khon
				}
			}
			set_character_faith = faith:sakya
		}
		#Sakya Trizin
		
		every_living_character = {
			limit = {
				game_start_date > 1080.1.1
				OR = {
					house = house:house_khon
					dynasty = dynasty:2003056
					dynasty = dynasty:2003057
					dynasty = dynasty:2003052
					dynasty = dynasty:105834
					dynasty = dynasty:2003060
					dynasty = dynasty:2003053
					dynasty = dynasty:2003061
				}
			}
			set_character_faith = faith:sakya
		}
		
		#Xia
		
		every_living_character = {
			limit = {
				game_start_date > 1100.1.1
				OR = {
					dynasty = dynasty:2003100
					dynasty = dynasty:2003108
					dynasty = dynasty:2003119
					dynasty = dynasty:2003113
					
				
				}
			}
			set_character_faith = faith:sakya
		}
		
		#Kagyu
		
		every_living_character = {
			limit = {
				game_start_date > 1100.1.1
				OR = {
					dynasty = dynasty:2003068
					
					dynasty = dynasty:2003026
					dynasty = dynasty:2003073
					house = house:house_boyul
					house = house:house_pemako
					dynasty = dynasty:2003021
					dynasty = dynasty:2003022
					dynasty = dynasty:2003023
					dynasty = dynasty:2003020
					dynasty = dynasty:2003056
					dynasty = dynasty:2003090
					dynasty = dynasty:2003066
					dynasty = dynasty:2003067
					dynasty = dynasty:105804
					dynasty = dynasty:2003007
				}
			}
			set_character_faith = faith:kagyu
		}
		
		#Gelug
		
		every_living_character = {
			limit = {
				game_start_date > 1100.1.1
				OR = {
					dynasty = dynasty:2003070
					
				}
			}
			set_character_faith = faith:gelug
		}
		
		#Saura
		
		every_living_character = {
			limit = {
				game_start_date > 1100.1.1
				NOT = {
						has_title = title:k_lanka
					}
					
				dynasty = dynasty:1029195
			}
			set_character_faith = faith:saura
		}
	}
	
}


MB_set_court_languages = {

    effect = {

		#Persian
		
		if = {
            limit = { exists = title:e_persia.holder game_start_date >= 1066.1.1 }
            title:e_persia.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_persia.holder game_start_date >= 1066.1.1 }
            title:k_persia.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_kerman.holder game_start_date >= 1066.1.1 }
            title:k_kerman.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_khorasan.holder }
            title:k_khorasan.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_daylam.holder }
            title:k_daylam.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_ormus.holder }
            title:k_ormus.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_transoxiana.holder game_start_date >= 1042.1.1 }
            title:k_transoxiana.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_kabulistan.holder game_start_date >= 997.1.1 }
            title:k_kabulistan.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_sindh.holder  game_start_date >= 1017.1.1 }
            title:k_sindh.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_shirvan.holder  game_start_date >= 1066.1.1 }
            title:k_shirvan.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_khwarezmia.holder  game_start_date >= 1066.1.1 }
            title:k_khwarezmia.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:e_rajastan.holder game_start_date >= 1187.1.1 }
            title:e_rajastan.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_bengal.holder game_start_date >= 1210.1.1 }
            title:k_bengal.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_punjab.holder game_start_date >= 1210.1.1 }
            title:k_punjab.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_bengal_east.holder game_start_date >= 1300.1.1 }
            title:k_bengal_east.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_malwa.holder game_start_date >= 1310.1.1 }
            title:k_malwa.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_maharastra.holder game_start_date >= 1337.1.1 }
            title:k_maharastra.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_chobanids.holder game_start_date >= 1337.1.1 }
            title:k_chobanids.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_mesopotamia.holder game_start_date >= 1337.1.1 }
            title:k_mesopotamia.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_eretnid.holder game_start_date >= 1337.1.1 }
            title:k_eretnid.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_madurai.holder game_start_date >= 1337.1.1 }
            title:k_madurai.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_delhi.holder game_start_date >= 1195.1.1 }
            title:k_delhi.holder = { set_court_language = language_iranian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		#Arabic
		
		if = {
            limit = { exists = title:e_arabia.holder }
            title:e_arabia.holder = { set_court_language = language_arabic }
        }
		if = {
            limit = { exists = title:e_egypt.holder }
            title:e_egypt.holder = { set_court_language = language_arabic }
        }
		if = {
            limit = { exists = title:k_africa.holder }
            title:k_africa.holder = { set_court_language = language_arabic }
        }
		if = {
            limit = { exists = title:k_andalusia.holder }
            title:k_andalusia.holder = { set_court_language = language_arabic }
        }
		if = {
            limit = { exists = title:k_egypt.holder }
            title:k_egypt.holder = { set_court_language = language_arabic }
        }
		if = {
            limit = { exists = title:k_tahert.holder }
            title:k_tahert.holder = { set_court_language = language_arabic }
        }
		if = {
            limit = { exists = title:k_maghreb.holder }
            title:k_maghreb.holder = { set_court_language = language_arabic }
        }
		if = {
            limit = { exists = title:k_yemen.holder }
            title:k_yemen.holder = { set_court_language = language_arabic }
        }
		if = {
            limit = { exists = title:k_oman.holder }
            title:k_oman.holder = { set_court_language = language_arabic }
        }
		if = {
            limit = { exists = title:k_mesopotamia.holder game_start_date < 1336.1.1  }
            title:k_mesopotamia.holder = { set_court_language = language_arabic }
        }
		if = {
            limit = { exists = title:k_jazira.holder }
            title:k_jazira.holder = { set_court_language = language_arabic }
        }
		if = {
            limit = { exists = title:k_syria.holder }
            title:k_syria.holder = { set_court_language = language_arabic }
        }
		if = {
            limit = { exists = title:k_shirvan.holder game_start_date < 1065.1.1 }
            title:k_shirvan.holder = { set_court_language = language_arabic }
        }
		if = {
            limit = { exists = title:k_mauretania.holder }
            title:k_mauretania.holder = { set_court_language = language_arabic }
        }
		if = {
            limit = { exists = title:k_sindh.holder game_start_date < 1000.1.1 }
            title:k_sindh.holder = { set_court_language = language_arabic }
        }
		if = {
            limit = { exists = title:k_valencia.holder }
            title:k_valencia.holder = { set_court_language = language_arabic }
        }
		
		#East Africa
		
		if = {
            limit = { exists = title:k_abyssinia.holder game_start_date < 1270.1.1 }
            title:k_abyssinia.holder = { set_court_language = language_ethiopic
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_semien.holder }
            title:k_semien.holder = { set_court_language = language_ethiopic
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		# Europe
		
		if = {
            limit = { exists = title:e_hre.holder }
            title:e_hre.holder = { set_court_language = language_franconian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_lotharingia.holder game_start_date >= 856.1.1 }
            title:k_lotharingia.holder = { set_court_language = language_franconian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_east_francia.holder }
            title:k_east_francia.holder = { set_court_language = language_franconian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_burgundy.holder game_start_date < 1020.1.1 }
			title:k_burgundy.holder = { set_court_language = language_franconian 
				if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_bohemia.holder game_start_date >= 1310.1.1 }
            title:k_bohemia.holder = { set_court_language = language_franconian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_papal_state.holder }
            title:k_papal_state.holder = { set_court_language = language_latin
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_salerno.holder }
            title:k_salerno.holder = { set_court_language = language_latin
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_italy.holder game_start_date < 900.1.1 }
			title:k_italy.holder = { set_court_language = language_latin 
				if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_croatia.holder game_start_date < 1091.1.1 }
			title:k_croatia.holder = { set_court_language = language_slavonic 
				if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_brittany.holder game_start_date >= 1187.8.31 game_start_date <= 1195.8.31  }
			title:k_brittany.holder = { set_court_language = language_french 
				if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_brittany.holder game_start_date >= 1204.1.1 }
			title:k_brittany.holder = { set_court_language = language_french 
				if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_scotland.holder game_start_date < 1235.1.1 }
			title:k_scotland.holder = { set_court_language = language_goidelic 
				if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_scotland.holder game_start_date >= 1236.1.1 }
			title:k_scotland.holder = { set_court_language = language_scots 
				if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_ellan_vanin.holder game_start_date >= 1266.1.1 }
			title:k_ellan_vanin.holder = { set_court_language = language_scots 
				if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_aragon.holder }
			title:k_aragon.holder = { set_court_language = language_pyreanean 
				if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_aragon.holder game_start_date >= 1213.1.1 }
			title:k_aragon.holder = { set_court_language = language_occitano_romance 
				if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_mallorca.holder }
			title:k_mallorca.holder = { set_court_language = language_occitano_romance 
				if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
	
		if = {
            limit = { exists = title:k_navarra.holder game_start_date >= 852.1.1 game_start_date < 1234.1.1 }
			title:k_navarra.holder = { set_court_language = language_pyreanean 
				if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_navarra.holder game_start_date >= 1235.1.1 }
			title:k_navarra.holder = { set_court_language = language_french 
				if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:e_bulgaria.holder game_start_date <= 892.1.1  }
			title:e_bulgaria.holder = { set_court_language = language_greek 
				if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:e_bulgaria.holder game_start_date >= 893.1.1 game_start_date <= 1018.1.1 }
			title:e_bulgaria.holder = { set_court_language = language_slavonic 
				if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:e_bulgaria.holder game_start_date >= 1019.1.1 }
			title:e_bulgaria.holder = { set_court_language = language_bulgarian 
				if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_poland.holder }
            title:k_poland.holder = { set_court_language = language_lechitic
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_sicily.holder game_start_date >= 1130.1.1 game_start_date <= 1194.1.1 }
            title:k_sicily.holder = { set_court_language = language_norman
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_sicily.holder game_start_date >= 1195.1.1 game_start_date <= 1250.1.1 }
            title:k_sicily.holder = { set_court_language = language_franconian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_sicily.holder game_start_date >= 1251.1.1 }
            title:k_sicily.holder = { set_court_language = language_sicilian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_sweden.holder game_start_date >= 1166.1.1 }
            title:k_sweden.holder = { set_court_language = language_old_swedish
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_norway.holder game_start_date >= 1166.1.1 }
            title:k_norway.holder = { set_court_language = language_old_norwegian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_denmark.holder game_start_date >= 1166.1.1 }
            title:k_denmark.holder = { set_court_language = language_old_danish
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_jerusalem.holder }
            title:k_jerusalem.holder = { set_court_language = language_french
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_galicia-volhynia.holder }
            title:k_galicia-volhynia.holder = { set_court_language = language_east_slavic
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_england.holder game_start_date >= 1066.12.26 }
            title:k_england.holder = { set_court_language = language_french
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:e_latin_empire.holder }
            title:e_latin_empire.holder = { set_court_language = language_french
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_thessalonika.holder }
            title:k_thessalonika.holder = { set_court_language = language_french
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_cyprus.holder }
            title:k_cyprus.holder = { set_court_language = language_french
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_trinacria.holder game_start_date >= 1280.1.1 game_start_date <= 1302.1.1 }
            title:k_trinacria.holder = { set_court_language = language_sicilian
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_trinacria.holder game_start_date >= 1303.1.1 }
            title:k_trinacria.holder = { set_court_language = language_occitano_romance
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_hungary.holder game_start_date >= 1310.1.1 }
            title:k_hungary.holder = { set_court_language = language_magyar
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		#Steppe
		
		if = { #Mainly for when Kimeks rule it
            limit = { exists = title:k_qipchaq.holder }
            title:k_qipchaq.holder = { set_court_language = language_kipchak
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }

		if = { #
            limit = { exists = title:e_white_horde.holder game_start_date >= 1280.1.1 game_start_date <= 1299.1.1 }
            title:e_white_horde.holder = { set_court_language = language_kipchak
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = { #
            limit = { exists = title:e_blue_horde.holder game_start_date >= 1280.1.1 game_start_date <= 1299.1.1 }
            title:e_blue_horde.holder = { set_court_language = language_kipchak
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = { #
            limit = { exists = title:e_white_horde.holder game_start_date >= 1300.1.1 }
            title:e_white_horde.holder = { set_court_language = language_tatar
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = { #
            limit = { exists = title:e_blue_horde.holder game_start_date >= 1300.1.1 }
            title:e_blue_horde.holder = { set_court_language = language_tatar
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = { #
            limit = { exists = title:e_turan.holder game_start_date >= 1280.1.1 }
            title:e_turan.holder = { set_court_language = language_chagatai
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = { #
            limit = { exists = title:k_transoxiana.holder game_start_date >= 1300.1.1 }
            title:k_transoxiana.holder = { set_court_language = language_chagatai
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = { #
            limit = { exists = title:k_zhetysu.holder game_start_date >= 1300.1.1 }
            title:k_zhetysu.holder = { set_court_language = language_chagatai
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = { #
            limit = { exists = title:k_mongolia.holder game_start_date >= 1337.1.1 }
            title:k_mongolia.holder = { set_court_language = language_mongolic
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		#Southeast Asia
		
		if = { #
            limit = { exists = title:k_arakan.holder }
            title:k_arakan.holder = { set_court_language = language_burmese
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		#Indosphere
		
		if = {
            limit = { exists = title:e_deccan.holder game_start_date < 1206.1.1 }
            title:e_deccan.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:e_chola.holder game_start_date < 1206.1.1 }
            title:e_chola.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_alupas.holder game_start_date < 1206.1.1 }
            title:k_alupas.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_andhra.holder game_start_date < 1206.1.1 }
            title:k_andhra.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_kandamba_goa.holder game_start_date < 1206.1.1 }
            title:k_kandamba_goa.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_chera.holder game_start_date < 1206.1.1 }
            title:k_chera.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_kozhikode.holder game_start_date < 1206.1.1 }
            title:k_kozhikode.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_cochin.holder game_start_date < 1206.1.1 }
            title:k_cochin.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_venadu.holder game_start_date < 1206.1.1 }
            title:k_venadu.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:e_kalinga.holder game_start_date < 1206.1.1 }
            title:e_kalinga.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:e_bengal.holder game_start_date < 1206.1.1 }
            title:e_bengal.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_gondwana.holder game_start_date < 1206.1.1 }
            title:k_gondwana.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_kosala.holder game_start_date < 1206.1.1 }
            title:k_kosala.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_chandela.holder game_start_date < 1206.1.1 }
            title:k_chandela.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_malwa.holder game_start_date < 1206.1.1 }
            title:k_malwa.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_bengal_east.holder game_start_date < 1206.1.1 }
            title:k_bengal_east.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_bengal.holder game_start_date < 1206.1.1 }
            title:k_bengal.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_kangra.holder game_start_date < 1206.1.1 }
            title:k_kangra.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_bihar.holder game_start_date < 1206.1.1 }
            title:k_bihar.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_ratnapura.holder game_start_date < 1206.1.1 }
            title:k_ratnapura.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_gujarat.holder game_start_date < 1206.1.1 }
            title:k_gujarat.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_chudasama.holder game_start_date < 1206.1.1 }
            title:k_chudasama.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_mewar.holder game_start_date < 1206.1.1 }
            title:k_mewar.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_delhi.holder game_start_date < 1190.1.1 }
            title:k_delhi.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_rajputana.holder game_start_date < 1206.1.1 }
            title:k_rajputana.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_telingana.holder game_start_date < 1206.1.1 }
            title:k_telingana.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_karnata.holder game_start_date < 1206.1.1 }
            title:k_karnata.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_maharastra.holder game_start_date < 1206.1.1 }
            title:k_maharastra.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_jaisalmer.holder game_start_date < 1206.1.1 }
            title:k_jaisalmer.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_kutch.holder game_start_date < 1206.1.1 }
            title:k_kutch.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_kamarupa.holder game_start_date < 1206.1.1 }
            title:k_kamarupa.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_sena.holder game_start_date < 1206.1.1 }
            title:k_sena.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_kashmir.holder game_start_date < 1206.1.1 }
            title:k_kashmir.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_chand.holder game_start_date < 1206.1.1 }
            title:k_chand.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:e_rajastan.holder game_start_date < 1186.1.1 }
            title:e_rajastan.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_punjab.holder game_start_date < 1070.1.1 }
            title:k_punjab.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_kabulistan.holder game_start_date = 936.8.7 }
            title:k_kabulistan.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_gondwana.holder game_start_date >= 1210.1.1 }
            title:k_gondwana.holder = { set_court_language = language_bundeli
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_chandela.holder game_start_date >= 1210.1.1 }
            title:k_chandela.holder = { set_court_language = language_bundeli
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_ratnapura.holder game_start_date >= 1210.1.1 }
            title:k_ratnapura.holder = { set_court_language = language_bundeli
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_baghela.holder game_start_date >= 1210.1.1 }
            title:k_baghela.holder = { set_court_language = language_bundeli
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_chanda.holder game_start_date >= 1337.1.1 }
            title:k_chanda.holder = { set_court_language = language_bundeli
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_mawar.holder game_start_date >= 1300.1.1 }
            title:k_mawar.holder = { set_court_language = language_rajasthani
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_champa.holder game_start_date < 1250.1.1 }
            title:k_champa.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = { # Khmer using Sanskrit until they started to turn to Buddhism
            limit = { exists = title:k_chenla.holder game_start_date < 1250.1.1 }
            title:k_chenla.holder = { set_court_language = language_sanskrit
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		#Sinosphere
		
		if = {
            limit = { exists = title:k_nanzhao.holder }
            title:k_nanzhao.holder = { set_court_language = language_chinese
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		if = {
            limit = { exists = title:k_ziqi.holder game_start_date <= 1174.1.1 }
            title:k_ziqi.holder = { set_court_language = language_chinese
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
        if = {
            limit = { exists = title:e_dai_viet.holder game_start_date <= 1174.1.1 }
            title:e_dai_viet.holder = { set_court_language = language_chinese
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
        if = {
            limit = { exists = title:k_annam.holder }
            title:k_annam.holder = { set_court_language = language_chinese
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		#if = {
        #    limit = { exists = title:k_jinghai.holder }
        #    title:k_jinghai.holder = { set_court_language = language_chinese
        #	if = {
		#			limit = { NOT = { knows_court_language_of = this } }
		#			learn_court_language_of = this
		#		}
		#	}
        #}
		
		if = {
            limit = { exists = title:k_goryeo.holder game_start_date > 996.1.1 }
            title:k_goryeo.holder = { set_court_language = language_chinese
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:e_jurchen_china.holder game_start_date <= 1140.1.1 }
            title:e_jurchen_china.holder = { set_court_language = language_jurchen
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:e_jurchen_china.holder game_start_date >= 1141.1.1 }
            title:e_jurchen_china.holder = { set_court_language = language_chinese
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:e_celestia_china.holder }
            title:e_celestia_china.holder = { set_court_language = language_chinese
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		#Indonesia
		
		if = { # All of them should probably be Sanskrit
            limit = { exists = title:k_jawa.holder game_start_date < 1095.1.1 } 
            title:k_jawa.holder = { set_court_language = language_malay
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_samudera.holder } 
            title:k_samudera.holder = { set_court_language = language_malay
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_galuh.holder } 
            title:k_galuh.holder = { set_court_language = language_malay
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
		
		if = {
            limit = { exists = title:k_sunda.holder } 
            title:k_sunda.holder = { set_court_language = language_malay
        	if = {
					limit = { NOT = { knows_court_language_of = this } }
					learn_court_language_of = this
				}
			}
        }
    }
	
}



MB_holy_site_fix = {

    effect = {
        every_religion_global = {
            every_faith = {
                every_holy_site = {
                    limit = { title_province = { has_holding = no } }
                    title_province = {
                        set_holding_type = church_holding
                    }
                }
            }
        }
    }
	
}

MB_succexpstart = {
	#Fix succession laws not being properly set
	
    effect = {
        every_independent_ruler = {
            limit = {
                OR = {
                    has_culture = culture:irish
                    AND = {
                        has_culture = culture:gaelic
                        game_start_date < 1005.1.1
                    }
                }
                OR = {
                    has_government = feudal_government
                    has_government = tribal_government
                }
                highest_held_title_tier >= tier_county
            }
            this.primary_title = {
                add_title_law = gaelic_elective_succession_law
            }
        }
        every_independent_ruler = {
            limit = {
                culture = { has_cultural_parameter = witenagemot_succession_enabled }
                highest_held_title_tier >= tier_kingdom
                OR = {
                    has_government = feudal_government
                    has_government = tribal_government
                }
            }
            this.primary_title = {
                add_title_law = saxon_elective_succession_law
            }
        }
        every_independent_ruler = {
            limit = {
                culture = { has_cultural_parameter = scandinavian_elective_enabled }
                highest_held_title_tier >= tier_duchy
                OR = {
                    has_government = feudal_government
                    has_government = tribal_government
                }
            }
            this.primary_title = {
                add_title_law = scandinavian_elective_succession_law
            }
        }
    }
	
}

MB_add_syncretic_doctrines = {

    effect = {
        every_religion_global = {
			every_faith = {
		
            ## Syncretism Fix
				# Add True Faith
				if = {
					limit = { 
						NOR = { 
							has_doctrine = tenet_eastern_syncretism
							has_doctrine = tenet_unreformed_syncretism
							has_doctrine = tenet_christian_syncretism
							has_doctrine = tenet_islamic_syncretism
							has_doctrine = tenet_jewish_syncretism
							has_doctrine = tenet_no_syncretism
							has_doctrine = tenet_pantheon_syncretism #ZGC #TROME
						} 
					}
					add_doctrine = tenet_no_syncretism
				}

				## Add adaptive to all syncretic faiths that are pluralistic
				#else_if = {
				#	limit = {
				#		OR = {
				#			has_doctrine = tenet_eastern_syncretism
				#			has_doctrine = tenet_unreformed_syncretism
				#			has_doctrine = tenet_christian_syncretism
				#			has_doctrine = tenet_islamic_syncretism
				#			has_doctrine = tenet_jewish_syncretism
				#		}
				#		has_doctrine = doctrine_pluralism_pluralistic
				#		NOT = { has_doctrine = tenet_adaptive }
				#
				#		# I can't find if there's any script that's along the lines of 'ignore faiths that have 3 tenets already' so I'll just add the ones that give errors here to make the errors go away
				#
				#		NOR = {
				#			this = faith:muism
				#			this = faith:jatisunda
				#			this = faith:kapitayan
				#			this = faith:javanist
				#			this = faith:azhaliism
				#			this = faith:dongba
				#			this = faith:old_bon
				#			this = faith:bon
				#		}
				#
				#	}
				#	add_doctrine = tenet_adaptive
				#}

			}
		}
	}
}

#Various contract and obligation settings
MB_contracts = {

    effect = {
	
        if = {
			limit = {
				game_start_date >= 760.1.1
			}
			title:k_yamato.holder ?= {
				every_vassal = {
					limit = { has_government = feudal_government highest_held_title_tier >= tier_county vassal_contract_has_modifiable_obligations = yes }
					vassal_contract_set_obligation_level = {
						type = title_revocation_rights
						level = 1
					}
					vassal_contract_set_obligation_level = {
						type = feudal_government_taxes
						level = 0
					}
					vassal_contract_set_obligation_level = {
						type = feudal_government_levies
						level = 0
					}
				}
			}
		}
		#Scandinavia - Primarily to represent that Norway and Swedens Kings had a bit less power until later centralization
		if = {
			limit = {
				game_start_date >= 936.1.1
				game_start_date <= 1215.1.1
			}
			title:k_norway.holder ?= {
				every_vassal = {
					limit = { has_government = feudal_government highest_held_title_tier >= tier_county vassal_contract_has_modifiable_obligations = yes }
					vassal_contract_set_obligation_level = {
						type = title_revocation_rights
						level = 1
					}
					vassal_contract_set_obligation_level = {
						type = feudal_government_taxes
						level = 1
					}
					vassal_contract_set_obligation_level = {
						type = feudal_government_levies
						level = 1
					}
				}
			}
		}
		if = {
			limit = {
				game_start_date >= 990.1.1
				game_start_date <= 1300.1.1
			}
			title:k_sweden.holder ?= {
				every_vassal = {
					limit = { has_government = feudal_government highest_held_title_tier >= tier_county vassal_contract_has_modifiable_obligations = yes }
					vassal_contract_set_obligation_level = {
						type = title_revocation_rights
						level = 1
					}
					vassal_contract_set_obligation_level = {
						type = feudal_government_taxes
						level = 1
					}
					vassal_contract_set_obligation_level = {
						type = feudal_government_levies
						level = 1
					}
				}
			}
		}
		if = {
			limit = {
				game_start_date >= 867.1.1
			}
			title:k_sweden.holder ?= {
				every_vassal = {
					limit = { has_government = feudal_government highest_held_title_tier >= tier_county vassal_contract_has_modifiable_obligations = yes }
					vassal_contract_set_obligation_level = {
						type = feudal_government_taxes
						level = 1
					}
					vassal_contract_set_obligation_level = {
						type = feudal_government_levies
						level = 1
					}
				}
			}
		}
		# To represent the clan-based society being less centralized till later in the period
		if = {
			limit = {
				game_start_date >= 867.1.1
				game_start_date <= 1330.1.1
			}
			title:k_scotland.holder ?= {
				every_vassal = {
					limit = { has_government = feudal_government highest_held_title_tier >= tier_county vassal_contract_has_modifiable_obligations = yes }
					vassal_contract_set_obligation_level = {
						type = feudal_government_taxes
						level = 1
					}
					vassal_contract_set_obligation_level = {
						type = feudal_government_levies
						level = 1
					}
				}
			}
		}
		#Poland during the Fragmentation. Making the duchies de facto independent would just result in the larger neighbors conquering Poland so these effects can be used to strengthen the duchies
		if = {
			limit = {
				game_start_date >= 1138.1.1
				game_start_date <= 1320.1.1
			}
			title:k_poland.holder ?= {
				every_vassal = {
					limit = { has_government = feudal_government highest_held_title_tier >= tier_duchy vassal_contract_has_modifiable_obligations = yes }
					vassal_contract_set_obligation_level = {
						type = title_revocation_rights
						level = 1
					}
					vassal_contract_set_obligation_level = {
						type = feudal_government_taxes
						level = 0
					}
					vassal_contract_set_obligation_level = {
						type = feudal_government_levies
						level = 0
					}
				}
			}
		}
		
		#It feels like it wouldn't be wrong to empower the ducal titles in France as well
		if = {
			limit = {
				game_start_date >= 1000.1.1
			}
			title:k_france.holder ?= {
				every_vassal = {
					limit = { has_government = feudal_government highest_held_title_tier >= tier_duchy vassal_contract_has_modifiable_obligations = yes }
					vassal_contract_set_obligation_level = {
						type = title_revocation_rights
						level = 1
					}
					vassal_contract_set_obligation_level = {
						type = feudal_government_taxes
						level = 0
					}
					vassal_contract_set_obligation_level = {
						type = feudal_government_levies
						level = 0
					}
				}
			}
		}
		
		#It feels like it wouldn't be wrong to empower the ducal titles in France as well
		if = {
			limit = {
				game_start_date >= 769.1.1
			}
			title:k_opolye.holder ?= {
				every_vassal = {
					limit = { has_government = feudal_government highest_held_title_tier >= tier_duchy vassal_contract_has_modifiable_obligations = yes }
					vassal_contract_set_obligation_level = {
						type = title_revocation_rights
						level = 1
					}
					vassal_contract_set_obligation_level = {
						type = feudal_government_taxes
						level = 0
					}
					vassal_contract_set_obligation_level = {
						type = feudal_government_levies
						level = 0
					}
				}
			}
		}
		
		#Weaken Kyiv Rus' control over its vassals
		if = {
			limit = {
				game_start_date >= 880.1.1
				game_start_date <= 1239.1.1
			}
			title:k_ruthenia.holder ?= {
				every_vassal = {
					limit = { has_government = feudal_government highest_held_title_tier >= tier_duchy vassal_contract_has_modifiable_obligations = yes }
					vassal_contract_set_obligation_level = {
						type = feudal_government_taxes
						level = 1
					}
					vassal_contract_set_obligation_level = {
						type = feudal_government_levies
						level = 1
					}
				}
			}
		}
		
		#Weaken Vladimirs control over its vassals
		if = {
			limit = {
				game_start_date >= 1165.1.1
			}
			title:k_opolye.holder ?= {
				every_vassal = {
					limit = { has_government = feudal_government highest_held_title_tier >= tier_duchy vassal_contract_has_modifiable_obligations = yes }
					vassal_contract_set_obligation_level = {
						type = feudal_government_taxes
						level = 1
					}
					vassal_contract_set_obligation_level = {
						type = feudal_government_levies
						level = 1
					}
				}
			}
		}
		
		#Same as the ERE
		if = {
			limit = {
				game_start_date >= 990.1.1
			}
			title:e_hre.holder ?= {
				every_vassal = {
					limit = { has_government = feudal_government highest_held_title_tier >= tier_duchy vassal_contract_has_modifiable_obligations = yes }
					vassal_contract_set_obligation_level = {
						type = feudal_government_taxes
						level = 1
					}
					vassal_contract_set_obligation_level = {
						type = feudal_government_levies
						level = 1
					}
				}
			}
		}

		#Same thing with the Kara Khitai and their Qarluq subjects
		if = {
			limit = {
				game_start_date >= 1157.1.1
				game_start_date <= 1220.1.1
				#vassal_contract_has_modifiable_obligations = yes
			}
			title:k_transoxiana.holder ?= {
				vassal_contract_set_obligation_level = {
					type = religious_rights
					level = 1
				}
				vassal_contract_set_obligation_level = {
					type = title_revocation_rights
					level = 1
				}
			}
			title:d_kashgar.holder ?= {
				vassal_contract_set_obligation_level = {
					type = religious_rights
					level = 1
				}
				vassal_contract_set_obligation_level = {
					type = title_revocation_rights
					level = 1
				}
			}
			title:d_khotan.holder ?= {
				vassal_contract_set_obligation_level = {
					type = religious_rights
					level = 1
				}
				vassal_contract_set_obligation_level = {
					type = title_revocation_rights
					level = 1
				}
			}
		}
		
		#Admin Government Vassals
		
			#0 = Balanced		- Purely gameplay. Will attempt to avoid this
			#1 = Civilian		- All themes had both civil and military functions. However, this category could represent themes in more settled, interior regions of the empire that had less military pressure.
			#2 = Military		- Represent the standard land-based themes that formed the core of the Byzantine defensive system. Most themes would fall into this category.
			#3 = Frontier		- Represents themes on the empire's borders that had a more militarized structure. Examples might include the themes of Charsianon or Mesopotamia. Not a historical themata but has a gameplay purpose
			#4 = Imperial		- The imperial themes were those directly under the emperor's control, often including Constantinople and its surroundings. CK3 only allows 1
			#5 = Naval			- Historically Cibyrrhaeot, Aegean Sea, Samos (9th Century), Sicily, Krete (after 961), Cephalonia, and Dyrrhachium
		
		if = {
			limit = {
				game_start_date >= 769.1.1
				game_start_date <= 770.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
			#Lot of duchies in this period were not actual themata and some duchies should be completely excluded such as Sardinia, Mallorca, and Dalmatia
			title:d_sicily.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_dyrrachion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cephalonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_achaia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_athens.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_aegean_islands.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_cibyrrhaeot.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_anatolia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cappadocia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_charsianon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_coloneia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_armeniac.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_paphlagonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_bucellaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_krete.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
		}
		
		if = {
			limit = {
				game_start_date >= 867.1.1
				game_start_date <= 868.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
		
			title:d_sicily.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_calabria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cephalonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_achaia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_athens.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_aegean_islands.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cibyrrhaeot.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_anatolia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cappadocia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_charsianon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_coloneia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_sebasteia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_armeniac.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_paphlagonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_bucellaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_dalmatia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 936.1.1
				game_start_date <= 937.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
		
			title:d_apulia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_cephalonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_achaia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_athens.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
		
			title:d_aegean_islands.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_cibyrrhaeot.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_seleucia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_anatolia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cappadocia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_charsianon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_coloneia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_armeniac.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_bucellaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 997.1.1
				game_start_date <= 998.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
		
			title:d_apulia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_cephalonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_achaia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_athens.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}

			title:d_aegean_islands.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_cibyrrhaeot.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_seleucia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_cyprus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_anatolia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cappadocia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_charsianon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_coloneia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_antioch.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_sebasteia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_dzopk.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_melitene.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_armeniac.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_paphlagonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_bucellaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_krete.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1018.1.1
				game_start_date <= 1019.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
		
			title:d_apulia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_dyrrachion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cephalonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_achaia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_athens.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_aegean_islands.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_cibyrrhaeot.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_seleucia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_cyprus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_anatolia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cappadocia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_charsianon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_coloneia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_antioch.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_sebasteia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_dzopk.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_armeniac.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_paphlagonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_bucellaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_krete.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_elbistan.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_mesopotamia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_turnovo.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_bulgaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_syrmia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_duklja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1031.1.1
				game_start_date <= 1032.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
		
			title:d_apulia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_dyrrachion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cephalonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_achaia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_athens.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_aegean_islands.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_cibyrrhaeot.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_seleucia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_cyprus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_anatolia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cappadocia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_charsianon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_coloneia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_antioch.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_sebasteia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_dzopk.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_armeniac.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_paphlagonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_bucellaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_krete.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_elbistan.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_mesopotamia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_turnovo.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_bulgaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_syrmia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_usora.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_vaspurakan.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_duklja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_edessa.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		if = {
			limit = {
				game_start_date >= 1066.1.1
				game_start_date <= 1067.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				#

				#liege = {
				#	title:e_byzantium
				#}
				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_dyrrachion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cephalonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_achaia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_athens.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_aegean_islands.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_cibyrrhaeot.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_seleucia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_cyprus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_anatolia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cappadocia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_charsianon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_coloneia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_antioch.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_sebasteia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_dzopk.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_melitene.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_armeniac.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_paphlagonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_bucellaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_krete.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_elbistan.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_mesopotamia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_turnovo.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_bulgaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_syrmia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_taron.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_vaspurakan.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_edessa.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1081.1.1
				game_start_date <= 1082.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_dyrrachion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cephalonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_achaia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_athens.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_aegean_islands.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_cibyrrhaeot.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_cyprus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_krete.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_turnovo.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_bulgaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1099.1.1
				game_start_date <= 1100.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_dyrrachion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cephalonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_achaia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_athens.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_aegean_islands.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_cibyrrhaeot.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_seleucia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cyprus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}

			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_krete.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_turnovo.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_bulgaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_duklja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_rashka.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1124.1.1
				game_start_date <= 1125.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_dyrrachion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cephalonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_achaia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_athens.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_aegean_islands.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_cibyrrhaeot.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_seleucia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cyprus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_krete.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_turnovo.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_bulgaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_duklja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_rashka.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1144.1.1
				game_start_date <= 1145.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_dyrrachion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cephalonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_achaia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_athens.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_aegean_islands.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_cibyrrhaeot.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_seleucia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cyprus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_paphlagonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_krete.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_turnovo.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_bulgaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_dobrudja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_duklja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_rashka.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1157.1.1
				game_start_date <= 1158.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_dyrrachion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cephalonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_achaia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_athens.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_aegean_islands.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_cibyrrhaeot.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_seleucia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cyprus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_paphlagonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_krete.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_turnovo.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_bulgaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_dobrudja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_syrmia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_duklja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_rashka.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		if = {
			limit = {
				game_start_date >= 1166.1.1
				game_start_date <= 1167.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_dyrrachion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cephalonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_achaia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_athens.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_aegean_islands.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_cibyrrhaeot.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_seleucia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cyprus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_paphlagonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_krete.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_turnovo.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_bulgaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_dobrudja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_vidin.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_duklja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_rashka.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_bosna.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_dalmatia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1171.1.1
				game_start_date <= 1172.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_dyrrachion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cephalonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_achaia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_athens.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_aegean_islands.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_cibyrrhaeot.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_seleucia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cyprus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}

			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_paphlagonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}

			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_krete.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_turnovo.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_bulgaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_dobrudja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_vidin.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_duklja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_rashka.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_bosna.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_dalmatia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1178.1.1
				game_start_date <= 1179.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_dyrrachion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cephalonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_achaia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_athens.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_aegean_islands.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_cibyrrhaeot.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_seleucia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cyprus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_paphlagonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_krete.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_turnovo.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_bulgaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_dobrudja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_vidin.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_duklja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_rashka.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_bosna.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_dalmatia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1187.1.1
				game_start_date <= 1188.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_dyrrachion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cephalonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_achaia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_athens.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_aegean_islands.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_cibyrrhaeot.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_seleucia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_paphlagonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_krete.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_bulgaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_dobrudja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_vidin.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1194.1.1
				game_start_date <= 1195.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_dyrrachion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cephalonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_achaia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_athens.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_aegean_islands.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_cibyrrhaeot.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
			title:d_seleucia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_paphlagonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}

			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_krete.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}

			title:d_bulgaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_dobrudja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_vidin.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		#Themata no longer exists at this point but whatever
		if = {
			limit = {
				game_start_date >= 1204.1.1
				game_start_date <= 1205.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}

			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}

			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}

			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1211.1.1
				game_start_date <= 1212.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes
				
				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}

			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
		
			title:d_paphlagonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_bucellaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1220.1.1
				game_start_date <= 1221.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}

			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_bucellaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1234.1.1
				game_start_date <= 1235.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}

			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}

			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}

			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_bucellaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1246.1.1
				game_start_date <= 1247.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_bucellaria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1258.1.1
				game_start_date <= 1259.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1267.1.1
				game_start_date <= 1268.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}

			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}

			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
		
			title:d_paphlagonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1286.1.1
				game_start_date <= 1287.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
		
			title:d_paphlagonia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1295.1.1
				game_start_date <= 1296.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1300.1.1
				game_start_date <= 1301.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}

			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_ephese.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thracesia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1310.1.1
				game_start_date <= 1311.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessaly.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1324.1.1
				game_start_date <= 1325.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_opsikion.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_optimatoi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 1337.1.1
				game_start_date <= 1338.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
			
			title:d_epirus.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
			title:d_thessalonika.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_strymon.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
			title:d_philippopolis.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_chaldia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
			title:d_cherson.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
		
		
		#Song Dynasty
		
		
		#0 = Balanced		
		#1 = Civilian		
		#2 = Military		
		#3 = Frontier		
		#4 = Imperial		
		#5 = Naval

		
		#Northern Song
		if = {
			limit = {
				game_start_date >= 997.1.1
				game_start_date <= 1143.1.1 #Jin conquest of north China
				
				has_dlc_feature = roads_to_power
				

			
				#vassal_contract_has_modifiable_obligations = yes
				
			}
			
			title:k_yongxingjun_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_youzhou_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:k_qinfeng.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:k_hebeidong.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:k_hebeixi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:k_hedong_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:k_lizhou.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:k_chengdufu.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:k_zizhou.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:k_kuizhou.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:k_jingxi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 4
				}
			}
			title:k_jinghubei.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:k_jingdongxi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:k_huainandong.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:k_jiangnandong_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1	
				}
			}
			title:k_liangzhe.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:k_fujian.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:k_jiangnanxi_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:k_guangnandong.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:k_jinghunan.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:k_guangnanxi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			
		}
				
				
		if = { #Southern Song
			limit = {
				game_start_date >= 1144.1.1 #Post Jin Conquest
				game_start_date <= 1233.1.1 #Start of Mongol conquest
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
		
			title:d_longnan_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_hanzhong_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_dongchuan_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_xichuan_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:d_luzhou_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_ningjiang_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_jingxiang_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_jingnan_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_hunan_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_guiguan_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_lingnan_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:d_jiangxi_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:d_fujian_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:d_huaixi_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_huainan_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_xuanshe_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:d_zhedong_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:d_tohchen_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_malgal_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:d_xarmoron_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
		}
		
		if = { #Southern Song
			limit = {
				game_start_date >= 1246.1.1 #Post Jin Conquest
				game_start_date <= 1279.3.19 #Fall of Song
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
		
			title:d_luzhou_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_ningjiang_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_jingxiang_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_jingnan_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_hunan_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_guiguan_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_lingnan_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:d_jiangxi_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:d_fujian_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:d_huaixi_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_huainan_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_xuanshe_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:d_zhedong_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
		}
		
		#Yuan
		if = {
			limit = {
				game_start_date >= 1286
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
			
			#Feel like a military 'themata' makes the most sense for all of China given how the Mongols ruled (and how it eventually lead to their downfall)
			title:d_eyue_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_jiangxi_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_zhexi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_xichuan_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_biansong_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_xijing_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_liangzhou.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:d_shuofang_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:d_xiazhou_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:d_hezhong_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_hedong_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_chengde_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_weibo_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_ziqing_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:k_goguryeo_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_liaoxi_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:d_rangnang_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:d_xarmoron_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:d_liaoxi_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:d_pucao_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			
		}
		
		#Goryeo
		if = {
			limit = {
				game_start_date >= 997.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
		
			title:d_baekje.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:d_gaya.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:d_sila.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:d_dongya.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_goguryeo.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			
		}
		
		
		#Dai Viet
		if = {
			limit = {
				game_start_date >= 997.1.1
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
		
			title:d_hai_dong.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_cuu_chan.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:d_cu_duc.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_muong.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_son_tay.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
		}
		
		
		#Xi Xia
		if = {
			limit = {
				game_start_date >= 1038.1.1
				game_start_date <= 1227.2.1 #Mongol conquest
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
		
			title:d_xiazhou_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_ordos_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_wuluhai.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_shuofang_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_liangzhou.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_ganzhou.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:d_yijinai.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_guiyi.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			
		}
		
		
		#Jin
		if = {
			limit = {
				game_start_date >= 1124.1.1
				game_start_date <= 1143.2.9 #Mongol conquest
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
		
			title:k_goguryeo_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:k_yinshan_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

		}
		
		if = {
			limit = {
				game_start_date >= 1144.1.1
				game_start_date <= 1234.2.9 #Mongol conquest
				
				has_dlc_feature = roads_to_power
				
				#vassal_contract_has_modifiable_obligations = yes

				
			}
		
			title:k_goguryeo_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:k_yinshan_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

			title:d_youzhou_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:d_hedong_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_chengde_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 1
				}
			}
			title:d_ziqing_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 5
				}
			}
			title:d_taining_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_biansong_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_hezhong_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_xijing_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_fufang_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 2
				}
			}
			title:d_binning_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}
			title:d_longxi_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = administrative_themes
					level = 3
				}
			}

		}
		
		#Marches and Palatinates
		
		#For earlier dates I need to do this by exact date rather than more broad dates due to more common border changes
		
		#Special Contracts
		#level = 1 - Scutage
		#level = 2 - March
		#level = 3 - Palatinate
		
		
		
		if = {
			limit = {
				game_start_date >= 769.1.1
				game_start_date <= 770.1.1
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}
			
			#title:e_arabia.holder ?= {
			#every_vassal = {
			#		limit = {
			#			government_has_flag = government_is_feudal
			#			vassal_contract_has_modifiable_obligations = yes
			#		}
			#		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 = religious_rights level = 1 }
			#		set_vassal_contract_modification_blocked = no
			#	}
			#}
		
			title:d_toulouse.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_thuringia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

		}
		
		if = {
			limit = {
				game_start_date >= 867.1.1
				game_start_date <= 869.1.1
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}
			title:d_toulouse.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_barcelona.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_thuringia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_anhalt.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_anjou.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_beja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_toledo.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_cilicia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

		}
		
		if = {
			limit = {
				game_start_date >= 936.8.7
				game_start_date <= 950.8.7
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_thuringia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_saxon_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_oberbayern.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_anjou.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_badajoz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_toledo.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

		}
		
		if = {
			limit = {
				game_start_date >= 997.7.1
				game_start_date <= 1000.7.1
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_anhalt.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_toscana.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_porto.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_cantabria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_verona.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_anjou.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_badajoz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_zaragoza.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_toledo.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_provence.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

		}
		
		if = {
			limit = {
				game_start_date >= 1018.8.1
				game_start_date <= 1050.8.1
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_carinthia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_toscana.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_verona.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_porto.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_cantabria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_badajoz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_zaragoza.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_toledo.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_provence.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

		}
		
		if = {
			limit = {
				game_start_date >= 1066.1.1
				game_start_date <= 1066.12.31
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_carinthia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_krain.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_toscana.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			#title:d_friuli.holder ?= {
			#	vassal_contract_set_obligation_level = {
			#		type = special_contract
			#		level = 2
			#	}
			#}
			title:d_verona.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_porto.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_provence.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

		}
		
		if = {
			limit = {
				game_start_date >= 1081.1.1
				game_start_date <= 1081.12.31
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_carinthia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_krain.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_toscana.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_verona.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_provence.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
		

		}
		
		if = {
			limit = {
				game_start_date >= 1099.1.1
				game_start_date <= 1099.12.31
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_carinthia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_krain.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_toscana.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_porto.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_provence.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_morgannwg.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			#I'm not sure if the Almohads or Almoravids used 'marches' in Andalusia like the Umayyads did but for gameplay purposes I think it's fine
			title:d_beja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_badajoz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_la_mancha.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
		

		}
		
		if = {
			limit = {
				game_start_date >= 1124.1.1
				game_start_date <= 1124.12.31
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_carinthia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_krain.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_toscana.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_porto.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_morgannwg.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_slesvig.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
		

		}
		
		if = {
			limit = {
				game_start_date >= 1144.1.1
				game_start_date <= 1144.12.31
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_carinthia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_krain.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_toscana.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_morgannwg.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_provence.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
		

		}
		
		if = {
			limit = {
				game_start_date >= 1157.1.1
				game_start_date <= 1166.12.31
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_carinthia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_krain.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_toscana.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_morgannwg.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_provence.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_badajoz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_cordoba.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_transylvania.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_pfalz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 3
				}
			}
			
			title:d_mae_si.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_mahasay.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nakhon_phanom.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

		}
		
		if = {
			limit = {
				game_start_date >= 1171.1.1
				game_start_date <= 1178.12.31
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_carinthia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_krain.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_toscana.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_morgannwg.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ireland_lordship.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_provence.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_auvergne.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_teruel.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_beja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_la_mancha.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_badajoz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_cordoba.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_algarve.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_transylvania.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_slesvig.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_pfalz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 3
				}
			}
			
			title:d_artsakh.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_suenik.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_tao-klarjeti.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_zhetysu.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_oultrejourdain.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_mae_si.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_mahasay.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nakhon_phanom.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

		}
		
		if = {
			limit = {
				game_start_date >= 1187.1.1
				game_start_date <= 1195.12.31
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_carinthia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_krain.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_steyermark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_morgannwg.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ireland_lordship.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_provence.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_teruel.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_beja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_la_mancha.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_badajoz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_cordoba.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_algarve.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_murcia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_valencia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_transylvania.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_slesvig.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_pfalz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 3
				}
			}
			
			title:d_mae_si.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_mahasay.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nakhon_phanom.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

		}
		
		if = {
			limit = {
				game_start_date >= 1204.1.1
				game_start_date <= 1212.12.31
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_carinthia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_krain.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_steyermark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_istria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_morgannwg.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ireland_lordship.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_provence.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_teruel.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_beja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_la_mancha.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_badajoz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_cordoba.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_algarve.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_murcia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_valencia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_transylvania.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_slesvig.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_rangnang_china.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_pfalz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 3
				}
			}
			
			title:d_mae_si.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_mahasay.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nakhon_phanom.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

		}
		
		if = {
			limit = {
				game_start_date >= 1220.1.1
				game_start_date <= 1220.12.31
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_carinthia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_krain.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_steyermark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_istria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_morgannwg.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ireland_lordship.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_provence.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_teruel.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_beja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_la_mancha.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_badajoz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_cordoba.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_algarve.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_murcia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_valencia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_transylvania.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_slesvig.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_pfalz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 3
				}
			}
			
			title:d_mae_si.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_mahasay.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nakhon_phanom.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

		}
		
		if = {
			limit = {
				game_start_date >= 1234.1.1
				game_start_date <= 1234.12.31
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_carinthia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_krain.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_steyermark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_istria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_morgannwg.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ireland_lordship.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_provence.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_teruel.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_beja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_la_mancha.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_badajoz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_transylvania.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_walishtan.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_slesvig.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_pfalz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 3
				}
			}
			
			title:d_mae_si.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_mahasay.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nakhon_phanom.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

		}
		
		if = {
			limit = {
				game_start_date >= 1246.1.1
				game_start_date <= 1258.12.31
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_carinthia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_krain.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_steyermark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_istria.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_morgannwg.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ireland_lordship.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_provence.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_teruel.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_beja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_la_mancha.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_badajoz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_valencia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_muntenia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_oltenia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_walishtan.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_slesvig.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_pfalz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 3
				}
			}
			
			title:d_battambang.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_sambhupura.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_can_tho.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
		}
		
		if = {
			limit = {
				game_start_date >= 1267.1.1
				game_start_date <= 1267.12.31
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_carinthia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_krain.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_steyermark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_morgannwg.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ireland_lordship.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_beja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_la_mancha.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_badajoz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_muntenia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_oltenia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_slesvig.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_pfalz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 3
				}
			}
			
			title:d_battambang.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_sambhupura.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_can_tho.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

		}
		
		
		if = {
			limit = {
				game_start_date >= 1286.1.1
				game_start_date <= 1300.12.31
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_carinthia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_krain.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_steyermark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_morgannwg.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ireland_lordship.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_beja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_la_mancha.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_badajoz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_transylvania.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_slesvig.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_pfalz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 3
				}
			}
			
			title:d_battambang.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_sambhupura.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_can_tho.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

		}
		
		if = {
			limit = {
				game_start_date >= 1305.1.1
				game_start_date <= 1330.12.31
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_carinthia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_krain.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_steyermark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_morgannwg.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ireland_lordship.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_beja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_la_mancha.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_badajoz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_transylvania.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_slesvig.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_pfalz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 3
				}
			}
			
			title:d_battambang.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_sambhupura.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_can_tho.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

		}
		
		if = {
			limit = {
				game_start_date >= 1337.1.1
				game_start_date <= 1340.12.31
				
				#vassal_contract_has_modifiable_obligations = yes
				exists = holder
				
			}

			title:d_lausitz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_meissen.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ostmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordgau.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_nordmark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_carinthia.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_krain.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_steyermark.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

			title:d_friuli.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_morgannwg.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_ireland_lordship.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_beja.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_la_mancha.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_badajoz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_transylvania.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_slesvig.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			
			title:d_pfalz.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 3
				}
			}
			
			title:d_battambang.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_sambhupura.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}
			title:d_can_tho.holder ?= {
				vassal_contract_set_obligation_level = {
					type = special_contract
					level = 2
				}
			}

		}
    }
	
}

MB_set_catholic_doctrines = {

	effect = {
		
		#Removes the doctrine that hides historical religions from earlier dates. This doctrine is also removed by decision in said earlier dates
		
		if = {
				limit = { 
					game_start_date >= 1211.1.1
				}
				faith:serbian_orthodox = { remove_doctrine = unavailable_doctrine }
		}
		
		if = {
				limit = { 
					game_start_date >= 1211.1.1
				}
				faith:vlach_orthodox = { remove_doctrine = unavailable_doctrine }
		}
		
		#if = {
		#		limit = { 
		#			game_start_date >= 950.1.1
		#		}
		#		faith:slavic_orthodox = { remove_doctrine = unavailable_doctrine }
		#}
		
		if = {
				limit = { 
					game_start_date >= 866.1.1
				}
				faith:bulgarian_orthodox = { remove_doctrine = unavailable_doctrine }
		}
		
		faith:bohemian_catholic = {
			if = {
				limit = { game_start_date >= 1066.9.15 } #Suppressed
				add_doctrine = unavailable_doctrine
			}
		}
	}
	
}

MB_set_ablution_doctrines = {
	
	effect = {
	
		#This effect is for the ablution doctrines from ME. The doctrines were only assigned to islamic faiths but in reality could be applied to many others
		
		if = {
			limit = { # Double-check to make certain this has not already happened
				NOT = { exists = global_var:me_flag_add_doctrine }	
			}
		} #This bracket is missing in ME
		set_global_variable = { # Add global variable to prevent this from happening more than once
			name = me_flag_add_doctrine
			value = yes
		}
		every_religion_global = {
			every_faith = {
				## Add intoxication crime doctrine to faiths
				if = {
					limit = { 
						NOR = { 
							religion_tag = islam_religion
							religion_tag = alb_religion
							#this = faith:zurvanism # Behafardism
							this = faith:sabianism
						} 
					}
					add_doctrine = doctrine_me_intoxication_accepted
				}
				else_if = {
					limit = { 
						OR = {
							NOR = {
								religion_tag = islam_religion
								religion_tag = alb_religion
							}
							this = faith:sabianism
							this = faith:zurvanism
						} 
					}
					add_doctrine = doctrine_me_intoxication_shunned
				}
#				else_if = { #Placeholder incase it is needed to give a faith the crime doctine
#					limit = { 
#						OR = { 
#						} 
#					}
#					add_doctrine = doctrine_me_intoxication_crime
#				}
#				else_if = { #Placeholder incase it is needed to give a faith the virtuous doctine
#					limit = { 
#						OR = { 
#						} 
#					}
#					add_doctrine = doctrine_me_intoxication_virtuous
#				}

				## Add Ablution doctrine to faiths
				if = {
					limit = { 
						NOR = { 
							religion_tag = islam_religion
							religion_tag = alb_religion
							religion_tag = judaism_religion
							religion_tag = sampsaeism_religion
							religion_tag = christianity_religion # Christianity - Christians practiced ablution in the middle ages with the Cantharus. In Western Christianity it slowly turned into the holy water font over the time period though ablution still occurred
							religion_tag = shinto_religion
							religion_tag = baltic_religion
							religion_tag = germanic_religion
							religion_tag = finno_ugric_religion
							religion_tag = slavic_religion
							this = faith:ethiopian_orthodox
							this = faith:nubian_orthodox
							this = faith:coptic
						} 
					}
					add_doctrine = doctrine_me_ablution_none
				}
				
				#Base Map
				
				else_if = { # Jewish Handwashing
					limit = { religion_tag = judaism_religion }
					add_doctrine = doctrine_me_ablution_handwashing
				}
				else_if = { # Mandaean Rishama
					limit = { religion_tag = sampsaeism_religion }
					add_doctrine = doctrine_me_ablution_full
				}
				#Bathhouses/Saunas were pretty common in these regions even during pagan times
				else_if = { # Baltic Paganmism
					limit = { religion_tag = baltic_religion }
					add_doctrine = doctrine_me_ablution_full
				}
				else_if = { # Germanic Paganmism
					limit = { religion_tag = germanic_religion }
					add_doctrine = doctrine_me_ablution_full
				}
				else_if = { # Balto-Finnic Paganmism
					limit = { religion_tag = finno_ugric_religion }
					add_doctrine = doctrine_me_ablution_full
				}
				else_if = { # Slavic Paganmism
					limit = { religion_tag = slavic_religion }
					add_doctrine = doctrine_me_ablution_full
				}
				
				
				#Asia
				
				
				else_if = { # Japan
					limit = { religion_tag = shinto_religion }
					add_doctrine = doctrine_me_ablution_full
				}
			}
		}
	}
	
}


MB_set_noble_families = {

	effect = {
		
		#This effect sets noble families in admin governments. This does mean unlanded families that may be important do not get made noble families but that's an acceptable tradeoff given the performance impact unlanded characters have. Unlanded characters also apparently impact the development of wherever they are 'unlanded' which, for example, made Constantinople have 100+ development
	
			##ERE
	
			if = {
				limit = {
					game_start_date >= 769.1.1
					game_start_date <= 1203.1.1
				}
				title:e_byzantium.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_county
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			if = {
				limit = {
					game_start_date >= 1260.1.1
				}
				title:e_byzantium.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_county
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			if = {
				limit = {
					exists = title:e_byzantium.holder
					has_dlc_feature = roads_to_power
				}
				title:e_byzantium.holder = {
					create_noble_family_effect = yes
				}
			}
			if = {
				limit = {
					game_start_date >= 1204.1.1
				}
				title:k_epirus.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_county
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			if = {
				limit = {
					exists = title:k_epirus.holder
					has_dlc_feature = roads_to_power
				}
				title:k_epirus.holder = {
					create_noble_family_effect = yes
				}
			}
			if = {
				limit = {
					game_start_date >= 1204.1.1
					game_start_date <= 1260.1.1
				}
				title:k_nikaea.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_county
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			if = {
				limit = {
					exists = title:k_nikaea.holder
					has_dlc_feature = roads_to_power
				}
				title:k_nikaea.holder = {
					create_noble_family_effect = yes
				}
			}
			if = {
				limit = {
					game_start_date >= 1204.1.1
				}
				title:k_trebizond.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_county
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			if = {
				limit = {
					exists = title:k_trebizond.holder
					has_dlc_feature = roads_to_power
				} 
				title:k_trebizond.holder = {
					create_noble_family_effect = yes
				}
			}
			
			#Dai Viet
			
			if = {
				limit = {
					exists = title:e_dai_viet.holder
					has_dlc_feature = roads_to_power
				}
				title:e_dai_viet.holder = {
					create_noble_family_effect = yes
				}
			}
			if = {
				limit = {
					exists = title:e_dai_viet.holder
				}
				title:e_dai_viet.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_duchy
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			
			#Goryeo
			
			if = {
				limit = {
					game_start_date >= 997.1.1
					exists = title:k_goryeo.holder
					has_dlc_feature = roads_to_power
					
				}
				title:k_goryeo.holder = {
					create_noble_family_effect = yes
				}
			}
			if = {
				limit = {
					exists = title:k_goryeo.holder
				}
				title:k_goryeo.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_duchy
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			
			#China
			
			if = {
				limit = {
					exists = title:e_han.holder
					game_start_date = 936.8.7
				}
				title:e_han.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_duchy
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			if = {
				limit = {
					exists = title:e_min.holder
					game_start_date = 936.8.7
				}
				title:e_min.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_duchy
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			if = {
				limit = {
					exists = title:k_chu_china.holder
					game_start_date = 936.8.7
				}
				title:k_chu_china.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_duchy
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			if = {
				limit = {
					exists = title:k_wu_china.holder
					game_start_date = 936.8.7
				}
				title:k_wu_china.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_duchy
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			if = {
				limit = {
					exists = title:e_shu.holder
					game_start_date = 936.8.7
				}
				title:e_shu.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_duchy
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			if = {
				limit = {
					exists = title:k_jin_china.holder
					game_start_date = 936.8.7
				}
				title:k_jin_china.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_duchy
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			if = {
				limit = {
					exists = title:k_xia_china.holder
				}
				title:k_xia_china.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_duchy
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			if = {
				limit = {
					exists = title:k_xia.holder
					game_start_date >= 850.1.1
				}
				title:k_xia.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_duchy
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			if = {
				limit = {
					exists = title:k_yue_china.holder
				}
				title:k_yue_china.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_county
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			if = {
				limit = {
					exists = title:k_jinghai.holder
					game_start_date >= 850.1.1
				}
				title:k_jinghai.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_duchy
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			if = {
				limit = {
					exists = title:e_celestia_china.holder
				}
				title:e_celestia_china.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_duchy
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			if = {
				limit = {
					exists = title:e_wu.holder
					has_dlc_feature = roads_to_power
				}
				title:e_wu.holder = {
					create_noble_family_effect = yes
				}
			}
			if = {
				limit = {
					exists = title:k_yue_china.holder
					has_dlc_feature = roads_to_power
				}
				title:k_yue_china.holder = {
					create_noble_family_effect = yes
				}
			}
			if = {
				limit = {
					exists = title:e_min.holder
					has_dlc_feature = roads_to_power
				}
				title:e_min.holder = {
					create_noble_family_effect = yes
				}
			}
			if = {
				limit = {
					exists = title:e_han.holder
					has_dlc_feature = roads_to_power
				}
				title:e_han.holder = {
					create_noble_family_effect = yes
				}
			}
			if = {
				limit = {
					exists = title:k_chu_china.holder
					has_dlc_feature = roads_to_power
				}
				title:k_chu_china.holder = {
					create_noble_family_effect = yes
				}
			}
			if = {
				limit = {
					exists = title:e_shu.holder
					has_dlc_feature = roads_to_power
				}
				title:e_shu.holder = {
					create_noble_family_effect = yes
				}
			}
			if = {
				limit = {
					exists = title:k_xia_china.holder
					has_dlc_feature = roads_to_power
				}
				title:k_xia_china.holder = {
					create_noble_family_effect = yes
				}
			}
			if = {
				limit = {
					exists = title:k_xia.holder
					has_dlc_feature = roads_to_power
				}
				title:k_xia.holder = {
					create_noble_family_effect = yes
				}
			}
			if = {
				limit = {
					exists = title:k_jin_china.holder
					has_dlc_feature = roads_to_power
				}
				title:k_jin_china.holder = {
					create_noble_family_effect = yes
				}
			}
			if = {
				limit = {
					exists = title:k_jinghai.holder
					has_dlc_feature = roads_to_power
				}
				title:k_jinghai.holder = {
					create_noble_family_effect = yes
				}
			}
			if = {
				limit = {
					exists = title:e_celestia_china.holder
					game_start_date >= 850.1.1
					has_dlc_feature = roads_to_power
				}
				title:e_celestia_china.holder = {
					create_noble_family_effect = yes
				}
			}
			
			#Jin
			
			if = {
				limit = {
					exists = title:e_jurchen_china.holder
				}
				title:e_jurchen_china.holder ?= {
					every_vassal = {
						limit = {
							highest_held_title_tier >= tier_duchy
							has_government = administrative_government
							has_dlc_feature = roads_to_power
							is_house_head = yes
						}
						create_noble_family_effect = yes
					}
				}
			}
			if = {
				limit = {
					exists = title:e_jurchen_china.holder
					has_dlc_feature = roads_to_power
				}
				title:e_jurchen_china.holder = {
					create_noble_family_effect = yes
				}
			}	
	}
	
}

MB_set_clan_unity = {

	effect = {
	
	########################################################################################### UNITY CONFIG ###########################################################################################
		#Only going to do this for major families that held 'Kingdoms' for a length of time or Empires
		
		## Ayyubids
		if = {
			limit = { game_start_date >= 1171.1.1 game_start_date <= 1172.1.1 }
			house:house_Ayyubid ?= {
				add_unity_value = {
					value = 60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1178.1.1 game_start_date <= 1179.1.1 }
			house:house_Ayyubid ?= {
				add_unity_value = {
					value = 85
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1187.1.1 game_start_date <= 1188.1.1 }
			house:house_Ayyubid ?= {
				add_unity_value = {
					value = 95
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1194.1.1 game_start_date <= 1195.1.1 }
			house:house_Ayyubid ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1204.1.1 game_start_date <= 1205.1.1 }
			house:house_Ayyubid ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1211.1.1 game_start_date <= 1212.1.1 }
			house:house_Ayyubid ?= {
				add_unity_value = {
					value = 30
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1220.1.1 game_start_date <= 1221.1.1 }
			house:house_Ayyubid ?= {
				add_unity_value = {
					value = 20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1234.1.1 game_start_date <= 1235.1.1 }
			house:house_Ayyubid ?= {
				add_unity_value = {
					value = 10
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1258.1.1 game_start_date <= 1259.1.1 }
			house:house_Ayyubid ?= {
				add_unity_value = {
					value = -20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1267.1.1 game_start_date <= 1268.1.1 }
			house:house_Ayyubid ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1286.1.1 game_start_date <= 1287.1.1 }
			house:house_Ayyubid ?= {
				add_unity_value = {
					value = -60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1300.1.1 }
			house:house_Ayyubid ?= {
				add_unity_value = {
					value = -80
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Abbasids
		if = {
			limit = { game_start_date >= 769.1.1 game_start_date <= 770.1.1 }
			house:house_abbasid ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 867.1.1 game_start_date <= 868.1.1 }
			house:house_abbasid ?= {
				add_unity_value = {
					value = -20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 936.1.1 game_start_date <= 937.1.1 }
			house:house_abbasid ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 997.1.1 game_start_date <= 998.1.1 }
			house:house_abbasid ?= {
				add_unity_value = {
					value = -10
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1018.1.1 game_start_date <= 1032.1.1 }
			house:house_abbasid ?= {
				add_unity_value = {
					value = 0
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1066.1.1 game_start_date <= 1082.1.1 }
			house:house_abbasid ?= {
				add_unity_value = {
					value = 20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1099.1.1 game_start_date <= 1125.1.1 }
			house:house_abbasid ?= {
				add_unity_value = {
					value = 30
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1141.1.1 game_start_date <= 1167.1.1 }
			house:house_abbasid ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1171.1.1 game_start_date <= 1195.1.1 }
			house:house_abbasid ?= {
				add_unity_value = {
					value = 35
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1204.1.1 game_start_date <= 1235.1.1 }
			house:house_abbasid ?= {
				add_unity_value = {
					value = 25
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1246.1.1 game_start_date <= 1259.1.1 }
			house:house_abbasid ?= {
				add_unity_value = {
					value = 15
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Seljuks
		if = {
			limit = { game_start_date >= 1031.1.1 game_start_date <= 1032.1.1 }
			house:house_oghuzSeljuks ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1066.1.1 game_start_date <= 1067.1.1 }
			house:house_oghuzSeljuks ?= {
				add_unity_value = {
					value = 85
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1081.1.1 game_start_date <= 1082.1.1 }
			house:house_oghuzSeljuks ?= {
				add_unity_value = {
					value = 60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1099.1.1 game_start_date <= 1100.1.1 }
			house:house_oghuzSeljuks ?= {
				add_unity_value = {
					value = -10
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1124.1.1 game_start_date <= 1125.1.1 }
			house:house_oghuzSeljuks ?= {
				add_unity_value = {
					value = -30
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1141.1.1 game_start_date <= 1142.1.1 }
			house:house_oghuzSeljuks ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1166.1.1 game_start_date <= 1167.1.1 }
			house:house_oghuzSeljuks ?= {
				add_unity_value = {
					value = -60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1171.1.1 game_start_date <= 1195.1.1 }
			house:house_oghuzSeljuks ?= {
				add_unity_value = {
					value = -70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1204.1.1 game_start_date <= 1221.1.1 }
			house:house_oghuzSeljuks ?= {
				add_unity_value = {
					value = -80
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1234.1.1 game_start_date <= 1235.1.1 }
			house:house_oghuzSeljuks ?= {
				add_unity_value = {
					value = -85
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1246.1.1 game_start_date <= 1247.1.1 }
			house:house_oghuzSeljuks ?= {
				add_unity_value = {
					value = -90
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1258.1.1 game_start_date <= 1259.1.1 }
			house:house_oghuzSeljuks ?= {
				add_unity_value = {
					value = -95
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1267.1.1 }
			house:house_oghuzSeljuks ?= {
				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
				}
			}
		}
		## Anushtiginlar
		if = {
			limit = { game_start_date >= 1099.1.1 game_start_date <= 1100.1.1 }
			house:house_anushtigar ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1124.1.1 game_start_date <= 1125.1.1 }
			house:house_anushtigar ?= {
				add_unity_value = {
					value = 65
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1141.1.1 game_start_date <= 1142.1.1 }
			house:house_anushtigar ?= {
				add_unity_value = {
					value = 75
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1166.1.1 game_start_date <= 1167.1.1 }
			house:house_anushtigar ?= {
				add_unity_value = {
					value = 80
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1171.1.1 game_start_date <= 1172.1.1 }
			house:house_anushtigar ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1194.1.1 game_start_date <= 1195.1.1 }
			house:house_anushtigar ?= {
				add_unity_value = {
					value = 85
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1204.1.1 game_start_date <= 1205.1.1 }
			house:house_anushtigar ?= {
				add_unity_value = {
					value = 90
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1211.1.1 game_start_date <= 1212.1.1 }
			house:house_anushtigar ?= {
				add_unity_value = {
					value = 75
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1220.1.1 game_start_date <= 1221.1.1 }
			house:house_anushtigar ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1234.1.1 }
			house:house_anushtigar ?= {
				add_unity_value = {
					value = -80
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Ghurids
		if = {
			limit = { game_start_date >= 997.1.1 game_start_date <= 998.1.1 }
			dynasty:791.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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1018.1.1 game_start_date <= 1032.1.1 }
			dynasty:791.dynast.house ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1066.1.1 game_start_date <= 1082.1.1 }
			dynasty:791.dynast.house ?= {
				add_unity_value = {
					value = 45
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1099.1.1 game_start_date <= 1142.1.1 }
			dynasty:791.dynast.house ?= {
				add_unity_value = {
					value = 60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1166.1.1 game_start_date <= 1167.1.1 }
			dynasty:791.dynast.house ?= {
				add_unity_value = {
					value = 85
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1171.1.1 game_start_date <= 1172.1.1 }
			dynasty:791.dynast.house ?= {
				add_unity_value = {
					value = 90
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1194.1.1 game_start_date <= 1195.1.1 }
			dynasty:791.dynast.house ?= {
				add_unity_value = {
					value = 85
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1204.1.1 game_start_date <= 1205.1.1 }
			dynasty:791.dynast.house ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1211.1.1 game_start_date <= 1212.1.1 }
			dynasty:791.dynast.house ?= {
				add_unity_value = {
					value = -20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1220.1.1 }
			dynasty:791.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
				}
			}
		}
		## Delhi
		if = {
			limit = { game_start_date >= 1211.1.1 game_start_date <= 1212.1.1 }
			dynasty:1040202.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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1220.1.1 game_start_date <= 1221.1.1 }
			dynasty:1040202.dynast.house ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1234.1.1 game_start_date <= 1235.1.1 }
			dynasty:1040202.dynast.house ?= {
				add_unity_value = {
					value = -30
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1246.1.1 game_start_date <= 1247.1.1 }
			dynasty:1040202.dynast.house ?= {
				add_unity_value = {
					value = 60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1258.1.1 game_start_date <= 1259.1.1 }
			dynasty:1040202.dynast.house ?= {
				add_unity_value = {
					value = 65
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		
		if = {
			limit = { game_start_date >= 1200.1.1 game_start_date <= 1268.1.1 }
			dynasty:1040204.dynast.house ?= {
				add_unity_value = {
					value = 75
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1286.1.1 game_start_date <= 1287.1.1 }
			dynasty:1040204.dynast.house ?= {
				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
				}
			}
		}
		
		if = {
			limit = { game_start_date >= 1200.1.1 game_start_date <= 1290.1.1 }
			dynasty:1040205.dynast.house ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1300.1.1 game_start_date <= 1301.1.1 }
			dynasty:1040205.dynast.house ?= {
				add_unity_value = {
					value = 80
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1310.1.1 game_start_date <= 1311.1.1 }
			dynasty:1040205.dynast.house ?= {
				add_unity_value = {
					value = 85
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1311.1.1 }
			dynasty:1040205.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
				}
			}
		}
		
		
		if = {
			limit = { game_start_date >= 1255.1.1 game_start_date <= 1336.1.1 }
			dynasty:1040208.dynast.house ?= {
				add_unity_value = {
					value = 30
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1337.1.1 }
			dynasty:1040208.dynast.house ?= {
				add_unity_value = {
					value = 65
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Mamluks
		if = {
			limit = { game_start_date >= 1250.1.1 game_start_date <= 1259.1.1 }
			dynasty:7268.dynast.house ?= {
				add_unity_value = {
					value = 65
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		
		if = {
			limit = { game_start_date >= 1250.1.1 game_start_date <= 1268.1.1 }
			dynasty:7267.dynast.house ?= {
				add_unity_value = {
					value = 80
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1277.1.1 game_start_date <= 1290.1.1 }
			dynasty:7267.dynast.house ?= {
				add_unity_value = {
					value = -90
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		
		if = {
			limit = { game_start_date >= 1286.1.1 game_start_date <= 1287.1.1 }
			dynasty:762.dynast.house ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1300.1.1 game_start_date <= 1301.1.1 }
			dynasty:762.dynast.house ?= {
				add_unity_value = {
					value = 75
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1310.1.1 game_start_date <= 1336.1.1 }
			dynasty:762.dynast.house ?= {
				add_unity_value = {
					value = 85
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1337.1.1 }
			dynasty:762.dynast.house ?= {
				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
				}
			}
		}
		## Almohads
		if = {
			limit = { game_start_date >= 1166.1.1 game_start_date <= 1167.1.1 }
			house:house_almohads ?= {
				add_unity_value = {
					value = 85
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1171.1.1 game_start_date <= 1172.1.1 }
			house:house_almohads ?= {
				add_unity_value = {
					value = 80
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1178.1.1 game_start_date <= 1188.1.1 }
			house:house_almohads ?= {
				add_unity_value = {
					value = 75
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1194.1.1 game_start_date <= 1195.1.1 }
			house:house_almohads ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1204.1.1 game_start_date <= 1205.1.1 }
			house:house_almohads ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1211.1.1 game_start_date <= 1212.1.1 }
			house:house_almohads ?= {
				add_unity_value = {
					value = 20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1220.1.1 game_start_date <= 1221.1.1 }
			house:house_almohads ?= {
				add_unity_value = {
					value = 0
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1234.1.1 game_start_date <= 1235.1.1 }
			house:house_almohads ?= {
				add_unity_value = {
					value = -30
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1246.1.1 game_start_date <= 1247.1.1 }
			house:house_almohads ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1258.1.1 }
			house:house_almohads ?= {
				add_unity_value = {
					value = -70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Marinids
		if = {
			limit = { game_start_date >= 1166.1.1 game_start_date <= 1188.1.1 }
			house:house_marinids ?= {
				add_unity_value = {
					value = 45
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1194.1.1 game_start_date <= 1195.1.1 }
			house:house_marinids ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1204.1.1 game_start_date <= 1205.1.1 }
			house:house_marinids ?= {
				add_unity_value = {
					value = 60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1211.1.1 game_start_date <= 1212.1.1 }
			house:house_marinids ?= {
				add_unity_value = {
					value = 65
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1220.1.1 game_start_date <= 1221.1.1 }
			house:house_marinids ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1234.1.1 game_start_date <= 1235.1.1 }
			house:house_marinids ?= {
				add_unity_value = {
					value = 75
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1246.1.1 game_start_date <= 1247.1.1 }
			house:house_marinids ?= {
				add_unity_value = {
					value = 85
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1258.1.1 game_start_date <= 1259.1.1 }
			house:house_marinids ?= {
				add_unity_value = {
					value = 80
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1267.1.1 game_start_date <= 1268.1.1 }
			house:house_marinids ?= {
				add_unity_value = {
					value = 75
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1286.1.1 game_start_date <= 1301.1.1 }
			house:house_marinids ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1310.1.1 }
			house:house_marinids ?= {
				add_unity_value = {
					value = 65
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Zayyanids
		if = {
			limit = { game_start_date >= 1211.1.1 game_start_date <= 1212.1.1 }
			house:house_zayyanids ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1220.1.1 game_start_date <= 1221.1.1 }
			house:house_zayyanids ?= {
				add_unity_value = {
					value = 55
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1234.1.1 game_start_date <= 1235.1.1 }
			house:house_zayyanids ?= {
				add_unity_value = {
					value = 65
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1246.1.1 game_start_date <= 1247.1.1 }
			house:house_zayyanids ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1258.1.1 game_start_date <= 1259.1.1 }
			house:house_zayyanids ?= {
				add_unity_value = {
					value = 65
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1267.1.1 game_start_date <= 1268.1.1 }
			house:house_zayyanids ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1286.1.1 game_start_date <= 1287.1.1 }
			house:house_zayyanids ?= {
				add_unity_value = {
					value = 45
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1300.1.1 game_start_date <= 1301.1.1 }
			house:house_zayyanids ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1310.1.1 }
			house:house_zayyanids ?= {
				add_unity_value = {
					value = 35
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Hafsids
		if = {
			limit = { game_start_date >= 1166.1.1 game_start_date <= 1188.1.1 }
			house:house_hafsids ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1194.1.1 game_start_date <= 1195.1.1 }
			house:house_hafsids ?= {
				add_unity_value = {
					value = 45
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1204.1.1 game_start_date <= 1205.1.1 }
			house:house_hafsids ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1211.1.1 game_start_date <= 1212.1.1 }
			house:house_hafsids ?= {
				add_unity_value = {
					value = 60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1220.1.1 game_start_date <= 1221.1.1 }
			house:house_hafsids ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1234.1.1 game_start_date <= 1235.1.1 }
			house:house_hafsids ?= {
				add_unity_value = {
					value = 80
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1246.1.1 game_start_date <= 1247.1.1 }
			house:house_hafsids ?= {
				add_unity_value = {
					value = 85
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1258.1.1 game_start_date <= 1259.1.1 }
			house:house_hafsids ?= {
				add_unity_value = {
					value = 75
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1267.1.1 game_start_date <= 1268.1.1 }
			house:house_hafsids ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1286.1.1 game_start_date <= 1287.1.1 }
			house:house_hafsids ?= {
				add_unity_value = {
					value = 60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1300.1.1 }
			house:house_hafsids ?= {
				add_unity_value = {
					value = 55
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Rasulids
		if = {
			limit = { game_start_date >= 1210.1.1 game_start_date <= 1221.1.1 }
			dynasty:139.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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1234.1.1 game_start_date <= 1235.1.1 }
			dynasty:139.dynast.house ?= {
				add_unity_value = {
					value = 65
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1246.1.1 game_start_date <= 1247.1.1 }
			dynasty:139.dynast.house ?= {
				add_unity_value = {
					value = 80
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1258.1.1 game_start_date <= 1259.1.1 }
			dynasty:139.dynast.house ?= {
				add_unity_value = {
					value = 85
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1267.1.1 game_start_date <= 1268.1.1 }
			dynasty:139.dynast.house ?= {
				add_unity_value = {
					value = 80
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1286.1.1 game_start_date <= 1287.1.1 }
			dynasty:139.dynast.house ?= {
				add_unity_value = {
					value = 75
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1300.1.1 game_start_date <= 1301.1.1 }
			dynasty:139.dynast.house ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1310.1.1 }
			dynasty:139.dynast.house ?= {
				add_unity_value = {
					value = 65
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Nahbanids
		if = {
			limit = { game_start_date >= 1145.1.1 game_start_date <= 1188.1.1 }
			house:house_nahbani ?= {
				add_unity_value = {
					value = 35
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1194.1.1 game_start_date <= 1195.1.1 }
			house:house_nahbani ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1204.1.1 game_start_date <= 1212.1.1 }
			house:house_nahbani ?= {
				add_unity_value = {
					value = 45
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1220.1.1 game_start_date <= 1221.1.1 }
			house:house_nahbani ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1234.1.1 game_start_date <= 1247.1.1 }
			house:house_nahbani ?= {
				add_unity_value = {
					value = 45
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1258.1.1 game_start_date <= 1268.1.1 }
			house:house_nahbani ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1286.1.1 }
			house:house_nahbani ?= {
				add_unity_value = {
					value = 35
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Nasri
		if = {
			limit = { game_start_date >= 1210.1.1 game_start_date <= 1211.1.1 }
			dynasty:101904.dynast.house ?= {
				add_unity_value = {
					value = 45
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1220.1.1 game_start_date <= 1221.1.1 }
			dynasty:101904.dynast.house ?= {
				add_unity_value = {
					value = 55
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1234.1.1 game_start_date <= 1235.1.1 }
			dynasty:101904.dynast.house ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1246.1.1 game_start_date <= 1247.1.1 }
			dynasty:101904.dynast.house ?= {
				add_unity_value = {
					value = 75
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1258.1.1 game_start_date <= 1259.1.1 }
			dynasty:101904.dynast.house ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1267.1.1 game_start_date <= 1268.1.1 }
			dynasty:101904.dynast.house ?= {
				add_unity_value = {
					value = 75
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1286.1.1 game_start_date <= 1287.1.1 }
			dynasty:101904.dynast.house ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1300.1.1 game_start_date <= 1301.1.1 }
			dynasty:101904.dynast.house ?= {
				add_unity_value = {
					value = 65
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1310.1.1 }
			dynasty:101904.dynast.house ?= {
				add_unity_value = {
					value = 60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Ilkhan
		if = {
			limit = { game_start_date >= 1300.1.1 game_start_date <= 1301.1.1 }
			house:house_Toluid ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1310.1.1 game_start_date <= 1311.1.1 }
			house:house_Toluid ?= {
				add_unity_value = {
					value = 60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1337.1.1 }
			house:house_Toluid ?= {
				add_unity_value = {
					value = -30
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Golden Horde
		if = {
			limit = { game_start_date >= 1315.1.1 }
			house:house_Jochid ?= {
				add_unity_value = {
					value = -20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Ottomans
		if = {
			limit = { game_start_date >= 1260.1.1 game_start_date <= 1301.1.1 }
			house:house_oghuzqayi ?= {
				add_unity_value = {
					value = 60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1310.1.1 game_start_date <= 1311.1.1 }
			house:house_oghuzqayi ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1337.1.1 }
			house:house_oghuzqayi ?= {
				add_unity_value = {
					value = 75
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Kartids
		if = {
			limit = { game_start_date >= 1211.1.1 game_start_date <= 1212.1.1 }
			house:house_Kartid ?= {
				add_unity_value = {
					value = 45
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1220.1.1 game_start_date <= 1221.1.1 }
			house:house_Kartid ?= {
				add_unity_value = {
					value = 35
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1234.1.1 game_start_date <= 1235.1.1 }
			house:house_Kartid ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1246.1.1 game_start_date <= 1247.1.1 }
			house:house_Kartid ?= {
				add_unity_value = {
					value = 60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1258.1.1 game_start_date <= 1259.1.1 }
			house:house_Kartid ?= {
				add_unity_value = {
					value = 65
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1267.1.1 game_start_date <= 1287.1.1 }
			house:house_Kartid ?= {
				add_unity_value = {
					value = 60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1300.1.1 game_start_date <= 1301.1.1 }
			house:house_Kartid ?= {
				add_unity_value = {
					value = 55
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1310.1.1 }
			house:house_Kartid ?= {
				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
				}
			}
		}
		## Mihrabanids
		if = {
			limit = { game_start_date >= 1211.1.1 game_start_date <= 1212.1.1 }
			house:house_mihrabani ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1220.1.1 game_start_date <= 1221.1.1 }
			house:house_mihrabani ?= {
				add_unity_value = {
					value = 30
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1234.1.1 game_start_date <= 1235.1.1 }
			house:house_mihrabani ?= {
				add_unity_value = {
					value = 45
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1246.1.1 game_start_date <= 1247.1.1 }
			house:house_mihrabani ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1258.1.1 game_start_date <= 1259.1.1 }
			house:house_mihrabani ?= {
				add_unity_value = {
					value = 55
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1267.1.1 game_start_date <= 1287.1.1 }
			house:house_mihrabani ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1300.1.1 game_start_date <= 1301.1.1 }
			house:house_mihrabani ?= {
				add_unity_value = {
					value = 45
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1310.1.1 }
			house:house_mihrabani ?= {
				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
				}
			}
		}
		## Bahmanids
		if = {
			limit = { game_start_date >= 1337.1.1 }
			dynasty:12334.dynast.house ?= {
				add_unity_value = {
					value = 75
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Multanids
		if = {
			limit = { game_start_date >= 1337.1.1 }
			dynasty:1044389.dynast.house ?= {
				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
				}
			}
		}
		## Madurai
		if = {
			limit = { game_start_date >= 1337.1.1 }
			dynasty:ahsan_shah.dynast.house ?= {
				add_unity_value = {
					value = 35
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Soomra
		if = {
			limit = { game_start_date >= 1018.1.1 game_start_date <= 1032.1.1 }
			dynasty:1042163.dynast.house ?= {
				add_unity_value = {
					value = 45
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1066.1.1 game_start_date <= 1082.1.1 }
			dynasty:1042163.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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1099.1.1 game_start_date <= 1125.1.1 }
			dynasty:1042163.dynast.house ?= {
				add_unity_value = {
					value = 55
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1141.1.1 game_start_date <= 1167.1.1 }
			dynasty:1042163.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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1171.1.1 game_start_date <= 1195.1.1 }
			dynasty:1042163.dynast.house ?= {
				add_unity_value = {
					value = 45
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1204.1.1 game_start_date <= 1235.1.1 }
			dynasty:1042163.dynast.house ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1246.1.1 game_start_date <= 1287.1.1 }
			dynasty:1042163.dynast.house ?= {
				add_unity_value = {
					value = 35
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1300.1.1 }
			dynasty:1042163.dynast.house ?= {
				add_unity_value = {
					value = 30
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Samma
		if = {
			limit = { game_start_date >= 1200.1.1 }
			dynasty:1042086.dynast.house ?= {
				add_unity_value = {
					value = 45
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Fatimids
		if = {
			limit = { game_start_date >= 936.1.1 game_start_date <= 937.1.1 }
			house:house_Fatimid ?= {
				add_unity_value = {
					value = 65
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 997.1.1 game_start_date <= 998.1.1 }
			house:house_Fatimid ?= {
				add_unity_value = {
					value = 85
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1018.1.1 game_start_date <= 1019.1.1 }
			house:house_Fatimid ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1031.1.1 game_start_date <= 1032.1.1 }
			house:house_Fatimid ?= {
				add_unity_value = {
					value = 60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1066.1.1 game_start_date <= 1067.1.1 }
			house:house_Fatimid ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1081.1.1 game_start_date <= 1082.1.1 }
			house:house_Fatimid ?= {
				add_unity_value = {
					value = -20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1099.1.1 game_start_date <= 1100.1.1 }
			house:house_Fatimid ?= {
				add_unity_value = {
					value = 0
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1124.1.1 game_start_date <= 1215.1.1 }
			house:house_Fatimid ?= {
				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
				}
			}
		}
		## Ghaznavids
		if = {
			limit = { game_start_date >= 997.1.1 game_start_date <= 998.1.1 }
			dynasty:790.dynast.house ?= {
				add_unity_value = {
					value = 80
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1018.1.1 game_start_date <= 1019.1.1 }
			dynasty:790.dynast.house ?= {
				add_unity_value = {
					value = 90
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1031.1.1 game_start_date <= 1032.1.1 }
			dynasty:790.dynast.house ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1066.1.1 game_start_date <= 1067.1.1 }
			dynasty:790.dynast.house ?= {
				add_unity_value = {
					value = 20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1081.1.1 game_start_date <= 1082.1.1 }
			dynasty:790.dynast.house ?= {
				add_unity_value = {
					value = 0
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1099.1.1 game_start_date <= 1175.1.1 }
			dynasty:790.dynast.house ?= {
				add_unity_value = {
					value = -20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Almoravids
		if = {
			limit = { game_start_date >= 1031.1.1 game_start_date <= 1032.1.1 }
			house:house_almoravid ?= {
				add_unity_value = {
					value = 60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1066.1.1 game_start_date <= 1067.1.1 }
			house:house_almoravid ?= {
				add_unity_value = {
					value = 75
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1081.1.1 game_start_date <= 1082.1.1 }
			house:house_almoravid ?= {
				add_unity_value = {
					value = 85
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1099.1.1 game_start_date <= 1100.1.1 }
			house:house_almoravid ?= {
				add_unity_value = {
					value = 80
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1124.1.1 game_start_date <= 1125.1.1 }
			house:house_almoravid ?= {
				add_unity_value = {
					value = 30
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1141.1.1 game_start_date <= 1142.1.1 }
			house:house_almoravid ?= {
				add_unity_value = {
					value = -20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1147.1.1 }
			house:house_almoravid ?= {
				add_unity_value = {
					value = -60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Zirids
		if = {
			limit = { game_start_date >= 997.1.1 game_start_date <= 998.1.1 }
			house:house_zirid ?= {
				add_unity_value = {
					value = 70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1018.1.1 game_start_date <= 1019.1.1 }
			house:house_zirid ?= {
				add_unity_value = {
					value = 65
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1031.1.1 game_start_date <= 1032.1.1 }
			house:house_zirid ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1066.1.1 game_start_date <= 1067.1.1 }
			house:house_zirid ?= {
				add_unity_value = {
					value = -30
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1081.1.1 game_start_date <= 1082.1.1 }
			house:house_zirid ?= {
				add_unity_value = {
					value = -20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1099.1.1 }
			house:house_zirid ?= {
				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
				}
			}
		}
		## Zengids
		if = {
			limit = { game_start_date >= 1099.1.1 game_start_date <= 1100.1.1 }
			dynasty:101687.dynast.house ?= {
				add_unity_value = {
					value = 65
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1124.1.1 game_start_date <= 1125.1.1 }
			dynasty:101687.dynast.house ?= {
				add_unity_value = {
					value = 80
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1141.1.1 game_start_date <= 1142.1.1 }
			dynasty:101687.dynast.house ?= {
				add_unity_value = {
					value = 75
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1146.1.1 game_start_date <= 1167.1.1 }
			dynasty:101687.dynast.house ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1171.1.1 game_start_date <= 1172.1.1 }
			dynasty:101687.dynast.house ?= {
				add_unity_value = {
					value = 20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1178.1.1 game_start_date <= 1221.1.1 }
			dynasty:101687.dynast.house ?= {
				add_unity_value = {
					value = 0
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1220.1.1 }
			dynasty:101687.dynast.house ?= {
				add_unity_value = {
					value = -20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Zurayids
		if = {
			limit = { game_start_date >= 1099.1.1 game_start_date <= 1100.1.1 }
			dynasty:7503.dynast.house ?= {
				add_unity_value = {
					value = 60
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1124.1.1 game_start_date <= 1125.1.1 }
			dynasty:7503.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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1141.1.1 game_start_date <= 1142.1.1 }
			dynasty:7503.dynast.house ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1166.1.1 game_start_date <= 1174.1.1 }
			dynasty:7503.dynast.house ?= {
				add_unity_value = {
					value = -10
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Karakhanids
		if = {
			limit = { game_start_date >= 997.1.1 game_start_date <= 998.1.1 }
			house:house_karakhanid ?= {
				add_unity_value = {
					value = 20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1018.1.1 game_start_date <= 1019.1.1 }
			house:house_karakhanid ?= {
				add_unity_value = {
					value = 10
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1031.1.1 game_start_date <= 1032.1.1 }
			house:house_karakhanid ?= {
				add_unity_value = {
					value = 0
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1066.1.1 game_start_date <= 1067.1.1 }
			house:house_karakhanid ?= {
				add_unity_value = {
					value = -20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1081.1.1 game_start_date <= 1142.1.1 }
			house:house_karakhanid ?= {
				add_unity_value = {
					value = -30
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1143.1.1 game_start_date <= 1212.1.1 }
			house:house_karakhanid ?= {
				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
				}
			}
		}
		if = {
			limit = { game_start_date >= 1213.1.1 }
			house:house_karakhanid ?= {
				add_unity_value = {
					value = -70
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		## Banu Sulaym
		if = {
			limit = { game_start_date >= 1066.1.1 game_start_date <= 1067.1.1 }
			dynasty:101671.dynast.house ?= {
				add_unity_value = {
					value = 30
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1081.1.1 game_start_date <= 1082.1.1 }
			dynasty:101671.dynast.house ?= {
				add_unity_value = {
					value = 20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1099.1.1 game_start_date <= 1142.1.1 }
			dynasty:101671.dynast.house ?= {
				add_unity_value = {
					value = 10
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1143.1.1 game_start_date <= 1221.1.1 }
			dynasty:101671.dynast.house ?= {
				add_unity_value = {
					value = 0
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
		if = {
			limit = { game_start_date >= 1221.1.1 }
			dynasty:101671.dynast.house ?= {
				add_unity_value = {
					value = -20
					# This is from historical circumstances, so we just do use the house head.
					character = house_head
					desc = clan_unity_historical_circumstances.desc
				}
			}
		}
	}
	
}

MB_set_landless_adventurers = {

	effect = {
	
	########################################################################################### LANDLESS SETUP ###########################################################################################
		
		
		#camp_purpose_wanderers
		#camp_purpose_mercenaries
		#camp_purpose_scholars
		#camp_purpose_explorers
		#camp_purpose_brigands
		#camp_purpose_legitimists 
			
	#Main goal would be at least 1 of each type in every bookmark with ~2 in the most popular boomarks. Unlanded characters do come with a performance impact
		
	#769
		## Alcuin of York
			character:769Unlanded1 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					#add_realm_law_skip_effects = camp_purpose_wanderers #Apparently redundant as that's the default
				}
			}
		## Paul the Deacon
			character:769Unlanded2 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					#add_realm_law_skip_effects = camp_purpose_wanderers
				}
			}
		## Roland
			character:769Unlanded3 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
		## Turgeis
			character:769Unlanded4 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
		## Virgil of Salzburg
			character:769Unlanded5 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
			
	#997
		## Al-Biruni
			character:997Unlanded1 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
			
	#1066
		## Edgar
			character:112 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_legitimists
				}
			}
			
	#1099
		## Ghazali
			character:1099Unlanded1 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					#add_realm_law_skip_effects = camp_purpose_wanderers
				}
			}
		
	#1144
		## Abu Hamid al-Gharnati
			character:1144Unlanded1 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_explorers
				}
			}
		## Muhammad al-Idrisi
			character:1144Unlanded2 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_explorers
				}
			}
		
	#1171
		## William of Tyre
			character:1171Unlanded2 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					#add_realm_law_skip_effects = camp_purpose_wanderers
				}
			}
		## Fan Chengda
			character:1171Unlanded3 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					#add_realm_law_skip_effects = camp_purpose_wanderers
				}
			}
		## Fan Chengda
			character:204540 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
		## Minamoto no Yoshinaka
			character:10120084 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
		## Benkei
			character:12550060 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
		## Strongbow
			character:204770 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
		## Maimonides
			character:1171Unlanded4 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
		## Averroes
			character:1171Unlanded5 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
		## Benjamin of Tudela
			character:1171Unlanded1 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_explorers
				}
			}
		## Petachiah of Regensburg
			character:1171Unlanded6 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_explorers
				}
			}
		## Sverre
			character:202500 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_brigands
				}
			}
			
	#1211
		## Fakhr al-Din al-Razi
			character:1211Unlanded1 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					#add_realm_law_skip_effects = camp_purpose_wanderers
				}
			}
		## Eustace the Monk
			character:1211Unlanded2 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
		## Abd al-Latif al-Baghdadi
			character:1211Unlanded3 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
		## Jacques de Vitry
			character:1211Unlanded4 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
		## Zhao Rukuo
			character:1211Unlanded5 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_explorers
				}
			}
		## Martin Algais
			character:1211Unlanded6 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
			
	#1337
		## Montfort
			character:455755 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_legitimists
				}
			}
			
		## Ibn Battuta
			character:1337Unlanded1 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
		
		## William of Ockham
			character:1337Unlanded2 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
		## Hojo Tokiyuki
			character:10132313 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_legitimists
				}
			}
		## Werner von Urslingen
			character:213102M2 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
		## Arnaud de Cervole
			character:1337Unlanded3 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_mercenaries
				}
			}
		## Giovanni de' Marignolli
			character:1337Unlanded4 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_explorers
				}
			}
		## Hugh Calveley
			character:1337Unlanded5 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_brigands
				}
			}
		## Ibn Fadlallah al-Umari
			character:1337Unlanded6 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_explorers
				}
			}
			
		## Han Shantong
			character:1337Unlanded7 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_legitimists
				}
			}
		## Ming Yuzhen
			character:1337Unlanded9 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_legitimists
				}
			}
		## Chen Youliang
			character:1337Unlanded10 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_brigands
				}
			}
		## Fang Guozhen
			character:1337Unlanded11 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_brigands
				}
			}
		## Zhang Shicheng
			character:1337Unlanded12 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_wanderers
				}
			}
			
		## Zhao Zongpu
			character:zhuojun_zhao_612 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_legitimists
				}
			}
			
		## Petrarch
			character:214092 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_scholars
				}
			}
			
		## Cola di Rienzo
			character:1337Unlanded13 ?= {
				if = {
					limit = {
						is_alive = yes
						is_landless_adventurer = yes
					}
					add_realm_law_skip_effects = camp_purpose_legitimists
				}
			}

	}
	
}

MB_set_regencies = {

	effect = {
	
	########################################################################################### REGENCIES ###########################################################################################
		
		
		#936
		if = {
		
			limit = { game_start_date = 936.8.7 }
			
			
			## France
			character:90120 = { designate_diarch = character:6444 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:6444
				LIEGE = character:90120
			}
			
		}
		
		#1018
		if = {
		
			limit = { game_start_date = 1018.8.1 }
			
			
			## Portugal
			character:110530 = { designate_diarch = character:110634 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:110634
				LIEGE = character:110530
			}
			
			
		}
		
		#1031
		if = {
		
			limit = { game_start_date = 1031.11.30 }
		
			## Song
			character:217724 = { designate_diarch = character:huayang_liu_006 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:huayang_liu_006
				LIEGE = character:217724
			}
			
		}
		
		if = {
			limit = { exists = character:217724 }
			character:217724 = { trigger_event = diarchy.0012 }
		}
		
		#1081
		if = {
		
			limit = { game_start_date = 1081.4.1 }
		
			## Seljuk
			character:3042 = {
				designate_diarch = character:3050
				try_start_diarchy = vizierate
				set_variable = {
					name = my_vizier
					value = character:3042
				}
			}
		}
			
		if = {
			limit = { exists = character:3042 }
			character:3042 = { trigger_event = diarchy.0012 }
		}
		
		#1099
		if = {
		
			limit = { game_start_date = 1099.7.15 }
		
			## Fatimid
			character:3100 = {
				designate_diarch = character:34979
				try_start_diarchy = vizierate
				set_variable = {
					name = my_vizier
					value = character:34979
				}
			}
		}
			
		if = {
			limit = { exists = character:3100 }
			character:3100 = { trigger_event = diarchy.0012 }
		}
		
		#1124
		if = {
		
			limit = { game_start_date = 1124.7.7 }
			
			
			## Portugal
			character:209503 = { designate_diarch = character:207661 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:207661
				LIEGE = character:209503
			}
			
			## Japan
			character:10041053 = { designate_diarch = character:11000150 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:11000150
				LIEGE = character:10041053
			}
			
		}
		
		#1144
		if = {
		
			limit = { game_start_date = 1144.10.1 }
			
			## Hungary
			character:219510 = { designate_diarch = character:218511 }
		
			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:218511
				LIEGE = character:219510
			}
			
			### Fatimid
			#character:32905 = {
			#	designate_diarch = character:34979
			#	try_start_diarchy = vizierate
			#	set_variable = {
			#		name = my_vizier
			#		value = character:32905
			#	}
			#}
			
		}
		
		#1166
		if = {
		
			limit = { game_start_date = 1166.4.1 }
			
			
			## Khitai
			character:188912 = { designate_diarch = character:1413863 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:1413863
				LIEGE = character:188912
			}
			
			### Fatimid Caliphate 
			
			character:32910 = { designate_diarch = character:34982 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:34982
				LIEGE = character:32910
			}
			
			if = {
				limit = { exists = character:32910 }
				character:32910 = { trigger_event = diarchy.0012 }
			}
			character:32910 = {
				designate_diarch = character:34982
				try_start_diarchy = vizierate
				set_variable = {
					name = my_vizier
					value = character:34982
				}
			}
			
		}
		
		#1171
		if = {
		
			limit = { game_start_date = 1171.8.1 }
			
			
			## Aragon
			character:210500 = { designate_diarch = character:210507 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:210507
				LIEGE = character:210500
			}
			
			
			## Khitai
			character:188912 = { designate_diarch = character:188908 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:188908
				LIEGE = character:188912
			}
			
			### Khamag
			#character:125501 = { designate_diarch = character:Suldus1 }
			#
			#remove_generated_diarch_consequences_effect = {
			#	NEW_DIARCH = character:Suldus1
			#	LIEGE = character:125501
			#}
			
			## Southern Song
			character:zhuojun_zhao_545 = { designate_diarch = character:zhuojun_zhao_292 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:zhuojun_zhao_292
				LIEGE = character:zhuojun_zhao_545
			}
			
			if = {
				limit = { exists = character:zhuojun_zhao_545 }
				character:zhuojun_zhao_545 = { trigger_event = diarchy.0012 }
			}
		
			### Fatimid Caliphate 
			
			character:32910 = { designate_diarch = character:226000 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:226000
				LIEGE = character:32910
			}
			
			if = {
				limit = { exists = character:32910 }
				character:32910 = { trigger_event = diarchy.0012 }
			}
			character:32910 = {
				designate_diarch = character:226000
				try_start_diarchy = vizierate
				set_variable = {
					name = my_vizier
					value = character:226000
				}
			}
			
		}
		
		#1178
		if = {
		
			limit = { game_start_date = 1178.10.1 }
			
			
			## Jerusalem
			character:223523 = { designate_diarch = character:188908 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:188908
				LIEGE = character:223523
			}
			
		}
		
		#1194
		if = {
		
			limit = { game_start_date = 1194.9.30 }
			
			
			## England - Mom runs the realm during his many absences
			character:204510 = { designate_diarch = character:205730 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:205730
				LIEGE = character:204510
			}
			
		}
		if = {
				limit = { exists = character:204510 }
				character:204510 = { trigger_event = diarchy.0012 }
			}
		
		#1204
		if = {
		
			limit = { game_start_date = 1204.5.16 }
			

			## Kamakura Shogunate
			
			character:10120086 = { designate_diarch = character:10131650 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:10131650
				LIEGE = character:10120086
			}
			
			#Emperor
			character:10041061 = { designate_diarch = character:10041060 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:10041060
				LIEGE = character:10041061
			}
			
		}
		if = {
				limit = { exists = character:10041061 }
				character:10041061 = { trigger_event = diarchy.0012 }
			}
		if = {
				limit = { exists = character:10120086 }
				character:10120086 = { trigger_event = diarchy.0012 }
			}
		
		#1211
		if = {
		
			limit = { game_start_date = 1211.6.16 }
			
			
			#Thessalonika
			
			character:31346 = { designate_diarch = character:205528 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:205528
				LIEGE = character:31346
			}
			
			## Ghurids
			
			character:144143 = { designate_diarch = character:170302 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:170302
				LIEGE = character:144143
			}
			
			## Kamakura Shogunate
			
			character:10120087 = { designate_diarch = character:10131653 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:10131653
				LIEGE = character:10120087
			}
			
			#Emperor
			character:10041062 = { designate_diarch = character:10041060 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:10041060
				LIEGE = character:10041062
			}
			
		}
		if = {
				limit = { exists = character:10041062 }
				character:10041062 = { trigger_event = diarchy.0012 }
			}
		if = {
				limit = { exists = character:10120087 }
				character:10120087 = { trigger_event = diarchy.0012 }
			}
		if = {
				limit = { exists = character:144143 }
				character:144143 = { trigger_event = diarchy.0012 }
			}
		
		#1220
		if = {
		
			limit = { game_start_date = 1220.5.16 }
			
			
			## Kamakura Shogunate

			#Emperor
			character:10041062 = { designate_diarch = character:10041060 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:10041060
				LIEGE = character:10041062
			}
			
		}
		if = {
				limit = { exists = character:10041062 }
				character:10041062 = { trigger_event = diarchy.0012 }
			}
		
		#1258
		if = {
		
			limit = { game_start_date = 1258.2.15 }
			
			
			## Kamakura Shogunate

			#Emperor
			character:10041068 = { designate_diarch = character:10041067 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:10041067
				LIEGE = character:10041068
			}
			
		}
		if = {
				limit = { exists = character:10041068 }
				character:10041068 = { trigger_event = diarchy.0012 }
			}
		
		#1267
		if = {
		
			limit = { game_start_date = 1267.6.1 }
			
			
			#Delhi
			character:170201 = { designate_diarch = character:170204 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:170204
				LIEGE = character:170201
			}
			
			## Kamakura Shogunate

			#Emperor
			character:10041069 = { designate_diarch = character:10041068 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:10041068
				LIEGE = character:10041069
			}
			
		}
		if = {
				limit = { exists = character:10041069 }
				character:10041069 = { trigger_event = diarchy.0012 }
		}
		if = {
				limit = { exists = character:170201 }
				character:170201 = { trigger_event = diarchy.0012 }
		}
		
		#1300
		if = {
		
			limit = { game_start_date = 1300.9.10 }
			
			
			## Castile
			character:457520 = { designate_diarch = character:457666 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:457666
				LIEGE = character:457520
			}
			
			## Mamluks
			character:485000 = { designate_diarch = character:32940 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:32940
				LIEGE = character:485000
			}
			
		}
		
		#1337
		## Yuan Dynasty controlled by Empress Dowager
		if = {
		
			limit = { game_start_date = 1337.5.24 }
	
			## Yuan
			character:217284 = { designate_diarch = character:166862M29 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:166862M29
				LIEGE = character:217284
			}
			
		}
		if = {
			limit = { exists = character:217284 }
			character:217284 = { trigger_event = diarchy.0012 }
		}
		#Ilkhanate now dominated by the Jalayirids
		if = {
		
			limit = { game_start_date = 1337.5.24 }
			
			character:478030 = { designate_diarch = character:478040 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:478040
				LIEGE = character:478030
			}
			
		}
		if = {
			limit = { exists = character:478030 }
			character:478030 = { trigger_event = diarchy.0012 }
		}
		if = {
		
			limit = { game_start_date = 1337.5.24 }
			
			character:453500 = { designate_diarch = character:andrew_moray_regent }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:andrew_moray_regent
				LIEGE = character:453500
			}
			
		}
		
		#Korea Military Dictatorship 1170-1270
	
		if = {
		
			limit = { game_start_date = 1171.8.1 }
	
			## Goryeo
			character:1900755 = { designate_diarch = character:UiBang }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:UiBang
				LIEGE = character:1900755
			}
			
		}
		if = {
			limit = { exists = character:1900755 }
			character:1900755 = { trigger_event = diarchy.0012 }
		}
		
		if = {
		
			limit = { game_start_date = 1178.10.1 }
	
			## Goryeo
			character:1900755 = { designate_diarch = character:Chong0 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:Chong0
				LIEGE = character:1900755
			}
			
		}
		if = {
			limit = { exists = character:1900755 }
			character:1900755 = { trigger_event = diarchy.0012 }
		}
		
		if = {
		
			limit = { game_start_date = 1183.5.1 }
	
			## Goryeo
			character:1900755 = { designate_diarch = character:Kyong0 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:Kyong0
				LIEGE = character:1900755
			}
			
		}
		if = {
			limit = { exists = character:1900755 }
			character:1900755 = { trigger_event = diarchy.0012 }
		}
		
		if = {
		
			limit = { game_start_date = 1194.9.30 }
	
			## Goryeo
			character:1900755 = { designate_diarch = character:UiMin0 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:UiMin0
				LIEGE = character:1900755
			}
			
		}
		if = {
			limit = { exists = character:1900755 }
			character:1900755 = { trigger_event = diarchy.0012 }
		}
		
		if = {
		
			limit = { game_start_date = 1204.5.16 }
	
			## Goryeo
			character:1900783 = { designate_diarch = character:ChoeClan1 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:ChoeClan1
				LIEGE = character:1900783
			}
			
		}
		if = {
			limit = { exists = character:1900783 }
			character:1900783 = { trigger_event = diarchy.0012 }
		}
		
		if = {
		
			limit = { game_start_date = 1211.6.16 }
	
			## Goryeo
			character:1900783 = { designate_diarch = character:ChoeClan1 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:ChoeClan1
				LIEGE = character:1900783
			}
			
		}
		if = {
			limit = { exists = character:1900783 }
			character:1900783 = { trigger_event = diarchy.0012 }
		}
		
		if = {
		
			limit = { game_start_date = 1220.5.16 }
	
			## Goryeo
			character:gaeseong_wang_268 = { designate_diarch = character:ChoeClan2 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:ChoeClan2
				LIEGE = character:gaeseong_wang_268
			}
			
		}
		if = {
			limit = { exists = character:gaeseong_wang_268 }
			character:gaeseong_wang_268 = { trigger_event = diarchy.0012 }
		}
		
		if = {
		
			limit = { game_start_date = 1234.4.6 }
	
			## Goryeo
			character:gaeseong_wang_268 = { designate_diarch = character:ChoeClan2 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:ChoeClan2
				LIEGE = character:gaeseong_wang_268
			}
			
		}
		if = {
			limit = { exists = character:gaeseong_wang_268 }
			character:gaeseong_wang_268 = { trigger_event = diarchy.0012 }
		}
		
		if = {
		
			limit = { game_start_date = 1246.6.13 }
	
			## Goryeo
			character:gaeseong_wang_268 = { designate_diarch = character:ChoeClan2 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:ChoeClan2
				LIEGE = character:gaeseong_wang_268
			}
			
		}
		if = {
			limit = { exists = character:gaeseong_wang_268 }
			character:gaeseong_wang_268 = { trigger_event = diarchy.0012 }
		}
		
		if = {
		
			limit = { game_start_date = 1250.7.15 }
	
			## Goryeo
			character:gaeseong_wang_268 = { designate_diarch = character:ChoeClan3 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:ChoeClan3
				LIEGE = character:gaeseong_wang_268
			}
			
		}
		if = {
			limit = { exists = character:gaeseong_wang_268 }
			character:gaeseong_wang_268 = { trigger_event = diarchy.0012 }
		}
		
		if = {
		
			limit = { game_start_date = 1258.2.15 }
	
			## Goryeo
			character:gaeseong_wang_268 = { designate_diarch = character:KorKim1 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:KorKim1
				LIEGE = character:gaeseong_wang_268
			}
			
		}
		if = {
			limit = { exists = character:gaeseong_wang_268 }
			character:gaeseong_wang_268 = { trigger_event = diarchy.0012 }
		}
		
		if = {
		
			limit = { game_start_date = 1267.6.1 }
	
			## Goryeo
			character:gaeseong_wang_271 = { designate_diarch = character:KorKim1 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:KorKim1
				LIEGE = character:gaeseong_wang_271
			}
			
		}
		if = {
			limit = { exists = character:gaeseong_wang_271 }
			character:gaeseong_wang_271 = { trigger_event = diarchy.0012 }
		}
		
		
		#Japan
		
		
		if = {
		
			limit = { game_start_date >= 867.1.1 
					  game_start_date <= 868.1.1
			}
	
			character:10041034 = { designate_diarch = character:11000039 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:11000039
				LIEGE = character:10041034
			}
			
		}
		if = {
			limit = { exists = character:10041034 }
			character:10041034 = { trigger_event = diarchy.0012 }
		}
		
		if = {
		
			limit = { game_start_date >= 936.1.1 
					  game_start_date <= 937.1.1
			}
	
			character:10041039 = { designate_diarch = character:11000069 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:11000069
				LIEGE = character:10041039
			}
			
		}
		if = {
			limit = { exists = character:10041039 }
			character:10041039 = { trigger_event = diarchy.0012 }
		}
		
		if = {
		
			limit = { game_start_date >= 997.1.1 
					  game_start_date <= 998.1.1
			}
	
			character:10041044 = { designate_diarch = character:11000102 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:11000102
				LIEGE = character:10041044
			}
			
		}
		if = {
			limit = { exists = character:10041044 }
			character:10041044 = { trigger_event = diarchy.0012 }
		}
		
		if = {
		
			limit = { game_start_date >= 1018.1.1 
					  game_start_date <= 1019.1.1
			}
	
			character:10041046 = { designate_diarch = character:11000102 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:11000102
				LIEGE = character:10041046
			}
			
		}
		if = {
			limit = { exists = character:10041046 }
			character:10041046 = { trigger_event = diarchy.0012 }
		}
		
		if = {
		
			limit = { game_start_date >= 1031.1.1 
					  game_start_date <= 1032.1.1
			}
	
			character:10041046 = { designate_diarch = character:11000105 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:11000105
				LIEGE = character:10041046
			}
			
		}
		if = {
			limit = { exists = character:10041046 }
			character:10041046 = { trigger_event = diarchy.0012 }
		}
		
		if = {
		
			limit = { game_start_date >= 1066.1.1 
					  game_start_date <= 1067.1.1
			}
	
			character:10041048 = { designate_diarch = character:11000105 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:11000105
				LIEGE = character:10041048
			}
			
		}
		if = {
			limit = { exists = character:10041048 }
			character:10041048 = { trigger_event = diarchy.0012 }
		}
		
		if = {
		
			limit = { game_start_date >= 1081.1.1 
					  game_start_date <= 1082.1.1
			}
	
			character:10041050 = { designate_diarch = character:11000123 }

			remove_generated_diarch_consequences_effect = {
				NEW_DIARCH = character:11000123
				LIEGE = character:10041050
			}
			
		}
		if = {
			limit = { exists = character:10041050
					  game_start_date >= 1081.1.1 
					  game_start_date <= 1082.1.1
			}
			character:10041050 = { trigger_event = diarchy.0012 }
		}
		
	
		if = {
			limit = { game_start_date >= 1099.1.1 
					  game_start_date <= 1100.1.1
			}
			
			character:10041051 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_monarchy
					set_diarch = character:10041050
					#set_designated_heir = character:10041050 #Insei wasn't really making them the heir
				}
			}
			
			
			
		}
		if = {
			limit = { exists = character:10041051 }
			character:10041051 = { trigger_event = diarchy.0012 }
		}
		
		if = {
			limit = { game_start_date >= 1124.1.1 
					  game_start_date <= 1125.1.1
			}
			
			character:10041053 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_monarchy
					set_diarch = character:10041052
					#set_designated_heir = character:10041052 #Insei wasn't really making them the heir
				}
			}
			
			
			
		}
		if = {
			limit = { exists = character:10041053 }
			character:10041053 = { trigger_event = diarchy.0012 }
		}
		
		if = {
			limit = { game_start_date >= 1144.1.1 
					  game_start_date <= 1145.1.1
			}
			
			character:10041055 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_monarchy
					set_diarch = character:10041052
					#set_designated_heir = character:10041052 #Insei wasn't really making them the heir
				}
			}
			
			
			
		}
		if = {
			limit = { exists = character:10041055 }
			character:10041055 = { trigger_event = diarchy.0012 }
		}
		
		
		if = {
			limit = { game_start_date >= 1171.1.1 
					  game_start_date <= 1172.1.1
			}
			
			character:10041058 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_monarchy
					set_diarch = character:10041054
					#set_designated_heir = character:10041052 #Insei wasn't really making them the heir
				}
			}
			
			
			
		}
		if = {
			limit = { exists = character:10041058 }
			character:10041058 = { trigger_event = diarchy.0012 }
		}
		
		########################################################################################### CO-MONARCHS/EMPERORS ###########################################################################################
		
		#769
		
		
		if = {
			limit = { game_start_date = 769.1.1 }
			
			character:70501 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_emperorship
					set_diarch = character:70500
					set_designated_heir = character:70500
				}
			}
			
			
		}
		
		if = {
			limit = { exists = character:70501 }
			character:70501 = { trigger_event = diarchy.0012 }
		}
		
		
		#867
		
		
		if = {
			limit = { game_start_date = 867.1.1 }
			
			character:1700 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = junior_emperorship
					set_diarch = character:145133
					set_designated_heir = character:145133
				}
			}
			
			character:longxi_li_1036 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = junior_emperorship
					set_diarch = character:longxi_li_1041
					set_designated_heir = character:longxi_li_1041
				}
			}
			
			
		}
		
		
		#936
		
		
		if = {
			limit = { game_start_date = 936.8.7 }
			
			character:1706 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_emperorship
					set_diarch = character:1708
					set_designated_heir = character:1708
				}
			}
			
			#character:70024 = {
			#	if = {
			#		limit = { has_ep3_dlc_trigger = yes }
			#		try_start_diarchy = co_monarchy
			#		set_diarch = character:108600
			#		set_designated_heir = character:108600
			#	}
			#}
			
		}
			

		#997
		
		
		if = {
			limit = { game_start_date = 997.7.1 }
			
			character:1716 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_emperorship
					set_diarch = character:1718
					set_designated_heir = character:1718
				}
			}

			
			
		}
		
		
		#1018
		
		
		if = {
			limit = { game_start_date = 1018.8.1 }
			
			character:1716 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_emperorship
					set_diarch = character:1718
					set_designated_heir = character:1718
				}
			}
			
			character:217723 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = junior_emperorship
					set_diarch = character:217724
					set_designated_heir = character:217724
				}
			}
			
			
		}
		
		
		#1031
		
		
		if = {
			limit = { game_start_date = 1031.11.30 }
			
			character:1312 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = junior_emperorship
					set_diarch = character:1314
					set_designated_heir = character:1314
				}
			}
			
			
			
		}
		
		
		#1066
		
		
		if = {
			limit = { game_start_date >= 1066.1.1 
					  game_start_date <= 1067.1.1
			}
			
			character:102531 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_monarchy
					set_diarch = character:102532
					set_designated_heir = character:102532
				}
			}
			
			
			
		}
		
		if = {
				limit = { exists = character:102531 }
				character:102531 = { trigger_event = diarchy.0012 }
			}
			
		
		#1081
		
		
		if = {
			limit = { game_start_date >= 1081.1.1 
					  game_start_date <= 1082.1.1
			}
			
			character:217726 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = junior_emperorship
					set_diarch = character:217727
					set_designated_heir = character:217727
				}
			}
			
			
			
		}
		
		if = {
				limit = { exists = character:217726 }
				character:217726 = { trigger_event = diarchy.0012 }
			}
				
		
		#1099
		
		
		if = {
			limit = { game_start_date >= 1099.1.1 
					  game_start_date <= 1100.1.1
			}
			
			character:1742 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = junior_emperorship
					set_diarch = character:223023
					set_designated_heir = character:223023
				}
			}
			
			character:214 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_monarchy
					set_diarch = character:205502
					set_designated_heir = character:205502
				}
			}
			
			
			
		}
				
		
		#1124
		
		
		if = {
			limit = { game_start_date >= 1124.1.1 
					  game_start_date <= 1125.1.1
			}
			
			character:223023 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_emperorship
					set_diarch = character:232510
					set_designated_heir = character:232510
				}
			}
		
			
			
		}
				
		
		#1144
		
		
		if = {
			limit = { game_start_date >= 1144.1.1 
					  game_start_date <= 1145.1.1
			}
			
			character:231067 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_monarchy
					set_diarch = character:232006
					set_designated_heir = character:232006
				}
			}
			character:7903 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = junior_emperorship
					set_diarch = character:30752
					set_designated_heir = character:30752
				}
			}
		
			
			
		}
		
		
		#1171
		
		
		if = {
			limit = { game_start_date >= 1171.1.1 
					  game_start_date <= 1172.1.1
			}
			
			character:204500 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_monarchy
					set_diarch = character:204508
					set_designated_heir = character:204508
				}
			}
			character:202051 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_monarchy
					set_diarch = character:202050
					#set_designated_heir = character:202050
				}
			}
			character:215530 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = junior_emperorship
					set_diarch = character:215531
					set_designated_heir = character:215531
				}
			}
			
			
		}
		
		if = {
				limit = { exists = character:204500 }
				character:204500 = { trigger_event = diarchy.0012 }
			}
		
		
		
		#1178
		
		
		if = {
			limit = { game_start_date >= 1178.1.1 
					  game_start_date <= 1179.1.1
			}
			
			character:202051 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_monarchy
					set_diarch = character:202050
					set_designated_heir = character:202050
				}
			}
			
		}
		
		
		#1187
		
		
		if = {
			limit = { game_start_date >= 1187.1.1 
					  game_start_date <= 1188.1.1
			}
			
			character:212501 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = junior_emperorship
					set_diarch = character:212507
					set_designated_heir = character:212507
				}
			}
				
			character:zhuojun_zhao_545 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = junior_emperorship
					set_diarch = character:zhuojun_zhao_548
					set_designated_heir = character:zhuojun_zhao_548
				}
			}
			
			character:223500 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_monarchy
					set_diarch = character:223522
					set_designated_heir = character:223522
				}
			}
			
		}
		
		
		#1194
		
		
		if = {
			limit = { game_start_date >= 1194.1.1 
					  game_start_date <= 1195.1.1
			}
			
			character:215500 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_emperorship
					set_diarch = character:215503
					set_designated_heir = character:215503
				}
			}
			
			
		}
		
		
		#1234
		
		
		if = {
			limit = { game_start_date >= 1234.1.1 
					  game_start_date <= 1235.1.1
			}
			
			character:212513 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_emperorship
					set_diarch = character:30759
					set_designated_heir = character:30759
				}
			}
			
			
		}
		
		
		#1258
		
		
		if = {
			limit = { game_start_date >= 1258.1.1 
					  game_start_date <= 1259.1.1
			}
			
			character:454522 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_monarchy
					set_diarch = character:454520
					set_designated_heir = character:454520
				}
			}
			character:98003 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_monarchy
					set_diarch = character:98004
					set_designated_heir = character:98004
				}
			}
			character:1000080080 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = junior_emperorship
					set_diarch = character:1000080079
					set_designated_heir = character:1000080079
				}
			}
			
			
		}
		if = {
				limit = { exists = character:454522 }
				character:454522 = { trigger_event = diarchy.0012 }
			}
		if = {
				limit = { exists = character:98003 }
				character:98003 = { trigger_event = diarchy.0012 }
			}
		
		
		#1267
		
		
		if = {
			limit = { game_start_date >= 1267.1.1 
					  game_start_date <= 1268.1.1
			}
			
			character:454522 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_monarchy
					set_diarch = character:454520
					set_designated_heir = character:454520
				}
			}
			character:98003 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_monarchy
					set_diarch = character:98004
					set_designated_heir = character:98004
				}
			}
			character:74583 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_monarchy
					set_diarch = character:74582
					set_designated_heir = character:74582
				}
			}
			character:465527 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = junior_emperorship
					set_diarch = character:465521
					set_designated_heir = character:465521
				}
			}
			character:1000080080 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = junior_emperorship
					set_diarch = character:1000080079
					set_designated_heir = character:1000080079
				}
			}
			
			
		}
		if = {
				limit = { exists = character:454522 }
				character:454522 = { trigger_event = diarchy.0012 }
			}
		if = {
				limit = { exists = character:98003 }
				character:98003 = { trigger_event = diarchy.0012 }
			}
		
		
		#1310
		
		
		if = {
			limit = { game_start_date >= 1300.1.1 
					  game_start_date <= 1301.1.1
			}
			
			character:465521 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_emperorship
					set_diarch = character:465501
					set_designated_heir = character:465501
				}
			}
			
			
		}
		if = {
				limit = { exists = character:465521 }
				character:465521 = { trigger_event = diarchy.0012 }
			}
			
			
		#1310
		
		
		if = {
			limit = { game_start_date >= 1310.1.1 
					  game_start_date <= 1311.1.1
			}
			
			character:465521 = {
				if = {
					limit = { has_ep3_dlc_trigger = yes }
					try_start_diarchy = co_emperorship
					set_diarch = character:465501
					set_designated_heir = character:465501
				}
			}
				
		}
	}
	
}

MB_set_legitimacy = {

	effect = {
	
		########################################################################################### LEGITIMACY/SPLENDOR ###########################################################################################
			
		# LEGITIMACY CONFIG
			#miniscule_legitimacy_gain = 20
			#minor_legitimacy_gain = 50
			#medium_legitimacy_gain = 100
			#major_legitimacy_gain = 200
			#massive_legitimacy_gain = 300
			
			#miniscule_legitimacy_loss
			#minor_legitimacy_loss
			#medium_legitimacy_loss
			#major_legitimacy_loss
			#massive_legitimacy_loss
		

		#Kong Dynasty

		dynasty:1000048574 = {
			add_dynasty_prestige = 1500
			add_dynasty_prestige_level = 1
		}
		
		#769
		
		if = {
			limit = { game_start_date = 769.1.1 }
			## Karl and Karloman should have the same level of legitimacy at 3 instead of 2 and 1 respectively
			character:144999 = {
				add_legitimacy = massive_legitimacy_gain
			}
			character:6392 = {
				add_legitimacy = massive_legitimacy_gain
			}
			
			#Constantine V - Reduce his legitimacy a bit just to cover the fact that he was an Iconoclast
			character:70501 = {
				add_legitimacy = medium_legitimacy_loss
			}
		}
		
		## 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
			}
		}
		
		## 1204
		if = {
			limit = { game_start_date = 1204.5.16 }
			## Epirus, Trebizond, and Nikaea
			character:215674 = {
				add_legitimacy = massive_legitimacy_gain
			}
			character:215517 = {
				add_legitimacy = massive_legitimacy_gain
			}
			character:215519 = {
				add_legitimacy = massive_legitimacy_gain
			}
		}
		
		## 1211
		if = {
			limit = { game_start_date = 1211.6.16 }
			## Epirus, Trebizond, and Nikaea
			character:215674 = {
				add_legitimacy = massive_legitimacy_gain
			}
			character:215517 = {
				add_legitimacy = massive_legitimacy_gain
			}
			character:215519 = {
				add_legitimacy = massive_legitimacy_gain
			}
			character:212513 = {
				add_legitimacy = massive_legitimacy_gain
			}
			character:125501 = {
				add_legitimacy = massive_legitimacy_gain
			}
		}
		
		## 1337
		if = {
			limit = { game_start_date = 1337.5.24 }
			character:74401 = {
				add_legitimacy = massive_legitimacy_gain
			}
			character:469500 = {
				add_legitimacy = massive_legitimacy_gain
			}
			character:12139028 = {
				add_legitimacy = massive_legitimacy_gain
			}
			character:453500 = {
				add_legitimacy = massive_legitimacy_gain
			}
		}
	}
	
}

MB_set_government = { #Mostly in MB_government_assignment_on_actions. Move over?

	effect = {
		
		every_living_character = {
			limit = {
				OR = {
					has_culture = culture:serbian
					has_culture = culture:croatian
				}
				is_playable_character = yes
				is_ruler = yes
				has_government = feudal_government
				NOT = { has_government = mercenary_government }
				has_faith = faith:slavic_pagan
				
			}
			change_government = tribal_government
		}
		
		#Removed Mandala. It added a lot of extra work for file updating, was prone to having issues, and didn't exactly do much differently than feudal so it's easier to remove it till Paradox adds Mandala in the DLC later this year and this can be adapted for that
		##Mandala
		#
		#every_ruler = {
			#
			#	if = {
		#		limit = {
		#			exists = capital_county
		#			capital_county.title_province = { geographical_region = world_burma }
		#			has_government = feudal_government
		#			OR = {
		#				religion = religion:hinduism_religion
		#				religion = religion:buddhism_religion
		#				religion = religion:jainism_religion
		#				religion = religion:burmic_religion
		#			}
		#			NOT = { faith = faith:lamaism }
		#			NOT = { has_government = mercenary_government }
		#			NOT = { has_government = theocracy_government }
		#			NOT = { has_government = landless_adventurer_government }
		#		}
		#		change_government = mandala_government
		#
		#		every_vassal = {
		#			limit = {
		#				highest_held_title_tier = tier_barony
		#				OR = {
		#					has_government = feudal_government
		#					has_government = republic_government
		#				}
		#			}
		#			change_government = mandala_government
		#		}
		#	}
		#	if = {
		#		limit = {
		#			exists = capital_county
		#			capital_county.title_province = { geographical_region = world_india }
		#			has_government = feudal_government
		#			NOT = { has_government = theocracy_government }
		#			NOT = { has_government = landless_adventurer_government }
		#			OR = {
		#				culture = { has_cultural_pillar = heritage_indo_aryan }
		#				culture = { has_cultural_pillar = heritage_dravidian }
		#				culture = { has_cultural_pillar = heritage_burman }
		#			}
		#			OR = {
		#				religion = religion:hinduism_religion
		#				religion = religion:buddhism_religion
		#				religion = religion:jainism_religion
		#				religion = religion:indian_religion
		#			}
		#			NOT = { faith = faith:lamaism }
		#		}
		#		change_government = mandala_government
		#
		#		every_vassal = {
		#			limit = {
		#				highest_held_title_tier = tier_barony
		#				OR = {
		#					has_government = feudal_government
		#					has_government = republic_government
		#				}
		#			}
		#			change_government = mandala_government
		#		}
		#	}
		#
		#	if = {
		#		limit = {
		#			exists = capital_county
		#			NOT = { has_government = theocracy_government }
		#			NOT = { has_government = landless_adventurer_government }
		#			NOT = { has_government = clan_government }
		#			capital_county.title_province = {
		#				OR = {
		#					geographical_region = world_southeast_asia
		#					geographical_region = world_burma
		#				}
		#			}
			#			has_government = feudal_government
		#			OR = {
		#				religion = religion:hinduism_religion
		#				religion = religion:buddhism_religion
		#				religion = religion:jainism_religion
		#				religion = religion:austronesian_religion
		#			}
		#			NOT = { faith = faith:lamaism }
		#		}
		#		change_government = mandala_government
		#		#add_realm_law_skip_effects = single_heir_succession_law
		#
		#		every_vassal = {
		#			limit = {
		#				highest_held_title_tier = tier_barony
		#				OR = {
		#					has_government = feudal_government
		#					has_government = republic_government
		#				}
		#			}
		#			change_government = mandala_government
		#			#add_realm_law_skip_effects = single_heir_succession_law
		#		}
		#	}
		#	if = {
		#		limit = {
		#			exists = capital_county
		#			NOT = { has_government = theocracy_government }
		#			NOT = { has_government = landless_adventurer_government }
		#			capital_county.title_province = { geographical_region = world_india }
		#			has_government = feudal_government
		#			OR = {
		#				culture = { has_cultural_pillar = heritage_indo_aryan }
		#				culture = { has_cultural_pillar = heritage_dravidian }
		#				culture = { has_cultural_pillar = heritage_burman }
		#			}
		#			OR = {
		#				religion = religion:hinduism_religion
		#				religion = religion:buddhism_religion
		#				religion = religion:jainism_religion
		#			}
		#			NOT = { faith = faith:lamaism }
		#		}
		#		change_government = mandala_government
		#		add_realm_law_skip_effects = single_heir_succession_law
		#
		#		every_vassal = {
		#			limit = {
		#				highest_held_title_tier = tier_barony
		#				OR = {
		#					has_government = feudal_government
		#					has_government = republic_government
		#				}
		#			}
		#			change_government = mandala_government
		#			add_realm_law_skip_effects = single_heir_succession_law
			#		}
			#	}
			#
			#	if = {
		#		limit = {
		#			exists = capital_county
		#			has_government = clan_government
		#			capital_county.title_province = {
		#				OR = {
		#					geographical_region = world_southeast_asia
		#					geographical_region = world_burma
		#				}
		#			}
		#		}
		#		add_realm_law_skip_effects = clan_impassive_partition_succession_law
		#
		#		every_vassal = {
		#			limit = {
		#				highest_held_title_tier = tier_barony
		#				has_government = clan_government
		#			}
		#			add_realm_law_skip_effects = clan_impassive_partition_succession_law
		#		}
		#	}
		#
		#	if = {
		#		limit = {
		#			has_government = mandala_government
		#		}
		#
		#		if = {
		#			limit = { NOT = { has_realm_law = mandala_authority_0 } }
		#			add_realm_law_skip_effects = mandala_authority_0
		#		}
		#		if = {
		#			limit = { has_realm_law = crown_authority_0 }
		#			remove_realm_law = crown_authority_0
		#		}
		#		if = {
		#			limit = { has_realm_law = crown_authority_1 }
		#			remove_realm_law = crown_authority_1
		#		}
		#		if = {
		#			limit = { has_realm_law = crown_authority_2 }
		#			remove_realm_law = crown_authority_2
		#		}
		#		if = {
		#			limit = { has_realm_law = crown_authority_3 }
		#			remove_realm_law = crown_authority_3
		#		}
		#	}
		#
		#	if = {
		#		limit = {
		#			AND = {
		#				has_government = mandala_government
		#				game_start_date > 1100.1.1
		#				game_start_date < 1300.1.1
		#			}
		#		}
		#
		#		if = {
		#			limit = { NOT = { has_realm_law = mandala_authority_1 } }
		#			add_realm_law_skip_effects = mandala_authority_1
		#		}
		#	}
		#
		#	if = {
		#		limit = {
		#			AND = {
		#				has_government = mandala_government
		#				game_start_date > 1300.1.1
		#			}
		#		}
		#
		#		if = {
		#			limit = { NOT = { has_realm_law = mandala_authority_2 } }
		#			add_realm_law_skip_effects = mandala_authority_2
		#		}
		#	}
		#
		#	#if = {
		#	#	limit = {
		#	#		has_government = feudal_government
		#	#	}
		#	#
		#	#	if = {
		#	#		limit = { NOT = { has_realm_law = crown_authority_0 } }
		#	#		add_realm_law_skip_effects = crown_authority_0
		#	#	}
		#	#}
		#	#
		#	#if = {
		#	#	limit = {
		#	#		AND = {
		#	#			has_government = feudal_government
		#	#			game_start_date > 1100.1.1
		#	#			game_start_date < 1300.1.1
		#	#		}
		#	#	}
		#	#
		#	#	if = {
		#	#		limit = { NOT = { has_realm_law = crown_authority_1 } }
		#	#		add_realm_law_skip_effects = crown_authority_1
		#	#	}
		#	#}
		#
		#}
		
		#Administrative Government - Let's set this in a more sensible way than editing a thousand history entries like Paradox did
		#Pre 1204 ERE
		every_ruler = {
		
			if = {
				limit = {
					game_start_date <= 1204.1.1 
					exists = title:e_byzantium.holder
					has_dlc_feature = roads_to_power
				}
				
				title:e_byzantium.holder = { change_government = administrative_government }
				
				title:e_byzantium.holder ?= {
					every_vassal_or_below = {
						limit = {
							highest_held_title_tier >= tier_county
							NOT = { has_government = theocracy_government }
							NOT = { has_government = landless_adventurer_government }
							OR = {
								has_government = feudal_government
								has_government = republic_government
							}
						}
						change_government = administrative_government
					}
				}
			}
		}
		#Later ERE
		every_ruler = {
		
			if = {
				limit = {
					game_start_date >= 1261.7.25 
					game_start_date <= 1338.1.1 
					has_dlc_feature = roads_to_power
				}
				
				title:e_byzantium.holder = { change_government = administrative_government }
				
				title:e_byzantium.holder ?= {
					every_vassal_or_below = {
						limit = {
							highest_held_title_tier >= tier_county
							NOT = { has_government = theocracy_government }
							NOT = { has_government = landless_adventurer_government }
							OR = {
								has_government = feudal_government
								has_government = republic_government
							}
						}
						change_government = administrative_government
					}
				}
			}
		}
		#Epirus
		every_ruler = {
		
			if = {
				limit = {
					game_start_date >= 1204.1.1 
					has_dlc_feature = roads_to_power
				}
				
				title:k_epirus.holder = { change_government = administrative_government }
				
				title:k_epirus.holder ?= {
					every_vassal_or_below = {
						limit = {
							highest_held_title_tier >= tier_county
							NOT = { has_government = theocracy_government }
							NOT = { has_government = landless_adventurer_government }
							OR = {
								has_government = feudal_government
								has_government = republic_government
							}
						}
						change_government = administrative_government
					}
				}
			}
		}
		#Trebizond
		every_ruler = {
		
			if = {
				limit = {
					game_start_date >= 1204.1.1 
					has_dlc_feature = roads_to_power
				}
				
				title:k_trebizond.holder = { change_government = administrative_government }
				
				title:k_trebizond.holder ?= {
					every_vassal_or_below = {
						limit = {
							highest_held_title_tier >= tier_county
							NOT = { has_government = theocracy_government }
							NOT = { has_government = landless_adventurer_government }
							OR = {
								has_government = feudal_government
								has_government = republic_government
							}
						}
						change_government = administrative_government
					}
				}
			}
		}
		#Nikaea
		every_ruler = {
		
			if = {
				limit = {
					game_start_date >= 1204.1.1 
					game_start_date <= 1261.7.25 
					has_dlc_feature = roads_to_power
				}
				
				title:k_nikaea.holder = { change_government = administrative_government }
				
				title:k_nikaea.holder ?= {
					every_vassal_or_below = {
						limit = {
							highest_held_title_tier >= tier_county
							NOT = { has_government = theocracy_government }
							NOT = { has_government = landless_adventurer_government }
							OR = {
								has_government = feudal_government
								has_government = republic_government
							}
						}
						change_government = administrative_government
					}
				}
			}
		}
		#China
		every_ruler = {
		
			if = {
				
				limit = {
					has_dlc_feature = roads_to_power
				}
				
				title:e_celestia_china.holder = { change_government = administrative_government }
				
				title:e_celestia_china.holder ?= {
					every_vassal = {
						limit = {
							exists = capital_county
							highest_held_title_tier >= tier_county
							NOT = { has_government = theocracy_government }
							NOT = { has_government = landless_adventurer_government }
							OR = {
								has_government = feudal_government
								has_government = republic_government
							}
						}
						change_government = administrative_government
					}
				}
			}
		}
		#Get any stragglers
		every_ruler = {
			if = {
				limit = {
					
					game_start_date >= 750.1.28
					has_dlc_feature = roads_to_power
					
					exists = capital_county
					highest_held_title_tier >= tier_county
					NOT = { has_government = theocracy_government }
					NOT = { has_government = landless_adventurer_government }
					OR = {
						capital_county.title_province = { geographical_region = world_china_proper }
						capital_county.title_province = { geographical_region = world_luodian }
						capital_county.title_province = { geographical_region = world_asia_china_shuofang }
						capital_county.title_province = { geographical_region = world_asia_china_liao }
						capital_county.title_province = { geographical_region = world_asia_china_qin }
					}
						
					OR = {
					has_government = feudal_government
						has_government = clan_government
					}
					
					OR = {
						culture = { has_cultural_pillar = heritage_chinese }
						culture = culture:sogdian
						culture = culture:shatuo
						culture = culture:tangut
					}
					OR = {
						religion = religion:buddhism_religion
						religion = religion:taoism_religion
					}
				}
				change_government = administrative_government
			}
		}
		#Jin
		every_ruler = {
			if = {
				limit = {
					
					game_start_date >= 1115.1.28
					game_start_date <= 1220.5.16
					has_dlc_feature = roads_to_power

					exists = capital_county
					NOT = { has_government = theocracy_government }
					NOT = { has_government = landless_adventurer_government }
					OR = {
						capital_county.title_province = { geographical_region = world_china }
						capital_county.title_province = { geographical_region = world_manchuria }
					}

					has_government = feudal_government
					OR = {
						culture = { has_cultural_pillar = heritage_chinese }
						culture = { has_cultural_pillar = heritage_tungusic }
						culture = culture:khitan
					}
					OR = {
						religion = religion:buddhism_religion
						religion = religion:taoism_religion
					}
				}
				change_government = administrative_government
			}
		}
		#Liao
		every_ruler = {
			if = {
				limit = {

					game_start_date >= 930.1.28
					game_start_date <= 1114.1.28
					has_dlc_feature = roads_to_power
					
					exists = capital_county
					NOT = { has_government = theocracy_government }
					NOT = { has_government = landless_adventurer_government }
					OR = {
						capital_county.title_province = { geographical_region = world_china }
						capital_county.title_province = { geographical_region = world_manchuria }
					}
						
					has_government = feudal_government
					OR = {
						culture = { has_cultural_pillar = heritage_chinese }
						culture = { has_cultural_pillar = heritage_tungusic }
						culture = culture:khitan
					}
					OR = {
						religion = religion:buddhism_religion
						religion = religion:taoism_religion
					}
				}
				change_government = administrative_government
			}
		}
		#Yuan
		every_ruler = {
			if = {
				limit = {

					game_start_date >= 1286.1.1
					has_dlc_feature = roads_to_power

					exists = capital_county
					NOR = { 
						has_government = nomad_government
						has_government = herder_government
						has_government = theocracy_government
						has_government = landless_adventurer_government 
					}
					NOR = { 
						has_title = title:d_confucius
					}
					OR = {
						capital_county.title_province = { geographical_region = world_china }
						capital_county.title_province = { geographical_region = world_manchuria }
					}

					has_government = feudal_government
					OR = {
						culture = { has_cultural_pillar = heritage_mongolic }
						culture = { has_cultural_pillar = heritage_chinese }
						culture = { has_cultural_pillar = heritage_tungusic }
						culture = culture:yughur
					}
					OR = {
						religion = religion:buddhism_religion
						religion = religion:taoism_religion
						religion = religion:tengrism_religion
						faith = faith:nestorian
					}
				}
				change_government = administrative_government
			}
		}
		#Japan
		every_ruler = {
			if = {
				limit = {
			
					game_start_date <= 1219.1.1 #Japan eventually became feudal with the Shogunate with the Jōkyū War being when the transition was completed
					has_dlc_feature = roads_to_power
					
					exists = capital_county
					NOT = { has_government = theocracy_government }
					NOT = { has_government = landless_adventurer_government }
					
					capital_county.title_province = { geographical_region = world_japan }
						
					has_government = feudal_government
					culture = { has_cultural_pillar = heritage_yamato }
					OR = {
						religion = religion:buddhism_religion
						religion = religion:shinto_religion
					}
					
				}
				change_government = administrative_government
				
				title:k_yamato.holder ?= {
					every_vassal_or_below = {
						limit = {
							highest_held_title_tier >= tier_barony
							NOT = { has_government = theocracy_government }
							NOT = { has_government = landless_adventurer_government }
							NOR = { has_title = title:d_nf_japan_tachibana 
									has_title = title:d_nf_japan_taira
									has_title = title:d_nf_japan_minamoto
									has_title = title:d_nf_japan_fujiwara_oshu
									has_title = title:d_nf_japan_fujiwara_nanke
									has_title = title:d_nf_japan_fujiwara_hokke
									has_title = title:d_nf_japan_fujiwara_shikike
									has_title = title:d_nf_japan_fujiwara_kyoke
									has_title = title:d_nf_japan_yamato
									has_title = title:d_nf_japan_shogunate_hojo
							
							}
							OR = {
								has_government = feudal_government
								has_government = administrative_government
							}
						}
						change_government = feudal_government
					}
				}
				
			}
		}
		#Goryeo
		every_ruler = {
		
			if = {
				limit = {
					game_start_date >= 990.1.1
					has_dlc_feature = roads_to_power
				}
				title:k_goryeo.holder = { change_government = administrative_government }
				
				title:k_goryeo.holder ?= {
					every_vassal_or_below = {
						limit = {
							highest_held_title_tier >= tier_county
							NOT = { has_government = theocracy_government }
							NOT = { has_government = landless_adventurer_government }
							OR = {
								has_government = feudal_government
								has_government = republic_government
							}
						}
						change_government = administrative_government
					}
				}
			}
		}
		#Xi Xia
		every_ruler = {
		
			if = {
				limit = {
					game_start_date >= 1035.1.1
					game_start_date <= 1223.1.1
					has_dlc_feature = roads_to_power
				}
				title:e_xi_xia.holder = { change_government = administrative_government }
				
				title:e_xi_xia.holder ?= {
					every_vassal_or_below = {
						limit = {
							highest_held_title_tier >= tier_county
							NOT = { has_government = theocracy_government }
							NOT = { has_government = landless_adventurer_government }
							OR = {
								has_government = feudal_government
								has_government = republic_government
							}
						}
						change_government = administrative_government
					}
				}
			}
		}
		#Jinhai/Viet
		every_ruler = {
		
			if = {
				limit = {
					game_start_date = 936.8.7
					has_dlc_feature = roads_to_power
				}
				title:k_jinghai.holder = { change_government = administrative_government }
				
				title:k_jinghai.holder ?= {
					every_vassal_or_below = {
						limit = {
							highest_held_title_tier >= tier_county
							NOT = { has_government = theocracy_government }
							NOT = { has_government = landless_adventurer_government }
							OR = {
								has_government = feudal_government
								has_government = republic_government
							}
						}
						change_government = administrative_government
					}
				}
			}
		}
		#Dai Viet
		every_ruler = {
		
			if = {
				limit = {
					game_start_date >= 960.1.1
					has_dlc_feature = roads_to_power
				}
				title:k_annam.holder = { change_government = administrative_government }
				
				title:k_annam.holder ?= {
					every_vassal_or_below = {
						limit = {
							highest_held_title_tier >= tier_county
							NOT = { has_government = theocracy_government }
							NOT = { has_government = landless_adventurer_government }
							OR = {
								has_government = feudal_government
								has_government = republic_government
							}
						}
						change_government = administrative_government
					}
				}
			}
		}
		
		#Fix any christian titles stuck as clan
		
		every_ruler = {
		
			if = {
				limit = {	
					has_religion = religion:christianity_religion
					NOR = {
						has_government = tribal_government
							has_government = republic_government
							has_government = theocracy_government
							has_government = holy_order_county_government
							has_government = holy_order_government
							has_government = mercenary_government 
							has_government = administrative_government
							has_government = landless_adventurer_government 
						}
						OR = {
							capital_county.title_province = { geographical_region = world_europe_west }
							capital_county.title_province = { geographical_region = world_europe_north }
							capital_county.title_province = { geographical_region = world_europe_south }
							capital_county.title_province = { geographical_region = world_europe_east }
							capital_county.title_province = { geographical_region = world_middle_east_jerusalem }
							capital_county.title_province = { geographical_region = world_asia_minor }
						}
					}
					change_government = feudal_government
			}
		}
		
		#Make early Zoroastrians into Clan
		
		every_ruler = {
		
			if = {
				
				limit = {
					has_religion = religion:zoroastrianism_religion
					NOR = {
						has_government = tribal_government
						has_government = republic_government
						has_government = theocracy_government
						has_government = holy_order_county_government
						has_government = holy_order_government
						has_government = mercenary_government 
						has_government = administrative_government
						has_government = landless_adventurer_government 
					}
				}
				change_government = clan_government
			}
		}
		
		#Make all pagans be tribal government except the Steppe who would be nomadic
		
		every_ruler = {
			
			if = {
				limit = {
					religion = { is_in_family = rf_pagan }
					NOT = {
						has_government = republic_government
						has_government = theocracy_government
						has_government = holy_order_county_government
						has_government = holy_order_government
						has_government = landless_adventurer_government 
						
						culture = culture:lithuanian
						
						OR = {
							capital_county.title_province = { geographical_region = world_steppe_west }
							capital_county.title_province = { geographical_region = world_steppe_east }
							capital_county.title_province = { geographical_region = world_steppe_tarim }
						}
					}
				}
				
				#Make Lithuania feudal if post 1258 or tribal otherwise
				
				if = {
					limit = {
						game_start_date >= 1258.1.1
						culture = culture:lithuanian
					}
					change_government = feudal_government
				}
				
				
				else_if = {
					limit = {
						game_start_date <= 1257.1.1
						culture = culture:lithuanian
					}
					change_government = tribal_government
				}

			}
		}
		
	

		every_ruler = {

			if = {
				limit = {
					has_government = tribal_government
					has_mpo_dlc_trigger = yes

					OR = {
						# The steppe
						capital_county.title_province = { geographical_region = dlc_mpo_steppe_western_steppe }
						capital_county.title_province = { geographical_region = dlc_mpo_steppe_central_steppe }
						capital_county.title_province = { geographical_region = dlc_mpo_steppe_eastern_steppe } # Not world_manchuria as it covers too large of an area
						capital_county.title_province = { geographical_region = dlc_mpo_steppe_southern_steppe }
						#Iran
						capital_county.title_province = { geographical_region = world_middle_east_persia } # The Ilkhanate was nomadic its entire existence
					}
					
					
					NOT = {
						#Various groups I don't want being changed from tribal to nomadic
						OR = {
							culture = { has_cultural_pillar = heritage_ugro_permian }
							culture = { has_cultural_pillar = heritage_balto_finnic }
							culture = { has_cultural_pillar = heritage_siberian }
							culture = { has_cultural_pillar = heritage_volga_finnic }
							culture = { has_cultural_pillar = heritage_east_slavic }
							culture = { has_cultural_pillar = heritage_south_slavic }
							culture = { has_cultural_pillar = heritage_west_slavic }
							culture = { has_cultural_pillar = heritage_vlach }
							culture = { has_cultural_pillar = heritage_chinese }
							culture = { has_cultural_pillar = heritage_tungusic }
							culture = { has_cultural_pillar = heritage_samoyedic }
							culture = culture:kurdish
							culture = culture:tajik
							culture = culture:yakut
							culture = culture:saka
							culture = culture:circassian
						}

					}
					
				}
				

				change_government = nomad_government
				
				every_held_title = {
					if = {
						limit = {
							title_province = {
								has_holding_type = tribal_holding
							}
						}
						title_province = {
							set_holding_type = nomad_holding
						}
					}
				}

			}
			
			#Holding Fixes
			
			if = { # Make sure herders get their proper holdings without me needing to juggle province files
				limit = {
					has_government = herder_government
					has_mpo_dlc_trigger = yes
				}

				every_held_title = {
					if = {
						limit = {
							title_province = {
								has_holding_type = tribal_holding
							}
						}
						title_province = {
							set_holding_type = herder_holding
						}
					}
				}

			}
			
			#if = { # Fix any remnant feudals that have tribal holdings. Run this after all the above changes.
			#	limit = {
			#		has_government = feudal_government
			#	}
			#
			#	every_held_title = {
			#		if = {
			#			limit = {
			#				title_province = {
			#					has_holding_type = tribal_holding
			#				}
			#			}
			#			title_province = {
			#				set_holding_type = castle_holding
			#			}
			#		}
			#	}
			#
			#}
			#
			#if = { # Fix any remnant tribals that have castles. Run this after all the above changes.
			#	limit = {
			#		has_government = tribal_government
			#	}
			#
			#	every_held_title = {
			#		if = {
			#			limit = {
			#				title_province = {
			#					has_holding_type = castle_holding
			#				}
			#			}
			#			title_province = {
			#				set_holding_type = tribal_holding
			#			}
			#		}
			#	}
			#
			#}
		}

	}
}

MB_set_de_jure = {

	effect = {
	
		########################################################################################### DE JURE TERRITORY SETUP ###########################################################################################
		
		
		##A much easier way to set de_jure territory changes without touching history files. Also comes with the added benefit of it not requiring me to restart the game to test it
		
		
		#Titles that never have a de_jure//other stuff for all Bookmarks
		
		if = {
			limit = {
				game_start_date >= 769.1.1
			}

			title:k_papal_states = { set_de_jure_liege_title = title:e_italy }
			
			title:k_liuqiu = { set_de_jure_liege_title = title:e_kalimantan } # I don't want China conquering it
			
			title:k_maldives = { set_de_jure_liege_title = title:e_null_maldives }
			
			title:c_yamashiro = { set_de_jure_liege_title = title:d_yamato_imperial }
			
			
		}	
		
		#if = {
		#	limit = {
		#		game_start_date <= 900.1.1
		#		game_start_date >= 800.1.1
		#	}
		#
		#	title:d_somerset = { set_de_jure_liege_title = title:k_wessex }
		#	title:d_cornwall = { set_de_jure_liege_title = title:k_wessex }
		#	title:d_canterbury = { set_de_jure_liege_title = title:k_wessex }
		#	title:d_essex = { set_de_jure_liege_title = title:k_wessex }
		#	title:d_gloucester = { set_de_jure_liege_title = title:k_mercia }
		#	title:d_norfolk = { set_de_jure_liege_title = title:k_east_anglia }
		#	title:d_hereford = { set_de_jure_liege_title = title:k_mercia }
		#	title:d_northumberland = { set_de_jure_liege_title = title:k_northumberland }
		#	title:d_york = { set_de_jure_liege_title = title:k_northumberland }
		#	title:d_lancaster = { set_de_jure_liege_title = title:k_northumberland }
		#	title:d_lothian = { set_de_jure_liege_title = title:k_northumberland }
		#}
		#
		#if = {
		#	limit = {
		#		game_start_date <= 800.1.1
		#		game_start_date >= 700.1.1
		#	}
		#
		#	title:d_somerset = { set_de_jure_liege_title = title:k_wessex }
		#	title:d_cornwall = { set_de_jure_liege_title = title:k_wessex }
		#	title:d_canterbury = { set_de_jure_liege_title = title:k_kent }
		#	title:d_essex = { set_de_jure_liege_title = title:k_essex }
		#	title:d_gloucester = { set_de_jure_liege_title = title:k_hwicce }
		#	title:d_norfolk = { set_de_jure_liege_title = title:k_east_anglia }
		#	title:d_hereford = { set_de_jure_liege_title = title:k_mercia }
		#	title:d_northumberland = { set_de_jure_liege_title = title:k_northumberland }
		#	title:d_york = { set_de_jure_liege_title = title:k_northumberland }
		#	title:d_lancaster = { set_de_jure_liege_title = title:k_northumberland }
		#	title:d_lothian = { set_de_jure_liege_title = title:k_northumberland }
		#}
		
		#For when Old Armenia is used in 769
		if = {
			limit = {
				game_start_date >= 769.1.1
				game_start_date <= 861.1.1
			}

			title:d_greater_armenia = { set_de_jure_liege_title = title:k_old_armenia }
			title:d_suenik = { set_de_jure_liege_title = title:k_old_armenia }
			title:d_vaspurakan = { set_de_jure_liege_title = title:k_old_armenia }
			title:d_mesopotamia = { set_de_jure_liege_title = title:k_old_armenia }
			title:d_dzopk = { set_de_jure_liege_title = title:k_old_armenia }
			title:d_artsakh = { set_de_jure_liege_title = title:k_old_armenia }
			title:d_georgia = { set_de_jure_liege_title = title:k_old_armenia }
			title:d_taron = { set_de_jure_liege_title = title:k_old_armenia }
			title:d_melitene = { set_de_jure_liege_title = title:k_old_armenia }
		}
		
		if = {
			limit = {
				game_start_date >= 672.1.1
				game_start_date < 846.1.1
			}
			title:d_albany = {
				set_de_jure_liege_title = title:k_picts_mbrn
			}
			title:d_aberdeen = {
				set_de_jure_liege_title = title:k_picts_mbrn
			}
			title:d_moray = {
				set_de_jure_liege_title = title:k_picts_mbrn
			}
			title:d_sutherland = {
				set_de_jure_liege_title = title:k_picts_mbrn
			}
			title:d_western_isles = {
				set_de_jure_liege_title = title:k_dalriata_mbrn
			}
			title:d_hebrides = {
				set_de_jure_liege_title = title:k_dalriata_mbrn
			}
			title:d_argyll = {
				set_de_jure_liege_title = title:k_dalriata_mbrn
			}
		}
		
		#769 Setup
		
		if = {
			limit = {
				game_start_date >= 769.1.1
				game_start_date <= 866.1.2
			}

			title:k_dacia = { set_de_jure_liege_title = title:e_bulgaria }
			title:k_moldavia = { set_de_jure_liege_title = title:e_bulgaria }
			
			#title:d_holland = { set_de_jure_liege_title = title:k_lotharingia }
			#title:d_frisia = { set_de_jure_liege_title = title:k_lotharingia }
			title:d_gelre = { set_de_jure_liege_title = title:k_lotharingia }
			#title:d_utrecht = { set_de_jure_liege_title = title:k_lotharingia }
			
			title:d_swabia = { set_de_jure_liege_title = title:k_old_franconia }
			title:d_augsburg = { set_de_jure_liege_title = title:k_old_franconia }
			title:d_currezia = { set_de_jure_liege_title = title:k_old_franconia }
			title:d_teck = { set_de_jure_liege_title = title:k_old_franconia }
			title:d_baden = { set_de_jure_liege_title = title:k_old_franconia }
			title:d_tubingen = { set_de_jure_liege_title = title:k_old_franconia }
			title:d_east_franconia = { set_de_jure_liege_title = title:k_old_franconia }
			title:d_augsburg = { set_de_jure_liege_title = title:k_old_franconia }
			title:d_hesse = { set_de_jure_liege_title = title:k_old_franconia }
			title:d_mainz = { set_de_jure_liege_title = title:k_old_franconia }
			title:d_nuremberg = { set_de_jure_liege_title = title:k_old_franconia }
			title:d_west_franconia = { set_de_jure_liege_title = title:k_old_franconia }
			
			title:d_carinthia = { set_de_jure_liege_title = title:k_bavaria }
			title:d_osterreich = { set_de_jure_liege_title = title:k_bavaria }
			title:d_istria = { set_de_jure_liege_title = title:k_bavaria }
			title:d_krain = { set_de_jure_liege_title = title:k_bavaria }
			title:d_steyermark = { set_de_jure_liege_title = title:k_bavaria }
			
			
			
			title:d_iceland = { set_de_jure_liege_title = title:k_iceland }
			
			title:d_lothian = { set_de_jure_liege_title = title:k_strathclyde }

			
		}
		
		#867 
		
		if = {
			limit = {
				game_start_date >= 800.1.1
				game_start_date <= 867.1.2
			}

			title:k_dacia = { set_de_jure_liege_title = title:e_bulgaria }
			title:k_moldavia = { set_de_jure_liege_title = title:e_bulgaria }
			
			title:d_holland = { set_de_jure_liege_title = title:k_lotharingia }
			title:d_frisia = { set_de_jure_liege_title = title:k_lotharingia }
			title:d_gelre = { set_de_jure_liege_title = title:k_lotharingia }
			title:d_utrecht = { set_de_jure_liege_title = title:k_lotharingia }
			
			title:d_carinthia = { set_de_jure_liege_title = title:k_bavaria }
			title:d_osterreich = { set_de_jure_liege_title = title:k_bavaria }
			title:d_istria = { set_de_jure_liege_title = title:k_bavaria }
			title:d_krain = { set_de_jure_liege_title = title:k_bavaria }
			title:d_steyermark = { set_de_jure_liege_title = title:k_bavaria }
			
			title:d_lothian = { set_de_jure_liege_title = title:k_strathclyde }
			
			
		}
		
		if = {
			limit = {
				game_start_date >= 769.1.1
				game_start_date <= 936.1.1
			}

			title:d_syrmia = { set_de_jure_liege_title = title:k_croatia }
			title:d_bosna = { set_de_jure_liege_title = title:k_serbia }
			title:d_realusora = { set_de_jure_liege_title = title:k_serbia }
			title:k_jazira = { set_de_jure_liege_title = title:e_arabia }
		}
		
		
		#867 - 2 Setup (For bookmark where e_francia does not exist)
		
		if = {
			limit = {
				game_start_date = 867.1.2
			}

			title:k_italy = { set_de_jure_liege_title = title:e_italy }
		}
		
		#936
		
		if = {
			limit = {
				game_start_date = 936.8.7
			}

			title:d_moravia = { set_de_jure_liege_title = title:k_bohemia }
		}
		
		#993
		
		if = {
			limit = {
				game_start_date = 993.1.1
			}

			title:d_syrmia = { set_de_jure_liege_title = title:k_croatia }
			title:d_bosna = { set_de_jure_liege_title = title:k_serbia }
			title:d_realusora = { set_de_jure_liege_title = title:k_serbia }
			title:d_lausitz = { set_de_jure_liege_title = title:k_saxony }
			title:d_ostmark = { set_de_jure_liege_title = title:k_saxony }
		}
		
		#1018-1066
		
		if = {
			limit = {
				game_start_date >= 1018.1.1
				game_start_date <= 1067.1.1
			}

			title:d_syrmia = { set_de_jure_liege_title = title:k_croatia }
			title:d_ostmark = { set_de_jure_liege_title = title:k_saxony }
			
		}
		
		#1066-1144
		
		if = {
			limit = {
				game_start_date >= 1066.1.1
				game_start_date <= 1145.1.1
			}

			title:d_ostmark = { set_de_jure_liege_title = title:k_saxony }
			
		}
		
		#France
		
		#Initial conquest by Philippe
		
		if = {
			limit = {
				game_start_date >= 1200.1.1
			}

			title:d_poitou = { set_de_jure_liege_title = title:k_france }
			title:d_limousin = { set_de_jure_liege_title = title:k_france }
			title:d_auvergne = { set_de_jure_liege_title = title:k_france }
		}
		
		#Give the rest of Aquitaine
		
		if = {
			limit = {
				game_start_date >= 1250.1.1
			}

			title:d_languedoc = { set_de_jure_liege_title = title:k_france }
			title:d_gevaudan = { set_de_jure_liege_title = title:k_france }
			title:d_toulouse = { set_de_jure_liege_title = title:k_france }
			title:d_armagnac = { set_de_jure_liege_title = title:k_france }
			title:d_gascogne = { set_de_jure_liege_title = title:k_france }
			title:d_aquitaine = { set_de_jure_liege_title = title:k_france }
		}
		
		#ERE Setup - To show the weakening of the ERE
		
		if = {
			limit = {
				game_start_date = 1018.8.1
			}
		
			title:k_bulgaria = { set_de_jure_liege_title = title:e_byzantium }
		}
		
		if = {
			limit = {
				game_start_date >= 1204.1.1
				game_start_date <= 1336.1.1
			}
			
			title:k_serbia = { set_de_jure_liege_title = title:e_carpathia } 
			
		}
		
		if = {
			limit = {
				game_start_date >= 1204.1.1
			}

			title:k_trebizond = { set_de_jure_liege_title = title:e_transcaucasia } 
			title:k_pontus = { set_de_jure_liege_title = title:e_transcaucasia } 
		}
		
		if = {
			limit = {
				game_start_date >= 1337.1.1
			}
		
			title:k_serbia = { set_de_jure_liege_title = title:e_serbia }
			title:k_epirus = { set_de_jure_liege_title = title:e_serbia } #Technically the empire was proclaimed before Epirus was conquered but this makes the Empire not only have 1 Kingdom and also makes it so it can't be made right away in 1337
		}
		
		#End ERE setup
		
		#Georgian Kingdoms
		if = {
			limit = {
				game_start_date >= 1259.1.1
				game_start_date <= 1336.1.1
			}
			
			title:d_abkhazia = { set_de_jure_liege_title = title:k_imereti }
			title:d_racha = { set_de_jure_liege_title = title:k_imereti }
			title:d_mingrelia = { set_de_jure_liege_title = title:k_imereti }
			title:d_meshketi = { set_de_jure_liege_title = title:k_imereti }
			title:d_imeretia = { set_de_jure_liege_title = title:k_imereti }
			
			
			title:d_kartli = { set_de_jure_liege_title = title:k_iberia }
			title:d_kakheti = { set_de_jure_liege_title = title:k_iberia }
			title:d_hereti = { set_de_jure_liege_title = title:k_iberia }
			title:d_georgia = { set_de_jure_liege_title = title:k_iberia }
		
		}
		
		
		###############################################################################################Asia###############################################################################################
		
		if = {
			limit = {
				game_start_date >= 1144.1.1
				game_start_date <= 1219.1.1
			}
			title:k_goguryeo_china = { set_de_jure_liege_title = title:e_jurchen_china }
			title:k_khitan_china = { set_de_jure_liege_title = title:e_jurchen_china }
			title:k_yan_china = { set_de_jure_liege_title = title:e_jurchen_china }
			title:k_yinshan_china = { set_de_jure_liege_title = title:e_jurchen_china }
		}
		
		if = {
			limit = {
				game_start_date >= 1234.1.1
				game_start_date <= 1271.1.1
			}
			title:k_goguryeo_china = { set_de_jure_liege_title = title:e_mongol_empire }
			title:k_khitan_china = { set_de_jure_liege_title = title:e_mongol_empire }
			title:k_yan_china = { set_de_jure_liege_title = title:e_mongol_empire }
			title:k_yinshan_china = { set_de_jure_liege_title = title:e_mongol_empire }
		}
		
		
		if = {
			limit = {
				game_start_date >= 900.1.1
				game_start_date <= 1143.1.1
			}
		
			title:k_zhetysu = { set_de_jure_liege_title = title:e_turan } 
			title:k_khwarezmia = { set_de_jure_liege_title = title:e_turan } 
			
		}
		
		#if = {
		#	limit = {
		#		game_start_date >= 1038.1.1
		#	}
		#
		#	title:k_khotan = { set_de_jure_liege_title = title:e_turan } 
		#	title:k_dzungaria = { set_de_jure_liege_title = title:e_turan } 
		#	
		#}
		
		if = {
			limit = {
				game_start_date >= 1144.1.1
			}
		
			title:k_zhetysu = { set_de_jure_liege_title = title:e_turan } 
			title:k_khwarezmia = { set_de_jure_liege_title = title:e_turan } 
			title:k_oghuz_il = { set_de_jure_liege_title = title:e_tartaria } 
			
		}
		
		if = {
			limit = {
				game_start_date >= 1234.1.1
			}

			title:k_oghuz_il = { set_de_jure_liege_title = title:e_blue_horde } 
			
		}
		
		if = {
			limit = {
				game_start_date >= 1206.1.1
				game_start_date <= 1338.1.1
			}

			title:d_phetchabun = { set_de_jure_liege_title = title:k_sukhothai } 
			title:d_sukhothai = { set_de_jure_liege_title = title:k_sukhothai } 
			title:d_tak = { set_de_jure_liege_title = title:k_sukhothai } 
			title:d_u_thong = { set_de_jure_liege_title = title:k_sukhothai } 
			title:d_pribpri = { set_de_jure_liege_title = title:k_sukhothai } 
			title:d_kra = { set_de_jure_liege_title = title:k_sukhothai } 
			
		}
		
		if = {
			limit = {
				game_start_date >= 1230.1.1
				game_start_date <= 1338.1.1
			}

			title:d_mallorca = { set_de_jure_liege_title = title:k_mallorca } 
			
		}
		
		if = {
			limit = {
				game_start_date >= 1060.1.1
				game_start_date <= 1338.1.1
			}
			
			title:d_hormuz = { set_de_jure_liege_title = title:k_ormus } 
			
		}
		
		if = {
			limit = {
				game_start_date >= 1215.1.1
			}
			
			title:d_sinhala = { set_de_jure_liege_title = title:k_jaffna } 
			
		}
		
		if = {
			limit = {
				game_start_date >= 1147.1.1
			}
			
			title:d_anartta = { set_de_jure_liege_title = title:k_kutch } 
			
		}
		
		
		if = {
			limit = {
				game_start_date >= 915.1.1
			}
			
			title:c_bhumilka = { set_de_jure_liege_title = title:d_bhumilka } 
			title:c_somnath = { set_de_jure_liege_title = title:d_bhumilka } 
			
		}
		
		if = {
			limit = {
				game_start_date >= 1324.1.1
			}
			
			title:d_dandakaranya = { set_de_jure_liege_title = title:k_bastar } 
			
		}
		
		if = {
			limit = {
				game_start_date >= 1324.1.1
			}
			
			title:d_vidharba = { set_de_jure_liege_title = title:k_chanda } 
			
		}
		
		if = {
			limit = {
				game_start_date >= 1170.1.1
			}

			title:d_sutiya = { set_de_jure_liege_title = title:k_chutia } 
		}
		
		if = {
			limit = {
				game_start_date >= 1228.1.1
			}
			
			title:d_ahom = { set_de_jure_liege_title = title:k_ahom } 
			title:c_haruppeswara = { set_de_jure_liege_title = title:d_ahom } 
			title:c_charaideo = { set_de_jure_liege_title = title:d_ahom } 
			title:d_para_lauhitya = { set_de_jure_liege_title = title:k_kachari } 
		}
		
		if = {
			limit = {
				game_start_date >= 734.1.1
			}
			
			title:d_medapata = { set_de_jure_liege_title = title:k_mewar } 
		}
		
		if = {
			limit = {
				game_start_date >= 1226.1.1
			}
			
			title:d_maru = { set_de_jure_liege_title = title:k_mawar } 
		}
		
		if = {
			limit = {
				game_start_date >= 1156.1.1
			}
			
			title:d_stravani = { set_de_jure_liege_title = title:k_jaisalmer } 
		}
		
		if = {
			limit = {
				game_start_date >= 1192.1.1
			}
			
			title:d_jangladesh = { set_de_jure_liege_title = title:k_jangladesh } 
		}
		
		if = {
			limit = {
				game_start_date >= 1220.1.1
			}
			
			title:d_baltiyul = { set_de_jure_liege_title = title:k_maqpon } 
		}
		
		if = {
			limit = {
				game_start_date >= 760.1.1
			}
			
			title:d_pamir = { set_de_jure_liege_title = title:k_gilgit } 
		}
		
		#Shan States
		if = {
			limit = {
				game_start_date >= 760.1.1
			}
			
			title:c_mongkawng = { set_de_jure_liege_title = title:d_mongkawng } 
			title:c_mongyang = { set_de_jure_liege_title = title:d_mongkawng } 
			title:c_hkamti = { set_de_jure_liege_title = title:d_mongkawng } 
		}
		
		if = {
			limit = {
				game_start_date >= 1110.1.1
			}
			
			title:d_mang_shuea = { set_de_jure_liege_title = title:k_mong_mao } 
			title:c_bhamo = { set_de_jure_liege_title = title:d_mang_shuea } 
		}

		#By the 1200's prob a good idea to make northern Japan de jure part of k_yamato rather than ezo
		if = {
			limit = {
				game_start_date >= 1200.1.1
			}
		
			title:d_mutsu = { set_de_jure_liege_title = title:k_yamato }
			title:d_dewa = { set_de_jure_liege_title = title:k_yamato } 
		}
		
		
		###############################################################################################Italian Republics###############################################################################################
		
		
		#Republic of Pavia - 1140-Rest of game		d_pavia_republic
		#Republic of Arezzo - 1167-Rest of game		d_arezzo_republic
		#Republic of Florence - 1167-Rest of game	d_firenze_republic
		#Republic of Lucca - 1160-Rest of game		d_lucca_republic
		#Republic of Mantua - 1167-Rest of game		d_mantua_republic
		#Republic of Parma - 1138-Rest of game		d_parma_republic
		#Republic of Padova - 1153-Rest of game		d_padova_republic
		#Republic of Asti - 1140-Rest of game		d_asti_republic
		#Republic of Siena - 1167-1310				d_siena_republic
		#Republic of Cremona - 1093-1310			d_cremona_republic
		#Republic of Milan - 1026-1310				d_milano_republic
		#Republic of Bergamo - 1095-1310			d_bergamo_republic
		#Republic of Vicenza - 1147-1297			d_vicenza_republic
		#Republic of Modena - 1149-1285				d_modena_republic
		#Republic of Reggio - 1136-1267				d_reggio_republic
		

		if = {
			limit = {
				game_start_date >= 1167.1.1
			}
		
			title:c_arezzo = { set_de_jure_liege_title = title:d_arezzo_republic } 
		}
		
		if = {
			limit = {
				game_start_date >= 1160.1.1
			}
		
			title:c_lucca = { set_de_jure_liege_title = title:d_lucca_republic } 
			title:c_luni = { set_de_jure_liege_title = title:d_lucca_republic } 
			title:c_guidi = { set_de_jure_liege_title = title:d_lucca_republic } 
		}
		
		if = {
			limit = {
				game_start_date >= 1167.1.1
			}
		
			title:c_mantua = { set_de_jure_liege_title = title:d_mantua_republic } 
			title:c_novellara = { set_de_jure_liege_title = title:d_mantua_republic } 
		}
		
		if = {
			limit = {
				game_start_date >= 1130.1.1
			}
		
			title:c_parma = { set_de_jure_liege_title = title:d_parma_republic } 
		}
		
		
		if = {
			limit = {
				game_start_date >= 1130.1.1
				game_start_date <= 1313.1.1
			}
		
			title:c_piacenza = { set_de_jure_liege_title = title:d_piacenza_republic } 
		}
		
		if = {
			limit = {
				game_start_date >= 1313.1.1
			}
		
			title:c_piacenza = { set_de_jure_liege_title = title:d_lombardia } 
		}
		
		if = {
			limit = {
				game_start_date >= 1153.1.1
			}
		
			title:c_padua = { set_de_jure_liege_title = title:d_padova_republic } 
		}
		
		if = {
			limit = {
				game_start_date >= 1140.1.1
			}
		
			title:c_monferrato = { set_de_jure_liege_title = title:d_asti_republic } 
		}
		
		if = {
			limit = {
				game_start_date >= 1167.1.1
			}
		
			title:c_siena = { set_de_jure_liege_title = title:d_siena_republic } 
			title:c_scialenga = { set_de_jure_liege_title = title:d_siena_republic } 
			title:c_piombino = { set_de_jure_liege_title = title:d_siena_republic } 
			title:c_orbetello = { set_de_jure_liege_title = title:d_siena_republic } 
		}
		
		
		if = {
			limit = {
				game_start_date >= 1026.1.1
				game_start_date <= 1310.1.1
			}
		
			title:c_valtelline = { set_de_jure_liege_title = title:d_milano_republic }
			title:c_lombardia = { set_de_jure_liege_title = title:d_milano_republic } 
			title:c_sepiro = { set_de_jure_liege_title = title:d_milano_republic } 
			title:c_como = { set_de_jure_liege_title = title:d_milano_republic } 
			title:c_bergamo = { set_de_jure_liege_title = title:d_milano_republic } 
			title:c_cremona = { set_de_jure_liege_title = title:d_milano_republic } 
			title:c_pavia = { set_de_jure_liege_title = title:d_milano_republic } 
			title:c_brescia = { set_de_jure_liege_title = title:d_milano_republic } 
			
		}
		
		if = {
			limit = {
				game_start_date >= 1093.1.1
				game_start_date <= 1310.1.1
			}
		
			title:c_cremona = { set_de_jure_liege_title = title:d_cremona_republic } 
		}
		
		if = {
			limit = {
				game_start_date >= 1140.1.1
			}
		
			title:c_pavia = { set_de_jure_liege_title = title:d_pavia_republic } 
		}
		
		if = {
			limit = {
				game_start_date >= 1095.1.1
				game_start_date <= 1310.1.1
			}
		
			title:c_bergamo = { set_de_jure_liege_title = title:d_bergamo_republic } 
			
		}
		
		if = {
			limit = {
				game_start_date >= 1147.1.1
				game_start_date <= 1297.1.1
			}
		
			title:c_bassano = { set_de_jure_liege_title = title:d_vicenza_republic } 
			title:c_verona = { set_de_jure_liege_title = title:d_vicenza_republic } 
			title:c_treviso = { set_de_jure_liege_title = title:d_vicenza_republic } 
		}
		
		if = {
			limit = {
				game_start_date >= 1140.1.1
				game_start_date <= 1335.1.1
			}
		
			title:c_modena = { set_de_jure_liege_title = title:d_modena_republic } 
		}
		
		if = {
			limit = {
				game_start_date >= 1140.1.1
				game_start_date <= 1335.1.1
			}
		
			title:c_reggionellemilia = { set_de_jure_liege_title = title:d_reggio_republic } 
		}
	}
	
}

MB_set_buildings = {

	effect = {
	
	########################################################################################### REMOVE SPECIAL BUILDINGS SETUP ###########################################################################################
		
		if = {
			limit = {
				game_start_date > 1258.1.1
			}
			province:4828 = {
				remove_building = house_of_wisdom_01
			}
		}

	########################################################################################### BUILDINGS ###########################################################################################
		
		#BAP Stuff
		
		## k_nubia
		# if = {
		# 	limit = {
		# 		title:b_aswan = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_aswan.title_province = {
		# 		add_special_building = wap_temple_of_philae_01
		# 	}
		# }
		# if = {
		# 	limit = {
		# 		title:b_old_dongola = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_old_dongola.title_province = {
		# 		add_special_building = wap_fortress_of_dongola_01
		# 	}
		# }
		# if = {
		# 	limit = {
		# 		title:b_abu_hammad = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_abu_hammad.title_province = {
		# 		add_special_building = wap_gold_mines_01
		# 	}
		# }
		# if = {
		# 	limit = {
		# 		title:b_shunqayr = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_shunqayr.title_province = {
		# 		add_special_building_slot = wap_gold_mines_01
		# 	}
		# }
		# if = {
		# 	limit = {
		# 		title:b_al-ghazali = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_al-ghazali.title_province = {
		# 		add_special_building = wap_ghazali_monastery_01
		# 	}
		# }
		# if = {
		# 	limit = {
		# 		title:b_naga = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_naga.title_province = {
		# 		add_special_building = wap_temple_of_apedemak_01
		# 	}
		# }
		# if = {
		# 	limit = {
		# 		title:b_fazughli = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_fazughli.title_province = {
		# 		add_special_building = wap_gold_mines_01
		# 	}
		# }
		# if = {
		# 	limit = {
		# 		title:b_faras = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_faras.title_province = {
		# 		add_special_building = wap_cathedral_of_our_lady_01
		# 	}
		# }
		# if = {
		# 	limit = {
		# 		title:b_qasr_ibrim = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_qasr_ibrim.title_province = {
		# 		add_special_building = wap_st_marys_cathedral_01
		# 	}
		# }
		# if = {
		# 	limit = {
		# 		title:b_nuri = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_nuri.title_province = {
		# 		add_special_building = wap_pyramids_at_nuri_01
		# 	}
		# }
		# if = {
		# 	limit = {
		# 		title:b_kareima = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_kareima.title_province = {
		# 		add_special_building = wap_temple_of_amun_01
		# 	}
		# }
		
		# if = {
		# 	limit = {
		# 		title:b_khawr_nubt = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_khawr_nubt.title_province = {
		# 		add_special_building_slot = wap_gold_mines_01
		# 	}
		# }
		
		# #Ethiopia and the Horn
	
		# if = {
		# 	limit = {
		# 		title:b_zaila = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_zaila.title_province = {
		# 		add_special_building_slot = wap_masjid_al_qiblatayn_01
		# 	}
		# }
		
		# #if = {
		# #	limit = {
		# #		title:b_marka = { #Should be in b_mogadishu but CK3 doesn't allow multiple special buildings
		# #			title_province = { has_special_building_slot = no }
		# #		}
		# #	}
		# #	title:b_marka.title_province = {
		# #		add_special_building_slot = wap_masjid_fakhr_ad_din_01
		# #	}
		# #}
		# if = {
		# 	limit = {
		# 		title:b_aksum = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_aksum.title_province = {
		# 		add_special_building = wap_church_of_our_lady_mary_of_zion_01
		# 	}
		# }
		# if = {
		# 	limit = {
		# 		title:b_lalibela = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_lalibela.title_province = {
		# 		add_special_building_slot = wap_rockhewn_church_01
		# 	}
		# }
		# title:b_shimazana.title_province = {
		# 	set_holding_type = church_holding
		# }
		# if = {
		# 	limit = {
		# 		title:b_shimazana = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_shimazana.title_province = {
		# 		add_special_building = wap_dabra_dammo_01
		# 	}
		# }
	
		
		# ## k_akan
		# if = {
		# 	limit = {
		# 		title:b_aowin = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_aowin.title_province = {
		# 		add_special_building_slot = wap_gold_mines_01
		# 	}
		# }
		# if = {
		# 	limit = {
		# 		title:b_bonduku = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_bonduku.title_province = {
		# 		add_special_building_slot = wap_gold_mines_01
		# 	}
		# }
		# if = {
		# 	limit = {
		# 		title:b_tarkwa = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_tarkwa.title_province = {
		# 		add_special_building_slot = wap_gold_mines_01
		# 	}
		# }
		# #k_ghana
		# if = {
		# 	limit = {
		# 		title:b_al-ghaba = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_al-ghaba.title_province = {
		# 		add_special_building = wap_palace_of_al_ghaba_01
		# 	}
		# }
		# title:b_kumbi.title_province = {
		# 	set_holding_type = church_holding
		# }
		# if = {
		# 	limit = {
		# 		title:b_kumbi = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_kumbi.title_province = {
		# 		add_special_building = wap_cavern_of_bida_01
		# 	}
		# }
		# if = {
		# 	limit = {
		# 		title:b_tichitt = {
		# 			title_province = {  has_special_building = no has_special_building_slot = no }
		# 		}
		# 	}
		# 	title:b_tichitt.title_province = {
		# 		add_special_building_slot = wap_dhar_tichitt_01
		# 	}
		# }
		# #k_gao
		# title:b_gao = {
		# 	title_province = {
		# 		if = {
		# 			limit = {
		# 				current_date >= 800.1.1
		# 				current_date < 1066.1.1
		# 				title_province = {  has_special_building = no has_special_building_slot = no }
		# 			}
		# 			add_special_building_slot = wap_palace_of_gao_01
		# 		}
		# 		else_if = {
		# 			limit = {
		# 				current_date >= 1066.1.1
		# 			}
		# 			add_special_building = wap_palace_of_gao_01
		# 		}
		# 	}
		# }
		
		# #senegambia
		# 	title:b_badibu.title_province = {
		# 		add_special_building = wap_senegambian_stone_circles_01
		# 	}
			
		# #k_hausaland
		# 	title:b_kano.title_province = {
		# 		add_special_building = wap_walls_of_kano_01
		# 	}
		# #k_nri
		# 	title:b_igbo-ukwu.title_province = { 
		# 		add_special_building = wap_bronze_industry_01
		# 	}
		# #k_benin
		# 	title:b_edo.title_province = { 
		# 		add_special_building_slot = wap_bronze_industry_01
		# 	}
		# #k_sao
		# 	title:b_banre.title_province = { 
		# 		add_special_building = wap_bronze_industry_01
		# 	}
		# #k_hausaland
		# 	title:b_daura.title_province = {
		# 		add_special_building = wap_sarki_well_01
		# 	}
		# #k_yorubaland
		# 	title:b_ile-ife.title_province = {
		# 		add_special_building = wap_oracle_of_ife_01
		# 	}
		# 	title:b_owu.title_province = { 
		# 		add_special_building_slot = wap_bronze_industry_01
		# 	}
		# 	title:b_ijebu.title_province = { 
		# 		add_special_building_slot = wap_sungbos_eredo_01
		# 	}
			
		# #k_kong
		# 	title:b_loropeni.title_province = {
		# 		add_special_building_slot = wap_walls_of_loropeni_01
		# 	}
		# 	title:b_takkeda.title_province = { 
		# 		add_special_building = wap_copper_mine_01
		# 	}
		# #k_sahara
		# 	title:b_tadmekka.title_province = { 
		# 		add_special_building = wap_salt_mine_01
		# 	}
			
		# #k_anyiba
		# title:b_bilma.title_province = { 
		# 	add_special_building = wap_salt_mine_01
		# }
		# #title:b_taghaza.title_province = { ###Added now by PDX
		# #	add_special_building = wap_salt_mine_01
		# #}
		
		# #amazigh holy sites
		# 	title:b_ahaggar.title_province = {
		# 		set_holding_type = church_holding
		# 	}
		# 	if = {
		# 		limit = {
		# 			title:b_ahaggar = {
		# 				title_province = {  has_special_building = no has_special_building_slot = no }
		# 			}
		# 		}
		# 		title:b_ahaggar.title_province = {
		# 			add_special_building = wap_tomb_of_tin_hinan_01
		# 		}
		# 	}
		# 	title:b_bilizma.title_province = { 
		# 		add_special_building = wap_madghacen_01
		# 	}
		# 	title:b_sharshal.title_province = {
		# 		add_special_building = wap_mausoleum_of_juba_01
		# 	}
			
		#Buildings post 1200 - Something to do over time
		
		if = {
			limit = {
				game_start_date > 1170.1.1
			}
			
			
			#Castles
			
			province:1887 = {
				add_building = castle_02
			}	
			province:1806 = {
				add_building = castle_02
			}
			province:1816 = {
				add_building = castle_02
			}
			province:1754 = {
				add_building = castle_02
			}
			province:1995 = {
				add_building = castle_02
			}
			province:1855 = {
				add_building = castle_02
			}
			province:1919 = {
				add_building = castle_03
			}
			province:2214 = {
				add_building = castle_02
			}
			province:2152 = {
				add_building = castle_02
			}
			province:1665 = {
				add_building = castle_02
			}
			province:1741 = {
				add_building = castle_02
			}
			province:2092 = {
				add_building = castle_02
			}
			province:63 = {
				add_building = castle_02
			}
			province:341 = {
				add_building = castle_02
			}
			province:234 = {
				add_building = castle_02
			}
			province:527 = {
				add_building = castle_02
			}
			province:3803 = {
				add_building = castle_02
			}
			province:473 = {
				add_building = castle_02
			}
			province:678 = {
				add_building = castle_02
			}
			province:9862 = {
				add_building = castle_02
			}	
			province:1595 = {
				add_building = castle_03
			}	
			
			province:7154 = {
				add_building = tribe_02
			}	
			
			
		}
		
		if = {
			limit = {
				game_start_date > 769.1.1
				game_start_date < 1203.1.1
			}
			
			province:9830 = { # Hagia Sophia
				add_building = temple_03
			}	
			
		}
		
		if = {
			limit = {
				game_start_date > 1204.1.1
			}
			
			province:9830 = { # Hagia Sophia
				add_building = temple_02
			}	
			
		}
		
		if = {
			limit = {
				game_start_date > 1150.1.1
				game_start_date < 1336.1.1
			}
			
			province:1457 = {
				add_building = tribe_02
			}	
			
		}
		
		########################################################################################### BUILDING SLOTS ###########################################################################################
		
		#Increase building slots for some major cities//deal with errors about a holding not having enough slots for buildings its set to have in history
		
		if = {
			limit = {
				game_start_date > 866.1.1
			}
			
			title:b_napoli.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_hanau.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_marseille.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_lisboa.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_toledo.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_pamplona.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_burgos.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_winchester.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_edinburgh.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_milano.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_bologna.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_pisa.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_palermo.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_syracusa.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_praha.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_krakow.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_sighnaq.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_trebizond.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_tekor.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_tbilisi.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_tabriz.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_rayy.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_oslosyslar.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_cordoba.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_regensburg.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_linz.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_acre.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_neuss.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
		
			title:b_baghdad.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_thessaloniki.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
			
			title:b_constantinople.title_province = { 
			
				add_province_modifier = extra_building_slot
				
			}
		}
	}
	
}

lutici_rename_effect_setup = {

	trigger = {
        game_start_date <= 940.1.1
    }
	
	effect = {
		lutici_rename_effect = yes
	}
	
}


character_variables= {

	trigger = {
        game_start_date <= 940.1.1
    }
	
	effect = {
		lutici_rename_effect = yes
	}
	
}


set_global_variablesMB = {

	trigger = {
        game_start_date >= 1204.1.1
    }
	
	effect = {
		set_global_variable = {
			name = mongols_have_appeared
			value = yes
		}
		set_global_variable = {
			name = frankokratia_occurred
			value = yes
		}
	}
	
}

asdac_on_title_gain = {

	effect = {
	
		if = {
			limit = {
				scope:title = {
					tier >= tier_kingdom
				}
				has_nickname = nick_the_black_prince
				this = character:454501
			}
			give_nickname = nick_the_black
		}
		if = {
			limit = {
				#scope:title = { is_holy_order = yes }
				NOT = { has_trait = order_member }
				has_government = holy_order_county_government
			}
			add_trait = order_member
		}
	}
	
}

asdac_on_birth_child = {

	effect = {
	
		if = {
			limit = {
				scope:child = {
					is_female = yes
				}
				scope:father = character:471500
			}
			add_trait = disinherited
		}
	}
	
}

on_persia_struggle_821 = {

	trigger = {
		game_start_date < 867.1.1  # Paradox auto-start the struggle if you start the game in 867
		current_date < 867.1.1 # No need to check this later
		NOT = { has_global_variable = persia_struggle_821_triggered } # To prevent multiple split (which will not have any effect)
		NOT = { exists = struggle:persian_struggle }
		current_date >= 821.1.1 # Historic year when the Iranian Intermezzo has start
	}
	
	effect = {
		start_struggle = {
			struggle_type = persian_struggle
			start_phase = struggle_persia_phase_stabilisation
		}
	
		set_global_variable = {
			name = persia_struggle_821_triggered
			value = yes
		}
	}
	
}


KOH_holy_orders = {

	effect = {
		
		if = {
            limit = {
                game_start_date >= 1099.1.1
                game_start_date <= 1099.12.31
            }
			
			##1099
				
				character:10072 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1099.7.15
						}
						trigger_event = {
							id = KoH_holy_orders.108 #Hospitaller Creation
							days = -1
						}
					}
				}
				
				character:144225 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1099.7.15
						}
						trigger_event = {
							id = KoH_holy_orders.109 #Assassin Buffs
							days = 1
						}
					}
				}
				character:144225 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1099.7.15
						}
						trigger_event = {
							id = KoH_holy_orders.110 #Assassin Buffs
							days = -1
						}
					}
				}
			}
			
		if = {
            limit = {
                game_start_date >= 1124.1.1
                game_start_date <= 1124.12.31
            }
			
			##1124
				
				character:232007 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1124.7.7
						}
						trigger_event = {
							id = KoH_holy_orders.104 #Templar Creation
							days = -1
						}
					}
				}
				character:232007 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1124.7.7
						}
						trigger_event = {
							id = KoH_holy_orders.105 #Hospitaller Creation
							days = -1
						}
					}
				}
				
				character:144226 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1124.7.7
						}
						trigger_event = {
							id = KoH_holy_orders.106 #Assassin Buffs
							days = 1
						}
					}
				}
				character:144226 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1124.7.7
						}
						trigger_event = {
							id = KoH_holy_orders.107 #Assassin Buffs
							days = -1
						}
					}
				}
			}
			
		if = {
            limit = {
                game_start_date >= 1166.1.1
                game_start_date <= 1166.12.31
			}
			
			##1166
				
				character:223520 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1166.4.1
						}
						trigger_event = {
							id = KoH_holy_orders.1 #Templar Creation
							days = -1
						}
					}
				}
				character:223520 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1166.4.1
						}
						trigger_event = {
							id = KoH_holy_orders.2 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:207510 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1166.4.1
						}
						trigger_event = {
							id = KoH_holy_orders.5 #Calavatra Creation
							days = -1
						}
					}
				}
				#character:207510 = {
				#	if = {
				#		limit = {
				#			is_alive = yes
				#			game_start_date = 1166.4.1
				#		}
				#		trigger_event = {
				#			id = KoH_holy_orders.7 #Santiago creation
				#			days = -1
				#		}
				#	}
				#}
		
				character:227012 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1166.4.1
						}
						trigger_event = {
							id = KoH_holy_orders.102 #Assassin Buffs
							days = 1
						}
					}
				}
				character:227012 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1166.4.1
						}
						trigger_event = {
							id = KoH_holy_orders.103 #Assassin Buffs
							days = -1
						}
					}
				}
			}
			
		if = {
            limit = {
                game_start_date >= 1171.1.1
                game_start_date <= 1171.12.31
			}
			
			##1166
				
				character:223520 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1171.8.1
						}
						trigger_event = {
							id = KoH_holy_orders.1 #Templar Creation
							days = -1
						}
					}
				}
				character:223520 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1171.8.1
						}
						trigger_event = {
							id = KoH_holy_orders.2 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:207510 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1171.8.1
						}
						trigger_event = {
							id = KoH_holy_orders.5 #Calavatra Creation
							days = -1
						}
					}
				}
				#character:207510 = {
				#	if = {
				#		limit = {
				#			is_alive = yes
				#			game_start_date = 1171.8.1
				#		}
				#		trigger_event = {
				#			id = KoH_holy_orders.7 #Santiago creation
				#			days = -1
				#		}
				#	}
				#}
		
				character:227012 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1171.8.1
						}
						trigger_event = {
							id = KoH_holy_orders.102 #Assassin Buffs
							days = 1
						}
					}
				}
				character:227012 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1171.8.1
						}
						trigger_event = {
							id = KoH_holy_orders.103 #Assassin Buffs
							days = -1
						}
					}
				}
			}
			
		if = {
            limit = {
                game_start_date >= 1187.1.1
                game_start_date <= 1187.12.31
			}
			
			#1187
		
				character:223500 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1187.8.31
						}
						trigger_event = {
							id = KoH_holy_orders.111 #Templar Creation
							days = -1
						}
					}
				}
				character:223500 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1187.8.31
						}
						trigger_event = {
							id = KoH_holy_orders.112 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:207510 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1187.8.31
						}
						trigger_event = {
							id = KoH_holy_orders.113 #Calavatra Creation
							days = -1
						}
					}
				}
				character:207510 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1187.8.31
						}
						trigger_event = {
							id = KoH_holy_orders.114 #Santiago creation
							days = -1
						}
					}
				}
		
				character:227012 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1187.8.31
						}
						trigger_event = {
							id = KoH_holy_orders.115 #Assassin Buffs
							days = 1
						}
					}
				}
				character:227012 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1187.8.31
						}
						trigger_event = {
							id = KoH_holy_orders.116 #Assassin Buffs
							days = -1
						}
					}
				}
			}
			
		if = {
            limit = {
                game_start_date >= 1204.1.1
                game_start_date <= 1204.12.31
			}
				
			#1204
			
				character:223505 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1204.5.16
						}
						trigger_event = {
							id = KoH_holy_orders.117 #Templar Creation
							days = -1
						}
					}
				}
				character:223505 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1204.5.16
						}
						trigger_event = {
							id = KoH_holy_orders.118 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:207510 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1204.5.16
						}
						trigger_event = {
							id = KoH_holy_orders.119 #Calavatra Creation
							days = -1
						}
					}
				}
				character:207510 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1204.5.16
						}
						trigger_event = {
							id = KoH_holy_orders.120 #Santiago creation
							days = -1
						}
					}
				}
		
				character:144228 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1204.5.16
						}
						trigger_event = {
							id = KoH_holy_orders.121 #Assassin Buffs
							days = 1
						}
					}
				}
				character:144228 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1204.5.16
						}
						trigger_event = {
							id = KoH_holy_orders.122 #Assassin Buffs
							days = -1
						}
					}
				}
			}
			
		if = {
            limit = {
                game_start_date >= 1220.1.1
                game_start_date <= 1220.12.31
			}
			
			#1220
			
				character:30809 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1220.5.16
						}
						trigger_event = {
							id = KoH_holy_orders.123 #Templar Creation
							days = -1
						}
					}
				}
				character:30809 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1220.5.16
						}
						trigger_event = {
							id = KoH_holy_orders.124 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:457620 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1220.5.16
						}
						trigger_event = {
							id = KoH_holy_orders.125 #Calavatra Creation
							days = -1
						}
					}
				}
				character:457620 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1220.5.16
						}
						trigger_event = {
							id = KoH_holy_orders.126 #Santiago creation
							days = -1
						}
					}
				}
		
				character:144229 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1220.5.16
						}
						trigger_event = {
							id = KoH_holy_orders.127 #Assassin Buffs
							days = 1
						}
					}
				}
				character:144229 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1220.5.16
						}
						trigger_event = {
							id = KoH_holy_orders.128 #Assassin Buffs
							days = -1
						}
					}
				}
				
				character:219502 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1220.5.16
						}
						trigger_event = {
							id = KoH_holy_orders.129 #Teutonic creation
							days = -1
						}
					}
				}
			}
		
		if = {
            limit = {
                game_start_date >= 1246.1.1
                game_start_date <= 1246.12.31
			}
			
			#1241
			
				character:461905 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1246.6.13 
						}
						trigger_event = {
							id = KoH_holy_orders.130 #Templar Creation
							days = -1
						}
					}
				}
				character:31024 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1246.6.13 
						}
						trigger_event = {
							id = KoH_holy_orders.131 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:457620 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1246.6.13 
						}
						trigger_event = {
							id = KoH_holy_orders.132 #Calavatra Creation
							days = -1
						}
					}
				}
				character:457620 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1246.6.13 
						}
						trigger_event = {
							id = KoH_holy_orders.133 #Santiago creation
							days = -1
						}
					}
				}
		
				character:144230 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1246.6.13 
						}
						trigger_event = {
							id = KoH_holy_orders.134 #Assassin Buffs
							days = 1
						}
					}
				}
				character:144230 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1246.6.13 
						}
						trigger_event = {
							id = KoH_holy_orders.135 #Assassin Buffs
							days = -1
						}
					}
				}
				
				character:30406 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1246.6.13 
						}
						trigger_event = {
							id = KoH_holy_orders.136 #Teutonic creation
							days = -1
						}
					}
				}
				
				character:30406 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1246.6.13 
						}
						trigger_event = {
							id = KoH_holy_orders.137 #Teutonic creation
							days = -1
						}
					}
				}
			}
		
		if = {
            limit = {
                game_start_date >= 1267.1.1
                game_start_date <= 1267.12.31
			}
			
			#1267
			
				character:461905 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1267.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.138 #Templar Creation
							days = -1
						}
					}
				}
				character:461905 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1267.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.139 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:457540 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1267.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.140 #Calavatra Creation
							days = -1
						}
					}
				}
				character:457540 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1267.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.141 #Santiago creation
							days = -1
						}
					}
				}
				
				character:30409 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1267.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.144 #Teutonic creation
							days = -1
						}
					}
				}
				
				character:30409 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1267.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.145 #Teutonic creation
							days = -1
						}
					}
				}
			}
			
		if = {
            limit = {
                game_start_date >= 1286.1.1
                game_start_date <= 1286.12.31
			}
				
			#1285
			
				character:138024 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1286.3.15
						}
						trigger_event = {
							id = KoH_holy_orders.146 #Templar Creation
							days = -1
						}
					}
				}
				character:138024 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1286.3.15
						}
						trigger_event = {
							id = KoH_holy_orders.147 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:457530 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1286.3.15
						}
						trigger_event = {
							id = KoH_holy_orders.148 #Calavatra Creation
							days = -1
						}
					}
				}
				character:457530 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1286.3.15
						}
						trigger_event = {
							id = KoH_holy_orders.149 #Santiago creation
							days = -1
						}
					}
				}
				
				character:30411 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1286.3.15
						}
						trigger_event = {
							id = KoH_holy_orders.150 #Teutonic creation
							days = -1
						}
					}
				}
				
				character:30411 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1286.3.15
						}
						trigger_event = {
							id = KoH_holy_orders.151 #Teutonic creation
							days = -1
						}
					}
				}
			}
			
		if = {
            limit = {
                game_start_date >= 1310.1.1
                game_start_date <= 1310.12.31
			}
				
			#1310
			
				character:459510 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1310.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.152 #Templar Creation
							days = -1
						}
					}
				}
				character:147024 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1310.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.153 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:147024 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1310.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.154 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:457520 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1310.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.155 #Calavatra Creation
							days = -1
						}
					}
				}
				character:457520 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1310.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.156 #Santiago creation
							days = -1
						}
					}
				}
				
				character:30414 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1310.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.157 #Teutonic creation
							days = -1
						}
					}
				}
				
				character:30414 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1310.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.158 #Teutonic creation
							days = -1
						}
					}
				}
			}
			
		if = {
            limit = {
                game_start_date >= 1324.1.1
                game_start_date <= 1324.12.31
			}
				
			#1324
			
				character:459510 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1310.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.205 #Templar Creation
							days = -1
						}
					}
				}
				character:478502 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1310.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.206 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:478502 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1310.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.207 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:457500 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1310.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.208 #Calavatra Creation
							days = -1
						}
					}
				}
				character:457500 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1310.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.209 #Santiago creation
							days = -1
						}
					}
				}
				
				character:30416 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1310.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.210 #Teutonic creation
							days = -1
						}
					}
				}
				
				character:30416 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1310.6.1
						}
						trigger_event = {
							id = KoH_holy_orders.211 #Teutonic creation
							days = -1
						}
					}
				}
			}
			
		if = {
            limit = {
                game_start_date >= 1337.1.1
                game_start_date <= 1337.12.31
			}
				
			##1337
			
				character:459500 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1337.5.24
						}
						trigger_event = {
							id = KoH_holy_orders.159 #Templar Creation
							days = -1
						}
					}
				}
				character:478502 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1337.5.24
						}
						trigger_event = {
							id = KoH_holy_orders.160 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:478502 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1337.5.24
						}
						trigger_event = {
							id = KoH_holy_orders.161 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:457500 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1337.5.24
						}
						trigger_event = {
							id = KoH_holy_orders.162 #Calavatra Creation
							days = -1
						}
					}
				}
				character:457500 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1337.5.24
						}
						trigger_event = {
							id = KoH_holy_orders.163 #Santiago creation
							days = -1
						}
					}
				}
				
				character:474000 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1337.5.24
						}
						trigger_event = {
							id = KoH_holy_orders.164 #Teutonic creation
							days = -1
						}
					}
				}
				
				character:474000 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1337.5.24
						}
						trigger_event = {
							id = KoH_holy_orders.165 #Teutonic creation
							days = -1
						}
					}
				}
			}
			
		if = {
            limit = {
                game_start_date >= 1144.1.1
                game_start_date <= 1144.12.31
			}
			
			#1144
				
				character:231067 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1144.10.1
						}
						trigger_event = {
							id = KoH_holy_orders.166 #Templar Creation
							days = -1
						}
					}
				}
				character:231067 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1144.10.1
						}
						trigger_event = {
							id = KoH_holy_orders.167 #Hospitaller Creation
							days = -1
						}
					}
				}
				
				character:144227 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1144.10.1
						}
						trigger_event = {
							id = KoH_holy_orders.168 #Assassin Buffs
							days = 1
						}
					}
				}
				character:144227 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1144.10.1
						}
						trigger_event = {
							id = KoH_holy_orders.169 #Assassin Buffs
							days = -1
						}
					}
				}
			}
			
		if = {
            limit = {
                game_start_date >= 1194.1.1
                game_start_date <= 1194.12.31
			}
				
			#1194
			
				character:223524 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1194.9.30
						}
						trigger_event = {
							id = KoH_holy_orders.170 #Templar Creation
							days = -1
						}
					}
				}
				character:223524 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1194.9.30
						}
						trigger_event = {
							id = KoH_holy_orders.171 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:207510 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1194.9.30
						}
						trigger_event = {
							id = KoH_holy_orders.172 #Calavatra Creation
							days = -1
						}
					}
				}
				character:207510 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1194.9.30
						}
						trigger_event = {
							id = KoH_holy_orders.173 #Santiago creation
							days = -1
						}
					}
				}
		
				character:144228 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1194.9.30
						}
						trigger_event = {
							id = KoH_holy_orders.174 #Assassin Buffs
							days = 1
						}
					}
				}
				character:144228 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1194.9.30
						}
						trigger_event = {
							id = KoH_holy_orders.175 #Assassin Buffs
							days = -1
						}
					}
				}
			}
			
			
		if = {
            limit = {
                game_start_date >= 1234.1.1
                game_start_date <= 1234.12.31
			}		
				
			#1229
			
				character:138019 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1234.4.6
						}
						trigger_event = {
							id = KoH_holy_orders.176 #Templar Creation
							days = -1
						}
					}
				}
				character:138019 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1234.4.6
						}
						trigger_event = {
							id = KoH_holy_orders.177 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:457620 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1234.4.6
						}
						trigger_event = {
							id = KoH_holy_orders.178 #Calavatra Creation
							days = -1
						}
					}
				}
				character:457620 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1234.4.6
						}
						trigger_event = {
							id = KoH_holy_orders.179 #Santiago creation
							days = -1
						}
					}
				}
		
				character:144230 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1234.4.6
						}
						trigger_event = {
							id = KoH_holy_orders.180 #Assassin Buffs
							days = 1
						}
					}
				}
				character:144230 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1234.4.6
						}
						trigger_event = {
							id = KoH_holy_orders.181 #Assassin Buffs
							days = -1
						}
					}
				}
				
				character:30403 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1234.4.6
						}
						trigger_event = {
							id = KoH_holy_orders.182 #Teutonic creation
							days = -1
						}
					}
				}
				
				character:30403 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1234.4.6
						}
						trigger_event = {
							id = KoH_holy_orders.183 #Teutonic creation
							days = -1
						}
					}
				}
			}
				
		
		if = {
            limit = {
                game_start_date >= 1300.1.1
                game_start_date <= 1300.12.31
			}
			
			#1300
			
				character:138024 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1300.9.10
						}
						trigger_event = {
							id = KoH_holy_orders.184 #Templar Creation
							days = -1
						}
					}
				}
				character:138024 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1300.9.10
						}
						trigger_event = {
							id = KoH_holy_orders.185 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:457520 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1300.9.10
						}
						trigger_event = {
							id = KoH_holy_orders.186 #Calavatra Creation
							days = -1
						}
					}
				}
				character:457520 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1300.9.10
						}
						trigger_event = {
							id = KoH_holy_orders.187 #Santiago creation
							days = -1
						}
					}
				}
				
				character:30413 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1300.9.10
						}
						trigger_event = {
							id = KoH_holy_orders.188 #Teutonic creation
							days = -1
						}
					}
				}
				
				character:30413 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1300.9.10
						}
						trigger_event = {
							id = KoH_holy_orders.189 #Teutonic creation
							days = -1
						}
					}
				}
			}
				
		
		if = {
            limit = {
                game_start_date >= 1258.1.1
                game_start_date <= 1258.12.31
			}
				
			#1258
			
				character:461905 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1258.2.15 
						}
						trigger_event = {
							id = KoH_holy_orders.190 #Templar Creation
							days = -1
						}
					}
				}
				character:31031 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1258.2.15 
						}
						trigger_event = {
							id = KoH_holy_orders.191 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:457540 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1258.2.15
						}
						trigger_event = {
							id = KoH_holy_orders.192 #Calavatra Creation
							days = -1
						}
					}
				}
				character:457540 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1258.2.15
						}
						trigger_event = {
							id = KoH_holy_orders.193 #Santiago creation
							days = -1
						}
					}
				}
		
				character:8000525 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1258.2.15 
						}
						trigger_event = {
							id = KoH_holy_orders.194 #Assassin Buffs
							days = 1
						}
					}
				}
				character:8000525 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1258.2.15
						}
						trigger_event = {
							id = KoH_holy_orders.195 #Assassin Buffs
							days = -1
						}
					}
				}
				
				character:30409 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1258.2.15
						}
						trigger_event = {
							id = KoH_holy_orders.196 #Teutonic creation
							days = -1
						}
					}
				}
				
				character:30409 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1258.2.15
						}
						trigger_event = {
							id = KoH_holy_orders.197 #Teutonic creation
							days = -1
						}
					}
				}
			}
			
			
			if = {
            limit = {
                game_start_date >= 1211.1.1
                game_start_date <= 1211.12.31
			}
				
			#1211
			
				character:461742 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1211.6.16
						}
						trigger_event = {
							id = KoH_holy_orders.212 #Templar Creation
							days = -1
						}
					}
				}
				character:461742 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1211.6.16
						}
						trigger_event = {
							id = KoH_holy_orders.213 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:207510 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1211.6.16
						}
						trigger_event = {
							id = KoH_holy_orders.214 #Calavatra Creation
							days = -1
						}
					}
				}
				character:207510 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1211.6.16
						}
						trigger_event = {
							id = KoH_holy_orders.215 #Santiago creation
							days = -1
						}
					}
				}
		
				character:144229 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1211.6.16
						}
						trigger_event = {
							id = KoH_holy_orders.216 #Assassin Buffs
							days = 1
						}
					}
				}
				character:144229 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1211.6.16
						}
						trigger_event = {
							id = KoH_holy_orders.217 #Assassin Buffs
							days = -1
						}
					}
				}
				
				character:219502 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1211.6.16
						}
						trigger_event = {
							id = KoH_holy_orders.218 #Teutonic creation
							days = -1
						}
					}
				}
			}
			
			
			if = {
            limit = {
                game_start_date >= 1157.1.1
                game_start_date <= 1157.12.31
			}
			
			##1166
				
				character:231067 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1157.5.8
						}
						trigger_event = {
							id = KoH_holy_orders.219 #Templar Creation
							days = -1
						}
					}
				}
				character:231067 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1157.5.8
						}
						trigger_event = {
							id = KoH_holy_orders.220 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:207500 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1157.5.8
						}
						trigger_event = {
							id = KoH_holy_orders.221 #Calavatra Creation
							days = -1
						}
					}
				}
				
				character:144227 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1157.5.8
						}
						trigger_event = {
							id = KoH_holy_orders.222 #Assassin Buffs
							days = 1
						}
					}
				}
				character:144227 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1157.5.8
						}
						trigger_event = {
							id = KoH_holy_orders.223 #Assassin Buffs
							days = -1
						}
					}
				}
			}
			
		if = {
            limit = {
                game_start_date >= 1178.1.1
                game_start_date <= 1178.12.31
			}
			
			#1178
		
				character:223523 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1178.10.1
						}
						trigger_event = {
							id = KoH_holy_orders.111 #Templar Creation
							days = -1
						}
					}
				}
				character:223523 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1178.10.1
						}
						trigger_event = {
							id = KoH_holy_orders.112 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:207510 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1178.10.1
						}
						trigger_event = {
							id = KoH_holy_orders.113 #Calavatra Creation
							days = -1
						}
					}
				}
				character:207510 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1178.10.1
						}
						trigger_event = {
							id = KoH_holy_orders.114 #Santiago creation
							days = -1
						}
					}
				}
		
				character:227012 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1178.10.1
						}
						trigger_event = {
							id = KoH_holy_orders.115 #Assassin Buffs
							days = 1
						}
					}
				}
				character:227012 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1178.10.1
						}
						trigger_event = {
							id = KoH_holy_orders.116 #Assassin Buffs
							days = -1
						}
					}
				}
			}
			
		if = {
            limit = {
                game_start_date >= 1250.1.1
                game_start_date <= 1250.12.31
			}
			
			#1250
			
				character:461905 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1250.5.1 
						}
						trigger_event = {
							id = KoH_holy_orders.230 #Templar Creation
							days = -1
						}
					}
				}
				character:31024 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1250.5.1 
						}
						trigger_event = {
							id = KoH_holy_orders.231 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:457620 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1250.5.1 
						}
						trigger_event = {
							id = KoH_holy_orders.232 #Calavatra Creation
							days = -1
						}
					}
				}
				character:457620 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1250.5.1 
						}
						trigger_event = {
							id = KoH_holy_orders.233 #Santiago creation
							days = -1
						}
					}
				}
		
				character:144230 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1250.5.1 
						}
						trigger_event = {
							id = KoH_holy_orders.234 #Assassin Buffs
							days = 1
						}
					}
				}
				character:144230 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1250.5.1 
						}
						trigger_event = {
							id = KoH_holy_orders.235 #Assassin Buffs
							days = -1
						}
					}
				}
				
				character:30407 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1250.5.1 
						}
						trigger_event = {
							id = KoH_holy_orders.236 #Teutonic creation
							days = -1
						}
					}
				}
				
				character:30407 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1250.5.1 
						}
						trigger_event = {
							id = KoH_holy_orders.237 #Teutonic creation
							days = -1
						}
					}
				}
			}
			
			
		if = {
            limit = {
                game_start_date >= 1295.1.1
                game_start_date <= 1295.12.31
			}
			
			#1295
			
				character:138024 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1295.6.16
						}
						trigger_event = {
							id = KoH_holy_orders.238 #Templar Creation
							days = -1
						}
					}
				}
				character:138024 = {
					if = {
						limit = {
							is_alive = yes
							is_landed = yes
							game_start_date = 1295.6.16
						}
						trigger_event = {
							id = KoH_holy_orders.239 #Hospitaller Creation
							days = -1
						}
					}
				}
				character:457520 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1295.6.16
						}
						trigger_event = {
							id = KoH_holy_orders.240 #Calavatra Creation
							days = -1
						}
					}
				}
				character:457520 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1295.6.16
						}
						trigger_event = {
							id = KoH_holy_orders.241 #Santiago creation
							days = -1
						}
					}
				}
				
				character:30412 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1295.6.16
						}
						trigger_event = {
							id = KoH_holy_orders.242 #Teutonic creation
							days = -1
						}
					}
				}
				
				character:30412 = {
					if = {
						limit = {
							is_alive = yes
							game_start_date = 1295.6.16
						}
						trigger_event = {
							id = KoH_holy_orders.243 #Teutonic creation
							days = -1
						}
					}
				}
		}
	}
	
}


on_gain_holy_order = {

	effect = {
		if = {
			limit = { NOT = { has_trait = order_member } has_government = holy_order_county_government }
			add_trait = order_member
		}
	}
	
}

start_nanzhao_collapse = {
	trigger = {
		current_date > 895.1.1
		current_date < 950.1.1
		is_at_war = no
		NOT = {
			title:k_nanzhao.holder = {
				any_vassal_or_below = {
					owns_story_of_type = nanzhao_collapse_story
				}
			}
		}
		title:k_nanzhao = {
			OR = {
				has_variable = nanzhao
				has_variable = dachanghe
				has_variable = datianxing
				has_variable = dayining
			}
		}
	}
	effect = {
		if = {
			limit = { title:k_nanzhao = { has_variable = nanzhao } }
			trigger_event = nanzhao_collapse.0001
		}
		else_if = {
			limit = { title:k_nanzhao = { has_variable = dachanghe } }
			trigger_event = nanzhao_collapse.1001
		}
		else_if = {
			limit = { title:k_nanzhao = { has_variable = datianxing } }
			trigger_event = nanzhao_collapse.2001
		}
		else_if = {
			limit = { title:k_nanzhao = { has_variable = dayining } }
			trigger_event = nanzhao_collapse.3001
		}
	}
}

	########################################################################################### POP-UP ###########################################################################################


MB_setup_after_game_start_on_actions = {

	effect = {
		every_player = { # Intro event
		 	trigger_event = MBintro.0001
		}
	}
	
}
