child_personality_gain = {
	trigger = {
		is_adult = no
		number_of_personality_traits < personality_trait_limit
	}
	random_events = {
		100 = child_personality.0001
		100 = child_personality.0002
		100 = child_personality.0003
		100 = child_personality.0004
		100 = child_personality.0005
		300 = child_personality.0006 #Weighted x3 because it can only be triggered as the 3rd and final personality event
		100 = child_personality.0007
		300 = child_personality.0008 #Weighted x3 because it can only be triggered as the 3rd and final personality event
		100 = child_personality.0009
		100 = child_personality.0010
		100 = child_personality.0011
		100 = child_personality.0012

		#In prison
		100 = child_personality.0021 ##Gain lustful
		100 = child_personality.0022 ##Gain chaste
		100 = child_personality.0023 ##Gain gluttonous
		100 = child_personality.0024 ##Gain temperate
		100 = child_personality.0025 ##Gain greedy
		50 = child_personality.0026 ##Gain generous
		100 = child_personality.0027 ##Gain lazy
		100 = child_personality.0028 ##Gain diligent
		100 = child_personality.0029 ##Gain wrathful
		100 = child_personality.0030 ##Gain calm
		100 = child_personality.0031 ##Gain patient
		100 = child_personality.0032 ##Gain impatient
		100 = child_personality.0033 ##Gain arrogant
		100 = child_personality.0034 ##Gain humble
		100 = child_personality.0035 ##Gain deceitful
		50 = child_personality.0036 ##Gain honest
		100 = child_personality.0037 ##Gain craven
		100 = child_personality.0038 ##Gain brave
		100 = child_personality.0039 ##Gain shy
		100 = child_personality.0040 ##Gain gregarious
		100 = child_personality.0041 ##Gain ambitious
		100 = child_personality.0042 ##Gain content
		100 = child_personality.0043 ##Gain arbitrary
		100 = child_personality.0044 ##Gain just
		100 = child_personality.0045 ##Gain cynical
		100 = child_personality.0046 ##Gain zealous
		100 = child_personality.0047 ##Gain paranoid
		50 = child_personality.0048 ##Gain trusting
		50 = child_personality.0049 ##Gain compassionate
		100 = child_personality.0050 ##Gain callous
		100 = child_personality.0051 ##Gain sadistic
		100 = child_personality.0052 ##Gain stubborn
		100 = child_personality.0053 ##Gain fickle
		100 = child_personality.0054 ##Gain vengeful
		50 = child_personality.0055 ##Gain forgiving
	}
}

childhood_ongoing = {
	random_events = {
		400 = 0
		100 = childhood.0001 #Child gets a crush
		50 = childhood.0003 #Child gets a bully
		100 = childhood.0005 #Child gets a friend
		50 = childhood.0007 #Child gets a victim
		50 = childhood.1000 #Your friendship can turn into a crush
		50 = childhood.1001 #You make your bully stop being such a bully
		50 = childhood.1002 #Parent is your educator, "supportive_parent" opinion_modifier
		50 = childhood.1004 #Guardian parent reduces stress
		50 = childhood.1005 #Guardian parent gives stress
		50 = childhood.1006 #Guardian parent (diligent) gives stress to lazy child
		50 = childhood.1007 #Bully gives you stress
		50 = childhood.1008 #To have a victim while malicious reduces stress
		50 = childhood.1009 #Your friend reduces your stress
		50 = childhood.1010 #Crush gives/reduces stress
		50 = childhood.1011 #Child might return an existing crush
		50 = childhood.1012 #Cruel guardian parent take child's toy away
		50 = childhood.1013 #You destroy your victims toy
		50 = childhood.1015 #child studies diplomacy with friend/crush
		50 = childhood.1016 #child studies martial with friend/crush
		50 = childhood.1017 #child studies stewardship with friend/crush
		50 = childhood.1018 #child studies intrigue with friend/crush
		50 = childhood.1019 #child studies learning with friend/crush
		25 = childhood.2001 #Get a pet cat!
		25 = childhood.2003 #Get a pet dog!
		50 = child_personality.0061 # Child may gain a propensity to drinking and lose their shyness by watching their guardian
	}
}

on_3rd_birthday = {
	trigger = { age = 3 }

	events = {
		child_personality.3000 #Randomizes a childhood personality
		birth.3033 #lose the trait sickly
	}
}

on_6th_birthday = {
	trigger = { age = 6 }

	events = {
		childhood_education.9001 #Assigns the education corresponding to their trait
	}
}

on_10th_birthday = {
	trigger = { age = 10 }

	events = {
		child_personality.4000 #Assigns a sexuality to the child
	}
}

on_15th_birthday = {
	trigger = { age = 15 }

	events = {
		witch.1001
	}
}

on_16th_birthday = {
	trigger = { age = 16 }

	events = {
		childhood_education.9103 #To make sure that every child gets a education
		child_personality.4011 #To make sure everyone gets a sexuality
		childhood.0900#victim transforms into opinion modifier on adulthood
		childhood.0910#bully transforms into opinion modifier on adulthood
		childhood.0998#crush transforms into opinion modifier on adulthood
		coming_of_age.0001#Learning
		coming_of_age.0002#Stewardship
		coming_of_age.0003#Martial
		coming_of_age.0004#Intrigue
		coming_of_age.0005#Diplomacy
		mgr.1 #Game rule: Reveal secret bastard
		delay = { days = 1 }
		childhood_education.0005 #To remove education focus
	}
}

#To make sure everyone, including character from history, gets a sexuality
on_action_add_sexuality = {
	trigger = { age >= 10 }

	events = {
		delay = { days = { 14 30 } }
		child_personality.4000 #To make sure everyone gets a sexuality
	}
}

on_birthday_education_events = {
	trigger = {
		is_adult = no
		age >= childhood_education_start_age
	}

	events = {
		court_maintenance.0003 #All children should acquire Personality Traits
		court_maintenance.0004 #Fire Childhood events for children
	}
	
	on_actions = {
		childhood_education_boost
		childhood_education
	}
}

#To check if character needs education boost or not
childhood_education_boost = {
	trigger = {
		NOT = { has_character_flag = natural_education_progression }
		NOT = { age = 16 } # Already fired in 'on_16th_birthday' on_action
		has_education_focus_trigger = yes
	}
	events = {
		childhood_education.9103 # Education catchup
	}
}

#To gain education points
childhood_education = {
	trigger = {
		is_adult = no
		age >= childhood_education_start_age
	}

	events = {
		childhood_education.9002
		childhood_education.1001
		childhood_education.9004
	}
	on_actions = {
		childhood_education_patronage
	}
}

#Patronage-focused / scholarly spouse may adds points
childhood_education_patronage = {
	trigger = {
		exists = host.cp:councillor_spouse
		host.cp:councillor_spouse = { save_temporary_scope_as = councillor }
		spouse_learning_tier_1_trigger = yes
		has_education_focus_trigger = yes
		trigger_if = {
			limit = {
				has_variable = patronage_spouse_tutor
			}
			var:patronage_spouse_tutor = scope:councillor
		}
	}
	events = {
		childhood_education.9003
	}
}
