# Fires for the player character when the game starts (but not from saves) 
# Also works without Charlemagne DLC.
on_chronicle_start = {
	events = {
		meta.1 # Checksum
	}
}

# Fires for every character at game start (and also when loading from saves)
on_startup = {
	events = {
		# W_racial_events
		racial.1 # Racial trait assignment
		racial.30 # Combat trait initialization
		racial.10 # Fertile elves
		racial.31 # Sorcerer portrait fix
		
		# W_crown_law_events
		crown_laws.1
		crown_laws.2
		crown_laws.3
		
		# W_wilderness_events
		wilderness.2 # Give diplomatic immunity
		
		meta.2 # Save conversion
		meta.3 # Fix independent baronies
	}
}

on_yearly_pulse = {
	events = {
		#Hobbit Party
		halflings.7
		halflings.8
		
		old_age.97 # Prune court for unimportant immortals
	}
	
	random_events = {
		#Hobbit Party
		100 = halflings.0
		20 = halflings.6

		# W_dream_events
		100 = dream.1 # Good Dream
		100 = dream.2 # Battle Dream
		100 = dream.3 # Dagoth Ur Dream
		100 = dream.4 # Temptation dream
		100 = dream.7 # Lucien Lachance Intro Dialogue
		100 = dream.8 # Wet dream
		100 = dream.9 # Dream Recollection
		100 = dream.10 # Wild hunt chases you
		
		# W_druid_events
		100 = druid.204 # Druid is sharing his views with you
		
		# W_health_events
		100 = health.1 # Vassal has to visit sick liege
		100 = health.2 # Sick character can't do duties anymore
		100 = health.10 # Lonely Leper
		100 = health.11 # Religious Leper
		100 = health.12 # Living as a Leper is miserable
		100 = health.20 # Blind character trips down the stairs
		100 = health.21 # Blind character worries
		100 = health.22 # Blind character contemplates blindness
		100 = health.120 # Depressed - Sad
		100 = health.121 # Depressed - Exhausted
		
		
		# W_lovers_events
		100 = lovers.1 # Character can't satisfy lover
		100 = lovers.2 # Character & lover are too chaste
		100 = lovers.3 # Character & lover - why do you love me?
		100 = lovers.4 # Character & lover's display of affections are getting out of hand
		100 = lovers.5 # 2 good people fall in love?
		100 = lovers.7 #  Sunset Sex
		100 = lovers.8 # # Strange sex smell
		100 = lovers.9 # Viagra?
		100 = lovers.10 # Sex fart
		
		# W_misc_events
		100 = misc.1 # Sky admiring
		100 = misc.2 # The Butterfly
		100 = misc.3 # Can't Fall Asleep Quickly
		100 = misc.4 # Ocean peace
		100 = misc.5 # Hammers and Anvils
		100 = misc.20 # Elven ruins
		100 = misc.100 # Don't drink too fast
		100 = misc.101 # I am a water drinker
		100 = misc.102 # Water does not grow in trees
		100 = misc.103 # A lot of pickled eggs
		100 = misc.104 # Loud Fishers
		100 = misc.105 # Druid tree
		100 = misc.106 # Old fort
		100 = misc.107 # The Hourglass
		100 = misc.108 # Overslept
		100 = misc.109 # Diligent servant
		100 = misc.110 # Noontime hijinks
		100 = misc.111 # Lost A Ring
		100 = misc.113 # Sad Courtier
		100 = misc.118 # What was that
		100 = misc.119 # Suffering of others
		100 = misc.121 # Beautiful sunset
		100 = misc.122 # Sunset buddy
		100 = misc.123 # Going meta
		100 = misc.124 # Itchy
		100 = misc.125 # Funny Smell
		100 = misc.126 # Oops, forgot
		100 = misc.127 # Unnecessary thoughts
		100 = misc.128 # Dirty fingernails
		100 = misc.129 # Pleasant day
		100 = misc.132 # Foolish eater
		100 = misc.133 # Nose picker
		100 = misc.134 # Conman selling charms
		100 = misc.140 # Silly Prank
		100 = misc.141 # Fart
		100 = misc.142 # Courtier dislikes my favorite book
		100 = misc.143 # What genre is my life
		100 = misc.144 # Head tilt fad
		100 = misc.145 # Tongue biting
		100 = misc.146 # Lover plotting to murder me?
		100 = misc.147 # Lazy courtier
		100 = misc.148 # Despair
		100 = misc.149 # Nice boat - don't lose your head!
		
		# W_monster_events
		100 = monster.50 # Garlic against vampires
		
		# W_religious_events
		100 = religious.10 # Church Prayer
		
		# W_republic_events
		100 = republic.1 # Pickpocket!
		100 = republic.2 # Ruined clothes
		
		# W_rumours_events
		10 = rumours.1 # Any courtier - Suspect a courtier being a Scoiatael supporter
		10 = rumours.5 # Ruler - Suspect a courtier being a Scoiatael supporter
		10 = rumours.10 # Incompetence at work - Court Mage
		
		# W_trait_events
		100 = trait_flavour.1 # Slothful - Don't Like Working
		100 = trait_flavour.2 # Diligent - feel asleep working last night
		100 = trait_flavour.3 # Greedy - coin purse on the ground during Summer Fair
		100 = trait_flavour.4 # Charitable - Beggar Girl
		100 = trait_flavour.5 # Content - Fine with illness or disability
		100 = trait_flavour.6 # Ambitious - Ruler wants to improve image
		100 = trait_flavour.7 # Arbitrary - Silence after arbitrary sentencing
		100 = trait_flavour.8 # Just - Peasants love it
		100 = trait_flavour.9 # Wroth - anger means none dare cross
		100 = trait_flavour.10 # Patient - Listening to the opinions of others
		100 = trait_flavour.11 # Envious - Why is everyone better than me?
		100 = trait_flavour.12 # Kind - Help a recently deceased impoverished noble's orphaned child
		100 = trait_flavour.13 # Craven - foolish while sparring
		100 = trait_flavour.14 # Brave - defeated bandit
		100 = trait_flavour.15 #Humble - character learns from a peasant
		100 = trait_flavour.16 # Lustful - Ugly Wench
		100 = trait_flavour.17 # Chaste - Pretty young maiden
		100 = trait_flavour.18 # Temperate - some people say character doesn't enjoy life enough
		100 = trait_flavour.19 # Paranoid - character thinks he/she just saw an assassin
		100 = trait_flavour.20 # Trusting - character got pranked by a courtier
		100 = trait_flavour.21 # Deceitful - Never show true self
		100 = trait_flavour.22 # Honest - character meets an incompetent merchant
		100 = trait_flavour.23 # Cruel - subjects fear character
	}
}

on_bi_yearly_pulse = {
	random_events = {
		# W_court_events
		10 = court.1 # Drinking contest
		10 = court.4 # Drunk courtier interrupts court
		10 = court.10 # Innocent man executed
		10 = court.11 # Annoying courtier
		
		# W_lovers_events
		10 = lovers.6 # Remembering great time with lover
		
		# W_misc_events
		10 = misc.6 # First love
		10 = misc.8 # Old Hunting grounds
		10 = misc.9 # Old childhood friend - merchant
		
		# W_old_age_events
		10 = old_age.10 # Hunting in old age
		10 = old_age.11 # Character complains about youth
		10 = old_age.12 # Character worrying about the afterlife
		10 = old_age.13 # Character feels weaker and weaker as they get older and older
		10 = old_age.14 # Old age is sad
		
		# W_republic_events
		10 = republic.3 # Grounded Ship
		10 = republic.4 # Character's associate gone bankrupt, asks for money
		10 = republic.7 # Character misjudged prices
		10 = republic.8 # Bad associate
		10 = republic.9 # Minor family vendetta
		
		# W_trait_events
		10 = trait_flavour.100 # Dwarf kills man in tavern brawl
		10 = trait_flavour.200 # Alchemist flavor events - Increase fertility
		10 = trait_flavour.210 # Alchemist flavor events - Increase health
		10 = trait_flavour.220 # Alchemist flavor events - Gathering ingredients
		10 = trait_flavour.230 # Alchemist flavor events - Making friends with witcher
		10 = trait_flavour.240 # Alchemist flavor events - Explosions, fires and odor
	}
}

on_five_year_pulse = {
	events = {
		# W_magic_events
		magic.1063 # Create random sorcerer
		magic.1064 # Create random apprentice
		
		old_age.8 # Menopause
	}
	random_events = {
		# W_battle_events
		100 = battle.100 # Commander deals with soldiers accused of rape
		50 = battle.101 # Commander deals homosexual sergeant
		50 = battle.102 # Commander deals with old mounts for knights
		100 = battle.103 # Commander deals with deserters
		80 = battle.104 # Camp struck by disease
		80 = battle.105 # Provisions gone bad
		80 = battle.106 # Camp riot
		80 = battle.107 # Fire in the camp
		25 = battle.108 # Reinforcements
		
		# W_job_events
		10 = job.100 # Chancellor deals with petitioners
		10 = job.101 # Chancellor deals with a diplomatic incident
		10 = job.102 # Chancellor deals with a foreign envoy
		10 = job.103 # Chancellor deals with a scandal
		10 = job.104 # Chancellor deals with a foreign envoy bringing gifts
		10 = job.105 # Chancellor deals with a diplomatic insult
		10 = job.110 # Chaplain deals with a philosophical book
		10 = job.111 # Chaplain deals with heretic talks
		10 = job.112 # Chaplain deals with a woman accused of being witch
		10 = job.113 # Chaplain deals with a sexual scandal 
		10 = job.120 # Steward deals with the interests on the realm's debts
		10 = job.121 # Steward deals with ineffective policies
		10 = job.122 # Steward deals with the need of money during wartime
		10 = job.123 # Steward deals with dwarven bankers in the realm
		10 = job.124 # Steward deals with foreign merchants
		10 = job.125 # Steward deals with liege spending too much
		10 = job.130 # Marshal deals with badly disciplined soldiers
		10 = job.131 # Marshal deals with poorly equipped soldiers
		10 = job.140 # Spymaster deals with a foreign spy
		10 = job.141 # Spymaster deals with street informants about liege assassination plans
		10 = job.142 # Spymaster deals with hiding a scandal
		10 = job.143 # Spymaster deals with unfaithful liege's spouse
		10 = job.144 # The spymaster's interests clash with the church's
		10 = job.145 # Spymaster deals with a turncloak foreign spy
		10 = job.150 # Councillor deals with a death menace
		10 = job.151 # Councillor deals with the liege's concerns on his policies
		10 = job.152 # Councillor quarrels with liege
		10 = job.153 # Councillor deals with insults in the streets
		
		# W_monster_events
		10 = monster.60 # Mermaid
		
		# W_miec_events
		10 = misc.114 # Beggar corpse on the road
		10 = misc.120 # Watch sunset/sunrise
		10 = misc.130 # Supernatural happenings
		10 = misc.131 # Mysterious vanishing village
		10 = misc.135 # Three wenches
		10 = misc.138 # Pretty barmaid
		
		# W_personality_events
		10 = personality.10 # Racist/tolerant
		
		# W_trait_events
		10 = trait_flavour.50 # Lustful turning to hedonist
		10 = trait_flavour.51 # Lustful turning to chaste
		10 = trait_flavour.52 # Chaste turning to celibate
	}
}

on_decade_pulse = {
	events = {
		# W_ambition_events
		ambition.50 # Improve martial by 1
		ambition.51 # Improve stewardship by 1
		ambition.52 # Improve learning by 1
		ambition.53 # Improve diplomacy by 1
		ambition.54 # Improve intrigue by 1
	}
}

# For characters 2 to 15 years old
on_yearly_childhood_pulse = {
	events = {
		# W_childhood_events
		# childhood.200 # Need education
	}
	random_events = {
		10 = childhood.1 # Character not being fed
		20 = childhood.2 # Character hurt self while playing
		20 = childhood.3 # Character curious about something
		20 = childhood.4 # Character at feast
		20 = childhood.5 # Rock and Roll Event Chain
		10 = childhood.9 # Character learning baby talk
		10 = childhood.10 # Character learning prayers
		20 = childhood.11 # Meek child considers confessing love to another child
		10 = childhood.12 # Vomit
		20 = childhood.14 # # Why sky is colorful
		35 = childhood.20 # Diplomacy gain
		35 = childhood.22 # Stewardship gain
		35 = childhood.24 # Intrigue gain
		35 = childhood.26 # Learning gain
		
		100 = childhood.100 # Dangers of magic
		50 = childhood.110 # Places of Power
		100 = childhood.120 # Magic book
		
		# W_magic_events
		150 = magic.10 # Magic outburst
		150 = magic.11 # Child notices his talents and inform guardian
		
		# W_personality_events
		100 = personality.1 # Racist
		100 = personality.4 # Tolerant
	}	
}

on_combat_pulse = {
	random_events = {
		# W_battle_events
		5 = battle.1 # Become Veteran
		10 = battle.10 # Skyrim Bandits always say they yield but they never do
		10 = battle.11 # Captured Enemy Scouts
		10 = battle.12 # Advice to young squire
		10 = battle.13 # Soldier sacrifices self
		10 = battle.14 # Dodge enemy just in the nick of time
		10 = battle.15 # Praying in the middle of battle
		10 = battle.16 # Praying for a dying soldier
	}
}

on_siege_pulse = {
	events = {
		aok.3 # Foltest offer Arjan to surrender
	}
	random_events = {
		# W_siege_events
		75 = siege.1 # Taunt the enemy commander - attacker
		75 = siege.10 # Inspirational speech raises troop morale -defender
		75 = siege.12 # Inspirational speech raises troop morale -attacker
		75 = siege.20 # Soldiers desert -defender
		75 = siege.22 # Soldiers desert -attacker
		75 = siege.30 # Raid the camp during night - defender
		75 = siege.40 # Your camp have attracted all manner of rabble - mercenaries, looter, prostitutes and merchants in hopes to earn something - attacker
		75 = siege.50 # Peasants join the defenders bolstering their ranks - defender
		75 = siege.60 # Catapults and ballistas -attacker
		75 = siege.70 # Scouting party - defenders
	}
}

# any leader in battle on winning side is ROOT - opponent army leader is FROM
on_battle_won = {
	random_events = {
		# W_graveirbattlefield_events
		10 = graveirbattlefield.0 # Graveir
	}
}

# Any leader in battle on losing side is ROOT - opponent army leader is FROM
on_battle_lost = {
	random_events = {
		# W_graveirbattlefield_events
		10 = graveirbattlefield.0 # Graveir
	}
}

# The taken Holding title is in FROM.
on_siege_won_leader = {
	events = {
		# W_AoK_events
		aok.5 # Foltest wins the siege of La Valette
		
		# W_haak_events
		haak.20 # Others - Haaks sack Nilfgaard
	}
	random_events = {
		# W_siege_events
		100 = siege.100 # Troops raping and pillaging 
		100 = siege.110 # Troops are looting everything of value
		100 = siege.150 # A priest is holding sermon for the fallen
	}
}

# Fires for the owner of the winning unit (ROOT). The taken Holding title is in FROM.
on_siege_over_winner = {
	events = {
		# W_rebels_events
		rebel.12
	}
}

on_birth = {
	events = {
		# W_prisoner_events
		prisoner.8 # Child is born because of rape
		
		# W_racial_events
		racial.1 # Racial trait assignment
		racial.12 # Elven fertility reduction per birth
		
		# W_magic_events
		magic.1 # Get dormant magic talent
	}
}

on_adulthood = {
	events = {
		# W_childhood_events
		# Without Conclave
		#childhood.220 # Received court education
		#childhood.221 # Received steward education
		#childhood.222 # Received martial education
		#childhood.223 # Received no education
		# With Conclave
		childhood.250 # Received polymath education
		
		# W_magic_events
		magic.90 # Become sorcerer
		magic.93 # Learned to control talent
		magic.96 # Didn't learn enough
		
		old_age.90 # Workaround adult portrait for long lived races
	}
}

#character (at 2 months)
on_pregnancy = {
	events = {
		# W_prisoner_events
 		prisoner.5 # Pregnancy because of rape
	}
}

# Sent to employers of both spouses - ROOT is employer. FROM is employers "employee". new_character is the other spouse.
on_marriage = {
	events = {
		# W_racial_events
		racial.4 # If normal marriage run event 500
	}
}

on_death = {
	events = {
		# W_druid_events
		druid.2 # Make temple barony heir nature religion character
		
		# W_magic_events
		magic.1060 # Faux Aretuza election
		magic.1061 # Faux Ban Ard Academy election
		magic.1062 # Faux Nilfgaard Academy election
		
		# W_tournament_events
		tournament.12 # You have died, the competition is over
		
		# W_wilderness_events
		wilderness.100 # Give tower to wilderness
		
		old_age.99 # logging
	}
}

on_loot_settlement = {
	random_events = {
		# W_battle_events
		35 = battle.2 # Become Raider
	}
}

# When rebels appear
on_rebel_revolt = {
	events = {
		# W_rebel_events
		rebel.1 # Main rebel selection and processing event
	}
}

# ROOT is the creating character
# FROM is the title
on_create_title = {
	events = {
		# Vassal kingdom CoAs 
		nilfgaard.151
		nilfgaard.152
	}
}

# ROOT is the character, FROM is the title, FROMFROM is the old holder
on_new_holder = {
	events = {
		# W_realm_events
		realm.51 # Name the new commander of Drakenborg
		
		# W_nilfgaard_events
		nilfgaard.1 # Imperial Authority evaluation
		nilfgaard.151 # Vassal kingdom CoAs
		nilfgaard.152 # Vassal kingdom CoAs
	}
}

# ROOT is the character, FROM is the title, FROMFROM is the old holder
on_new_holder_inheritance = {
	events = {
		# W_realm_events
		realm.51 # Name the new commander of Drakenborg
		
		old_age.98 # Prevent immortal courtier pruning
		
		# W_nilfgaard_events
		nilfgaard.1 # Imperial Authority evaluation
		nilfgaard.151 # Vassal kingdom CoAs
		nilfgaard.152 # Vassal kingdom CoAs
	}
}

# ROOT is the character, FROM is the title, FROMFROM is the old holder
on_new_holder_usurpation = {
	events = {
		# W_realm_events
		realm.51 # Name the new commander of Drakenborg
		
		old_age.98 # Prevent immortal courtier pruning
		
		# W_nilfgaard_events
		nilfgaard.6 # Imperial Authority reduction because of succession through usurpation
		nilfgaard.151 # Vassal kingdom CoAs
		nilfgaard.152 # Vassal kingdom CoAs
	}
}

# From = Attacker, Root = Defender
on_war_ended_victory = {
	events = {
		aok.6
		
		# Vassal kingdom CoAs 
		nilfgaard.150
		nilfgaard.153
	}
}

# From = Attacker, Root = Defender
on_war_ended_whitepeace = {
	events = {
		aok.6
	}
}

# From = Attacker, Root = Defender
on_war_ended_defeat = {
	events = {
		aok.6
	}
}

on_law_vote_passed = {
	events = {
		# W_crown_law_events
		crown_laws.4
	}
}