on_startup = {
	events = {
		ipcm.000 #initialization
		ipcm.900 #clearing false title flags
	}
}


on_yearly_pulse = {
	events = {
		ipcm.087 #emperor maintenance
		ipcm.093 #rank 3 member no longer direct vassal
	}
}

on_bi_yearly_pulse = {
	random_events = {
		100 = ipc.500 #emperor flavor tombola
	}
}


on_five_year_pulse = {
	events = {
		ipcm.080 #AI joining/ranking
	}
}

on_death = {
	events = {
		ipc.700 #empire claim if society influence high
		ipcm.092 #revolting office holder dies
		ipcq.1002 #character on mission dies
	}
}

on_adulthood = {
	events = {
		ipcm.014 #child emperor grows up
	}
}

on_artifact_inheritance = {
	events = {
		ipcm.088 #destroy tribute chests
	}
}


on_society_bi_yearly_pulse = {
	#events = { }
	
	random_events = {
		80 = ipcq.000 #generic mission tombola
		100 = ipc.300 #generic flavor tombola
	}
}


# 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 = {
		ipcq.1000 #influence and notifications
	}
}

# 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 = {
		ipcq.1001 #influence and notifications	
	}
}



# ROOT is the character, FROM is the title, FROMFROM is the old holder
on_new_holder = {
	events = {
		ipcm.017 #multi empire management
	}
}

# ROOT is the character, FROM is the title, FROMFROM is the old holder
on_new_holder_inheritance = {
	events = {
		ipcm.011 #new emperor
		ipcm.017 #multi empire management
	}
}

# ROOT is the character, FROM is the title, FROMFROM is the old holder
on_new_holder_usurpation = {
	events = {
		ipcm.015 #vassal usurped empire
		ipcm.017 #multi empire management
	}
}

#From = Attacker, Root = Defender
on_war_ended_whitepeace = {
	events = {
		ipcm.089 #revolting office holders
	}
}

#From = Attacker, Root = Defender
on_war_ended_victory = {
	events = {
		ipcm.022 #gained imperial capital
		ipcm.089 #revolting office holders
	}
}

#From = Attacker, Root = Defender
on_war_ended_defeat = {
	events = {
		ipcm.021 #lost imperial capital
		ipcm.089 #revolting office holders
		#ipcm.094 #china shatter cb
	}
}



#From = Attacker, Root = Defender
on_war_ended_invalid = {
	events = {
		ipcm.089 #revolting office holders
		ipcq.242 #imperial conquest invalid
	}
}


# A character leaves or is forced to leave a society
# Root = Character
# From = Society
on_character_leave_society = {
	events = {
		ipcm.084 #player emperor leaves
		ipcm.085 #player regent leaves
		ipcm.086 #remove modifiers and flags
	}
}


# A character is removed from society for failing the potential trigger.
# Root = Character
# From = Society
on_character_kicked_from_society = {
	events = {
		ipcm.086 #remove modifiers and flags
	}
}



# A character asks to join a society. Only works on player
# Root = Character
# From = Society
on_character_ask_to_join_society = { 
	events = {
		ipc.020 #player joining
	}
}


# 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 = {
	effect = { # Effects to happen in the scope the on-action provides. Happens before any events
		if = {
			limit = { is_imperial_court_member_trigger = yes }
			set_character_flag = ipc_member
		}
	}
	#events = {
	#}
}


# A character ranks up in their society, or becomes grandmaster
# Root = Character
# From = Society
on_character_society_rank_up = { 
	effect = {
		if = {
			limit = {
				ai = yes
				is_imperial_court_member_trigger = yes
				society_rank == 3
				NOT = { has_character_flag = ipc_approved_rank_3 }
			}
			society_rank_down = 1
		}
	}
}








# ROOT is the creating character, FROM is the title
#might be needed for ck2+/hip compatibility
#on_create_title = {
#	events = {
#	}
#}









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




