#added 250277 on on_death
#character
on_startup = {
	events = {
		JD.60005 #Convert prosthetics event modifiers into artifacts

		roberts_rebellion.1 #Scenario Initialisation
		# mega_wars.999 #set up mega wars flags/variables
		dynamic_coa.0
		maintenance.41 # Summerhall de jure maintenance
		maintenance.19 #Check CK2 Version
		CM.10002 #Check chroncile event target
		maintenance.50 # Dragon fake education
		dothraki.203 #Dosh Khaleen Maintenance
		maintenance.53 #Rainwood de jure maintenance
		maintenance.54 # triggered modifiers
		maintenance.59 #Find active player regions for cull
		maintenance.498 #check for characters who've had tyranny for too long
		maintenance.499 #check for characters who've had dishonour for too long
		REP.908 #find new patricians
		valyrian_steel.998 #convert valyrian steel traits to artifacts
		feast_for_crows.999 #Spoiler warning
		HF.20372 # Apply Crowned_by_traits
		#686 # TODO REMOVE TEST STARTUP GENERATION OF BLOODLINES
		#HFP.30031 # Set up freckles
		HF.1 # Set up Great Conquerors for Shattered World
		HF.2 # Set up Primogeniture in Shattered World
		HF.5 # Alternate Start General maintenance
		HF.23205 # Altstart Dogmatic/Cosmopolitan effects.
		#HF.25057 #Give West African Grand Masters some Masks.
		HF.23035 #Status of Women cleanup for customized religions on Random Start.
		#HF.25070 #Add Tattoos to landless starting Warrior Lodge members of high ranks.
		689 # scripted default elective token setup
		HFP.24025 #Enable Eldership for appropriate religions/Doctrines.
		#HF.15099 # Setup rain in African regions
		#HF.23776 #Assign African tattoos.
		#HFP.20804 #Clear Byzantine commander variables on the Emperor.
		HF.23778 #Setting up god-emperors on Altstart.
		HFP.11051 # Hidden event to give commanders (who do not have it already) the commander bonus
		LT.32000 # Adding the historical flag to wonders.
	}
}

#character
on_yearly_pulse = {
	events = {
		HL.1030 # Wolf Child growing older, rumors of real mother being a wolf
		ZE.1100 # Disobedient daughter is unhappy
		ZE.9000 # Ally not contributing in war
		ZE.10000 # Mercenary event tombola
		RIP.10012 # Check for plague notifications
		RIP.5050 # Scurvy event
		RIP.30316 # clean up immortal crisis 
		RIP.30317 # immortal crisis spreads
		#MNM.4430 # Passive nice trait gain for buddhist/jain monastic societies
		#MNM.9815 # Seal of Solomon artifact makes you immune to possession
		MNM.70030 # Secret society visibility reduction
		JD.20041 # Chinese (Foreign) commander teaching other commanders their leadership trait
		#JD.4000 # Character raiding China result events
		bear.7 # Secret bear generation
		bear.1 # Secret bear discovery. Called here and in bear.7, as bear.1 can be temporarily precluded
		GR.23 # Repeat exclave purge for AI's every year if they are at war
		HF.20405 #Ticking negative opinion modifier for uncrowned Catholic
		HF.21999 #Main Appease hidden event, no further pulses are required.
		HF.22999 #Main Antagonize hidden event, no further pulses are required.
		#HF.3 # Activate GHW's and holy orders when running randomized rel names
		HF.304 # Child of Destiny gains bloodline if above Duke tier
		#HFP.44002 # Holy Orders check if their liege, if any, is still fit to rule them
		HFP.24001 # Elder has too much to live for.

		#Maintenance
		maintenance.5 #General Maintenance				
		maintenance.31 #Human auto-assigns minor titles
		maintenance.32 #Traditional honourary titles assigned
		maintenance.40 #AI gender law check		
		maintenance.49 ##AI job action control		
		maintenance.51 # Empire crown law maintenance
		maintenance.54 # triggered modifiers
		maintenance.39 # House Forrester names a Sentinel
		maintenance.66 #AI hire merchant ships?
		maintenance.68 # Shattered Realms rule, force AI to consider using fabricated claims
				
		#Misc Maintenance		
		old_races.600 #giant merc flag cleanup
		warden.1 # New warden needed	
		ironborn_events.61 #Lose salt wife trait	
		dragon.8 #yearly dragon growth event
		knight.35 #House Manderly Knight of Greenhand title
		diplomatic.50 #King loses spare King titles
		diplomatic.51 #Has titular kingdom, liege will decide what to do
		dynasty.100  #Defunct title grants claim on new title
		CM.10002 #Check chronicle event target
		council_plot.52 #You Support A Friend On Your Liege's Council
		SoA.30399 #Demon child event generator
		harrenhal.199 #Harrenhal rebuilding event generator
		faction_event_new.96 #Yearly fear calculator
		ransom.298 #unlanded prisoner ransom check
		vassal_request.20 #request vassal transfer from fellow vassal
		high_valyrian.57 #Glass candle user
		bankruptcy.103 # Personal loan is due
		dynastic_loyalty.4 #Dynastic loyalty maintenance
		37049 # Close relative asks to get married due to obj_get_married
		
		#Maesters
		#maester.7 #new maester decides
		#maester.10 #archmaester counter
		maester.1 #Archmaester maintenance
		maester.2 #Maester mainetance
		maester.11 #new archmaester needed
		maester.30 #Citadel Archmaester Maintenance
		
		#Nightswatch
		nightswatch.4 #Lord Commander surrenders titles
		nightswatch.5 #Give title back to the watch
		nightswatch.6 #Black brother maintenance
		nightswatch.7 #watch is open elective
		nightswatch.11 #no women/children in night's watch
		nightswatch.12 #Night's Watch must stay independent
		#nightswatch.24 #AI decides what to do with child on wall
		wildling.102 # Check Night's Watch prisoners of Wildlings
		nightswatch.51 #LC breaks vow by raiding
		nightswatch.91 #Men unhappy with common personal steward
		nightswatch.899 #Black brother assigned role
		nightswatch.103 #deserter management
		
		#Slavery
		slavery.12 #Character owns slaves but does not have slave owner trait
		slavery.13 #Character who owns no slaves has slave owner trait
		slavery.15 # Bookkeeping - Slave Traders
		slavery.20 # Dealing with out-of-place slaves
		slavery.299 #AI slavery action even
		slavery.1010 # Slave pit in a non-capital holding!
		slavery.259 #Yearly AI slave management
		slavery.701 #unsullied training finished
		
		#Kingsguard
		kingsguard.16 #KG Maintenance
		#kingsguard.15   #no women in the kingsguard
		kingsguard.76 #Loan Kingsguard?
		kingsguard.24 #Kingsguard family at war with the king.
		
		#Religion
		religious.6 #Most Devout Counter
		#religious.1.2 #Converting away from religion removes religion specific traits
		
		#Piracy
		pirate.13 #Tyroshi/Lysene Patrician decides to go pirate
			
		# Dynastic Claim Checks
		traditional_claims.2 		#Gain claim on King's Landing
		traditional_claims.14		# Blackwood/Bracken
		
		# Ruins/colonisation
		unoccupied.201 #Ruin maintenance
		unoccupied.203 #Sub barony ruin maintenance
		
		#White Walkers
		cold_winds.201  #White Walker/Winter wasteland maintainence
		cold_winds.203 #Cull excess White Walkers/Winter Wastelands
		
		#Essos
		volantis.1 #Triarch election
		free_cities.8 #Braavos Unloacking feat		
		free_cities.1027
		free_cities.1028
		free_cities.1029 #Prince of Pentos deflowers maids
		free_cities.9 #courtesan gains trait at 16
		free_cities.10 #courtesan loses trait at 43 when daughter recieves trait
		free_cities.11 #courtesan automatically has daughter to continue the line
		free_cities.12 #courtesan automatically move to Braavos
		free_cities.11027 #Princes of Lorath
		
		essos.1 #brindlemen pygmies
		essos.449 #lengi courtier maintenance
		essos.47 #hyrkooni son is of age, potential gelding
		essos.52 #hyrkooni courtier maintenance
		essos.151 #The Scourge
		essos.154 #The Scourge
		essos.159 #The Scourge
		far_east.6 #Strong ruler of asshai decides unite shadowlanders
		far_east.9 #You control all of Asshai, establish a monarchy?
		
		#Education		
		knight.18 #Squire Knighted
		reeducation.199 #Choose education path
		reeducation.7 #Courtier Education Trait
		reeducation.8 #Steward Education Trait
		reeducation.9 #Martial Education Trait
		reeducation.10 #No Education Trait
		
		#Dothraki/Jogos Nhai
		dothraki.203 #Dosh Khaleen Maintenance
		dothraki.700 # Dothraki child is now old enough for their first horse	#
		dothraki.820 #Force the AI to consider using raids 
		
		#Mega Wars
		mega_wars.21 #AI vassal control
		mega_wars.2191 #AI dragon rider control
		mega_wars.60 #Courtier is related to an enemy
		mega_wars.96 #Vassal is harbouring exiled pretender
		mega_wars.105 # Check player actually sends help in the war
		mega_wars.903 #check independent lower tier characters
		
		#Childhood Development
		ZE.13999 # Conclave Random list event (NOTE: also checked non-randomly at on_adulthood)
		1999 #Non-conclave childhood traits master event
		
		#Scenario Events
		game_of_thrones.1 #Viserys and Daenerys go to Pentos
	}
	random_events = {
		#Lifestyles
		40 = 200000
		40 = 200001
		40 = 200002
		40 = 200003
		40 = 200004
		40 = 200005
		40 = 200006
		40 = 200007
		40 = 200008
		40 = 200009
		40 = 5040
		40 = 5060
		
		# Feudal Life Events
		100 = 4000
		100 = 4005
		100 = 4010
		10 = 4015
		100 = 4020
		100 = 4035
		100 = 4036
		100 = 4040
		#100 = 4041
		100 = 4045
		100 = 4050
		100 = 4055
		100 = 4060
		100 = 4085
		#100 = 4110 moved to feast events
		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
		100 = kingsguard.67 #KG take on lover?
		
		#Job Flavour Events
		#100 = 75010 #Lord Spiritual finds a heretic
		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
		25 = 75110
		100 = 75120
		100 = 75010

		#Dynasty requests
		250 = 66000
		250 = 66099 # Landless claimant asks dynasty head to press the claim in a war
		
		#Hedge Knights Events
		100 = 71000 
		
		#Rumours Events
		10 = 69000
		10 = 69003 
		10 = 69010 
		#10 = 69014 
		10 = 69016
		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 #orthodox bishop in jail
		
		#Bastard Events
		100 = 76000
		100 = 76005
		100 = 76010
		#100 = 76015
		50 = 76020
		100 = 76025
		100 = 76030
		100 = 76035
		100 = 76040
		
		#Ward Events
		100 = 78000
		100 = 78005
		100 = 78010
		100 = 78015
		100 = 78018
		100 = 78025
		100 = 78030
		100 = HL.10610
		
		# #Various Events #FLAG
		# 100 = 100019
		# 100 = 100024 
		150 = 37250 #Wife of same education offers to help
		
		# 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
		
		# Way of Life events
		100 = WoL.12506 # Legendary Wisdom
		100 = WoL.12507 # Respected Ruler
		
		# 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
		
		# Horse Lords Mercenary Events
		150 = HL.10100
		150 = HL.10200
		150 = HL.10210
		150 = HL.10220
		150 = HL.10230
		150 = HL.10240
		150 = HL.10250
		150 = HL.10260
		150 = HL.10270
		50 = HL.10400
		25 = HL.10410
		10 = HL.10500
		150 = HL.10510
		150 = HL.10600
		
		# Wolf's Blood events
		100 = HL.1010 # Wolf Child found in woods
		100 = HL.1020 # Child lost in woods and is rescued by wolves
		500 = HL.1200 # Call of the Wolves
		#500 = HL.1300 # The Lost Cub
		150 = HL.1400 # Werewolf first occurrence
		1500 = HL.1401 # Werewolf subsequent occurrences
		
		300 = HL.1500 # Become cannibal
		300 = HL.1510 # Howl at the moon
		300 = HL.1520 # Hunter instinct strikes unexpectedly (and awkwardly) at court
		300 = HL.1530 # Hunter instincts in martial training (upgrade martial education)
		300 = HL.1540 # Become strong
		300 = HL.1550 # Cunning as a wolf (quick)
		300 = HL.1560 # Animal instincts take over... (lustful)
		300 = HL.1570 # Pack instinct (gregarious)
		300 = HL.1580 # Wolf is brave (brave)
		300 = HL.1590 # Animal cruelty (cruel)
		300 = HL.1610 # Rabid wolf (wroth)
		300 = HL.1620 # Wolf-face (ugly)
		300 = HL.1630 # Animal mind (lower learning trait level) 
		300 = HL.1640 # Really howl at the moon! (lunatic)
		
		# # Horse Lords Horse Events
		800 = HL.6010 # Ward can't ride yet
		100 = HL.6020 # Dangerous river crossing - save spouse or favorite horse?
		100 = HL.6030 # A loyal retinue warrior's family have lost their horses to sickness
		100 = HL.6510 # Your horse gets bitten by another horse
		100 = HL.6520 # Foreign portrait painter offers his services
		
		# Zeus Disobedient Daughter Events
		2000 = ZE.1300 # Disobedient daughter asks to marry lover
		
		# Zeus Councillor Random Events
		300 = ZE.4000 # Marshal suggests new commander
		#300 = ZE.4010 # Marshal wants to do experiments with new weaponry
		200 = ZE.4100 # Marshal on mission turns against liege
		100 = ZE.4120 # Marshal - abuse of office, runs protection racket in province
		
		100 = ZE.5000 # Zealous Lord Spiritual asks to go and proselytize among heathens
		200 = ZE.5010 # Zealous Lord Spiritual insists in building more temple holdings, willing to donate own money
		300 = ZE.5020 # Lord Spiritual on mission turns disloyal
		100 = ZE.5030 # Lord Spiritual - abuse of office - charges money from populace for godly favor
		500 = ZE.5040 # Craven or Cynical Lord Spiritual complains about dangerous mission to convert heathens
		
		
		#100 = ZE.3000 # Steward takes loan to cover up incompetence
		100 = ZE.3002 # Steward makes extra money because of high stewardship
		100 = ZE.3004 # Steward offers to make statue for liege
		100 = ZE.3011 # Steward offers to teach liege 
		
		100 = ZE.2060 # Councillor steals money from the realm coffers
		
		100 = ZE.2020 # Chancellor tries to teach ruler foreign languages
		100 = ZE.2030 # Chancellor sets up bureaucratic scheme to get hearings with the ruler
		
		100 = ZE.2070 # Spymaster uses realm spynetwork to blackmail people
		100 = ZE.2075 # Spymaster tries to improve spy defenses

		#Alliance events
		100 = ZE.8000
		100 = ZE.8010
		300 = ZE.9100

		#Favor events
		100 = ZE.8100 # Drank too much and fell
		100 = ZE.8110 # Vassal arguing with spouse
		100 = ZE.23000 # Councillor is Overburden with Work
		100 = ZE.23005 # Troublesome Peasants
		100 = ZE.22300 # Pardon a young noble
		200 = ZE.22400 # Voter saves another voters face at a Council Meeting
		200 = ZE.22500 # Godly voter shows you how to be more pious
		100 = ZE.22601 # Ask foreign voter for help
		200 = ZE.22700 # Give land to an unlanded friend for a favor
		200 = ZE.22850 # Offer to train your Liege's commanders
		100 = ZE.8115 #AGOT:#Females have an interesting alternative way of getting favors
		
		#Dynamic mercenary events
		40 = ZE.23150 # Band Leader Speaks Highly of Employer
		
		#Female councillors
		100 = 77777 # Visit from talented woman
		#100 = 77790 # Female relative wants to get on council
		#150 = 77760 # Female vassal wants to get on council

		#End of days events
		25 = RIP.14000
		
		#Chess with death
		2 = RIP.30220
		
		#Immortal vassal crisis
		25 = RIP.30300
		25 = RIP.30315
		50 = RIP.30318
		
		#Gamebook
		100 = GBC.1 # Making a friend in mourning
		
		#Physician Flavor events
		100 = RIP.4010 # Court Physician recommends that you "Take it Easy"
		100 = RIP.4011 # Court Physician gifts you a guide dog
		200 = RIP.4013 # Court Physician suggests fertility treatment
		100 = RIP.4020 # Court Physician Friend teaches you medicine
		100 = RIP.4022 # Court Physician suggests you implement provincial apothecaries (prosperity boost)
		100 = RIP.4030 # Court Physician asks for patronage
		100 = RIP.4040 # Court Physician training event
		200 = RIP.4100 # A Physician-Missionary arrives in a Tribal or Nomadic Court
		
		#Random Prosperity Increasing Events
		125 = RIP.4300 # Steward suggests building new roads
		125 = RIP.4301 # Lord Spiritual suggests building shrines
		125 = RIP.4302 # Marshal suggests building outposts
		125 = RIP.4303 # Spymaster suggests setting up local messenger stations
		125 = RIP.4304 # Chancellor suggests sponsoring local harvest festivals
		125 = RIP.4305 # You decide upon personally visiting a province
		
		#Maimed Flavor events
		100 = RIP.29100 # Disfigured events
		100 = RIP.29200 # One-eyed events
		100 = RIP.29300 # One-handed events
		100 = RIP.29400	# One-legged events
		100 = RIP.29511 # Close relation taking care of you
		
		#Hospital events
		100 = RIP.4501 # Pilgrim physician arrives
		100 = RIP.4504 # Perform charity
		100 = RIP.4512 # Religious heads demand money for hospital presence
		75 = RIP.4514 # Leper arrives at court
		100 = RIP.4520 # Soup kitchen is damaged
		100 = RIP.4530 # Court physician seek learning at hospital
		
		#Pet events
		100 = 77850 # Cat event tombola
		150 = 77860 # Cat makes you happy
		10 = 6360 #Mittens

		#Monks and Mystics events
		#50 = MNM.9000 # Artifact rumor
		#50 = MNM.3910 # Commission painting
		30 = MNM.7829 # AI-only disciple recruitment

		#Artifact events
		#500 = MNM.9816 # Blessed Mantle allows you to make Water of the Blessed Mantle (-> logic)

		#Jade Dragon events
		3 = JD.20000 # Visit by Chinese councilor
		# 150 = JD.30000 # Traders acting dishonest
		3 = JD.10009 # Courtier offers to visit the Western Protectorate
		# 200 = JD.30010 # Courtier from Chinese court compliments/berates
		# 25 = JD.60000 # Envoy from China offers trade for artifacts
		# 150 = JD.70000 # Escaped Chinese Noble
		# 200 = JD.10030 # Gifted refugee appears
		10 = JD.20039 # Acquire foreign commander
		#150 = JD.7000 # Chinese Teacher visits
		#150 = JD.7010 # Radhanite Merchant asks for money
		
		#20 = JD.2100 # Chance of Religious Liberation CB
		
		#150 = JD.4100

		# Holy Fury Flavor
		200 = HFP.1 # Giant-trait character gains Frail or Brawny
		200 = HFP.4 # Giant-trait character gets health problems
		100 = HFP.30000 # Family member confronts you about your drinking
		20 = HFP.30010 # Giant-trait character keeps hitting their head on doorways
		100 = HFP.30020 # Court Physician offers you a potion that might stop you being depressed
		1 = HFP.30100 # Meteorite Falls
		#150 = HF.46000 # Booming saint tomb burial site
		#150 = HF.46001 # Inspired by Local Saint
		#150 = HF.46010 # Pillage Local Saintly Burial Site
		
		# Holy Fury Bloodline Events
		350 = HF.110 # Gain Sympathy for Founder religion
		200 = HF.120 # Chance of gaining a personality trait of Founder
		#300 = HF.43000 # Chance for zealots to help aid your cause
		#200 = HF.43200 # Chance for Great Theologian to join your Court
		#150 = HF.43300 # Frenzied zealots at your capital
		#150 = HF.43400 # Monk Society helping out
		
		# Former MTTH Events
		50 = SoA.5219 # Donate to local monastery - Formerly 2000 month MTTH
		2000 = 63050 #former MTTH event

		#Wonder Flavor Events 
		100 = LT.20001 # Lost Book event chain, 
		100 = LT.60101 #Library lets you write cooler book
		100 = LT.60301 #Tavern lets you blow off stress
		100 = LT.60501 #Opinion boost from your liege if you have a wonder in your province
		100 = LT.60601 #A part of the wonder has fallen off!
		100 = LT.60701 #Chance to pick some cool herbs
		
		health = {
			delay = 15
			25000 = 0
			
			15 = 6000 # Syphilitic
			15 = 6001 # Remove Syphilitic
			6 = 6020 # Lunatic
			20 = 6021 # Remove Lunatic
			6 = 6030 # Possessed
			6 = 6031 # Remove Possessed
			150 = 6040 # Stressed
			210 = 6041 # Remove Stressed
			25 = 6050 # Depressed
			210 = 6051 # Remove Depressed
			1010 = 6063 # Meta ill
			30 = 6080 # Wounded
			1250 = 6082 # Illness from wound
			250 = 6100 # Infirm
			2500 = 6110 # Incapable
			30 = 6464 #Greyscale
			4000 = 6470 # Maimed to Crippled
			300 = 6471 # Old Age Blindness
		}
		
		ambition_events = {
			delay = 60
			220 = 0
			
			50 = 94010
			50 = 94126
			
			10 = 94000
			10 = 94005
			#10 = 94010
			10 = 94016
			10 = 94017
			10 = 94018
			10 = ambition.940
			10 = 94050
			10 = 94065
			10 = 94070
			10 = 94072
			10 = 94073
			10 = 94074
			10 = 94080
			10 = 94098
			#10 = 94100
			10 = 94102
			10 = 94107
			10 = 94108
			10 = 94109
			10 = 94110
			10 = 94125
			10 = 94130
			10 = 94138
			10 = 94139
			10 = 94156
			10 = 94140
			10 = 94160
			10 = 94165
			10 = 94169
			10 = 94172
			10 = 94173
			#10 = 94170
			#10 = 94175
			#10 = 94180
			#10 = 94185
			#10 = 94186
			#10 = 94187
 		}
				
		yearly_child_of_destiny_chance = {
			9999 = 0
			1 = HF.199
		}
		regency_events = {
			delay = 23
			10000 = 0
			
			480 = 61000 # Regent embezzles money
			430 = 61105 # Regent gives Ruler's money to charity
			670 = 61110 # Regent is a better administrator
			320 = 61120 # Regent humiliates Ruler
			320 = 61135 # Ruler, if child, kills Regent
			350 = 61140 # Regent attempts to declare ruler insane when he's not
			500 = 61141 # Regent attempts to declare ruler insane
			670 = 61165 # Ruler escapes from tower
			500 = 61190 # Regent sends ruler to scrub roof
		}
		vassal_requests = {
			delay = 15
			100 = 0
			100 = 37000 # Relative demands inheritance due to his ambition
			500 = 37350 # Targaryen/Blackfyre heir to Iron Throne demands Dragonstone
			10 = 37056 # Male relative who was denied decides to marry in secret
			100 = free_cities.233 # Bearded Priest demands land
			200 = 63000 # Vassal believes his liege should transfer a vassal title
			2 = 63010 # Vassal asks liege to get rid of a rival
			10 = 63040 # Vassal asks liege for a specific title
			1 = 63060 # A mayor asks for lower taxes
			8 = 63076 # Vassal believes his liege should make him Lord Paramount
			1 = vassal_request.40 #vassal demands a command
		}
		#################
		####AGOT events####
		#################
		
		250 = 450 #courtier initiates romance with their liege
		125 = 371 # A courtier initiates romance with another courtier
		#250 = 190083  #Fall in love with concubine
		#150 = dishonorable.1 #assassin excomm
		150 = dishonorable.2 #Assassin goes nuts
		150 = dishonorable.3 #Assassin goes nuts
		#150 = 190041 #ruler goes native, not high valyrians
		#150 = 220004 #concubine pregnant
		#2000 = 190020 #Septon demands return of b_great_sept_of_baelor	
		#2000 = 190072 #AI employs concubine
		#50 = 312 #diligent
		
		50 = 76102 #Lord's Right
		25 = 76110 #First Night
		50 = 250910 #cyvasse event
		200 = knight.4 #too old to be a squire event (oga)
		#100 = 150195 #wife is old, looking for lover (oga - modified from Vanilla.)
		100 = 3726 #Jorah Mormont inpsired event
		10 = nightswatch.16 #Ranger finds wildling infant
		50 = pirate.21 #Corsair visits Skull island
		20 = dynasty.47 #Rich commoner offers marriage in exchange for large dowry
		100 = fire_obsessed.5 #Drive off winter with wildfire!
		25 = dothraki.815 #Trader caravan
		5 = old_races.9 #unicorns
		5 = old_races.12 #unicorns
		70 = TOG.1299 # AGOT Landless Adventurer Master Event
		100 = WoL.10649 #Setup a brothel
		100 = court.54 #wife asks for handmaiden
		100 = court.63 #wife asks for handmaiden
		50 = wildling.11 #find a skinchanger	
		25 = WoL.5550 #AGOT Cruel huntsman event
		100 = dragon.180 #Dragon rider consort escapes
		50 = WoL.6550 #buy a book		
		100 = mourning.20 #Old and alone
		50 = REP.920 #Patrician family is poor and weak, sell palace to another family?
		25 = kingsguard.68 #Fellow KG finds out about lover
		150 = ZE.8160	# NPC AI obtain random favors
		
		#Dynastic Rivalry
		100 = dynastic_rivalry.199 #Dynastic Feud start
		100 = dynastic_rivalry.100 #Dynastic Feud start (independent rulers)
		100 = dynastic_rivalry.990 #Dynastic Feud reconcile
		100 = dynastic_rivalry.40 #Argument on the council
		
		#Flavour Events.txt		
		50 = flavour_events.1 # Wake up next to your 'partner'...
		50 = flavour_events.8 # Stacy's mum has got it going on
		50 = flavour_events.25 #Winterfell blue roses
		20 = flavour_events.30 #Leviathans
		100 = flavour_events.35 #Build a wine cellar?
		900 = flavour_events.200 #Your Son is Craven
		
		#Ironborn events
		50 = ironborn_events.1 #Drowned man offers to bless ship
		50 = ironborn_events.2  #Crazy man babbles about voyage to Sunset Sea
		25 = ironborn_events.3  #Low tide reveals ancient Longship
		50 = ironborn_events.13	#Son pays ironprice?
		2 = ironborn_events.62	# Salt wife (or abducted consorts) trys to murder husband
		50 = kingsmoot.2299  #Challenge fellow candidate to a duel
		2 = kingsmoot.28 #New Pretender Claim Descent from iron King
		
		#Essos events
		5 = essos.27 #Gift Zorse
		50 = essos.39 #Yi Ti provinces plagued by basilisks
		100 = volantis.576 # Enemy family has chance to deface statue
		50 = essos.51 #Hyrkooni adopt a son?
		50 = essos.100 #Northern Lights
		2 = essos.103 #Ice Dragon
		5 = essos.115 #Thousand Islanders
		
		#Free City Events
		100 = free_cities.226 #Noble sells child to priests
		100 = free_cities.229 # Bells of Norvos
		100 = free_cities.230 # Bearded priest demands execution of black goat worshipper
		100 = free_cities.300 #Lysene Patron God
		
		#AGOT religious events
		100 = 39299 #Seven Icon
		5 = religious.50 #Outlaw Prostitution?
		5 = religious.54 #Donate bread to the poor?
		5 = religious.55 #Take a Septon's vows?
		50 = religious.57 #Replace ravens with doves
		50 = religious.59 #Chastity Belts!
		50 = religious.61 #Book Burning
		
		#Life at court events
		100 = lifeatcourt.1 #Fake Valerian Sword Saga - Teen Life (Ages 14-22)
		100 = lifeatcourt.8 #Bully Saga - Growing up (Ages 8-17)
					
		6000 = 0 # Chance of no yearly event
		
		ai_marriage = {
			6000 = 0
			2500 = maintenance.6 #AI marriage maintenance
		}	
		accomadations = {
			delay = 4
			6000 = 0
			6000 = 50005 #request better accomadations
		}
	}
}


#character
on_bi_yearly_pulse = {
	events = {
		TOG.3005 # Lose Berserker Trait when too old
		SoA.5300 # Christian becoming a wicked priest
		#SoA.5301 # Muslim becoming a wicked caliph
		SoA.5302 # Norse becoming an unworthy priest
		#SoA.5303 # Tengri becoming an unworthy priest
		SoA.5304 # Zoroastrian becoming an immoral priest
		#SoA.5305 # Aztec becoming an unworthy priest
		RIP.11700 # Prosperity system
		63106 # (Safety flag clearance check event)
		
		###Low prio maintenance###
		#AI objective management
		maintenance.12 #plot_check
		maintenance.13 #abort_plot
		maintenance.14 #obj_check
		maintenance.15 #abort_obj
		
		#Misc
		#maintenance.29 #Independent characters somehow ending up with no demesne #FIXED by patch 2.2
		slavery.308 #Slave breeding impregnation chance
		#190057 #warned_about_landless
		cadet.10 #Cadet house opinions
		cadet.16 #AI find cadet house to legitimise
		valyria.1 #Valyrian election
		dothraki.204 #Rename held titles after owner
		
		#AI actions	
		maintenance.16 #AI selects a bodyguard
		maintenance.17 #AI selects a city watch commander		
		maintenance.18 #AI fires a city watch commander
		interaction.31 #AI visits chambers
		#interaction.25 #AI send gift
		maintenance.7 #AI gives honorary title
		wildling.60 # Wildling invasion AI check
		imprisoned.1 #imprison enemies/foes
		#dragon.74 #AI Dragon rider declare war?
		#maintenance.67 #AI finds allies
		dragon.200 #Character with ambition finds dragon to tame
		
		#Dothraki
		#dothraki.415 #AI selects a Bloodrider
		
		faction_event_new.84 #Ai evaluate loyalist faction membership
	}
	
	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
		1 = 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
		
		#Character Improves Steward/Diplomat/intrigue Education
		20 = 65161
		20 = 65162
		20 = 65163

		#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 = 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
		
		#Voice of "Jesus"
		2 = 6200
		20 = 6201
		20 = 6202
		20 = 6203
		20 = 6204
		20 = 6205
		20 = 6206
		20 = 6207
		20 = 6208
		20 = 6209
		20 = 6210
		20 = 6211
		20 = 6212
		20 = 6213
		20 = 6214
		20 = 6215
		20 = 6216
		20 = 6217
		20 = 6219
		20 = 6220
		20 = 6221
		20 = 6222
		
		#Voice of "Satan"
		2 = 6223
		20 = 6224
		20 = 6225
		20 = 6226
		20 = 6227
		20 = 6228
		20 = 6229
		20 = 6230
		20 = 6231
		20 = 6232
		20 = 6233
		20 = 6234
		20 = 6235
		20 = 6236
		20 = 6237
		20 = 6238
		20 = 6239
		20 = 6240
		
		#SoA events
		10 = SoA.5203 # Misplaced relic
		200 = SoA.5204 # Relic is stolen by raider
		10 = SoA.5205 # Relic mixed up with other bones
		250 = SoA.5206 # Use relic to heal sickness?
		25 = SoA.5207 # Bring relic out to bless the fields
		10 = SoA.5209 # Donate owned relic to church?
		200 = SoA.5410 # Tolerant character making friend
		200 = SoA.5411 # Tolerant character making friend
		200 = SoA.5412 # Tolerant character making friend
		200 = SoA.5413 # Tolerant character making friend
		200 = SoA.5414 # Tolerant character making friend
		200 = SoA.5420 # Zealous character insults other religions
		
		#Friends/Rivals events
		20 = friends_rivals.232
		20 = 100190
		20 = 100200
		20 = 100210
		20 = 100220
		20 = 100230
		20 = 100240
		20 = 100250
		20 = 100260
		20 = 100400
		20 = 100450
		20 = 100460
		20 = 100470
		20 = 100480
		20 = 100490
		20 = 100530
		20 = 100540
		40 = friends_rivals.5
		
		#Republic Trade Events
		120 = REP.400 # Family member marries burgher daughter (AI)
		80 = REP.404 # Family member marries bar wench/peasant girl/rich girl (AI)
		50 = REP.408 # Old family member marries young woman (AI)
		50 = REP.410 # Young family member marries older woman 
		50 = REP.412 # Family member marries foreign woman
		
		20 = TOG.3009
		
		#AGOT events
		10= flavour_events.210 #Dead men walking 1
		5 = flavour_events.211 #Dead men walking 2
		3 = 250850 #bandits event					
		6 = wikid.250  #Character decides to go abroad on adventure
		34 = TOG.3109  # Son wants to join the Varangians (Son) #AGOT: adapted for merc company adventures
		25 = slavery.3000 # A character becomes a liberator
		10 = iron_throne.30 #Cut on the Iron Throne
		25 = nightswatch.120 # Donate New Gift to Night's Watch?
		200 = invasions.602 #Blackfyre joins golden company
		40 = pirate.55 #smuggle past east watch
		40 = pirate.65 #smuggle in province
		25 = MNM.9972 #Artifact stolen
		500 = MNM.9990 #AI sells artifact
		
		2000 = 0 # Chance of no bi-yearly event
		
		# reevaluate_loyalty = {
			# delay = 4
			# 10 = plot_event.27 #reevaluate bought loyalty relationship
			# 500 = 0
		# }
		valyrian_free_city = {
			delay = 6
			500 = valyria.48 # Valyrian Vassal requests free city status
			1500 = 0
		}
	}
}

#character
on_five_year_pulse = {
	events = {
		GR.1
		MNM.10031 # Have AI characters join societies
		HF.20375 # Catholic/Fraticelli Kings/Emperors who have not been crowned will receive random negative events.
		HFP.20604 # Hidden check for physique_variable.
		HF.99 # Legendary warrior arrives
		HF.10050 # Warrior Lodges: Maintenance: AIs joins available warrior lodges
		HF.21997 #AI picks Antagonizing target.
		HF.21998 #AI picks Swaying target.
		HF.24129 # Knights and Bards arrive.
		HF.24132 # Lady seeks protection.
		HF.24236 # Artists arrive.
		
		slavery.2500 #force the AI to consider using slave raids
		unoccupied.18 #AI colonisation prompt
		faceless.12 #Faceless men pay tax
		maintenance.69 #merc company accounting
		traditional_claims.200 #Establish new dynastic claim
		bankruptcy.21 #Bank society bookkeeping
		religious.95 #God King opinion effects
		religious.102 #authority for controlling a large empire
	}
	random_events = {
		#----  misc traits needing revision below...
		
		#Brave
		6 = 3320
		6 = 3325
		6 = 3330
		6 = 3335
		#6 = 3740
		
		#Shy
		6 = 3340
		6 = 3345
		6 = 3350
		6 = 3355
		
		#Ambitious
		6 = 3360
		6 = 3365
		6 = 3370
		6 = 3375
		#6 = 3371
		
		#Content
		6 = 3380
		6 = 3385
		6 = 3390
		6 = 3395
		#6 = 3745
		
		#Arbitrary
		6 = 3400
		6 = traits_effects.100
		6 = 3410
		6 = 3415
		#6 = 3411
		
		#Just
		6 = 3420
		6 = 3425
		6 = 3430
		6 = 3435
		
		#Cynical
		6 = 3440
		6 = 3445
		6 = 3450
		6 = 3455	
		#6 = 3456		
		
		#Zealous
		6 = 3460
		6 = 3465
		6 = 3470
		6 = 3475
		#6 = 3476
		#6 = 3750
		#6 = 3755

		#Trusting
		6 = 3500
		6 = 3505
		6 = 3510
		6 = 3515
		
		#Personality Traits
		6 = 1499
		6 = 1000
		6 = 1001
		6 = 1002
		6 = 1003
		6 = 1004
		6 = 1005
		6 = 1006
		6 = 1007
		6 = 1008
		6 = 1009
		6 = 1010
		6 = 1011
		6 = 1012
		6 = 1013
		6 = 1014
		6 = 1015
		6 = 1016
		6 = 1017
		6 = 1018
		6 = 1019

		#Zoroastrian pets
		#1 = ZP.1

		#Crown events.
		10 = HF.20399
		10 = HF.20400

		#Physical shape events.
		2 = HFP.20605 #Character is getting fat
		5 = HFP.20628 #Character is getting malnourished
		10 = HFP.20647 #Health complications - Fat
		10 = HFP.20648 #Health complications - Malnourished
		10 = HFP.20649 #Help from friend
		
		2 = HFP.20801 #Character becoming Groomed due to Focus.
		2 = HFP.20802 #Character becoming Uncouth due to Focus.		
		
		#10 = 1060
		#10 = 1070
		#10 = 3264
		#10 = 3730
		#10 = 3735
		
		#SoA events
		2 = SoA.5210 # Monks make fantastic beer
		2 = SoA.5211 # Monks make great wine
		4 = SoA.5212 # Monks have healing herbs
		1 = SoA.5213 # Monk is fantastic painter
		1 = SoA.5214 # Monks produce beautiful books
		1 = SoA.5215 # Local monks come to visit often
		2 = SoA.5219 # Donate to local monastery
		1 = SoA.5241 # I saw the Virgin
		2 = SoA.5341 # Donate to Quiet Isle
		
		#Polished new trait events;
		10 = misc_traits.33 #Mid-life Fashion Event
		10 = misc_traits.34 #Mid-life Authoritative Event
			
		100 = knight.1 #Becoming a knight event (oga)
		
		#Nicknames for landless
		3 = nicknames_wildlings.1
		1 = nicknames.0
		1 = nicknames.1
		1 = nicknames.2
		1 = nicknames.3
		1 = nicknames.4
		1 = nicknames.5
		1 = nicknames.6
		1 = nicknames.7
		1 = nicknames.8
		1 = nicknames.9
		1 = nicknames.10
		1 = nicknames.11
		1 = nicknames.12
		1 = nicknames.13
		1 = nicknames.14
		1 = nicknames.15
		1 = nicknames.16
		1 = nicknames.17
		1 = nicknames.18
		1 = nicknames.19
		1 = nicknames.20
		1 = nicknames.21
		1 = nicknames.22
		1 = nicknames.23
		1 = nicknames.24
		1 = nicknames.25
		1 = nicknames.26
		1 = nicknames.27
		1 = nicknames.28
		1 = nicknames.29
		1 = nicknames.30
		1 = nicknames.31
		1 = nicknames.32
		1 = nicknames.33
		1 = nicknames.34
		1 = nicknames.35
		1 = nicknames.36
		1 = nicknames.37
		1 = nicknames.38
		1 = nicknames.39
		1 = nicknames.40
		1 = nicknames.41
		1 = nicknames.42
		1 = nicknames.43
		1 = nicknames.44
		1 = nicknames.45
		1 = nicknames.46
		1 = nicknames.47
		1 = nicknames.48
		1 = nicknames.49
		1 = nicknames.50
		1 = nicknames.51
		1 = nicknames.52
		1 = nicknames.53
		1 = nicknames.54
		1 = nicknames.55
		
		#Dragon Nicknames
		4 = dragon.90
		
		40 = 0
		
		excess_traits = {
			delay = 10
			60 = 1025 #Remove excess traits
			60 = 0
		}
	}
}

#character
on_decade_pulse = {
	events = {
		RIP.10031 # clear global flags from bubonic plague
		HF.23400 # Astrology + Haruspicy = Religious Head reads the stars.

		religious.63 #Weirwood Growth
		ironborn_events.91 #flagship retired
	}
	random_events = {
		40 = SoA.4020 #former MTTH event
		100 = 0
		#Late life health complications
		200 = HFP.20661
		200 = HFP.20662
		100 = HF.23404 #  Astrology + Haruspicy + No Religious Head: Court Chaplain occasionally reads the signs.

		#forged_bloodlines = {
			#50 = HF.24200 # Chance to claim Alexander the Great's Bloodline.
			#50 = HF.24220 # Chance to claim Ashoka's Bloodline.
			#7900 = 0
		#}

		eldership_succession = {
			15 = HFP.24002 #Pleased Elder moves in.
			15 = HFP.24004 #Grumpy Elder moves out.
			5 = HFP.24006 #Happy Elder suggests County grant.
			45 = HFP.24010 #Grumpy Elder suggests County grant.
			5 = HFP.24014 #Pleased Elder feels lonely.
			3 = HFP.24016 #Grumpy Elder fabricates claim against ruler.
			2 = HFP.24020 #Ecstatic Elder praises ruler.
			1 = HFP.24022 #Ecstatic Elder mentors ruler.
			150 = 0
		}
		
		horse_prophecy = {
			delay = 128
			40 = HF.6 # A Prophecy foretold
			890 = 0
		}
	}
}

# For characters older than AGE_CHILDHOOD_PULSE but not an adult as defined by ADULT_AGE_FEMALE and ADULT_AGE_MALE
on_yearly_childhood_pulse = {
	events = {
		HFP.20057 # Hollow Child nickname.
		HF.302 # Child of Destiny gets extra stats
	}
	random_events = {	
		100 = knight.2 #becoming a squire (8-16) (Oga)
		10 = foreign_training.1 # Braavosi Swordsman Traiing (Oga)
		10 = foreign_training.5 # Pentosi Magistrate Traiing (Oga)
		10 = foreign_training.7 # Tyroshi Diplomet Training (Oga)
		10 = skinchanger.1 # Skinchanger Chain starter (Oga)
		50 = old_races.3 #Children of the Forest offer to teach Wildling child with greensight
		5000 = RoI.10010 # Acknowledged reincarnated child acquires trait from previous personality
		4 = high_valyrian.25 # Child has dragon dreams

		4000 = 0
				
		bloodline_events = {
			100 = HF.24100 #Child is bored with his guardian.
			1000 = 0
		}
	}
}

# Yearly pulse (six months from on_yearly_pulse) intended for Focus events (only fires for characters with a Focus)
on_focus_pulse = {	
	events = {
	}
	random_events = {
		1000 = 0
		
		# Family Focus
		1250 = WoL.3019 #event generator
		
		# Theology Focus
		125 = WoL.7000 # Study religious myths?
		50 = WoL.7010 # Befriend priest through your religious interest
		50 = WoL.7020 # Visit holy site and speak with priests there (not Muslims, Christians, Jews or Indians)
		50 = WoL.7030 # Reflect on own life and how it relates to the gods.
		50 = WoL.7040 # Theologian's view of other religions - can gain Sympathy for other faiths
		50 = WoL.7050 # Question own faith - can gain Cynical or Zealous
		#50 = WoL.7060 # Embrace heresy? Zealous characters only. Can lose the trait or become heretic.
		100 = WoL.7070 # Embrace theologian lifestyle?
		50 = WoL.7080 # Mystical experience - lose Depressed and Stressed
		50 = WoL.7090 # Meditation/Prayer in Seclusion - Go into hiding for a week. Lose Drunkard, Gluttonous and Lustful and possible gain Temperate and Chaste (depending on religion). Tiny Chance of restored eyesight or cured illness.
	
		# Hunting focus
		100 = WoL.5000 # Epic Hunt chain start
		50 = WoL.5200 # Receive hunting dog
		100 = WoL.5210 # Dog makes you happy
		100 = WoL.5211 # Dog makes you popular
		100 = WoL.5220 # Train your dog?
		100 = WoL.5230 # Bad dog kills other dog
		100 = WoL.5231 # Bad dog kills or wounds courtier
		40 = 5040 #Falconer event
		
		# War Focus
		60 = WoL.11300 # Improved martial education
		60 = WoL.11301 # Leader Trait gained: Troop type specialist
		60 = WoL.11302 # Leader Trait gained: Terrain/climate specialist
		60 = WoL.11303 # Leader Trait gained: Battle tactics
		60 = WoL.11304 # Leader Trait gained: Inspiration, logistics and sieges
		60 = WoL.11305 # Leader Trait gained: Offense vs Defense
		60 = WoL.11310 # Teach a commander one of my leader traits
		
		# Intrigue Focus
		75 = WoL.2300 # Your spymaster is plotting!
		
		# Rulership Focus
		40 = WoL.12000 # The Architect
		7 = WoL.12010 # Depressed
		7 = WoL.12011 # Stressed
		50 = WoL.12015 # The Murders
		20 = WoL.12025 # Noble Feud
		40 = WoL.12027 # Farm Fire
		40 = WoL.12028 # Witch
		40 = WoL.12029 # Drunkard
		29 = WoL.12030 # City Brigands
		
		#Seduction Focus
		50 = WoL.509 # Flirting at confession
		50 = WoL.520 # Seduce handsome guard
		50 = WoL.530 # Seduce Maid
		50 = WoL.560 # Seduction of a bush
		50 = WoL.570 # Seduction of a centaur.
		50 = WoL.580 # Prisoner seduces guard
		33 = WoL.590 # Seduction of a Concubine
		
		#War Focus
		150 = WoL.11100 # Random event list
		
		#Scholarship Focus
		75 = WoL.6551
		
		#Business
		150 = WoL.10400 # Random event list
	}
}

### on combat pulse
#FROM is the character who is the commander of the opposing side
#FROMFROM is the character who is the LIEGE of the commander of the opposing side
on_combat_pulse = {
	events = { 
		nightswatch.22 #NW own wildlings when fighting on the wall.
		wildfire.138 #Use flame creatures?
		dragon.3199 #AI field of fire decision
		essos.1859 #AI rhoyne magic decision
		essos.1869 #AI stops dragons with water magic
	}
	random_events = {
		2650 = 0
		2650 = dragon.43 #Dragon Duel
		400 = HFP.11000 #tombola for battle events
		#2000 = MIL.500 #Milla's debug event

		#### Below: Outcommented - some remade, some moved into tombola.
		#### See HFP.11000 for more details....

		#15 = cold_winds.60 #Ice Spider
		#15 = cold_winds.62 #ice Spider attacks
		#15 = cold_winds.64 #Ice Spider
		#15 = cold_winds.66 #ice Spider attacks
	}
}

### on combat starting
#FROM is the character who is the commander of the opposing side
#FROMFROM is the character who is the LIEGE of the commander of the opposing side
on_combat_starting = {

}

#on siege pulse
on_siege_pulse = {
	events = {
		#dragon.38 #siegeoffire
		siege_agot.20 #waylit fight or flee - ruler
		siege_agot.21 #waylit fight or flee - courtier
		#unoccupied.20 #Instantly end colony sieges
		unoccupied.21 #colony siege warning
		wildfire.909 #Use wildfire in defensive siege (member)
	}
	random_events = {
		200000 = 0
		#50 = 1059008 # Building sacked during siege
		75 = 62000 #defenders sally
		75 = 62001 #defenders sally
		75 = 62003 #defenders sally
		75 = 62004 #treachery
		75 = 62005 #treachery
		75 = 62006 #unsanitary
		75 = 62007 #food runs out
		75 = 62008 #food smuggled in
		75 = 62009 #bandits attack
		#75 = 62010 #tuscan raiders counter attacked
		#25 = 62014 #christians sally
		75 = 62015 #Ill, pneumonic, leper or syphilitic
		75 = 62016 #hornblower
		100 = essos.2 #Naath magic butterflies
		400 = essos.5 #Asshai'i use Shadow Baby on enemy siege leader
		75 = essos.7 #Warlocks cause disease in besiegers
		#1 = 62011	#christian, pagan heavy attrition
		#1 = 62012 #holy relic in city
		#1 = 62013 #muslims sally
		
		75 = knight.5 #battlefield promotion.
		2000 = plot_event.13 #bought councillor ends siege
		1000 = wildfire.9 #Use wildfire in defensive siege (non-member)
		7500 = siege_agot.23 #waylit siegeescape
		#300 = siege_agot.29 #tompalmer surrender event chain
		
		#1 = 62500 #Twenty Good men
	}
}

# any leader in battle on winning side (except the leader) is ROOT - opponent army leader is FROM
on_battle_won = {
	events = {
		#dragon.31 #fieldoffire
		battle.50 #inform player commander
	}
	random_events = {
		1030 = 0
		10 = 260 # Heroism shown
		10 = 261 # Soldier Distinguish himself.
		1 = 250278 # AGOT Find Valyrian sword!
		#100 = 8310 # Crusader becomes zealous
	}
}

# any leader in battle on winning side (except the leader) 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 = {
	events = {
	}
}

# 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 = {
	events = {
		RIP.15115 #EoD prophet loses
	}
}

# Any leader in battle on losing side (except the leader) is ROOT - opponent army leader is FROM
on_battle_lost = {
	events = {
		battle.51 #inform player commander
	}
	random_events = {
		1000 = 0
		70 = 250 # Imprisoned by the enemy
		#50 = 8320 # Crusader becomes cynical
		1 = 250279 # AGOT Lost Valyrian sword!		
	}
}

# Any leader in battle on losing side (except the leader) 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
	}
}

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

# The taken Holding title is in FROM.
on_siege_won_leader = {
	events = {
		#8330 # Conquers the crusade target
		#999900929  #mega wars capital tracking
		#999900932
		siege_agot.1 #Siege maintenance
		siege_agot.299 #Take prisoners
		siege_agot.4 #Release prisoners at location
		raid_events.66 #Take Salt Wife
		raid_events.67 #Take Sword
		TOG.10702 #Liberator frees slaves in camps	
		CM.10033 # Chronicle for certain major locations
		CM.10034 # Chronicle for certain major locations
		feast_for_crows.71 # Brotherhood without Banners sieges a province
		siege_agot.40 #inform player commander
	}
	random_events = {
		300 = 0
		1 = wildling.23
		#100 = 8340 # Finds the Spear of Destiny / Holy Lance
		#100 = 8342 # Finds the Holy Grail
		#500 = 8345 # Sack of Jerusalem
		
	}
}

#on_siege_lost = {
#
#}
# The province is in FROM
on_siege_won_leader_fort = {
	events = {
	}
}

# The province is in FROM
on_siege_won_leader_trade_post = {
	events = {
	}
}

# The taken Holding title is in FROM.
on_siege_lost_leader = {
	events = {
		#8350 # Loses the crusade target's capital
		#347800 #RobertReb
	}
}
# The province is in FROM
on_siege_lost_leader_fort = {
	events = {
	}
}

# The province is in FROM
on_siege_lost_leader_trade_post = {
	events = {
	}
}

# 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.10035 # Chronicle for certain major locations
		HL.2005 # Minor Nomad Clan rebels take county capital
		RIP.11702 # Prosperity lost when sieged
		RIP.11713 # Monument to Glory teardown
		HL.4813 # Nomads may pillage holdings on siege
		cold_winds.703 #others kill everyone
		#MNM.6222 # Assassins occupy holding
		MNM.7111 # Devil Worshipers desecrate holding
		MNM.9900 # Chance to steal artifact from capital holdings
		#HF.23473 # Destroy Tribal Great Pillar
		
		bankruptcy.170 #Loot bank after siege of province
	}
	random_events = {
		400 = 0 # Nothing happens
		#50 = HF.46020 # Taking Saintly Burial Site
		100 = slavery.3998 #Take slaves
	}
}

# Fires for the owner of the winning unit (ROOT) for forts. The province the siege was in is FROM.
on_siege_over_winner_fort = {
	events = {
	}
}

# Fires for the owner of the winning unit (ROOT) for forts. The province the siege was in is FROM.
on_siege_over_winner_trade_post = {
	events = {
	}
}

# 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
		200 = TOG.1190 # Rebels kill character
		400 = MNM.99729 #Artifact lost after siege
 	}
}

# Fires for all characters presumed to be in the province at the time for forts. Siege winner unit owner in the 'new_character' scope, province in FROM, local character in ROOT.
on_siege_over_loc_chars_fort = {
	events = {
	}
}

# Fires for all characters presumed to be in the province at the time for trade posts. Siege winner unit owner in the 'new_character' scope, province in FROM, local character in ROOT.
on_siege_over_loc_chars_trade_post = {
	events = {
	}
}

#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 = {
		#vengeance.2
 		163
 	}
}

# character
on_birth = {
	events = {
		birth.990 #Universal on birth event
	
		MNM.7508 # DW Demon child
		#MNM.1206 # A Child is born, Hermetic Scrying vision fulfilled
		#HFP.30030 # Apply freckles trait properly.
	}
	random_events = {
		200 = 0
		25 = RIP.29600 # Firstborn/first son reaction 
				
		child_of_destiny_chance = { # Chance of a newborn child becoming a Child of Destiny
			15000 = 0
			1 = HF.200
		}
	}
}

# character
on_adulthood = {
	events = {
		TOG.3260 #demon child reaches adulthood
		
		# Childhood Traits mature if they haven't yet
		ZE.13000 # Haughty
		ZE.13010 # Affectionate
		ZE.13020 # Timid
		ZE.13030 # Rowdy
		ZE.13040 # Willful
		ZE.13050 # Brooding
		ZE.13060 # Indolent
		ZE.13070 # Playful
		ZE.13080 # Conscientious
		ZE.13090 # Fussy
		ZE.13100 # Curious
		ZE.13110 # Idolizer
		
		# Resolve education and add trait
		ZE.14100 # Diplomacy
		ZE.14200 # Martial
		ZE.14300 # Stewardship
		ZE.14400 # Intrigue
		ZE.14500 # Learning
		ZE.14700 # Lack of focus
		
		SoA.3020 # Demon child's true nature asserts itself

		MNM.1269 # Horoscoped child gets new modifiers
		#MNM.4302 # Monastic Order education bonus purity effect

		HFP.20592 # Child of troubled pregnancy speaks to mother.
		#HF.23016 # Reformed pagans with no religious head pick their religious branch.
		HF.300 # Child of Destiny reaches adulthood
		HF.23775 # African adulthood rite.
		
		essos.60 #Summer Islander year at the temple of love
		HL.1040 # Wolf Child reaches maturity
		imprisoned.1 #imprison enemies/foes
	}
}

on_adolescence = { # Checked on 12th birthday.
	events = {
		ZE.12998 # Clear childhood event chain flags
		#MNM.3429 # Educator/guardian/parent with secret religion get a chance to convince child to convert secretly
		HFP.20058 # Hollow child special event

		reeducation.20 # Conclave version of reeducation.1
		maintenance.50 # Dragon fake education
	}
	random_events = {
		200 = 0
		1 = reeducation.23 # Child is a prodigy
	}
}

# baby scope
on_post_birth = {
	events = {
		313 # Possible complications for the mother and child
		#314 # Possible complications for the mother after stillbirth
		HFP.20555 # Clear all hard_pregnancy traits and flags.
	}
}

#character (at 2 months)
on_pregnancy = {
	effect = {
		if = { 
			limit = {
				ai = no
				NOR = { 
					any_courtier_or_vassal = { has_minor_title = title_appointed_regent } 				 
					has_dynasty_flag = pregnancy_regent_warning
				} 				
			}
			character_event = { id = HFP.20400 } 
		}
	}
	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!	
	 	HFP.20401 # Hidden event to set clock for regency during final months.
 		HFP.20556 # Umbrella event for positive pregnancy flavor.
		40299 # pregnancy after forced interaction

		dothraki.806	#Dothraki stallion heart ceremony
		dothraki.808	#Dothraki stallion heart ceremony		
 	}
}

#character
on_crusade_creation = {
	events = {
 	}
}

# 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
 		#HF.23777 # Doctrine close kin marriage
		CM.10023  # Chronicle entry
		#CM.10036 # Chronicle entry - primary heir
		#ZE.1015 # Disobedient daughter is unhappy with marriage
		ironborn_events.75 #salt child starts new dynasty
		dragon.99 #Ilyrio give dany eggs
		GBC.199 # Game book event, falling in love with someone else at marriage feast
		500992 # AI Marriage Evaluation
		45432 #Chance of congenital infertility
	}
	random_events = {
		#10 = ZE.1010 # Daughter becomes disobedient - undesired marriage
		2000 = 0 # No random event
		
		refusal = {
			delay = 4
			10000 = flavour_events.39 #Character potentially rejects betrothal
			1 = 0
		}
	}
}

#character. Triggers when someone gets imprisoned for any reason. - ROOT is prisoner, FROM is imprisoner
on_become_imprisoned_any_reason = {
	effect = {
		#Ask for better accomadation? staggered so senior characters more likely to ask for family group mercy
		if = { 
			limit = { is_ruler = yes }
			character_event = { id = 50005 days = 3 random = 2 } 
		}	
		else_if = {
			limit = { age = 40 }
			character_event = { id = 50005 days = 8 random = 3 } 
		}
		else = {
			character_event = { id = 50005 days = 14 random = 3 } 
		}			
		#Request to take the black?
		if = {
			limit = { offer_to_take_black_potential_trigger = yes }
			character_event = { id = trial.309 days = 15 random = 15 }
		}
	}
	events = {
		HL.190
		ZE.14600 # Being thrown in prison affects education negatively
		RIP.12097 # Being thrown in prison removes seclusion modifier
		#MNM.9033 # Imprisoned councillor cannot hunt for relics
		685 # Remove in-hiding trait on imprisonment
		HF.12305 # Legendary Hero has been imprisoned - notifies society members
		HFP.24024 # Elder imprisoned without reason, other Elders upset.

		45400 #Workaround for AI trying to execute vassals who they are heir to
		ransom.299 #offer to pay own ransom
		45426 #Inform player
	}
}

#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 = {
		kingsguard.1
 		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
		ZE.12219  # Released from dungeon must choose whether to leave pet rat behind
		#HF.23446  # Prisoner about to be put through blood games is released before the games start. His jailer has no champion left.
 	}
}

#character. Triggers if someone is executed, character not dead yet
on_executed = {
	events = {
		#vengeance.3
 		154
 	}
}

#character. Triggers if someone is exiled
on_exiled = {
	events = {
		kingsguard.1
 		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 = {
		45340 #uber on-death action event, please put any flag/trait inheritance effects here
		45341 #uber on-death action event, RULER ONLY EVENTS
		
		4141 #The king is dead
		widowed.3 #Spouse potentially becomes widowed
		widowed.399 #Lover potentially becomes widowed
		24502 #Death of a good son
		kingsguard.1 #Kingsguard dies	
		wildling.100	# Break up large wildling realms
		pirate.7 #Break up large pirate realms
		dragon.69	# Dies during dragon conquest with no heir
		religious.10 #High Septon dies
		SoA.5306 # Check for Cadaver Synod		
		dynasty.3 #Nominated female heir coup	
		37353	#ruler passes on wealth to non-primary heirs
		REP.904 #Patrician family dies out, find exisiting one to replace
		
#		8250
		#650		
		#70041
		#38000 #debt
		#110044 #dishonourable/tyranny stain (moved to uber event)
		#250277 #valyrian steel inheritance
		#251100
		#999900908 #westeros civil war flag inheritance
		#3370050 #dragon
		#3370000 #egg
		#seasons.4 #season letter inheritance
		#70060 #cancel tourny
		#705
		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.
		#HLF.8001 # Sky Burial
		HL.12
		ZE.1030 # Daughter becomes disobedient - killed lover- merged with ZE.1040
		HL.4998
		RIP.4400 #Nicknames for executions
		#MNM.6844 #Removes mark of death block for Assassins GM
		MNM.6991 #Clears any quests targeting this character
		#MNM.6012 #Transfers assassins debt to heir
		#MNM.1415 #Announces hermetics apprentice death
		SoA.3091 # The Death of the Demon Child?
		RoI.248 # clearing inventory of cursed diamond
		#MNM.9030 # Notify of dead relic hunter
		MNM.1611 # Clears Apprentice minor titles
		680
		JD.60006 # Destroy prosthetics
		#JD.3042 # Clear Supply Horses modifier if no longer Nomadic
		GR.14 # Lose disconnected exclaves if not at war (Limited)
		GR.15 # Lose disconnected exclaves if not at war (Significant)
		GR.16 # Lose disconnected exclaves if not at war (Harsh)
		GR.17 # Lose disconnected exclaves if not at war (Total)
		GR.18 # Lose disconnected exclaves if not at war (Limited Naval)
		#HF.20227 # Character flag inheritance during wars for Coronation
		HF.20228 # Character flag inheritance during wars for Coronation
		#HF.20229 # Character flag inheritance during wars for Coronation
		HF.20231 # Notification if priest dies before the end of the Coronation Ceremony
		HF.20393 # On death of vassal, heir prompted to pay homage to crowned liege.
		HF.21001 # Clear swayed target on his death.
		HF.22119 # Clear swayed target on his death.
		#HF.40000 # Potential Beatification
		#HF.40090 # Potential bad Papal beatification
		#HF.40100 # Potential Ancestor Worship
		HFP.10997 #For logging purposes: how many of my commanders died during my lifetime
		HF.23410 #Haruspicy + Bloodthirsty Gods = Read future in human entrails of your sacrifices.
		#HF.23430 #Bloodthirsty Gods gain points for sacrifying people.
		#HF.23448 #A contender for the blood games dies before the games start.
		#HF.23450 #Host of blood games dies before the games start.
		#HF.23801 #Host of a great tribal festival dies, end the event chain.
		HF.10502 #Clears quest target for: Warrior Lodge duel-, wage war-, and recruit child-missions
		WoL.4801 #Clear DND on your Carousing guests
		HF.560 # Notify Lodge Members that die in duels
		HF.25071 #Clear Warriors of Ukko event troops.
		HF.24017 #Murder points for Forge Bloodline Ambition.
		HF.24232 #Dragon Blood.
		HF.12304 #Legendary Journey: Notify current heir and other warrior lodge members of your untimely demise
		HF.50107 # Clean up for Warrior Lodge war aid
		HFP.24019 # Elder has been killed, other Elders hate the killer.
		LT.20501 # Sucessor must decide on Burial if it has wonders with burial_ground flag
	}
	random_events = {
		1 = RIP.29800 #reincarnation investigation		
		5 = HF.51000 # Crucible steel weapon chain
		5 = volantis.573 #Triarch Statue defaced
		10 = 24505
		10 = 24510
		25 = RIP.29000 #Lovers/rivals/friends react 
		#100 = MNM.1207 # Hermetic Scrying vision fulfilled
		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
		50 = TGF.3320
		20 = HF.23207 #Pirating events: taking thralls.
		30 = HF.23209 #Pirating events: stealing cattle.
		60 = HF.23210 #Pirating events: destroying large port city.
		80 = HF.23214 #Pirating events: hiring local mercenaries. 
		100 = slavery.3999 #Take slaves
		250 = 0
	}
	events = {
		TGF.3321
		TGF.3322
		TGF.3323
		RIP.11720
		MNM.9899 # Chance to steal artifact from capital holdings
		HF.25503 # Warrior Lodge Mission: Raid province
		#HF.23212 # Earned Seaking Bloodline.
	
		raid_events.665 #Take Salt Wife
		raid_events.675 #Take Sword
		jogos_nhai.5 #Jogos Camp 'sacked', flavour
		45415 #Check for possible AI counter measures
	}
}

# When someone is looting currently in a province
# ROOT = Looter, FROM = Province
on_loot_province = {
	events = {
		dothraki.697 #target can offer tribute to stop
	}
	random_events = {
		8 = HL.8
		10 = HF.23219 # Pirate events: infiltrate holding. 
		400 = 0
	}
}

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

# FROM is the character recieving the event
# FROMFROM is the person sending the event
# ROOT is empty or a third party
# new_character is empty or a third party

DEMAND_RELIGIOUS_CONVERSION_INTERACTION_ACCEPT_EVENT = {
	events = {
		202
	}
}

DEMAND_RELIGIOUS_CONVERSION_INTERACTION_DECLINE_EVENT = {
	events = {
		203
	}
}

REVOKE_TITLE_INTERACTION_ACCEPT_EVENT = {
	events = {
		kingsguard.1
		204
	}
}

REVOKE_TITLE_INTERACTION_DECLINE_EVENT = {
	events = {
		205
	}
}

OFFER_PEACE_INTERACTION_ACCEPT_EVENT = {
	events = {
		206
		#mega_wars.8	#westeros civil war peace
		#999900907
	}
}

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

OFFER_VASSALIZATION_INTERACTION_DECLINE_EVENT = {
	events = {
		211
	}
}

ARRANGE_BETROTHAL_INTERACTION_ACCEPT_EVENT = {
	events = {
		212
		21299
	}
}

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

OFFER_SUCCESSION_MARRIGE_INTERACTION_DECLINE_EVENT = {
	events = {
		215
	}
}

OFFER_MARRIGE_INTERACTION_ACCEPT_EVENT = {
	events = {
		216
		37255
	}
}

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

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 = {
		#MNM.1217
		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 # Ally accepts
		41000 # Vassal accepts
		mega_wars.41 #Mega war Flags
		nightswatch.52  #Human breaks NW vows by accepting a call to arms
		CM.10014
	}
}

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

DECLARE_WAR_INTERACTION_ACCEPT_EVENT = {
	events = {
		240
		241
		#999901900
	}
}

RETRACT_VASSAL_INTERACTION_ACCEPT_EVENT = {
	events = {
		274
	}
}

RETRACT_VASSAL_INTERACTION_DECLINE_EVENT = {
	events = {
		275
	}
}

INVITE_TO_COURT_INTERACTION_ACCEPT_EVENT = {
	events = {
		280
		28099
	}
}

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
		CM.10013
	}
}

ASK_TO_JOIN_WAR_INTERACTION_DECLINE_EVENT = {
	events = {
		294
	}
}

ASK_TO_EMBARGO_INTERACTION_ACCEPT_EVENT = {
	events = {
		295
		#295666
	}
}

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

FORM_ALLIANCE_INTERACTION_ACCEPT_EVENT = {
	events = {
		diploresponse.1
	}
}

FORM_ALLIANCE_INTERACTION_DECLINE_EVENT = {
	events = {
		diploresponse.2
	}
}

DISSOLVE_ALLIANCE_INTERACTION_ACCEPT_EVENT = {
	events = {
	}
}

DISSOLVE_ALLIANCE_INTERACTION_DECLINE_EVENT = {
	events = {
	}
}

BUY_FAVOR_INTERACTION_ACCEPT_EVENT = {
	events = {
		520
	}
}
BUY_FAVOR_INTERACTION_DECLINE_EVENT = {
	events = {
		521
	}
}

REQUEST_SUPPORT_INTERACTION_ACCEPT_EVENT = {
	events = {
		522
	}
}
REQUEST_SUPPORT_INTERACTION_DECLINE_EVENT = {
	events = {
		523
	}
}

FORM_NON_AGGRESSION_PACT_INTERACTION_ACCEPT_EVENT = {
	events = {
		524
	}
}
FORM_NON_AGGRESSION_PACT_INTERACTION_DECLINE_EVENT = {
	events = {
		525
	}
}

ASK_COUNCIL_POSITION_INTERACTION_ACCEPT_EVENT = {
	events = {
		526
	}
}
ASK_COUNCIL_POSITION_INTERACTION_DECLINE_EVENT = {
	events = {
		527
	}
}

ASK_REALM_PEACE_INTERACTION_ACCEPT_EVENT = {
	events = {
		528
	}
}
ASK_REALM_PEACE_INTERACTION_DECLINE_EVENT = {
	events = {
		529
	}
}

FORCE_JOIN_FACTION_INTERACTION_ACCEPT_EVENT = {
	events = {
		530
	}
}
FORCE_JOIN_FACTION_INTERACTION_DECLINE_EVENT = {
	events = {
		531
	}
}

ASK_TO_JOIN_AMBITION_INTERACTION_ACCEPT_EVENT = {
	events = {
		535
	}
}
ASK_TO_JOIN_AMBITION_INTERACTION_DECLINE_EVENT = {
	events = {
		536
	}
}
OFFER_CONSORT_INTERACTION_ACCEPT_EVENT = {
	events = {
		537
	}
}
GIVE_ARTIFACT_INTERACTION_ACCEPT_EVENT = {
	events = {
		538
	}
}

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

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

# Respond to a proposed change of law
councilor_on_approve_law = {
	events = {
		#750
		675
	}
}

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

# When rebels appear
#better rebels mod, uses province modifiers
on_rebel_revolt = {
	events = { 
		better_rebels.1
		
		TOG.1999 	#Rebellion, choose rebel type
	}
}

# 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 mission invalidates
on_crusade_invalid = {
	events = {
		#534
	}
}

# 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, ROOT is province. FROM has the old religion.
on_county_religion_change = {
	events = {
		#SoA.4121
		#MNM.6206 #Convert province assassin quest
	}
}

# 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 = {
		SoA.5311 # Wicked High Septon
		SoA.5319 # Immoral High Priest
		#704
		#religious.206
	}
}

# 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 = {
	random_events = {
		100 = TOG.3404 #Prosperity gain from loot
		300 = 0
	}
}

# ROOT is the creating character, FROM is the title
on_create_title = {
	events = {
		CM.10021
		mega_wars.44 #reset defacto empire variables
		#CM.1501
		45435 #High Lordship is created in shattered counties, rename
		45436 #Kingdom is created in shattered realms, create dejure realm
		traditional_claims.203 #Gain bloodline?
		MNM.9999 #check artifact claims for title holders
	}
}

##AGOT notes
# gain_title, create_title, grant_title - on_new_holder
# usurp_title - on_new_holder_usurpation
# inheritance, abdicate - on_new_holder_inheritance

# ROOT is the character, FROM is the title, FROMFROM is the old holder
on_new_holder = {
	events = {
		HL.4999 #Preserve Nomad Culture
		HL.4996 #Clear Nomad Agitation when conquered by a non-nomad
		HL.4812 #Clear nomadic pillage holding modifiers upon succession/conquest
		HL.4811 #Clear the 'Rampaging Nomads'-Modifier when conquered by a non-nomad
		HL.140 #Landless nomad gains a title.
		#60504 #Landless status clean-up for e_mongol_empire.
		#ZE.7000 # Check for Gain Any Title ambition.
		RIP.12098 #check if we need to remove in_seclusion.
		RIP.11715 #Removes crown focus on new holder
		#MNM.6990 #Makes sure d_hashshashin owner is always shiite & member of the_assassins
		#MNM.1215 # The Hermetics Scrying Power result (for new holder)
		#MNM.1216 # The Hermetics Scrying Power result (for old holder)
		HF.25510 # Clear loot province mission if province has fallen under your control.
		HF.23700 # Apply proper succession laws tied to gender Doctrines when creating a new vassal.
		
		# Clean up zoroastrian pets on province modifiers in case capital lost
		#ZP.7

		##Events for all new_holder##
		66114 #Grandchild Princes
		knight.17 #Remove ser title
		maintenance.43 #Special titles for titular kingdoms
		maintenance.52 # Empire AI vassal limit management (make them give kingdom titles)
		diplomatic.56 #Royal privilege maintenance
		maintenance.54 # triggered modifiers
		cadet.18 #bastard starts new cadet dynasty
		royal_proclamations.999 #Royal Proclamations	
		dynamic_coa.2 #Dynamis CoAs
		dynamic_coa.3
		valyria.47 #New holder of e_new_valyria, ensure tributaries are transferred
		valyria.4799 #Tributary has new holder, ensure suzerain is transferred
		bankruptcy.101 #Usurped debtor, take on loan
		traditional_claims.198 #Check traditional dynastic claims
		evil.2
		MNM.9999 #check artifact claims for title holders
		HF.23779 #Setting up next god-emperor.
		
		##Events for on_new_holder only
		traditional_claims.1 #traditional title maintenance	
		dothraki.850 #New clan maintenance	
		maintenance.48 #Empire grants empire maintenance
		family.103 #Player's family reaction	
		45410 #ruler pleased relative granted title		
		pirate.42 #pirate government check
		
		##Events for on_new_holder and on_new_holder_usurpation
		mega_wars.42 #maintain split vassal defacto link
		nightswatch.125 #Wildlings Take The Wall
		maintenance.70 # check for unlanded cull bug	
	}
}

# ROOT is the character, FROM is the title, FROMFROM is the old holder
on_new_holder_inheritance = {
	events = {
		HL.4812 #Clear nomadic pillage holding modifiers upon succession/conquest
		RIP.11715 #Removes crown focus on new holder
		#MNM.6990 #Makes sure d_hashshashin owner is always shiite & member of the_assassins
		#MNM.1215 # The Hermetics Scrying Power result (for new holder)
		#MNM.1216 # The Hermetics Scrying Power result (for old holder)
		HF.25510 # Clear loot province mission if province has fallen under your control.
		
		##Events for all new_holder##
		66114 #Grandchild Princes
		knight.17 #Remove ser title
		maintenance.43 #Special titles for titular kingdoms
		maintenance.52 # Empire AI vassal limit management (make them give kingdom titles)
		diplomatic.56 #Royal privilege maintenance
		maintenance.54 # triggered modifiers
		cadet.18 #bastard starts new cadet dynasty	
		royal_proclamations.999 #Royal Proclamations
		dynamic_coa.2 #Dynamis CoAs
		dynamic_coa.3
		valyria.47 #New holder of e_new_valyria, ensure tributaries are transferred
		valyria.4799 #Tributary has new holder, ensure suzerain is transferred
		bankruptcy.101 #Usurped debtor, take on loan
		traditional_claims.198 #Check traditional dynastic claims
		evil.2
		MNM.9999 #check artifact claims for title holders
		HF.23779 #Setting up next god-emperor.
		
		##Events for on_new_holder_inheritance only
		CM.10039 # Chronicle entry	
		better_rebels.17 #Chance of general unrest
		essos.106 #Yi Ti God Emperor opts to become eunuch	
		maintenance.44 #Merc leader dynasty maintenance
		imprisoned.1 #imprison enemies/foes			
		volantis.280 #check volantis liege

		##Events for on_new_holder_inheritance and on_new_holder_usurpation
		dynastic_stability.1
	}
}

# ROOT is the character, FROM is the title, FROMFROM is the old holder
on_new_holder_usurpation = {
	events = {
		HL.4999 #Preserve Nomad Culture
		HL.4996 #Clear Nomad Agitation when conquered by a non-nomad
		HL.4812 #Clear nomadic pillage holding modifiers upon succession/conquest
		HL.4811 #Clear the 'Rampaging Nomads'-Modifier when conquered by a non-nomad
		RIP.11715 #Removes crown focus on new holder
		
		HL.140 #Landless nomad gains a title.
		#MNM.6990 #Makes sure d_hashshashin owner is always shiite & member of the_assassins
		#MNM.1215 # The Hermetics Scrying Power result (for new holder)
		#MNM.1216 # The Hermetics Scrying Power result (for old holder)
		HF.25510 # Clear loot province mission if province has fallen under your control.
		HF.20417 # Clear uncrowned modifier.
		
		##Events for all new_holder##
		66114 #Grandchild Princes
		knight.17 #Remove ser title
		maintenance.43 #Special titles for titular kingdoms
		maintenance.52 # Empire AI vassal limit management (make them give kingdom titles)
		diplomatic.56 #Royal privilege maintenance
		maintenance.54 # triggered modifiers
		cadet.18 #bastard starts new cadet dynasty
		royal_proclamations.999 #Royal Proclamations
		dynamic_coa.2 #Dynamis CoAs
		dynamic_coa.3
		valyria.47 #New holder of e_new_valyria, ensure tributaries are transferred
		valyria.4799 #Tributary has new holder, ensure suzerain is transferred
		bankruptcy.101 #Usurped debtor, take on loan
		traditional_claims.198 #Check traditional dynastic claims
		evil.2	
		MNM.9999 #check artifact claims for title holders
		HF.23779 #Setting up next god-emperor.
		
		##Events for on_new_holder_usurpation only
		CM.10022	
		interregnum.12 #flag reset
		45420 #transfer artifacts
		bankruptcy.185 #Bank location is usurped, new holder acquires shares
			
		##Events for on_new_holder_inheritance and on_new_holder_usurpation
		dynastic_stability.1
		
		##Events for on_new_holder and on_new_holder_usurpation
		mega_wars.42 #maintain split vassal defacto link
		nightswatch.125 #Wildlings Take The Wall
		maintenance.70 # check for unlanded cull bug	
	}
}

on_unlanded = {
	events = {
		HL.130 #Landless nomad clean-up.
		knight.179 #add ser title
		volantis.575 #Triarch statue defaced
		maintenance.55 #lose ruler related modifiers
		slavery.16 #slave owner maintenance
	}
}

# 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
		#63105
		#TOG.7101 #Removes main deity for defensive pagans

		# If switched religion then trait is gone and we need to clean up modifiers for zoroastrian pets
		#ZP.7

		# Baptism - Mass Conversion checks
		#HF.20012 	# On conversion of sponsor during baptism
		#HF.20018 	# On conversion of converter after baptism
		#HF.20020	# On conversion of sponsor after baptism
		#HF.20027	# On baptism of deceitful player, maintain previous faith
		HF.20408	# Ruler has converted in the middle of coronation, stop everything.
		HF.20416	# Cleanup uncrowned modifiers when converting away from Catholicism/Fraticelli.
		#HF.23033	# Acquire Pagan religious branch when converting to a religion that has No Head.
		HF.23034	# Acquire Gender law when converting to Matriarchal/Equal/Patriarchal religion.
		#HF.23458	# Host of Blood Games converts to non-Bloodthirsty religion in the middle of the tournament.

		religious.111 #remove special titles
		#SoA.5229 # Remove relic modifier if no longer Christian (Rhllor)
		pirate.2 #remove pirate trait if no longer pirate
		religious.66 #remove syncretic faith
	}
}

# Character converts secret religion, for whatever reason. ROOT is the character after conversion and the FROM scope has the old religion. Note that this fires even when the secret religion is reset as a result of the character converting to it, or if the character didn't previously have a secret religion
on_character_convert_secret_religion = {
	events = {
	}
}

# 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
		wildling.2 #check wildling trait
		55020 #Ruler converts culture, also convert courtiers if same culture group
	}
}

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		
		HF.24013 # Corsair ships for special bloodline.
		#HF.23803 # Interrupt Great Tribal Festival.
		HF.24021 # Reset peaceful_years variable for Forged Bloodlines.
		HF.50000 # Ask Warrior Lodge member for help in war

		volantis.9100 #Triarchs can veto
		regency.60 #Regent Veto
		essos.57 #Naath pacifism
		mega_wars.1 #trigger mega war if valid		
		mega_wars.4299  #Vassal of split vassal rebels, add defacto liege link to emperor
		mega_wars.42 #Maintain defacto link of split vassals
		#diplomatic.3099 #A foreign power is invading, can call to arms realms of same culture group NOW CALLED DIRECTLY FROM CB
		maintenance.66 #AI hire merchant ships?
		45428 #War declared on valyrian/sarnori tributary, add opinion
		45433 #break non-aggression pacts/alliances
	}
}

# From = Attacker, Root = Defender
on_war_ended_victory = {
	events = {
		CM.10038
		HF.23012 # Clean-up haruspicy modifiers
		#HF.24010 # Teuta bloodline applied.
		HF.24250 # Matilda bloodline applied.
		HF.25002 # Clear warriors of Ukko cooldown.
		HF.25035 # Clear Call to Glory effects.
		HF.24018 # Won Wars Bloodline counter.
		HF.10515 # Complete Wage War mission, if you went about it some non-conventional way
		HFP.23025 # Remove stolen spouse from concubinage.
		HF.50100 # Warrior Lodge War Aid conclusion  

		free_cities.102 #Pentos lost war- kill Prince?
		volantis.350 #check for volantene election
		valyria.199 #check for valyrian election
		dothraki.880  #Nomad lost war, negative modifiers
		7514 #check for successful weaken vassal plot
		religious.100 #moral authority effects
	}
}

# From = Attacker, Root = Defender
on_war_ended_whitepeace = {
	events = {
		CM.10040
		#HF.23012 # Clean-up haruspicy modifiers
		HF.25002 # Clear warriors of Ukko cooldown.
		HF.25035 # Clear Call to Glory effects.
		HF.10516 # Completes Wage War mission for Warrior Lodge members
		HF.50101 # Warrior Lodge War Aid conclusion 

		volantis.350 #check for volantene election
		valyria.199 #check for valyrian election
		bankruptcy.117 #Loan Insurer defeated
	}
}

# From = Attacker, Root = Defender
on_war_ended_defeat = {
	events = {
		CM.10041
		#HF.23012 # Clean-up haruspicy modifiers
		HF.25002 # Clear warriors of Ukko cooldown.
		HF.25035 # Clear Call to Glory effects.		
		HF.24019 # Won Wars Bloodline counter.
		HF.10517 # Completes Wage War mission for Warrior Lodge members
		HFP.23026 # Remove stolen spouse from concubinage.
		HF.50102 # Warrior Lodge War Aid conclusion  

		free_cities.1023 #Pentos lost war- kill Prince?
		volantis.350 #check for volantene election
		valyria.199 #check for valyrian election
		dothraki.881  #Nomad lost war, negative modifiers
		bankruptcy.117 #Loan Insurer defeated
		religious.101 #moral authority effects
	}
}
# From = Attacker, Root = Defender
on_war_ended_invalid = {
	events = {
		#HF.23012 # Clean-up haruspicy modifiers
		HF.25002 # Clear warriors of Ukko cooldown.
		HF.25035 # Clear Call to Glory effects.
		HF.10518 # Clear mission to Wage War

		volantis.350 #check for volantene election
		bankruptcy.117 #Loan Insurer defeated
	}
}

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

# ROOT = Builder, FROM = Title
on_settlement_construction_start = {
	events = {
		WoL.12009
	}
}
# ROOT = Builder, FROM = Province
on_trade_post_construction_start = {
	events = {
	}
}

# ROOT = Builder, FROM = Province
on_fort_construction_start = {
	events = {
	}
}

# ROOT = Builder, FROM = Province
on_hospital_construction_start = {
	events = {
	}
}
# ROOT = Builder, FROM = Title
on_settlement_construction_completed = {
	events = {
		44482
		HL.4
		#MNM.4024
		HF.24022 # Architect Bloodline check.
		HF.24023 # Castellan Bloodline check.
		HF.24024 # Monumental Bloodline check.
	}
}
# ROOT = Builder, FROM = Province
on_trade_post_construction_completed = {
	events = {
	}
}

# ROOT = Builder, FROM = Province
on_fort_construction_completed = {
	events = {
	}
}

# ROOT = Builder, FROM = Province
on_hospital_construction_completed = {
	events = {
	}
}
# ROOT = Builder, FROM = The Holding Title
on_holding_building_start = {
	events = {
		RIP.30100
		harrenhal.21 #buildings collapse in harrenhal
	}
}

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

on_mercenary_hired = {
	events = {
		ZE.10038
	}
}

on_mercenary_dismissed = {
	events = {
		ZE.10039
	}
}
# ROOT = target, FROM = starter, FROMFROM = chosen replacement
on_mercenary_captain_replacement = {
	events = {
		ZE.11040
	}
}

on_enforce_peace = {
}

on_enforce_peace_start = {
}

on_enforce_peace_six_vassals = {
	events = {
	}
}

on_law_vote_passed = {
	events = {
	}
}

on_law_vote_failed = {
}

on_player_mercenary_income = {
	events = {
	}
}

on_outbreak = {
	events = {
		RIP.10000
		RIP.4000
	}
}

on_province_major_modifier = {
	events = {
		RIP.10030
	}
}

# Fires every two years for characters who are members of any society
on_society_bi_yearly_pulse = {
	events = {
		#MNM.6199 # Assassins quest tombola
		MNM.7200 # Devil Worshipers quest tombola
		#MNM.4000 # Monastic order quest tombola
		#MNM.3000 # Secret religious society quest tombola
		MNM.1000 # Hermetics quest tombola
		MNM.7000 # Devil Worshipers: soul corruption chance
		MNM.10030 # Ai rank up in society
		HF.25500 # Warrior Lodges: quest tombola
		
		wildfire.50 # Alchemist quest tombola
		bankruptcy.135 #Bank quest tombola
		bankruptcy.2698 #Ai bank member trys to rank up
	}
	
	random_events = {
		50 = MNM.10020 # Criminal societies: stressed
		100 = MNM.20000 # Devil Worshippers: Orgy
		100 = MNM.20010 # Devil Worshippers: Night on the Town
		75 = MNM.20030 # Devil Worshippers: Grand Summoning
		100 = MNM.20040 # Devil Worshippers: Impersonating Priests
		100 = MNM.20060 # Devil Worshippers: Infernal Choir (only with Rivals)
		75 = MNM.7854 # Devil Worshipers: Demon Hunters Attack
		# 100 = MNM.6899 # Assassins: friend or foe?
		# 100 = MNM.6910 # Assassins: assisting a murder plot
		# 50 = MNM.6920 # Assassins: blackmailing superior
		# 100 = MNM.3260 # Monastic Orders: Advising a Poet
		# 100 = MNM.4200 # Monastic Orders: Learning about Roses
		# 100 = MNM.4210 # Monastic Orders: Fellow member drowsing off
		# 100 = MNM.4435 # Monastic Orders: Friendship & Love
		# 50 = MNM.4610 # Monastic Orders: Monastery has Artifact
		# 50 = MNM.3920 # Secret Religious societies: Worried member
		# 50 = MNM.3930 # Secret Religious societies: Fellow society member goes for a round
		# 50 = MNM.3505 # Secret Religious societies: Get help from another member with problematic trait
		# 50 = MNM.3500 # Secret Religious societies: I am so stressed
		50 = MNM.1620 # Hermetic Society: Divine Summoning
		50 = MNM.1460 # Hermetic Society: Gathering of the Minds
		50 = MNM.10040 # Every society: Gain rival
		50 = MNM.10043 # Every society: Gain friend (or possibly lover...?)
		20 = HF.25200 #Arm-wrestling during feast.
		5 = HF.25226 #Dice-throwing during feast.
		#70 = HF.25250 #Flyting contest during feast.
		10 = HF.25280 #Drinking games.
		40 = HF.25600 #Warrior Lodges Ritual Hunting.
		75 = HF.14000 #Warrior Lodges: Teaching Moment
		
		100 = bankruptcy.200 #Non-heir child demands shares

		200 = 0 # Nothing
		
				
		warrior_lodge_heroes_train_other_members = {
			delay = 40
			20 = HF.500
			80 = 0
		}
		warrior_lodge_members_duel_enemies = {
			delay = 24
			5 = HF.550
			95 = 0
		}
	}
}

# A character has switched their society interest
# Root = Character
# From = Society
on_character_switch_society_interest = {
	events = {
		MNM.10010
		MNM.10024 # Backup for refounding societies
	}
}

# A character ranks up in their society, or becomes grandmaster
# Root = Character
# From = Society
on_character_society_rank_up = {
	events = {
		#735 # Dark Lord achievement
		#736 # Birthright achievement
		#737 # Jihad Sultan achievement
		MNM.1750 # Grandmaster notification event		
	}
}

# A character ranks down in their society
# Root = Character
# From = Society
on_character_society_rank_down = {
	events = {
	}
}

# A character joins a society. The has_game_started trigger can be useful to avoid firing events from auto-assignment of characters at game start
# Root = Character
# From = Society
on_character_join_society = {
	events = {
		
	}
}

# A character leaves or is forced to leave a society
# Root = Character
# From = Society
on_character_leave_society = {
	events = {
		MNM.10018 #clears on-going event flags and effects
		HF.25035 # Clear Call to Glory effects.
		HF.25071 #Clear Warriors of Ukko event troops.
		bankruptcy.27 #Left bank, receive shares in cash
	}
}
# A character asks to join a society. Only works on player
# Root = Character
# From = Society
on_character_ask_to_join_society = {
	events = {
		#MNM.4450 #Join Monastic Order
		MNM.100 #Join Hermetics			
		MNM.10024 # Backup for refounding societies
		HF.10003 # Warrior Lodge Hero will inform new recruit about the initation duel
		
		wildfire.45 #join Alchemists
		bankruptcy.24 #Join bank
	}
}

# A character is removed from society for failing the potential trigger.
# Root = Character
# From = Society
on_character_kicked_from_society = {
	events = {
		MNM.10021
	}
}

# A character stops showing interest in a society for failing the CanJoin trigger.
# Root = Character
# From = Society
on_character_stop_showing_interest = {
	events = {
		MNM.10019
	}
}

# Someone joins a society that has no members
# Root = Character
# From = Society
on_society_created = {
	events = {
	}
}

# The last member of a society leaves the society and is not replaced
# Root = Character
# From = Society
on_society_destroyed = {
	events = {
		HF.10053 # Warrior Lodges: Maintenance: Society tries to respawn if it died 
	}
}

# A character selects a focus
# Root = Character
on_focus_selected = {
	events = {
		HF.25506
		HF.25507
		HF.25508
		HF.25509
	}
}

# A character succeeds in a quest. This happens just before the quest disappears, so you can access the quest itself. Only invoked when a quest is cleared via script. E.G., does not happen on death
# Root = Character
on_quest_success = {
	events = {
		MNM.6666
	}
}

# A character fails a quest. This happens just before the quest disappears, so you can access the quest itself. Only invoked when a quest is cleared via script. E.G., does not happen on death
# Root = Character
on_quest_failure = {
	events = {
		MNM.6667
	}
}

# An indestructible society failed to find a new leader from existing characters
# Root = Society
# From = Previous leader
on_society_failed_to_find_new_leader = {
	events = {
	}
}


# Root = New artifact owner
# From = inherited artifact
# FromFrom = Previous owner
on_artifact_inheritance = {
	#random_events = {
		#5 = HFP.16005 # old destruction risk
		#95 = 0 # nothing happens
	#}
	events = {
		#MNM.5107 # for inheriting ingredients
	}
}

# An offmap power changes its policy. Triggers for the governor
# Root = Governor
# From = Offmap
on_offmap_policy_changed = {
	events = {
		# JD.30501 # Print policy update to logs
		# JD.50020 # News from China about Policy Change
		# JD.50400 # Update Silk Road values
	}
}

# An offmap power changes its status. Triggers for the governor
# Root = Governor
# From = Offmap
on_offmap_status_changed = {
	events = {
		# JD.30502 # Print status update to logs
		# JD.50030 # News from China about Status Change
		# JD.50400 # Update Silk Road values
	}
}


# An offmap power changes its governor. Triggers for the new governor
# Root = New governor
# From = Old governor
# FromFrom = Offmap
on_offmap_governor_changed = {
	events = {
	}
}

# An offmap power changes its ruler. Triggers for the new ruler
# Root = New ruler
# From = Old ruler
# FromFrom = Offmap
on_offmap_ruler_changed = {
	events = {
		# JD.30503 # Logging new ruler data
		# JD.10005 # In case of dynasty change...
		# JD.10202 # Delayed cleanup event. Makes sure the new administration may also launch Chinese invasions.
		# JD.50000 # Select a new Policy and send News Event
		# JD.31000 # Logging for emperor statistics
	}
}

# Happens once a month on a random day. Triggers for the governor
# Root = Governor
# From = Offmap
on_offmap_monthly_pulse = {
	events = {
		#JD.10121 #Fallback event to make sure that Displaced Royals, Jurchen Invaders, and Rebel Generals actually appear (regardless of new administration in China or not)
	}
	random_events = {
	}
}

# Happens once a year during a random monthly update. Triggers for the governor (once for each offmap governor, if there's more than one)
# Root = Governor
# From = Offmap
on_offmap_yearly_pulse = {
	# events = {
		# JD.10100 # Chinese Invasion tombola
		# #JD.40000 # Chinese Trade Competition
		# JD.30500 # China logging variable increment
		# JD.10200 # Chinese Invasion clean-up event - REGULAR (tributary invasion + other flags)
		# JD.10201 # Chinese Invasion clean-up event - MAJOR Invasion (rare)
	# }
	
	# random_events = {
		# 10000 = 0
		# 300 = JD.50100 # Status returns to 'Stable'
		# 150 = JD.50120 # Status changes to 'Unrest'
		# 50 = JD.50140 # Status changes to 'Mongol Invasion'
		# 450 = JD.50160 # 'Mongol Invasion' Resolution
		# 50 = JD.50180 # Status changes to 'Jurchen Invasion'
		# 450 = JD.50200 # 'Jurchen Invasion' Resolution
		# 100 = JD.50220 # Status changes to 'Great Famine'
		# 100 = JD.50240 # Status changes to 'Devastating Plague'
		# 100 = JD.50260 # Status changes to 'Golden Age'
		# 350 = JD.50280 # Status changes to 'Civil War'
		# 400 = JD.50300 # 'Civil War' Resolution
	# }
}

# Happens just prior to the EU4 converter converting the game
# Root = Player. Random character if in observe mode
on_eu4_conversion_start = {
	events = {
		#JD.60205 # Prepare on map China for conversion
	}
}

# Happens just after the EU4 converter is done converting the game
# Root = Player. Random character if in observe mode
on_eu4_conversion_done = {
	events = {
		#JD.60206 # Restore on map China after conversion
	}
}

# Happens when tyranny is caused by the code rather than script. That is; won't trigger if you use "add_opinion_modifier" to add tyranny. Fires for every character that gets the "tyrant" opinion penalty towards the tyrant
# Root = Upset character
# From = Tyrant
on_tyranny_gained = {
	events = {
	}
}

# Happens when tyranny is caused by the code rather than script. That is; won't trigger if you use "add_opinion_modifier" to add tyranny. Only happens for the tyrant themselves, rather than for each of their "victims", so happens exactly once per tyranny-giving action
# Root = Tyrant
on_tyranny_gained_tyrant_only = {
	events = {
		45360
	}
}

# Triggers if someone tries to revoke someone's title, and the person refuses and starts a war in response
# Root = The person declaring war
# From = The revoker
# FromFrom = The title being revoked
on_revoke_attempted_started_war = {
	events = {
		681
 	}
}

# Triggers if someone tries to retract someone's vassal, and the person refuses and starts a war in response
# Root = The person declaring war
# From = The revoker
# FromFrom = The vassal title being retracted
on_retract_vassal_attempted_started_war = {
	events = {
		682
 	}
}

# Triggers if someone tries to absorb a clan, and the person refuses and starts a war in response
# Root = The person declaring war
# From = The revoker
on_absorb_clan_attempted_started_war = {
	events = {
		683
 	}
}

# Triggers if someone tries to split a clan, and the person refuses and starts a war in response
# Root = The person declaring war
# From = The revoker
on_split_clan_attempted_started_war = {
	events = {
		684
 	}
}

# Triggers if the game is started with Random/Shattered World. Fires at the very end of game setup (just before the Welcome screen is shown)
# Root = The very first character generated (events need a character to work)
on_alternate_start = {
	events = {
	}
}

# Triggers when the society progress is decreased / set to the value 0
# Root = The affected society grandmaster
# From = The affected society
on_society_progress_zero = {
	events = {
	}
}

# Triggers on a betrothal being agreed. Sent to employers of both parties
# Root = Employer of the character getting betrothed
# From = Character getting betrothed in the court of Root
# new_character = The other character getting betrothed
on_betrothal = {
	events = {
		500992 # AI Marriage Evaluation
	}
	random_events = {
		refusal = {
			delay = 4
			10 = flavour_events.39 #Character potentially rejects betrothal
		}
	}
}

# Triggers when the society progress is increased / set to the value 100
# Root = The affected society grandmaster
# From = The affected society
on_society_progress_full = {
	events = {
		HF.11999
	}
}
# Triggers for all characters in a unit (leading a flank or subunit) when it enters a province
# Root = the affected character
on_unit_entering_province = {
	random_events = {
		1000 = 0
		
		misc_events = {
			delay = 10
			1000 = 0
			50 = ambition.2 #Lusty/Hedonist/unmarried commander finds peasant girl at war
			250 = ambition.74 # Army campfire
			2 = 76100 #Lonely whilst campaigning
			3 = 6900 #Become friendly with a fellow vassal
			3 = 6920 #Become rival with a fellow vassal
			10 = cold_winds.12 # Character in winter wasteland province encounter Others
			10 = 64140 #Being separated FROM your love by the needs of war is heart-aching		
			15 = sothoryos.15 #Wyvern Attack!
			1 = wildling.63 # Find Dark Sister Beyond the Wall
			25 = words_events.3 #Hear me Roar!
			25 = dynastic_rivalry.30 #Men get into fights in army encampment
		}
		raiding_events = {
			delay = 7
			900 = 0
			100 = raid_events.2099 #Looting Duel
			200 = raid_events.3299 #Attack a ship
		}	
		location = {
			delay = 5
			1 = 0
			10 = evil.3 #the sorrows
		}
	}
	events = {		
		evil.1		
	}
}

# Triggers for character when they are put in command of a flank
# Root = the affected character
on_command_unit = {
	events = {
	}
}

# Triggers for character when they are put in command of a subunit
# Root = the affected character
on_command_sub_unit = {
	events = {
	}
}

# Triggers when Crusade preparation starts
# Root = the religious head
# Warning - This fires for all Crusades / Jihads / Great Holy Wars upon creation regardless if they have a preparation phase - Use "uses_new_crusade = yes" trigger to limit effects
on_crusade_preparation_starts = {
	events = {
	}
}

# Triggers when Crusade preparation ends
# Root = the religious head
on_crusade_launches = {
	events = {
	}
}

# Triggers when a Crusade is canceled
# Root = the religious head
on_crusade_canceled = {
	events = {
	}
}

# Triggers once a month while a Crusade is preparing or active
# Root = the religious head
on_crusade_monthly = {
	events = {
	}
}

# Triggers when the target of a crusade changes (either through script or invalidation, or the target's heir inheriting). Happens immediately after the crusade_target_char and crusade_target_title scopes are updated
# Root = the religious head
# From = the previous target character
# FromFrom = the previous target title
# FromFromFrom = the character who made the change, if via diplomatic action. Otherwise not defined
on_crusade_target_changes = {
	events = {
	}
}

# Triggers when a character pledges their participation. Triggers even if the war has started. Does *not* trigger when the character is auto-pledged due to joining the war
# Root = the character pledging
on_pledge_crusade_participation = {
	events = {
	}
}

# Triggers when a character pledges their defense of the crusade target. Triggers even if the war has started. Does *not* trigger when the character is auto-pledged due to joining the war
# Root = the character pledging
on_pledge_crusade_defense = {
	events = {
	}
}

# Triggers when a character unpledges their participation, including the automatic unpledging on death and conversion
# Root = the character unpledging
on_unpledge_crusade_participation = {
	events = {
	}
}

# Triggers when a character unpledges their defense, including the automatic unpledging on death and conversion
# Root = the character unpledging
on_unpledge_crusade_defense = {
	events = {
	}
}

# Triggers when someone is excommunicated via the hardcoded diplomatic interaction
# Root = Excommunicated person
# From = Asker
# FromFrom = Pope
on_excommunicate_interaction = {
	events = {
		HFP.23002 #Add opinion modifier to prevent excommunication spamming.
	}
}

# Triggers when a player renames a character. Note that the player is not provided as a scope. This includes the "newborn" event
# Root = The renamed character
on_character_renamed = {
	events = {
		dragon.499 #change dragon whip name
	}
}

# Triggers when a player renames a title. Note that the player is not provided as a scope. This includes renaming via the title screen
# Root = The renamed title
on_title_renamed = {
	events = {
	}
}

# Triggers when a player renames a province. Note that the player is not provided as a scope. This includes renaming via the province view
# Root = The renamed character
on_province_renamed = {
	events = {
	}
}

# Triggers when a player renames a wonder.
#ROOT = owner
#FROM = upgrade
#FROMFROM = The renamed wonder
#FROMFROMFROM = province (location of wonder)
on_wonder_renamed = {
	events = {
	}
}

# Triggers when a player renames an artifact. Note that the player is not provided as a scope
# Root = The renamed artifact
on_artifact_renamed = {
	events = {
	}
}

# Triggers when a player renames a bloodline. Note that the player is not provided as a scope
# Root = The renamed bloodline
on_bloodline_renamed = {
	events = {
	}
}

# Triggers when a change of employer has been detected. Note that the from scope is empty for newly created characters.
# Root = character that got a new employer
# From = previous employer
# FromFrom = new employer
on_employer_change = {
	events = {
		HFP.19000 # For safety, to prevent everlasting food-shortage from Seclusion
	}
}

# Triggers when a change of host has been detected. Note that the from scope is empty for newly created characters. "on_employer_change" is triggered first if a character has had both their employer and host changed since the last check was made.
# Root = the character that got a new host
# From = the previous host
# FromFrom = new employer
on_host_change = {
	events = {
		HFP.19000 # For safety, to prevent everlasting food-shortage from Seclusion
		cold_winds.1003
	}
}

# Triggers when a character becomes the owner of a wonder.
# ROOT = new owner
# FROM = wonder
# FROMFROM = previous owner (this person might be dead or whatever, but still needed)
# FROMFROMFROM = province wonder is in
on_wonder_owner_change = {
	events = {
	}
	random_events = {
		1000 = 0
		delayed_upgrade_finish_effects = {
			delay = 14
			100 = LT.60401 #Traps kill courtiers from new court
		}
	}
}

# Triggers when a wonder begins construction of any stage.
# ROOT = owner
# FROM = wonder
# FROMFROM = province (location of wonder)
on_wonder_construction_start = {
	events = {
	}
	random_events = {
		1000 = 0
		100 = LT.20100 #Tomb is found during construction
	}
}

# Triggers when a wonder finishes building a stage.
# ROOT = owner
# FROM = wonder
# FROMFROM = province (location of wonder)
on_wonder_stage_finish = {
	events = {
		LT.10000
	}
}

# Triggers when a wonder is destroyed.
# ROOT = owner
# FROM = wonder
# FROMFROM = province (location of wonder)
on_wonder_destroyed = {
	events = {

	}
}

# Triggers when construction of an upgrade begins in a wonder.
# ROOT = owner
# FROM = upgrade
# FROMFROM = wonder
# FROMFROMFROM = province (location of wonder)
on_wonder_upgrade_start = {
	events = {
	}
}

# Triggers when construction of an upgrade finishes in a wonder.
# ROOT = owner
# FROM = upgrade
# FROMFROM = wonder
# FROMFROMFROM = province (location of wonder)
on_wonder_upgrade_finish = {
	events = {
		LT.10001
		LT.20700 #upgrade_strategic_exclaves effect to build maximum fortification in province holdings
	}
	random_events = {
		1000 = 0
		delayed_upgrade_finish_effects = {
			delay = 50
			100 = LT.60001 #Town springs up
		}
	}
}

# Triggers when an upgrade is destroyed in a wonder.
# ROOT = owner
# FROM = upgrade
# FROMFROM = wonder
# FROMFROMFROM = province (location of wonder)
on_wonder_upgrade_destroyed = {
	events = {
	}
}

# Triggers when looting of a wonder begins
# ROOT = owner
# FROM = wonder
# FROMFROM = province (location of wonder)
on_wonder_loot_start = {
	events = {
		LT.20799 #Looting renaming prep-event
		LT.20800 #Artifact looting
	}
	random_events = {
		100 = 0
		delayed_upgrade_finish_effects = {
			delay = 2
			100 = LT.20810
		}
	}
}

# Triggers when looting of a wonder stage is started
# ROOT = owner
# FROM = wonder
# FROMFROM = province (location of wonder)
on_wonder_stage_loot_start = {
	events = {
	}
}

# Triggers when looting of a wonder stage is completed
# ROOT = owner
# FROM = wonder
# FROMFROM = province (location of wonder)
on_wonder_stage_loot_finish = {
	events = {
		LT.10002 # Renames wonders and sets desc for Ruined versions
		LT.20820 # Notification for the owner that looting stage finished
	}
}

# Triggers when restoration of a wonder begins
# ROOT = owner
# FROM = wonder
# FROMFROM = province (location of wonder)
on_wonder_restore_start = {
	events = {
	}
}

# Triggers when restoration of a wonder completed
# ROOT = owner
# FROM = wonder
# FROMFROM = province (location of wonder)
on_wonder_restore_finish = {
	events = {
		LT.20808 # clean up looted_artifact flag
	}
}