﻿# 00_court_character_templates.txt
random_barrel_character = {
	age = { 25 45 }
		
	# They should be vaguely good at what they do
	random_traits_list = {
		count = 1
		education_learning_3 = {}
		education_learning_4 = {}
		education_intrigue_3 = {}
		education_intrigue_4 = {}
		education_diplomacy_3 = {}
		education_diplomacy_4 = {}
		education_stewardship_3 = {}
		education_stewardship_4 = {}
		education_martial_3 = {}
		education_martial_4 = {}
	}
	random_traits = yes

	# Lowborn from the local populace
	dynasty = none
	faith = root.capital_province.faith
	culture = root.capital_province.culture

	# Some chance of non-dominant gender, but small
	gender_female_chance = root_faith_dominant_gender_adjusted_female_chance

	learning = {
		min_template_low_skill
		max_template_high_skill
	}
	intrigue = {
		min_template_low_skill
		max_template_high_skill
	}
	stewardship = {
		min_template_low_skill
		max_template_high_skill
	}
	diplomacy = {
		min_template_low_skill
		max_template_high_skill
	}
	martial = {
		min_template_low_skill
		max_template_high_skill
	}
	prowess = {
		min_template_low_skill
		max_template_high_skill
	}
	
	after_creation = {
		if = {
			limit = { exists = root.capital_county }
        	root.capital_county = { random_county_province = { save_temporary_scope_as = origin_province } }
		}
		else = { root.location.county = { random_county_province = { save_temporary_scope_as = origin_province } } }
        E_kCAFG_set_culture_from_province_random = { PROVINCE = scope:origin_province }
        E_kCAFG_set_faith_from_province_random = { PROVINCE = scope:origin_province }

		random_list = {
			30 = {
				# Character is of average weight, nothing happens	
			}
			20 = {
				change_current_weight = -50
			}
			20 = {
				change_current_weight = -100
			}
		}
		if = { # If the character does not speak the ruler's language, learn it
			limit = {
				NOT = {
					knows_language_of_culture = root.culture
				}
			}
			learn_language_of_culture = root.culture
		}
	}
}

# 00_officials_templates.txt
estate_owner_character = {
	age = { 20 40 }
	trait = deceitful
	random_traits_list = {
		count = 1
		education_stewardship_3 = {}
		education_stewardship_4 = {}
	}
	random_traits = yes
	culture = root.capital_province.culture
	faith = root.capital_province.faith
	gender_female_chance = {
		if = {
			limit = { root.capital_province.faith = { has_doctrine = doctrine_gender_male_dominated } }
			add = 0
		}
		else_if = {
			limit = { root.capital_province.faith = { has_doctrine = doctrine_gender_female_dominated } }
			add = 100
		}
		else = {
			add = 50
		}
	}
	stewardship = {
		min_template_decent_skill
		max_template_decent_skill
	}
	
	after_creation = {
		if = {
			limit = { exists = root.capital_county }
        	root.capital_county = { random_county_province = { save_temporary_scope_as = origin_province } }
		}
		else = { root.location.county = { random_county_province = { save_temporary_scope_as = origin_province } } }
        E_kCAFG_set_culture_from_province_random = { PROVINCE = scope:origin_province }
        E_kCAFG_set_faith_from_province_random = { PROVINCE = scope:origin_province }
    }
}

# 00_peasants_template.txt

bandit_character = {
	age = { 20 40 }
	random_traits = no
	dynasty = none
	faith = root.location.county.holder.faith
	culture = root.location.culture
	random_traits_list = {
		count = 1
		education_martial_1 = { weight = { base = 50 } }
		education_martial_2 = { weight = { base = 20 } }
		education_martial_3 = { weight = { base = 5 } }
	}
	random_traits_list = {
		count = 2
		ambitious = {}
		gregarious = {}
		impatient = {}
		wrathful = {}
		callous = {}
		stubborn = {}
		vengeful = {}
		greedy = {}
		zealous = {}
		lazy = {}
		deceitful = {}
		arrogant = {}
		gluttonous = {}
	}
	random_traits_list = {
		count = 1
		intellect_bad_1 = { weight = { base = 10 } }
		intellect_bad_2 = { weight = { base = 10 } }
		physique_good_1 = { weight = { base = 5 } }
		physique_good_2 = { weight = { base = 5 } }
		strong = { weight = { base = 5 } }
		giant = { weight = { base = 5 } }
		reckless = { weight = { base = 20 } }
		rough_terrain_expert = { weight = { base = 20 } }
		unyielding_defender = { weight = { base = 10 } }
		flexible_leader = { weight = { base = 10 } }
		forder = { weight = { base = 10 } }
		tourney_participant = { weight = { base = 20 } }
	}
	gender_female_chance = root_soldier_female_chance
	martial = {
		min_template_decent_skill
		max_template_decent_skill
	}
	after_creation = {
        root.location.county = { random_county_province = { save_temporary_scope_as = origin_province } }
        E_kCAFG_set_culture_from_province_random = { PROVINCE = scope:origin_province }
		random_list = {
			10 = {}
			10 = {
				add_random_tiered_trait_track_xp_effect = {
					TRAIT = tourney_participant
					TRACK = horse
					LEVEL_1 = yes
					LEVEL_3 = no
				}
			}
			10 = {
				add_random_tiered_trait_track_xp_effect = {
					TRAIT = tourney_participant
					TRACK = bow
					LEVEL_1 = yes
					LEVEL_3 = no
				}
			}
		}
	}
}

# 00_pool_repopulation_character_templates.txt
# pool_repopulate_prowess = {
# 	age = { 20 40 }
# 	random_traits = yes
# 	gender_female_chance = root_soldier_female_chance
# 	culture = root.culture
# 	faith = root.faith
# 	prowess = {
# 		min_guest_template_skill max_guest_template_skill
# 	}
# 	random_traits_list = {
# 		education_martial_1 = { weight = { base = 35 } }
# 		education_martial_2 = { weight = { base = 35 } }
# 		education_martial_3 = { weight = { base = 20 } }
# 		education_martial_4 = { weight = { base = 10 } }
# 	}
# 	random_traits_list = {
# 		count = { 0 1 }
# 		lifestyle_blademaster = {}
# 		gallant = {}
# 		brave = {}
# 		gluttonous = {}
# 		strong = {}
# 		athletic = {}
# 		lifestyle_hunter = {}
# 	}
# 	dynasty = none
# 	after_creation = {
# 		if = {
# 			limit = { exists = root.capital_county }
#         	root.capital_county = { random_county_province = { save_temporary_scope_as = origin_province } }
# 		}
# 		else_if = {
# 			limit = {
# 				exists = root.location
# 				exists = root.location.county
# 			}
# 			root.location.county = { random_county_province = { save_temporary_scope_as = origin_province } }
# 		}
# 		if = {
# 			limit = { exists = scope:origin_province }
# 			E_kCAFG_set_culture_from_province_random = { PROVINCE = scope:origin_province }
# 			E_kCAFG_set_faith_from_province_random = { PROVINCE = scope:origin_province }
# 		}
#         E_kei_character_creation_nudge_cultural_traits = yes

# 		set_interesting_traits_and_modifiers_effect = yes
# 		add_random_tiered_trait_xp_effect = {
# 			TRAIT = lifestyle_blademaster
# 			LEVEL_1 = yes
# 			LEVEL_3 = yes
# 		}
# 		add_random_tiered_trait_track_xp_effect = {
# 			TRAIT = lifestyle_hunter
# 			TRACK = hunter
# 			LEVEL_1 = yes
# 			LEVEL_3 = no
# 		}
# 		# ToTo Hastiluder
# 		if = {
# 			limit = { has_dlc_feature = tours_and_tournaments }
# 			random = {
# 				chance = 33
# 				add_trait = tourney_participant
# 				add_random_tourney_participant_level_effect = yes
# 			}
# 		}
# 	}
# }

# pool_repopulate_diplomacy = {
# 	age = { 20 40 }
# 	gender_female_chance = root_faith_dominant_gender_adjusted_female_chance #because chancellor gender is doctrine dependent
# 	random_traits = yes
# 	culture = root.culture
# 	faith = root.faith
# 	diplomacy = {
# 		min_guest_template_skill max_guest_template_skill
# 	}
# 	random_traits_list = {
# 		education_diplomacy_1 = { weight = { base = 35 } }
# 		education_diplomacy_2 = { weight = { base = 35 } }
# 		education_diplomacy_3 = { weight = { base = 20 } }
# 		education_diplomacy_4 = { weight = { base = 10 } }
# 	}
# 	random_traits_list = {
# 		count = { 0 1 }
# 		diplomat = {}
# 		family_first = {}
# 		august = {}
# 		lifestyle_reveler = {}
# 		generous = {}
# 		arrogant = {}
# 		honest = {}
# 		gregarious = {}
# 		trusting = {}
# 		compassionate = {}
# 		fickle = {}
# 		forgiving = {}
# 		poet = {}
# 		tourney_participant = {}
# 		lifestyle_traveler = {}
# 	}
# 	dynasty = none
# 	after_creation = {
# 		if = {
# 			limit = { exists = root.capital_county }
#         	root.capital_county = { random_county_province = { save_temporary_scope_as = origin_province } }
# 		}
# 		else = { root.location.county = { random_county_province = { save_temporary_scope_as = origin_province } } }
#         E_kCAFG_set_culture_from_province_random = { PROVINCE = scope:origin_province }
#         E_kCAFG_set_faith_from_province_random = { PROVINCE = scope:origin_province }

# 		random = {
# 			chance = 1
# 			add_trait = lifestyle_poet

# 			modifier = {
# 				add = 29
# 				culture = { has_cultural_parameter = poet_trait_more_common }
# 			}
# 		}
#         E_kei_character_creation_nudge_cultural_traits = yes
# 		set_interesting_traits_and_modifiers_effect = yes
# 		if = {
# 			limit = { has_trait = lifestyle_reveler }
# 			add_trait_xp = {
# 				trait = lifestyle_reveler
# 				value = {
# 					integer_range = {
# 						min = small_lifestyle_random_xp_low
# 						max = small_lifestyle_random_xp_high
# 					}
# 				}
# 			}
# 		}
# 		add_random_tiered_trait_track_xp_effect = {
# 			TRAIT = tourney_participant
# 			TRACK = wit
# 			LEVEL_1 = yes
# 			LEVEL_3 = no
# 		}
# 	}
# }

# pool_repopulate_martial = {
# 	age = { 30 45 }
# 	gender_female_chance = root_faith_dominant_gender_adjusted_female_chance #because marshal gender is doctrine dependent
# 	random_traits = yes
# 	culture = root.culture
# 	faith = root.faith
# 	martial = {
# 		min_guest_template_skill max_guest_template_skill
# 	}
# 	random_traits_list = {
# 		education_martial_1 = { weight = { base = 35 } }
# 		education_martial_2 = { weight = { base = 35 } }
# 		education_martial_3 = { weight = { base = 20 } }
# 		education_martial_4 = { weight = { base = 10 } }
# 	}
# 	random_traits_list = {
# 		count = { 0 1 }
# 		strategist = {}
# 		overseer = {}
# 		wrathful = {}
# 		zealous = {}
# 		impatient = {}
# 		lifestyle_hunter = {}
# 		tourney_participant = {}
# 	}
# 	dynasty = none
# 	after_creation = {
# 		if = {
# 			limit = { exists = root.capital_county }
#         	root.capital_county = { random_county_province = { save_temporary_scope_as = origin_province } }
# 		}
# 		else = { root.location.county = { random_county_province = { save_temporary_scope_as = origin_province } } }
#         E_kCAFG_set_culture_from_province_random = { PROVINCE = scope:origin_province }
#         E_kCAFG_set_faith_from_province_random = { PROVINCE = scope:origin_province }
#         E_kei_character_creation_nudge_cultural_traits = yes

# 		set_interesting_traits_and_modifiers_effect = yes
# 		add_random_tiered_trait_track_xp_effect = {
# 			TRAIT = lifestyle_hunter
# 			TRACK = hunter
# 			LEVEL_1 = yes
# 			LEVEL_3 = no
# 		}
# 		add_random_tiered_trait_track_xp_effect = {
# 			TRAIT = tourney_participant
# 			TRACK = wit
# 			LEVEL_1 = yes
# 			LEVEL_3 = no
# 		}
# 	}
# }

# pool_repopulate_stewardship = {
# 	age = { 20 40 }
# 	gender_female_chance = root_faith_dominant_gender_adjusted_female_chance #because steward gender is doctrine dependent
# 	random_traits = yes
# 	culture = root.culture
# 	faith = root.faith
# 	stewardship = {
# 		min_guest_template_skill max_guest_template_skill
# 	}
# 	random_traits_list = {
# 		education_stewardship_1 = { weight = { base = 35 } }
# 		education_stewardship_2 = { weight = { base = 35 } }
# 		education_stewardship_3 = { weight = { base = 20 } }
# 		education_stewardship_4 = { weight = { base = 10 } }
# 	}
# 	random_traits_list = {
# 		count = { 0 1 }
# 		architect = {}
# 		administrator = {}
# 		avaricious = {}
# 		temperate = {}
# 		greedy = {}
# 		just = {}
# 		stubborn = {}
# 		ambitious = {}
# 	}
# 	dynasty = none
# 	after_creation = {
# 		if = {
# 			limit = { exists = root.capital_county }
#         	root.capital_county = { random_county_province = { save_temporary_scope_as = origin_province } }
# 		}
# 		else = { root.location.county = { random_county_province = { save_temporary_scope_as = origin_province } } }
#         E_kCAFG_set_culture_from_province_random = { PROVINCE = scope:origin_province }
#         E_kCAFG_set_faith_from_province_random = { PROVINCE = scope:origin_province }
#         E_kei_character_creation_nudge_cultural_traits = yes

# 		set_interesting_traits_and_modifiers_effect = yes
# 	}
# }

# pool_repopulate_intrigue = {
# 	age = { 25 40 }
# 	random_traits = yes
# 	gender_female_chance = 50 #No gender blocks for spymaster
# 	culture = root.culture
# 	faith = root.faith
# 	intrigue = {
# 		min_guest_template_skill max_guest_template_skill
# 	}
# 	random_traits_list = {
# 		education_intrigue_1 = { weight = { base = 35 } }
# 		education_intrigue_2 = { weight = { base = 35 } }
# 		education_intrigue_3 = { weight = { base = 20 } }
# 		education_intrigue_4 = { weight = { base = 10 } }
# 	}
# 	random_traits_list = {
# 		count = { 0 1 }
# 		schemer = {}
# 		seducer = {}
# 		torturer = {}
# 		deceitful = {}
# 		lustful = {}
# 		calm = {}
# 		arbitrary = {}
# 		paranoid = {}
# 		callous = {}
# 		sadistic = {}
# 		vengeful = {}
# 		craven = {}
# 	}
# 	dynasty = none
# 	after_creation = {
# 		if = {
# 			limit = { exists = root.capital_county }
#         	root.capital_county = { random_county_province = { save_temporary_scope_as = origin_province } }
# 		}
# 		else = { root.location.county = { random_county_province = { save_temporary_scope_as = origin_province } } }
#         E_kCAFG_set_culture_from_province_random = { PROVINCE = scope:origin_province }
#         E_kCAFG_set_faith_from_province_random = { PROVINCE = scope:origin_province }
#         E_kei_character_creation_nudge_cultural_traits = yes

# 		set_interesting_traits_and_modifiers_effect = yes
# 	}
# }

# pool_repopulate_learning = {
# 	age = { 25 60 }
# 	gender_female_chance = 50 #No gender blocks for physicians
# 	random_traits = yes
# 	culture = root.culture
# 	faith = root.faith
# 	learning = {
# 		min_guest_template_skill max_guest_template_skill
# 	}
# 	random_traits_list = {
# 		education_learning_1 = { weight = { base = 35 } }
# 		education_learning_2 = { weight = { base = 35 } }
# 		education_learning_3 = { weight = { base = 20 } }
# 		education_learning_4 = { weight = { base = 10 } }
# 	}
# 	random_traits_list = {
# 		count = { 0 1 }
# 		scholar = {}
# 		theologian = {}
# 		whole_of_body = {}
# 		lifestyle_physician = {}
# 		lifestyle_mystic = {}
# 		lifestyle_herbalist = {}
# 		chaste = {}
# 		diligent = {}
# 		patient = {}
# 		humble = {}
# 		shy = {}
# 		content = {}
# 		cynical = {}
# 		lazy = {}
# 	}
# 	dynasty = none
# 	after_creation = {
# 		if = {
# 			limit = { exists = root.capital_county }
#         	root.capital_county = { random_county_province = { save_temporary_scope_as = origin_province } }
# 		}
# 		else = { root.location.county = { random_county_province = { save_temporary_scope_as = origin_province } } }
#         E_kCAFG_set_culture_from_province_random = { PROVINCE = scope:origin_province }
#         E_kCAFG_set_faith_from_province_random = { PROVINCE = scope:origin_province }
#         E_kei_character_creation_nudge_cultural_traits = yes

# 		if = {
# 			limit = {
# 				faith = {
# 					has_doctrine = tenet_monasticism
# 				}
# 			}
# 			random_list = {
# 				75 = {}
# 				25 = {
# 					add_trait = devoted
# 				}
# 			}
# 		}
# 		set_interesting_traits_and_modifiers_effect = yes
# 		add_random_tiered_trait_xp_effect = {
# 			TRAIT = lifestyle_physician
# 			LEVEL_1 = yes
# 			LEVEL_3 = yes
# 		}
# 		add_random_tiered_trait_xp_effect = {
# 			TRAIT = lifestyle_mystic
# 			LEVEL_1 = yes
# 			LEVEL_3 = no
# 		}
# 	}
# }

# pool_repopulate_spouse = {
# 	gender_female_chance = root.marriage_gender_adjusted_female_chance
# 	age = { 16 26 }
# 	random_traits = yes
# 	culture = root.culture
# 	faith = root.faith
# 	random_traits_list = {
# 		education_diplomacy_1 = { weight = { base = 35 } }
# 		education_diplomacy_2 = { weight = { base = 35 } }
# 		education_diplomacy_3 = { weight = { base = 20 } }
# 		education_diplomacy_4 = { weight = { base = 10 } }
# 		education_martial_1 = {
# 			weight = {
# 				base = 35
# 				modifier = { # Less common with martial education if character can't be combatant because of gender
# 					factor = 0.3
# 					trigger_if = {
# 						limit = { root = { is_female = yes } }
# 						dummy_male = { NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
# 					}
# 					trigger_else = {
# 						dummy_female = { NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
# 					}
# 				}
# 			}
# 		}
# 		education_martial_2 = {
# 			weight = {
# 				base = 35
# 				modifier = { # Less common with martial education if character can't be combatant because of gender
# 					factor = 0.3
# 					trigger_if = {
# 						limit = { root = { is_female = yes } }
# 						dummy_male = { NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
# 					}
# 					trigger_else = {
# 						dummy_female = { NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
# 					}
# 				}
# 			}
# 		}
# 		education_martial_3 = {
# 			weight = {
# 				base = 20
# 				modifier = { # Less common with martial education if character can't be combatant because of gender
# 					factor = 0.3
# 					trigger_if = {
# 						limit = { root = { is_female = yes } }
# 						dummy_male = { NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
# 					}
# 					trigger_else = {
# 						dummy_female = { NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
# 					}
# 				}
# 			}
# 		}
# 		education_martial_4 = {
# 			weight = {
# 				base = 10
# 				modifier = { # Less common with martial education if character can't be combatant because of gender
# 					factor = 0.3
# 					trigger_if = {
# 						limit = { root = { is_female = yes } }
# 						dummy_male = { NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
# 					}
# 					trigger_else = {
# 						dummy_female = { NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
# 					}
# 				}
# 			}
# 		}
# 		education_stewardship_1 = { weight = { base = 35 } }
# 		education_stewardship_2 = { weight = { base = 35 } }
# 		education_stewardship_3 = { weight = { base = 20 } }
# 		education_stewardship_4 = { weight = { base = 10 } }
# 		education_intrigue_1 = { weight = { base = 35 } }
# 		education_intrigue_2 = { weight = { base = 35 } }
# 		education_intrigue_3 = { weight = { base = 20 } }
# 		education_intrigue_4 = { weight = { base = 10 } }
# 		education_learning_1 = { weight = { base = 35 } }
# 		education_learning_2 = { weight = { base = 35 } }
# 		education_learning_3 = { weight = { base = 20 } }
# 		education_learning_4 = { weight = { base = 10 } }
# 	}
# 	random_traits_list = {
# 		count = { 0 1 }
# 		diplomat = {}
# 		strategist = {}
# 		architect = {}
# 		schemer = {}
# 		scholar = {}
# 		whole_of_body = {}
# 		fecund = {}
# 		intellect_good_1 = {}
# 		physique_good_1 = {}
# 		beauty_good_1 = {}
# 	}
# 	dynasty = none
# 	after_creation = {
# 		if = {
# 			limit = { exists = root.capital_county }
#         	root.capital_county = { random_county_province = { save_temporary_scope_as = origin_province } }
# 		}
# 		else = { root.location.county = { random_county_province = { save_temporary_scope_as = origin_province } } }
#         E_kCAFG_set_culture_from_province_random = { PROVINCE = scope:origin_province }
#         E_kCAFG_set_faith_from_province_random = { PROVINCE = scope:origin_province }
#         E_kei_character_creation_nudge_cultural_traits = yes

# 		set_interesting_traits_and_modifiers_effect = yes
# 	}
# }

# pool_repopulate_local_flavor = {
# 	age = { 20 50 }
# 	gender_female_chance = root_faith_dominant_gender_adjusted_female_chance #because council gender is doctrine dependent
# 	random_traits = yes
# 	culture = root.culture
# 	faith = root.faith

# 	learning = {
# 		min_guest_template_skill max_guest_template_skill
# 	}
	
# 	stewardship = {
# 		min_guest_template_skill max_guest_template_skill
# 	}
	
# 	diplomacy = {
# 		min_guest_template_skill max_guest_template_skill
# 	}
	
# 	intrigue = {
# 		min_guest_template_skill max_guest_template_skill
# 	}
	
# 	martial = {
# 		min_guest_template_skill max_guest_template_skill
# 	}
	
# 	random_traits_list = {
# 		education_learning_1 = { weight = { base = 8 } }
# 		education_learning_2 = { weight = { base = 12 } }
# 		education_learning_3 = { weight = { base = 20 } }
# 		education_learning_4 = { weight = { base = 15 } }
# 		education_stewardship_1 = { weight = { base = 8 } }
# 		education_stewardship_2 = { weight = { base = 12 } }
# 		education_stewardship_3 = { weight = { base = 20 } }
# 		education_stewardship_4 = { weight = { base = 15 } }
# 		education_diplomacy_1 = { weight = { base = 8 } }
# 		education_diplomacy_2 = { weight = { base = 12 } }
# 		education_diplomacy_3 = { weight = { base = 20 } }
# 		education_diplomacy_4 = { weight = { base = 15 } }
# 		education_intrigue_1 = { weight = { base = 8 } }
# 		education_intrigue_2 = { weight = { base = 12 } }
# 		education_intrigue_3 = { weight = { base = 20 } }
# 		education_intrigue_4 = { weight = { base = 15 } }
# 		education_martial_1 = { weight = { base = 8 } }
# 		education_martial_2 = { weight = { base = 12 } }
# 		education_martial_3 = { weight = { base = 20 } }
# 		education_martial_4 = { weight = { base = 15 } }
# 	}
# 	dynasty = none

# 	after_creation = {
# 		# Unfortunately, this method of randomizing the culture doesn't change the ethnicity (dna) of the character
# 		# This is done after creation to allow compatibility
		
# 		if = {
# 			limit = { exists = root.capital_province }
# 			random_geographical_region = {
# 				limit = { root.capital_province = { geographical_region = prev } }
# 				random_county_in_region = {
# 					region = this
# 					random_county_province = {
# 						limit = { is_sea_province = no }
# 						save_temporary_scope_as = origin_province
# 					}
# 				}
# 			}
# 		}
# 		else = { root.location.county = { random_county_province = { save_temporary_scope_as = origin_province } } }

#         E_kCAFG_set_culture_from_province_random = { PROVINCE = scope:origin_province }
#         E_kCAFG_set_faith_from_province_random = { PROVINCE = scope:origin_province }

# 		random_list = {
# 			10 = { add_trait = diplomat 				modifier = { factor = 5 has_education_diplomacy_trigger = yes } }
# 			10 = { add_trait = family_first 			modifier = { factor = 5 has_education_diplomacy_trigger = yes } }
# 			10 = { add_trait = lifestyle_reveler 		modifier = { factor = 5 has_education_diplomacy_trigger = yes } }
# 			10 = { add_trait = gallant					modifier = { factor = 5 has_education_martial_trigger = yes } }
# 			10 = { add_trait = strategist 				modifier = { factor = 5 has_education_martial_trigger = yes } }
# 			10 = {
# 				modifier = { factor = 5 has_education_martial_trigger = yes }
# 				modifier = { factor = 0.2 NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
# 				add_trait = lifestyle_hunter
# 				random_list = {
#                     1 = {
#                         add_random_tiered_trait_track_xp_effect = {
#                             TRAIT = lifestyle_hunter
#                             TRACK = hunter
#                             LEVEL_1 = no
#                             LEVEL_3 = yes
#                         }
                        
#                         add_random_tiered_trait_track_xp_effect = {
#                             TRAIT = lifestyle_hunter
#                             TRACK = falconer
#                             LEVEL_1 = yes
#                             LEVEL_3 = no
#                         }
#                     }
#                     1 = {
#                         add_random_tiered_trait_track_xp_effect = {
#                             TRAIT = lifestyle_hunter
#                             TRACK = falconer
#                             LEVEL_1 = no
#                             LEVEL_3 = yes
#                         }
                        
#                         add_random_tiered_trait_track_xp_effect = {
#                             TRAIT = lifestyle_hunter
#                             TRACK = hunter
#                             LEVEL_1 = yes
#                             LEVEL_3 = no
#                         }
#                     }
#                 }
# 			}
# 			10 = {
# 				modifier = { factor = 5 has_education_martial_trigger = yes }
# 				modifier = { factor = 0.2 NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
# 				add_trait = lifestyle_blademaster
# 				add_random_tiered_trait_xp_effect = {
# 					TRAIT = lifestyle_blademaster
# 					LEVEL_1 = yes
# 					LEVEL_3 = no
#                 }
# 			}
# 			10 = { add_trait = schemer 					modifier = { factor = 5 has_education_intrigue_trigger = yes } }
# 			10 = { add_trait = seducer 					modifier = { factor = 5 has_education_intrigue_trigger = yes } }
# 			10 = { add_trait = administrator 			modifier = { factor = 5 has_education_stewardship_trigger = yes } }
# 			10 = { add_trait = architect 				modifier = { factor = 5 has_education_stewardship_trigger = yes } }
# 			10 = { add_trait = lifestyle_gardener 		modifier = { factor = 5 has_education_stewardship_trigger = yes } }
# 			10 = { add_trait = lifestyle_herbalist 		modifier = { factor = 2.5 has_education_stewardship_trigger = yes } modifier = { factor = 2.5 has_education_learning_trigger = yes } }
# 			10 = { add_trait = scholar 					modifier = { factor = 5 has_education_learning_trigger = yes } }
# 			10 = { add_trait = theologian 				modifier = { factor = 5 has_education_learning_trigger = yes } }
# 			10 = {
# 				modifier = { factor = 5 has_education_learning_trigger = yes }
# 				add_trait = lifestyle_mystic
# 				add_random_tiered_trait_xp_effect = {
# 					TRAIT = lifestyle_mystic
# 					LEVEL_1 = yes
# 					LEVEL_3 = yes
# 				}
# 			}
# 			10 = { add_trait = lifestyle_physician 		modifier = { factor = 5 has_education_learning_trigger = yes } }
# 			10 = {
# 				modifier = { factor = 0.5 NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
# 				add_trait = tourney_participant
# 				random_list = {
#                     10 = {
# 						modifier = { factor = 0.15 NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
# 						add_random_tiered_trait_track_xp_effect = {
# 							TRAIT = tourney_participant
# 							TRACK = foot
# 							LEVEL_1 = yes
# 							LEVEL_3 = yes
# 						}
# 					}
#                     10 = {
# 						modifier = { factor = 0.15 NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
# 						add_random_tiered_trait_track_xp_effect = {
# 							TRAIT = tourney_participant
# 							TRACK = bow
# 							LEVEL_1 = yes
# 							LEVEL_3 = yes
# 						}
# 					}
#                     10 = {
# 						modifier = { factor = 0.15 NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
# 						add_random_tiered_trait_track_xp_effect = {
# 							TRAIT = tourney_participant
# 							TRACK = horse
# 							LEVEL_1 = yes
# 							LEVEL_3 = yes
# 						}
# 					}
#                     10 = {
# 						add_random_tiered_trait_track_xp_effect = {
# 							TRAIT = tourney_participant
# 							TRACK = wit
# 							LEVEL_1 = yes
# 							LEVEL_3 = yes
# 						}
# 					}
# 				}
# 			}
# 			100 = {
# 				modifier = {
# 					factor = 0.25
# 					OR = {
# 						has_diplomacy_lifestyle_trait_trigger = yes
# 						has_martial_lifestyle_trait_trigger = yes
# 						has_stewardship_lifestyle_trait_trigger = yes
# 						has_intrigue_lifestyle_trait_trigger = yes
# 						has_learning_lifestyle_trait_trigger = yes
# 						has_lifestyle_trait = yes
# 					}
# 				}
# 				# Nothing
# 			}
# 		}

#         E_kei_character_creation_nudge_cultural_traits = yes
# 		set_interesting_traits_and_modifiers_effect = yes
# 	}
# }

# 01_fp1_character_templates
old_country_local_warlord_template = {
	age = { 20 40 }
	random_traits = yes
	culture = scope:current_county.title_province.culture
	faith = scope:current_county.title_province.faith
	gender_female_chance = {
		if = {
			limit = {
				scope:current_county.title_province.faith = { has_doctrine = doctrine_gender_male_dominated }
			}
			add = 0
		}
		else_if = {
			limit = {
				scope:current_county.title_province.faith = { has_doctrine = doctrine_gender_female_dominated }
			}
			add = 100
		}
		else = {
			add = 50
		}
	}
	martial = {
		min_template_decent_skill
		max_template_decent_skill
	}
	after_creation = {
		scope:current_county = { random_county_province = { save_temporary_scope_as = origin_province } }
        E_kCAFG_set_culture_from_province_random = { PROVINCE = scope:origin_province }
        E_kCAFG_set_faith_from_province_random = { PROVINCE = scope:origin_province }
	}
}
