#character
on_startup = {
}

#character
on_yearly_pulse = {
	events = {
		CM.5000 # Ragnar Lodbrok
		CM.503 # Start of Viking Age
		CM.1011 # Lombard Queen
	}
	
	random_events = {
		
		# Feudal Life Events
		100 = 4000
		100 = 4005
		100 = 4010
		100 = 4015
		100 = 4020
		100 = 4035
		100 = 4036
		100 = 4040
		100 = 4041
		100 = 4045
		100 = 4050
		100 = 4055
		100 = 4060
		100 = 4085
		100 = 4110
		100 = 4115
		100 = 4120
		100 = 4125
		100 = 4130
		100 = 4135
		100 = 4145
		100 = 4150
		100 = 4155
		100 = 4175
		
		# Married Life Events
		100 = 30000
		100 = 30001
		100 = 30004
		100 = 30020
		100 = 30021
		100 = 30025
		100 = 30030
		100 = 30040
		100 = 30045
		100 = 30050
		100 = 30051
		100 = 30052
		100 = 30055
		100 = 30056
		100 = 30057
		100 = 30058
		100 = 30059
		100 = 30060
		100 = 30063
		100 = 30066
		100 = 30069
		100 = 30072
		100 = 30075
		100 = 30085
		100 = 30100
		100 = 30105
		100 = 30110
		
		# Old Lover Events (Disabled in "Way of Life")
		100 = 64000 # Confronts spouse about lover. Rivalries, lover lost.
		100 = 64005 # Lover is ill. Give comfort.
		100 = 64006 # Wounded lover. Wound removed.
		100 = 64010 # Teenage infatuation starts.
		100 = 64015 # Wife is old and ugly. Take a mistress?
		100 = 64025 # Fallen in love with spouse
		100 = 64030 # Vacation with lover
		100 = 64035 # Party/hunting/nothing with lover
		100 = 64040 # Ruler confronts spouse about lover
		
		#Job Flavour Events
		100 = 75010
		100 = 75020
		100 = 75030
		100 = 75040
		100 = 75050
		100 = 75060
		100 = 75065
		100 = 75070
		100 = 75075
		100 = 75080
		100 = 75085
		100 = 75090
		100 = 75095
		100 = 75105
		100 = 75110
		100 = 75120

		#Dynasty requests
		250 = 66000
		250 = 66050
		250 = 66100
		
		#Hedge Knights Events
		100 = 71000 
		100 = 71006 
		
		#Rumours Events
		10 = 69000
		10 = 69003 
		10 = 69010 
		10 = 69014 
		10 = 69020 
		10 = 69023 
		10 = 69030 
		10 = 69037 
		10 = 69040 
		10 = 69043 
		10 = 69050 
		10 = 69052 
		10 = 69054 
		10 = 69056 
		10 = 69058  
		10 = 69060  
		10 = 69063  
		10 = 69070
		10 = 69073
		10 = 69100
		10 = 69095
		
		#Court Events
		100 = 73000
		100 = 73001
		100 = 73002
		100 = 73003
		100 = 73004
		100 = 73005
		100 = 73006
		100 = 73007
		100 = 73008
		100 = 73009
		100 = 73010
		
		#Religious Events
		100 = 39230
		
		#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
		
		# Reincarnation: Memories of the previous life
		1000 = RoI.10020
		1000 = RoI.10021
		1000 = RoI.10022
		
		# Indian guru events
		100 = RoI.3100
		100 = RoI.3101
		100 = RoI.3102
		100 = RoI.3103
		100 = RoI.3104
		100 = RoI.3105
		100 = RoI.3106
		100 = RoI.3107
		100 = RoI.3108
		100 = RoI.3109
		100 = RoI.3110
		100 = RoI.3111
		100 = RoI.3112
		100 = RoI.3113
		100 = RoI.3114
		500 = RoI.3200
		500 = RoI.3300
		100 = RoI.3400
		
		# Indian ascetics and yogis
		20 = RoI.203
		20 = RoI.206
		20 = RoI.209
		20 = RoI.193
		
		# Indian story events
		20 = RoI.215
		20 = RoI.20147
		20 = RoI.20164
		
		# Indian minor events
		100 = RoI.157
		100 = RoI.158
		100 = RoI.163
		100 = RoI.180
		100 = RoI.190
		50 = RoI.401
		100 = RoI.403
		100 = RoI.410
		100 = RoI.411
		200 = RoI.412
		500 = RoI.500
		
		# Indian low religious authority events
		50 = RoI.3500
		50 = RoI.3506
		50 = RoI.3510
		50 = RoI.3516
		10 = RoI.3520
		50 = RoI.3530
		50 = RoI.3536
		
		# Religious tolerance events
		100 = RoI.400

		# Hero knight adventure events
		200 = CM.2010
		200 = CM.2020
		200 = CM.2100
		
		# Effects of being in hiding
		100 = CM.6100
		100 = CM.6102
		100 = CM.6104
		100 = CM.6106
		100 = CM.6108
		100 = CM.6110
		100 = CM.6112
		100 = CM.6114
		100 = CM.6116
		100 = CM.6118
		100 = CM.6120
		100 = CM.6122
		100 = CM.6124
		100 = CM.6126
		100 = CM.6128
		100 = CM.6130
		100 = CM.6132
		
		# Meddling mother events
		100 = CM.1150
		100 = CM.1160
		100 = CM.1170
		100 = CM.1180
		100 = CM.1190
		
		# Other Charlemagne/Carloman
		100 = CM.1130
		
		# Way of Life Theology focus
		1000 = WoL.7000
		1000 = WoL.7010
		1000 = WoL.7020
		1000 = WoL.7030
		1000 = WoL.7040
		1000 = WoL.7050
		1000 = WoL.7060
		1000 = WoL.7070

		# Way of Life Hunting focus
		2000 = WoL.5000 # Epic Hunt chain start
		2000 = WoL.5200 # Receive hunting dog
		1000 = WoL.5210 # Dog makes you happy
		1000 = WoL.5211 # Dog makes you popular
		1000 = WoL.5220 # Train your dog?
		1000 = WoL.5230 # Bad dog kills other dog
		1000 = WoL.5231 # Bad dog kills or wounds courtier
		
		5000 = 0 # Chance of no yearly event
	}
}


#character
on_bi_yearly_pulse = {
	random_events = {

		#Pope demands return of Rome
		100 = 1000182000	
	
		#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

		#Seven Virtues
		10 = 3020
		10 = 3021
		10 = 3022
		10 = 3025
		10 = 3026
		10 = 3030
		10 = 3035
		10 = 3012
		10 = 3013
		10 = 3095
		10 = 3080
		10 = 3081
		10 = 3082
		10 = 3083
		10 = 3084
		10 = 3085
		10 = 3120
		10 = 3121
		10 = 3123
		10 = 3124
		10 = 3125
		10 = 3126
		10 = 3200
		10 = 3202
		10 = 3203
		10 = 3205
		10 = 3240
		10 = 3242
		10 = 3243
		10 = 3245
		10 = 3246
		10 = 3247
		10 = 3248
		10 = 3258
		10 = 3160
		#10 = 3165 - deleted
		10 = 3170
		10 = 3175

		#Seven Deadly Sins
		10 = 3000
		10 = 3001
		10 = 3005
		10 = 3010
		10 = 3011		
		10 = 3040
		10 = 3045
		10 = 3050
		10 = 3055
		10 = 3060
		10 = 3065
		10 = 3070
		10 = 3075
		10 = 3100
		10 = 3105
		10 = 3110
		10 = 3115
		10 = 3180
		10 = 3185
		10 = 3190
		10 = 3195
		10 = 3140
		10 = 3141
		10 = 3142
		10 = 3143
		10 = 3144
		10 = 3145
		10 = 3220
		10 = 3225
		10 = 3230
		10 = 3235
		
		
		#Misc Traits, Paranoid, Honest,Gregagrious, Craven
		10 = 3480
		10 = 3485
		10 = 3490
		10 = 3495	
		10 = 3280
		10 = 3282
		10 = 3283
		10 = 3286
		10 = 3710
		10 = 3715
		10 = 3720
		10 = 3725
		10 = 3300
		10 = 3305
		10 = 3310
		10 = 3315

		
		#Deceitful
		10 = 3260
		10 = 3261
		10 = 3262
		10 = 3263
	

		#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
	}
}

#character
on_decade_pulse = {

}

# For characters 2 to 16 years old
on_yearly_childhood_pulse = {
	random_events = {
		# Childhood Personality Events
		
		#Age 6-16, aiming to get at least 4 traits before adult.
		100 = 1500
		100 = 1510
		100 = 1520
		100 = 1530
		100 = 1540
		100 = 1550
		100 = 1560
		100 = 1570
		100 = 1580
		100 = 1590
		100 = 1600
		100 = 1610
		100 = 1620
		100 = 1630
		100 = 1640
		100 = 1650
		100 = 1660
		100 = 1670
		100 = 1680
		100 = 1690
		100 = 1700
		100 = 1710
		100 = 1720
		100 = 1730
		100 = 1965
		100 = 1632
		100 = 1732
		5000 = RoI.10010 # Acknowledged reincarnated child acquires trait from previous personality
		
		#Toddler flavour events (age 2-5), not very common, but some will get them.
		10 = 1900 
		10 = 1901
		10 = 1902
		10 = 1903
		10 = 1904
		
		#Young children flavour events, (age 6-10), not very common, but some will get then..
		20 = 1905
		20 = 1906
		20 = 1907
		20 = 1908
		20 = 1909
		20 = 1910
		20 = 1911
		20 = 1912
		
		#Youngsters flavour events (age 11-15), not very common, but some will get then..
		50 = 1913
		50 = 1914
		50 = 1915
		50 = 1916
		50 = 1917
		50 = 1918
		50 = 1919
		50 = 1920
		50 = 1921
		50 = 1922
		50 = 1923
		50 = 1924
		50 = 1925
		50 = 1926
		50 = 1927
		50 = 1928
		50 = 1929
		50 = 1930
		50 = 1931
		50 = 1932
		50 = 1933
		50 = 1934
		50 = 1935
		
		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 = {
		2750 = 0
		10 = 242 # Killed
		20 = 243 # Wounded
		10 = 244 # Maimed
		5 = 245 # Serious head injury
		50 = 246 # Improves martial education
		20 = 247 # Flat improvement to martial skill

		20 = 248 # Knowledge boost in capital from battle.
		10 = 255 # Marshal: Unnecessary violence
		25 = 270 # Gain Brave
		25 = 271 # Gain Craven
		20 = 272 # Gain Wroth
		20 = 273 # Gain Patient
		
		30 = 96500 # Gain Combat Trait 1
		15 = 96501 # Gain Combat Trait 2
		15 = 96502 # Gain Combat Trait 3
		15 = 96503 # Gain Combat Trait 4
		
		50 = TOG.3000 # Becomes Berserker
		15 = TOG.3001 # Berserker Maimed
		20 = TOG.3002 # Berserker Wounded
		15 = TOG.3003 # Berserker Killed
		25 = TOG.3004 # Berserker Kills Many
	}
}

#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
	}
}

# any leader in battle on winning side is ROOT - opponent army leader is FROM
on_battle_won = {
	random_events = {
		800 = 0
		10 = 260 # Heroism shown
		10 = 261 # Soldier Distinguish himself.
		100 = 8310 # Crusader becomes zealous
		50 = CM.1054 # Death of Roland
	}
}

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

# Winning army leader is ROOT - opponent army leader is FROM
on_battle_won_leader = {
}

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

# Any leader in battle on losing side is ROOT - opponent army leader is FROM
on_battle_lost = {
	random_events = {
		700 = 0
		50 = 250 # Imprisoned by the enemy
		50 = 8320 # Crusader becomes cynical
		200 = CM.1056 # Death of Roland
	}
}

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

# Losing army leader ROOT - opponent army leader is FROM
on_battle_lost_leader = {
}

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

# The taken Holding title is in FROM.
on_siege_won_leader = {
	events = {
		8330 # Conquers the crusade target
		60100 # Mongols sack Kiev
		60101 # Mongols sack Novgorod
		60102 # Mongols sack Krakow
		60103 # Mongols sack Aachen
		60104 # Mongols sack Paris
		60105 # Mongols sack London
		60106 # Mongols sack Rome
		60107 # Mongols sack Venice
		60108 # Mongols sack Constantinople
		60109 # Mongols sack Lisbon
		60110 # Mongols sack Smolensk
		60111 # Mongols sack Prague
		60112 # Mongols sack Vienna
		60113 # Mongols sack Esztergom
		60114 # Mongols sack Athens
		60115 # Mongols sack Belgrade
		60116 # Mongols sack Baghdad
		60117 # Mongols sack Damascus
		60118 # Mongols sack Jerusalem
		60119 # Mongols sack Alexandria
		60120 # Mongols sack Cairo
		60121 # Mongols sack Mecca
		88005 # Mongols sack city near the Hashshashin
		CM.10033 # Chronicle for certain major locations
		CM.10034 # Chronicle for certain major locations
	}
	random_events = {
		300 = 0
		100 = 8340 # Finds the Spear of Destiny / Holy Lance
		100 = 8342 # Finds the Holy Grail
		500 = 8345 # Sack of Jerusalem
	}
}

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
		TOG.1065 # Religious rebels take county capital
		CM.1101 # Destruction of Irminsul
		CM.10035 # Chronicle for certain major locations
	}
	random_events = {
		400 = 0 # Nothing happens
		100 = SoA.5400 # Massacre at Beziers-type event
	}
}

# 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 = {
	events = {
		SoA.5406 # Shepherds' Crusade kills Jews and priests
	}
	random_events = {
 		1000 = 0 # Nothing happens
 		400 = SSI.61 # Aztec sacrifice
 		100 = 62100 # Character imprisoned
 		200 = TOG.1190 # Rebels kill character
 	}
}

#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 = { 
		thegods.009 # God or not?
		equip.007
		300 # A Bastard is born
		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
		706 # Full House achievement
		707 # Keeping it in the Family achievement
		CM.10011 # Chronicle entry
	}
	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 # Christian Crusade against Muslims
 		201 # Christian Crusade against Pagans
 		321 # Christian Crusade against Heretics
 		320 # Jihad against Christians
 		322 # Jihad against Pagans
 		323 # Jihad against Heretics
 		324 # Pagan Holy War against Christians
 		325 # Pagan Holy War against Muslims
 		326 # Pagan Holy War against other Pagans
		CM.10015  # Chronicle entry
 	}
}

# Sent to employers of both spouses - ROOT is employer. FROM is employers "employee". new_character is the other spouse.
on_marriage = {
	events = {
 		500 # Royal Marriage Aid Duty
 		501 # Zoroastrian "Xwedodah" marriage
 		502 # Messalian close kin marriage
		708 # Marriage Game achievement
		CM.10023  # Chronicle entry
		CM.10036 # Chronicle entry - primary heir
 	}
}

#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 - ROOT is prisoner, FROM is imprisoner
on_became_imprisoned = {
	events = {
 		151 # Was imprisoned
		CM.10024  # Chronicle entry
 	}
}

#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 - ROOT is prisoner, FROM is imprisoner
on_released_from_prison = {
	events = {
 		153
		CM.10025  # Chronicle entry
		CM.15002  # Free anyone thrown into the desert
 	}
}

#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 = { 
		equip.000
		equip.001
		equip.007
#		8250
		650
		24500
		24502
		60002 # Genghis Khan dies
		60006 # Sons of Genghis Khan die
		70041
		88291
		SoA.5306
		705
		CM.1068 # Carloman dies
		CM.1069 # Charlemagne dies
		CM.10010 # Chronicle entry
		CM.6185 # Dies of other causes while assassination is in progress - clear flags
		WoL.6335 # Owner of Necronomicon dies...
#		WoL.11300 # Check if spouse is executed or killed by someone.
	}
	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
	}
}

###########################
# 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
	}
}

# FROM is character receiving peace proposal. ROOT is character sending peace proposal.
OFFER_PEACE_INTERACTION_ACCEPT_EVENT = {
	events = {
		206
		CM.1407 # Charlemagne in Spain
	}
}

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
		717 # Achievement
		CM.10037
	}
}

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 # Ally accepts
		41000 # Vassal accepts
		CM.10014
	}
}

CALL_ALLY_INTERACTION_DECLINE_EVENT = {
	events = {
		239 # Ally 
		41001 # Vassal
	}
}

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
	}
}

ASK_TO_JOIN_WAR_INTERACTION_ACCEPT_EVENT = {
	events = {
		293
		CM.10013
	}
}

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
	}
}

# 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 = {
		600 		# Only valid without "The Old Gods" DLC
		TOG.1030 	# Heretic rebels reinforced
		TOG.1020	# Heretic rebels rise up
		TOG.1050 	# Nationalist rebels reinforced
		TOG.1040	# Nationalist rebels rise up
		TOG.1070 	# Religious rebels reinforced
		TOG.1060	# Religious rebels rise up
		TOG.1010 	# Peasant rebels reinforced
		TOG.1000 	# Peasant rebels rise up
	}
}

# 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
		CM.10016  # Chronicle entry
	}
}

# When a mission fails
on_crusade_failure = {
	events = {
		621
		CM.10017  # Chronicle entry
	}
}

# 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
	}
}

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 = {
	events = {
		CM.10021
		CM.1501
	}
}

# ROOT is the character, FROM is the title, FROMFROM is the old holder
on_new_holder = {
}

# ROOT is the character, FROM is the title, FROMFROM is the old holder
on_new_holder_inheritance = {
	events = {
		CM.10039 # Chronicle entry
	}
}

# ROOT is the character, FROM is the title, FROMFROM is the old holder
on_new_holder_usurpation = {
	events = {
		CM.10022
	}
}

# Fires at the end of each year if the chronicle is empty
on_create_chronicle_if_empty = {
	random_events = {
		100 = CM.10500
		100 = CM.10502
		100 = CM.10504
		100 = CM.10506
		100 = CM.10507
		100 = CM.10509
		100 = CM.10511
		100 = CM.10513
		100 = CM.10515
		100 = CM.10517
		100 = CM.10519
		100 = CM.10521
		100 = CM.10523
		100 = CM.10525
		100 = CM.10527
		100 = CM.10529
	}
}

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

# Fires when the game starts (not from saves)
on_chronicle_start = {
	events = {
		CM.10000
	}
}

# 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
	}
}

# 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
	}
}

