﻿RICE_setup_tarim_basin_flavor_pack_effect = {

	#########################################################################
	#
	# BUILDING AND COUNTY/PROVINCE STUFF
	#
	#########################################################################

	# Add Mogao Caves
	if = {
		limit = {
			title:b_mogao = {
				title_province = { has_special_building = no }
			}
		}
		title:b_mogao.title_province = {
			add_special_building = RICE_tarim_basin_mogao_caves
		}
	}
	# Add Bezeklik Caves
	if = {
		limit = {
			title:b_bezeklik = {
				title_province = { has_special_building = no }
			}
		}
		title:b_bezeklik.title_province = {
			add_special_building = RICE_tarim_basin_bezeklik_caves
		}
	}
	if = {
		limit = {
			title:b_bezeklik = {
				NOT = { title_province = { has_holding_type = church_holding } }
			}
		}
		title:b_bezeklik.title_province = {
			set_holding_type = church_holding
		}
	}
	# Add Kizil Caves
	if = {
		limit = {
			title:b_kucha = {
				title_province = { has_special_building = no }
			}
		}
		title:b_kucha.title_province = {
			add_special_building = RICE_tarim_basin_kizil_caves
		}
	}
	# Add Khotan Jade Mines and other holdings
	if = {
		limit = {
			title:b_bugaiwilik = {
				title_province = { has_special_building = no }
			}
		}
		title:b_bugaiwilik.title_province = {
			add_special_building = RICE_tarim_basin_khotan_jade_deposits_01
		}
	}
	title:b_domoko.title_province = { # Was an ancient monastery
		set_holding_type = church_holding
	}
	title:b_bugaiwilik.title_province = {
		set_holding_type = castle_holding
	}

	if = {
		limit = {
			current_date < 1000.1.1			
		}
		title:c_kucha = {
			add_county_modifier = {
				modifier = RICE_tarim_basin_kuchean_music
			}
		}
	}

	if = {
		limit = {
			has_global_variable = RICE_game_started_on_TFE_start_date
		}
		title:c_charkliq = {
			add_county_modifier = {
				modifier = RICE_tarim_basin_lop_nur_dry_period
			}
		}
		title:c_loulan = {
			add_county_modifier = {
				modifier = RICE_tarim_basin_lop_nur_dry_period
			}
		}
		title:c_dunhuang = {
			add_county_modifier = {
				modifier = RICE_tarim_basin_lop_nur_dry_period
			}
		}
		title:c_kumtag = {
			add_county_modifier = {
				modifier = RICE_tarim_basin_lop_nur_dry_period
			}
		}
	}
	else = {
		title:c_charkliq = {
			add_county_modifier = {
				modifier = RICE_tarim_basin_lop_nur_fluctuations
			}
		}
		title:c_loulan = {
			add_county_modifier = {
				modifier = RICE_tarim_basin_lop_nur_fluctuations
			}
		}
		title:c_dunhuang = {
			add_county_modifier = {
				modifier = RICE_tarim_basin_lop_nur_fluctuations
			}
		}
		title:c_kumtag = {
			add_county_modifier = {
				modifier = RICE_tarim_basin_lop_nur_fluctuations
			}
		}
	}



	#########################################################################
	#
	# CULTURE AND RELIGION STUFF
	#
	#########################################################################

	
	if = {
		limit = {
			current_date > 750.1.1
			current_date < 1050.1.1			
		}
		# Set Wenmo culture, centered around Liangzhou
		title:c_liangzhou = {
			set_county_culture = culture:wenmo
		}		
		title:c_dajing = {
			set_county_culture = culture:wenmo
		}		
		title:c_baiyin = {
			set_county_culture = culture:wenmo
			set_county_faith = faith:lamaism
		}		
		title:c_yongdeng = {
			set_county_culture = culture:wenmo
			set_county_faith = faith:lamaism
		}		
		title:c_shanzhou = {
			set_county_culture = culture:wenmo
		}
		# According to Xuanzang, Tocharian city-states were Hinayanists, specifically Sarvastivada
		# However, Sarvastivada was a major influence on Mahayana and adopted many Mahayana idea, even if Sinic Mahayanists criticized some of its stances
		title:c_kucha = {
			set_county_faith = faith:mahayana # faith:theravada
		}
		title:c_luntai = {
			set_county_faith = faith:mahayana # faith:theravada
		}
		title:c_karashar = {
			set_county_faith = faith:mahayana # faith:theravada
		}
		title:c_toksun = {
			set_county_faith = faith:mahayana # faith:theravada
		}
		title:c_loulan = {
			set_county_faith = faith:mahayana # faith:theravada
		}
		title:c_charkliq = {
			set_county_faith = faith:mahayana # faith:theravada
		}
		title:c_kucha = {
			set_county_faith = faith:mahayana # faith:theravada
		}
		character:166706 = {
			set_character_faith_with_conversion = faith:mahayana # faith:theravada
			every_courtier = {
				set_character_faith_with_conversion = faith:mahayana # faith:theravada
			}
		}
		character:166755 = {
			set_character_faith_with_conversion = faith:mahayana # faith:theravada
			every_courtier = {
				set_character_faith_with_conversion = faith:mahayana # faith:theravada
			}
		}
		character:166746 = {
			set_character_faith_with_conversion = faith:mahayana # faith:theravada
			every_courtier = {
				set_character_faith_with_conversion = faith:mahayana # faith:theravada
			}
		}
		character:166740 = {
			set_character_faith_with_conversion = faith:mahayana # faith:theravada
			every_courtier = {
				set_character_faith_with_conversion = faith:mahayana # faith:theravada
			}
		}
	}

	culture:sogdian = {
		remove_culture_tradition = tradition_horse_breeder
		add_culture_tradition = tradition_RICE_silk_road
		remove_variable = tradition_cooldown
	}	

	# culture:han = {
	# 	remove_culture_tradition = tradition_ce1_ritual_washing
	# 	add_culture_tradition = tradition_ep3_cultivated_sophistication
	# 	remove_variable = tradition_cooldown
	# }	
		
	culture:saka = {
		set_culture_pillar = ethos_bureaucratic
		if = {
			limit = { has_cultural_tradition = tradition_horse_lords }
			remove_culture_tradition = tradition_horse_lords
		}
		remove_culture_tradition = tradition_artisans
		add_culture_tradition = tradition_language_scholars # Translators
		add_culture_tradition = tradition_RICE_silk_road
		remove_variable = tradition_cooldown
	}		

	culture:tocharian = {
		add_culture_tradition = tradition_music_theory # Kuchean music is famous
		if = {
			limit = { has_cultural_tradition = tradition_philosopher_culture }
			remove_culture_tradition = tradition_philosopher_culture
		}
		remove_culture_tradition = tradition_caravaneers
		add_culture_tradition = tradition_RICE_silk_road
		remove_variable = tradition_cooldown
	}
		# tradition_RICE_image_of_china
	culture:khitan = {
		# Start of the Liao Dynasty
		if = {
			limit = {
				game_start_date >= 916.1.1
			}
			add_culture_tradition = tradition_RICE_image_of_china
			remove_variable = tradition_cooldown
		}
		set_culture_pillar = ethos_bureaucratic
	}	

	if = {
		limit = {
			exists = culture:khotanese
		}
		culture:khotanese = {
			add_culture_tradition = tradition_RICE_silk_road
			remove_variable = tradition_cooldown
		}
	}


	culture:radhanite = {
		add_culture_tradition = tradition_RICE_silk_road
		remove_variable = tradition_cooldown
	}	

	if = {
		limit = {
			exists = culture:soissons
		}		
		culture:bactrian = {
			add_culture_tradition = tradition_RICE_silk_road
			remove_variable = tradition_cooldown
		}	
	}

	#########################################################################
	#
	# HISTORY TWEAKS
	#
	#########################################################################

	# Set up Dunhuang vassals
	# if = {
	# 	limit = {
	# 		current_date > 865.1.1
	# 		current_date < 875.1.1			
	# 	}

	# 	title:k_guiyi = {
	# 		add_title_law = male_only_law
	# 	}


	# 	# Fix up Zhang Yichao
	# 	character:206811 = {
	# 		# Not needed since the realm is already turned into admin
	# 		# if = {
	# 		# 	limit = {
	# 		# 		has_dlc_feature = roads_to_power
	# 		# 		any_held_title = {
	# 		# 			tier = tier_duchy
	# 		# 			is_landless_type_title = no
	# 		# 			is_noble_family_title = no
	# 		# 		}
	# 		# 	}
	# 		# 	create_noble_family_effect = yes
	# 		# }
	# 		RICE_remove_personality_traits_effect = yes
	# 		RICE_remove_education_traits_effect = yes
	# 		add_trait = education_stewardship_4 	# Administrator able to balance the interests of different groups
	# 		add_trait = intellect_good_1 			# Seriously, took a lot of talent to be a competent leader in the situation
	# 		add_trait = zealous						# Stauchly Buddhist
	# 		add_trait = compassionate				# Said to care for the people
	# 		add_trait = just						# Able to balance the competing interests of different clans through marriage and official appointments
	# 		add_trait = diligent					# Just an overall hardworking dude with good military and administrative abilities
	# 		add_martial_skill = 3					# Military capabilities
	# 		add_stewardship_skill = 3				# Administrative capabilities
	# 		add_diplomacy_skill = 2					# Able to balance the competing interests of different clans
	# 		save_scope_as = zhang_yichao
	# 		add_character_modifier = {
	# 			modifier = RICE_tarim_basin_is_zhang_yichao
	# 		}
	# 		dynasty = {
	# 			add_dynasty_modifier = {
	# 				modifier = RICE_tarim_basin_zhang_clan
	# 			}
	# 		}
	# 	}

	# 	character:RICE_song_002 = {
	# 		save_scope_as = zhang_yichao_waifu
	# 	}
	# 	character:304188 = {
	# 		set_mother = scope:zhang_yichao_waifu
	# 	}
	# 	character:304190 = {
	# 		set_mother = scope:zhang_yichao_waifu
	# 	}

	# 	character:RICE_suo_002 = {
	# 		save_scope_as = zhang_huaishen_mommy
	# 	}

	# 	# Give Cao Yijin some more land and historical aspirations
	# 	character:1059714 = {
	# 		# if = {
	# 		# 	limit = {
	# 		# 		has_dlc_feature = roads_to_power
	# 		# 		any_held_title = {
	# 		# 			tier = tier_duchy
	# 		# 			is_landless_type_title = no
	# 		# 			is_noble_family_title = no
	# 		# 		}
	# 		# 	}
	# 		# 	create_noble_family_effect = yes
	# 		# }
	# 		set_character_faith_with_conversion = faith:mahayana
	# 		get_title = title:d_kara_khoja
	# 		get_title = title:c_chamil
	# 		add_trait = intellect_good_1
	# 		dynasty = {
	# 			add_dynasty_modifier = {
	# 				modifier = RICE_tarim_basin_cao_clan
	# 			}
	# 		}
	# 		save_scope_as = cao_yijin
	# 		add_character_modifier = {
	# 			modifier = RICE_tarim_basin_aspiration_restore_order_guiyi
	# 		}
	# 		set_variable = {
	# 			name = RICE_historical_aspiration
	# 			value = flag:cao_yijin
	# 		}
	# 	}

		character:RICE_zhai_003 = {
			save_scope_as = zhai_farong
		}
		character:RICE_zhai_005 = {
			save_scope_as = zhai_fengda_uncle
		}
		character:RICE_zhai_013 = {
			save_scope_as = zhai_huaiguan
		}
		character:RICE_zhai_014 = {
			save_scope_as = zhai_huaien
		}
		character:RICE_zhai_015 = {
			save_scope_as = zhang_yichao_niece
		}


		# Give Zhai Huixin/Xin (Zhai Fengda's father) territory under the Caos
		# Otherwise, he should already have it
		character:RICE_zhai_004 = {
			if = {
				limit = {
					NOT = { has_dlc_feature = roads_to_power }
				}
				get_title = title:c_hongliuyuan
				# if = {
				# 	limit = {
				# 		has_dlc_feature = roads_to_power
				# 	}
				# 	create_noble_family_effect = yes
				# }
				RICE_setup_new_granted_ruler_bonuses_effect = yes
				add_courtier = scope:zhai_fengda_uncle
				add_courtier = scope:zhai_farong
				add_courtier = scope:zhai_huaiguan
				add_courtier = scope:zhai_huaien
				add_courtier = scope:zhang_yichao_niece
			}
			dynasty = {
				add_dynasty_modifier = {
					modifier = RICE_tarim_basin_zhai_clan
				}
			}
		}

		# Return title to duke
		# if = {
		# 	limit = {
		# 		has_dlc_feature = roads_to_power
		# 	}
		# 	title:d_kara_khoja.holder = {
		# 		get_title = title:c_hongliuyuan
		# 	}
		# }


		# Li Mingzhen - give him all of the stuff in Ganzhou
		# character:304192 = { 
		# 	get_title = title:c_ganzhou
		# 	get_title = title:d_ganzhou
		# 	get_title = title:c_linze
		# 	get_title = title:c_gaotai
		# 	get_title = title:c_jinta
		# 	get_title = title:c_suzhou # Keep it for the fictitious vanilla guy
		# 	get_title = title:c_heihe			
		# 	get_title = title:c_yumen	
		# 	# if = {
		# 	# 	limit = {
		# 	# 		has_dlc_feature = roads_to_power
		# 	# 		any_held_title = {
		# 	# 			tier = tier_duchy
		# 	# 			is_landless_type_title = no
		# 	# 			is_noble_family_title = no
		# 	# 		}
		# 	# 	}
		# 	# 	create_noble_family_effect = yes
		# 	# }		
		# 	RICE_setup_new_granted_ruler_bonuses_effect = yes
		# 	dynasty = {
		# 		add_dynasty_modifier = {
		# 			modifier = RICE_tarim_basin_li_clan
		# 		}
		# 	}
		# 	RICE_remove_personality_traits_effect = yes
		# 	RICE_remove_education_traits_effect = yes
		# 	add_trait = education_diplomacy_3
		# 	add_trait = brave
		# 	add_trait = zealous
		# 	add_trait = diligent
		# }

		# # Suo Hanjun - give him suzhou
		# character:RICE_suo_006 = {			
		# 	if = {
		# 		limit = {
		# 			NOT = { has_dlc_feature = roads_to_power }
		# 		}
		# 		get_title = title:c_suzhou
		# 		RICE_setup_new_granted_ruler_bonuses_effect = yes
		# 	}
		# 	dynasty = {
		# 		add_dynasty_modifier = {
		# 			modifier = RICE_tarim_basin_suo_clan
		# 		}
		# 	}
		# }

				
		# # Return title to duke
		# if = {
		# 	limit = {
		# 		has_dlc_feature = roads_to_power
		# 	}
		# 	title:d_ganzhou.holder = {
		# 		get_title = title:c_suzhou
		# 	}
		# }

		# # Li Mingda - Mingzhen's brother
		# character:RICE_li_005 = {
		# 	if = {
		# 		limit = {
		# 			NOT = { has_dlc_feature = roads_to_power }
		# 		}
		# 		get_title = title:c_jinta
		# 		RICE_setup_new_granted_ruler_bonuses_effect = yes
		# 	}
		# }

		# # Li Mingcheng (fictional name) - Mingzhen's other brother
		# character:RICE_li_006 = {
		# 	if = {
		# 		limit = {
		# 			NOT = { has_dlc_feature = roads_to_power }
		# 		}
		# 		get_title = title:c_yumen
		# 		RICE_setup_new_granted_ruler_bonuses_effect = yes
		# 	}
		# }

		# # Zhu Zaiqing - give him Subei
		# # character:RICE_dunhuang_misc_001 = { 
		# # 	get_title = title:c_yumenguan
		# # 	RICE_setup_new_granted_ruler_bonuses_effect = yes
		# # }

		# # Yin Wentong - give him all of the stuff in Qilin, since he helped fight off the Tibetans
		# character:RICE_yin_001 = { 
		# 	get_title = title:c_qilin
		# 	get_title = title:d_qilin
		# 	get_title = title:c_yalong
		# 	# if = {
		# 	# 	limit = {
		# 	# 		has_dlc_feature = roads_to_power
		# 	# 		any_held_title = {
		# 	# 			tier = tier_duchy
		# 	# 			is_landless_type_title = no
		# 	# 			is_noble_family_title = no
		# 	# 		}
		# 	# 	}
		# 	# 	create_noble_family_effect = yes
		# 	# }
		# 	RICE_setup_new_granted_ruler_bonuses_effect = yes
		# 	dynasty = {
		# 		add_dynasty_modifier = {
		# 			modifier = RICE_tarim_basin_yin_clan
		# 		}
		# 	}
		# 	change_government = feudal_government
		# }

		# # Yin Jifeng - official under Zhang Yichao who later helped the Zhang family reclaim Guiyi
		# character:RICE_yin_003 = {
		# 	if = {
		# 		limit = {
		# 			NOT = { has_dlc_feature = roads_to_power }
		# 		}
		# 		get_title = title:c_yalong
		# 		RICE_setup_new_granted_ruler_bonuses_effect = yes
		# 		change_government = feudal_government
		# 	}
		# }

				
		# # Return title to duke
		# # if = {
		# # 	limit = {
		# # 		has_dlc_feature = roads_to_power
		# # 	}
		# # 	title:d_qilin.holder = {
		# # 		get_title = title:c_yalong
		# # 	}
		# # }

		# character:304190 = {
		# 	save_scope_as = suo_xun_waifu
		# }
		# character:RICE_suo_008 = {
		# 	save_scope_as = suo_xun_son
		# }
		# character:RICE_suo_007 = {
		# 	save_scope_as = suo_xun_daughter
		# 	create_betrothal = scope:cao_yijin
		# }


		# # Suo Xun - give him all of the stuff in Liangzhou
		# character:304191 = { 
		# 	get_title = title:c_liangzhou
		# 	get_title = title:d_liangzhou
		# 	get_title = title:c_dajing
		# 	get_title = title:c_baiyin
		# 	get_title = title:c_yongdeng
		# 	get_title = title:c_fanhe
		# 	# if = {
		# 	# 	limit = {
		# 	# 		has_dlc_feature = roads_to_power
		# 	# 		any_held_title = {
		# 	# 			tier = tier_duchy
		# 	# 			is_landless_type_title = no
		# 	# 			is_noble_family_title = no
		# 	# 		}
		# 	# 	}
		# 	# 	create_noble_family_effect = yes
		# 	# }
		# 	RICE_setup_new_granted_ruler_bonuses_effect = yes
		# 	save_scope_as = suo_xun
		# 	RICE_remove_personality_traits_effect = yes
		# 	RICE_remove_education_traits_effect = yes
		# 	add_trait = education_intrigue_3
		# 	add_trait = ambitious
		# 	add_trait = deceitful
		# 	add_trait = patient
		# 	#add_courtier = scope:suo_xun_waifu
		# 	#add_courtier = scope:suo_xun_son
		# 	#add_courtier = scope:suo_xun_daughter
		# }

		# # Yan Yingda - give him Subei or Zhenfan if he's Admin gov't
		# character:RICE_dunhuang_misc_005 = {
		# 	# if = {
		# 	# 	limit = {
		# 	# 		has_dlc_feature = roads_to_power
		# 	# 	}
		# 	# 	create_noble_family_effect = yes
		# 	# }
		# 	# else = {
		# 	# 	get_title = title:c_subei
		# 	# 	RICE_setup_new_granted_ruler_bonuses_effect = yes
		# 	# }
		# 	if = {
		# 		limit = {
		# 			NOT = { has_dlc_feature = roads_to_power }
		# 		}
		# 		get_title = title:c_subei
		# 		RICE_setup_new_granted_ruler_bonuses_effect = yes
		# 	}
		# 	else = {				
		# 		get_title = title:c_zhenfan
		# 		get_title = title:d_zhenfan
		# 	}
		# 	dynasty = {
		# 		add_dynasty_modifier = {
		# 			modifier = RICE_tarim_basin_yan_clan
		# 		}
		# 	}
		# }
				
		# # Return title to duke
		# # if = {
		# # 	limit = {
		# # 		has_dlc_feature = roads_to_power
		# # 	}
		# # 	title:k_guiyi.holder = {
		# # 		get_title = title:c_subei
		# # 	}
		# # }


		# # character:RICE_zhang_002 = {
		# # 	save_scope_as = suo_xun_fake_mommy
		# # }

		# # Suo Zhongxin - give him Fanhe
		# if = {
		# 	limit = {
		# 		NOT = { has_dlc_feature = roads_to_power }
		# 	}
		# 	character:RICE_suo_005 = {
		# 		get_title = title:c_fanhe
		# 		RICE_setup_new_granted_ruler_bonuses_effect = yes
		# 	}
		# }

						
		# # Return title to duke
		# # if = {
		# # 	limit = {
		# # 		has_dlc_feature = roads_to_power
		# # 	}
		# # 	title:d_liangzhou.holder = {
		# # 		get_title = title:c_fanhe
		# # 	}
		# # }

		# # An Jingmin - Sogdian vice commissioner of Guiyi army
		# character:RICE_an_001 = {
		# 	get_title = title:c_yumenguan
		# 	get_title = title:d_charkliq
		# 	# if = {
		# 	# 	limit = {
		# 	# 		has_dlc_feature = roads_to_power
		# 	# 		any_held_title = {
		# 	# 			tier = tier_duchy
		# 	# 			is_landless_type_title = no
		# 	# 			is_noble_family_title = no
		# 	# 		}
		# 	# 	}
		# 	# 	create_noble_family_effect = yes
		# 	# }
		# 	RICE_setup_new_granted_ruler_bonuses_effect = yes
		# 	save_scope_as = an_jingmin
		# 	if = {
		# 		limit = {
		# 			NOT = { has_dlc_feature = roads_to_power }
		# 		}
		# 		change_government = feudal_government
		# 	}
		# }

		# # Fictitious Wenmo leader
		# # The Wenmo would establish an independent state in Liangzhou in 884
		# character:RICE_wenmo_001 = {
		# 	get_title = title:c_baiyin
		# 	get_title = title:c_yongdeng
		# 	RICE_setup_new_granted_ruler_bonuses_effect = yes
		# 	RICE_dunhuang_wenmo_troop_spawn_effect = yes # Have him start with some troops so he could cause trouble if he wanted
		# 	#save_scope_as = suo_xun_liangzhou_vassal
		# }

		# Gao Jinda - one of Zhang Yichao's OG commanders who was sent as his first envoy to the Tang Dynasty in 850 CE
		character:RICE_dunhuang_misc_003 = { 
			if = {
				limit = {
					NOT = { has_dlc_feature = roads_to_power }
				}
				get_title = title:c_dajing
				RICE_setup_new_granted_ruler_bonuses_effect = yes
			}
			# if = {
			# 	limit = {
			# 		has_dlc_feature = roads_to_power
			# 		any_held_title = {
			# 			tier = tier_duchy
			# 			is_landless_type_title = no
			# 			is_noble_family_title = no
			# 		}
			# 	}
			# 	create_noble_family_effect = yes
			# }
			add_character_flag = RICE_gao_jinda
		}
						
		# Return title to duke
		# if = {
		# 	limit = {
		# 		has_dlc_feature = roads_to_power
		# 	}
		# 	title:d_liangzhou.holder = {
		# 		get_title = title:c_dajing
		# 	}
		# }

		# Kang Tongxin - Sogdian magistrate Prefect of Guazhou at one point
		# character:RICE_kang_002 = { 
		# 	get_title = title:c_xingqing
		# 	get_title = title:d_xia
		# 	#if = {
		# 	#	limit = {
		# 	#		has_dlc_feature = roads_to_power
		# 	#		any_held_title = {
		# 	#			tier = tier_duchy
		# 	#			is_landless_type_title = no
		# 	#			is_noble_family_title = no
		# 	#		}
		# 	#	}
		# 	#	create_noble_family_effect = yes
		# 	#	get_title = title:c_zhenfan
		# 	#	get_title = title:d_zhenfan
		# 	#}
		# 	RICE_setup_new_granted_ruler_bonuses_effect = yes
		# 	save_scope_as = kang_master
		# 	if = {
		# 		limit = {
		# 			NOT = { has_dlc_feature = roads_to_power }
		# 		}
		# 		change_government = feudal_government
		# 	}
		# }
		
		# # Kang Shijun - Sogdian magistrate Prefect of Guazhou at one point
		# if = {
		# 	limit = {
		# 		NOT = { has_dlc_feature = roads_to_power }
		# 	}
		# 	character:RICE_kang_003 = { 
		# 		get_title = title:c_zhenfan
		# 		get_title = title:d_zhenfan
		# 		RICE_setup_new_granted_ruler_bonuses_effect = yes
		# 		change_government = feudal_government
		# 	}
		# }

		# # Zhang Wenche - official who led the Guiyi envoy group to the Tang Dynasty alongside Song Runying in 887 CE, and *may* have led the coup against Zhang Huaishen in c. 890
		# character:RICE_dunhuang_misc_006 = { 
		# 	if = {
		# 		limit = {
		# 			NOT = { has_dlc_feature = roads_to_power }
		# 		}
		# 		get_title = title:c_gaotai
		# 		RICE_setup_new_granted_ruler_bonuses_effect = yes
		# 	}
		# 	# if = {
		# 	# 	limit = {
		# 	# 		has_dlc_feature = roads_to_power
		# 	# 		any_held_title = {
		# 	# 			tier = tier_duchy
		# 	# 			is_landless_type_title = no
		# 	# 			is_noble_family_title = no
		# 	# 		}
		# 	# 	}
		# 	# 	create_noble_family_effect = yes
		# 	# }
		# 	add_character_flag = RICE_zhang_wenche
		# }

								
		# # Return title to duke
		# # if = {
		# # 	limit = {
		# # 		has_dlc_feature = roads_to_power
		# # 	}
		# # 	title:d_ganzhou.holder = {
		# # 		get_title = title:c_gaotai
		# # 	}
		# # }

		# # Song Runying - Official who led the Guiyi envoy group to the Tang Dynasty alongside Zhang Wenche in 887 CE
		# character:RICE_song_001 = { 
		# 	if = {
		# 		limit = {
		# 			NOT = { has_dlc_feature = roads_to_power }
		# 		}
		# 		get_title = title:c_linze
		# 		RICE_setup_new_granted_ruler_bonuses_effect = yes
		# 	}
		# 	# if = {
		# 	# 	limit = {
		# 	# 		has_dlc_feature = roads_to_power
		# 	# 		any_held_title = {
		# 	# 			tier = tier_duchy
		# 	# 			is_landless_type_title = no
		# 	# 			is_noble_family_title = no
		# 	# 		}
		# 	# 	}
		# 	# 	create_noble_family_effect = yes
		# 	# }
		# 	add_character_flag = RICE_song_runying
		# }	

		# Return title to duke
		# if = {
		# 	limit = {
		# 		has_dlc_feature = roads_to_power
		# 	}
		# 	title:d_ganzhou.holder = {
		# 		get_title = title:c_linze
		# 	}
		# }

		if = {
			limit = {
				current_date > 750.1.1
				current_date < 1050.1.1	
			}
			title:b_zhenfan.title_province = {
				set_holding_type = castle_holding
			}
			title:b_babao.title_province = {
				set_holding_type = castle_holding
			}
			title:b_yalong.title_province = {
				set_holding_type = castle_holding
			}
		}

		character:shatuo0005 = {
			save_scope_as = fake_shatuo
		}

		character:tuoba0005 = {
			save_scope_as = tuoba_ruler
		}

		character:166746 = {
			save_scope_as = kumtag_ruler
		}

		character:sogdian0005 = {
			save_scope_as = miran_ruler
		}

		create_title_and_vassal_change = {
			type = swear_fealty
			save_scope_as = change
		}
		scope:fake_shatuo = {
			change_liege = {
				liege = scope:kang_master
				change = scope:change
			}
		}
		resolve_title_and_vassal_change = scope:change

		create_title_and_vassal_change = {
			type = swear_fealty
			save_scope_as = change
		}
		scope:tuoba_ruler = {
			change_liege = {
				liege = scope:kang_master
				change = scope:change
			}
		}
		resolve_title_and_vassal_change = scope:change

		create_title_and_vassal_change = {
			type = swear_fealty
			save_scope_as = change
		}
		scope:kumtag_ruler = {
			change_liege = {
				liege = scope:an_jingmin
				change = scope:change
			}
		}
		resolve_title_and_vassal_change = scope:change

		create_title_and_vassal_change = {
			type = swear_fealty
			save_scope_as = change
		}
		scope:miran_ruler = {
			change_liege = {
				liege = scope:an_jingmin
				change = scope:change
			}
		}
		resolve_title_and_vassal_change = scope:change

		character:RICE_zhang_001 = {
			save_scope_as = li_mingzhen_wife
		}

		character:RICE_li_002 = {
			save_scope_as = li_mingzhen_daddy
		}

		character:304193 = {
			set_mother = scope:li_mingzhen_wife
		}

		character:304192 = {
			set_father = scope:li_mingzhen_daddy
		}

		character:244004 = {
			set_mother = scope:zhang_huaishen_mommy
			RICE_make_chinese_buddhist_effect = yes			
			RICE_remove_personality_traits_effect = yes
			add_trait = brave
			add_trait = patient
			add_trait = diligent
		}

		title:c_khotan.holder = {
			add_character_modifier = {
				modifier = RICE_tarim_basin_khotan_eight_protectors
			}
		}

		# Fu Murong (or whoever's supposed to be the last Tuyuhun in-game)
		character:247407 = {
			add_character_flag = do_not_generate_starting_family
		}

		# Kill off fictional Dunhuang characters
		# character:han0005 = {
		# 	death = {
		# 		death_reason = death_vanished
		# 	}			
		# }
		# character:han0006 = {
		# 	death = {
		# 		death_reason = death_vanished
		# 	}			
		# }
		# character:han0007 = {
		# 	death = {
		# 		death_reason = death_vanished
		# 	}			
		# }

		# title:k_guiyi.holder = {
		# 	every_vassal_or_below = {
		# 		limit = {
		# 			is_landed = no
		# 			domicile ?= {
		# 				is_domicile_type = estate
		# 			}
		# 		}
		# 		domicile ?= { move_domicile = title:b_shazhou.title_province }				
		# 	}
		# }

		# # If not running with Roads to Power, add in courtiers who would've been random Admin families
		# if = {
		# 	limit = {
		# 		NOT = { has_dlc_feature = roads_to_power }
		# 	}
		# 	if = {
		# 		limit = {
		# 			character:RICE_dunhuang_misc_001 = {
		# 				is_playable_character = no
		# 				is_ruler = no
		# 				NOT = { is_courtier_of = scope:zhang_yichao }
		# 			}
		# 		}
		# 		scope:zhang_yichao = {
		# 			add_courtier = character:RICE_dunhuang_misc_001
		# 		}
		# 	}
		# 	if = {
		# 		limit = {
		# 			character:RICE_dunhuang_misc_004 = {
		# 				is_playable_character = no
		# 				is_ruler = no
		# 				NOT = { is_courtier_of = scope:zhang_yichao }
		# 			}
		# 		}
		# 		scope:zhang_yichao = {
		# 			add_courtier = character:RICE_dunhuang_misc_004
		# 		}
		# 	}
		# 	if = {
		# 		limit = {
		# 			character:RICE_dunhuang_misc_007 = {
		# 				is_playable_character = no
		# 				is_ruler = no
		# 				NOT = { is_courtier_of = scope:zhang_yichao }
		# 			}
		# 		}
		# 		scope:zhang_yichao = {
		# 			add_courtier = character:RICE_dunhuang_misc_007
		# 		}
		# 	}
		# }


	}

	

	# 1066 start date shenanigans
	if = {
		limit = {
			game_start_date > 1050.1.1
		}
		add_to_global_variable_list = {
			name = unavailable_unique_decisions
			target = flag:RICE_tarim_basin_fake_china_proclaimed_flag
		}
		set_global_variable = {
			name = RICE_tarim_basin_khotan_eight_protectors_abandoned
			value = yes
		}
		set_global_variable = {
			name = RICE_ordam_mazar_festival_triggered
			value = yes
		}
	}

	# 1066 start date shenanigans
	if = {
		limit = {
			game_start_date > 1050.1.1
			game_start_date < 1100.1.1
		}
		character:3014 = {
			# Not sure why he was made lustful in vanilla - couldn't find anything suggesting that in my research, though I might have missed something
			RICE_remove_personality_traits_effect = yes
			#RICE_remove_education_traits_effect = yes
			#add_trait = education_stewardship_4 	
			add_trait = administrator				# Heavy focus on managing the economy and trade, reducing hardship for common folk, screwing over bandits
			add_trait = architect					# Also built a lot of stuff
			add_trait = shrewd # Said to be a capable, intelligent ruler
			add_trait = just # Praised by Muslim chroniclers for being just
			add_trait = zealous # Also praised for being devout
			add_trait = diligent # What a hard worker
			dynasty = {
				add_dynasty_modifier = {
					modifier = RICE_tarim_basin_fake_china_dynasty
				}
			}
		}
	}


	# Al-Kashgari/Turkic Dictionary stuff
	if = {
		limit = {
			game_start_date >= 1029.5.8
			game_start_date <= 1102.8.5
		}

		# Al-Kashgari
		character:RICE_kashgar_001 = {
			if = {
				limit = {
					has_playable_adventurer_dlc_trigger = no
				}
				if = {
					limit = {
						roa_is_active = yes
					}
					get_title = title:c_terek
				}
				else = {
					get_title = title:c_terek_pass
				}
			}
			RICE_setup_new_granted_ruler_bonuses_effect = yes
			add_character_modifier = {
				modifier = RICE_tarim_basin_is_al_kashgari
			}
			set_variable = {
				name = RICE_historical_aspiration
				value = flag:al_kashgari
			}
		}
	}
	else_if = {
		limit = {
			game_start_date < 1029.5.8
		}
		set_global_variable = {
			name = RICE_anyone_can_write_turkic_dictionary
			value = yes
		}
	}
	else = {
		add_to_global_variable_list = {
			name = unavailable_unique_decisions
			target = flag:RICE_tarim_basin_compile_turkic_dictionary_done
		}
	}

	if = {
		limit = {
			game_start_date = 1178.10.1
		}
		# Setting up Kara-Khitan
		character:188909 = {
			if = {
				limit = {
					has_dlc_feature = roads_to_power
				}
				create_noble_family_effect = yes
			}
			get_title = title:d_alakol
		}
		character:188910 = {
			get_title = title:d_tarbagatai
		}
		# Setting up Wo Daochong, Tangut official
		character:RICE_xixia_wo_001 = {
			get_title = title:c_liangzhou
			get_title = title:d_liangzhou
			get_title = title:c_dajing
			get_title = title:c_baiyin
			get_title = title:c_yongdeng
			get_title = title:c_fanhe
			RICE_setup_new_granted_ruler_bonuses_effect = yes
		}
		character:RICE_xixia_wo_002 = {
			get_title = title:c_baiyin
			get_title = title:c_yongdeng
			RICE_setup_new_granted_ruler_bonuses_effect = yes
		}
		character:125501 = {
			add_trait = just
			remove_trait = shrewd
			add_trait = intellect_good_2
			add_trait = physique_good_1
			save_scope_as = genghis_khan
		}
		# Some Genghis Khan stuff because I dunno where else to put it
		# Borte
		character:172004 = {
			RICE_remove_education_traits_effect = yes
			RICE_remove_personality_traits_effect = yes
			remove_all_perk_lifestyle_traits_effect = yes
			add_trait = education_stewardship_4
			add_trait = diligent
			add_trait = gregarious
			add_trait = just
			add_trait = beauty_good_2
			add_trait = intellect_good_1
			set_relation_soulmate = {
				reason = lover_history
				target = scope:genghis_khan
			}
		}
		# Hoelun
		character:172003 = {
			RICE_remove_education_traits_effect = yes
			RICE_remove_personality_traits_effect = yes
			remove_all_perk_lifestyle_traits_effect = yes
			add_trait = education_stewardship_3
			add_trait = diligent
			add_trait = brave
			add_trait = temperate
			add_trait = beauty_good_2
		}
	}



}



RICE_make_chinese_buddhist_effect = {
	if = {
		limit = {
			culture = { has_cultural_pillar = heritage_chinese }
			NOT = { religion = religion:buddhism_religion } # Not already Buddhist
		}
		set_character_faith_with_conversion = faith:mahayana
	}
	if = {
		limit = {
			is_married = yes
			any_spouse = {
				is_landed = no
				culture = { has_cultural_pillar = heritage_chinese }
				NOT = { religion = religion:buddhism_religion } # Not already Buddhist
			}
		}
		every_spouse = {
			limit = {
				is_landed = no
				culture = { has_cultural_pillar = heritage_chinese }
				NOT = { religion = religion:buddhism_religion } # Not already Buddhist
			}
			set_character_faith_with_conversion = faith:mahayana
		}
	}
	if = {
		limit = {
			any_close_family_member = {
				is_landed = no
				culture = { has_cultural_pillar = heritage_chinese }
				culture = { has_cultural_pillar = heritage_chinese }
				NOT = { religion = religion:buddhism_religion } # Not already Buddhist
			}
		}
		every_close_family_member = {
			limit = {
				is_landed = no
				culture = { has_cultural_pillar = heritage_chinese }
				NOT = { religion = religion:buddhism_religion } # Not already Buddhist
			}
			set_character_faith_with_conversion = faith:mahayana
		}
	}

	if = {
		limit = {
			is_ruler = yes
		}
		#Convert appropriate vassals, and their family
		every_vassal_or_below ?= {
			limit = {
				culture = { has_cultural_pillar = heritage_chinese }
				NOT = { religion = religion:buddhism_religion } # Not already Buddhist
			}
			set_character_faith_with_conversion = faith:mahayana
			hidden_effect = {
				if = {
					limit = {
						any_spouse = {
							is_landed = no
							culture = { has_cultural_pillar = heritage_chinese }
							NOT = { religion = religion:buddhism_religion } # Not already Buddhist
						}
					}
					every_spouse = {
						limit = {
							is_landed = no
							culture = { has_cultural_pillar = heritage_chinese }
							NOT = { religion = religion:buddhism_religion } # Not already Buddhist
						}
						set_character_faith_with_conversion = faith:mahayana
					}
				}
				if = {
					limit = {
						any_close_family_member = {
							is_landed = no
							culture = { has_cultural_pillar = heritage_chinese }
							NOT = { religion = religion:buddhism_religion } # Not already Buddhist
						}
					}
					every_close_family_member = {
						limit = {
							is_landed = no
							culture = { has_cultural_pillar = heritage_chinese }
							NOT = { religion = religion:buddhism_religion } # Not already Buddhist
						}
						set_character_faith_with_conversion = faith:mahayana
					}
				}
			}
		}
		every_courtier = {
			limit = {
				culture = { has_cultural_pillar = heritage_chinese }
				NOT = { religion = religion:buddhism_religion } # Not already Buddhist
			}
			set_character_faith_with_conversion = faith:mahayana
			hidden_effect = {
				if = {
					limit = {
						any_spouse = {
							is_landed = no
							culture = { has_cultural_pillar = heritage_chinese }
							NOT = { religion = religion:buddhism_religion } # Not already Buddhist
						}
					}
					every_spouse = {
						limit = {
							is_landed = no
							culture = { has_cultural_pillar = heritage_chinese }
							NOT = { religion = religion:buddhism_religion } # Not already Buddhist
						}
						set_character_faith_with_conversion = faith:mahayana
					}
				}
				if = {
					limit = {
						any_close_family_member = {
							is_landed = no
							culture = { has_cultural_pillar = heritage_chinese }
							NOT = { religion = religion:buddhism_religion } # Not already Buddhist
						}
					}
					every_close_family_member = {
						limit = {
							is_landed = no
							culture = { has_cultural_pillar = heritage_chinese }
							NOT = { religion = religion:buddhism_religion } # Not already Buddhist
						}
						set_character_faith_with_conversion = faith:mahayana
					}
				}
			}
		}
	}

}

RICE_tarim_basin_sinicize_effect = {
	set_culture = culture:han
	add_prestige = 100
	add_character_modifier = {
		modifier = RICE_tarim_basin_recently_sinicized
		years = 10
	}
	every_spouse = {
		limit = {
			is_landed = no
			OR = {
				culture = culture:sogdian
				culture = culture:saka
				culture = culture:tocharian
				culture = {
					any_parent_culture_or_above = {
						OR = {
							this = culture:sogdian
							this = culture:saka
							this = culture:tocharian
						}
					}
				}
			}
		}
		set_culture = culture:han
		add_character_modifier = {
			modifier = RICE_tarim_basin_recently_sinicized
			years = 10
		}
	}
	every_close_family_member = {
		custom = all_family_members
		limit = {
			is_landed = no
			OR = {
				culture = culture:sogdian
				culture = culture:saka
				culture = culture:tocharian
				culture = {
					any_parent_culture_or_above = {
						OR = {
							this = culture:sogdian
							this = culture:saka
							this = culture:tocharian
						}
					}
				}
			}
			is_courtier_of = root
		}
		set_culture = culture:han
		add_character_modifier = {
			modifier = RICE_tarim_basin_recently_sinicized
			years = 10
		}
	}
	every_courtier_or_guest = {
		custom = all_courtiers_and_guests
		limit = {
			is_landed = no
			OR = {
				culture = culture:sogdian
				culture = culture:saka
				culture = culture:tocharian
				culture = {
					any_parent_culture_or_above = {
						OR = {
							this = culture:sogdian
							this = culture:saka
							this = culture:tocharian
						}
					}
				}
			}		
		}
		random = {
			chance = 33
			set_culture = culture:han
			add_character_modifier = {
				modifier = RICE_tarim_basin_recently_sinicized
				years = 10
			}
		}
	}
}

RICE_dunhuang_greater_troop_spawn_effect = {
	spawn_army = {
		levies = 200
		men_at_arms = {
			type = chu_ko_nu
			stacks = 1
		}
		men_at_arms = {
			type = light_footmen
			stacks = 1
		}
		men_at_arms = {
			type = pikemen_unit
			stacks = 1
		}
		men_at_arms = {
			type = light_horsemen
			stacks = 1
		}
		location = root.capital_province
		inheritable = yes
		name = RICE_dunhuang_tang_gift_event_troops
	}	
}

RICE_dunhuang_lesser_troop_spawn_effect = {
	spawn_army = {
		levies = 100
		men_at_arms = {
			type = chu_ko_nu
			stacks = 1
		}
		men_at_arms = {
			type = light_footmen
			stacks = 1
		}
		location = root.capital_province
		inheritable = yes
		name = RICE_dunhuang_tang_gift_event_troops
	}	
}

RICE_dunhuang_tang_bonus_remove_character_flags_effect = {
	if = {
		limit = {
			has_character_flag = RICE_dunhuang_bonus_gold
		}
		remove_character_flag = RICE_dunhuang_bonus_gold
	}
	if = {
		limit = {
			has_character_flag = RICE_dunhuang_bonus_troops
		}
		remove_character_flag = RICE_dunhuang_bonus_troops
	}
	if = {
		limit = {
			has_character_flag = RICE_dunhuang_bonus_prestige
		}
		remove_character_flag = RICE_dunhuang_bonus_prestige
	}
	if = {
		limit = {
			has_character_flag = RICE_dunhuang_bonus_economic
		}
		remove_character_flag = RICE_dunhuang_bonus_economic
	}
	if = {
		limit = {
			has_character_flag = RICE_dunhuang_bonus_military
		}
		remove_character_flag = RICE_dunhuang_bonus_military
	}
	if = {
		limit = {
			has_character_flag = RICE_dunhuang_bonus_political
		}
		remove_character_flag = RICE_dunhuang_bonus_political
	}
}


RICE_tarim_basin_steppe_troops_spawn_effect = {
	spawn_army = {
		levies = 100
		men_at_arms = {
			type = horse_archers
			stacks = 1
		}
		men_at_arms = {
			type = light_horsemen
			stacks = 1
		}
		location = root.capital_province
		uses_supply = yes
		inheritable = no
		name = RICE_tarim_basin_steppe_gift_event_troops
	}	
}

RICE_tarim_basin_himalayan_troops_spawn_effect = {
	spawn_army = {
		levies = 100
		men_at_arms = {
			type = light_footmen
			stacks = 1
		}
		men_at_arms = {
			type = mountaineer
			stacks = 1
		}
		location = root.capital_province
		uses_supply = yes
		inheritable = no
		name = RICE_tarim_basin_himalayan_gift_event_troops
	}	
}

RICE_tarim_basin_bring_chinese_specialists_effect = {
	dynasty = { add_dynasty_prestige = 25 }
	add_character_modifier = {
		modifier = RICE_tarim_basin_east_asian_specialists
		years = 10
	}
}

RICE_tarim_basin_bring_merchant_settlers_effect = {
	add_prestige = 100
	capital_county = {
		add_county_modifier = {
			modifier = RICE_tarim_basin_merchant_settlers
			years = 10
		}
	}
}

RICE_tarim_basin_bring_indic_artisans_effect = {
	add_piety = 100
	add_character_modifier = {
		modifier = RICE_tarim_basin_indic_artisans
		years = 10
	}
}

RICE_tarim_basin_east_african_decision_effect = {
	add_character_modifier = {
		modifier = RICE_tarim_basin_african_contracts
		years = 10
	}
}

RICE_tarim_basin_southeast_asian_shipbuilders_effect = {
	add_character_modifier = {
		modifier = RICE_tarim_basin_southeast_asian_shipbuilders
		years = 10
	}
}


RICE_tarim_basin_lop_nur_lake_level_change_effect = {
	title:c_charkliq = {
		remove_county_modifier = RICE_tarim_basin_lop_nur_dry_period
		add_county_modifier = {
			modifier = RICE_tarim_basin_lop_nur_fluctuations
		}
	}
	title:c_loulan = {
		remove_county_modifier = RICE_tarim_basin_lop_nur_dry_period
		add_county_modifier = {
			modifier = RICE_tarim_basin_lop_nur_fluctuations
		}
	}
	title:c_dunhuang = {
		remove_county_modifier = RICE_tarim_basin_lop_nur_dry_period
		add_county_modifier = {
			modifier = RICE_tarim_basin_lop_nur_fluctuations
		}
	}
	title:c_kumtag = {
		remove_county_modifier = RICE_tarim_basin_lop_nur_dry_period
		add_county_modifier = {
			modifier = RICE_tarim_basin_lop_nur_fluctuations
		}
	}
}

RICE_tarim_basin_claim_fake_china_effect = {
	dynasty = {
		add_dynasty_modifier = {
			modifier = RICE_tarim_basin_fake_china_dynasty
		}
		add_dynasty_prestige = 500
	}
}

RICE_tarim_basin_khotan_procession_eight_guardian_blessings_effect = {
	random = {
		chance = 25
		modifier = {
			add = -6
			num_sinful_traits >= 1
		}
		modifier = {
			add = -6
			num_sinful_traits >= 2
		}
		modifier = {
			add = -6
			num_sinful_traits >= 3
		}
		modifier = {
			add = 6
			num_virtuous_traits <= 1
		}
		modifier = {
			add = 6
			num_virtuous_traits <= 2
		}
		modifier = {
			add = 6
			num_virtuous_traits <= 3
		}
		modifier = {
			add = 3
			piety_level >= 2
		}
		modifier = {
			add = 3
			piety_level >= 4
		}
		if = {
			limit = {
				piety_level <= 2
			}
			add_character_modifier = {
				modifier = RICE_tarim_basin_eight_protectors_blessing_1
				years = 8
			}
		}
		else_if = {
			limit = {
				piety_level = 3
			}
			add_character_modifier = {
				modifier = RICE_tarim_basin_eight_protectors_blessing_2
				years = 8
			}
		}
		else_if = {
			limit = {
				piety_level = 4
			}
			add_character_modifier = {
				modifier = RICE_tarim_basin_eight_protectors_blessing_3
				years = 8
			}
		}
		else_if = {
			limit = {
				piety_level >= 5
			}
			add_character_modifier = {
				modifier = RICE_tarim_basin_eight_protectors_blessing_4
				years = 8
			}
		}
	}
}

RICE_tarim_basin_khotan_procession_completed_log_entry_effect = {
	scope:activity = {
		add_activity_log_entry = {
			key = RICE_tarim_basin_khotan_procession_completed_log
			tags = { completed }
			# this line below adds the entry to the Effects section of the conclusion UI
			show_in_conclusion = yes
			character = root
			scope:host = {
				if = {
					limit = {
						scope:activity = {
							has_activity_option = {
								category = special_type
								option = RICE_tarim_basin_khotan_procession_monastery_type_other
							}
						}
					}
					add_prestige = 50
				}
				else_if = {
					limit = {
						scope:activity = {
							has_activity_option = {
								category = special_type
								option = RICE_tarim_basin_khotan_procession_monastery_type_mashe
							}
						}
					}
					add_prestige = 100
				}
				else_if = {
					limit = {
						scope:activity = {
							has_activity_option = {
								category = special_type
								option = RICE_tarim_basin_khotan_procession_monastery_type_gomati
							}
						}
					}
					add_prestige = 50
					if = {
						limit = {
							exists = dynasty
						}
						dynasty = {
							add_dynasty_prestige = 25
						}
					}
				}
				if = {
					limit = {
						scope:activity = {
							has_activity_option = {
								category = RICE_tarim_basin_khotan_procession_donation_type
								option = RICE_tarim_basin_khotan_procession_donation_type_small
							}
						}
					}
					add_piety = 50
				}
				else_if = {
					limit = {
						scope:activity = {
							has_activity_option = {
								category = RICE_tarim_basin_khotan_procession_donation_type
								option = RICE_tarim_basin_khotan_procession_donation_type_medium
							}
						}
					}
					add_piety = 100
				}
				else_if = {
					limit = {
						scope:activity = {
							has_activity_option = {
								category = RICE_tarim_basin_khotan_procession_donation_type
								option = RICE_tarim_basin_khotan_procession_donation_type_large
							}
						}
					}
					add_piety = 150
				}
				RICE_tarim_basin_khotan_procession_eight_guardian_blessings_effect = yes
				add_character_modifier = {
					modifier = RICE_tarim_basin_participated_in_khotan_procession
					years = 5
				}
			}
			every_attending_character = {
				limit = { NOT = { this = scope:host } }
				custom = EVERY_ACTIVITY_PARTICIPANT_EFFECT
				add_character_modifier = {
					modifier = RICE_tarim_basin_participated_in_khotan_procession
					years = 5
				}
			}
		}
	}
}


RICE_tarim_basin_eight_protectors_abandoned_effect = {
	set_global_variable = {
		name = RICE_tarim_basin_khotan_eight_protectors_abandoned
		value = yes
	}
	set_global_variable = {
		name = RICE_tarim_basin_khotan_eight_protectors_abandoned_timer
		value = yes
		days = 10950
	}
	add_piety = 100
	#add_gold = 100
	title:c_khotan = {
		set_county_faith = scope:khotan_new_ruler.faith
	}
	faith = {
		change_fervor = {
			value = 5
			desc = fervor_gain_RICE_khotan_new_religion
		}
	}
	religion:buddhism_religion = {
        every_faith = {
			change_fervor = {
				value = -5
				desc = fervor_loss_RICE_khotan_new_religion
			}
        }
    }
	if = {
		limit = {
			title:c_khotan.holder = {
				has_character_modifier = RICE_tarim_basin_khotan_eight_protectors
			}
		}
		title:c_khotan.holder = {
			remove_character_modifier = RICE_tarim_basin_khotan_eight_protectors
		}		
	}
}

RICE_tarim_basin_gift_silk_road_troops_low_quality_spawn_effect = {
	spawn_army = {
		levies = 100
		men_at_arms = {
			type = light_footmen
			stacks = 1
		}
		location = root.capital_province
		uses_supply = yes
		inheritable = no
		name = RICE_tarim_basin_silk_road_event_troops
	}	
}

RICE_tarim_basin_gift_silk_road_troops_medium_quality_spawn_effect = {
	spawn_army = {
		levies = 100
		men_at_arms = {
			type = light_footmen
			stacks = 1
		}
		men_at_arms = {
			type = bowmen
			stacks = 1
		}
		location = root.capital_province
		uses_supply = yes
		inheritable = no
		name = RICE_tarim_basin_silk_road_event_troops
	}	
}

RICE_tarim_basin_gift_silk_road_troops_high_quality_spawn_effect = {
	spawn_army = {
		levies = 100
		men_at_arms = {
			type = light_footmen
			stacks = 1
		}
		men_at_arms = {
			type = bowmen
			stacks = 1
		}
		men_at_arms = {
			type = light_horsemen
			stacks = 1
		}
		location = root.capital_province
		uses_supply = yes
		inheritable = no
		name = RICE_tarim_basin_silk_road_event_troops
	}	
}

RICE_tarim_basin_gift_silk_road_troops_very_high_quality_spawn_effect = {
	spawn_army = {
		levies = 100
		men_at_arms = {
			type = light_footmen
			stacks = 1
		}
		men_at_arms = {
			type = bowmen
			stacks = 1
		}
		men_at_arms = {
			type = light_horsemen
			stacks = 1
		}
		men_at_arms = {
			type = pikemen_unit
			stacks = 1
		}
		location = root.capital_province
		uses_supply = yes
		inheritable = no
		name = RICE_tarim_basin_silk_road_event_troops
	}	
}


RICE_tarim_basin_dunhuang_zhang_yichao_death_effect = {
	title:k_guiyi.holder = {
		every_vassal = {
			limit = {
				culture = { has_cultural_pillar = heritage_chinese }
				highest_held_title_tier = tier_duchy
			}
			add_pressed_claim = title:k_guiyi
		}
	}
	if = {
		limit = {
			exists = title:k_xia.holder
		}
		title:k_guiyi.holder = {
			every_vassal = {
				limit = {
					culture = { has_cultural_pillar = heritage_chinese }
					highest_held_title_tier = tier_duchy
				}
				add_pressed_claim = title:k_xia
			}
		}
	}
}



RICE_tarim_basin_entertainer_effect = {
	if = {
		limit = {
			has_character_modifier = RICE_tarim_basin_kuchean_entertainers
		}
		title:c_kucha = {
			save_scope_as = kucha_county
		}
		# set_variable = {
		# 	name = RICE_entertainer_home_region
		# 	value = flag:RICE_entertainer_kuchean
		# 	years = 10 # Approx when the variable should expire
		# }		
	}

	# Entertainer is well-received by everyone
	random = {
		chance = 30
		trigger_event = {
			id = tarim_basin.0040
			days = { 365 3285 }
		}
	}

	# Singing girl catches someone's eye
	#trigger_event = tarim_basin.0042
	random = {
		chance = 20
		trigger_event = {
			id = tarim_basin.0042
			days = { 365 3285 }
		}
	}


}


RICE_tarim_basin_marry_entertainer_crush_effect = {
	# The girl joins the guy's court if he is not landed
	if = {
		limit = {
			scope:lover = {
				is_landed = yes
			}
		}
		scope:lover = {
			add_courtier = scope:crush
			marry = scope:crush
		}
		if = {
			limit = {
				var:RICE_entertainer_romance_type = flag:mutual
			}
			scope:lover = {
				set_random_lover_reason = { TARGET = scope:crush }
			}
		}
		else_if = {
			limit = {
				var:RICE_entertainer_romance_type = flag:one_sided
			}
			scope:crush = {
				add_opinion = {
					target = scope:lover
					modifier = RICE_tarim_basin_unwilling_marriage
				}
			}
			if = {
				limit = {
					NOT = { has_character_flag = RICE_tarim_basin_respects_entertainer_feelings }
				}
				scope:crush = {
					add_opinion = {
						target = scope:recipient
						modifier = RICE_tarim_basin_forced_to_be_consort
					}
				}
			}
		}
	}
	# The girl joins your court if the guy is not landed
	else = {			
		add_courtier = scope:crush
		scope:lover = {
			marry = scope:crush
		}
		if = {
			limit = {
				var:RICE_entertainer_romance_type = flag:mutual
			}
			scope:lover = {
				set_random_lover_reason = { TARGET = scope:crush }
			}
		}
		else_if = {
			limit = {
				var:RICE_entertainer_romance_type = flag:one_sided
			}
			scope:crush = {
				add_opinion = {
					target = scope:lover
					modifier = RICE_tarim_basin_unwilling_marriage
				}
			}
			if = {
				limit = {
					NOT = { has_character_flag = RICE_tarim_basin_respects_entertainer_feelings }
				}
				scope:crush = {
					add_opinion = {
						target = scope:recipient
						modifier = RICE_tarim_basin_forced_to_be_consort
					}
				}
			}
		}

		# if = {
		# 	limit = {
		# 		can_add_hook = {
		# 			target = scope:crush
		# 			type = loyalty_hook
		# 		}
		# 	}
		# 	add_hook = {
		# 		target = scope:crush
		# 		type = loyalty_hook
		# 	}
		# }
	}
}


RICE_dunhuang_wenmo_troop_spawn_effect = {
	spawn_army = {
		levies = 400
		men_at_arms = {
			type = light_footmen
			stacks = 1
		}
		men_at_arms = {
			type = mountaineer
			stacks = 1
		}
		men_at_arms = {
			type = bowmen
			stacks = 1
		}
		men_at_arms = {
			type = light_horsemen
			stacks = 1
		}
		location = this.capital_province
		uses_supply = yes
		inheritable = yes
		name = RICE_tarim_basin_wenmo_event_troops
	}	
}


RICE_dunhuang_intro_history_context_effect = {
	if = {
		limit = {
			dynasty = {
				has_dynasty_modifier = RICE_tarim_basin_zhang_clan
			}
		}
		custom_description_no_bullet = {
			text = RICE_dunhuang_start_intro.zhang
		}
	}
	else_if = {
		limit = {
			dynasty = {
				has_dynasty_modifier = RICE_tarim_basin_cao_clan
			}
		}
		custom_description_no_bullet = {
			text = RICE_dunhuang_start_intro.cao
		}
	}
	else_if = {
		limit = {
			dynasty = {
				has_dynasty_modifier = RICE_tarim_basin_li_clan
			}
		}
		custom_description_no_bullet = {
			text = RICE_dunhuang_start_intro.li
		}
	}
	else_if = {
		limit = {
			dynasty = {
				has_dynasty_modifier = RICE_tarim_basin_suo_clan
			}
		}
		custom_description_no_bullet = {
			text = RICE_dunhuang_start_intro.suo
		}
	}
	else_if = {
		limit = {
			dynasty = {
				has_dynasty_modifier = RICE_tarim_basin_zhai_clan
			}
		}
		custom_description_no_bullet = {
			text = RICE_dunhuang_start_intro.zhai
		}
	}
	else_if = {
		limit = {
			dynasty = {
				has_dynasty_modifier = RICE_tarim_basin_yin_clan
			}
		}
		custom_description_no_bullet = {
			text = RICE_dunhuang_start_intro.yin
		}
	}
	else_if = {
		limit = {
			dynasty = {
				has_dynasty_modifier = RICE_tarim_basin_yan_clan
			}
		}
		custom_description_no_bullet = {
			text = RICE_dunhuang_start_intro.yan
		}
	}
	else_if = {
		limit = {
			has_character_flag = RICE_zhang_wenche
		}
		custom_description_no_bullet = {
			text = RICE_dunhuang_start_intro.zhang_wenche
		}
		remove_character_flag = RICE_zhang_wenche
	}
	else_if = {
		limit = {
			has_character_flag = RICE_song_runying
		}
		custom_description_no_bullet = {
			text = RICE_dunhuang_start_intro.song_runying
		}
		remove_character_flag = RICE_song_runying
	}
	else_if = {
		limit = {
			has_character_flag = RICE_gao_jinda
		}
		custom_description_no_bullet = {
			text = RICE_dunhuang_start_intro.gao_jinda
		}
		remove_character_flag = RICE_gao_jinda
	}
	else_if = {
		limit = {
			culture = culture:sogdian
		}
		custom_description_no_bullet = {
			text = RICE_dunhuang_start_intro.sogdian
		}
	}
	else_if = {
		limit = {
			culture = culture:wenmo
		}
		custom_description_no_bullet = {
			text = RICE_dunhuang_start_intro.wenmo
		}
	}
}



RICE_tarim_basin_reinhabit_gomati_monastery_effect = {
	add_piety_level = 1
	add_prestige = 500
	dynasty = { add_dynasty_prestige = 250 }
	hidden_effect = {
		title:c_khotan.holder = {
			add_character_modifier = {
				modifier = RICE_tarim_basin_khotan_eight_protectors
			}
		}
	}
	if = {
		limit = {
			exists = global_var:RICE_tarim_basin_khotan_eight_protectors_abandoned
		}
		every_in_global_list = {
			variable  = RICE_tarim_basin_khotan_non_buddhist_maker_list
			remove_list_global_variable = {
				name = RICE_tarim_basin_khotan_non_buddhist_maker_list
				target = THIS
			}
		}
	}
	if = {
		limit = {
			has_global_variable = RICE_tarim_basin_khotan_eight_protectors_abandoned_timer
		}
		remove_global_variable = RICE_tarim_basin_khotan_eight_protectors_abandoned_timer
	}
	remove_global_variable = RICE_tarim_basin_khotan_eight_protectors_abandoned
	title:c_khotan = {
		set_county_faith = scope:khotan_buddhism_restorer.faith
	}
	custom_tooltip = RICE_tarim_basin_reinhabit_gomati_monastery_effect_tooltip_1
	custom_tooltip = RICE_tarim_basin_reinhabit_gomati_monastery_effect_tooltip_2
	religion:buddhism_religion = {
        every_faith = {
			custom = RICE_every_buddhist_faith
			change_fervor = {
				value = 5
				desc = fervor_gain_RICE_khotan_gomati_restored
			}
        }
    }
}

RICE_tarim_basin_construct_ordam_mazar_effect = {
	add_piety = 500
	add_prestige = 250
	custom_tooltip = RICE_tarim_basin_construct_ordam_mazar_effect_tooltip_1
	custom_tooltip = RICE_tarim_basin_construct_ordam_mazar_effect_tooltip_2
	faith = {
		change_fervor = {
			value = 3
			desc = fervor_gain_RICE_ordam_mazar_built
		}
	}
	set_global_variable = {
		name = RICE_ordam_mazar_festival_triggered
		value = yes
	}
	title:c_kashgar = {
		set_county_faith = root.faith
		add_county_modifier = {
			modifier = RICE_tarim_basin_ordam_mazar_recently_built
			years = 30
		}
	}
}


RICE_tarim_basin_crescent_lake_visit_completed_log_entry_effect = {
	scope:activity = {
		add_activity_log_entry = {
			key = RICE_tarim_basin_crescent_lake_visit_completed_log
			tags = { completed }
			# this line below adds the entry to the Effects section of the conclusion UI
			show_in_conclusion = yes
			character = root
			scope:host = {
				if = {
					limit = {
						scope:host = {
							var:RICE_tarim_basin_crescent_lake_visit_event = flag:dunes
						}
					}
					add_prestige = 30
					stress_impact = {
						base = minor_stress_impact_loss
						brave = miniscule_stress_impact_loss
						diligent = miniscule_stress_impact_loss
					}
				}
				else_if = {
					limit = {
						scope:host = {
							var:RICE_tarim_basin_crescent_lake_visit_event = flag:temple
						}
					}
					add_piety = 30
					stress_impact = {
						base = minor_stress_impact_loss
						zealous = minor_stress_impact_loss
					}
				}
				else_if = {
					limit = {
						scope:host = {
							var:RICE_tarim_basin_crescent_lake_visit_event = flag:lake
						}
					}
					add_prestige = 15
					add_piety = 15
					stress_impact = {
						base = minor_stress_impact_loss
						gregarious = miniscule_stress_impact_loss
						lazy = miniscule_stress_impact_loss
						gluttonous = miniscule_stress_impact_loss
					}
				}
				add_character_modifier = {
					modifier = RICE_tarim_basin_dunhuang_crescent_lake_visit
					years = 5
				}	
			}
            every_attending_character = {
                limit = { NOT = { this = root } }
                custom = EVERY_ACTIVITY_PARTICIPANT_EFFECT			
				stress_impact = {
					base = minor_stress_impact_loss
				}
				add_character_modifier = {
					modifier = RICE_tarim_basin_dunhuang_crescent_lake_visit
					years = 5
				}	
            }	
		}
	}
}

# RICE_tarim_basin_crescent_lake_visit_completed_log_entry_effect = {
# 	scope:activity = {
# 		add_activity_log_entry = {
# 			key = RICE_tarim_basin_crescent_lake_visit_completed_log
# 			tags = { completed }
# 			# this line below adds the entry to the Effects section of the conclusion UI
# 			show_in_conclusion = yes
# 			character = root
# 			show_as_tooltip = {
# 				every_attending_character = {
# 					limit = { NOT = { this = root } }
# 					custom = EVERY_ACTIVITY_PARTICIPANT_EFFECT			
# 					stress_impact = {
# 						base = minor_stress_impact_loss
# 					}
# 					add_character_modifier = {
# 						modifier = RICE_tarim_basin_dunhuang_crescent_lake_visit
# 						years = 5
# 					}	
# 				}					
# 			}
# 		}
# 	}
# }

RICE_tocharian_animal_fight_completed_log_entry_effect = {	
	scope:activity = {
		add_activity_log_entry = {
			key = RICE_tocharian_animal_fight_completed_log
			tags = { completed }
			# this line below adds the entry to the Effects section of the conclusion UI
			show_in_conclusion = yes
			character = root
			scope:host = {
				custom_tooltip = RICE_activity_result_gained_prestige
				show_as_tooltip = {
					if = {
						limit = {
							has_character_modifier = RICE_tarim_basin_fight_cattle_good_character
						}
						add_character_modifier = {
							modifier = RICE_tarim_basin_fight_cattle_good_character
							years = 7
						}
					}
					else_if = {
						limit = {
							has_character_modifier = RICE_tarim_basin_fight_horses_good_character
						}
						add_character_modifier = {
							modifier = RICE_tarim_basin_fight_horses_good_character
							years = 7
						}
					}
					else_if = {
						limit = {
							has_character_modifier = RICE_tarim_basin_fight_camels_good_character
						}
						add_character_modifier = {
							modifier = RICE_tarim_basin_fight_camels_good_character
							years = 7
						}
					}
					else_if = {
						limit = {
							has_character_modifier = RICE_tarim_basin_fight_goats_good_character
						}
						add_character_modifier = {
							modifier = RICE_tarim_basin_fight_goats_good_character
							years = 7
						}
					}
					else_if = {
						limit = {
							has_character_modifier = RICE_tarim_basin_fight_cattle_great_character
						}
						add_character_modifier = {
							modifier = RICE_tarim_basin_fight_cattle_great_character
							years = 7
						}
					}
					else_if = {
						limit = {
							has_character_modifier = RICE_tarim_basin_fight_horses_great_character
						}
						add_character_modifier = {
							modifier = RICE_tarim_basin_fight_horses_great_character
							years = 7
						}
					}
					else_if = {
						limit = {
							has_character_modifier = RICE_tarim_basin_fight_camels_great_character
						}
						add_character_modifier = {
							modifier = RICE_tarim_basin_fight_camels_great_character
							years = 7
						}
					}
					else_if = {
						limit = {
							has_character_modifier = RICE_tarim_basin_fight_goats_great_character
						}
						add_character_modifier = {
							modifier = RICE_tarim_basin_fight_goats_great_character
							years = 7
						}
					}
					else_if = {
						limit = {
							capital_county = {
								has_county_modifier = RICE_tarim_basin_fight_cattle_good_county
							}
						}
						capital_county = {
							add_county_modifier = {
								modifier = RICE_tarim_basin_fight_cattle_good_county
								years = 7
							}			
						} 
					}
					else_if = {
						limit = {
							capital_county = {
								has_county_modifier = RICE_tarim_basin_fight_horses_good_county
							}
						}
						capital_county = {
							add_county_modifier = {
								modifier = RICE_tarim_basin_fight_horses_good_county
								years = 7
							}			
						} 
					}
					else_if = {
						limit = {
							capital_county = {
								has_county_modifier = RICE_tarim_basin_fight_camels_good_county
							}
						}
						capital_county = {
							add_county_modifier = {
								modifier = RICE_tarim_basin_fight_camels_good_county
								years = 7
							}			
						} 
					}
					else_if = {
						limit = {
							capital_county = {
								has_county_modifier = RICE_tarim_basin_fight_goats_good_county
							}
						}
						capital_county = {
							add_county_modifier = {
								modifier = RICE_tarim_basin_fight_goats_good_county
								years = 7
							}			
						} 
					}
					else_if = {
						limit = {
							capital_county = {
								has_county_modifier = RICE_tarim_basin_fight_cattle_great_county
							}
						}
						capital_county = {
							add_county_modifier = {
								modifier = RICE_tarim_basin_fight_cattle_great_county
								years = 7
							}			
						} 
					}
					else_if = {
						limit = {
							capital_county = {
								has_county_modifier = RICE_tarim_basin_fight_horses_great_county
							}
						}
						capital_county = {
							add_county_modifier = {
								modifier = RICE_tarim_basin_fight_horses_great_county
								years = 7
							}			
						} 
					}
					else_if = {
						limit = {
							capital_county = {
								has_county_modifier = RICE_tarim_basin_fight_camels_great_county
							}
						}
						capital_county = {
							add_county_modifier = {
								modifier = RICE_tarim_basin_fight_camels_great_county
								years = 7
							}			
						} 
					}
					else_if = {
						limit = {
							capital_county = {
								has_county_modifier = RICE_tarim_basin_fight_goats_great_county
							}
						}
						capital_county = {
							add_county_modifier = {
								modifier = RICE_tarim_basin_fight_goats_great_county
								years = 7
							}			
						} 
					}
				}
			}					
			every_attending_character = {
				limit = { NOT = { this = root } }
				custom = EVERY_ACTIVITY_PARTICIPANT_EFFECT			
				add_prestige = 25
			}	
		}
	}
}



RICE_tarim_basin_ordam_mazar_completed_log_entry_effect = {
	scope:activity = {
		add_activity_log_entry = {
			key = RICE_tarim_basin_ordam_mazar_completed_log
			tags = { completed }
			# this line below adds the entry to the Effects section of the conclusion UI
			show_in_conclusion = yes
			character = root
			scope:host = {
				if = {
					limit = {
						scope:activity = {
							has_activity_option = {
								category = RICE_tarim_basin_ordam_mazar_golden_bowl_type
								option = RICE_tarim_basin_ordam_mazar_golden_bowl_type_small
							}
						}
					}
					add_prestige = 50
				}
				else_if = {
					limit = {
						scope:activity = {
							has_activity_option = {
								category = RICE_tarim_basin_ordam_mazar_golden_bowl_type
								option = RICE_tarim_basin_ordam_mazar_golden_bowl_type_medium
							}
						}
					}
					add_prestige = 100
				}
				else_if = {
					limit = {
						scope:activity = {
							has_activity_option = {
								category = RICE_tarim_basin_ordam_mazar_golden_bowl_type
								option = RICE_tarim_basin_ordam_mazar_golden_bowl_type_large
							}
						}
					}
					add_prestige = 150
				}
				if = {
					limit = {
						scope:activity = {
							has_activity_option = {
								category = RICE_tarim_basin_ordam_mazar_tomb_upkeep_type
								option = RICE_tarim_basin_ordam_mazar_tomb_upkeep_type_none
							}
						}
					}
					add_piety = 50
				}
				else_if = {
					limit = {
						scope:activity = {
							has_activity_option = {
								category = RICE_tarim_basin_ordam_mazar_tomb_upkeep_type
								option = RICE_tarim_basin_ordam_mazar_tomb_upkeep_type_modest
							}
						}
					}
					add_piety = 100
				}
				else_if = {
					limit = {
						scope:activity = {
							has_activity_option = {
								category = RICE_tarim_basin_ordam_mazar_tomb_upkeep_type
								option = RICE_tarim_basin_ordam_mazar_tomb_upkeep_type_substantial
							}
						}
					}
					add_piety = 150
				}
				add_character_modifier = {
					modifier = RICE_tarim_basin_attended_ordam_mazar
					years = 5
				}
				if = {
					limit = {
						has_activity_intent = RICE_tarim_basin_ordam_mazar_remembrance_intent
					}
					stress_impact = {
						zealous = miniscule_stress_impact_loss
						calm = miniscule_stress_impact_loss
						humble = miniscule_stress_impact_loss
						just = miniscule_stress_impact_loss
					}
				}
				else_if = {
					limit = {
						has_activity_intent = RICE_tarim_basin_ordam_mazar_socialization_intent
					}
					stress_impact = {
						gregarious = miniscule_stress_impact_loss
						ambitious = miniscule_stress_impact_loss
						gluttonous = miniscule_stress_impact_loss
						lustful = miniscule_stress_impact_loss
					}
				}
			}				
			every_attending_character = {
				limit = { NOT = { this = root } }
				custom = EVERY_ACTIVITY_PARTICIPANT_EFFECT			
				add_piety = 25
				add_prestige = 25
				add_character_modifier = {
					modifier = RICE_tarim_basin_attended_ordam_mazar
					years = 5
				}
				hidden_effect = {
					if = {
						limit = {
							has_activity_intent = RICE_tarim_basin_ordam_mazar_remembrance_intent
						}
						stress_impact = {
							zealous = miniscule_stress_impact_loss
							calm = miniscule_stress_impact_loss
							humble = miniscule_stress_impact_loss
							just = miniscule_stress_impact_loss
						}
					}
					else_if = {
						limit = {
							has_activity_intent = RICE_tarim_basin_ordam_mazar_socialization_intent
						}
						stress_impact = {
							gregarious = miniscule_stress_impact_loss
							ambitious = miniscule_stress_impact_loss
							gluttonous = miniscule_stress_impact_loss
							lustful = miniscule_stress_impact_loss
						}
					}					
				}
			}
		}
	}
}


RICE_silk_road_merchant_assign_experience_effect = {
	if = {
		limit = { has_trait = RICE_silk_road_merchant }
		random_list = {
			# Lower end
			45 = {
				add_trait_xp = {
					trait = RICE_silk_road_merchant
					value = {
						integer_range = {
							min = 0
							max = 50
						}
					}
				}
			}
			# Middle
			35 = {
				add_trait_xp = {
					trait = RICE_silk_road_merchant
					value = {
						integer_range = {
							min = 50
							max = 75
						}
					}
				}
			}
			# High
			20 = {
				add_trait_xp = {
					trait = RICE_silk_road_merchant
					value = {
						integer_range = {
							min = 75
							max = 100
						}
					}
				}
			}
		}
	}
}

