on_startup = { 
	events = {
		ancrel.9010 # set ancrel global flag when game begins
		ancrel.9023 # event to fix problems between updates
		celtic.156 # Druidic priest get the druid trait as well
		britannic.4 # dryad gets dryad trait
	}
	effect = {
		if = {
			limit = {
				controls_religion = yes
				religion = catholic
				NOT = { has_global_flag = acr_pagan_papal_scopes_set }
			}
			set_global_flag = acr_pagan_papal_scopes_set
			acr_set_pagan_papal_scopes_effect = yes
		}
		if = {
			limit = {
				is_reformed_religion = yes
				religion_scope = {
					persistent_event_target:religion_title = { NOT = { has_title_flag = acr_has_set_religion_flags } }
				}
			}
			acr_investiture_antipope_flags_effect = yes
		}
		if = {
			limit = {
				OR = {
					religion = britannic_pagan
					religion = promethean_pagan
					religion = jewish
					religion = zoroastrian
					religion = manichaean
				}
				religion_scope = {
					persistent_event_target:religion_title = {
						has_holder = yes
						NOT = { has_title_flag = acr_has_set_religion_flags }
					}
				}
				trigger_if = {
					limit = { religion = manichaean }
					has_global_flag = army_light_founded
					d_army_light = { has_holder = yes }
				}
			}
			acr_investiture_antipope_flags_effect = yes
		}
	}
}

on_character_ask_to_join_society = {
	events = {
		dionysus.0 # mysteries of dionysus
	}
}

#character
on_yearly_pulse = {
	events = {
		celtic.153 # Liege doesn't have a Druid
		egyptian.100 # Nile flood
		hellenic.0 # philosopher approaches the Emperor
		hellenic.50 # Myrmidon formation
		celtic.1000 # Celtic King is maimed
		hellenic.1 # Philosopher asks to be Hypatos
		hellenic.3 # Priest angry about Platonic Curriculum
		hellenic.23 # Priests are SUPER PISSED now
		promethean.116 # province doesn't qualify for open settlement
		celtic.156 # Druidic priest get the druid trait as well
		britannic.4 # dryad gets dryad trait
	}
	
	random_events = {
		ACR_random_events = {
			delay = 16
			10000 = 0
			#The Philosopher
			300 = hellenic.6 # Research Project
			300 = hellenic.11 # Imperial Chronicle
			300 = hellenic.14 # Streamline the Beaurocracy
			300 = hellenic.17 # Sage advice about a rivalry

			#Celtic Flavor
			100 = celtic.1260 # fennid arrested by marshal, catholics only (why?)
			100 = celtic.1254 # fian visiting your court
			
			#Egypt Flavor
			100 = egyptian.154 # Bes protects from nightmare
			100 = egyptian.160 # someone has dared to kill a cat
			100 = egyptian.167 # Shezmu execution
			100 = egyptian.161 # be nice to girls (?)
			100 = egyptian.162 # Senet game
			10  = egyptian.166 # ghost of akhenaten?
			100  = egyptian.168 # Nefertum
			100  = egyptian.169 # Constellation of Sah
			200  = egyptian.172 # A simple Egyptian meal
			100  = egyptian.173 # Fruit offering to temple
			100  = egyptian.174 # Field of reeds
			#100 = egyptian.215 # ancient tomb entrance discovered [unfinished]
			
			#Hellenic Flavor
			100 = hellenic.503 # Dead beggar doesn't have money to pay the ferryman
			100 = hellenic.509 # Found a curse tablet
			100 = hellenic.510 # maid tries to charm you
			100 = hellenic.511 # (male) servant tries to charm you
			100 = hellenic.515 # Leptis Manialis
			100 = hellenic.518 # Lightning strikes tree
			100 = hellenic.519 # Odysseus
			100 = hellenic.529 # Praying to family Lares
			100 = hellenic.530 # The greatest Greek city-state?
			100 = hellenic.534 # Priest recitation mistake
			100 = hellenic.536 # Oathbreaking courtier
			100 = hellenic.537 # Vulcan's appearance
			100 = hellenic.541 # Fruit of Pomona
			
			# Promethean Prosperity
			100 = promethean.101 # better roads improve trade
			100 = promethean.102 # roads allow better patrols, reducing banditry
			100 = promethean.103 # dams increase arable land
			100 = promethean.104 # irrigation increases arable land
			100 = promethean.105 # bridges improve travel and trade
			100 = promethean.110 # small group of settlers arrive from neighboring province
			100 = promethean.111 # influx of foreigners in the province
			100 = promethean.112 # friction between locals and immigrants
			100 = promethean.113 # friction between locals and immigrants 2: electric boogaloo
			100 = promethean.114 # extended family arrive from regional province
			100 = promethean.115 # minor noble asks to settle in the province

			#I Can't Believe My Virgin Goddess of the Hunt is This Cute Event Blob (a.k.a. Artemis Event Blob)
			2000 = hellenic.559 # Make offerings to the goddess
			1500 = hellenic.562 # Apollo pays you a visit
			1000 = hellenic.569 # Ask Artemis for relationship advice
			1000 = hellenic.573 # Ask Artemis for sibling advice
			1000 = hellenic.579 # Artemis is in a bad mood
			1000 = hellenic.591 # Artemis tells you about a prank she played on Apollo
			1000 = hellenic.595 # Artemis complaining about Apollo having loud sex
			2000 = hellenic.597 # Ask Artemis about death
			1000 = hellenic.615 # Someone has sex in Artemis' temple
			1000 = hellenic.617 # Yo Artemis if you hate sex why are you hanging out with me?

			#Minor Title Events
			100 = celtic.2200	# costs are less then expected
			100 = celtic.2202   # headsman did a good job, maybe reward them?
			100 = celtic.2206   # unexpected problems increase costs
			100 = celtic.2210   # an excellent worker at the office
			100 = celtic.2211   # making friends at the office!
			100 = celtic.2212   # making a rival at the office!
		}
	}
}

#character, every 2 years
on_bi_yearly_pulse = {

	events = {
		#I Can't Believe My Virgin Goddess of the Hunt is This Cute Event Blob (i.e. Artemis Event Blob)
		hellenic.565 # Devotion to Artemis inspires virtue - repeatable event
		
		ke_ancrel_m.4 # Non-Christian Free Investiture Maintainence
		ke_ancrel_m.8 # Non-Christian Papal Investiture Maintainence
	}

	random_events = {
		delay = 32
		1000 = 0
		#Egypt Flavor
		20 = egyptian.150 # Distribute Garlic
		20 = egyptian.151 # Palm trees
		20 = egyptian.152 # Khnum Amulet
		50 = egyptian.157 # You are upholding Ma'at
		50 = egyptian.158 # You are NOT upholding Ma'at
		20 = egyptian.161 # Women had more rights in ancient Egypt
		20 = egyptian.170 # Servant asks Shed for help
		
		#Hellenic Flavor
		20 = hellenic.500 # HadesxPersephone
		20 = hellenic.501 # ApolloxArtemis
		20 = hellenic.508 # Pharmakos ceremony
		20 = hellenic.516 # Courtier hunted in Diana's sacred groves
		20 = hellenic.527 # Herma
		20 = hellenic.528 # Touch Priapus statue or not?
		20 = hellenic.539 # Statue of Flora
		20 = hellenic.540 # Sterquilinus god of Feces
		20 = hellenic.542 # Lightning breaks statue
		20 = hellenic.545 # Pomegranate gift
		
		#I Can't Believe My Virgin Goddess of the Hunt is This Cute Event Blob (i.e. Artemis Event Blob)
		100 = hellenic.582 # Artemis blesses capital
		100 = hellenic.583 # Rumors about your relationship with Artemis
		100 = hellenic.588 # Artemis and you are chatting when Zeus interrupts
		100 = hellenic.593 # Artemis and Apollo are arguing
		300 = hellenic.600 # Wild Boar Spotted
		300 = hellenic.605 # Ceryneian Hind Spotted
		300 = hellenic.613 # Highwaymen
	}
}

#character
on_five_year_pulse = {
	random_events = {
		delay = 48
		1000 = 0

		#Egypt Flavor
		100 = egyptian.155 # expel the evil within
		100 = egyptian.159 # one of your wives displays feline grace... <.< >.>
		50 = egyptian.166 # Ghost of Akhenaten
		100 = egyptian.167 # Shezmu execution event
		100 = egyptian.171 # Visited the Egyptian underworld
		50 = egyptian.175 # Creepy courtier tries to bang maid by using dark magic
			
		#Hellenic Flavor
		20 = hellenic.502 # Zeus supposedly knocked a woman up - is she lying?
		20 = hellenic.504 # Zeus visits
		20 = hellenic.507 # Stumble on some nymphs
		20 = hellenic.510 # Maid attempts to use love spell
		20 = hellenic.511 # Servant boy attempts to use love spell
		20 = hellenic.512 # Daughter breastfeeds starving father
		20 = hellenic.513 # Nymph legend
		20 = hellenic.514 # Courtier's son wants to become priest of Cybele
		20 = hellenic.517 # Courtier marries nymph
		20 = hellenic.520 # Theseus and Pirithuos
		20 = hellenic.523 # Who's the fairest of them all?
		20 = hellenic.531 # Prayers for Nix
		20 = hellenic.532 # Erotes
		20 = hellenic.544 # Athena visits

		#I Can't Believe My Virgin Goddess of the Hunt is This Cute Event Blob (i.e. Artemis Event Blob)
		5 = hellenic.550 # Stumble upon Artemis naked
	}
}

# For characters 2 to 16 years old
on_yearly_childhood_pulse = {
	events = {
		celtic.184 # Celtic child begins education (14 years old)
		britannic.104 # Britannic child has not been tumtha!
	}
	random_events = {
		5000 = celtic.272 	# Acknowledged reincarnated child acquires trait from previous personality
	}
}

#on combat pulse
on_combat_pulse = {
	random_events = {
		20 = celtic.10 # Becomes reknowned headhunter
		5 = celtic.11 # Becomes a legendary hero
		10 = hellenic.568 # Artemis saves your ass in battle
	}
}

# any leader in battle on winning side is ROOT - opponent army leader is FROM
on_battle_won = {
	random_events = {
	}
}

# Fires for the owner of the winning unit (ROOT). The taken Holding title is in FROM.
on_siege_over_winner = {
	random_events = {
	}
}
#character
on_assassination_disc = {
 	random_events = {
		100 = 0
	}
}

# character
# baby is root
on_birth = {
	events = {
		celtic.215 # Child Perceived to be a Changeling
		britannic.1 # a dryad has given birth
	}
	random_events = {
		1 = celtic.270 # child is reincarnation?
	}
}

# character
on_adulthood = {
	events = {
		celtic.241   # Changeling child's true nature asserts itself
		promethean.403   # promethean chooses school
	}
}

on_death = {
	events = {
		celtic.1194 	# cancel the Aonach Tailteann if the ruler dies
		hellenic.123 	# a Vestalis has died, cleanup things
		
		#I Can't Believe My Virgin Goddess of the Hunt is This Cute Event Blob (i.e. Artemis Event Blob)
		hellenic.599 	# Character dies - Artemis escorts to the underworld
		
		
		ke_ancrel_m.3 # Non-Christian Free Investiture Succession
		ke_ancrel_m.6 # Give old titles to invested successor if you become head of religion
		ke_ancrel_m.4 # Non-Christian Free Investiture Maintainence
		ke_ancrel_m.7 # Non-Christian Papal Investiture Succession
		ke_ancrel_m.8 # Non-Christian Papal Investiture Maintainence
	}
}

# When the religion changes in a county
on_county_religion_change = {
	events = {
		celtic.280 # Wolf Tails founded with first Celtic Pagan province
	}
}

on_character_convert_religion = {
	events = {
		britannic.9 # fixes succession laws for britannic theocracy
		ke_ancrel_m.1 # Give Investiture w/ Pagan Papal (Theocracies)
		ke_ancrel_m.2 # Give Investiture w/ Pagan Papal (Other)
	}
}

# ROOT is the creating character
# FROM is the title
on_create_title = {
	events = {
		celtic.256 # Pendragon nick
	}
}

# ROOT is the character
# FROM is the title
# FROMFROM is the old holder
on_new_holder = {
	events = {
		celtic.256 # Pendragon nick
		ancrel.9299 # generic holy order maintenance event
		britannic.8 # fixes succession laws for britannic theocracy
		ke_ancrel_m.1 # Give Investiture w/ Pagan Papal (Theocracies)
		ke_ancrel_m.2 # Give Investiture w/ Pagan Papal (Other)
		celtic.156 # Druidic priest get the druid trait as well
		britannic.4 # dryad gets dryad trait
	}
}
