namespace = AFI

#Explain inauguration preparation, ask whom to ask to be crowned by.
character_event = {
	id = AFI.1
	title = EVTNAMEAFI1
	desc = {
		trigger = {
			NOT = { has_character_flag = prez_inaug }
		}
		text = EVTDESCAAFI1
	}
	desc = {
		trigger = {
			has_character_flag = prez_inaug
		}
		text = EVTDESCBAFI1
	}
	picture = GFX_evt_judge
	border = GFX_event_normal_frame_religion
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAAFI1
		custom_tooltip = { text = sendforcjudge }
		trigger = {
			NOT = { trait = excommunicated }
			any_realm_character = {
				is_theocracy = yes
				any_liege = { character = ROOT }
				religion = ROOT
				NOT = { block_general_event_trigger = yes }
				OR = {
					higher_tier_than = BARON
					has_minor_title = title_chief_justice
				}
				NOT = { has_landed_title = d_americanist }
			}
		}
		
		random_realm_character = {
			limit = {
				is_theocracy = yes
				any_liege = { character = ROOT }
				religion = ROOT
				NOT = { block_general_event_trigger = yes }
				OR = {
					higher_tier_than = BARON
					has_minor_title = title_chief_justice
				}
				NOT = { has_landed_title = d_americanist }
			}
			preferred_limit = {
				has_minor_title = title_chief_justice
			}
			hidden_tooltip = { letter_event = { id = AFI.2 days = 30 random = 5 } } 
			break = yes
		}
		ai_chance = { 
			factor = 70
		}
	}
	option = {
		custom_tooltip = { text = sendforjudge }
		name = EVTOPTBAFI1
		trigger = {
			any_realm_character = {
				is_theocracy = yes
				any_liege = { character = ROOT }
				religion = ROOT
				lower_tier_than = COUNT
				NOT = { has_landed_title = d_americanist }
			}
		}
		if = {
			limit = {
				tier = EMPEROR
			}
			prestige = -300
			piety = -75
		}
		if = {
			limit = {
				NOT = { trait = excommunicated }
				any_realm_character = {
					is_theocracy = yes
					any_liege = { character = ROOT }
					religion = ROOT
					NOT = { block_general_event_trigger = yes }
					OR = {
						higher_tier_than = BARON
						has_minor_title = title_chief_justice
					}
					NOT = { has_landed_title = d_americanist }
				}
			}
			custom_tooltip = { text = scorned_powerful_judges }
			hidden_tooltip = { 
				any_realm_character = { 
					limit = {
						is_theocracy = yes
						any_liege = { character = ROOT }
						religion = ROOT
						NOT = { block_general_event_trigger = yes }
						OR = {
							higher_tier_than = BARON
							has_minor_title = title_chief_justice
						}
						NOT = { has_landed_title = d_americanist }
					}			
					opinion = {
						modifier = opinion_offended
						years = 10
						who = ROOT
					} 
				}
			}
		}
		random_realm_character = {
			limit = {
				is_theocracy = yes
				any_liege = { character = ROOT }
				religion = ROOT
				lower_tier_than = COUNT
				NOT = { has_landed_title = d_americanist }
			}
			preferred_limit = { 
				opinion = { 
					who = ROOT
					value = 50 
				}
			}
			preferred_limit = { 
				opinion = { 
					who = ROOT
					value = 20 
				}
			}
			hidden_tooltip = { letter_event = { id = AFI.2 days = 30 random = 5 } } 
			break = yes
		}
		ai_chance = { 
			factor = 30
			modifier = {
				factor = 1.5
				trait = slothful
			}
			modifier = {
				factor = 1.5
				trait = shy
			}
			modifier = {
				factor = 1.25
				trait = content
			}
			modifier = {
				factor = 0.7
				trait = proud
			}
			modifier = {
				factor = 0.7
				trait = ambitious
			}
			modifier = {
				factor = 0.7
				tier = EMPEROR
			}
			modifier = {
				factor = 0.5
				has_landed_title = e_usa
			}
		}
	}
	option = { #Changed your mind, not yet.
		name = EVTOPTCAFI1
		custom_tooltip = { text = inauguration_cancelled }
		hidden_tooltip = { remove_character_modifier = coronation_request_cooldown }
		ai_chance = { factor = 0 }	
	}
}

letter_event = {
	id = AFI.2
	desc = EVTDESCAFI2
	border = GFX_event_letter_frame_religion
	is_triggered_only = yes
	
	trigger = {
		FROM = {
			religion = ROOT
		}
	}
	
	option = {
		name = EVTOPTAAFI2
		trigger = {
			lower_tier_than = COUNT
		}
		random_list = { 
			50 = {
				modifier = {
					factor = 0
					NOT = { 
						opinion = { 
							who = FROM
							value = -100 
						} 
					}
				}
				modifier = {
					factor = 0.5
					NOT = { 
						opinion = { 
							who = FROM
							value = -80 
						} 
					}
				}
				modifier = {
					factor = 0.6
					NOT = { 
						opinion = { 
							who = FROM
							value = -60 
						} 
					}
				}
				modifier = {
					factor = 0.7
					NOT = { 
						opinion = { 
							who = FROM
							value = -40 
						} 
					}
				}
				modifier = {
					factor = 0.8
					NOT = { 
						opinion = { 
							who = FROM
							value = -20 
						} 
					}
				}
				modifier = {
					factor = 1.25
					opinion = { 
						who = FROM
						value = 20 
					} 
				}
				modifier = {
					factor = 1.5
					opinion = { 
						who = FROM
						value = 40 
					} 
				}
				modifier = {
					factor = 1.5
					opinion = { 
						who = FROM
						value = 60 
					} 
				}
				modifier = {
					factor = 1.75
					opinion = { 
						who = FROM
						value = 80 
					} 
				}
				modifier = {
					factor = 2
					opinion = { 
						who = FROM
						value = 100 
					} 
				}
				FROM = { letter_event = { id = AFI.3 } } #Priest asks for nothing, proceed with coronation.
			} 
		
			50 = {  
				modifier = {
					factor = 1.5
					trait = greedy
				}
				modifier = {
					factor = 1.25
					trait = slothful
				}
				modifier = {
					factor = 1.25
					trait = envious
				}
				modifier = {
					factor = 1.5
					trait = bad_priest_americanist
				}
				FROM = { letter_event = { id = AFI.4 } } #Priest asks for small donation.
			}
		}
	}
	option = {
		desc = EVTOPTBAFI2
		trigger = {
			is_theocracy = yes
			any_liege = { character = ROOT }
			religion = ROOT
			NOT = { block_general_event_trigger = yes }
			OR = {
				higher_tier_than = BARON
				has_minor_title = title_chief_justice
			}
			NOT = { has_landed_title = d_americanist }
		}
		random_list = { 
			40 = { 
				modifier = {
					factor = 1.5
					trait = greedy
				}
				modifier = {
					factor = 1.25
					trait = slothful
				}
				modifier = {
					factor = 1.25
					trait = envious
				}
				modifier = {
					factor = 0
					NOT = { 
						opinion = { 
							who = FROM
							value = -100 
						} 
					}
				}
				modifier = {
					factor = 0.5
					NOT = { 
						opinion = { 
							who = FROM
							value = -80 
						} 
					}
				}
				modifier = {
					factor = 0.6
					NOT = { 
						opinion = { 
							who = FROM
							value = -60 
						} 
					}
				}
				modifier = {
					factor = 0.7
					NOT = { 
						opinion = { 
							who = FROM
							value = -40 
						} 
					}
				}
				modifier = {
					factor = 0.8
					NOT = { 
						opinion = { 
							who = FROM
							value = -20 
						} 
					}
				}
				FROM = { letter_event = { id = AFI.4 } } #Donate money to me.
			} 
			40 = { 
				modifier = {
					factor = 0
					OR = { 
						trait = cynical 
						trait = bad_priest_americanist
					}
				}
				modifier = {
					factor = 1.5
					trait = charitable
				}
				modifier = {
					factor = 1.5
					trait = zealous
				}
				modifier = {
					factor = 0.5
					OR = {
						trait = bad_priest_americanist
					}
				}
				modifier = {
					factor = 0
					NOT = { 
						opinion = { 
							who = FROM
							value = -100 
						} 
					}
				}
				modifier = {
					factor = 0
					b_washington = {
						holder_scope = {
							NOR = {
								religion = americanist
								religion = hamiltonian
								religion = jeffersonian
								religion = libertarian
							}
						}
					}
				}
				modifier = {
					factor = 0.5
					NOT = { 
						opinion = { 
							who = FROM
							value = -80 
						} 
					}
				}
				modifier = {
					factor = 0.6
					NOT = { 
						opinion = { 
							who = FROM
							value = -60 
						} 
					}
				}
				modifier = {
					factor = 0.7
					NOT = { 
						opinion = { 
							who = FROM
							value = -40 
						} 
					}
				}
				modifier = {
					factor = 0.8
					NOT = { 
						opinion = { 
							who = FROM
							value = -20 
						} 
					}
				}
				FROM = { letter_event = { id = AFI.5 } } #Donate money to the Judge of Washington.
			}  
			10 = { 
				modifier = {
					factor = 0
					NOT = {
						FROM = {
							any_demesne_title = {
								can_be_given_away = yes
								tier = count
								is_feudal = yes
								location = {
									is_capital = no
								}
							}
						}
					}
				}
				modifier = {
					factor = 1.5
					FROM = {
						any_demesne_title = {
							can_be_given_away = yes
							tier = count
							is_feudal = yes
							count = 2
							location = {
								is_capital = no
							}
						}
					}
				}
				modifier = {
					factor = 2
					FROM = {
						any_demesne_title = {
							can_be_given_away = yes
							tier = count
							is_feudal = yes
							count = 5
							location = {
								is_capital = no
							}
						}
					}
				}
				FROM = { letter_event = { id = AFI.6 } } #Wishes for another County.
			} 
		}
	}
}

#No Donation
letter_event = {
	id = AFI.3
	desc = EVTDESCAFI3
	border = GFX_event_letter_frame_religion
	trigger = {
		OR = {
			religion = americanist
			religion = hamiltonian
			religion = jeffersonian
			religion = libertarian
		}
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAAFI3
		set_character_flag = flag_crowned_by_priest
		FROM = { 
			save_event_target_as = coronation_priest
			show_scope_change = no	
			opinion = {
				modifier = opinion_supposed_to_crown
				months = 1
				who = ROOT
			}
			reverse_opinion = {
				modifier = opinion_supposed_to_crown
				months = 1
				who = ROOT
			}
		}
		hidden_tooltip = { character_event = { id = AFI.100 } } #Go to budget event
		ai_chance = { factor = 100 }
	}
	option = {	#End of the line
		name = EVTOPTBHF20202
		custom_tooltip = { text = inauguration_cancelled }
		ai_chance = { factor = 0 }
	}
}

#Small Donation
letter_event = {
	id = AFI.4
	desc = EVTDESCAFI4
	border = GFX_event_letter_frame_religion

	trigger = {
		OR = {
			religion = americanist
			religion = hamiltonian
			religion = jeffersonian
			religion = libertarian
		}
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20204
		set_character_flag = flag_crowned_by_priest
		FROM = { 
			save_event_target_as = coronation_priest 
			show_scope_change = no	
			opinion = {
				modifier = opinion_supposed_to_crown
				months = 1
				who = ROOT
			}
			reverse_opinion = {
				modifier = opinion_supposed_to_crown
				months = 1
				who = ROOT
			}
		}
		wealth = -150
		hidden_tooltip = { FROM = { wealth = 150 } }
		hidden_tooltip = { character_event = { id = AFI.100 } } #Go to budget event
		ai_chance = { factor = 100 }
	}
	option = {	#End of the line
		name = EVTOPTBAFI4
		custom_tooltip = { text = inauguration_cancelled }
		ai_chance = { factor = 0 }
	}
}

#Donation to Judge of Washington
letter_event = {
	id = AFI.5
	desc = EVTDESCAFI5
	border = GFX_event_letter_frame_religion

	trigger = {
		OR = {
			religion = americanist
			religion = hamiltonian
			religion = jeffersonian
			religion = libertarian
		}
	}
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAAFI5
		set_character_flag = flag_crowned_by_bishop
		FROM = { 
				show_scope_change = no	
			save_event_target_as = coronation_priest
			opinion = {
				modifier = opinion_supposed_to_crown
				months = 1
				who = ROOT
			}
			reverse_opinion = {
				modifier = opinion_supposed_to_crown
				months = 1
				who = ROOT
			}
		}
		wealth = -100
		hidden_tooltip = { b_washington = { holder_scope = { wealth = 100 } } }
		hidden_tooltip = { character_event = { id = AFI.100 } } #Go to budget event
		ai_chance = { factor = 100 }
	}
	option = {	#End of the line
		name = EVTOPTBAFI5
		custom_tooltip = { text = inauguration_cancelled }
		ai_chance = { factor = 0 }
	}
}

#Donation of County
letter_event = {
	id = AFI.6
	desc = EVTDESCAFI6
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes
	
	trigger = {
		OR = {
			religion = americanist
			religion = hamiltonian
			religion = jeffersonian
			religion = libertarian
		}
	}
	option = {
		name = EVTOPTAAFI6
		set_character_flag = flag_crowned_by_bishop
		FROM = { save_event_target_as = coronation_priest 
			show_scope_change = no	
			opinion = {
				modifier = opinion_supposed_to_crown
				months = 1
				who = ROOT
			}
			reverse_opinion = {
				modifier = opinion_supposed_to_crown
				months = 1
				who = ROOT
			}
		}
		random_demesne_title = { 
			limit = {
				can_be_given_away = yes
				tier = count
				is_feudal = yes
				location = {
					is_capital = no
				}
			}
			grant_title = FROM
		}
		hidden_tooltip = { character_event = { id = AFI.100 } } #Go to budget event
		ai_chance = { factor = 100 }
	}
	option = {	#End of the line
		name = EVTOPTBAFI6
		custom_tooltip = { text = inauguration_cancelled }
		ai_chance = { factor = 0 }
	}
}

#Judge dies
character_event = {
	id = AFI.8
	hide_window = yes
	is_triggered_only = yes

	only_rulers = yes
	min_age = 16

	trigger = {
		has_any_opinion_modifier = opinion_supposed_to_crown
	}

	immediate = {
		any_playable_ruler = { 
			limit = { 
				has_opinion_modifier = { 
					who = ROOT 
					modifier = opinion_supposed_to_crown 
				}
			}
			character_event = { id = AFI.9 }
		}
	}
}

#Informs Inauguratee that judge is dead
character_event = {
	id = AFI.9
	desc = EVTDESCAFI9

	picture = GFX_evt_judge
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	option = {
		name = EVTOPTAAFI10
		hidden_tooltip = { remove_trait = travelling }
		hidden_tooltip = { remove_character_modifier = out_traveling }
		hidden_tooltip = { set_variable = { which = inauguration_count value = 0 } }
		clr_character_flag = flag_preparing_coronation
		clr_character_flag = flag_antipope_for_coronation 
		clr_character_flag = flag_excommunicated_for_coronation 
		clr_character_flag = flag_extravagant_coronation
		clr_character_flag = flag_regular_coronation
		clr_character_flag = flag_secluded_coronation
		clr_character_flag = flag_crowned_by_priest
		clr_character_flag = flag_crowned_by_bishop
		clr_character_flag = prez_inaug

		clr_character_flag = flag_coronation_foreign_friendship
		clr_character_flag = flag_coronation_vassal_friendship
		clr_character_flag = flag_coronation_diplomacy_boost
		clr_character_flag = flag_coronation_learning_boost
		clr_character_flag = flag_coronation_guest_opinions
		clr_character_flag = flag_coronation_gain_diligent 
		clr_character_flag = flag_coronation_gain_ambitious 
		clr_character_flag = flag_coronation_haughty_child 
		clr_character_flag = flag_coronation_priest_approves 
		clr_character_flag = flag_coronation_hre_talk 
		clr_character_flag = flag_coronation_pope_talk 
		clr_character_flag = flag_coronation_foreign_teacher 
		clr_character_flag = flag_coronation_priest_disapproves 
		clr_character_flag = flag_coronation_diplomatic_incident 
		clr_character_flag = flag_coronation_cynic_taunts 
		clr_character_flag = flag_coronation_wandering_knight 
		clr_character_flag = flag_coronation_wandering_priest
		clr_character_flag = flag_coronation_random_rivalry 
		clr_character_flag = flag_coronation_secluded_embarassed 
		clr_character_flag = flag_coronation_secluded_vassals 
		clr_character_flag = flag_coronation_secluded_priest 
		clr_character_flag = flag_coronation_secluded_ambitious 
		clr_character_flag = flag_coronation_secluded_proud 
		clr_character_flag = flag_coronation_secluded_steward 


		hidden_tooltip = { 
			any_playable_ruler = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT
						modifier = opinion_coronation_guest 
					}
				}
				remove_trait = travelling
				remove_opinion = { 
					who = ROOT
					modifier = opinion_coronation_guest 
				}
				character_event = { id = AFI.10 }
			} 
			any_courtier_or_vassal = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT
						modifier = opinion_coronation_guest 
					}
				}
				remove_trait = travelling
				remove_opinion = { 
					who = ROOT
					modifier = opinion_coronation_guest 
				}
				character_event = { id = AFI.10 }
			}
		}
	}
}

#Inform guests that judge is dead
character_event = {
	id = AFI.10
	desc = EVTDESCAFI10

	picture = GFX_evt_judge
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	option = {
		name = EVTOPTAAFI10
	}
}

####Inauguration sponsor found, now decide how much money to invest in it. (REVISED WITH SCALED WEALTH)
character_event = {
	id = AFI.100
	desc = {
		trigger = {
			has_character_flag = flag_crowned_by_bishop
			war = no
		}
		text = EVTDESCAAFI100
	}
	desc = {
		trigger = {
			has_character_flag = flag_crowned_by_priest
			war = no
		}
		text = EVTDESCBAFI100
	}
	desc = {
		trigger = {
			war = yes
		}
		text = EVTDESCCAFI100
		picture = GFX_evt_mounted_combat_day_hf
	}

	picture = GFX_evt_diplomatic_greeting
	border = GFX_event_normal_frame_religion

	trigger = {
		OR = {
			religion = americanist
			religion = hamiltonian
			religion = jeffersonian
			religion = libertarian
		}
	}
	is_triggered_only = yes
	
	immediate = {
		save_event_target_as = coronation_ruler
		add_character_modifier = {
			name = out_traveling
			duration = 66
			hidden = yes #Make the character inaccessible, the ruler himself is not actually out, he's still at court.
		}
	}

	option = {
		name = EVTOPTAAFI100
		trigger = { war = no }
		set_character_flag = flag_extravagant_coronation
		custom_tooltip = { text = send_extrainaug_invitations }
		if = { 
			limit = { ai = no } #Cheaty AI...
			scaled_wealth = { value = -1 min = -250 max = -1000 }
		}
		hidden_tooltip = {
			character_event = { id = AFI.105 days = 11 } #Ceremony actually starts
			any_vassal = {
				limit =  {
					prisoner = no
					NOT = { has_character_flag = do_not_disturb }
					NOT = { has_character_modifier = holding_large_feast }
					is_adult = yes
					NOT = { trait = incapable }
					NOT = { is_inaccessible_trigger = yes }
					NOT = { has_any_opinion_modifier = opinion_coronation_guest }
				}
				character_event = { id = AFI.101 } #Send Invitations
			}
			any_independent_ruler = {
				limit = { 
					war = no
					prisoner = no
					NOT = { has_character_flag = do_not_disturb }
					NOT = { has_character_modifier = holding_large_feast }
					is_adult = yes
					NOT = { trait = incapable }
					NOT = { is_inaccessible_trigger = yes }
					NOT = { has_any_opinion_modifier = opinion_coronation_guest }
					religion = ROOT 	
					is_within_diplo_range = ROOT
					higher_real_tier_than = COUNT
					NOT = { distance_from_realm = { who = ROOT value = 120 } }
				}
				character_event = { id = AFI.102 } #Send Invitations to other Americanist neighbors
			}
		}
		ai_chance = { 
			factor = 30 
			modifier = { 
				factor = 0.5
				NOT = { scaled_wealth = 1 } 
			} 
			modifier = { 
				factor = 0.5
				NOT = { scaled_wealth = 0.5 } 
			} 
			modifier = { 
				factor = 0.25
				NOT = { wealth = 0 } 
			} 
			modifier = { 
				factor = 0
				NOT = { wealth = -100 } 
			} 
			modifier = { 
				factor = 3
				tier = EMPEROR
			} 
			modifier = { 
				factor = 0.75
				trait = greedy
			} 
		}
	}
	option = {
		name = EVTOPTBAFI100
		trigger = { war = no }
		set_character_flag = flag_regular_coronation
		custom_tooltip = { text = send_inaug_invitations }
		hidden_tooltip = {
			character_event = { id = AFI.105 days = 11 } #Ceremony actually starts
			any_vassal = {
				limit =  {
					prisoner = no
					NOT = { has_character_flag = do_not_disturb }
					NOT = { has_character_modifier = holding_large_feast }
					is_adult = yes
					NOT = { trait = incapable }
					NOT = { is_inaccessible_trigger = yes }
					NOT = { has_any_opinion_modifier = opinion_coronation_guest }
				}
				character_event = { id = AFI.101 } #Send Invitations
			}
		}
		if = { 
			limit = { ai = no } #Cheaty AI...
			scaled_wealth = { value = -0.5 min = -100 max = -500 }
		}
		ai_chance = { 
			factor = 40 
			modifier = { 
				factor = 0.5
				NOT = { scaled_wealth = 0.5 } 
			} 
			modifier = { 
				factor = 0.5
				NOT = { scaled_wealth = 0.25 } 
			} 
			modifier = { 
				factor = 0.25
				NOT = { wealth = 0 } 
			} 
			modifier = { 
				factor = 0
				NOT = { wealth = -100 } 
			} 
			modifier = { 
				factor = 0.5
				tier = EMPEROR
			} 
			modifier = { 
				factor = 0.75
				trait = greedy
			} 
		}
	}
	option = {
		name = {
			text = EVTOPTCAFI100
			trigger = {
				war = no
			}
		}
		name = {
			text = EVTOPTCAFI100_B
			trigger = {
				war = yes
			}
		}
		set_character_flag = flag_secluded_coronation
		custom_tooltip = { text = send_seclinaug_invitations }
		if = { 
			limit = { ai = no } #Cheaty AI...
			scaled_wealth = { value = -0.05 min = -10 max = -150 }
		}
		hidden_tooltip = {
			character_event = { id = AFI.105 days = 11 } #Ceremony actually starts
			any_courtier = {
				limit = { 
					is_councillor = yes 
					prisoner = no
					NOT = { has_character_flag = do_not_disturb }
					NOT = { has_character_modifier = holding_large_feast }
					is_adult = yes
					NOT = { trait = incapable }
					NOT = { is_inaccessible_trigger = yes }
					NOT = { has_any_opinion_modifier = opinion_coronation_guest }
				}
				character_event = { id = AFI.101 } #Send Invitations
			}
		}
		ai_chance = { 
			factor = 30 
			modifier = { 
				factor = 0.25
				NOT = { wealth = 0 } 
			} 
			modifier = { 
				factor = 3
				NOT = { wealth = -100 } 
			} 
			modifier = { 
				factor = 0.1
				tier = EMPEROR
			} 
			modifier = { 
				factor = 1.5
				trait = greedy
			}
		}
	}
}

#Invitations
letter_event = {
	id = AFI.101
	desc = EVTDESCAFI101
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes
	trigger = {
		FROM = {
			OR = {
				has_character_flag = flag_crowned_by_bishop
				has_character_flag = flag_crowned_by_priest
			}
		}
	}
	
	option = {
		name = EVTOPTAAFI101
		hidden_tooltip = { FROM = { character_event = { id = AFI.102 days = 3 random = 5 } } } #Notification.
		opinion = {
			modifier = opinion_coronation_guest
			months = 4
			who = FROM
		}
		add_character_modifier = {
			name = out_traveling #Vassal travel is short, so no regent needed.
			duration = 45
		}
		ai_chance = { 
			factor = 70 
		}
	}
	option = {	#End of the line
		name = EVTOPTBAFI101
		hidden_tooltip = { FROM = { character_event = { id = AFI.104 days = 3 random = 5 } } } #Notification.
		FROM = { 
				show_scope_change = no	
			opinion = {
				modifier = opinion_dislike
				years = 10
				who = ROOT
			}
		}
		ai_chance = { 
			factor = 30 
			modifier = {		#Of course he will be present.
				factor = 0
				event_target:coronation_priest = { character = ROOT }
			} 
			modifier = {
				factor = 0.3
				opinion = { who = from value = 100 }
			}
			modifier = {
				factor = 0.4
				opinion = { who = from value = 80 }
			}
			modifier = {
				factor = 0.5
				opinion = { who = from value = 60 }
			}
			modifier = {
				factor = 0.65
				opinion = { who = from value = 40 }
			}
			modifier = {
				factor = 0.75
				opinion = { who = from value = 20 }
			}
			modifier = {
				factor = 0.85
				opinion = { who = from value = 0 }
			}
			modifier = {
				factor = 1.15
				NOT = { opinion = { who = from value = 0 } }
			}
			modifier = {
				factor = 1.25
				NOT = { opinion = { who = from value = -20 } }
			}
			modifier = {
				factor = 1.5
				NOT = { opinion = { who = from value = -40 } }
			}
			modifier = {
				factor = 1.5
				NOT = { opinion = { who = from value = -60 } }
			}
			modifier = {
				factor = 1.75
				NOT = { opinion = { who = from value = -80 } }
			}
			modifier = {
				factor = 2
				NOT = { opinion = { who = from value = -100 } }
			}
		}
	}
}

#Coming
letter_event = {
	id = AFI.102
	desc = EVTDESCAFI102
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes
	trigger = {
		FROM = {
			OR = {
				has_character_flag = flag_crowned_by_bishop
				has_character_flag = flag_crowned_by_priest
			}
		}
	}
	
	
	option = {
		name = EVTOPTAAFI102
		hidden_tooltip = { FROM = { character_event = { id = AFI.103 days = 5 random = 5 } } } #Notification.
		FROM = { 
			prestige = 75	# Prestigious guests bring prestige.
		}
		opinion = {
			modifier = opinion_coronation_guest
			months = 4
			who = FROM
		}
		add_trait = travelling #Foreign King's travel is longer, it needs a regent, as if it were a pilgrimage.
		ai_chance = { 
			factor = 70 
		}
	}
	option = {	#End of the line
		name = EVTOPTBAFI102
		hidden_tooltip = { FROM = { character_event = { id = AFI.104 days = 5 random = 5 } } } #Notification.
		FROM = { 
				show_scope_change = no	
			opinion = {
				modifier = opinion_dislike
				years = 10
				who = ROOT
			}
		}
		ai_chance = { 
			factor = 30
			modifier = {		#Of course he will be present.
				factor = 0
				event_target:coronation_priest = { character = ROOT }
			} 
			modifier = {
				factor = 0.3
				opinion = { who = from value = 100 }
			}
			modifier = {
				factor = 0.4
				opinion = { who = from value = 80 }
			}
			modifier = {
				factor = 0.5
				opinion = { who = from value = 60 }
			}
			modifier = {
				factor = 0.65
				opinion = { who = from value = 40 }
			}
			modifier = {
				factor = 0.75
				opinion = { who = from value = 20 }
			}
			modifier = {
				factor = 0.85
				opinion = { who = from value = 0 }
			}
			modifier = {
				factor = 1.15
				NOT = { opinion = { who = from value = 0 } }
			}
			modifier = {
				factor = 1.25
				NOT = { opinion = { who = from value = -20 } }
			}
			modifier = {
				factor = 1.5
				NOT = { opinion = { who = from value = -40 } }
			}
			modifier = {
				factor = 1.5
				NOT = { opinion = { who = from value = -60 } }
			}
			modifier = {
				factor = 1.75
				NOT = { opinion = { who = from value = -80 } }
			}
			modifier = {
				factor = 2
				NOT = { opinion = { who = from value = -100 } }
			}
		}
	}
}

#Notify Inauguratee coming
letter_event = {
	id = AFI.103
	desc = EVTDESCAFI103

	trigger = {
		OR = {
			religion = americanist
			religion = hamiltonian
			religion = jeffersonian
			religion = libertarian
		}
		OR = {
			has_character_flag = flag_crowned_by_bishop
			has_character_flag = flag_crowned_by_priest
		}
	}
	notification = yes
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAAFI103
	}
}

#Notify Inauguratee not coming
letter_event = {
	id = AFI.104
	desc = EVTDESCAFI104

	trigger = {
		OR = {
			religion = americanist
			religion = hamiltonian
			religion = jeffersonian
			religion = libertarian
		}
		OR = {
			has_character_flag = flag_crowned_by_bishop
			has_character_flag = flag_crowned_by_priest
		}
	}
	notification = yes
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAAFI104
	}
}

character_event = {
	id = AFI.105
	desc = {
		trigger = {
			has_character_flag = flag_extravagant_coronation 
			war = no
		}
		text = EVTDESCAAFI105
	}
	desc = {
		trigger = {
			has_character_flag = flag_regular_coronation
			war = no
		}
		text = EVTDESCBAFI105
	}
	desc = {
		trigger = {
			has_character_flag = flag_secluded_coronation
			war = no
		}
		text = EVTDESCCAFI105
	}

	desc = {
		trigger = {
			war = yes
		}
		text = EVTDESCDAFI105
		picture = GFX_evt_mounted_combat_day_hf
	}

	picture = GFX_evt_magnificent_castle
	border = GFX_event_normal_frame_religion

	trigger = { 
		OR = {
			religion = americanist
			religion = hamiltonian
			religion = jeffersonian
			religion = libertarian
		}
		OR = {
			has_character_flag = flag_crowned_by_priest
			has_character_flag = flag_crowned_by_bishop
		}
		event_target:coronation_priest = { is_alive = yes } #Check if the priest supposed to be crowning you is still alive.
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAAFI105
			#King befriends foreign ruler
			#King befriends vassal
			#King's new acquaintances improve his diplomacy/stewardship
			#King's new acquaintances improve his intrigue/learning
			#King's diplomacy helps him improve opinion of all guests
			#King's new resolve makes him lose slothful/content.
			#Proud King's trepidation makes him gain ambitious.
			#Child King's flattered and can become haughty or conscientious.
			#The coronation_priest approves of the ceremony.
			#Temperate/Celibate coronation_priest disapproves of the extravagant ceremony.
			#HRE/Francia Emperor gets a talk from the priest about being the heir of Charlemagne (chance for prestige, learning, diligent)
			#The Pope talks to the King about his duties as protector of Christendom (chance to gain zealous, cynical, learning).
			#Child king is taught by foreign ruler about stewardship.
			#Two foreign Kings (guests) become (or are) rivals, coronation_ruler with high diplomacy can help them lose rivalry and become his friends.
			#Cynical vassal (or wicked priest) annoys the coronation_priest. High diplomacy ruler may help and gain gregarious.
			#A knight comes to pledge his service to the new King/Emperor, if ruler is female/child, chance to become friend/lover or increase martial.
			#A wise priest joins the court.
			#King becomes rival of one of his vassals.

			#King is embarassed of secluded coronation, chance to gain stressed or paranoid.
			#King's vassals are offended by secluded coronation (chance to avoid with high diplomacy).
			#Coronation_priest is disappointed by secluded ceremony.
			#King is disraught by secluded ceremony (chance to lose ambitious, gain content/slothful).
			#King reflects upon secluded coronation (chance to lose proud, gain humble).
			#King's Councillor becomes his rival due to secluded coronation.
			hidden_tooltip = { set_variable = { which = inauguration_count value = 0 } } 
			hidden_tooltip = { character_event = { id = AFI.107 days = 3 random = 3 } } # First and second row of random list.
		hidden_tooltip = { long_character_event = { id = AFI.108 days = 32 } } #THE CORONATION ITSELF # For safety reasons, just in case guests die in the middle of the feast and prevent the last event from firing.
		
	}
}

character_event = {
	id = AFI.106
	desc = EVTDESCAFI106
	hide_new = yes 

	picture = GFX_evt_fancy_feast
	border = GFX_event_normal_frame_diplomacy

	trigger = { 
		event_target:coronation_priest = { is_alive = yes } #Check if the priest supposed to be crowning you is still alive.
		event_target:coronation_ruler = { is_alive = yes } #Check if the ruler supposed to be crowned is still alive. (check for guests)
	}
	immediate = { 
		event_target:coronation_ruler = { set_character_flag = flag_coronation_gain_diligent } #to avoid the same event happening twice during the coronation.
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAAFI106
		trigger = { trait = content }
		prestige = 75
		random = { 
			chance = 50
			remove_trait = content 
			hidden_tooltip = { character_event = { id = 38299 } } 
		}
		ai_chance = { 	
			factor = 50	
		}
	}
	option = {
		name = EVTOPTABFI106
		trigger = { trait = slothful }
		piety = 20
		random = { 
			chance = 50
			remove_trait = slothful 
			hidden_tooltip = { character_event = { id = 38298 } } 
		}
		ai_chance = { 	
			factor = 50		
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = AFI.107 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

character_event = {
	id = AFI.107
	hide_window = yes

	trigger = { 
		event_target:coronation_ruler = {
			OR = {
				religion = americanist
				religion = hamiltonian
				religion = jeffersonian
				religion = libertarian
			}
			OR = {
				has_character_flag = flag_crowned_by_priest
				has_character_flag = flag_crowned_by_bishop
			}
			OR = {
				NOR = {
					trait = inaug_by_judge
					trait = inaug_by_cjudge
					trait = inaug_prez
				} 
				has_character_flag = prez_inaug
			}
		} 
		event_target:coronation_priest = { is_alive = yes } #Check if the priest supposed to be crowning you is still alive.
		event_target:coronation_ruler = { is_alive = yes } #Check if the ruler supposed to be crownied is still alive.
		#NOT = { check_variable = { which = coronation_count value = 2 } } #Stop at second row.
	}

	is_triggered_only = yes
	
	immediate = {
		if =  { 
			limit = { 
				NOT = { check_variable = { which = inauguration_count value = 2 } } 
			}
			random_inaug_events_effect = yes	
		}
		if =  { 
			limit = { 
				check_variable = { which = inauguration_count value = 2 } 
			}
			long_character_event = { id = AFI.108 days = 15 } #THE CORONATION ITSELF.
		}
		change_variable = { which = inauguration_count value = 1 }
	}
}

long_character_event = {
	id = AFI.108
	title = EVTTITLEAFI108
	desc = {
		trigger = {
			ROOT = { 
				war = no
				NOT = { has_character_flag = prez_inaug }
				NOT = { has_character_flag = flag_secluded_coronation }
				NOT = { has_character_flag = flag_crowned_by_pope }
				age = 16
			}
		}
		text = EVTDESCAAFI108		# Localization for any adult ruler crowned by a Bishop or Priest (not in a barn).
		picture = GFX_evt_inauguration
	}
	desc = {
		trigger = {
			ROOT = { 
				war = no
				NOT = { has_character_flag = prez_inaug }
				NOT = { has_character_flag = flag_secluded_coronation }
				NOT = { has_character_flag = flag_crowned_by_pope }
				NOT = { age = 16 }
			}
		}
		text = EVTDESCBAFI108		# Localization for any child ruler crowned by a Bishop or Priest (not in a barn).
		picture = GFX_evt_inauguration
	}
	desc = {
		trigger = {
			ROOT = { 
				war = no
				NOT = { has_character_flag = prez_inaug }
				has_character_flag = flag_secluded_coronation
				NOT = { has_character_flag = flag_crowned_by_pope }
			}
		}
		text = EVTDESCCAFI108		# Localization for any ruler crowned by a Bishop or Priest in a barn.
		picture = GFX_evt_inauguration
	}
	desc = {
		trigger = {
			ROOT = { 
				war = yes
				NOT = { has_character_flag = prez_inaug }
				NOT = { has_character_flag = flag_crowned_by_pope }
			}
		}
		text = EVTDESCDAFI108		# War Coronation description.
		picture = GFX_evt_mounted_combat_day_hf
	}
	desc = {
		trigger = {
			ROOT = { 
				has_character_flag = prez_inaug
				age = 35
			}
		}
		text = EVTDESCEAFI108		#President Inauguration
		picture = GFX_evt_inauguration
	}

	picture = GFX_evt_inauguration
	border = GFX_event_long_frame_religion
	hide_new = yes

	trigger = { 
		NOT = { has_character_flag = flag_being_coronated }
		event_target:coronation_ruler = { 
			OR = {
				religion = americanist
				religion = hamiltonian
				religion = jeffersonian
				religion = libertarian
			}
			OR = {
				has_character_flag = flag_crowned_by_priest
				has_character_flag = flag_crowned_by_bishop
			}
			OR = {
				NOR = {
					trait = inaug_by_judge
					trait = inaug_by_cjudge
					trait = inaug_prez
				} 
				has_character_flag = prez_inaug
			} 
		}
		event_target:coronation_priest = { is_alive = yes } #Check if the priest supposed to be crowning you is still alive.
		event_target:coronation_ruler = { is_alive = yes } #Check if the ruler supposed to be crowned is still alive. (check for guests)
		event_target:coronation_ruler = { character = ROOT }
	}

	is_triggered_only = yes

	immediate = { 

		if = {
			limit = {
				has_character_flag = flag_secluded_coronation
				war = no
			}
			sound_effect = coronation_barn
		}
		else_if = {
			limit = {
				has_character_flag = flag_extravagant_coronation
			}
			sound_effect = coronation_extravagant
		}
		else = {
			sound_effect = coronation_normal
		}
		ROOT = {
			remove_character_modifiers = { modifier = uninaug_modifier amount = 30 } 
			set_variable = { which = uninaug_count value = 0 }
			set_character_flag = flag_being_coronated #Safety check to avoid double event.
		}
		ROOT = { save_persistent_event_target = { name = coronation_priest_per scope = event_target:coronation_priest } } #Needed to localize the trait properly.
	} 
	option = {
		name = EVTOPTAAFI108
		#Assign proper trait.
		if = { 
			limit = { 
				has_character_flag = flag_crowned_by_bishop 
			} 
			custom_tooltip = { text = tooltip_gain_inaug_by_cjudge }
			hidden_tooltip = { add_trait = inaug_by_cjudge }
		}
		if = { 
			limit = { 
				has_character_flag = flag_crowned_by_priest
			} 
			custom_tooltip = { text = tooltip_gain_inaug_by_judge }
			hidden_tooltip = { add_trait = inaug_by_judge }
		}
		if = {
			limit = {
				has_character_flag = prez_inaug
			}
			custom_tooltip = { text = prez_inaug_TT }
			hidden_tooltip = { add_trait = inaug_prez }
		}
		#Assign possible modifier.
		if = { 
			limit = { 
				war = no
				has_character_flag = flag_secluded_coronation 
				NOT = { has_character_flag = flag_crowned_by_pope } 
			} 
			add_character_modifier = {
				name = inaug_in_barn
				days = -1
			}
		}
		if = { 
			limit = { 
				war = yes
				has_character_flag = flag_secluded_coronation 
			} 
			add_character_modifier = {
				name = inaug_in_war
				days = -1
			}
		}
		if = { 
			limit = { 
				has_character_flag = flag_extravagant_coronation 
				NOT = { has_character_flag = flag_crowned_by_priest } 
			} 
			add_character_modifier = {
				name = extravagant_inaug
				days = 7300
			}
		}
		#Notify all guests, then conclude the ceremony.
		hidden_tooltip = {  
			character_event = { id = AFI.111 days = 3 random = 3 } #wrap up, clear all flags.
			any_vassal = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				}
				long_character_event = { id = AFI.109 } #Coronation event for guests.
				character_event = { id = AFI.112 days = 3 random = 3 } #wrap up, clear all flags.
			}
			any_vassal = { 
				limit = { 
					NOT = { 
						has_opinion_modifier = { 
							who = ROOT 
							modifier = opinion_coronation_guest 
						}
					}
				}
				character_event = { id = AFI.110 } #Smaller notification for vassals who did not attend to the ceremony.
			}
			any_independent_ruler = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				}
				long_character_event = { id = AFI.109 } #Coronation event for guests.
				character_event = { id = AFI.112 days = 3 random = 3 } #wrap up, clear all flags.
			} 
		} 
		ai_chance = { 	
			factor = 95		
		}
	}
	after = { 	
		hidden_tooltip = { remove_character_modifier = coronation_request_cooldown }
		clr_character_flag = flag_being_coronated
	}
}

long_character_event = {
	id = AFI.109
	title = EVTTITLEAFI109
	desc = {
		trigger = {
			FROM = { 
				war = no
				NOT = { has_character_flag = flag_secluded_coronation }
				NOT = { has_character_flag = prez_inaug }
				age = 16
			}
		}
		text = EVTDESCAAFI109		# Localization for any adult ruler crowned by a Bishop or Priest (not in a barn).
		picture = GFX_evt_inauguration
	}
	desc = {
		trigger = {
			FROM = { 
				war = no
				NOT = { has_character_flag = flag_secluded_coronation }
				NOT = { has_character_flag = prez_inaug }
				NOT = { age = 16 }
			}
		}
		text = EVTDESCBAFI109		# Localization for any child ruler crowned by a Bishop or Priest (not in a barn).
		picture = GFX_evt_inauguration
	}
	desc = {
		trigger = {
			FROM = { 
				war = no
				has_character_flag = flag_secluded_coronation
				NOT = { has_character_flag = prez_inaug }
			}
		}
		text = EVTDESCCAFI109		# Localization for any ruler crowned by a Bishop or Priest in a barn.
		picture = GFX_evt_inauguration
	}
	desc = {
		trigger = {
			FROM = { 
				war = yes
				NOT = { has_character_flag = flag_crowned_by_pope }
				NOT = { has_character_flag = prez_inaug }
			}
		}
		text = EVTDESCDAFI109		# War Coronation description.
		picture = GFX_evt_mounted_combat_day_hf
	}
	desc = {
		trigger = {
			FROM = { 
				has_character_flag = prez_inaug
				age = 35
			}
		}
		text = EVTDESCEAFI109
		picture = GFX_evt_inauguration
	}
	picture = GFX_evt_inauguration
	border = GFX_event_long_frame_religion

	trigger = { 
		event_target:coronation_priest = { is_alive = yes } #Check if the priest supposed to be crowning you is still alive.
		event_target:coronation_ruler = { is_alive = yes } #Check if the ruler supposed to be crowned is still alive. (check for guests)
		has_opinion_modifier = { 
			who = event_target:coronation_ruler 
			modifier = opinion_coronation_guest 
		}
	}

	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				FROM = { has_character_modifier = extravagant_inaug }
			}
			sound_effect = coronation_extravagant
		}
		else = {
			sound_effect = coronation_normal
		}
	}

	option = {
		name = EVTOPTAAFI109

		#Assign scaled piety.
		if = { 
			limit = { 
				FROM = { has_character_flag = flag_crowned_by_bishop } 
			} 
			piety = 20
		}
		if = { 
			limit = { 
				FROM = { has_character_flag = flag_crowned_by_priest } 
			} 
			piety = 30
		}

		#Assign scaled prestige.
		if = { 
			limit = { 
				FROM = { 
					has_character_flag = flag_secluded_coronation 
					NOT = { has_character_flag = flag_crowned_by_pope } 
				}  
			} 
			prestige = -25
		}
		if = { 
			limit = { 
				FROM = { has_character_flag = flag_regular_coronation }  
			} 
			prestige = 50
		}
		if = { 
			limit = { 
				FROM = { 
					has_character_flag = flag_extravagant_coronation 
					NOT = { has_character_flag = flag_crowned_by_pope } 
				} 
			} 
			prestige = 75
		}
		ai_chance = { 	
			factor = 100		
		}
	}
}

#Notifications for vassals who did not attend.
character_event = {
	id = AFI.110
	title = EVTTITLEAFI110
	desc = {
		trigger = {
			ROOT = { 
				war = no
			}
		}
		text = EVTDESCAFI110
	}
	desc = {
		trigger = {
			ROOT = { 
				war = yes
			}
		}
		text = EVTDESCAFI110
		picture = GFX_evt_mounted_combat_day_hf
	}

	picture = GFX_evt_inauguration
	border = GFX_event_normal_frame_religion

	trigger = { 
		event_target:coronation_priest = { is_alive = yes } #Check if the priest supposed to be crowning you is still alive.
		event_target:coronation_ruler = { is_alive = yes } #Check if the ruler supposed to be crowned is still alive. (check for guests)
		vassal_of = FROM
	}
	
	immediate = {
		if = {
			limit = {
				FROM = { has_character_modifier = inaug_in_barn war = no }
			}
			sound_effect = coronation_barn
		}
		else_if = {
			limit = {
				FROM = { has_character_modifier = extravagant_coronation }
			}
			sound_effect = coronation_extravagant
		}
		else = {
			sound_effect = coronation_normal
		}
	}

	is_triggered_only = yes

	option = {
		name = EVTOPTAAFI110
		ai_chance = { 	
			factor = 100		
		}
	}
}

#Crowned King: the Coronation ceremony has concluded. END OF THE LINE. HIDDEN FOR REDUNDANCY.
character_event = {
	id = AFI.111
	desc = EVTDESCAFI111
	hide_window = yes

	picture = GFX_evt_judge
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	#option = {
	#	name = EVTOPTAHF20369
	immediate = {
		hidden_tooltip = { #Post-ceremony flavor.
			if = { 
				limit = { has_character_modifier = inaug_in_barn } 
				random = { 
					chance = 30 
					character_event = { id = AFI.117 days = 100 random = 100 } #Emperor humbled by Crowning in a barn.
				}
			}
			random = { 
				chance = 30 
			} 
			if = { 
				limit = { has_character_flag = flag_extravagant_coronation } 
				random = { 
					chance = 30 
					character_event = { id = AFI.122 days = 50 random = 50 } #Peasants are still celebrating after the coronation. What do you do?
				}
			}
			if = { 
				limit = { has_character_flag = flag_extravagant_coronation } 
				random = { 
					chance = 30 
					character_event = { id = AFI.123 days = 50 random = 50 } #Word of great coronation spreads, giving additional prestige.
				}
			}
			if = { 
				limit = { has_character_flag = flag_extravagant_coronation } 
				random = { 
					chance = 30 
					character_event = { id = AFI.124 days = 150 random = 150 } #Capital economy increased because of coronation.
				}
			}
		}
		hidden_tooltip = { remove_character_modifier = out_traveling }
		hidden_tooltip = { remove_trait = travelling }
		hidden_tooltip = { set_variable = { which = coronation_count value = 0 } }

		clr_character_flag = flag_preparing_coronation 
		clr_character_flag = flag_antipope_for_coronation 
		clr_character_flag = flag_excommunicated_for_coronation 
		clr_character_flag = flag_pepin_for_coronation 
		clr_character_flag = flag_extravagant_coronation
		clr_character_flag = flag_regular_coronation
		clr_character_flag = flag_secluded_coronation

		clr_character_flag = flag_crowned_by_priest
		clr_character_flag = flag_crowned_by_bishop
		clr_character_flag = prez_inaug

		clr_character_flag = flag_coronation_foreign_friendship
		clr_character_flag = flag_coronation_vassal_friendship
		clr_character_flag = flag_coronation_diplomacy_boost
		clr_character_flag = flag_coronation_learning_boost
		clr_character_flag = flag_coronation_guest_opinions
		clr_character_flag = flag_coronation_gain_diligent 
		clr_character_flag = flag_coronation_gain_ambitious 
		clr_character_flag = flag_coronation_haughty_child 
		clr_character_flag = flag_coronation_priest_approves 
		clr_character_flag = flag_coronation_hre_talk 
		clr_character_flag = flag_coronation_pope_talk 
		clr_character_flag = flag_coronation_foreign_teacher 
		clr_character_flag = flag_coronation_priest_disapproves 
		clr_character_flag = flag_coronation_diplomatic_incident 
		clr_character_flag = flag_coronation_cynic_taunts 
		clr_character_flag = flag_coronation_wandering_knight 
		clr_character_flag = flag_coronation_wandering_priest
		clr_character_flag = flag_coronation_random_rivalry 
		clr_character_flag = flag_coronation_secluded_embarassed 
		clr_character_flag = flag_coronation_secluded_vassals 
		clr_character_flag = flag_coronation_secluded_priest 
		clr_character_flag = flag_coronation_secluded_ambitious 
		clr_character_flag = flag_coronation_secluded_proud 
		clr_character_flag = flag_coronation_secluded_steward 
	}
}

#Coronation Guest: the Coronation ceremony has concluded. END OF THE LINE.
character_event = {
	id = AFI.112
	desc = {
		trigger = {
			FROM = { 
				war = no
			}
		}
		text = EVTDESCHFB20370
	}
	desc = {
		trigger = {
			FROM = { 
				war = yes
			}
		}
		text = EVTDESCBAFI112		# War Coronation description.
		picture = GFX_evt_mounted_combat_day_hf
	}

	picture = GFX_evt_judge
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	option = {
		name = EVTOPTAHF20370
		if = { 
			limit = { trait = travelling }
			remove_trait = travelling
		}
		if = { 
			limit = { has_character_modifier = out_traveling }
			remove_character_modifier = out_traveling
		}
		hidden_tooltip = {
			remove_opinion = {
				modifier = opinion_coronation_guest
				who = FROM
			}
		}
		if = { 
			limit = { 
				FROM = { has_character_modifier = extravagant_inaug }
				independent = yes
				higher_real_tier_than = COUNT
				OR = { 
					has_character_modifier = inaug_in_barn
					OR = {
						NOR = {
							trait = inaug_by_judge
							trait = inaug_by_cjudge
							trait = inaug_prez
						} 
						has_character_flag = prez_inaug
					}
				}
			}
			hidden_tooltip = { character_event = { id = AFI.125 days = 50 random = 50 } } #Envious ruler who isn't crowned or is crowned in barn is upset that his host had a good coronation.
		}

	}
}

character_event = {
	id = AFI.113
	desc = EVTDESCAFI113

	picture = GFX_evt_daughter_asking_father
	border = GFX_event_normal_frame_diplomacy

	trigger = { 
		has_dlc = "Holy Fury"
		FROM = {
			is_married = ROOT
			OR = {
				NOR = {
					trait = inaug_by_judge
					trait = inaug_by_cjudge
					trait = inaug_prez
				} 
				has_character_flag = prez_inaug
			}
			OR = {
				religion = americanist
				religion = hamiltonian
				religion = jeffersonian
				religion = libertarian
			}
			higher_real_tier_than = COUNT
		}
	}

	is_triggered_only = yes

	option = {
		name = EVTOPTAHF20378
		custom_tooltip = { text = spouse_informed_inaug }
		opinion = {
			modifier = opinion_uncrowned_failure
			years = 5
			who = FROM
		}
		hidden_tooltip = { FROM = { character_event = { id = AFI.114 } } }
		ai_chance = { 	
			factor = 75	
		}
	}
	option = {
		name = EVTOPTBHF20378
		ai_chance = { 	
			factor = 25
			modifier = 	{ 
				factor = 0
				NOT = { trait = kind }
				NOT = { trait = patient }
			}
		}
	}
}
#Ruler: Your spouse is upset.
character_event = {
	id = AFI.114
	desc = EVTDESCAFI114

	picture = GFX_evt_daughter_asking_father
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	option = { #Look who's talking.
		name = EVTOPTAHF20379
		trigger = { 
			FROM = { 
				is_ruler = yes 
				higher_real_tier_than = COUNT
				NOR = { 
					trait = inaug_by_judge
					trait = inaug_by_cjudge
					trait = inaug_prez
				}
			} 
		}
		tooltip = {
			FROM = {
				prestige = -75
				opinion = {
					modifier = opinion_uncrowned_failure
					years = 5
					who = ROOT
				}
			}
		}
		add_rival = FROM
		hidden_tooltip = { FROM = { character_event = { id = AFI.115 } } }
		ai_chance = { 	
			factor = 25
			modifier = { 
				factor = 3
				trait = envious
			}
			modifier = { 
				factor = 3
				trait = proud
			}
		}
	}
	option = {
		name = EVTOPTBHF20379
		trigger = { diplomacy = 15 }
		tooltip_info = diplomacy
		prestige = 75
		FROM = {
				show_scope_change = no	
			remove_opinion = {
				modifier = opinion_uncrowned_failure
				who = ROOT
			}
		}
		hidden_tooltip = { FROM = { character_event = { id = HF.20381 } } }
		ai_chance = { 	
			factor = 50
		}
	}
	option = {
		name = EVTOPTCHF20379
		trigger = { 
			OR = { trait = lustful 
				is_lover = FROM
			} 
			FROM = { 
				NOR = { 
					trait = chaste 
					trait = celibate
				} 
			}
		}
		tooltip_info = lustful
		piety = -20
		tooltip = {
			FROM = {
				show_scope_change = no	
				remove_opinion = {
					modifier = opinion_uncrowned_failure
					who = ROOT
				}
			}
		}
		hidden_tooltip = { FROM = { character_event = { id = HF.20382 } } }
		ai_chance = { 	
			factor = 50
		}
	}
	option = {
		name = EVTOPTDHF20379
		tooltip = {
			FROM = {
				opinion = {
					modifier = opinion_uncrowned_failure
					years = 5
					who = ROOT
				}
			}
		}
		ai_chance = { 	
			factor = 25
			modifier = 	{ 
				factor = 0
				NOT = { trait = kind }
				NOT = { trait = patient }
			}
		}
	}
}

character_event = {
	id = AFI.115
	desc = EVTDESCAFI115

	picture = GFX_evt_quarrel
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	option = {
		name = EVTOPTAHF20380
		tooltip = {
			opinion = {
				modifier = opinion_uncrowned_failure
				who = FROM
				years = 5
			}
		}
		ai_chance = { 	
			factor = 100
		}
	}
}

#Remind liege they aren't inaugurated
character_event = {
	id = AFI.116
	desc = EVTDESCAFI116

	picture = GFX_evt_council
	border = GFX_event_normal_frame_diplomacy

	trigger = { 
		has_dlc = "Holy Fury"
		liege = {
			NOR = { 
				trait = inaug_by_cjudge
				trait = inaug_by_judge
				trait = inaug_prez
			}
			OR = {
				religion = americanist
				religion = hamiltonian
				religion = jeffersonian
				religion = libertarian
			}
			higher_real_tier_than = COUNT
		}
	}

	is_triggered_only = yes

	option = {
		name = EVTOPTAHF20384
		hidden_tooltip = { FROM = { character_event = { id = HF.20385 } } }
		opinion = {
			modifier = opinion_uncrowned_ruler
			years = 5
			who = FROM
		}
		ai_chance = { 	
			factor = 100
		}
	}
}

character_event = {
	id = AFI.117
	desc = EVTDESCAFI117

	picture = GFX_evt_knight_kneeling
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	trigger = { 
		tier = EMPEROR
		OR = { 
			trait = inaug_by_judge
			trait = inaug_by_cjudge
		}
		has_character_modifier = inaug_in_barn
	 } 

	option = {
		name = EVTOPTAAFI117
		trigger = { NOT = { trait = humble } } 
		prestige = -100
		if = { 
			limit = { trait = proud }
			remove_trait = proud
		} 
		add_trait = humble
		ai_chance = { 	
			factor = 40
		}
	}
	option = {
		name = EVTOPTBAFI117
		trigger = { trait = humble } 
		tooltip_info = humble
		prestige = -150
		piety = 50
		ai_chance = { 	
			factor = 40
		}
	}
	option = {
		name = EVTOPTCAFI117
		piety = -50
		if = { 
			limit = { trait = humble }
			remove_trait = humble
		} 
		ai_chance = { 	
			factor = 20
		}
	}
}

character_event = {
	id = AFI.118
	hide_window = yes


	only_rulers = yes
	min_age = 16

	is_triggered_only = yes

	trigger = { 
		has_dlc = "Holy Fury"
		OR = {
			is_feudal = yes
			is_merchant_republic = yes
		}
		higher_real_tier_than = COUNT
		ruled_years = 5
		OR = {
			religion = americanist
			religion = hamiltonian
			religion = jeffersonian
			religion = libertarian
		}
		NOR =  { 
			trait = inaug_by_judge
			trait = inaug_by_cjudge
			has_character_flag = flag_crowned_by_priest
			has_character_flag = flag_crowned_by_bishop
			government = order_government 
		}
	}

	immediate = { 
		#Random negative flavour.
		random_list = { 
			20 = { 
				character_event = { id = AFI.119 days = 100 random = 100 } #Peasants are upset.
			}
			20 = { 
				modifier = { 
					factor = 0
					NOT	= { 
						any_vassal = { 
							is_theocracy = yes
							count = 2
						}
					}
				}
				character_event = { id = AFI.120 days = 100 random = 100 } #Priests are upset.
			}
			20 = { 
				modifier = { 
					factor = 0
					is_married = no
				}
				modifier = { 
					factor = 0
					spouse = { 
						NOR = { 
							religion = americanist
							religion = hamiltonian
							religion = jeffersonian
							religion = libertarian
						}
					}
				}
				modifier = { 
					factor = 1.75
					spouse = { 
						trait = wroth
					}
				}
				modifier = { 
					factor = 1.75
					spouse = { 
						OR = { 
							trait = inaug_by_judge
							trait = inaug_by_cjudge
						}
					}
				}
				modifier = { 
					factor = 1.5
					spouse = { 
						higher_real_tier_than = ROOT
					}
				}
				spouse = { character_event = { id = AFI.114 days = 100 random = 100 } } #Spouse is upset.
			}
			20 = { 
				modifier = { 
					factor = 0
					NOT = { any_courtier_or_vassal = { has_job_title = job_chancellor } }
				}
				modifier = { 
					factor = 1.75
					any_courtier_or_vassal = { 
						has_job_title = job_chancellor 
						trait = wroth
					}
				}
				random_courtier_or_vassal = { 
					limit = { has_job_title = job_chancellor }
					character_event = { id = AFI.116 days = 100 random = 100 } #Chancellor is upset.
				} 
			}
			10 = { 
				modifier = { 
					factor = 0
					NOT = { any_courtier_or_vassal = { has_job_title = job_spiritual } }
				}
				modifier = { 
					factor = 0.25
					any_courtier_or_vassal = { 
						has_job_title = job_spiritual 
						dynasty = ROOT
					}
				}
				modifier = { 
					factor = 1.75
					any_courtier_or_vassal = { 
						has_job_title = job_spiritual 
						trait = zealous
					}
				}
				modifier = { 
					factor = 1.75
					any_courtier_or_vassal = { 
						has_job_title = job_spiritual 
						trait = diligent
					}
				}
				modifier = { 
					factor = 1.75
					any_courtier_or_vassal = { 
						has_job_title = job_spiritual 
						trait = temperate
					}
				}
				modifier = { 
					factor = 1.75
					any_courtier_or_vassal = { 
						has_job_title = job_spiritual 
						trait = wroth
					}
				}
				random_courtier_or_vassal = { 
					limit = { has_job_title = job_spiritual }
					character_event = { id = AFI.121 days = 100 random = 100 } #Court chaplain resigns in protest.
				} 
			}
			10 = { 
				modifier = { 
					factor = 0.5
					tier = EMPEROR
				}
				modifier = { 
					factor = 1.5
					piety = 200
				}
				modifier = { 
					factor = 1.5
					piety = 300
				}
				modifier = { 
					factor = 1.5
					piety = 400
				}
				modifier = { 
					factor = 1.5
					piety = 500
				}
				modifier = { 
					factor = 1.5
					piety = 600
				}
				modifier = { 
					factor = 1.5
					piety = 700
				}
				modifier = { 
					factor = 1.5
					piety = 800
				}
				modifier = { 
					factor = 1.5
					piety = 900
				}
				modifier = { 
					factor = 2
					piety = 1000
				}
				#Nothing happens.
			}
		}
	}
}

character_event = {
	id = AFI.119
	desc = EVTDESCAFI119

	picture = GFX_evt_peasants
	border = GFX_event_normal_frame_diplomacy

	only_rulers = yes

	trigger = { 
		has_dlc = "Holy Fury"
		NOR = { 
			trait = inaug_by_judge
			trait = inaug_by_cjudge
			trait = inaug_prez
		}
		OR = {
			religion = americanist
			religion = hamiltonian
			religion = jeffersonian
			religion = libertarian
		}
		capital_scope = { religion = ROOT }
		higher_real_tier_than = COUNT
	}

	is_triggered_only = yes

	option = {
		name = EVTOPTAHF20376
		capital_scope = {
			add_province_modifier = {
				name = peasant_unrest
				duration = 365
				stacking = yes
			}
		}
		ai_chance = { 	
			factor = 100		
		}
	}
}

#Church vassals upset because of uncrowned ruler.
character_event = {
	id = AFI.120
	desc = EVTDESCAFI120

	picture = GFX_evt_judge
	border = GFX_event_normal_frame_diplomacy

	only_rulers = yes

	trigger = { 
		has_dlc = "Holy Fury"
		NOR = { 
			trait = inaug_by_judge
			trait = inaug_by_cjudge
			trait = inaug_prez
		}
		OR = {
			religion = americanist
			religion = hamiltonian
			religion = jeffersonian
			religion = libertarian
		}
		higher_real_tier_than = COUNT
	}

	is_triggered_only = yes

	option = {
		name = EVTOPTAHF20377
		trigger = { learning = 12 }
		tooltip_info = learning
		custom_tooltip = { text = tooltip_explain_coronation }
		piety = 50
		ai_chance = { 	
			factor = 100		
		}
	}
	option = {
		name = EVTOPTBHF20377
		trigger = { diplomacy = 12 }
		tooltip_info = diplomacy
		custom_tooltip = { text = tooltip_explain_coronation_2 }
		prestige = 75
		ai_chance = { 	
			factor = 100		
		}
	}
	option = {
		name = EVTOPTCAFI120
		trigger = { wealth = 100 }
		custom_tooltip = { text = tooltip_bribe_church }
		wealth = -100
		religion_head = { wealth = 200 }
		ai_chance = { 	
			factor = 50		
		}
	}
	option = {
		name = EVTOPTDHF20377
		any_vassal = {
			limit = { 
				is_theocracy = yes
				religion = ROOT
			 }
			opinion = {
				modifier = opinion_uncrowned_ruler
				years = 1
				who = ROOT
			}
		}
		ai_chance = { 	
			factor = 50		
		}
	}
}

#Attorney general resigns in protest
character_event = {
	id = AFI.121
	desc = EVTDESCAFI121

	picture = GFX_evt_council
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes
	trigger = { 
		has_dlc = "Holy Fury"
		liege = {
			NOR = { 
				trait = inaug_by_cjudge
				trait = inaug_by_judge
				trait = inaug_prez
			}
			OR = {
				religion = americanist
				religion = hamiltonian
				religion = jeffersonian
				religion = libertarian
			}
			higher_real_tier_than = COUNT
		}
	}

	option = {
		name = EVTOPTAAFI121
		hidden_tooltip = { FROM = { character_event = { id = AFI.127 } } }
		remove_title = job_spiritual
		add_character_modifier = { 
			name = resigned_in_anger
			duration = -1
		}

		piety = 50
		opinion = {
			modifier = opinion_uncrowned_ruler
			years = 15
			who = FROM
		}
		ai_chance = { 	
			factor = 100
		}
	}
	option = {
		name = EVTOPTBHF20386
		ai_chance = { 	
			factor = 0
		}
	}
}

character_event = {
	id = AFI.127
	desc = EVTDESCAFI127

	picture = GFX_evt_council
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	option = {
		name = EVTOPTAAFI127
		tooltip = { 
			FROM = { 
				remove_title = job_spiritual  
				add_character_modifier = { 
					name = resigned_in_anger
					duration = -1
				}
			}
		}
		hidden_tooltip = { 
			FROM = { 
			remove_opinion = { 
					who = ROOT
					modifier = opinion_fired_from_council  
				}
			}
		} 
		ai_chance = { 	
			factor = 100
		}
	}
}

#Peasants are still celebrating coronation.
character_event = {
	id = AFI.122
	desc = EVTDESCAFI122

	picture = GFX_evt_market_hf
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	trigger = { 
		OR = { 
			trait = inaug_by_judge
			trait =inaug_by_cjudge
		}
		has_character_modifier = extravagant_inaug
	 } 

	option = { #Use excitement to build trade
		name = EVTOPTAAFI122
		trigger = { stewardship = 12 } 
		tooltip_info = stewardship
		wealth = 50
		prestige = 100
		capital_scope = {
			add_province_modifier = {
				name = coronation_improved_trade
				duration = 1265
				stacking = yes
			}
		}
		ai_chance = { 	
			factor = 100
		}
	}
	option = { #Let peasants have their fun.
		name = EVTOPTBAFI122
		prestige = 100
		capital_scope = {
			add_province_modifier = {
				name = coronation_peasants_happy
				duration = 600
				stacking = yes
			}
		}
		ai_chance = { 	
			factor = 30
		}
	}
	option = { #Have peasants return to work.
		name = EVTOPTCAFI122
		prestige = -100
		capital_scope = {
			add_province_modifier = {
				name = peasants_scorned
				duration = 400
				stacking = yes
			}
		}
		ai_chance = { 	
			factor = 10
		}
	}
}

#Word of the great coronation has spread across the realm, bringing even more prestige to the new ruler.
character_event = {
	id = AFI.123
	desc = EVTDESCAFI123

	picture = GFX_evt_diplomatic_greeting
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	trigger = { 
		OR = { 
			trait = inaug_by_judge
			trait = inaug_by_cjudge
		}
		has_character_modifier = extravagant_inaug
	 } 

	option = { 
		name = EVTOPTAHF20390
		prestige = 200
		ai_chance = { 	
			factor = 100
		}
	}
}

#Festivities for the coronation have brought in more trade.
character_event = {
	id = AFI.124
	desc = EVTDESCAFI124

	picture = GFX_evt_diplomatic_greeting
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	trigger = { 
		OR = { 
			trait = inaug_by_judge
			trait = inaug_by_cjudge
		}
		has_character_modifier = extravagant_inaug
	 } 

	option = { #Use excitement to build trade
		name = EVTOPTAHF20391
		wealth = 75
		capital_scope = {
			add_province_modifier = {
				name = coronation_improved_trade
				duration = 1265
				stacking = yes
			}
		}
		ai_chance = { 	
			factor = 100
		}
	}
}

#Former guest is envious of extravagant coronation.
character_event = {
	id = AFI.125
	desc = {
		trigger = {
			has_character_modifier = inaug_in_barn
		}
		text = EVTDESCAAFI125
	}
	desc = {
		trigger = {
			NOT = { has_character_modifier = inaug_in_barn }
		}
		text = EVTDESCBAFI125		
	}

	picture = GFX_evt_bad_news
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	trigger = { 
		FROMFROM = { has_character_modifier = extravagant_inaug }
		OR = { 
			has_character_modifier = inaug_in_barn
			NOR = { 
				trait = inaug_by_cjudge
				trait = inaug_by_judge
				trait = inaug_prez
			}
		}
	 } 
	option = { 
		name = EVTOPTAHF20392
		trigger = { trait = humble } 
		tooltip_info = humble
		piety = 50
		ai_chance = { 	
			factor = 50
		}
	}

	option = { 
		name = EVTDESCHFB20392
		if = { 
			limit = { trait = kind } 
			remove_trait = kind
			break = yes
		}
		if = { 
			limit = { 
				NOR = { 
					trait = kind 
					trait = envious
				} 
			} 
			add_trait = envious
			break = yes
		}
		if = { 
			limit = { trait = envious } 
			piety = -50
			break = yes
		}
		ai_chance = { 	
			factor = 50
		}
	}
}

character_event = {
	id = AFI.126
	hide_window = yes


	only_rulers = yes
	min_age = 16

	is_triggered_only = yes

	trigger = { 
		has_dlc = "Holy Fury"
		OR = {
			is_feudal = yes
			is_merchant_republic = yes
		}
		is_adult = yes
		is_vice_royalty = no
		NOT = { government = order_government }
		higher_real_tier_than = COUNT
		OR = {
			religion = americanist
			religion = hamiltonian
			religion = jeffersonian
			religion = libertarian
		}
		NOT = { check_variable = { which = uninaug_count value = 30 } } #Stop at minus thirty.
		NOR =  { 
			trait = inaug_by_judge
			trait = inaug_by_cjudge
			trait = inaug_prez
			has_character_flag = flag_crowned_by_priest
			has_character_flag = flag_crowned_by_bishop
		}
	}

	immediate = { 
		change_variable = { which = uninaug_count value = 1 }
		add_character_modifier = {
			name = uninaug_modifier
			duration = -1
			stacking = yes
		}
	}
}

character_event = {
	id = AFI.128
	hide_window = yes

	is_triggered_only = yes

	only_rulers = yes

	trigger = {
		has_dlc = "Holy Fury"
		religion_group = oldworld
		OR = {
			is_feudal = yes
			is_merchant_republic = yes
		} 
		independent = no
		higher_real_tier_than = COUNT #Avoid spamming.
		current_heir = { age = 12 } #At the very least
		liege = { 
			NOT = { character = ROOT }
			NOT = { 
				current_heir = { character = PREV } 
			}
			NOT = { #Prevent same vassal from giving homage multiple times when inheriting new titles within the realm (from siblings and such)
				current_heir = { vassal_of = PREV } 
			}
			OR = {
				religion = americanist
				religion = hamiltonian
				religion = jeffersonian
				religion = libertarian
			}
			higher_real_tier_than = COUNT
			OR = { 
				trait = inaug_by_judge
				trait = inaug_by_cjudge
				trait = inaug_prez
			}
			in_command = no
		}
	 } 

	immediate = { 
		current_heir = { character_event = { id = AFI.129 days = 4 random = 4 } }
	}
}

#Heir is prompted to go to his liege.
character_event = {
	id = AFI.129
	desc = EVTDESCHFA20394		

	picture = GFX_evt_diplomatic_greeting
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	trigger = { 
		independent = no
		age = 12
		OR = {
			is_feudal = yes
			is_merchant_republic = yes
		} 
		religion_group = oldworld
		liege = { 
			NOT = { character = ROOT }
			OR = {
				religion = americanist
				religion = hamiltonian
				religion = jeffersonian
				religion = libertarian
			}
			higher_real_tier_than = COUNT
			OR = { 
				trait = inaug_by_judge
				trait = inaug_by_cjudge
				trait = inaug_prez
			}
		}
	}

	option = { #Will go.
		name = EVTOPTAHF20394
		prestige = -50
		add_character_modifier = {
			name = out_traveling
			duration = 50
		}
		hidden_tooltip = { liege = { character_event = { id = AFI.131 days = 25 random = 10 } } } #Liege event.

		ai_chance = { 	
			factor = 80
		}
	}
	option = { #Will not go.
		name = EVTOPTBHF20394
		hidden_tooltip = { liege = { character_event = { id = AFI.139 days = 15 random = 15 } } } #Notify.

		liege = {
				show_scope_change = no	
			opinion = {
				modifier = opinion_didnot_pay_homage
				years = 15
				who = ROOT
			}
		}
		ai_chance = { 	
			factor = 20
			modifier = {
				factor = 0
				liege = { is_friend = ROOT }
			}
			modifier = {
				factor = 0
				liege = { is_lover = ROOT }
			}
			modifier = {
				factor = 0.5
				liege = { is_married = ROOT }
			}
			modifier = {
				factor = 0.5
				liege = { is_close_relative = ROOT }
			}
			modifier = {
				factor = 4
				liege = { is_rival = ROOT }
			}
			modifier = {
				factor = 1.5
				trait = slothful
			}
			modifier = {
				factor = 2
				trait = proud
			}
			modifier = {
				factor = 1.5
				trait = stubborn
			}
			modifier = {
				factor = 1.5
				trait = shy
			}
			modifier = {
				factor = 1.5
				liege = { NOT = { religion = ROOT } }
			}
			modifier = {
				factor = 1.5
				NOT = { 
					opinion = { 
						who = FROM
						value = 0 
					} 
				}
			}
			modifier = {
				factor = 1.5
				NOT = { 
					opinion = { 
						who = FROM
						value = -20 
					} 
				}
			}
			modifier = {
				factor = 2
				NOT = { 
					opinion = { 
						who = FROM
						value = -40 
					} 
				}
			}
			modifier = {
				factor = 3
				NOT = { 
					opinion = { 
						who = FROM
						value = -60 
					} 
				}
			}
		}
	}
}

#Liege notified new vassal won't pay him homage.
character_event = {
	id = AFI.130
	desc = EVTDESCHFA20395	

	picture = GFX_evt_courier
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	trigger = { 
		higher_real_tier_than = COUNT
		OR = { 
			trait = inaug_by_judge
			trait = inaug_by_cjudge
			trait = inaug_prez
		}
	}

	option = {
		name = EVTOPTAHF20395
		prestige = -50
		tooltip = {
			opinion = {
				modifier = opinion_didnot_pay_homage
				years = 15
				who = FROM
			}
		}
		ai_chance = { 	
			factor = 100
		}
	}
}

#Liege receives homage from vassal.
character_event = {
	id = AFI.131
	desc = EVTDESCHFA20396

	picture = GFX_evt_emissary
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	trigger = { 
		higher_real_tier_than = COUNT
		OR = { 
			trait = inaug_by_judge
			trait = inaug_by_cjudge
			trait = inaug_prez
		}
	}

	option = { #Accept homage
		name = EVTOPTAHF20396
		custom_tooltip = { text = tooltip_HF20396_A }
		hidden_tooltip = { 
			random_list = { 
				20 = { 
					modifier = {
						factor = 0
						religion = FROM 
					}
					set_character_flag = flag_homage_infidel
				}
				20 = { 
					modifier = {
						factor = 0
						FROM = { age = 16 }
					}
					set_character_flag = flag_homage_child
				}
				20 = { 
					modifier = {
						factor = 0
						NOT = { FROM = { age = 50 } }
					}
					set_character_flag = flag_homage_old
				}
				20 = { 
					modifier = {
						factor = 0
						NOT = { FROM = { is_attractive_trigger = yes } }
					}
					modifier = {
						factor = 0
						FROM = { is_female = yes }
						prefers_men_trigger = yes
					}
					modifier = {
						factor = 0
						FROM = { is_female = no }
						prefers_men_trigger = no
					}
					set_character_flag = flag_homage_attractive
				}
				20 = { 
					modifier = {
						factor = 0
						NOT = { FROM = { is_unattractive_trigger = yes } } 
					}
					set_character_flag = flag_homage_deformed
				}
				20 = { 
					modifier = {
						factor = 0
						FROM = { is_female = no }
						OR = { 
							has_law = agnatic_succession
							has_law = cognatic_succession 
						}
					}
					modifier = {
						factor = 0
						FROM = { is_female = yes }
						OR = { 
							has_law = enatic_cognatic_succession
							has_law = enatic_succession 
						}
					}
					set_character_flag = flag_homage_sex
				}
				20 = { 
					modifier = {
						factor = 0
						NOT = { FROM = { is_evil_trigger = yes } }  
					}
					set_character_flag = flag_homage_evil
				}
				20 = { 
					modifier = {
						factor = 0
						NOT = { FROM = { has_virtue_trigger = yes } }  
					}
					set_character_flag = flag_homage_good
				}
				1 = {
					set_character_flag = flag_homage_generic
				}
			} 

			character_event = { id = HF.20410 } # Reaction event.
		}
		ai_chance = { 	
			factor = 95
		}
	}
	option = { #Refuse homage
		name = EVTOPTBHF20396
		hidden_tooltip = { FROM = { character_event = { id = HF.20398 } } } #Notify.
		prestige = 100
		FROM = {
				show_scope_change = no	
			opinion = {
				modifier = opinion_offended
				years = 15
				who = ROOT
			}
		} 
		ai_chance = { 	
			factor = 5
			modifier = {
				factor = 0
				liege = { is_friend = ROOT }
			}
			modifier = {
				factor = 0
				liege = { is_lover = ROOT }
			}
			modifier = {
				factor = 0.5
				liege = { is_married = ROOT }
			}
			modifier = {
				factor = 0.5
				liege = { is_close_relative = ROOT }
			}
			modifier = {
				factor = 6
				liege = { is_rival = ROOT }
			}
			modifier = {
				factor = 1.5
				trait = envious
			}
			modifier = {
				factor = 1.5
				trait = proud
			}
			modifier = {
				factor = 1.5
				trait = stubborn
			}
			modifier = {
				factor = 1.5
				NOT = { 
					opinion = { 
						who = FROM
						value = 0 
					} 
				}
			}
			modifier = {
				factor = 1.75
				NOT = { 
					opinion = { 
						who = FROM
						value = -20 
					} 
				}
			}
			modifier = {
				factor = 2
				NOT = { 
					opinion = { 
						who = FROM
						value = -40 
					} 
				}
			}
			modifier = {
				factor = 3
				NOT = { 
					opinion = { 
						who = FROM
						value = -60 
					} 
				}
			}
		}
	}
}