#character
on_startup = {
	events = {
		maintenance.400 # Clean up government traits
		maintenance.450 # Default to Absolute Cognatic, not Agantic. It's the future.
		maintenace.16 # Princes and princesses
		
		# Initial construction capabilities
		maintenance.100
		maintenance.101
		maintenance.102
		maintenance.103
		startup.2
	}
}

#character
on_yearly_pulse = {
	random_events = {
		# Crisis Stuff
		# Implant beta tests
		100 = cybernetics.10100
		100 = cybernetics.10200
		100 = cybernetics.10300
		100 = cybernetics.10400
		100 = cybernetics.10500
		
		#Job Flavour Events
		100 = 75020
		100 = 75030
		100 = 75060
		100 = 75065
		100 = 75070
		100 = 75075
		100 = 75080
		100 = 75085
		100 = 75090
		100 = 75095
		100 = 75105
		100 = 75120

		#Dynasty requests
		250 = 66000
		250 = 66050
		250 = 66100
		
		#Bastard Events
		100 = 76000
		100 = 76005
		100 = 76010
		100 = 76015
		100 = 76020
		100 = 76025
		100 = 76030
		100 = 76035
		100 = 76040
		
		#Ward Events
		100 = 78000
		100 = 78005
		100 = 78010
		100 = 78015
		100 = 78020
		100 = 78025
		100 = 78030
		
		#Various Events
		# 100 = TOG.3403
		# 100 = TOG.3401
		# 100 = TOG.3402
		
		5000 = 0 # Chance of no yearly event
	}
	events = { maintenance.900 } # Update the senate yearly
}


#character
on_bi_yearly_pulse = {
	random_events = {

		#Various Traits Events
		10 = 65000
		10 = 65001
		10 = 65003
		10 = 65005
		10 = 65007
		10 = 65009
		10 = 65166
		10 = 65011
		10 = 65020
		10 = 65021
		10 = 65022
		10 = 65023
		10 = 65030
		10 = 65031
		10 = 65032
		10 = 65033
		10 = 65034
		10 = 65035
		10 = 65036
		10 = 65037
		10 = 65040
		10 = 65041
		10 = 65042
		10 = 65043
		10 = 65165
		10 = 65044
		10 = 65045
		10 = 65048
		10 = 65049
		10 = 65050
		10 = 65051
		10 = 65052
		10 = 65053
		10 = 65055
		10 = 65057
		10 = 65060
		10 = 65061
		10 = 65065
		10 = 65070
		10 = 65071
		10 = 65072
		10 = 65074
		10 = 65080
		10 = 65081
		10 = 65085
		10 = 65090
		10 = 65095
		10 = 65100
		10 = 65101
		10 = 65102
		10 = 65105
		10 = 65106
		10 = 65107
		10 = 65110
		10 = 65115
		10 = 65120
		10 = 65125
		10 = 65126
		10 = 65130
		10 = 65135
		10 = 65140
		10 = 65145
		10 = 65150
		10 = 65155
		10 = 65160

		#Lifestyle events
		10 = 3520
		10 = 3525
		10 = 3530
		10 = 3535
		10 = 3540
		10 = 3543
		10 = 3546
		10 = 3550
		10 = 3555
		10 = 3560
		10 = 3563
		10 = 3568
		10 = 3570
		10 = 3575
		10 = 3585
		10 = 3590
		10 = 3593
		10 = 3600
		10 = 3605
		10 = 3610
		10 = 3615
		10 = 3620
		10 = 3625
		10 = 3630
		10 = 3635
		10 = 3640
		10 = 3645
		10 = 3650
		10 = 3655
		10 = 3660
		10 = 3665
		10 = 3675
		10 = 3680
		10 = 3685
		10 = 3690
		10 = 3700
		
		2000 = 0 # Chance of no bi-yearly event
	}
}

#character
on_five_year_pulse = {
	random_events = {
		#----  misc traits needing revision below...

		
		
		#Brave
		10 = 3320
		10 = 3325
		10 = 3330
		10 = 3335
		10 = 3740
		
		#Shy
		10 = 3340
		10 = 3345
		10 = 3350
		10 = 3355
		
		#Ambitious
		10 = 3360
		10 = 3365
		10 = 3370
		10 = 3375
		10 = 3371
		
		#Content
		10 = 3380
		10 = 3385
		10 = 3390
		10 = 3395
		10 = 3745
		
		#Arbitrary
		10 = 3400
		10 = 3405
		10 = 3410
		10 = 3415
		10 = 3411
		
		#Just
		10 = 3420
		10 = 3425
		10 = 3430
		10 = 3435
		
		#Cynical
		10 = 3440
		10 = 3445
		10 = 3450
		10 = 3455	
		10 = 3456		
		
		#Zealous
		10 = 3460
		10 = 3465
		10 = 3470
		10 = 3475
		10 = 3476
		10 = 3750
		10 = 3755

		#Trusting
		10 = 3500
		10 = 3505
		10 = 3510
		10 = 3515
		
		#Personality Traits
		10 = 1000
		10 = 1001
		10 = 1002
		10 = 1003
		10 = 1004
		10 = 1005
		10 = 1006
		10 = 1007
		10 = 1008
		10 = 1009
		10 = 1010
		10 = 1011
		10 = 1012
		10 = 1013
		10 = 1014
		10 = 1015
		10 = 1016
		10 = 1017
		10 = 1018
		10 = 1019
		10 = 1028
		10 = 1029
		10 = 1030
		10 = 1031
		10 = 1032
		10 = 1033
		10 = 1034
		10 = 1035
		10 = 1036
		10 = 1037
		10 = 1038
		10 = 1039
		10 = 1040
		10 = 1041
		10 = 1042
		10 = 1043
		10 = 1044
		10 = 1045
		10 = 1046
		10 = 1047
		10 = 1048
		10 = 1049
		10 = 1050
		10 = 1051
		10 = 1052
		10 = 1053
		10 = 1054
		10 = 1057
		10 = 1058
		10 = 1060
		10 = 1070
		10 = 3264
		10 = 3730
		10 = 3735
		
		40 = 0
	}
	events = { maintenance.200 } # Balance out overpopulated and underpopulated courts
}

#character
on_decade_pulse = {

}

# For characters 2 to 16 years old
on_yearly_childhood_pulse = {
	random_events = {
		# Childhood Personality Events

		# 6 - 12: Personality-forming events
		100 = childhood_education.10 # Curious
		100 = childhood_education.20 # Cautious
		100 = childhood_education.30 # Disciplined
		100 = childhood_education.40 # Carefree
		100 = childhood_education.50 # Extroverted
		100 = childhood_education.60 # Introverted
		100 = childhood_education.70 # Friendly
		100 = childhood_education.80 # Cold
		100 = childhood_education.90 # Spiritual
		100 = childhood_education.100 # Skeptical
		100 = childhood_education.110 # Radical
		100 = childhood_education.120 # Pragmatic
		100 = childhood_education.130 # Humble
		100 = childhood_education.140 # Proud
		100 = childhood_education.150 # Content
		100 = childhood_education.160 # Ambitious
		100 = childhood_education.170 # Brave
		100 = childhood_education.180 # Craven
		
		# Conversions
		50 = childhood_education.200
		50 = childhood_education.300
		
		1500 = 0
	}
}

# Yearly pulse (six months from on_yearly_pulse) intended for Focus events (only fires for characters with a Focus)
# DISABLED FOR NOW
on_focus_pulse = {
}

#on combat pulse
on_combat_pulse = {
	random_events = {
		3000 = 0
		100 = battle.0
		50 = battle.2
		25 = battle.4
		
		100 = battle.10
		50 = battle.12
		25 = battle.14
		
		100 = battle.20
		50 = battle.22
		25 = battle.24
		
		50 = battle.30
		25 = battle.32
		12 = battle.34
		
		20 = 96500 # Gain Combat Trait 1
		20 = 96501 # Gain Combat Trait 2
		20 = 96502 # Gain Combat Trait 3
		
		50 = battle.100 # Shell-shock
		
		300 = assassination.300 # Mid-combat backstab!
		350 = assassination.350 # Alternative mid-combat backstab!
		
		300 = cybernetics.10203 # Odin Glitch results in self-inflicted wound
		300 = cybernetics.10204 # Odin Glitch results in friendly fire
		300 = cybernetics.10206 # Odin Glitch results in sudden success!
	}
	events = {
		coup.120 # Civil war defections
	}
}

#on siege pulse
on_siege_pulse = {
	random_events = {
		200000 = 0
		75 = 62000
		75 = 62001
		75 = 62003
		75 = 62004
		75 = 62005
		75 = 62006
		75 = 62007
		75 = 62008
		75 = 62009
		75 = 62010
		25 = 62014
		75 = 62015
		15 = 62011	
		15 = 62012
		15 = 62013
	}
	events = { coup.140 } # Defense commander defects
}

#character
on_battle_won = {
	random_events = {
		800 = 0
		10 = 260 # Heroism shown
		10 = 261 # Soldier Distinguish himself.
		100 = 8310 # Crusader becomes zealous
	}
}

# any leader in battle on winning side is ROOT - opponent army leader is FROM
on_major_battle_won = {
	events = {
		CM.10029 # Chronicle
	}
}


on_battle_won_leader = {

}

# Winning army leader is ROOT - opponent army leader is FROM
on_major_battle_won_leader = {
	events = {
		CM.10031
	}
}

# Winning army owner is ROOT - opponent army owner is FROM
on_battle_won_owner = {
}

#character
on_battle_lost = {
	random_events = {
		900 = 0
		50 = 250 # Imprisoned by the enemy
		50 = 8320 # Crusader becomes cynical
	}
}

# Any leader in battle on losing side is ROOT - opponent army leader is FROM
on_major_battle_lost = {
	events = {
		CM.10030 # Chronicle
	}
}

on_battle_lost_leader = {

}

# Losing army leader ROOT - opponent army leader is FROM
on_major_battle_lost_leader = {
	events = {
		CM.10032
	}
}

# Losing army owner is ROOT - opponent army owner is FROM
on_battle_lost_owner = {
	events = {
		HL.180 # Check raiding adventurer defeat
	}
}

on_siege_won_leader = {
	events = {
		8330 # Conquers the crusade target
		invasion.100 # Ordered an orbital bombardment
	}
	random_events = {
	}
}

on_siege_lost_leader = {
	events = {
		8350 # Loses the crusade target's capital
	}
}

# Fires for the owner of the winning unit (ROOT). The taken Holding title is in FROM.
on_siege_over_winner = {
	events = {
		#TOG.1005 # Peasants take county capital
		#TOG.1025 # Heretics take county capital
		#TOG.1045 # Nationalists take county capital
	}
}

# Fires for all characters presumed to be in the Holding at the time. Siege winner unit owner in the 'new_character' scope, lost holding title in FROM, local character in ROOT.
on_siege_over_loc_chars = {
	random_events = {
 		1000 = 0 # Nothing happens
 		#400 = SSI.61 # Aztec sacrifice
 		100 = 62100 # Character imprisoned
 	}
}

#character
on_failed_assassination = {
	random_events = {
 		85 = 156 # No harm done
 		10 = 157 # Wounded
 		5 = 158 # Maimed
 	}
}

#character
on_failed_assassination_disc = {
	random_events = {
 		85 = 159 # No harm done
 		10 = 160 # Wounded
 		5 = 161 # Maimed
 	}
}

#character
on_assassination = {
	events = {
 		162
 	}
}

#character
on_assassination_disc = {
	events = {
 		163
 	}
}

# character
on_birth = {
	events = {
		bastard.100 # A bastard is born
		bastard.101 # Cuckoo bastard born, alleged father not fooled
		312 # The child of a consort is born		
		318 # A Bastard is born, but is not recognized as such by the mother's spouse (cuckoo!)
		##TOG.3206 # Child Perceived to be Demon Born
		maintenance.5 # Yoruba twin names
	}
	random_events = {
		#200 = 0
		#1 = RoI.10000 # Reincarnation?
	}
}

# character
on_adulthood = {
	events = {
		#SoA.3020 # Demon child's true nature asserts itself
	}
}

# baby scope
on_post_birth = {
	events = {
		#313 # Possible complications for the mother and child
		#314 # Possible complications for the mother after stillbirth
	}
}

#character (at 2 months)
on_pregnancy = {
	events = {
 		400 # Pregnancy in matrimony
 		401 # Pregnancy out of wedlock
 		402 # Pregnancy in matrimony, with another father!
 		410 # Pregnancy as consort
 		412 # Pregnancy as consort, with another father!		
 	}
}

#character
on_crusade_creation = {
	events = {
 		200 # religious_group Crusade against transhumanist_group
 		201 # religious_group Crusade against outlaw_group
 		321 # religious_group Crusade against Heretics
 		320 # transhumanist_group Jihad against religious_group
 		322 # transhumanist_group Jihad against outlaw_group
 		323 # transhumanist_group Jihad against Heretics
 		324 # outlaw_group Holy War against religious_group
 		325 # outlaw_group Holy War against transhumanist_group
 		326 # outlaw_group Holy War against other outlaw_group
 	}
}

# Character. 
on_marriage = {
	events = {
 		500 # Royal Marriage Aid Duty
 		501 # bio_directionist marriage
 	}
}

#character. Triggers when someone gets imprisoned for any reason. - ROOT is prisoner, FROM is imprisoner
on_become_imprisoned_any_reason = {
	events = {
		HL.190
	}
}

#character. Triggers if someone tries to imprison someone landed and fails. This leads to an automatic war declaration(independece)
on_avoided_imprison_started_war = {
	events = {
 		150 # Avoided imprison, declared independece
 	}
}

#character. Triggers if someone becomes imprisoned by the diplo-action
on_became_imprisoned = {
	events = {
 		151 # Was imprisoned
 	}
}

#character. Triggers if someone tries to imprison someone unlanded and fails. Character is exiled to another country
on_avoided_imprison_fled_country = {
	events = {
 		152
 	}
}

#character. Triggers if someone is released from prison
on_released_from_prison = {
	events = {
 		153
 	}
}

#character. Triggers if someone is executed
on_executed = {
	events = {
 		154
 	}
}

#character. Triggers if someone is exiled
on_exiled = {
	events = {
 		155
 	}
}

#character. Fires every month for characters who are preparing an invasion.
on_prepared_invasion_monthly = {
	random_events = {
		15 = 0
		15 = 62322 	# A small force flocks to your banner
		15 = 62320 	# A significant force flocks to your banner
		2 = 62321 	# A Hero joins your cause with his retinue
	}
}

#character. Fires if a prepared invasion becomes invalid.
on_prepared_invasion_aborts = {
	events = {
		62300 # Handle abort
	}
}

#character. Fires if a prepared invasion expires.
on_prepared_invasion_expires = {
	events = {
		62310 # Handle expiration
	}
}

on_death = {
	events = {
#		8250
		650
		24500
		24502
		70041
		
		# CotC events
		nepotism.0 # Automatically hands all appointed titles to the expected successor
		nepotism.1
		laws.155 # Use a dummy character to handle patrician inheritance if necessary
		#laws.156
		maintenance.200 # Get rid of extra coup flags
	}
	random_events = {
		10 = 24505
		10 = 24510
		100 = 0
	}
}

on_merc_rampage = {
	events = {
 		38050
 	}
}

on_merc_leave = {
	events = {
 		38051
 	}
}

on_merc_turn_coat_from = {
	events = {
 		38052
 	}
}

on_merc_turn_coat_to = {
	events = {
 		38053
 	}
}

on_holy_order_leave = {
	events = {
 		38054
 	}
}

#Note: Unsynchronised, this message should not execute an event which changes the gamestate to prevent out of sync
on_letter_event_message = {
	events = {
		1
	}
}

#Note: Unsynchronised, this message should not execute an event which changes the gamestate to prevent out of sync
on_character_event_message = {
	events = {
		2
	}
}

on_loot_settlement = {
	random_events = {
		# 5 = TOG.3300
		# 5 = TOG.3301
		# 5 = TOG.3302
		# 5 = TOG.3303
		# 35 = TOG.3320
		250 = 0
	}
}

# When someone is looting currently in a province
# ROOT = Looter, FROM = Province
on_loot_province = {
	random_events = {
		10 = flavor.5100 # Ambush passenger ship
		10 = flavor.5200 # Attack trade ship
		10 = flavor.5300 # Steal military technology
		70 = 0
	}
}

###########################
# DIPLOMATIC NOTIFICATIONS
###########################

DEMAND_RELIGIOUS_CONVERSION_INTERACTION_ACCEPT_EVENT = {
	events = {
		202
	}
}

DEMAND_RELIGIOUS_CONVERSION_INTERACTION_DECLINE_EVENT = {
	events = {
		203
	}
}

REVOKE_TITLE_INTERACTION_ACCEPT_EVENT = {
	events = {
		204
	}
}

REVOKE_TITLE_INTERACTION_DECLINE_EVENT = {
	events = {
		205
	}
}

OFFER_PEACE_INTERACTION_ACCEPT_EVENT = {
	events = {
		206
	}
}

OFFER_PEACE_INTERACTION_DECLINE_EVENT = {
	events = {
		207
	}
}

SEND_GIFT_INTERACTION_ACCEPT_EVENT = {
	events = {
		208
	}
}

SEND_GIFT_INTERACTION_DECLINE_EVENT = {
	events = {
		209
	}
}

ASK_FOR_MONEY_INTERACTION_ACCEPT_EVENT = {
	events = {
		#SoA.3100
	}
}

ASK_FOR_MONEY_INTERACTION_DECLINE_EVENT = {
	events = {
		#SoA.3101
	}
}

ASK_FOR_CLAIM_INTERACTION_ACCEPT_EVENT = {
	events = {
		#SoA.3104
	}
}

ASK_FOR_CLAIM_INTERACTION_DECLINE_EVENT = {
	events = {
		#SoA.3105
	}
}

NOMINATE_BISHOP_TO_POPE_INTERACTION_ACCEPT_EVENT = {
	events = {
		#SoA.3102
	}
}

NOMINATE_BISHOP_TO_POPE_INTERACTION_DECLINE_EVENT = {
	events = {
		#SoA.3103
	}
}


OFFER_VASSALIZATION_INTERACTION_ACCEPT_EVENT = {
	events = {
		210
	}
}

OFFER_VASSALIZATION_INTERACTION_DECLINE_EVENT = {
	events = {
		211
	}
}

ARRANGE_BETROTHAL_INTERACTION_ACCEPT_EVENT = {
	events = {
		212
	}
}

ARRANGE_BETROTHAL_INTERACTION_DECLINE_EVENT = {
	events = {
		213
	}
}

ARRANGE_SUCC_BETROTHAL_INTERACTION_ACCEPT_EVENT = {
	events = {
		330
	}
}

ARRANGE_SUCC_BETROTHAL_INTERACTION_DECLINE_EVENT = {
	events = {
		331
	}
}

OFFER_SUCCESSION_MARRIGE_INTERACTION_ACCEPT_EVENT = {
	events = {
		214
	}
}

OFFER_SUCCESSION_MARRIGE_INTERACTION_DECLINE_EVENT = {
	events = {
		215
	}
}

OFFER_MARRIGE_INTERACTION_ACCEPT_EVENT = {
	events = {
		216
	}
}

OFFER_MARRIGE_INTERACTION_DECLINE_EVENT = {
	events = {
		217
	}
}

RANSOM_CHARACTER_INTERACTION_ACCEPT_EVENT = {
	events = {
		218
	}
}

RANSOM_CHARACTER_INTERACTION_DECLINE_EVENT = {
	events = {
		219
	}
}

EDUCATE_CHARACTER_INTERACTION_ACCEPT_EVENT = {
	events = {
		220
	}
}

EDUCATE_CHARACTER_INTERACTION_DECLINE_EVENT = {
	events = {
		221
	}
}

ABANDON_AMBITION_INTERACTION_ACCEPT_EVENT = {
	events = {
		222
	}
}

ABANDON_AMBITION_INTERACTION_DECLINE_EVENT = {
	events = {
		223
	}
}

STOP_BACKING_AMBITION_INTERACTION_ACCEPT_EVENT = {
	events = {
		224
	}
}

STOP_BACKING_AMBITION_INTERACTION_DECLINE_EVENT = {
	events = {
		225
	}
}

JOIN_AMBITION_INTERACTION_ACCEPT_EVENT = {
	events = {
		226
	}
}

JOIN_AMBITION_INTERACTION_DECLINE_EVENT = {
	events = {
		227
	}
}

GRANT_LANDED_TITLE_INTERACTION_ACCEPT_EVENT = {
	events = {
		228
	}
}

GRANT_LANDED_TITLE_INTERACTION_DECLINE_EVENT = {
	events = {
#		229
	}
}

APPOINT_TO_OFFICE_INTERACTION_ACCEPT_EVENT = {
	events = {
		230
	}
}

APPOINT_TO_OFFICE_INTERACTION_DECLINE_EVENT = {
	events = {
		231
	}
}

ASK_FOR_INVASION_INTERACTION_ACCEPT_EVENT = {
	events = {
		232
	}
}

ASK_FOR_INVASION_INTERACTION_DECLINE_EVENT = {
	events = {
		233
	}
}

ASK_FOR_DIVORCE_INTERACTION_ACCEPT_EVENT = {
	events = {
		234
	}
}

ASK_FOR_DIVORCE_INTERACTION_DECLINE_EVENT = {
	events = {
		235
	}
}

ASK_FOR_EXCOMMUNICATION_INTERACTION_ACCEPT_EVENT = {
	events = {
		236
	}
}

ASK_FOR_EXCOMMUNICATION_INTERACTION_DECLINE_EVENT = {
	events = {
		237
	}
}

CALL_ALLY_INTERACTION_ACCEPT_EVENT = {
	events = {
		238
	}
}

CALL_ALLY_INTERACTION_DECLINE_EVENT = {
	events = {
		239
	}
}

DECLARE_WAR_INTERACTION_ACCEPT_EVENT = {
	events = {
		240
		241
	}
}

RETRACT_VASSAL_INTERACTION_ACCEPT_EVENT = {
	events = {
		274
	}
}

RETRACT_VASSAL_INTERACTION_DECLINE_EVENT = {
	events = {
		275
	}
}

INVITE_TO_COURT_INTERACTION_ACCEPT_EVENT = {
	events = {
		280
	}
}

INVITE_TO_COURT_INTERACTION_DECLINE_EVENT = {
	events = {
		281
	}
}

ASK_FOR_VASSALIZATION_INTERACTION_ACCEPT_EVENT = {
	events = {
		282
	}
}

ASK_FOR_VASSALIZATION_INTERACTION_DECLINE_EVENT = {
	events = {
		283
	}
}

ASK_TO_LIFT_EXCOMMUNICATION_INTERACTION_ACCEPT_EVENT = {
	events = {
		284
	}
}

ASK_TO_LIFT_EXCOMMUNICATION_INTERACTION_DECLINE_EVENT = {
	events = {
		285
	}
}

ASK_TO_RANSOM_CHARACTER_INTERACTION_ACCEPT_EVENT = {
	events = {
		286
	}
}

ASK_TO_RANSOM_CHARACTER_INTERACTION_DECLINE_EVENT = {
	events = {
		287
	}
}

SETTLE_ADVENTURER_INTERACTION_ACCEPT_EVENT = {
	events = {
		288
		725
	}
}

SETTLE_ADVENTURER_INTERACTION_DECLINE_EVENT = {
	events = {
		289
	}
}

ASK_TO_JOIN_WAR_INTERACTION_ACCEPT_EVENT = {
	events = {
		293
	}
}

ASK_TO_JOIN_WAR_INTERACTION_DECLINE_EVENT = {
	events = {
		294
	}
}

ASK_TO_EMBARGO_INTERACTION_ACCEPT_EVENT = {
	events = {
		295
	}
}

ASK_TO_EMBARGO_INTERACTION_DECLINE_EVENT = {
	events = {
		296
	}
}

MAKE_CONSORT_INTERACTION_ACCEPT_EVENT = {
	events = {
		297
	}
}

MAKE_CONSORT_INTERACTION_DECLINE_EVENT = {
	events = {
		298
	}
}

ABSORB_CLAN_INTERACTION_ACCEPT_EVENT = {
	events = {
		503
	}
}

ABSORB_CLAN_INTERACTION_DECLINE_EVENT = {
	events = {
		504
	}
}

SPLIT_CLAN_INTERACTION_ACCEPT_EVENT = {
	events = {
		509
	}
}

SPLIT_CLAN_INTERACTION_DECLINE_EVENT = {
	events = {
		510
	}
}

FORM_BLOOD_OATH_INTERACTION_ACCEPT_EVENT = {
	events = {
		505
	}
}

FORM_BLOOD_OATH_INTERACTION_DECLINE_EVENT = {
	events = {
		506
	}
}

SETTLE_FEUD_INTERACTION_ACCEPT_EVENT = {
	events = {
		507
	}
}

SETTLE_FEUD_INTERACTION_DECLINE_EVENT = {
	events = {
		508
	}
}

# never triggered, but reserved for CB use
on_warleader_death = {
	events = {
		251
		252
	}
}

# Respond to a proposed change of law
on_approve_law = {
	events = {
		290
	}
}

# Respond to a proposed change of de jure law
on_approve_de_jure_law = {
	events = {
		291
		292
	}
}

# When rebels appear
on_rebel_revolt = {
	events = {
		# Events are called in reverse ID order due to prerequisite issues
		# Theocratic Rebellions
		rebels.340
		rebels.330
		rebels.320
		rebels.310
		rebels.300
		# Autocratic Rebellions
		rebels.240
		rebels.230
		rebels.220
		rebels.210
		rebels.200
		# Democratic Rebellions
		rebels.140
		rebels.130
		rebels.120
		rebels.110
		rebels.100
		# Protests and Riots
		rebels.16
		rebels.15
		rebels.10
	}
}

# When province defects to rebels
on_defect_to_rebels = {
	events = {
		610			# Only valid without "The Old Gods" DLC
	}
}

# When rebels disperse
on_defect_from_rebels = {
	events = {
		615			# Only valid without "The Old Gods" DLC
	}
}

# When a mission succeeds
on_crusade_success = {
	events = {
		620
	}
}

# When a mission fails
on_crusade_failure = {
	events = {
		621
	}
}

# When a pagan ruler forces a prisoner to be his consort
on_forced_consort = {
	events = {
		660
	}
}

# When a pagan religion is reformed
on_reform_religion = {
	events = {
		670
	}
}

# When the religion changes in a county
on_county_religion_change = {
	events = {
		#SoA.4121
	}
}

# When a character accepts religious conversion (the diplomatic action)
# FROMFROM is the demander. FROM is the vassal. ROOT is the character. Fires for the vassal and each of his courtiers and vassals.
on_vassal_accepts_religious_conversion = {
	events = {
		#39700 # Hidden event actually changing the religion
	}
}

# A heresy has become the new norm, replacing the old orthodoxy
on_heresy_takeover = {
	events = {
		#SoA.4200
	}
}

# Fires for a newly elected Doge. FROM is the previous (dying or abdicating) doge.
on_become_doge = {
	events = {
		#701
		maintenance.550 # Tentative fix for the Infinite Money Bug
		maintenance.900 # Update the senate
		
		# Handle election results
		laws.5217
		
		# Don't not be a doge
		government.50
	}
}

on_elective_gavelkind_succession = {
	events = {
		63103
	}
}

# Fires when a navy moves into a port. Starts in unit scope, FROM is the owner.
on_entering_port = {
	events = {
		#700
	}
}

# Fires when a cardinal is elected. SoA only! FROM is the Religious head.
on_rel_elector_chosen = {
}

# Fires when a Pope is elected. SoA only! FROM is the previous Religious Head
on_rel_head_chosen = {
	events = {
		#704
	}
}

# ROOT is the looter, FROM is the settlement title
on_settlement_looted = {
}

# ROOT is the navy's owner, FROM is the province
on_navy_returns_with_loot = {
}

# ROOT is the creating character, FROM is the title
on_create_title = {
	maintenance.900 # Update the senate
}

# ROOT is the character, FROM is the title, FROMFROM is the old holder
on_new_holder = {
	events = {
		# Check for Feudal Merchant Republics
		maintenance.550
		
		# Inherit old constitutional crises
		laws.10
		laws.20
		laws.30
		
		maintenance.900 # Update the senate every time a title changes
		
		# Election-related
		laws.5500
		laws.5115
		laws.5215
	}
}

# ROOT is the character, FROM is the title, FROMFROM is the old holder
on_new_holder_inheritance = {
	events = {
		# Check for Feudal Merchant Republics
		maintenance.550
		
		# Inherit old constitutional crises
		laws.10
		laws.20
		laws.30
		
		# Election-related
		laws.5500
		laws.5115
		laws.5215
	}
}

# ROOT is the character, FROM is the title, FROMFROM is the old holder
on_new_holder_usurpation = {
	events = {
		# Check for Feudal Merchant Republics
		maintenance.550
		
		# Inherit old constitutional crises
		laws.10
		laws.20
		laws.30
		
		# Possible intervention by liege
		usurpation.200
		
		# Election-related
		laws.5500
		laws.5115
		laws.5215
		
		# Assign appropriate government type
		government.2000
		government.2100
		government.2200
		government.2300
		government.2400
		government.2500
		government.2600
		government.2700
		government.2800
		government.2900
	}
}

on_unlanded = {
	events = {
		HL.130 #Landless nomad clean-up.
	}
}


# Fires at the end of each year if the chronicle is empty
on_create_chronicle_if_empty = {
}

# Fires when the player changes character
# FROM is the old character, ROOT is the new holder
on_chronicle_owner_change = {
}

# Fires when the game starts (not from saves)
on_chronicle_start = {
	events = {
		startup.0 # Fixing immortality trait bug
		startup.1 # Calculate initial senates
	}
}

# Character converts religion, for whatever reason. ROOT is the character after conversion and the FROM scope has the old religion.
on_character_convert_religion = {
	events = {
		#CM.10026
		671 #set rival conversion flag if eligible
		government.3000
	}
}

# Character converts culture, for whatever reason. ROOT is the character after conversion and the FROM scope has the old culture.
on_character_convert_culture = {
	events = {
		#CM.10027
	}
}

on_acquire_nickname = {
	events = {
		#CM.10028
	}
}

# Fires for vassals that can become independent as a result of liege being over vassal limit
on_over_vassal_limit_succession = {
	events = {
		63100
	}
}

# From = Attacker, Root = Defender
on_war_started = {
	events = {
		#CM.10012
	}
}

# From = Attacker, Root = Defender
on_war_ended_victory = {
	events = {
		#CM.10038
	}
}

# From = Attacker, Root = Defender
on_war_ended_whitepeace = {
	events = {
		#CM.10040
	}
}

# From = Attacker, Root = Defender
on_war_ended_defeat = {
	events = {
		#CM.10041
	}
}

# From = Divorcer, Root = Spouse, New = Religious head if applicable
on_divorce = {
	events = {
		717 # Achievement
		CM.10037
	}
}

# ROOT = Builder, FROM = Title
on_settlement_construction_start = {
}

# ROOT = Builder, FROM = Title
on_settlement_construction_completed = {
	events = {
		HL.3
		HL.4
	}
}

# ROOT = Starter, FROM = Target 
on_feud_started = {
	events = {
		HL.6
	}
}

# ROOT = Ender, FROM = Target 
on_feud_ended = {
}

on_blood_brother_death = {
	events = {
		HL.10
	}
}

# ROOT = AI character
on_ai_end_raid = {
	events = {
		HL.191
	}
}