# Character scope
on_startup = {
	events = {
		CM.998 # Charlemagne-Carloman rivalry - Charlemagne
		CM.999 # Charlemagne-Carloman rivalry - Carloman
	}
}

# Character scope
on_yearly_pulse = {
	events = {
		CM.5000 # Ragnar Lodbrok
		CM.503  # Start of Viking Age
		CM.1011 # Lombard Queen
		CM.1100 # Saxon wars begin
		CM.1104 # Blood court of Verden
		CM.1108 # Baptism of Widukind
		CM.1400 # Umayyad vassal calls upon Charlemagne to support rebellion in exchange for vassalization
	}

	random_events = {
		# Hero knight adventure events
		200 = CM.2020 # Knight is guardian to your child - child gains traits

		# Effects of being in hiding
		100 = CM.6100 # Goes insane
		100 = CM.6102 # Goes paranoid
		100 = CM.6104 # Goes celibate
		100 = CM.6106 # Becomes zealous
		100 = CM.6108 # Becomes depressed
		100 = CM.6110 # Becomes ill or pneumonic
		100 = CM.6112 # Eats for consolation and becomes a glutton
		100 = CM.6114 # Becomes lethargic
		100 = CM.6116 # Becomes shy
		100 = CM.6118 # Becomes craven
		100 = CM.6120 # Becomes content
		100 = CM.6122 # Vows to live life to the fullest henceforth
		100 = CM.6124 # Spends time poring over books
		100 = CM.6126 # Spends time contemplating mystical and weird things
		100 = CM.6128 # Takes up writing poetry
		100 = CM.6130 # Becomes possessed
		100 = CM.6132 # Starts drinking...

		# Meddling mother events
		100 = CM.1150 # Your mother starts to meddle in your affairs (hidden)
		100 = CM.1160 # Mother dislikes your spouse
		100 = CM.1172 # Mother dislikes your councillor
		100 = CM.1180 # Mother insists on being regent
		100 = CM.1192 # Mother seduces your spouse

		# Other Charlemagne/Carloman
		100 = CM.1132 # Vassal switches sides between Charlemagne/Carloman

		ogier_the_dane = {
			delay = 120

			750 = 0
			250 = CM.1070
		}
	}
}

# Character scope
on_bi_yearly_pulse = {
	events = {
		CM.1050 # Roland arrives at court
		CM.1105 # Emergence of Widukind
	}
}

# Character scope
on_decade_pulse = {
	random_events = {
		hero_knight = {
			delay = 33

			940 = 0
			 60 = CM.2000 # Hero knight appears
		}
	}
}

# ROOT is any leader in battle on winning side (except the leader)
# FROM is opponent army leader
on_battle_won = {
	random_events = {
		50 = CM.1054 # Death of Roland
	}
}

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

on_major_battle_won_leader = {
	events = {
		CM.10031 # Chronicle event - Won battle but didn't participate myself
	}
}

# ROOT is any leader in battle on losing side (except the leader)
# FROM is opponent army leader
on_battle_lost = {
	random_events = {
		200 = CM.1056 # Death of Roland
	}
}

# ROOT is any leader in battle on losing side (except the leader)
# FROM is opponent army leader
on_major_battle_lost = {
	events = {
		CM.10030 # Chronicle
	}
}

# ROOT is losing army leader
# FROM is opponent army leader
on_major_battle_lost_leader = {
	events = {
		CM.10032 # Lost battle but didn't participate myself
	}
}

# ROOT is the owner (?) of the unit
# FROM is the taken holding title
on_siege_won_leader = {
	events = {
		CM.10033 # Chronicle for certain major locations
		CM.10034 # Chronicle for certain major locations
	}
}

# ROOT is the owner of the winning unit
# FROM is the taken holding title
on_siege_over_winner = {
	events = {
		CM.1101 # Destruction of Irminsul
		CM.10035 # Chronicle for certain major locations
	}
}

# Character scope
on_birth = {
	events = {
		CM.10011 # Chronicle entry
	}
}

# new_character is the targetted enemy
# ROOT is the religious head
# FROM is the attacked kingdom title
on_crusade_creation = {
	events = {
		CM.10015 # Chronicle entry
	}
}

# Sent to employers of both spouses
# ROOT is employer
# FROM is employers "employee"
# new_character is the other spouse.
on_marriage = {
	events = {
		CM.10023 # Chronicle entry
		CM.10036 # Chronicle entry - primary heir
	}
}

# Triggers if someone becomes imprisoned by the diplo-action
# ROOT is prisoner
# FROM is imprisoner
on_became_imprisoned = {
	events = {
		CM.10024 # Chronicle entry
	}
}

# Triggers if someone is released from prison
# ROOT is prisoner
# FROM is imprisoner
on_released_from_prison = {
	events = {
		CM.10025 # Chronicle entry
		CM.15002 # Free anyone thrown into the desert
	}
}

# Character scope, isn't dead yet
on_death = {
	events = {
		CM.1068  # Carloman dies
		CM.1069  # Charlemagne dies
		CM.1081  # Carloman's widow dies
		CM.10010 # Chronicle entry
	}
}

OFFER_PEACE_INTERACTION_ACCEPT_EVENT = {
	events = {
		CM.1407 # Charlemagne in Spain
	}
}

CALL_ALLY_INTERACTION_ACCEPT_EVENT = {
	events = {
		CM.10014 # Chronicle event
	}
}

ASK_TO_JOIN_WAR_INTERACTION_ACCEPT_EVENT = {
	events = {
		CM.10013 # Chronicle event
	}
}

# ROOT is the target title
# new_character is the enemy
# FROM is the winner
on_crusade_success = {
	events = {
		CM.10016 # Chronicle entry
	}
}

# ROOT is the target title
# new_character is the enemy
# FROM is the Pope/Caliph
on_crusade_failure = {
	events = {
		CM.10017 # Chronicle entry
	}
}

# ROOT is the creating character
# FROM is the title
on_create_title = {
	events = {
		CM.1500 # Charlemagne's coronation
		CM.10021 # Chronicle event
	}
}

# ROOT is the character
# FROM is the title
# FROMFROM is the old holder
on_new_holder = {
	events = {
		CM.501 # Fall of the Kingdom of the Avars
		CM.502 # Fall of the Kingdom of the Lombards
	}
}

# ROOT is the character
# FROM is the title
# FROMFROM is the old holder
on_new_holder_inheritance = {
	events = {
		CM.10039 # Chronicle entry
		CM.501 # Fall of the Kingdom of the Avars
		CM.502 # Fall of the Kingdom of the Lombards
	}
}

# ROOT is the character
# FROM is the title
# FROMFROM is the old holder
on_new_holder_usurpation = {
	events = {
		CM.10022 # Chronicle event
		CM.501 # Fall of the Kingdom of the Avars
		CM.502 # Fall of the Kingdom of the Lombards
	}
}

# Fires at the end of each year if the chronicle is empty
# ROOT is player character
on_create_chronicle_if_empty = {
	random_events = {
		100 = CM.10500 # Dragon Sighted
		100 = CM.10502 # Giant sighted
		100 = CM.10504 # Sea serpents sighted
		100 = CM.10506 # Strange shapes seen dancing on the moon
		100 = CM.10507 # Ten feet tall woman
		100 = CM.10509 # Raining blood
		100 = CM.10511 # Strange plague kills rabbits
		100 = CM.10513 # Earthquake
		100 = CM.10515 # Flood
		100 = CM.10517 # Two suns were seen
		100 = CM.10519 # Goat with three heads was born
		100 = CM.10521 # Bird invasion
		100 = CM.10523 # Many children born in province
		100 = CM.10525 # Province celebrates beloved ruler
		100 = CM.10527 # A star falls from the sky
		100 = CM.10529 # Bountiful harvest
	}
}

# 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)
# If player used Ruler Designer, fires for both historical and new character
# ROOT is player character
on_chronicle_start = {
	events = {
		CM.10000 # When chronicle is begun
	}
}

# Character converts religion, for whatever reason
# ROOT is the character after conversion
# FROM scope has the old religion
on_character_convert_religion = {
	events = {
		CM.10026 # Chronicle event
	}
}

# Character converts culture, for whatever reason
# ROOT is the character after conversion
# FROM scope has the old culture
on_character_convert_culture = {
	events = {
		CM.10027 # Chronicle event - When a character converts to a new culture
		CM.501 # Fall of the Kingdom of the Avars
		CM.502 # Fall of the Kingdom of the Lombards
	}
}

# Character scope
on_acquire_nickname = {
	events = {
		CM.10028 # Chronicle event - When a character acquires a nickname
	}
}

# FROM is attacker
# ROOT is defender
on_war_started = {
	events = {
		CM.10012 # Chronicle event - War
	}
}

# FROM is attacker
# ROOT is defender
on_war_ended_victory = {
	events = {
		CM.10038 # Chronicle event - Peace, attacker won
	}
}

# FROM is attacker
# ROOT is defender
on_war_ended_whitepeace = {
	events = {
		CM.10040 # Chronicle event - Peace, whitepeace
	}
}

# FROM is attacker
# ROOT is defender
on_war_ended_defeat = {
	events = {
		CM.10041 # Peace, defender won
	}
}

# FROM is divorcer
# ROOT is spouse
# new_character is religious head, if applicable
on_divorce = {
	events = {
		CM.10037 # Divorce
	}
}


# Triggers for character when they are put in command of a flank
# ROOT is the affected character
on_command_unit = {
	events = {
		CM.1058 # Roland is very brave on campaign
	}
}

# Triggers for character when they are put in command of a subunit
# ROOT is the affected character
on_command_sub_unit = {
	events = {
		CM.1058 # Roland is very brave on campaign
	}
}
