#DRD-COPY of HF_coronation_events.txt, edited for non-Catholic/Fraticelli coronations. Does not conflict with the original, but should ideally be maintained in sync with it.

namespace=DRD_HF
# Explain coronation preparation, ask whom to ask to be crowned by.
character_event = {
	id = DRD_HF.20200
	title = EVTTITLE20200
	desc = EVTDESCHF20200

	picture = GFX_evt_bishop
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes
	
	option = { #Ask to be crowned by the Pope
		name = EVTOPTADRDHF20200
		trigger = { 
			NOT = { trait = excommunicated }
			religion_head = {  #DRD-DIFF: The religious head is always an option, even under autocephaly.
				is_alive = yes 
				NOT = { block_general_event_trigger = yes }
			} 
		}
		religion_head = { show_portrait = THIS }
		custom_tooltip = { text = EVTTOOLTIPDRDHF20201 }
		hidden_tooltip = { religion_head = { letter_event = { id = DRD_HF.20201 days = 30 random = 5 } } }
		ai_chance = { 
			factor = 70
			modifier = {
				factor = 0.7
				tier = EMPEROR
			}
			modifier = {  #DRD-DIFF: don't insist on being crowned by a religious head who requested their independence
				factor = 0
				has_opinion_modifier = {
					who = FROM 
					modifier = opinion_requested_independence 
				}
			}
			modifier = {
				factor = 0.1
				religion_head = { 
					#DRD-DIFF: religious head was already checked in the option trigger!
					NOT = { 
						opinion = { 
							who = ROOT
							value = -80 
						} 
					}
				}
			}
			modifier = {
				factor = 0.25
				religion_head = { 
					#DRD-DIFF: religious head was already checked in the option trigger!
					NOT = { 
						opinion = { 
							who = ROOT
							value = -60 
						} 
					}
				}
			}
			modifier = {
				factor = 0.5
				religion_head = { 
					#DRD-DIFF: religious head was already checked in the option trigger!
					NOT = { 
						opinion = { 
							who = ROOT
							value = -40 
						} 
					}
				}
			}
			modifier = {
				factor = 0.7
				religion_head = { 
					#DRD-DIFF: religious head was already checked in the option trigger!
					NOT = { 
						opinion = { 
							who = ROOT
							value = -20 
						} 
					}
				}
			}
			modifier = {
				factor = 0.8
				religion_head = { 
					#DRD-DIFF: religious head was already checked in the option trigger!
					NOT = { 
						opinion = { 
							who = ROOT
							value = 0 
						} 
					}
				}
			}
			modifier = {
				factor = 1.25
				religion_head = { 
					#DRD-DIFF: religious head was already checked in the option trigger!
					NOT = { 
						opinion = { 
							who = ROOT
							value = 20 
						} 
					}
				}
			}
			modifier = {
				factor = 1.25
				religion_head = { 
					#DRD-DIFF: religious head was already checked in the option trigger!
					NOT = { 
						opinion = { 
							who = ROOT
							value = 40 
						} 
					}
				}
			}
			modifier = {
				factor = 1.5
				religion_head = { 
					#DRD-DIFF: religious head was already checked in the option trigger!
					NOT = { 
						opinion = { 
							who = ROOT
							value = 60 
						} 
					}
				}
			}
			modifier = {
				factor = 1.75
				religion_head = { 
					#DRD-DIFF: religious head was already checked in the option trigger!
					NOT = { 
						opinion = { 
							who = ROOT
							value = 80 
						} 
					}
				}
			}
			modifier = {
				factor = 2
				religion_head = { 
					#DRD-DIFF: religious head was already checked in the option trigger!
					NOT = { 
						opinion = { 
							who = ROOT
							value = 100 
						} 
					}
				}
			}
		}
	}
	option = { #Invested by powerful priest
		name = EVTOPTBDRDHF20200
		trigger = { 
			NOT = { trait = excommunicated }
			NOT = { emf_uses_byzantine_coronation = yes }  #DRD-DIFF: with HIP/EMF, the Basileus must be crowned by the real RH.
			#DRD-DIFF: investiture is assumed to be disabled for the religion
			any_realm_character = {  #DRD-DIFF: scripted trigger includes autocephaly
				drd_character_is_powerful_priest = yes  #SEE DRD_coronation_triggers.txt
				any_liege = { character = ROOT }
				religion = ROOT
				NOT = { block_general_event_trigger = yes }
			}
		}
		custom_tooltip = { text = EVTTOOLTIPBDRDHF20200 }
		if = { #DRD-DIFF: if a hierocratic head is snubbed by an Emperor, they'll get mad.
			limit = { 
				tier = EMPEROR
				has_religion_feature = religion_theocratic_head
				religion_head = { is_alive = yes }
			}
			custom_tooltip = { text = drd_scorned_the_pope }
			hidden_tooltip = { 
				religion_head = { 		
					show_scope_change = no	
					opinion = {
						modifier = opinion_offended
						years = 30
						who = ROOT
					} 
				} 
			}
		}
		
		random_realm_character = {  #DRD-DIFF: scripted trigger includes autocephaly
			limit = {
				drd_character_is_powerful_priest = yes
				any_liege = { character = ROOT }
				religion = ROOT
				NOT = { block_general_event_trigger = yes }
			}
			preferred_limit = {  # The ruler's autocephalous religious head.
				has_autocephaly = yes
				ROOT = { rightful_religious_head = PREV }
			}
			preferred_limit = {  # Another religious head vassal (e.g from a pentarchy seat)
				has_autocephaly = yes
				rightful_religious_head = THIS
			}
			preferred_limit = {  # Temporal power
				higher_tier_than = COUNT
			}
			hidden_tooltip = { letter_event = { id = DRD_HF.20201 days = 30 random = 5 } } 
			break = yes
		}
		ai_chance = { 
			factor = 30
			modifier = { factor = 1 

			} 
		}
	}
	option = { #Invested by random priest
		name = EVTOPTCHF20200
		trigger = { 
			#DRD-DIFF: investiture is assumed to be disabled for the religion
			NOT = { emf_uses_byzantine_coronation = yes }  #DRD-DIFF: with HIP/EMF, the Basileus must be crowned by the real RH.
			any_realm_character = {   #DRD-DIFF: scripted trigger includes autocephaly
				is_theocracy = yes 
				is_landed = yes
				any_liege = { character = ROOT }
				religion = ROOT
				drd_character_is_powerful_priest = no
				controls_religion = no
				NOT = { block_general_event_trigger = yes }
			}
		}
		custom_tooltip = { text = EVTTOOLTIPCDRDHF20200 }
		if = { #Emperors not crowned by a powerful priest receive an additional penalty
			limit = {  #DRD-DIFF: ... unless there is no other option available right now.
				OR = {
					religion_head = {
						is_alive = yes 
						NOT = { block_general_event_trigger = yes }
					} 
					any_realm_character = {
						drd_character_is_powerful_priest = yes
						any_liege = { character = ROOT }
						religion = ROOT
						NOT = { block_general_event_trigger = yes }
					}
				}
			}
			prestige = -300
			piety = -75
		}
		if = { #DRD-DIFF: if a religious head, autocephalous or otherwise, is snubbed that hard by an Emperor, they'll get mad.
			limit = { 
				tier = EMPEROR
				rightful_religious_head_scope = { is_alive = yes }
			}
			custom_tooltip = { text = drd_scorned_the_pope }
			hidden_tooltip = {
				rightful_religious_head_scope = { 		
					show_scope_change = no	
					opinion = {
						modifier = opinion_offended
						years = 30
						who = ROOT
					} 
				} 
			}
		}
		if = { #If powerful theocrats are available but player picks random priest, the other theocrats will be mad.
			limit = { 
				NOT = { trait = excommunicated }
				any_realm_character = {  #DRD-DIFF: scripted trigger includes autocephaly
					drd_character_is_powerful_priest = yes
					NOT = {  # The Emperor's religious head is already angry for 30 years.
						ROOT = {
							tier = EMPEROR
							rightful_religious_head = PREV
						}
					}
					any_liege = { character = ROOT }
					religion = ROOT
					NOT = { block_general_event_trigger = yes }
				}
			}
			custom_tooltip = { text = drd_scorned_powerful_theocrats }
			hidden_tooltip = { 
				any_realm_character = { 
					limit = {  #DRD-DIFF: scripted trigger includes autocephaly
						drd_character_is_powerful_priest = yes
						NOT = {  # The Emperor's religious head is already angry for 30 years.
							ROOT = {
								tier = EMPEROR
								rightful_religious_head = PREV
							}
						}
						any_liege = { character = ROOT }
						religion = ROOT
						NOT = { block_general_event_trigger = yes }
					}			
					opinion = {
						modifier = opinion_offended
						years = 10
						who = ROOT
					} 
				}
			}
		}
		random_realm_character = { 
			limit = {
				is_theocracy = yes 
				is_landed = yes
				any_liege = { character = ROOT }
				religion = ROOT
				drd_character_is_powerful_priest = no
				controls_religion = no
				NOT = { block_general_event_trigger = yes }
			}
			preferred_limit = { 
				opinion = { 
					who = ROOT
					value = 50 
				}
			}
			preferred_limit = { 
				opinion = { 
					who = ROOT
					value = 20 
				}
			}
			hidden_tooltip = { letter_event = { id = DRD_HF.20201 days = 30 random = 5 } } 
			break = yes
		}
		ai_chance = { 
			factor = 10
			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_hre
			}
		}
	}
	option = { #Changed your mind, not yet.
		name = EVTOPTDHF20200
		custom_tooltip = { text = coronation_canceled }
		##clr_character_flag = flag_preparing_coronation #Replaced by timed modifier
		hidden_tooltip = { remove_character_modifier = coronation_request_cooldown }
		ai_chance = { factor = 0 }	
	}
}

#Scary giant letter event determining what is the priest going to ask to the King/Emperor in exchange for the Coronation.
letter_event = {
	id = DRD_HF.20201
	desc = EVTDESCHFA20201
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes
	trigger = {
		FROM = { 
			religion = ROOT
			#DRD-DIFF: avoid checking for distinct religions
		}
	}
	
	option = { #For random priest
		name = EVTOPTAHF20201
		trigger = {  #DRD-DIFF: scripted trigger includes autocephaly
			controls_religion = no
			drd_character_is_powerful_priest = no
		}
		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 = DRD_HF.20202 } } #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
					has_bad_priest_trait_trigger = yes  #DRD-DIFF: not just for christians
				}
				FROM = { letter_event = { id = DRD_HF.20203 } } #Priest asks for small donation.
			}
		}
	}
	option = { #For powerful theocrat OR religious head
		name = EVTOPTBHF20201
		trigger = {  #DRD-DIFF: scripted trigger includes autocephaly
			OR = {
				controls_religion = yes
				drd_character_is_powerful_priest = yes
			}
		}
		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 
						} 
					}
				}
				if = {  #DRD-DIFF: religious head asks for more money
					limit = { controls_religion = yes }
					FROM = { letter_event = { id = DRD_HF.20212 } }
				}
				else = {
					FROM = { letter_event = { id = DRD_HF.20204 } }
				}
			} 
			40 = { 
				modifier = {
					factor = 0
					rightful_religious_head = ROOT
				}
				modifier = {
					factor = 0
					OR = { 
						trait = cynical 
						has_bad_priest_trait_trigger = yes  #DRD-DIFF: not just for christians
					}
				}
				modifier = {
					factor = 1.5
					trait = charitable
				}
				modifier = {
					factor = 1.5
					trait = zealous
				}
				modifier = {
					factor = 0.5
					has_bad_priest_trait_trigger = yes  #DRD-DIFF: not just for christians
				}
				#DRD-DIFF: no antipopes nor cardinals
				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 = DRD_HF.20205 } } #Donate money to the religious head
			} 
			20 = { 
				trigger = {
					OR = {  #DRD-DIFF: only valid if the religion allows monks/nuns
						has_religion_feature = religion_monastic
						religion_group = christian
					}
					FROM = { 
						any_child = { 
							age = 16
							is_married = no
							is_ruler = no
							prisoner = no
							NOT = { trait = incapable }
							FROM = {
								NOT = { 
									current_heir = { character = PREVPREV }
								}
							}
							NOR = { 
								trait = monk 
								trait = nun
							} 
						}
					}
				}
				modifier = {
					factor = 1.5
					FROM = { 
						any_child = { 
							count = 3
							age = 16
							is_married = no
							is_ruler = no
							prisoner = no
							NOT = { trait = incapable }
							FROM = {
								NOT = { 
									current_heir = { character = PREVPREV }
								}
							}
							NOR = { 
								trait = monk 
								trait = nun
							} 
						}
					}
				}
				modifier = {
					factor = 1.5
					FROM = { 
						any_child = { 
							count = 4
							age = 16
							is_married = no
							is_ruler = no
							prisoner = no
							NOT = { trait = incapable }
							FROM = {
								NOT = { 
									current_heir = { character = PREVPREV }
								}
							}
							NOR = { 
								trait = monk 
								trait = nun
							} 
						}
					}
				}
				modifier = {
					factor = 1.5
					FROM = { 
						any_child = { 
							count = 5
							age = 16
							is_married = no
							is_ruler = no
							prisoner = no
							NOT = { trait = incapable }
							FROM = {
								NOT = { 
									current_heir = { character = PREVPREV }
								}
							}
							NOR = { 
								trait = monk 
								trait = nun
							} 
						}
					}
				}
				modifier = {
					factor = 1.5
					FROM = { 
						any_child = { 
							count = 6
							age = 16
							is_married = no
							is_ruler = no
							prisoner = no
							NOT = { trait = incapable }
							FROM = {
								NOT = { 
									current_heir = { character = PREVPREV }
								}
							}
							NOR = { 
								trait = monk 
								trait = nun
							} 
						}
					}
				}
				modifier = {
					factor = 0.25
					has_bad_priest_trait_trigger = yes  #DRD-DIFF: not just for christians
				}
				modifier = {
					factor = 0.25
					trait = cynical
				}
				FROM = { letter_event = { id = DRD_HF.20206 } } #Send child to monastery/nunnery.
			} 
			#DRD-DIFF: holy orders options disabled for now
			10 = { 
				trigger = {
					FROM = { war = no }
				}
				modifier = {  #DRD-DIFF: priests of non-ascetic pagan religions are not required to be depraved
					factor = 0
					drd_religion_values_temperate = yes  #SEE DRD_religion_values_triggers.txt
					NOR = {
						has_bad_priest_trait_trigger = yes
						trait = hedonist
					}
				}
				modifier = {
					factor = 0
					OR = {
						 trait = celibate
						 trait = temperate
					}
				}
				modifier = {
					factor = 1.5
					trait = gluttonous
				}
				modifier = {
					factor = 1.5
					trait = drunkard
				}
				modifier = {
					factor = 1.5
					trait = greedy
				}
				modifier = {
					factor = 1.25
					trait = cynical
				}
				modifier = {
					factor = 0.5
					trait = zealous
				}
				if = {  #DRD-DIFF: religious head asks for more expensive orgy
					limit = { controls_religion = yes }
					FROM = { letter_event = { id = DRD_HF.20235 } }
				}
				else = {
					FROM = { letter_event = { id = DRD_HF.20208 } }
				}
			} 
			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 = DRD_HF.20209 } } #Wishes for another County.
			} 
			10 = { 
				modifier = {
					factor = 0
					FROM = {
						is_monastic_member_trigger = yes
					}
				}
				modifier = {
					factor = 0
					is_monastic_member_trigger = no
				}
				modifier = {
					factor = 1.5
					trait = zealous
				}
				modifier = {
					factor = 1.5
					trait = scholar
				}
				modifier = {
					factor = 1.5
					trait = socializer
				}
				modifier = {
					factor = 1.25
					trait = gregarious
				}
				FROM = { letter_event = { id = DRD_HF.20210 } } #Join my Monastic Order.
			}
			10 = { 
				modifier = {  #DRD-DIFF: only for Christians ; pagans have too few relics to bother
					factor = 0
					NOT = {
						religion_group = christian
					} 
				}
				modifier = {
					factor = 0
					NOT = {
						FROM = {
							any_artifact = { 
								has_artifact_flag = christian 
								NOR = { 
									has_artifact_flag = rare
									has_artifact_flag = very_rare
								}
							}
						}
					}
				}
				modifier = {
					factor = 1.5
					trait = zealous
				}
				modifier = {
					factor = 1.5
					trait = scholar
				}
				modifier = {
					factor = 1.5
					trait = theologian
				}
				modifier = {
					factor = 1.5
					trait = mystic
				}
				FROM = { letter_event = { id = DRD_HF.20240 } } #Give me a relic.
			} 
			20 = {  #DRD-DIFF: Hierocratic heads can ask for independence if they have a reason to do so
				modifier = {
					factor = 0
					OR = {
						controls_religion = no
						has_autocephaly = yes  # Heads of autocephalous religions will never ask for independence
						NOR = {  # Must either have a king-tier title, dislike their liege, or be ambitious with some power base.
							higher_tier_than = DUKE
							NOT = { opinion = { who = FROM value = -20 } }
							AND = {
								realm_size = 10
								trait = ambitious
							}
						}
					}
				}
				modifier = {
					factor = 0
					NOT = { vassal_of = FROM }
				}
				modifier = {
					factor = 8  #DRD-DIFF: compensate for the lower base weight
					has_opinion_modifier = { #Opinion modifier keeps track of the Pope's previous decision, should the player deny his first request and then attempt to ask again immediately after for a different result.
						who = FROM 
						modifier = opinion_requested_independence 
					}
				}
				#DRD-DIFF: it's never going to be the Catholic Pope
				modifier = {
					factor = 2
					NOT = { 
						opinion = { 
							who = FROM
							value = -100 
						} 
					}
				}
				modifier = {
					factor = 1.75
					NOT = { 
						opinion = { 
							who = FROM
							value = -80 
						} 
					}
				}
				modifier = {
					factor = 1.75
					NOT = { 
						opinion = { 
							who = FROM
							value = -60 
						} 
					}
				}
				modifier = {
					factor = 1.75
					NOT = { 
						opinion = { 
							who = FROM
							value = -40 
						} 
					}
				}
				modifier = {
					factor = 1.5
					NOT = { 
						opinion = { 
							who = FROM
							value = -20 
						} 
					}
				}
				modifier = {
					factor = 0.9
					opinion = { 
						who = FROM
						value = 20 
					} 
				}
				modifier = {
					factor = 0.8
					opinion = { 
						who = FROM
						value = 40 
					} 
				}
				modifier = {
					factor = 0.7
					opinion = { 
						who = FROM
						value = 60 
					} 
				}
				modifier = {
					factor = 0.6
					opinion = { 
						who = FROM
						value = 80 
					} 
				}
				modifier = {
					factor = 0.5
					opinion = { 
						who = FROM
						value = 100 
					} 
				}
				FROM = { letter_event = { id = DRD_HF.20211 } } #I want to be independent.
			}
		}
	}
	#DRD-DIFF: Pope-specific options are disabled, most of them were not applicable to generic religious heads
}

#King: Random Priest doesn't ask for anything, proceed with the coronation immediately.
letter_event = {
	id = DRD_HF.20202
	desc = EVTDESCHFA20202
	border = GFX_event_letter_frame_religion
	#DRD-DIFF: avoid checking for distinct religions

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20202
		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 = DRD_HF.20300 } } #Go to budget event
		ai_chance = { factor = 100 }
	}
	option = {	#End of the line
		name = EVTOPTBHF20202
		custom_tooltip = { text = coronation_canceled }
		#clr_character_flag = flag_preparing_coronation #Replaced by timed modifier
		ai_chance = { factor = 0 }
	}
}

#King: Random Priest asks for small donation.
letter_event = {
	id = DRD_HF.20203
	desc = EVTDESCDRDHFA20203
	border = GFX_event_letter_frame_religion
	#DRD-DIFF: avoid checking for distinct religions

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20203
		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 = -50
		hidden_tooltip = { FROM = { wealth = 50 } }
		hidden_tooltip = { character_event = { id = DRD_HF.20300 } } #Go to budget event
		ai_chance = { factor = 100 }
	}
	option = {	#End of the line
		name = EVTOPTBHF20203
		custom_tooltip = { text = coronation_canceled }
		#clr_character_flag = flag_preparing_coronation #Replaced by timed modifier
		ai_chance = { factor = 0 }
	}
}

#King: Powerful priest asks for donation to himself.
letter_event = {
	id = DRD_HF.20204
	desc = EVTDESCHFA20204
	border = GFX_event_letter_frame_religion
	#DRD-DIFF: avoid checking for distinct religions

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20204
		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
			}
		}
		wealth = -150
		hidden_tooltip = { FROM = { wealth = 150 } }
		hidden_tooltip = { character_event = { id = DRD_HF.20300 } } #Go to budget event
		ai_chance = { factor = 100 }
	}
	option = {	#End of the line
		name = EVTOPTBHF20204
		custom_tooltip = { text = coronation_canceled }
		#clr_character_flag = flag_preparing_coronation #Replaced by timed modifier
		ai_chance = { factor = 0 }
	}
}

#King: Priest asks for donation to their religious head
letter_event = {
	id = DRD_HF.20205
	desc = EVTDESCHFA20205
	border = GFX_event_letter_frame_religion
	#DRD-DIFF: avoid checking for distinct religions

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20205
		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 = { rightful_religious_head_scope = { wealth = 100 } }
		hidden_tooltip = { character_event = { id = DRD_HF.20300 } } #Go to budget event
		ai_chance = { factor = 100 }
	}
	option = {	#End of the line
		name = EVTOPTBHF20205
		custom_tooltip = { text = coronation_canceled }
		#clr_character_flag = flag_preparing_coronation #Replaced by timed modifier
		ai_chance = { factor = 0 }
	}
}

#King: Bishop asks for child to become monk/nun.
letter_event = {
	id = DRD_HF.20206
	desc = EVTDESCDRDHFA20206
	border = GFX_event_letter_frame_religion
	#DRD-DIFF: avoid checking for distinct religions

	is_triggered_only = yes
	immediate = { 
		random_child = { 
			limit = { 
				age = 16
				is_married = no
				is_ruler = no
				prisoner = no
				NOT = { trait = incapable }
				liege = { character = ROOT }
				ROOT = {
					NOT = { 
						current_heir = { character = PREVPREV }
					}
				}
				NOR = { 
					trait = monk 
					trait = nun
				}
			}
			save_event_target_as = son_monk_candidate
		}
	} 
	
	option = {
		name = EVTOPTAHF20206
		if = {  #DRD-DIFF: true religious heads use the same event as powerful priests.
			limit = { FROM = { controls_religion = yes } }
			set_character_flag = flag_crowned_by_pope
		}
		else = {
			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
			}
		}
		hidden_tooltip = { character_event = { id = DRD_HF.20300 } } #Go to budget event
		religion_head = { 
			event_target:son_monk_candidate = { 
				if = {
					limit = { is_female = yes }
					add_trait = nun
				}
				if = {
					limit = { is_female = no }
					add_trait = monk
				}
				move_character = PREV
			}
		}
		ai_chance = { factor = 100 }
	}
	option = {	#End of the line
		name = EVTOPTBHF20206
		custom_tooltip = { text = coronation_canceled }
		#clr_character_flag = flag_preparing_coronation #Replaced by timed modifier
		ai_chance = { factor = 0 }
	}
}
#King: Bishop asks for son to join holy order.
letter_event = {
	id = DRD_HF.20207  #DRD-NOTE: unused
	desc = EVTDESCHFA20207
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes
	#DRD-DIFF: avoid checking for distinct religions

	immediate = { 
		random_child = { 
			limit = { 
				age = 16
				is_married = no
				is_ruler = no
				is_female = no
				prisoner = no
				NOT = { trait = incapable }
				liege = { character = ROOT }
				ROOT = {
					NOT = { 
						current_heir = { character = PREVPREV }
					}
				}
				NOR = { 
					trait = monk 
					trait = nun
				}
			}
			save_event_target_as = son_holyorder_candidate
		}
		random_playable_ruler = { 
			limit = { 
				religion = ROOT
				OR = { 
					has_landed_title = d_knights_templar
					has_landed_title = d_teutonic_order
					has_landed_title = d_knights_hospitaler
					has_landed_title = d_knights_santiago
					has_landed_title = d_knights_calatrava 
				} 
			}
			save_event_target_as = son_holyorder_host
		}
	} 
	
	
	option = {
		name = EVTOPTAHF20207
		set_character_flag = flag_crowned_by_bishop
		show_portrait = event_target:son_holyorder_host
		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
			}
		}
		event_target:son_holyorder_host = { 
			show_scope_change = no
			event_target:son_holyorder_candidate = { 
				show_scope_change = no
				add_trait = celibate
				move_character = PREV
			}
		}
		hidden_tooltip = { character_event = { id = DRD_HF.20300 } } #Go to budget event
		ai_chance = { factor = 100 }
	}
	option = {	#End of the line
		name = EVTOPTBHF20207
		custom_tooltip = { text = coronation_canceled }
		#clr_character_flag = flag_preparing_coronation #Replaced by timed modifier
		ai_chance = { factor = 0 }
	}
}

#King: Bishop wants an orgy. 
letter_event = {
	id = DRD_HF.20208
	desc = EVTDESCHFA20208
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes
	
	#Fund AND join the Orgy
	option = {
		name = EVTOPTZHF20208
		custom_tooltip = { text = join_bishop_orgy }
		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 = 2
				who = ROOT
			}
			reverse_opinion = {
				modifier = opinion_supposed_to_crown
				months = 2
				who = ROOT
			}
		}
		transfer_scaled_wealth = { to = FROM value = 0.5 min = 50 max = 200 } 
		if = {  #DRD-DIFF: most pagans don't take the piety hit
			limit = {
				drd_religion_values_temperate = yes  #SEE DRD_religion_values_triggers.txt
			}
			tiered_piety_negative_effect = yes
			hidden_tooltip = { 
				FROM = { 
					tiered_piety_negative_effect = yes
				} 
			}
		}
		hidden_tooltip = { character_event = { id = DRD_HF.20236 } } #Small event chain.
		#hidden_tooltip = { character_event = { id = DRD_HF.20300 } } #Go to budget event
		ai_chance = { factor = 10 }
	}
	option = {
		name = EVTOPTAHF20208
		trigger = { NOT = { trait = hedonist } }
		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 = 2
				who = ROOT
			}
			reverse_opinion = {
				modifier = opinion_supposed_to_crown
				months = 2
				who = ROOT
			}
		}
		transfer_scaled_wealth = { to = FROM value = 0.5 min = 50 max = 200 } 
		if = {  #DRD-DIFF: most pagans don't take the piety hit
			limit = {
				drd_religion_values_temperate = yes  #SEE DRD_religion_values_triggers.txt
			}
			tiered_piety_negative_effect = yes
			hidden_tooltip = { 
				FROM = { 
					tiered_piety_negative_effect = yes
				} 
			}
		}
		hidden_tooltip = { character_event = { id = DRD_HF.20300 } } #Go to budget event
		ai_chance = { factor = 100 }
	}
	option = {	#End of the line
		name = EVTOPTBHF20208
		custom_tooltip = { text = coronation_canceled }
		#clr_character_flag = flag_preparing_coronation #Replaced by timed modifier
		ai_chance = { factor = 0 }
	}
}


#King: Bishop wants a county
letter_event = {
	id = DRD_HF.20209
	desc = {  #DRD-DIFF: landed vs landless autocephalous heads
		text = EVTDESCDRDHFA20209
		trigger = {
			FROM = { is_ruler = yes }
		}
	}
	desc = {
		text = EVTDESCDRDHFB20209
		trigger = {
			FROM = { is_ruler = no }
		}
	}
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes
	#DRD-DIFF: avoid checking for distinct religions
	
	option = {
		name = EVTOPTAHF20209
		if = {  #DRD-DIFF: true religious heads use the same event as powerful priests.
			limit = { FROM = { controls_religion = yes } }
			set_character_flag = flag_crowned_by_pope
		}
		else = {
			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 = {  #DRD-DIFF: landless autocephalous heads should receive a temple first, if possible.
			limit = {
				can_be_given_away = yes
				tier = count
				location = {
					is_capital = no
				}
			}
			preferred_limit = {
				location = {
					any_province_holding = {
						holding_type = temple
					}
				}
			}
			if = {
				limit = {
					FROM = { is_ruler = no }
				}
				random_direct_de_jure_vassal_title = {
					limit = {
						holding_type = temple
					}
					grant_title = FROM
				}
			}
			grant_title = FROM
			hidden_tooltip = { FROM = { set_government_type = theocracy_government } }
		}
		hidden_tooltip = { character_event = { id = DRD_HF.20300 } } #Go to budget event
		ai_chance = { factor = 100 }
	}
	option = {	#End of the line
		name = EVTOPTBHF20209
		custom_tooltip = { text = coronation_canceled }
		#clr_character_flag = flag_preparing_coronation #Replaced by timed modifier
		ai_chance = { factor = 0 }
	}
}
#King: Bishop wants you to join his monastic order
letter_event = {
	id = DRD_HF.20210
	desc = EVTDESCHFA20210
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes
	#DRD-DIFF: avoid checking for distinct religions
	
	option = {
		name = EVTOPTAHF20210	
		if = {  #DRD-DIFF: true religious heads use the same event as powerful priests.
			limit = { FROM = { controls_religion = yes } }
			set_character_flag = flag_crowned_by_pope
		}
		else = {
			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
			}
		}	
        FROM = { ROOT = { join_prev_monastic_order_society = yes } }
		hidden_tooltip = { character_event = { id = DRD_HF.20300 } } #Go to budget event
		ai_chance = { factor = 100 }
	}
	option = {	#End of the line
		name = EVTOPTBHF20210
		custom_tooltip = { text = coronation_canceled }
		#clr_character_flag = flag_preparing_coronation #Replaced by timed modifier
		ai_chance = { factor = 0 }
	}
}

#King: Pope wants to be independent
letter_event = {
	id = DRD_HF.20211
	desc = EVTDESCDRDHFA20211
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes
	#DRD-DIFF: avoid checking for distinct religions
	
	option = {
		name = EVTOPTAHF20211
		set_character_flag = flag_crowned_by_pope
		custom_tooltip = { text = TT_EVTOPTAHF20211 }
		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 = { 
       		FROM = { 
       			character_event = { id = DRD_HF.20234 } 
       		} 
       	}
		hidden_tooltip = { character_event = { id = DRD_HF.20300 } } #Go to budget event
		ai_chance = {  #DRD-DIFF: AI reformers shouldn't release their pet religious head so easily.
			factor = 20
			modifier = {
				factor = 0
				trait = ambitious
			}
			modifier = {
				factor = 0
				NOR = {
					trait = cynical
					trait = slothful
					is_dumb_trigger = yes
				}
			}
		}
	}
	option = {	#End of the line
		name = EVTOPTBHF20211
		custom_tooltip = { text = coronation_canceled }
		#clr_character_flag = flag_preparing_coronation #Replaced by timed modifier
			 # The Pope remembers what he wants, cheaty spammy player.
		FROM = { 
				show_scope_change = no	
			opinion = {
				modifier = opinion_requested_independence
				years = 10
				who = ROOT
			}
		} 
		ai_chance = { factor = 80 }  #DRD-DIFF: Pagan reformers shouldn't release their pet religious head so easily.
	}
}

#King: Pope wants gold.
letter_event = {
	id = DRD_HF.20212
	desc = EVTDESCHFA20212
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes
	#DRD-DIFF: avoid checking for distinct religions
	
	option = {
		name = EVTOPTAHF20212
		hidden_tooltip = {
			FROM = {
				opinion = {
					modifier = opinion_coronation_money_refund
					who = ROOT
					years = 100
				}
			}
		}
		set_character_flag = flag_crowned_by_pope
		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
			}
		}
		#Transfer scaled wealth based on Pope's opinion of you and your piety. - King tier
		if = { 
			limit = { real_tier = KING }
			if = { 
				limit = {  
					NOT = { 
						piety = 350
					} 
					FROM = { 
						NOT = { 
							opinion = { 
								who = ROOT 
								value = -75
							} 
						}
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 2.5 min = 750 max = 1500 } 
			}
			if = { 
				limit = {
					piety = 350
					FROM = { 
						NOT = { 
							opinion = { 
								who = ROOT 
								value = -75
							} 
						}
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 2 min = 600 max = 1200 } 
			}
			if = { 
				limit = {  
					NOT = { 
						piety = 350
					} 
					FROM = { 
						opinion = { 
							who = ROOT 
							value = -75
						} 
						NOT = { 
							opinion = { 
								who = ROOT 
								value = -25
							} 
						} 
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 1.35 min = 500 max = 900 } 
			}
			if = { 
				limit = {  
					piety = 350
					FROM = { 
						opinion = { 
							who = ROOT 
							value = -75
						} 
						NOT = { 
							opinion = { 
								who = ROOT 
								value = -25
							} 
						} 
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 1.25 min = 400 max = 750 } 
			}
			if = { 
				limit = {  
					NOT = { 
						piety = 350
					} 
					FROM = { 
						opinion = { 
							who = ROOT 
							value = -25
						} 
						NOT = { 
							opinion = { 
								who = ROOT 
								value = 0
							} 
						} 
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 1.0 min = 350 max = 600 } 
			}
			if = { 
				limit = { 
					piety = 350
					FROM = { 
						opinion = { 
							who = ROOT 
							value = -25
						} 
						NOT = { 
							opinion = { 
								who = ROOT 
								value = 0
							} 
						} 
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 0.95 min = 300 max = 500 } 
			}
			if = { 
				limit = { 
					NOT = { 
						piety = 350
					}  
					FROM = { 
						opinion = { 
							who = ROOT 
							value = 0
						} 
						NOT = { 
							opinion = { 
								who = ROOT 
								value = 50
							} 
						} 
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 0.85 min = 250 max = 400 } 
			}
			if = { 
				limit = { 
					piety = 350
					FROM = { 
						opinion = { 
							who = ROOT 
							value = 0
						} 
						NOT = { 
							opinion = { 
								who = ROOT 
								value = 50
							} 
						} 
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 0.75 min = 200 max = 350 } 
			}
			if = { 
				limit = { 
					NOT = { 
						piety = 350
					}   
					FROM = { 
						opinion = { 
							who = ROOT 
							value = 50
						} 
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 0.65 min = 175 max = 300 } 
			}
			if = { 
				limit = { 
					piety = 350
					FROM = { 
						opinion = { 
							who = ROOT 
							value = 50
						} 
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 0.5 min = 150 max = 250 } 
			}
		}
		#Transfer scaled wealth based on Pope's opinion of you and your piety. - Emperor tier
		if = { 
			limit = { real_tier = EMPEROR }
			if = { 
				limit = {  
					NOT = { 
						piety = 350
					} 
					FROM = { 
						NOT = { 
							opinion = { 
								who = ROOT 
								value = -75
							} 
						}
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 3 min = 950 max = 1750 } 
			}
			if = { 
				limit = {
					piety = 350
					FROM = { 
						NOT = { 
							opinion = { 
								who = ROOT 
								value = -75
							} 
						}
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 2.5 min = 750 max = 1500 } 
			}
			if = { 
				limit = {  
					NOT = { 
						piety = 350
					} 
					FROM = { 
						opinion = { 
							who = ROOT 
							value = -75
						} 
						NOT = { 
							opinion = { 
								who = ROOT 
								value = -25
							} 
						} 
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 2.0 min = 600 max = 1000 } 
			}
			if = { 
				limit = {  
					piety = 350
					FROM = { 
						opinion = { 
							who = ROOT 
							value = -75
						} 
						NOT = { 
							opinion = { 
								who = ROOT 
								value = -25
							} 
						} 
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 1.75 min = 500 max = 850 } 
			}
			if = { 
				limit = {  
					NOT = { 
						piety = 350
					} 
					FROM = { 
						opinion = { 
							who = ROOT 
							value = -25
						} 
						NOT = { 
							opinion = { 
								who = ROOT 
								value = 0
							} 
						} 
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 1.5 min = 450 max = 700 } 
			}
			if = { 
				limit = { 
					piety = 350
					FROM = { 
						opinion = { 
							who = ROOT 
							value = -25
						} 
						NOT = { 
							opinion = { 
								who = ROOT 
								value = 0
							} 
						} 
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 1.35 min = 400 max = 600 } 
			}
			if = { 
				limit = { 
					NOT = { 
						piety = 350
					}  
					FROM = { 
						opinion = { 
							who = ROOT 
							value = 0
						} 
						NOT = { 
							opinion = { 
								who = ROOT 
								value = 50
							} 
						} 
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 1.25 min = 350 max = 500 } 
			}
			if = { 
				limit = { 
					piety = 350
					FROM = { 
						opinion = { 
							who = ROOT 
							value = 0
						} 
						NOT = { 
							opinion = { 
								who = ROOT 
								value = 50
							} 
						} 
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 0.95 min = 300 max = 450 } 
			}
			if = { 
				limit = { 
					NOT = { 
						piety = 350
					}   
					FROM = { 
						opinion = { 
							who = ROOT 
							value = 50
						} 
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 0.85 min = 275 max = 400 } 
			}
			if = { 
				limit = { 
					piety = 350
					FROM = { 
						opinion = { 
							who = ROOT 
							value = 50
						} 
					} 
				} 
				transfer_scaled_wealth = { to = FROM value = 0.75 min = 250 max = 350 } 
			}
		}
		hidden_tooltip = { character_event = { id = DRD_HF.20300 } } #Go to budget event
		ai_chance = { factor = 100 }
	}
	option = {	#End of the line
		name = EVTOPTBHF20212
		custom_tooltip = { text = coronation_canceled }
		#clr_character_flag = flag_preparing_coronation #Replaced by timed modifier
		ai_chance = { factor = 0 }
	}
}

#DRD-DIFF: did not copy events 20213-20230, too specific to Catholics and/or the Pope.

#DRD-DIFF: did not copy events 20231-20233, nothing to change from vanilla.

#Hidden event to make pope independent upon request.
character_event = {
	id = DRD_HF.20234
	hide_window = yes 

	is_triggered_only = yes

	immediate = {
		set_defacto_liege = THIS
		emf_liege_change = yes  #DRD-DIFF: HIP/EMF compatibilty, no effect otherwise.
	}
}

#King: Pope wants an orgy.
letter_event = {
	id = DRD_HF.20235
	desc = EVTDESCHFA20235
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes
	#DRD-DIFF: avoid checking for distinct religions
	
	#Fund AND join the Orgy
	option = {
		name = EVTOPTZHF20235
		custom_tooltip = { text = join_pope_orgy }
		set_character_flag = flag_crowned_by_pope
		FROM = { save_event_target_as = coronation_priest
				show_scope_change = no	
			opinion = {
				modifier = opinion_supposed_to_crown
				months = 2
				who = ROOT
			}
			reverse_opinion = {
				modifier = opinion_supposed_to_crown
				months = 2
				who = ROOT
			}
		}
		transfer_scaled_wealth = { to = FROM value = 0.75 min = 150 max = 400 } 
		if = {  #DRD-DIFF: most pagans don't take the piety hit
			limit = {
				drd_religion_values_temperate = yes  #SEE DRD_religion_values_triggers.txt
			}
			tiered_piety_negative_effect = yes
			hidden_tooltip = { 
				FROM = { 
					tiered_piety_negative_effect = yes
				} 
			}
		}
		hidden_tooltip = { character_event = { id = DRD_HF.20236 } } #Small event chain.
		#hidden_tooltip = { character_event = { id = DRD_HF.20300 } } #Go to budget event
		ai_chance = { factor = 10 }
	}
	option = {
		name = EVTOPTAHF20235
		trigger = { NOT = { trait = hedonist } }
		set_character_flag = flag_crowned_by_pope  #DRD-DIFF: fix vanilla bug
		FROM = { save_event_target_as = coronation_priest
				show_scope_change = no	
			opinion = {
				modifier = opinion_supposed_to_crown
				months = 2
				who = ROOT
			}
			reverse_opinion = {
				modifier = opinion_supposed_to_crown
				months = 2
				who = ROOT
			}
		}
		transfer_scaled_wealth = { to = FROM value = 0.75 min = 150 max = 400 } 
		if = {  #DRD-DIFF: most pagans don't take the piety hit
			limit = {
				drd_religion_values_temperate = yes  #SEE DRD_religion_values_triggers.txt
			}
			tiered_piety_negative_effect = yes
			hidden_tooltip = { 
				FROM = { 
					tiered_piety_negative_effect = yes
				} 
			}
		}
		hidden_tooltip = { 
			FROM = { 
				tiered_piety_negative_effect = yes
			} 
		}
		hidden_tooltip = { character_event = { id = DRD_HF.20300 } } #Go to budget event
		ai_chance = { factor = 100 }
	}
	option = {	#End of the line
		name = EVTOPTBHF20235
		custom_tooltip = { text = coronation_canceled }
		#clr_character_flag = flag_preparing_coronation #Replaced by timed modifier
		ai_chance = { factor = 0 }
	}
}

#Go to the priest's orgy, because why not.
character_event = {
	id = DRD_HF.20236
	desc = { #Orgy with Prince-Bishop.
		text = EVTDESCHFA20236
		trigger = {
			NOT = {
				FROMFROM = { 
					controls_religion = yes  #DRD-DIFF: avoid checking for distinct religions
				}
			}
		}
	}
	desc = { #Orgy with the Pope.
		text = EVTDESCHFB20236
		trigger = {
			FROMFROM = { 
				controls_religion = yes  #DRD-DIFF: avoid checking for distinct religions
			}
		}
	}
	show_from_from = yes

	picture = GFX_evt_pope_feast
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20236
		custom_tooltip = { text = papal_orgy_drunk }
		set_character_flag = flag_papal_orgy_drunk
		if = { 
			limit = {  #DRD-DIFF: most pagans don't take the piety hit
				trait = drunkard
				drd_religion_values_temperate = yes  #SEE DRD_religion_values_triggers.txt
			} 
			tiered_piety_negative_effect = yes
		}
		if = { 
			limit = { NOT = { trait = drunkard } } 
			add_trait = drunkard 
		}
		if = { 
			limit = { FROMFROM = { controls_religion = yes }}  #DRD-DIFF: avoid checking for distinct religions
			prestige = 50
		}
		ai_chance = { factor = 30 }
	}
	option = {
		name = EVTOPTBHF20236
		custom_tooltip = { text = papal_orgy_lustful }
		set_character_flag = flag_papal_orgy_lustful
		if = { 
			limit = {  #DRD-DIFF: most pagans don't take the piety hit
				trait = lustful
				drd_religion_values_temperate = yes  #SEE DRD_religion_values_triggers.txt
			} 
			tiered_piety_negative_effect = yes
		}
		if = { 
			limit = { trait = chaste } 
			remove_trait = chaste
		}
		if = { 
			limit = { NOT = { trait = lustful } } 
			add_trait = lustful
		}
		if = { 
			limit = { FROMFROM = { controls_religion = yes }}  #DRD-DIFF: avoid checking for distinct religions
			prestige = 50
		}
		ai_chance = { factor = 30 }
	}
	option = {
		name = EVTOPTCHF20236
		custom_tooltip = { text = papal_orgy_glutton }
		set_character_flag = flag_papal_orgy_glutton
		if = { 
			limit = {  #DRD-DIFF: most pagans don't take the piety hit
				trait = gluttonous
				drd_religion_values_temperate = yes  #SEE DRD_religion_values_triggers.txt
			} 
			tiered_piety_negative_effect = yes
		}
		if = { 
			limit = { trait = temperate } 
			remove_trait = temperate
		}
		if = { 
			limit = { NOT = { trait = gluttonous } } 
			add_trait = gluttonous
		}
		if = { 
			limit = { FROMFROM = { controls_religion = no }}  #DRD-DIFF: avoid checking for distinct religions
			gain_weight_medium_effect = yes
			weight_trait_check_effect = yes
		}
		if = { 
			limit = { FROMFROM = { controls_religion = yes }}  #DRD-DIFF: avoid checking for distinct religions
			gain_weight_large_effect = yes
			weight_trait_check_effect = yes
			prestige = 50
		}
		ai_chance = { factor = 30 }
	}
	after = { 
		hidden_tooltip = { 
			random_list = { 
				40 = { #Priest comes onto you.
					modifier = {  #DRD-DIFF: priests cannot be assumed to be male
						factor = 0
						FROMFROM = {
							NOR = {
								NOT = { same_sex = ROOT }
								trait = homosexual
							}
						} 
					}
					modifier = {  #DRD-DIFF: non-depraved priests are much less likely to cause this kind of incident
						factor = 0.1
						NOR = {
							has_bad_priest_trait_trigger = yes
							trait = hedonist
						}
					}
					modifier = { 
						factor = 0.25
						is_female = yes
						age = 45
					}
					modifier = { 
						factor = 0.5
						has_ugly_trait_trigger = yes
					} 
					modifier = { 
						factor = 0.5
						trait = disfigured
					} 
					modifier = { 
						factor = 0.5
						trait = has_bubonic_plague
					} 
					modifier = { 
						factor = 0.5
						trait = inbred
					} 
					modifier = { 
						factor = 1.75
						has_fair_trait_trigger = yes
					} 	
					modifier = { 
						factor = 1.5
						NOT = { age = 30 }
					} 
					modifier = { 
						factor = 2.5
						NOT = { age = 18 } #Obviously...
					} 
					modifier = { 
					factor = 0.5
						trait = one_eyed
					} 
					modifier = { 
						factor = 1.5
						trait = lustful
					} 
					modifier = { 
						factor = 0.5
						FROMFROM = { NOT = { trait = lustful } }
					} 

					character_event = { id = DRD_HF.20237 } 
				}
				30 = { #Become Hedonist.
					modifier = { 
						factor = 0
						has_any_lifestyle_trait = yes
					} 
					modifier = { 
						factor = 1.5
						trait = drunkard
					} 
					modifier = { 
						factor = 1.5
						trait = gluttonous
					} 
					modifier = { 
						factor = 1.5
					trait = slothful
					} 
					modifier = { 
						factor = 1.5
						trait = lustful
					} 
					character_event = { id = DRD_HF.20238 } 
				}
				30 = { #Nothing happens, end the event.
					character_event = { id = DRD_HF.20239 } 
				}
			}
		}
	}
}

#Time for the communion
character_event = {
	id = DRD_HF.20237
	desc = { # with Prince-Bishop.
		text = EVTDESCHFA20237
		trigger = {
			NOT = {
				FROMFROMFROM = { 
					controls_religion = yes  #DRD-DIFF: avoid checking for distinct religions
				}
			}
		}
	}
	desc = { # with the Pope.
		text = EVTDESCHFB20237
		trigger = {
			FROMFROMFROM = { 
				controls_religion = yes  #DRD-DIFF: avoid checking for distinct religions
			}
		}
	}
	show_from_from_from = yes

	picture = GFX_evt_pope_feast
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20237
		trigger = {
			OR = {  #DRD-DIFF: priests cannot be assumed to be male
				NOT = { same_sex = FROMFROMFROM }
				trait = homosexual  # the original event does not exclude lesbians
			} 
		}
		custom_tooltip = { text = papal_orgy_communion }
		tiered_prestige_reward_effect = yes
		tiered_piety_negative_effect = yes
		hidden_tooltip = { 
			if = { 
				limit = { 
					OR = {  #DRD-DIFF: priests cannot be assumed to be male
						AND = {
							is_female = yes
							FROMFROMFROM = { is_female = no }
							NOT = { age = 40 }
						}
						AND = {
							is_female = no
							FROMFROMFROM = { is_female = yes }
							FROMFROMFROM = { NOT = { age = 40 } }
						}
					}
					fertility = 0.4
				}
				random = { 
					chance = 10
					modifier = {
						factor = 0.5
						NOT = { fertility = 0.3 }
					}
					modifier = {
						factor = 1.5
						fertility = 0.3
					}
					modifier = {
						factor = 1.5
						fertility = 0.5
					}
					modifier = {
						factor = 1.5
						fertility = 0.7
					}
					modifier = {
						factor = 1.5
						fertility = 0.9
					}
					modifier = {
						factor = 1.5
						fertility = 1.25
					}
					modifier = {
						factor = 1.75
						fertility = 1.5
					}
					modifier = {
						factor = 2
						fertility = 1.75
					}
					modifier = {
						factor = 3
						fertility = 2
					}
					if = {  #DRD-DIFF: female character (king or priest) is impregnated
						limit = { is_female = yes }
						ROOT = { impregnate = FROMFROMFROM }
					}
					else = {
						FROMFROMFROM = { impregnate = ROOT }
					}
					#DRD-DIFF: no "insert-religious-center-here prince" title
				}
			}
		}
		hidden_tooltip = { character_event = { id = DRD_HF.20239 } } #Conclude the Orgy.
		ai_chance = { 
			factor = 90 
			modifier = { 
				factor = 0.25
				trait = chaste
			}
		}
	}
	option = {
		name = EVTOPTBHF20237
		custom_tooltip = { text = papal_orgy_flee }
		hidden_tooltip = { character_event = { id = DRD_HF.20239 } } #Conclude the Orgy.
		ai_chance = { 
			factor = 10 
		}
	}
}

#Becoming Hedonist
character_event = {
	id = DRD_HF.20238
	desc = EVTDESCHFA20238
	show_from_from_from = yes

	picture = GFX_evt_pope_feast
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20238
		add_trait = hedonist
		hidden_tooltip = { character_event = { id = DRD_HF.20239 } } #Proceed with the coronation.
	}
}

#The orgy has concluded.
character_event = {
	id = DRD_HF.20239
	desc = { # with Prince-Bishop.
		text = EVTDESCHFA20239
		trigger = {
			NOT = {
				event_target:coronation_priest = { 
					controls_religion = yes  #DRD-DIFF: avoid checking for distinct religions
				}
			}
		}
	}
	desc = { # with the Pope.
		text = EVTDESCHFB20239
		trigger = {
			event_target:coronation_priest = { 
				controls_religion = yes  #DRD-DIFF: avoid checking for distinct religions
			}
		}
	}

	picture = GFX_evt_pope_feast
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20239
		clr_character_flag = flag_papal_orgy_drunk
		clr_character_flag = flag_papal_orgy_lustful
		clr_character_flag = flag_papal_orgy_glutton
		hidden_tooltip = { character_event = { id = DRD_HF.20300 } } #Proceed with the coronation.
	}
}


#King: Bishop asks for small religious artifact.
letter_event = {
	id = DRD_HF.20240
	desc = EVTDESCHFA20240
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes
	#DRD-DIFF: avoid checking for distinct religions
	
	immediate = {
		random_artifact = { 
			limit = { 
				has_artifact_flag = christian  
				NOT = { has_artifact_flag = rare } 
				NOT = { has_artifact_flag = very_rare } 
				NOT = { has_artifact_flag = flag_considering_donation } 
			}
			save_event_target_as = scoped_artifact
			set_artifact_flag = flag_considering_donation
		}
	}
	option = {
		name = EVTOPTAHF20240
		if = {  #DRD-DIFF: true religious heads use the same event as powerful priests.
			limit = { FROM = { controls_religion = yes } }
			set_character_flag = flag_crowned_by_pope
		}
		else = {
			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
			}
		}
		event_target:scoped_artifact = {
			transfer_artifact = {
				from = ROOT
				to = FROM
 			} 
			clr_artifact_flag = flag_considering_donation
 		} 
		hidden_tooltip = { character_event = { id = DRD_HF.20300 } } #Go to budget event
		ai_chance = { factor = 100 }
	}
	option = {	#End of the line
		name = EVTOPTBHF20240
		custom_tooltip = { text = coronation_canceled }
		#clr_character_flag = flag_preparing_coronation #Replaced by timed modifier
		hidden_tooltip = { 
			event_target:scoped_artifact = { 
				clr_artifact_flag = flag_considering_donation
			} 
		}
		ai_chance = { factor = 0 }
	}
}

#King: Pope asks for rare religious artifact.
letter_event = {
	id = DRD_HF.20241  #DRD-NOTE: unused
	desc = EVTDESCHFA20241
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes
	#DRD-DIFF: avoid checking for distinct religions
	
	immediate = {
		random_artifact = { 
			limit = { 
				has_artifact_flag = christian  
				OR = { 
					has_artifact_flag = very_rare 
					has_artifact_flag = rare 
				} 
				NOT = { has_artifact_flag = flag_considering_donation } 
			}
			save_event_target_as = scoped_artifact
			set_artifact_flag = flag_considering_donation
		}
	}
	option = {
		name = EVTOPTAHF20241
		set_character_flag = flag_crowned_by_pope
		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
			}
		}
		event_target:scoped_artifact = {
			transfer_artifact = {
				from = ROOT
				to = FROM
 			} 
			clr_artifact_flag = flag_considering_donation
 		} 
		hidden_tooltip = { character_event = { id = DRD_HF.20300 } } #Go to budget event
		ai_chance = { factor = 100 }
	}
	option = {	#End of the line
		name = EVTOPTBHF20241
		custom_tooltip = { text = coronation_canceled }
		# The Pope remembers what he wants, cheaty spammy player.
		FROM = { 
				show_scope_change = no	
			opinion = {
				modifier = opinion_requested_artifact
				years = 10
				who = ROOT
			}
		}
		hidden_tooltip = { 
			event_target:scoped_artifact = { 
				clr_artifact_flag = flag_considering_donation
			} 
		}
		#clr_character_flag = flag_preparing_coronation #Replaced by timed modifier
		ai_chance = { factor = 0 }
	}
}

########################################################################################################################################

####Coronation sponsor found, now decide how much money to invest in it. (REVISED WITH SCALED WEALTH)
character_event = {
	id = DRD_HF.20300
	desc = {
		trigger = {
			OR = { 
				has_character_flag = flag_crowned_by_bishop
				has_character_flag = flag_crowned_by_pope 
				has_character_flag = flag_crowned_by_rh_strong_basileus
				has_character_flag = flag_crowned_by_rh_weak_basileus
			}
			war = no
		}
		text = EVTDESCHFA20300
	}
	desc = {
		trigger = {
			has_character_flag = flag_crowned_by_priest
			war = no
		}
		text = EVTDESCHFB20300
	}
	desc = {
		trigger = {
			war = yes
		}
		text = EVTDESCHFC20300
		picture = GFX_evt_mounted_combat_day_hf
	}

	picture = GFX_evt_diplomatic_greeting
	border = GFX_event_normal_frame_religion

	#DRD-DIFF: avoid checking for distinct religions
	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.
		}
		if = {  #DRD-DIFF: When used alongside HIP, (Eastern) Roman Emperors get different outcomes.
			limit = {
				has_character_flag = flag_crowned_by_pope
				emf_uses_byzantine_coronation = yes  #MOD HIP/EMF emf_title_triggers.txt
			}
			clr_flag = flag_crowned_by_pope
			drd_emf_add_flag_crowned_by_rh_basileus = yes  #SEE DRD_coronation_effects.txt
		}
	}

	option = {
		name = EVTOPTAHF20300
		trigger = { war = no }
		set_character_flag = flag_extravagant_coronation
		custom_tooltip = { text = send_extracoronation_invitations }
		if = { 
			limit = { ai = no } #Cheaty AI...
			scaled_wealth = { value = -1 min = -250 max = -1000 }
		}
		hidden_tooltip = {
			character_event = { id = DRD_HF.20305 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 = DRD_HF.20301 } #Send Invitations
			}
			any_independent_ruler = {
				limit = { 
					war = no
					prisoner = no
					is_theocracy = 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 = DUKE
					NOT = { distance_from_realm = { who = ROOT value = 120 } }
				}
				character_event = { id = DRD_HF.20302 } #Send Invitations to other same-religion 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 = EVTOPTBHF20300
		trigger = { war = no }
		set_character_flag = flag_regular_coronation
		custom_tooltip = { text = send_coronation_invitations }
		hidden_tooltip = {
			character_event = { id = DRD_HF.20305 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 = DRD_HF.20301 } #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 = EVTOPTCHF20300
			trigger = {
				war = no
			}
		}
		name = {
			text = EVTOPTCHF20300_B
			trigger = {
				war = yes
			}
		}
		set_character_flag = flag_secluded_coronation
		custom_tooltip = { text = send_seclcoronation_invitations }
		if = { 
			limit = { ai = no } #Cheaty AI...
			scaled_wealth = { value = -0.05 min = -10 max = -150 }
		}
		hidden_tooltip = {
			character_event = { id = DRD_HF.20305 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 = DRD_HF.20301 } #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
			}
		}
	}
}

#Vassal: King is inviting you to his coronation.
letter_event = {
	id = DRD_HF.20301
	desc = EVTDESCHFA20301
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes
	trigger = {
		FROM = {
			OR = {
				has_character_flag = flag_crowned_by_priest
				has_character_flag = flag_crowned_by_bishop
				has_character_flag = flag_crowned_by_pope
				has_character_flag = flag_crowned_by_rh_strong_basileus
				has_character_flag = flag_crowned_by_rh_weak_basileus
			}
		}
	}
	
	option = {
		name = EVTOPTAHF20301
		hidden_tooltip = { FROM = { character_event = { id = DRD_HF.20303 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 = EVTOPTBHF20301
		hidden_tooltip = { FROM = { character_event = { id = DRD_HF.20304 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 } }
			}
		}
	}
}
#Foreign King: King is inviting you to his coronation.
letter_event = {
	id = DRD_HF.20302
	desc = EVTDESCHFA20302
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes
	trigger = {
		FROM = {
			OR = {
				has_character_flag = flag_crowned_by_priest
				has_character_flag = flag_crowned_by_bishop
				has_character_flag = flag_crowned_by_pope
				has_character_flag = flag_crowned_by_rh_strong_basileus
				has_character_flag = flag_crowned_by_rh_weak_basileus
			}
		}
	}
	
	
	option = {
		name = EVTOPTAHF20302
		hidden_tooltip = { FROM = { character_event = { id = DRD_HF.20303 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.
		#add_character_modifier = {
		#	name = out_traveling
		#	duration = 45
		#}
		ai_chance = { 
			factor = 70 
		}
	}
	option = {	#End of the line
		name = EVTOPTBHF20302
		hidden_tooltip = { FROM = { character_event = { id = DRD_HF.20304 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 } }
			}
		}
	}
}
#King Notification: Vassal will come to the Coronation Ceremony
letter_event = {
	id = DRD_HF.20303
	desc = EVTDESCHF20303

	trigger = {
		#DRD-DIFF: avoid checking for distinct religions
		OR = {
			has_character_flag = flag_crowned_by_priest
			has_character_flag = flag_crowned_by_bishop
			has_character_flag = flag_crowned_by_pope
			has_character_flag = flag_crowned_by_rh_strong_basileus
			has_character_flag = flag_crowned_by_rh_weak_basileus
		}
	}
	notification = yes
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20303
	}
}
#King Notification: Vassal will not come to the Coronation Ceremony
letter_event = {
	id = DRD_HF.20304
	desc = EVTDESCHF20304

	trigger = {
		#DRD-DIFF: avoid checking for distinct religions
		OR = {
			has_character_flag = flag_crowned_by_priest
			has_character_flag = flag_crowned_by_bishop
			has_character_flag = flag_crowned_by_pope
			has_character_flag = flag_crowned_by_rh_strong_basileus
			has_character_flag = flag_crowned_by_rh_weak_basileus
		}
	}
	notification = yes
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20304
	}
}

#King: Day 11 from budget, ceremony starts.
character_event = {
	id = DRD_HF.20305
	desc = {
		trigger = {
			has_character_flag = flag_extravagant_coronation 
			war = no
		}
		text = EVTDESCHFA20305
	}
	desc = {
		trigger = {
			has_character_flag = flag_regular_coronation
			war = no
		}
		text = EVTDESCHFB20305
	}
	desc = {
		trigger = {
			has_character_flag = flag_secluded_coronation
			war = no
		}
		text = EVTDESCHFC20305
	}

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

	picture = GFX_evt_magnificent_castle
	border = GFX_event_normal_frame_religion

	trigger = { 
		#DRD-DIFF: avoid checking for distinct religions
		OR = {
			has_character_flag = flag_crowned_by_priest
			has_character_flag = flag_crowned_by_bishop
			has_character_flag = flag_crowned_by_pope
			has_character_flag = flag_crowned_by_rh_strong_basileus
			has_character_flag = flag_crowned_by_rh_weak_basileus
		}
		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 = EVTOPTAHF20305
			#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 = coronation_count value = 0 } } 
			hidden_tooltip = { character_event = { id = DRD_HF.20365 days = 3 random = 3 } } # First and second row of random list.
			hidden_tooltip = { character_event = { id = DRD_HF.20366 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.
		
	}
}

#King has chance to befriend foreign ruler.
character_event = {
	id = DRD_HF.20306
	desc = EVTDESCDRDHFA20306
	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)
	}

	is_triggered_only = yes
	
	immediate = { 
		event_target:coronation_ruler = { set_character_flag = flag_coronation_foreign_friendship } #to avoid the same event happening twice during the coronation.

		random_independent_ruler = { 
			limit = { 
				has_opinion_modifier = { 
					who = ROOT 
					modifier = opinion_coronation_guest 
				}
				NOT = { is_rival = ROOT } 
				NOT = { is_friend = ROOT } 
				NOT = { is_lover = ROOT } 
				NOT = { is_married = ROOT }
				NOT = { num_of_friends = 3 }
				opinion = { who = from value = -20 }
			} 
			save_event_target_as = potential_friend
		}
	}
	
	option = {
		name = EVTOPTAHF20306
		show_portrait = event_target:potential_friend
		event_target:potential_friend = { 
			character_event = { id = DRD_HF.20307 tooltip = EVTTOOLTIPAHF20307 }
		}
		ai_chance = { 	
			factor = 90
			modifier = { 
				factor = 0.5
				trait = shy
			}	
			modifier = { 
				factor = 0.5
				trait = paranoid
			}	
		}
	}
	option = {
		name = EVTOPTBHF20306
		ai_chance = { 	
			factor = 10	
		}
	}

	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Foreign ruler/Vassal: King wants to become your friend.
character_event = {
	id = DRD_HF.20307
	desc = EVTDESCHFA20307
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20307
		add_friend = FROM
		hidden_tooltip = { FROM = { character_event = { id = DRD_HF.20308 } } }
		ai_chance = { 	
			factor = 90
			modifier = { 
				factor = 0.8
				FROM = { trait = shy }
			}	
			modifier = { 
				factor = 0.75
				FROM = { trait = cruel }
				NOT = { trait = cruel }
			}	
			modifier = { 
				factor = 0.5
				trait = envious
			}
		}
	}
	option = {
		name = EVTOPTBHF20307
		FROM = { character_event = { id = DRD_HF.20309 tooltip = EVTTOOLTIPAHF20309 } }
		ai_chance = { 	
			factor = 10	
		}
	}
}

#King: you've acquired a new friend.
character_event = {
	id = DRD_HF.20308
	desc = EVTDESCHFA20308
	desc = {
		trigger = {
			FROM = { NOT = { vassal_of = ROOT } }
		}
		text = EVTDESCHFA20308
	}
	desc = {
		trigger = {
			FROM = { vassal_of = ROOT }
		}
		text = EVTDESCHFB20308
	}
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20308
		add_friend = FROM
		ai_chance = { 	
			factor = 100
		}
	}
}

#King: you have not acquired a new friend.
character_event = {
	id = DRD_HF.20309
	desc = EVTDESCHFA20309
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20309
		ai_chance = { 	
			factor = 100
		}
	}
}

#King has chance to befriend one of his vassals.
character_event = {
	id = DRD_HF.20310
	desc = EVTDESCHFA20310
	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)
	}

	is_triggered_only = yes
	
	immediate = { 
		event_target:coronation_ruler = { set_character_flag = flag_coronation_vassal_friendship } #to avoid the same event happening twice during the coronation.
		random_vassal = { 
			limit = { 
				has_opinion_modifier = { 
					who = ROOT 
					modifier = opinion_coronation_guest 
				}
				NOT = { is_rival = ROOT } 
				NOT = { is_friend = ROOT } 
				NOT = { is_lover = ROOT } 
				NOT = { is_married = ROOT }
				NOT = { num_of_friends = 3 }
				opinion = { who = from value = -20 }
			} 
			save_event_target_as = potential_friend
		}
	}
	
	option = {
		name = EVTOPTAHF20310
		show_portrait = event_target:potential_friend
		event_target:potential_friend = {  
			character_event = { id = DRD_HF.20307 tooltip = EVTTOOLTIPAHF20307 }
		}
		ai_chance = { 	
			factor = 90
			modifier = { 
				factor = 0.5
				trait = shy
			}	
			modifier = { 
				factor = 0.5
				trait = paranoid
			}	
		}
	}
	option = {
		name = EVTOPTBHF20310
		ai_chance = { 	
			factor = 10	
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#King talks with guests, chance to gain diplomacy or stewardship.
character_event = {
	id = DRD_HF.20311
	desc = EVTDESCHFA20311
	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_diplomacy_boost } #to avoid the same event happening twice during the coronation.
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20311
		change_diplomacy = 1
		hidden_tooltip = { 
			any_vassal = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				} 
				character_event = { id = DRD_HF.20312 }
			}
			any_independent_ruler = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				} 
				character_event = { id = DRD_HF.20312 }
			}
		}
		ai_chance = { 	
			factor = 50
			modifier = { 
				factor = 0.5
				NOT = { diplomacy = 10 }
			}		
		}
	}
	option = {
		name = EVTOPTBHF20311
		change_stewardship = 1
		hidden_tooltip = { 
			any_vassal = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				} 
				character_event = { id = DRD_HF.20313 }
			}
			any_independent_ruler = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				} 
				character_event = { id = DRD_HF.20313 }
			}
		}
		ai_chance = { 	
			factor = 50
			modifier = { 
				factor = 0.5
				NOT = { stewardship = 10 }
			}		
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}


#Coronation guest: ruler displays diplomacy.
character_event = {
	id = DRD_HF.20312
	desc = EVTDESCHFA20312
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20312
		prestige = 40
		random = { 
			chance = 5
			change_diplomacy = 1
		}
		ai_chance = { 	
			factor = 100
		}
	}
}
#Coronation guest: ruler displays stewardship.
character_event = {
	id = DRD_HF.20313
	desc = EVTDESCHFA20313
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20313
		prestige = 40
		random = { 
			chance = 5
			change_stewardship = 1
		}
		ai_chance = { 	
			factor = 100
		}
	}
}

#King talks with guests, chance to gain intrigue or learning.
character_event = {
	id = DRD_HF.20314
	desc = EVTDESCHFA20314
	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_learning_boost  } #to avoid the same event happening twice during the coronation.
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20314
		change_intrigue = 1
		ai_chance = { 	
			factor = 50
			modifier = { 
				factor = 0.5
				NOT = { intrigue = 10 }
			}		
		}
	}
	option = {
		name = EVTOPTBHF20314
		change_learning = 1
		hidden_tooltip = { 
			any_vassal = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				} 
				character_event = { id = DRD_HF.20315 }
			}
			any_independent_ruler = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				} 
				character_event = { id = DRD_HF.20315 }
			}
		}
		ai_chance = { 	
			factor = 50	
			modifier = { 
				factor = 0.5
				NOT = { learning = 10 }
			}		
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Coronation guest: ruler displays learning.
character_event = {
	id = DRD_HF.20315
	desc = EVTDESCDRDHFA20315
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20315
		piety = 50
		random = { 
			chance = 5
			change_learning = 1
		}
		ai_chance = { 	
			factor = 100
		}
	}
}

#King shows off with guests, chance to improve opinion.
character_event = {
	id = DRD_HF.20316
	desc = {
		trigger = {
			age = 16
		}
		text = EVTDESCHFA20316
	}
	desc = {
		trigger = {
			NOT = { age = 16 }
		}
		text = EVTDESCHFB20316
	}
	hide_new = yes 


	picture = GFX_evt_dancing
	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_guest_opinions } #to avoid the same event happening twice during the coronation.
	}
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20316
		custom_tooltip = { text = EVTTOOLTIPAHF20316 }
		hidden_tooltip = {
			random_list = {
				50 = {
					modifier = { 
						factor = 1.5
						has_character_flag = flag_extravagant_coronation
					}
					modifier = { 
						factor = 1.25
						diplomacy = 6
					}
					modifier = { 
						factor = 1.25
						diplomacy = 8
					}
					modifier = { 
						factor = 1.25
						diplomacy = 10
					}
					modifier = { 
						factor = 1.5
						diplomacy = 12
					}
					modifier = { 
						factor = 1.75
						diplomacy = 15
					}	
					modifier = { 
						factor = 1.25
						trait = gregarious
					}
					modifier = { 
						factor = 0.5
						trait = shy
					}
					modifier = { 
						factor = 1.25
						trait = underhanded_rogue
					}
					modifier = { 
						factor = 1.5
						trait = charismatic_negotiator
					}
					modifier = { 
						factor = 1.75
						trait = grey_eminence
					}
					modifier = { 
						factor = 1.75
						NOT = { age = 16 } #Lower expectations
					}
					character_event = { id = DRD_HF.20317 } #Success
				}
				50 = {
					character_event = { id = DRD_HF.20318 } #Failure
				
				}
			}

		}
		ai_chance = { 	
			factor = 90
			modifier = { 
				factor = 0.75
				NOT = { diplomacy = 10 }
			}	
			modifier = { 
				factor = 0.5
				trait = shy
			}		
		}
	}
	option = {
		name = EVTOPTBHF20316
		ai_chance = { 	
			factor = 10			
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}


#Success: King has impressed his guests
character_event = {
	id = DRD_HF.20317
	desc = {
		trigger = {
			age = 16
		}
		text = EVTDESCHFA20317
	}
	desc = {
		trigger = {
			NOT = { age = 16 }
		}
		text = EVTDESCHFB20317
	}
	hide_new = yes 

	picture = GFX_evt_dancing
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20317
		custom_tooltip = { text = EVTTOOLTIPAHF20317 }
		if = { 
			limit = { age = 16 } 
			prestige = 75
		}
		if = { 
			limit = { NOT = { age = 16 } } 
			prestige = 150
		}
		hidden_tooltip = { 
			any_vassal = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				} 
				character_event = { id = DRD_HF.20319 }
			}
			any_independent_ruler = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				} 
				character_event = { id = DRD_HF.20319 }
			}
			event_target:coronation_priest = {  
				character_event = { id = DRD_HF.20319 }
			}
		}		
		ai_chance = { 	
			factor = 100
		}
	}
}

#Failure: King has not impressed his guests
character_event = {
	id = DRD_HF.20318
	desc = {
		trigger = {
			age = 16
		}
		text = EVTDESCHFA20318
	}
	desc = {
		trigger = {
			NOT = { age = 16 }
		}
		text = EVTDESCHFB20318
	}
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20318
		custom_tooltip = { text = EVTTOOLTIPAHF20318 }
		if = { 
			limit = { age = 16 } 
			prestige = -90
		}
		if = { 
			limit = { NOT = { age = 16 } } 
			prestige = -40
		}
		hidden_tooltip = { 
			any_vassal = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				} 
				character_event = { id = DRD_HF.20320 }
			}
			any_independent_ruler = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				} 
				character_event = { id = DRD_HF.20320 }
			}
			event_target:coronation_priest = {  
				character_event = { id = DRD_HF.20320 }
			}
		}		
		ai_chance = { 	
			factor = 100
		}
	}
}


#Coronation guest: ruler speech increased opinion.
character_event = {
	id = DRD_HF.20319
	desc = {
		trigger = {
			age = 16
		}
		text = EVTDESCHFA20319
	}
	desc = {
		trigger = {
			NOT = { age = 16 }
		}
		text = EVTDESCHFB20319
	}
	hide_new = yes 

	picture = GFX_evt_dancing
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20319
		prestige = 40
		opinion = {
			modifier = opinion_swayed_1
			years = 10
			who = FROM
		}
		ai_chance = { 	
			factor = 100
		}
	}
}

#Coronation guest: ruler speech did not increase opinion.
character_event = {
	id = DRD_HF.20320
	desc = {
		trigger = {
			age = 16
		}
		text = EVTDESCHFA20320
	}
	desc = {
		trigger = {
			NOT = { age = 16 }
		}
		text = EVTDESCHFB20320
	}
	hide_new = yes 


	picture = GFX_evt_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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20320
		opinion = {
			modifier = opinion_tiresome
			years = 3
			who = FROM
		}
		ai_chance = { 	
			factor = 100
		}
	}
}

#King galvanized by upcoming coronation, chance to lose content or slothful.
character_event = {
	id = DRD_HF.20321
	desc = EVTDESCHFA20321
	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 = EVTOPTAHF20321
		trigger = { trait = content }
		prestige = 75
		random = { 
			chance = 50
			remove_trait = content 
			hidden_tooltip = { character_event = { id = 38299 } } 
		}
		ai_chance = { 	
			factor = 50	
		}
	}
	option = {
		name = EVTOPTBHF20321
		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 = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Proud King galvanized by upcoming coronation, chance to become ambitious or lose proud.
character_event = {
	id = DRD_HF.20322
	desc = EVTDESCHFA20322
	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_ambitious  } #to avoid the same event happening twice during the coronation.
	}
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20322
		prestige = 75
		if = { limit = { NOT = { trait = ambitious } }
			random = { 
				chance = 50
				add_trait = ambitious
				hidden_tooltip = { character_event = { id = 38278 } } 
			}
		}
		if = { limit = { trait = ambitious }
			random = { 
				chance = 50
				prestige = 75
			}
		}
		ai_chance = { 	
			factor = 50	
		}
	}
	option = {
		name = EVTOPTBHF20322
		piety = 50
		random = { 
			chance = 50
			remove_trait = proud 
			hidden_tooltip = { character_event = { id = 38300 } } 
		}
		ai_chance = { 	
			factor = 50		
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Child King galvanized by upcoming coronation, chance to become haughty or conscientious.
character_event = {
	id = DRD_HF.20323
	desc = EVTDESCHFA20323
	hide_new = yes 

	picture = GFX_evt_child_reading
	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_haughty_child } #to avoid the same event happening twice during the coronation.
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20323
		if = { 
			limit = { NOT = { trait = haughty } has_dlc = "Conclave" }
			prestige = 75
			random = { 
				chance = 50
				add_trait = haughty 
			}
			break = yes
		}
		if = { 
			limit = { OR = { NOT = { has_dlc = "Conclave" } trait = haughty } }
			prestige = 75
		}
		ai_chance = { 	
			factor = 50	
		}
	}
	option = {
		name = EVTOPTBHF20323
		if = { 
			limit = { NOT = { trait = conscientious } has_dlc = "Conclave" }
			piety = 50
			random = { 
				chance = 50
				add_trait = conscientious 
			}
			break = yes
		}
		if = { 
			limit = { OR = { NOT = { has_dlc = "Conclave" } trait = conscientious } }
			piety = 75
		}
		ai_chance = { 	
			factor = 50		
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#King: coronation_priest is pleased by the feast.
character_event = {
	id = DRD_HF.20324
	desc = EVTDESCHFA20324
	hide_new = yes 

	picture = GFX_evt_church_council
	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_priest_approves } #to avoid the same event happening twice during the coronation.
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20324
		if = { 
			limit = { age = 16 } 
			piety = 40
		}
		if = { 
			limit = { NOT = { age = 16 } } 
			piety = 60
		}
		event_target:coronation_priest = {	
				show_scope_change = no	
			opinion = {
				modifier = opinion_impressed
				years = 10
				who = ROOT
			}
		}
		hidden_tooltip = { 
			any_vassal = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				} 
				character_event = { id = DRD_HF.20325 }
			}
			any_independent_ruler = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				} 
				character_event = { id = DRD_HF.20325 }
			}
		}		
		ai_chance = { 	
			factor = 100
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Coronation guest: coronation_priest is impressed by the feast.
character_event = {
	id = DRD_HF.20325
	desc = EVTDESCHFA20325
	hide_new = yes 

	picture = GFX_evt_church_council
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20325
		piety = 50
		ai_chance = { 	
			factor = 100
		}
	}
}

#Emperor of Francia/HRE: coronation_priest speaks about responsibility of Charlemagne.
character_event = {
	id = DRD_HF.20326  #DRD-NOTE: unused, could be used as a pattern for other similar events
	desc = EVTDESCHFA20326
	hide_new = yes 

	picture = GFX_evt_church_council
	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_hre_talk } #to avoid the same event happening twice during the coronation.
	}


	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20326
		prestige = 100
		ai_chance = { 	
			factor = 40
		}
	}
	option = {
		name = EVTOPTBHF20326
		change_learning = 2
		ai_chance = { 	
			factor = 30
		}
	}
	option = {
		name = EVTOPTCHF20326
		if = { 
			limit = {
				trait = slothful
			} 
			remove_trait = slothful
			hidden_tooltip = { character_event = { id = 38298 } } 
			break = yes
		}
		if = { 
			limit = { trait = diligent } 
			piety = 30
			break = yes
		}
		if = { 
			limit = { 
				NOT = { trait = diligent } 
			} 
			add_trait = diligent
			hidden_tooltip = { character_event = { id = 38256 } } 
		}

		ai_chance = { 	
			factor = 30
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#King: Pope talks about responsibility of Catholic Kings.
character_event = {
	id = DRD_HF.20327
	desc = EVTDESCHFA20327
	hide_new = yes 

	picture = GFX_evt_church_council
	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_pope_talk  } #to avoid the same event happening twice during the coronation.
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20327
		if = { 
			limit = {
				trait = cynical
			} 
			remove_trait = cynical
			hidden_tooltip = { character_event = { id = 38316 } } 
			break = yes
		}
		if = { 
			limit = { trait = zealous } 
			piety = 75
			break = yes
		}
		if = { 
			limit = { 
				NOT = { trait = zealous } 
			} 
			add_trait = zealous
			hidden_tooltip = { character_event = { id = 38269 } } 
		}
		ai_chance = { 	
			factor = 50
		}
	}
	option = {
		name = EVTOPTBHF20327
		change_learning = 2
		ai_chance = { 	
			factor = 50
		}
	}
	option = {
		name = EVTOPTCHF20327
		if = { 
			limit = {
				trait = zealous
			} 
			remove_trait = zealous
			hidden_tooltip = { character_event = { id = 38310 } } 
			break = yes
		}
		if = { 
			limit = { 
				NOT = { trait = cynical } 
			} 
			add_trait = cynical
			hidden_tooltip = { character_event = { id = 38258 } } 
		}

		ai_chance = { 	
			factor = 0
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Foreign coronation guest: chance to teach Child King about stewardship.
character_event = {
	id = DRD_HF.20328
	desc = EVTDESCHFA20328
	hide_new = yes 

	picture = GFX_evt_state_diplomacy
	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_foreign_teacher } #to avoid the same event happening twice during the coronation.
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20328
			event_target:coronation_ruler = { character_event = { id = DRD_HF.20329 tooltip = EVTTOOLTIPHF20329 } }
		if = { 
			limit = {
				trait = slothful
			} 
			remove_trait = slothful
			hidden_tooltip = { character_event = { id = 38298 } } 
			break = yes
		}
		if = { 
			limit = { trait = diligent } 
			piety = 20
			break = yes
		}
		if = { 
			limit = { 
				NOT = { trait = diligent } 
			} 
			add_trait = diligent
			hidden_tooltip = { character_event = { id = 38256 } } 
		}
		ai_chance = { 	
			factor = 99
			modifier = { 
				factor = 0.5
				trait = slothful
			} 
		}
	}
	option = {
		name = EVTOPTBHF20328
		prestige = 75
		if = { 
			limit = { 
				trait = humble 
			} 
			random = { 
				chance = 50 
				remove_trait = humble
				hidden_tooltip = { character_event = { id = 38312 } } 
			} 
			break = yes
		}
		if = { 
			limit = { 
				NOT = { trait = proud } 
			} 
			random = { 
				chance = 50 
				add_trait = proud
				hidden_tooltip = { character_event = { id = 38261 } } 
			} 
		}
		ai_chance = { 	
			factor = 1
		}
	}
}
#Child King: foreign ruler wants to teach you about statemanship.
character_event = {
	id = DRD_HF.20329
	desc = EVTDESCHFA20329
	hide_new = yes 

	picture = GFX_evt_state_diplomacy
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20329
		FROM = { character_event = { id = DRD_HF.20330 tooltip = EVTTOOLTIPHF20330 } }
		change_stewardship = 2
		FROM = {
				show_scope_change = no	
			opinion = {
				modifier = opinion_impressed
				years = 10
				who = ROOT
			}
		}
		ai_chance = { 	
			factor = 80
			modifier = { 
				factor = 0.5
				trait = slothful
			} 
			modifier = { 
				factor = 0.5
				trait = indolent
			} 
			modifier = { 
				factor = 0.5
				trait = haughty
			} 
			modifier = { 
				factor = 1.75
				trait = conscientious
			} 
		}
	}
	option = {
		name = EVTOPTBHF20329
		FROM = { character_event = { id = DRD_HF.20331 tooltip = EVTTOOLTIPHF20331 } }
		FROM = {
				show_scope_change = no	
			opinion = {
				modifier = opinion_dislike
				years = 10
				who = ROOT
			}
		}
		if = { 
			limit = { 
				trait = conscientious 
			} 
			random = { 
				chance = 50 
				remove_trait = conscientious
			} 
			break = yes
		}
		if = { 
			limit = { 
				NOT = { trait = indolent } 
			} 
			random = { 
				chance = 50 
				add_trait = indolent
			} 
		}
		ai_chance = { 	
			factor = 20
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Foreign Coronation guest: Child King appreciated your help.
character_event = {
	id = DRD_HF.20330
	desc = EVTDESCHFA20330
	hide_new = yes 

	picture = GFX_evt_state_diplomacy
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20330
		tooltip = {
			opinion = {
				modifier = opinion_impressed
				years = 10
				who = FROM
			}
		}
		ai_chance = { 	
			factor = 100 
		}
	}
}

#Foreign Coronation guest: Child King did not appreciate your help.
character_event = {
	id = DRD_HF.20331
	desc = EVTDESCHFA20331
	hide_new = yes 

	picture = GFX_evt_state_diplomacy
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20331
		tooltip = {
			opinion = {
				modifier = opinion_dislike
				years = 10
				who = FROM
			}
		}
		ai_chance = { 	
			factor = 100 
		}
	}
}

#King: coronation_priest is displeased by the feast.
character_event = {
	id = DRD_HF.20332
	desc = EVTDESCHFA20332
	hide_new = yes 

	picture = GFX_evt_church_council
	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_priest_disapproves } #to avoid the same event happening twice during the coronation.
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20332
		if = { 
			limit = { age = 16 } 
			piety = -75
		}
		if = { 
			limit = { NOT = { age = 16 } } 
			piety = -25
		}
		event_target:coronation_priest = {	
				show_scope_change = no	
			opinion = {
				modifier = opinion_disapprove
				years = 10
				who = ROOT
			}
		}
		hidden_tooltip = { 
			any_vassal = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				} 
				character_event = { id = DRD_HF.20333 }
			}
			any_independent_ruler = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				} 
				character_event = { id = DRD_HF.20333 }
			}
		}		
		ai_chance = { 	
			factor = 100
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Coronation guest: coronation_priest is displeased by the feast.
character_event = {
	id = DRD_HF.20333
	desc = EVTDESCHFA20333
	hide_new = yes 

	picture = GFX_evt_church_council
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20333
		ai_chance = { 	
			factor = 100
		}
	}
}

#Foreign Coronation guest: you become (or are) rival with another guest. (hidden)
character_event = {
	id = DRD_HF.20334
	hide_window = yes

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

	is_triggered_only = yes
	
	immediate = {
		event_target:coronation_ruler = { set_character_flag = flag_coronation_diplomatic_incident } #to avoid the same event happening twice during the coronation.
		random_list = { 	
			50 = { #First check if you already have a foreign ruler guest as a rival
				modifier = { 
					factor = 0
					NOT = { 
						any_independent_ruler = { 
							has_opinion_modifier = { 
								who = event_target:coronation_ruler
								modifier = opinion_coronation_guest 
							}
							is_rival = ROOT
						}
					}
				}
				set_character_flag = flag_met_old_rival
				random_independent_ruler = { 
					limit = { 
						has_opinion_modifier = { 
							who = event_target:coronation_ruler
							modifier = opinion_coronation_guest 
						}
						is_rival = ROOT
					} 
					character_event = { id = DRD_HF.20335 } 
				}
			}
			50 = { #Otherwise create a new rivalry
				modifier = { 
					factor = 0
					any_independent_ruler = { 
						has_opinion_modifier = { 
							who = event_target:coronation_ruler
							modifier = opinion_coronation_guest 
						}
						NOT = {
							opinion = { 
								who = ROOT
								value = -30 
							}
						}
					}
				}
				random_independent_ruler = { 
					limit = { 
						has_opinion_modifier = { 
							who = event_target:coronation_ruler
							modifier = opinion_coronation_guest 
						}
						NOT = {
							opinion = { 
								who = ROOT
								value = -30 
							}
						} 
					} 
					character_event = { id = DRD_HF.20335 } 
				}
			}
		}
	}
}

#Coronation guest 2: new or old rivalry disrupts the feast.
character_event = {
	id = DRD_HF.20335
	desc = {
		trigger = {
			FROM = { has_character_flag = flag_met_old_rival }
		}
		text = EVTDESCHFA20335
	}
	desc = {
		trigger = {
			NOT = { FROM = { has_character_flag = flag_met_old_rival } }
		}
		text = EVTDESCHFB20335
	}
	hide_new = yes 

	picture = GFX_evt_rival_rulers
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20335
		if = { 
			limit = { 
				NOT = { is_rival = FROM } 
			}
			add_rival = FROM
		}
		hidden_tooltip = { FROM = { character_event = { id = DRD_HF.20336 } } }
		hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20337 } } }
		ai_chance = { 	
			factor = 100
		}
	}
}

#Coronation guest 1: new or old rivalry disrupts the feast.
character_event = {
	id = DRD_HF.20336
	desc = {
		trigger = {
			has_character_flag = flag_met_old_rival
		}
		text = EVTDESCHFA20336
	}
	desc = {
		trigger = {
			NOT = { has_character_flag = flag_met_old_rival }
		}
		text = EVTDESCHFB20336
	}
	hide_new = yes 

	picture = GFX_evt_rival_rulers
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20336
		if = { 
			limit = { 
				NOT = { is_rival = FROM } 
			}
			add_rival = FROM
		}
		clr_character_flag = flag_met_old_rival
		ai_chance = { 	
			factor = 100
		}
	}
}

#King: two foreign rulers are bickering, do you interfere?
character_event = {
	id = DRD_HF.20337
	desc = EVTDESCHFA20337
	hide_new = yes 

	picture = GFX_evt_rival_rulers
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20337
		tooltip_info = diplomacy
		custom_tooltip = { text = EVTTOOLTIPAHF20337 }
		hidden_tooltip = { 
			random_list = { 
				#Critical Success
				#Success
				#Failure
				#Critical Failure
				10 = { 

				modifier = { 
					factor = 0
					num_of_friends = 3
				} 
				modifier = { 
					factor = 0.1
					NOR = { 
						trait = naive_appeaser
						trait = underhanded_rogue
						trait = charismatic_negotiator
						trait = grey_eminence
						diplomacy = 15
					}
				} 
				modifier = { 
					factor = 0.5
					OR = { 
						FROM = { trait = stubborn }
						FROMFROM = { trait = stubborn }
					}
				} 
				ROOT = { character_event = { id = DRD_HF.20338 } } # King succeeds and becomes friends with the rulers.
				FROM = { character_event = { id = DRD_HF.20338 } }
				FROMFROM = { character_event = { id = DRD_HF.20338 } }
				} 
				40 = { 

				modifier = { 
					factor = 0.8
					NOR = { 
						trait = naive_appeaser
						trait = underhanded_rogue
						trait = charismatic_negotiator
						trait = grey_eminence
					}
				} 
				modifier = { 
					factor = 0.5
					OR = { 
						FROM = { trait = stubborn }
						FROMFROM = { trait = stubborn }
					}
				}
				modifier = { 
					factor = 0.25
					NOT = { diplomacy = 1 }
				}
				modifier = { 
					factor = 0.5
					NOT = { diplomacy = 2 }
				}
				modifier = { 
					factor = 0.75
					NOT = { diplomacy = 4 }
				}
				modifier = { 
					factor = 0.75
					NOT = { diplomacy = 6 }
				}
				modifier = { 
					factor = 0.75
					NOT = { diplomacy = 8 }
				}
				ROOT = { character_event = { id = DRD_HF.20339 } } # King succeeds, ending the rivalry.
				FROM = { character_event = { id = DRD_HF.20339 } }
				FROMFROM = { character_event = { id = DRD_HF.20339 } }
				} 
				40 = { 

				modifier = { 
					factor = 0.75
					diplomacy = 8
				}
				modifier = { 
					factor = 0.75
					diplomacy = 10
				}
				modifier = { 
					factor = 0.75
					diplomacy = 12
				}
				modifier = { 
					factor = 0.75
					diplomacy = 14
				}
				modifier = { 
					factor = 0.5
					diplomacy = 16
				}
				modifier = { 
					factor = 0.5
					diplomacy = 18
				}
				modifier = { 
					factor = 0.25
					diplomacy = 20
				}
				modifier = { 
					factor = 0.5
					trait = charismatic_negotiator
				}
				modifier = { 
					factor = 0.25
					trait = grey_eminence
				}
				modifier = { 
					factor = 0.75
					trait = gregarious
				}
				modifier = { 
					factor = 0.75
					trait = honest
				}
				ROOT = { character_event = { id = DRD_HF.20340 } } # King fails.
				FROM = { character_event = { id = DRD_HF.20340 } }
				FROMFROM = { character_event = { id = DRD_HF.20340 } }
				} 
				10 = { 
				modifier = { 
					factor = 0.1
					OR = { 
						trait = naive_appeaser
						trait = underhanded_rogue
						trait = charismatic_negotiator
						trait = grey_eminence
						diplomacy = 15
					}
				}

				modifier = { 
					factor = 0
					num_of_rivals = 3
				}
				ROOT = { character_event = { id = DRD_HF.20341 } } # King fails and becomes rival with rulers.
				FROM = { character_event = { id = DRD_HF.20341 } }
				FROMFROM = { character_event = { id = DRD_HF.20341 } }
				} 
			} 
		}
		ai_chance = { 	
			factor = 75
			modifier = { 
				factor = 0.5
				NOT = { diplomacy = 10 }
			} 
			modifier = { 
				factor = 0.5
				trait = shy
			} 
		}
	}
	option = {
		name = EVTOPTBHF20337
		prestige = -50
		piety = -25
		ai_chance = { 	
			factor = 25
			modifier = { 
				factor = 0.5
				trait = gregarious
			}
			modifier = { 
				factor = 0.5
				trait = proud
			}
			modifier = { 
				factor = 1.75
				trait = shy
			}
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Foreign incident: Critical success.
character_event = {
	id = DRD_HF.20338
	desc = {
		trigger = {
			ROOT = { character = FROM } #desc for host King
		}
		text = EVTDESCHFA20338
	}
	desc = {
		trigger = {
			NOT = { ROOT = { character = FROM } } #desc for two rivals
		}
		text = EVTDESCHFB20338
	}
	hide_new = yes 

	picture = GFX_evt_state_diplomacy
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20338
		if = { 
			limit = { 
				ROOT = { character = FROMFROM } 
			}
			remove_rival = FROMFROMFROM
		}
		if = { 
			limit = { 
				ROOT = { character = FROMFROMFROM } 
			}
			remove_rival = FROMFROM
		}
		if = { 
			limit = { 
				ROOT = { character = FROM } 
			}
			add_friend = FROMFROM
			add_friend = FROMFROMFROM
		}
		ai_chance = { 	
			factor = 100
		}
	}
}

#Foreign incident: success.
character_event = {
	id = DRD_HF.20339
	desc = {
		trigger = {
			ROOT = { character = FROM } #desc for host King
		}
		text = EVTDESCHFA20339
	}
	desc = {
		trigger = {
			NOT = { ROOT = { character = FROM } } #desc for two rivals
		}
		text = EVTDESCHFB20339
	}
	hide_new = yes 

	picture = GFX_evt_state_diplomacy
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20339
		if = { 
			limit = { 
				ROOT = { character = FROMFROM } 
			}
			remove_rival = FROMFROMFROM
		}
		if = { 
			limit = { 
				ROOT = { character = FROMFROMFROM } 
			}
			remove_rival = FROMFROM
		}
		if = { 
			limit = { 
				ROOT = { character = FROM } 
			}
			prestige = 100
		}
		ai_chance = { 	
			factor = 100
		}
	}
}
#Foreign incident: failure.
character_event = {
	id = DRD_HF.20340
	desc = {
		trigger = {
			ROOT = { character = FROM } #desc for host King
		}
		text = EVTDESCHFA20340
	}
	desc = {
		trigger = {
			NOT = { ROOT = { character = FROM } } #desc for two rivals
		}
		text = EVTDESCHFB20340
	}
	hide_new = yes 

	picture = GFX_evt_rival_rulers
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20340
		if = { 
			limit = { 
				ROOT = { character = FROMFROM } 
			}
			opinion = {
				who = FROM
				modifier = opinion_angry
				months = 30
			}
		}
		if = { 
			limit = { 
				ROOT = { character = FROMFROMFROM } 
			}		
			opinion = {
				who = FROM
				modifier = opinion_angry
				months = 30
			}
		}
		if = { 
			limit = { 
				ROOT = { character = FROM } 
			}
			prestige = -100
		}
		ai_chance = { 	
			factor = 100
		}
	}
}

#Foreign incident: critical failure, gained new rivals.
character_event = {
	id = DRD_HF.20341
	desc = {
		trigger = {
			ROOT = { character = FROM } #desc for host King
		}
		text = EVTDESCHFA20341
	}
	desc = {
		trigger = {
			NOT = { ROOT = { character = FROM } } #desc for two rivals
		}
		text = EVTDESCHFB20341
	}
	hide_new = yes 

	picture = GFX_evt_rival_rulers
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20341
		if = { 
			limit = { 
				ROOT = { character = FROMFROM } 
			}
			add_rival = FROM
		}
		if = { 
			limit = { 
				ROOT = { character = FROMFROMFROM } 
			}		
			add_rival = FROM
		}
		if = { 
			limit = { 
				ROOT = { character = FROM } 
			}
			prestige = -100
			add_rival = FROMFROM
			add_rival = FROMFROMFROM
		}
		ai_chance = { 	
			factor = 100
		}
	}
}

#Cynical/Wicked guest annoys coronation_priest.
character_event = {
	id = DRD_HF.20342
	desc = EVTDESCHFA20342
	hide_new = yes 

	picture = GFX_evt_rival_rulers
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20342
		event_target:coronation_priest = {
				show_scope_change = no	
			opinion = {
				who = ROOT
				modifier = opinion_insulted
				months = 30
			}
		}
		hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20364 } } }
		ai_chance = { 	 
			factor = 100
		}
	}
	option = {
		name = EVTOPTBHF20342
		ai_chance = { 	
			factor = 0
		}
	}
}

#King notified that coronation_priest has been offended, decide what to do.
character_event = {
	id = DRD_HF.20364
	desc = EVTDESCHFA20364
	hide_new = yes 

	picture = GFX_evt_rival_rulers
	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_cynic_taunts } #to avoid the same event happening twice during the coronation.
	}

	is_triggered_only = yes
	
	option = { #Use high diplomacy to make both happy
		name = EVTOPTAHF20364
		tooltip_info = diplomacy
		trigger = { diplomacy = 10 }
		prestige = 75
		piety = 25
		 event_target:coronation_priest = {
				show_scope_change = no	
			opinion = {
				who = ROOT
				modifier = opinion_feast_friend
				months = 30
			}
		}
		FROM = {
				show_scope_change = no	
			opinion = {
				who = ROOT
				modifier = opinion_feast_friend
				months = 30
			}
		}
		hidden_tooltip = { FROM = { character_event = { id = DRD_HF.20343 } } }
		ai_chance = { 	 
			factor = 100
		}
	}
	option = { #Support coronation_priest
		name = EVTOPTBHF20364
		piety = 75
		hidden_tooltip = { FROM = { character_event = { id = DRD_HF.20344 } } }
		 event_target:coronation_priest = {
				show_scope_change = no	
			opinion = {
				who = ROOT
				modifier = opinion_feast_friend
				months = 30
			}
		}
		FROM = {
				show_scope_change = no	
			opinion = {
				who = ROOT
				modifier = opinion_insulted
				months = 30
			}
		}
		ai_chance = { 	
			factor = 50
			modifier = { 
				factor = 0.5
				trait = cynical
			} 
		}
	}
	option = { #Support guest
		name = EVTOPTCHF20364
		prestige = 75
		hidden_tooltip = { FROM = { character_event = { id = DRD_HF.20345 } } }
		 event_target:coronation_priest = {
				show_scope_change = no	
			opinion = {
				who = ROOT
				modifier = opinion_insulted
				months = 30
			}
		}
		 FROM = {
				show_scope_change = no	
			opinion = {
				who = ROOT
				modifier = opinion_feast_friend
				months = 30
			}
		}
		ai_chance = { 	
			factor = 50
			modifier = { 
				factor = 0.5
				trait = zealous
			} 
		}
	}
	option = { #Support neither
		name = EVTOPTDHF20364
		ai_chance = { 	
			factor = 1
			modifier = { 
				factor = 10
				trait = shy
			} 
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Cynical/Wicked learns lesson.
character_event = {
	id = DRD_HF.20343
	desc = EVTDESCHFA20343
	hide_new = yes 

	picture = GFX_evt_state_diplomacy
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20343
		tooltip = {
			opinion = {
				who = FROM
				modifier = opinion_feast_friend
				months = 30
			}
		}
		ai_chance = { 	 
			factor = 100
		}
	}
}
#Cynical/Wicked insulted.
character_event = {
	id = DRD_HF.20344
	desc = EVTDESCHFA20344
	hide_new = yes 

	picture = GFX_evt_rival_rulers
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20344
		tooltip = {
			opinion = {
				who = FROM
				modifier = opinion_insulted
				months = 30
			}
		}
		ai_chance = { 	 
			factor = 100
		}
	}
}
#Cynical/Wicked glad of support.
character_event = {
	id = DRD_HF.20345
	desc = EVTDESCHFA20345
	hide_new = yes 

	picture = GFX_evt_rival_rulers
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20345
		tooltip = {
			opinion = {
				who = FROM
				modifier = opinion_feast_friend
				months = 30
			}
		}
		ai_chance = { 	 
			factor = 100
		}
	}
}

#King: A valiant knight has come to offer his services.
character_event = {
	id = DRD_HF.20346
	desc = {
		trigger = {
			NOT = { is_female = yes }
			age = 16
		}
		text = EVTDESCDRDHFA20346
	}
	desc = {
		trigger = {
			is_female = yes
			age = 16
		}
		text = EVTDESCDRDHFB20346
	}
	desc = {
		trigger = {
			NOT = { age = 16 }
		}
		text = EVTDESCDRDHFC20346
	}

	picture = GFX_evt_knight_kneeling
	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_wandering_knight } #to avoid the same event happening twice during the coronation.

		random_list = {  #DRD-DIFF: female soldiers
			60 = {
				create_random_soldier = {
					random_traits = yes
					dynasty = none
					culture = ROOT
					religion = ROOT
					female = no
					age = 24
					attributes = {
						learning = 10
						martial = 15
					}
				}
			}
			40 = {
				modifier = { 
					factor = 0
					drd_religion_rejects_female_soldiers = yes  #SEE DRD_religion_values_triggers.txt
				}
				modifier = { 
					factor = 0.2
					drd_religion_values_female_soldiers = no  #SEE DRD_religion_values_triggers.txt
				}
				modifier = {  # 90/60 = 60/40 = 1.5x more likely to be of the opposite sex.
					factor = 2.25
					is_female = no
				}
				create_random_soldier = {
					random_traits = yes
					dynasty = none
					culture = ROOT
					religion = ROOT
					female = yes
					age = 24
					attributes = {
						learning = 10
						martial = 15
					}
				}
			}
		}
		new_character = {
			save_event_target_as = coronation_knight
			remove_trait = slow
			remove_trait = imbecile
			remove_trait = dull
			
			remove_trait = mystic
			remove_trait = socializer
			remove_trait = gamer
			remove_trait = hedonist
			remove_trait = strategist
			remove_trait = administrator
			remove_trait = architect
			remove_trait = gardener
			remove_trait = schemer
			remove_trait = impaler
			remove_trait = seducer
			remove_trait = seductress
			remove_trait = theologian
			remove_trait = scholar
			remove_trait = craven
			add_trait = brave
			random = { 
				chance = 10
				add_trait = zealous
			}
			random = { 
				chance = 30 
				add_trait = charitable
			}
			if = {  #DRD-DIFF: trait selection varies between religions
				limit = {
					drd_religion_values_cruel = yes  #SEE DRD_religion_values_triggers.txt
				}
				random = { 
					chance = 30 
					add_trait = cruel
				}
			}
			else_if = {
				limit = {
					drd_religion_values_kind = yes  #SEE DRD_religion_values_triggers.txt
				}
				random = { 
					chance = 30 
					add_trait = kind
				}
			}
			if = {
				limit = {
					drd_religion_values_celibate = yes  #SEE DRD_religion_values_triggers.txt
				}
				random = { 
					chance = 40 
					add_trait = celibate
				}
			}
			else = {
				random = { 
					chance = 40 
					add_trait = lustful
				}
			}
			if = {  #DRD-DIFF: if GHWs are unlocked for religion, chance to give the appropriate trait
				limit = {
					drd_religion_ghw_unlocked = yes  #SEE DRD_religion_ghw_triggers.txt
				}
				random = { 
					chance = 30 
					add_crusade_trait_effect = yes
				}
			}
		}
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20346
		show_portrait = coronation_knight
		event_target:coronation_knight = { 
			move_character = ROOT 
			opinion = {
				modifier = opinion_loyal_servant
				who = ROOT
				years = 100
			}
		}
		hidden_tooltip = { 
			random_list = { 
				30 = {  } 
				40 = { #Court Love
					trigger = {  #DRD-DIFF: female soldiers
						OR = {
							AND = {
								event_target:coronation_knight = { is_female = no }
								is_female = yes
							}
							AND = {
								event_target:coronation_knight = { is_female = yes }
								is_female = no
							}
						}
						is_adult = yes
						NOT = { num_of_lovers = 3 }
					} 
					modifier = { 
						factor = 1.5
						has_fair_trait_trigger = yes
					} 
					modifier = { 
						factor = 0.5
						has_ugly_trait_trigger = yes
					} 
					modifier = { 
						factor = 0.5
						trait = inbred
					}
					modifier = { 
						factor = 0.75
						trait = harelip
					}
					modifier = { 
						factor = 0.75
						trait = lisp
					}
					modifier = { 
						factor = 0.75
						trait = hunchback
					}
					modifier = { 
						factor = 0.75
						trait = dwarf
					}
					modifier = { 
						factor = 1.5
						trait = gregarious
					} 
					modifier = { 
						factor = 1.5
						trait = quick
					} 
					modifier = { 
						factor = 1.5
						trait = genius
					} 
					modifier = { 
						factor = 1.5
						trait = chaste
					} 
					modifier = { 
						factor = 1.5
						trait = celibate
					} 
					modifier = { 
						factor = 0.5
						age = 40
					} 
					modifier = { 
						factor = 1.75
						is_married = no
					} 
					modifier = { 
						factor = 1.5
						event_target:coronation_knight = { trait = lustful }
					}
					hidden_tooltip = { character_event = { id = DRD_HF.20347 days = 2 random = 2 } }
				} 
				40 = { #Squire King

					modifier = { 
						factor = 0
						age = 16
					} 
					modifier = { 
						factor = 1.5
						trait = brave
					} 
					modifier = { 
						factor = 1.5
						trait = strong
					} 
					modifier = { 
						factor = 1.5
						trait = robust
					} 
					modifier = { 
						factor = 1.5
						trait = rowdy
					} 
					modifier = { 
						factor = 0.75
						trait = hunchback
					}
					modifier = { 
						factor = 0.75
						trait = dwarf
					}
					modifier = { 
						factor = 0.5
						trait = inbred
					}
					modifier = { 
						factor = 0.5
						trait = weak
					}
					modifier = { 
						factor = 0.75
						trait = slow
					}
					modifier = { 
						factor = 0.5
						trait = imbecile
					}
					modifier = { 
						factor = 0.75
						trait = feeble
					}
					hidden_tooltip = { character_event = { id = DRD_HF.20350 days = 2 random = 2 } }

				 } 
			} 
		}
		ai_chance = { 	 
			factor = 100
		}
	}
	option = {
		name = EVTOPTBHF20346
		
		hidden_tooltip = {
			event_target:coronation_knight = { 
				death = {
					death_reason = death_missing
				}
			}
		}
		ai_chance = { 	 
			factor = 0
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Queen: travelling knight has fallen in love with you.
character_event = {
	id = DRD_HF.20347
	desc = EVTDESCDRDHFA20347

	picture = GFX_evt_lovers
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20347
		event_target:coronation_knight = { add_lover = ROOT }
		hidden_tooltip = { add_lover = event_target:coronation_knight }
		hidden_tooltip = { #Chance affair is discovered
		random = { chance = 50
				character_event = { id = DRD_HF.20348 days = 1 }
				any_vassal = { 
					limit = { 
						has_opinion_modifier = { 
							who = ROOT 
							modifier = opinion_coronation_guest 
						}
					} 
					character_event = { id = DRD_HF.20349 days = 1 }
				}
				any_independent_ruler = { 
					limit = { 
						has_opinion_modifier = { 
							who = ROOT 
							modifier = opinion_coronation_guest 
						}
					} 
					character_event = { id = DRD_HF.20349 days = 1 }
				}
				event_target:coronation_priest = {  
					character_event = { id = DRD_HF.20349 days = 1 }
				}
			}
		}
		ai_chance = { 	 
			factor = 80
			modifier = { 
				factor = 0
				trait = homosexual
			}
			modifier = { 
				factor = 0.25
				is_married = yes
			}
			modifier = { 
				factor = 0.25
				num_of_lovers = 1
			}
			modifier = { 
				factor = 0.5
				event_target:coronation_knight = { has_ugly_trait_trigger = yes }
			}
			modifier = { 
				factor = 0.5
				event_target:coronation_knight = { trait = weak }
			}
		}
	}
	option = { #Let's just be friends.
		name = EVTOPTBHF20347
		trigger = { diplomacy = 10 }
		tooltip_info = diplomacy
		event_target:coronation_knight = { add_friend = ROOT }
		hidden_tooltip = { add_friend = event_target:coronation_knight }
		ai_chance = { 	 
			factor = 10
		}
	}
	option = {
		name = EVTOPTCHF20347
		custom_tooltip = { text = EVTTOOLTIPBHF20347 }
		hidden_tooltip = {
			event_target:coronation_knight = { 
				death = {
					death_reason = death_missing
				}
			}
		}
		ai_chance = { 	 
			factor = 10
		}
	}
}

#Queen: your affair with the knight has been discovered.
character_event = {
	id = DRD_HF.20348
	desc = EVTDESCHFA20348

	picture = GFX_evt_scandal
	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)
		event_target:coronation_knight = { is_alive = yes } #Check if the knight is still alive.
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20348
		piety = -50
		if = {  #DRD-DIFF: female soldiers
			limit = { 
				is_married = yes
				is_female = no
				NOT = { has_character_modifier = adulterer }
			}
			add_character_modifier = {
				name = adulterer
 				days = -1
 			}
 			spouse = {
				show_scope_change = no	
				opinion = {
					who = ROOT
					modifier = opinion_unfaithful_husband
					months = 1200
				}
 			}
		}
		if = {
			limit = { 
				is_married = yes
				is_female = yes
				NOT = { has_character_modifier = adulteress }
			}
			add_character_modifier = {
				name = adulteress
 				days = -1
 			}
 			spouse = {
				show_scope_change = no	
				opinion = {
					who = ROOT
					modifier = opinion_cuckolded
					months = 1200
				}
 			}
		}
		ai_chance = { 	 
			factor = 100
		}
	}
}

#Crowning guest: the Queen's affair has been revealed.
character_event = {
	id = DRD_HF.20349
	desc = EVTDESCDRDHFA20349
	hide_new = yes 

	picture = GFX_evt_scandal
	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)
		event_target:coronation_knight = { is_alive = yes } #Check if the knight is still alive.
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTADRDHF20349
		ai_chance = { 	 
			factor = 100
		}
	}
}

#Child King: the knight wants to teach you combat.
character_event = {
	id = DRD_HF.20350
	desc = EVTDESCDRDHFA20350
	hide_new = yes 

	picture = GFX_evt_child_sword
	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)
		event_target:coronation_knight = { is_alive = yes } #Check if the knight is still alive.
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20350
		change_martial = 2
		if = { 
			limit = { 
				NOR = { 
					trait = robust 
					trait = feeble
				} 
			} 
			random = { 
				chance = 25
				add_trait = robust
			}
		}
		ai_chance = { 	 
			factor = 80
			modifier = { 
				factor = 0.5
				trait = indolent
			}
		}
	}
	option = {
		name = EVTOPTBHF20350
		prestige = 100
		if = { 
			limit = { 
				NOR = { 
					trait = willful 
					trait = timid
				} 
			} 
			random = { 
				chance = 25
				add_trait = willful
			}
		}
		ai_chance = { 	 
			factor = 20
			modifier = { 
				factor = 0
				trait = rowdy
			}
		}
	}
}

#King: A wandering priest has come to offer his services.
character_event = {
	id = DRD_HF.20351
	desc = EVTDESCHFA20351

	picture = GFX_evt_emissary
	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_wandering_priest } #to avoid the same event happening twice during the coronation.

		random_list = {  #DRD-DIFF: female priests
			50 = {
				modifier = {
					factor = 0
					religion_allows_male_temple_holders = no
				}
				create_random_priest = {
					random_traits = yes
					dynasty = none
					culture = ROOT
					religion = ROOT
					female = no
					age = 37
					attributes = {
						learning = 15
						diplomacy = 10
					}
				}
			}
			50 = {
				modifier = {
					factor = 0
					religion_allows_female_temple_holders = no
				}
				create_random_priest = {
					random_traits = yes
					dynasty = none
					culture = ROOT
					religion = ROOT
					female = yes
					age = 37
					attributes = {
						learning = 15
						diplomacy = 10
					}
				}
			}
			fallback = {
				create_random_priest = {
					random_traits = yes
					dynasty = none
					religion = ROOT
					culture = elephant
					race = elephant
					female = random
					age = 37
					attributes = {
						learning = 15
						diplomacy = 10
					}
				}
			}
		}
		new_character = {
			save_event_target_as = coronation_scholar
			remove_trait = slow
			remove_trait = imbecile
			remove_trait = dull
			
			remove_trait = mystic
			remove_trait = socializer
			remove_trait = gamer
			remove_trait = hedonist
			remove_trait = duelist
			remove_trait = strategist
			remove_trait = administrator
			remove_trait = architect
			remove_trait = gardener
			remove_trait = schemer
			remove_trait = impaler
			remove_trait = seducer
			remove_trait = seductress
			remove_trait = theologian
			remove_trait = scholar
			remove_trait = craven
			add_trait = brave
			random = { 
				chance = 10
				add_trait = zealous
			}
			random = { 
				chance = 30 
				add_trait = temperate
			}
			random = { 
				chance = 30 
				add_trait = diligent
			}
			random = { 
				chance = 40 
				add_trait = scholar
			}
			if = { 
				limit = { 
					has_dlc = "Mystics"
				}
				drd_character_join_random_monastic_order = yes  #SEE DRD_monastic_order_effects.txt
			}
		}
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20351
		trigger = { 
			OR = { 
				learning = 10 
				trait = detached_priest
				trait = martial_cleric
				trait = scholarly_theologian
				trait = mastermind_theologian
			}
		}
		tooltip_info = learning
		change_learning = 2
		piety = 30
		show_portrait = coronation_scholar
		event_target:coronation_scholar = { 
			move_character = ROOT 
			opinion = {
				modifier = opinion_loyal_servant
				who = ROOT
				years = 100
			}
		}
		ai_chance = { 	 
			factor = 100
		}
	}
	option = {
		name = EVTOPTBHF20351
		show_portrait = coronation_scholar
		event_target:coronation_scholar = { 
			move_character = ROOT 
			opinion = {
				modifier = opinion_loyal_servant
				who = ROOT
				years = 100
			}
		}
		ai_chance = { 	 
			factor = 50
		}
	}
	option = {
		name = EVTOPTCHF20351
		hidden_tooltip = {
			event_target:coronation_scholar = { 
				death = {
					death_reason = death_missing
				}
			}
		}
		ai_chance = { 	 
			factor = 0
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Envious/Hateful Vassal guest becomes rival of host (or shows older rivalry).
character_event = {
	id = DRD_HF.20352
	desc = {
		trigger = {
			NOT = { is_rival = FROM }
		}
		text = EVTDESCHFA20352
	}
	desc = {
		trigger = {
			is_rival = FROM
		}
		text = EVTDESCHFB20352
	}

	picture = GFX_evt_scandal
	border = GFX_event_normal_frame_diplomacy
	hide_new = yes 

	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_random_rivalry } #to avoid the same event happening twice during the coronation.
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20352
		if = { 
			limit = { NOT = { is_rival = FROM } } 
			add_rival = FROM
			set_character_flag = flag_new_rivalry
		}
		event_target:coronation_ruler = { character_event = { id = DRD_HF.20353 } }
		ai_chance = { 	 
			factor = 100
		}
	}
	option = {
		name = EVTOPTBHF20352
		trigger = { NOT = { is_rival = FROM } } 
		ai_chance = { 	 
			factor = 0
		}
	}
}

#King: one of your vassals has become your rival.
character_event = {
	id = DRD_HF.20353
	desc = {
		trigger = {
			FROM = { NOT = { has_character_flag = flag_new_rivalry } }
		}
		text = EVTDESCHFA20353
	}
	desc = {
		trigger = {
			FROM = { has_character_flag = flag_new_rivalry }
		}
		text = EVTDESCHFB20353
	}

	picture = GFX_evt_scandal
	border = GFX_event_normal_frame_diplomacy
	hide_new = yes 

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

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20353
		trigger = { diplomacy = 10 }
		tooltip_info = diplomacy
		FROM = { 
			clr_character_flag = flag_new_rivalry 
		}
		FROM = { character_event = { id = DRD_HF.20354 } }
		ai_chance = { 	 
			factor = 100
		}
	}
	option = {
		name = EVTOPTBHF20353
		FROM = { clr_character_flag = flag_new_rivalry }
		add_rival = FROM
		ai_chance = { 	 
			factor = 0
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Rival Vassal: King has convinced you to not be his rival anymore.
character_event = {
	id = DRD_HF.20354
	desc = EVTDESCHFA20354
	hide_new = yes 

	picture = GFX_evt_scandal
	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).
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20354
		remove_rival = FROM
		ai_chance = { 	 
			factor = 100
		}
	}
}

#Secluded King: poor coronation makes you embarassed. Chance for paranoid or stressed.
character_event = {
	id = DRD_HF.20355
	desc = {
		trigger = { 
			war = no 
		}
		text = EVTDESCHFA20355
	}
	desc = {
		trigger = { 
			war = yes
		}
		text = EVTDESCHFB20355
		picture = GFX_evt_mounted_combat_day_hf
	}
	hide_new = yes 

	picture = GFX_evt_bad_news
	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_secluded_embarassed } #to avoid the same event happening twice during the coronation.
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20355
		prestige = -75
		if = { 
			limit = { 
				NOT = { trait = paranoid } 
			} 
			add_trait = paranoid
			hidden_tooltip = { character_event = { id = 38275 } } 
		} 
		ai_chance = { 	 
			factor = 50
		}
	}
	option = {
		name = EVTOPTBHF20355
		if = { 
			limit = { 
				NOT = { trait = stressed } 
			} 
			random = { 
				chance = 50
				add_trait = stressed 
				hidden_tooltip = { character_event = { id = 38282 } } 
			}
		} 
		if = { 
			limit = { trait = stressed } 
			piety = -30
		} 
		ai_chance = { 	 
			factor = 50
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Secluded King: poor coronation makes the uninvited vassals unhappy.
character_event = {
	id = DRD_HF.20356
	desc = {
		trigger = { 
			war = no 
		}
		text = EVTDESCHFA20356
	}
	desc = {
		trigger = { 
			war = yes
		}
		text = EVTDESCHFB20356
		picture = GFX_evt_mounted_combat_day_hf
	}
	hide_new = yes 

	picture = GFX_evt_bad_news
	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_secluded_vassals } #to avoid the same event happening twice during the coronation.
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20356
		custom_tooltip = { text = tooltip_EVTHF20356_A }
		prestige = -35
		hidden_tooltip = { 
			any_vassal = { 
				limit = {
					NOT = { is_councillor = yes }
				} 
				character_event = { id = DRD_HF.20357 }
			}
		}
		ai_chance = { 	 
			factor = 100
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Uninvited vassal of secluded coronation is unhappy with his liege.
character_event = {
	id = DRD_HF.20357
	desc = {
		trigger = { 
			war = no 
		}
		text = EVTDESCHFA20357
	}
	desc = {
		trigger = { 
			war = yes
		}
		text = EVTDESCHFB20357
		picture = GFX_evt_mounted_combat_day_hf
	}
	hide_new = yes 

	picture = GFX_evt_bad_news
	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).
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20357
			opinion = {
				who = FROM
				modifier = opinion_offended
				months = 60
			}
		ai_chance = { 	 
			factor = 100
		}
	}
}

#Coronation_priest is unhappy with secluded coronation.
character_event = {
	id = DRD_HF.20358
	desc = {  #DRD-DIFF: remove the description that mentioned "cardinals".
		trigger = {
			NOT = { event_target:coronation_priest = { higher_real_tier_than = DUKE } } 
		} 
		text = EVTDESCHFA20358
	}
	desc = {  #DRD-NOTE: this version of the event should only happen to the Orthodox Ecumenial Patriarch.
		trigger = { 
			event_target:coronation_priest = { higher_real_tier_than = DUKE } 
		} 
		text = EVTDESCHFB20358
	}
	hide_new = yes 

	picture = GFX_evt_lunatic
	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_secluded_priest } #to avoid the same event happening twice during the coronation.
	}

	is_triggered_only = yes
	
	option = {
		name = {  #DRD-DIFF: Christians refer to themselves as such, like Catholics already do. Same for Muslims, Israelites, and randomized religions.
			text = EVTOPTADRDHFA20358
			trigger = {
				NOT = { event_target:coronation_priest = { higher_real_tier_than = DUKE } } 
				OR = {
					has_alternate_start_parameter = { key = religion_names value = random }
					religion_group = christian
					religion_group = muslim
					religion_group = jewish_group  #DRD-DIFF: not as obvious, but avoids using Jewish as a noun
				}
			}
		}
		name = {  #DRD-DIFF: other real-life religions use their specific name rather than mentioning "Mazdan", "Eastern" or "Pagan" morals.
			text = EVTOPTADRDHFB20358
			trigger = {
				NOT = { event_target:coronation_priest = { higher_real_tier_than = DUKE } } 
				NOR = {
					has_alternate_start_parameter = { key = religion_names value = random }
					religion_group = christian
					religion_group = muslim
					religion_group = jewish_group
				}
			}
		}
		name = {
			text = EVTOPTAHF20358_B
			trigger = {
				event_target:coronation_priest = { higher_real_tier_than = DUKE } 
			}
		}
		trigger = {  #DRD-DIFF: non-monastic pagans should not have this option
			diplomacy = 10
			drd_religion_values_temperate = yes
		}
		if = { 
			limit = { event_target:coronation_priest = { higher_real_tier_than = DUKE } }
			event_target:coronation_priest = { 
				add_character_modifier = {
					name = mud_splatter
					months = 4
				}
			}
		}
		tooltip_info = diplomacy
		ai_chance = { 	 
			factor = 90
		}
	}
	option = {
		name = {
			text = EVTOPTBHF20358
			trigger = {
				NOR = { event_target:coronation_priest = { higher_real_tier_than = DUKE } war = yes } 
			}
		}
		name = {
			text = EVTOPTBHF20358_B
			trigger = {
				war = no
				event_target:coronation_priest = { higher_real_tier_than = DUKE } 
			}
		}
		piety = -75
		if = { 
			limit = { event_target:coronation_priest = { higher_real_tier_than = DUKE } }
			event_target:coronation_priest = { 
				add_character_modifier = {
					name = mud_splatter
					months = 4
				}
			}
		}
		event_target:coronation_priest = {
				show_scope_change = no	
			opinion = {
				who = FROM
				modifier = opinion_very_disappointed
				months = 240
			}
		}
		hidden_tooltip = { 
			any_vassal = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				} 
				character_event = { id = DRD_HF.20359 }
			}
		}
		ai_chance = { 	 
			factor = 10
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Guests of secluded ceremony informed that coronation_priest dislikes it.
character_event = {
	id = DRD_HF.20359
	desc = { 
		trigger = {
			war = no
		} 
		text = EVTDESCHFA20359
	}
	desc = { 
		trigger = {
			war = yes
		} 
		text = EVTDESCHFB20359
		picture = GFX_evt_mounted_combat_day_hf
	}
	hide_new = yes 

	picture = GFX_evt_lunatic
	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).
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20359
		ai_chance = { 	 
			factor = 100
		}
	}
}

#King depressed by secluded coronation, chance to lose ambitious or gain slothful.
character_event = {
	id = DRD_HF.20360
	desc = EVTDESCHFA20360
	hide_new = yes 

	picture = GFX_evt_bad_news
	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_secluded_ambitious } #to avoid the same event happening twice during the coronation.
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20360
		trigger = { trait = ambitious }
		prestige = -35
		random = { 
			chance = 50
			remove_trait = ambitious
		}
		ai_chance = { 	
			factor = 50	
		}
	}
	option = {
		name = EVTOPTBHF20360
		if = { 
			limit = { trait = diligent } 
			random = { 
				chance = 50
				remove_trait = diligent 
				hidden_tooltip = { character_event = { id = 38319 } } 
			}
			break = yes
		}
		if = { 
			limit = { 
				NOR = { 
					trait = diligent 
					trait = slothful
				}  
			} 
			random = { 
				chance = 50
				add_trait = diligent 
				hidden_tooltip = { character_event = { id = 38256 } } 
			}
			break = yes
		}
		if = { 
			limit = { trait = slothful } 
			random = { 
				chance = 50
				piety = -50
			}
			break = yes
		}
		ai_chance = { 	
			factor = 50		
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Proud King humbled by secluded coronation.
character_event = {
	id = DRD_HF.20361
	desc = EVTDESCHFA20361
	hide_new = yes 

	picture = GFX_evt_knight_kneeling
	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_secluded_proud } #to avoid the same event happening twice during the coronation.
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20361
		if = { 
			limit = { trait = proud } 
			remove_trait = proud
			add_trait = humble
			break = yes
		} 
		if = { 
			limit = { NOT = { trait = proud } } 
			add_trait = humble
		} 
		ai_chance = { 	
			factor = 50		
		}
	}
	option = {
		name = EVTOPTBHF20361
		piety = -100
		ai_chance = { 	
			factor = 50	
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#King in secluded Coronation mad at Steward.
character_event = {
	id = DRD_HF.20362
	desc = EVTDESCHFA20362
	hide_new = yes 

	picture = GFX_evt_lunatic
	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_secluded_steward } #to avoid the same event happening twice during the coronation.
		event_target:coronation_ruler = { 
			random_courtier_or_vassal = { 
				limit = { 
					has_job_title = job_treasurer
				} 
				save_event_target_as = lazy_treasurer
			}
		}
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20362
			random_courtier_or_vassal = { 
				limit = { 
					has_job_title = job_treasurer
				} 
				add_rival = ROOT
				hidden_tooltip = { character_event = { id = DRD_HF.20363 } }
			}
		ai_chance = { 	
			factor = 100		
		}
	}
	option = {
		name = EVTOPTBHF20362
		prestige = -100
		ai_chance = { 	
			factor = 0	
		}
	}
	after = { hidden_tooltip = { event_target:coronation_ruler = { character_event = { id = DRD_HF.20365 days = 3 random = 5 } } } } #Second row of random events, else coronation itself.
}

#Notify Steward of new rivalry.
character_event = {
	id = DRD_HF.20363
	desc = EVTDESCHFA20363
	hide_new = yes 

	picture = GFX_evt_lunatic
	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)
	}

	is_triggered_only = yes
	
	option = {
		name = EVTOPTAHF20363
		FROM = { add_rival = ROOT }
		ai_chance = { 	
			factor = 100		
		}
	}
}

#HF.20364 already taken by previous doubled event.

#Hidden event fired twice at different days, holding the scripted_effect containing the long random_list of possible events that can happen during the ceremony.
character_event = {
	id = DRD_HF.20365
	hide_window = yes

	trigger = { 
		event_target:coronation_ruler = {
			#DRD-DIFF: avoid checking for distinct religions
			OR = {
				has_character_flag = flag_crowned_by_priest
				has_character_flag = flag_crowned_by_bishop
				has_character_flag = flag_crowned_by_pope
				has_character_flag = flag_crowned_by_rh_strong_basileus
				has_character_flag = flag_crowned_by_rh_weak_basileus
			}
			NOR = {
				trait = crowned_by_priest
				trait = crowned_by_bishop
				trait = crowned_by_pope
				trait = crowned_by_myself
			} 
		} 
		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 = coronation_count value = 2 } } 
			}
			drd_random_coronation_events_effect = yes  #SEE DRD_00_scripted_effects.txt
		}
		if =  { 
			limit = { 
				check_variable = { which = coronation_count value = 2 } 
			}
			character_event = { id = DRD_HF.20366 days = 15 } #THE CORONATION ITSELF.
		}
		change_variable = { which = coronation_count value = 1 }
	}
}

############################################################################

#CORONATION EVENT
character_event = {
	id = DRD_HF.20366
	title = EVTTITLE20366
	desc = {  # DRD-DIFF: no special case for HRE/Francia
		trigger = {
			ROOT = { 
				war = no
				tier = EMPEROR
				NOT = { has_character_flag = flag_secluded_coronation }
				has_character_flag = flag_crowned_by_pope
				age = 16
			}
		}
		text = EVTDESCDRDHFB20366		# Localization for any adult Emperor crowned by the Pope (not in a barn).
		picture = GFX_evt_coronation
	}
	desc = {  # DRD-DIFF: no special case for HRE/Francia
		trigger = {
			ROOT = { 
				war = no
				tier = EMPEROR
				NOT = { has_character_flag = flag_secluded_coronation }
				has_character_flag = flag_crowned_by_pope
				NOT = { age = 16 }
			}
		}
		text = EVTDESCDRDHFC20366		# Localization for any child Emperor crowned by the Pope (not in a barn).
		picture = GFX_evt_coronation
	}
	desc = {
		trigger = {
			ROOT = { 
				war = no
				tier = KING
				NOT = { has_character_flag = flag_secluded_coronation }
				has_character_flag = flag_crowned_by_pope
				age = 16
			}
		}
		text = EVTDESCDRDHFD20366		# Localization for any adult King crowned by the Pope (not in a barn).
		picture = GFX_evt_a_crowning_ceremony
	}
	desc = {
		trigger = {
			ROOT = { 
				war = no
				tier = KING
				NOT = { has_character_flag = flag_secluded_coronation }
				has_character_flag = flag_crowned_by_pope
				NOT = { age = 16 }
			}
		}
		text = EVTDESCDRDHFE20366		# Localization for any child King crowned by the Pope (not in a barn).
		picture = GFX_evt_a_crowning_ceremony
	}
	desc = {
		trigger = {
			ROOT = { 
				war = no
				NOT = { has_character_flag = flag_secluded_coronation }
				NOT = { has_character_flag = flag_crowned_by_pope }
				age = 16
			}
		}
		text = EVTDESCDRDHFF20366		# Localization for any adult ruler crowned by a Bishop or Priest (not in a barn).
		picture = GFX_evt_a_crowning_ceremony
	}
	desc = {
		trigger = {
			ROOT = { 
				war = no
				NOT = { has_character_flag = flag_secluded_coronation }
				NOT = { has_character_flag = flag_crowned_by_pope }
				NOT = { age = 16 }
			}
		}
		text = EVTDESCDRDHFG20366		# Localization for any child ruler crowned by a Bishop or Priest (not in a barn).
		picture = GFX_evt_a_crowning_ceremony
	}
	desc = {
		trigger = {
			ROOT = { 
				war = no
				has_character_flag = flag_secluded_coronation
				has_character_flag = flag_crowned_by_pope
				age = 16
			}
		}
		text = EVTDESCDRDHFH20366		# Localization for any adult ruler crowned by the Pope in a barn.
		picture = GFX_evt_a_crowning_ceremony
	}
	desc = {
		trigger = {
			ROOT = { 
				war = no
				has_character_flag = flag_secluded_coronation
				has_character_flag = flag_crowned_by_pope
				NOT = { age = 16 }
			}
		}
		text = EVTDESCDRDHFI20366		# Localization for any child ruler crowned by the Pope in a barn.
		picture = GFX_evt_a_crowning_ceremony
	}
	desc = {
		trigger = {
			ROOT = { 
				war = no
				has_character_flag = flag_secluded_coronation
				NOT = { has_character_flag = flag_crowned_by_pope }
			}
		}
		text = EVTDESCHFL20366		# Localization for any ruler crowned by a Bishop or Priest in a barn.
		picture = GFX_evt_a_crowning_ceremony
	}
	desc = {
		trigger = {
			ROOT = { 
				war = yes
				NOT = { has_character_flag = flag_crowned_by_pope }
			}
		}
		text = EVTDESCDRDHFM20366		# War Coronation description.
		picture = GFX_evt_mounted_combat_day_hf
	}

	desc = {
		trigger = {
			ROOT = { 
				war = yes
				has_character_flag = flag_crowned_by_pope
			}
		}
		text = EVTDESCDRDHFN20366		# War Coronation description.
		picture = GFX_evt_mounted_combat_day_hf
	}
	desc = {  #DRD-DIFF: HIP-style Strong Basileus coronation.
		trigger = { ROOT = { has_character_flag = flag_crowned_by_rh_strong_basileus } }
		text = EVTDESCDRDHFB20366  #TODO more descriptive description, since the one in HIP is far too long to be used here.
		picture = GFX_evt_coronation_orthodox
	}
	desc = {  #DRD-DIFF: HIP-style Weak Basileus coronation.
		trigger = { ROOT = { has_character_flag = flag_crowned_by_rh_weak_basileus } }
		text = EVTDESCDRDHFB20366
		picture = GFX_evt_coronation_orthodox
	}

	picture = GFX_evt_a_crowning_ceremony
	border = GFX_event_normal_frame_religion
	hide_new = yes

	trigger = { 
		NOT = { has_character_flag = flag_being_coronated }
		event_target:coronation_ruler = { 
			#DRD-DIFF: avoid checking for distinct religions
			OR = {
				has_character_flag = flag_crowned_by_priest
				has_character_flag = flag_crowned_by_bishop
				has_character_flag = flag_crowned_by_pope
				has_character_flag = flag_crowned_by_rh_strong_basileus
				has_character_flag = flag_crowned_by_rh_weak_basileus
			}
			NOR = { 
				trait = crowned_by_myself
				trait = crowned_by_pope
				trait = crowned_by_bishop
				trait = crowned_by_priest
				trait = strong_basileus
				trait = weak_basileus
			} 
		}
		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 = drd_uncrowned_modifier amount = 30 } 
			set_variable = { which = uncrowned_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.

		if = {  #DRD-DIFF: flag to keep track of the priest's religious head status (only important for crowned_by_bishop)
			limit = {
				OR = {
					has_character_flag = flag_crowned_by_pope 
					has_character_flag = flag_crowned_by_rh_strong_basileus
					has_character_flag = flag_crowned_by_rh_weak_basileus
					rightful_religious_head = event_target:coronation_priest
				}
			}
			set_character_flag = drd_crowned_by_religious_head
		}
	} 
	option = { # Napoleon option
		name = EVTOPTZHF20366
		trigger = {  #DRD-DIFF: implemented but disabled; self-coronation is not necessarily scandalous for other Christians (Byzantine emperors did exactly that), much less for pagans.
			always = no
			age = 16 # Has to be strong enough to grab the crown from the Pope's clutches.
			event_target:coronation_priest = { controls_religion = yes }  #DRD-DIFF: no need to list all religious head titles
			has_character_flag = flag_extravagant_coronation				#Only allowed to screw everything up if you have spent the most money in it already.
			OR = { 
				trait = lunatic
				trait = possessed
				AND = { 
					trait = ambitious
					primary_title = { has_law = imperial_administration } 
				}
				is_devil_worshiper_trigger = yes  #DRD-DIFF: not just for Christians
			}
		}
		add_trait = crowned_by_myself
		add_character_modifier = {
			name = extravagant_coronation
			days = 7300 #20 years
		}
		#Notify all guests, then conclude the ceremony.
		hidden_tooltip = {  
			character_event = { id = DRD_HF.20371 } #Self-Coronation scandal.
			character_event = { id = DRD_HF.20369 days = 3 random = 3 } #wrap up, clear all flags.
			any_vassal = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				}
				character_event = { id = DRD_HF.20371 } #Self-Coronation event for guests.
				character_event = { id = DRD_HF.20370 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 = DRD_HF.20371 } #Self-Coronation event for vassals who did not attend to the ceremony.
			}
			any_independent_ruler = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				}
				character_event = { id = DRD_HF.20371 } #Coronation event for guests.
				character_event = { id = DRD_HF.20370 days = 3 random = 3 } #wrap up, clear all flags.
			} 
			if = {
				limit = {
					ai = no
				}
				set_character_flag = achievement_leglise_cest_moi
			}
		}

		ai_chance = { 	
			factor = 5		
		} 
	} 
	
	option = {
		name = EVTOPTAHF20366
		#Assign proper trait.
		if = {  #DRD-DIFF: other religious heads give a less powerful trait than the Pope, since they are not as hard to please
			limit = { 
				has_character_flag = flag_crowned_by_pope 
			} 
			add_trait = crowned_by_bishop
		}
		if = { 
			limit = { 
				has_character_flag = flag_crowned_by_bishop 
			} 
			add_trait = crowned_by_bishop  #DRD-DIFF: localization fix, no need for a tooltip anymore
		}
		if = { 
			limit = { 
				has_character_flag = flag_crowned_by_priest
			} 
			add_trait = crowned_by_priest  #DRD-DIFF: localization fix, no need for a tooltip anymore
		}
		else_if = {
			limit = {
				has_character_flag = flag_crowned_by_rh_strong_basileus
			} 
			prestige = 250
			add_trait = strong_basileus
			religion_authority = { modifier = strong_emperor_byz }
			pf_court_plus2_effect = yes
			pf_tradition_plus2_effect = yes
			emf_imperial_decay_minus_2 = yes
		}
		else_if = {
			limit = {
				has_character_flag = flag_crowned_by_rh_weak_basileus
			} 
			add_trait = weak_basileus
			religion_authority = { modifier = weak_emperor_byz }
			pf_court_plus1_effect = yes
			pf_tradition_plus1_effect = yes
			emf_imperial_decay_minus_1 = yes
		}

		#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 = crowned_in_barn
				days = -1
			}
		}
		if = { 
			limit = { 
				war = yes
				has_character_flag = flag_secluded_coronation 
			} 
			add_character_modifier = {
				name = crowned_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_coronation
				days = 7300
			}
		}
		#Notify all guests, then conclude the ceremony.
		hidden_tooltip = {  
			character_event = { id = DRD_HF.20369 days = 3 random = 3 } #wrap up, clear all flags.
			any_vassal = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				}
				character_event = { id = DRD_HF.20367 } #Coronation event for guests.
				character_event = { id = DRD_HF.20370 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 = DRD_HF.20368 } #Smaller notification for vassals who did not attend to the ceremony.
			}
			any_independent_ruler = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT 
						modifier = opinion_coronation_guest 
					}
				}
				character_event = { id = DRD_HF.20367 } #Coronation event for guests.
				character_event = { id = DRD_HF.20370 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
	}
}

#CORONATION EVENT (for guests)
character_event = {
	id = DRD_HF.20367
	title = EVTTITLE20366
	desc = {  # DRD-DIFF: no special case for HRE/Francia
		trigger = {
			FROM = { 
				war = no
				tier = EMPEROR
				NOT = { has_character_flag = flag_secluded_coronation }
				has_character_flag = flag_crowned_by_pope
				age = 16
			}
		}
		text = EVTDESCDRDHFB20367		# Localization for any adult Emperor crowned by the Pope (not in a barn).
		picture = GFX_evt_coronation
	}
	desc = {  # DRD-DIFF: no special case for HRE/Francia
		trigger = {
			FROM = { 
				war = no
				tier = EMPEROR
				NOT = { has_character_flag = flag_secluded_coronation }
				has_character_flag = flag_crowned_by_pope
				NOT = { age = 16 }
			}
		}
		text = EVTDESCDRDHFC20367		# Localization for any child Emperor crowned by the Pope (not in a barn).
		picture = GFX_evt_coronation
	}
	desc = {
		trigger = {
			FROM = { 
				war = no
				tier = KING
				NOT = { has_character_flag = flag_secluded_coronation }
				has_character_flag = flag_crowned_by_pope
				age = 16
			}
		}
		text = EVTDESCDRDHFD20367		# Localization for any adult King crowned by the Pope (not in a barn).
		picture = GFX_evt_a_crowning_ceremony
	}
	desc = {
		trigger = {
			FROM = { 
				war = no
				tier = KING
				NOT = { has_character_flag = flag_secluded_coronation }
				has_character_flag = flag_crowned_by_pope
				NOT = { age = 16 }
			}
		}
		text = EVTDESCDRDHFE20367		# Localization for any child King crowned by the Pope (not in a barn).
		picture = GFX_evt_a_crowning_ceremony
	}
	desc = {
		trigger = {
			FROM = { 
				war = no
				NOT = { has_character_flag = flag_secluded_coronation }
				NOT = { has_character_flag = flag_crowned_by_pope }
				age = 16
			}
		}
		text = EVTDESCHFF20367		# Localization for any adult ruler crowned by a Bishop or Priest (not in a barn).
		picture = GFX_evt_a_crowning_ceremony
	}
	desc = {
		trigger = {
			FROM = { 
				war = no
				NOT = { has_character_flag = flag_secluded_coronation }
				NOT = { has_character_flag = flag_crowned_by_pope }
				NOT = { age = 16 }
			}
		}
		text = EVTDESCHFG20367		# Localization for any child ruler crowned by a Bishop or Priest (not in a barn).
		picture = GFX_evt_a_crowning_ceremony
	}
	desc = {
		trigger = {
			FROM = { 
				war = no
				has_character_flag = flag_secluded_coronation
				has_character_flag = flag_crowned_by_pope
				age = 16
			}
		}
		text = EVTDESCDRDHFH20367		# Localization for any adult ruler crowned by the Pope in a barn.
		picture = GFX_evt_a_crowning_ceremony
	}
	desc = {
		trigger = {
			FROM = { 
				war = no
				has_character_flag = flag_secluded_coronation
				has_character_flag = flag_crowned_by_pope
				NOT = { age = 16 }
			}
		}
		text = EVTDESCDRDHFI20367		# Localization for any child ruler crowned by the Pope in a barn.
		picture = GFX_evt_a_crowning_ceremony
	}
	desc = {
		trigger = {
			FROM = { 
				war = no
				has_character_flag = flag_secluded_coronation
				NOT = { has_character_flag = flag_crowned_by_pope }
			}
		}
		text = EVTDESCHFL20367		# Localization for any ruler crowned by a Bishop or Priest in a barn.
		picture = GFX_evt_a_crowning_ceremony
	}
	desc = {
		trigger = {
			FROM = { 
				war = yes
				NOT = { has_character_flag = flag_crowned_by_pope }
			}
		}
		text = EVTDESCDRDHFM20367		# War Coronation description.
		picture = GFX_evt_mounted_combat_day_hf
	}
	desc = {
		trigger = {
			FROM = { 
				war = yes
				has_character_flag = flag_crowned_by_pope
			}
		}
		text = EVTDESCDRDHFN20367		# War Coronation description.
		picture = GFX_evt_mounted_combat_day_hf
	}
	desc = {  #DRD-DIFF: HIP-style Strong Basileus coronation.
		trigger = { FROM = { has_character_flag = flag_crowned_by_rh_strong_basileus } }
		text = EVTDESCDRDHFB20366
		picture = GFX_evt_coronation_orthodox
	}
	desc = {  #DRD-DIFF: HIP-style Weak Basileus coronation.
		trigger = { FROM = { has_character_flag = flag_crowned_by_rh_weak_basileus } }
		text = EVTDESCDRDHFB20366
		picture = GFX_evt_coronation_orthodox
	}

	picture = GFX_evt_a_crowning_ceremony
	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)
		has_opinion_modifier = { 
			who = event_target:coronation_ruler 
			modifier = opinion_coronation_guest 
		}
	}

	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				FROM = { war = no has_character_modifier = crowned_in_barn }
			}
			sound_effect = coronation_barn
		}
		else_if = {
			limit = {
				FROM = { has_character_modifier = extravagant_coronation }
			}
			sound_effect = coronation_extravagant
		}
		else = {
			sound_effect = coronation_normal
		}
	}

	option = {
		name = EVTOPTAHF20367

		#Assign scaled piety.
		if = { 
			limit = { 
				FROM = { has_character_flag = flag_crowned_by_pope } 
			} 
			piety = 10
		}
		if = { 
			limit = { 
				FROM = { has_character_flag = flag_crowned_by_bishop } 
			} 
			piety = 20
		}
		if = { 
			limit = { 
				FROM = { has_character_flag = flag_crowned_by_priest } 
			} 
			piety = 30
		}
		else_if = {
			limit = { 
				FROM = { has_character_flag = flag_crowned_by_rh_strong_basileus }
			}
			tooltip = {
				FROM = {
					add_trait = strong_basileus
					religion_authority = { modifier = strong_emperor_byz }
				}
			}
		}
		else_if = {
			limit = { 
				FROM = { has_character_flag = flag_crowned_by_rh_weak_basileus }
			} 
			tooltip = {
				FROM = {
					add_trait = weak_basileus
					religion_authority = { modifier = weak_emperor_byz }
				}
			}
		}

		#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
		}
		if = { 
			limit = { 
				FROM = { 
					has_character_flag = flag_extravagant_coronation 
					has_character_flag = flag_crowned_by_pope 
				}
			} 
			prestige = 100
		}
		ai_chance = { 	
			factor = 100		
		}
	}
}

#Notifications for vassals who did not attend.
character_event = {
	id = DRD_HF.20368
	title = EVTTITLE20366
	desc = {
		trigger = {
			ROOT = { 
				war = no
			}
		}
		text = EVTDESCHFA20368
	}
	desc = {
		trigger = {
			ROOT = { 
				war = yes
			}
		}
		text = EVTDESCHFA20368
		picture = GFX_evt_mounted_combat_day_hf
	}

	picture = GFX_evt_a_crowning_ceremony
	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 = crowned_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 = EVTOPTAHF20368
		ai_chance = { 	
			factor = 100		
		}
	}
}

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

	picture = GFX_evt_pope
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	#option = {
	#	name = EVTOPTAHF20369
	immediate = {
		hidden_tooltip = { #Post-ceremony flavor.
			if = { 
				limit = { has_character_modifier = crowned_in_barn } 
				random = { 
					chance = 30 
					character_event = { id = DRD_HF.20388 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 = DRD_HF.20389 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 = DRD_HF.20390 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 = DRD_HF.20391 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 = flag_crowned_by_pope
		clr_character_flag = flag_crowned_by_rh_strong_basileus
		clr_character_flag = flag_crowned_by_rh_weak_basileus

		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 = DRD_HF.20370
	desc = {
		trigger = {
			FROM = { 
				war = no
			}
		}
		text = EVTDESCHFB20370
	}
	desc = {
		trigger = {
			FROM = { 
				war = yes
			}
		}
		text = EVTDESCHFC20370		# War Coronation description.
		picture = GFX_evt_mounted_combat_day_hf
	}

	picture = GFX_evt_pope
	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_coronation }
				independent = yes
				higher_real_tier_than = DUKE
				OR = { 
					has_character_modifier = crowned_in_barn
					NOR = { 
						trait = crowned_by_priest
						trait = crowned_by_bishop
						trait = crowned_by_pope
						trait = crowned_by_myself
					}
				}
			}
			hidden_tooltip = { character_event = { id = DRD_HF.20392 days = 50 random = 50 } } #Envious ruler who isn't crowned or is crowned in barn is upset that his host had a good coronation.
		}

	}
}

#Crazy Napoleon ruler snatched the crown from the Pope's hands and crowned himself Emperor.
character_event = {
	id = DRD_HF.20371  #DRD-NOTE: unused
	title = EVTTITLE20371
	desc = {
		trigger = {
			ROOT = { character = FROM } #Desc for Ruler.
		}
		text = EVTDESCHFA20371
	}
	desc = {
		trigger = {
			ROOT = { 
				has_opinion_modifier = { #Desc for Guests
					who = event_target:coronation_ruler 
					modifier = opinion_coronation_guest 
				}
			}
		}
		text = EVTDESCHFB20371		
	}

	desc = {
		trigger = {
			ROOT = { 
				vassal_of = FROM
				NOT = { 
					has_opinion_modifier = { #Desc for Vassals who did not attend.
						who = event_target:coronation_ruler 
						modifier = opinion_coronation_guest 
					}
				}
			}
		}
		text = EVTDESCHFC20371		
	}
	picture = GFX_evt_a_crowning_ceremony
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	trigger = {
		OR = { 
			character = FROM #King
			has_opinion_modifier = { #Guests
				who = event_target:coronation_ruler 
				modifier = opinion_coronation_guest 
			}
			vassal_of = FROM #Vassals
		}

	}

	option = {
		name = EVTOPTAHF20371
		trigger = {
			ROOT = { character = FROM }
		}
		add_trait = excommunicated
		prestige = 400
		piety = -250
	}
	option = {
		name = EVTOPTBHF20371
		trigger = {
			ROOT = { NOT = { character = FROM } }
			ROOT = { 
				has_opinion_modifier = { 
					who = event_target:coronation_ruler 
					modifier = opinion_coronation_guest 
				}
			}
		}
	}
	option = {
		name = EVTOPTCHF20371
		trigger = {
			ROOT = { NOT = { character = FROM } }
			ROOT = { 
				vassal_of = FROM
				NOT = { 
					has_opinion_modifier = { #Desc for Vassals who did not attend.
						who = event_target:coronation_ruler 
						modifier = opinion_coronation_guest 
					}
				}
			}
		}
	}
}

###################################################################################################################

#On_start event to assign crowned_by_traits to existing rulers, so as to prevent a cascade of coronation ceremonies at the beginning of every game.
#DRD-DIFF: entire event has been reworked ; ignore religious head, trigger for all affected characters.
character_event = {
	id = DRD_HF.20372
	hide_window = yes

	is_triggered_only = yes
	
	only_playable = yes

	trigger = {  # Duplicate event for non-Catholics
		is_save_game = no
		has_dlc = "Holy Fury"
		OR = {
			drd_ruler_is_uncrowned = yes  #SEE DRD_coronation_triggers.txt
			AND = {  # MOD HIP/EMF: if fired after EMF's init event, replace emf_crowned with a vanilla Crowned trait.
				trait = emf_crowned
				drd_religion_allows_coronation = yes
			}
		}
		NOR = {
			religion = catholic
			religion = fraticelli
			emf_uses_byzantine_coronation = yes  #MOD HIP/EMF emf_title_triggers.txt: let HIP add the appropriate Basileus trait.
		}
		is_vice_royalty = no
	}
	immediate = {
		random_list = {
			10 = { 
				trigger = {
					religion_head = { always = yes }
				}
				modifier = {
					factor = 0
					OR = { 
						trait = excommunicated
						trait = possessed 
					}
				}
				religion_head = {
					ROOT = {
						save_persistent_event_target = { name = coronation_priest_per scope = PREV } #Needed to localize the trait properly.
					}
				}
				add_trait = crowned_by_bishop  # Other religious heads give a less powerful trait than the Pope, since they are not as hard to please
				set_character_flag = flag_crowned_by_pope
			}
			80 = { 
				modifier = { #Checking if there is no Antipope, and you are not excommunicated, go for the Pope.
					factor = 0.1
					NOT = { trait = excommunicated }
					NOT = { trait = possessed }
					religion_head = { always = yes }
					tier = EMPEROR
				}
				modifier = { #Checking if there is an available powerful theocrat.
					factor = 0
					NOT = { 
						any_realm_character = { 
							drd_character_is_powerful_priest = yes
							religion = ROOT
						}
					} 
				}
				character_event = { id = DRD_HF.20373 }
			}
			10 = { 
				modifier = { # Emperors always crowned by somebody important...
					factor = 0
					NOT = { trait = excommunicated }
					NOT = { trait = possessed }
					tier = EMPEROR
					NOR = {  # ... unless none are available.
						religion_head = { always = yes }
						any_realm_character = { 
							drd_character_is_powerful_priest = yes
							religion = ROOT
						}
					}
				}
				modifier = { #Respectable Kings are crowned by Bishops...
					factor = 0
					NOT = { trait = excommunicated }
					NOT = { trait = possessed }
					tier = KING
					NOR = {  # ... unless none are available
						religion_head = { always = yes }
						any_realm_character = { 
							drd_character_is_powerful_priest = yes
							religion = ROOT
						}
					}
				}
				add_trait = crowned_by_priest
			}
		}
		random_list = { #Second list to determine which modifier.
			40 = { 
				modifier = {
					factor = 0.1
					OR = { 
						trait = excommunicated
						trait = possessed 
					}
				}
				modifier = {
					factor = 0.5
					tier = KING
				}
				modifier = {
					factor = 2
					has_character_flag = flag_crowned_by_pope  #DRD-DIFF: do not use the trait
				}
				if = { 
					limit = { NOT = { ruled_years = 20 } }
					add_character_modifier = {
						name = extravagant_coronation
						days = 6000 #Has probably already ruled for a while.
					}
				}
			}
			50 = { 
			}
			10 = { 
				add_character_modifier = {
					name = crowned_in_barn
					days = -1
				}
			}
		}
	}
}
#Scoping to a powerful theocrat.
character_event = {
	id = DRD_HF.20373
	hide_window = yes

	is_triggered_only = yes

	immediate = { 
		random_realm_character = {  #DRD-DIFF: scripted trigger includes autocephaly
			limit = {
				drd_character_is_powerful_priest = yes
				religion = ROOT
			}
			preferred_limit = {  # Autocephalous ecclesiarch
				has_autocephaly = yes
				rightful_religious_head = THIS
			}
			preferred_limit = {  # Temporal power
				higher_tier_than = COUNT
			}
			ROOT = { save_persistent_event_target = { name = coronation_priest_per scope = PREV } }
		}
		add_trait = crowned_by_bishop
	}
}

#On_death: ruler who died uncrowned will gain uncrowned trait, so that his portrait doesn't default to the royal/imperial crown.
character_event = {
	id = DRD_HF.20374
	hide_window = yes

	only_rulers = yes

	is_triggered_only = yes

	trigger = {  #DRD-DIFF: duplicate event for non-Catholics
		has_dlc = "Holy Fury"  #DRD-NOTE: fix vanilla bug uncrowning kings that could not be "properly" crowned in the first place
		NOR = {
			religion = catholic
			religion = fraticelli
		}
		drd_ruler_is_uncrowned = yes  #SEE DRD_coronation_triggers.txt
	}
	immediate = { 
		add_trait = uncrowned
	}
}

#Five-yearly random bad events for uncrowned rulers.
character_event = {
	id = DRD_HF.20375
	hide_window = yes


	only_rulers = yes
	min_age = 16

	is_triggered_only = yes

	trigger = {  #DRD-DIFF: duplicate event for non-Catholics
		has_dlc = "Holy Fury"
		NOR = {
			religion = catholic
			religion = fraticelli
		}
		drd_ruler_is_uncrowned = yes  #SEE DRD_coronation_triggers.txt
		ruled_years = 5
		NOR =  { 
			has_character_flag = flag_crowned_by_priest
			has_character_flag = flag_crowned_by_bishop
			has_character_flag = flag_crowned_by_pope
			has_character_flag = flag_crowned_by_rh_strong_basileus
			has_character_flag = flag_crowned_by_rh_weak_basileus
		}
	}

	immediate = { 
		#Random negative flavour.
		random_list = { 
			20 = { 
				character_event = { id = DRD_HF.20376 days = 100 random = 100 } #Peasants are upset.
			}
			20 = { 
				modifier = { 
					factor = 0
					NOT	= { 
						any_vassal = { 
							is_theocracy = yes
							count = 2
						}
					}
				}
				character_event = { id = DRD_HF.20377 days = 100 random = 100 } #Priests are upset.
			}
			20 = { 
				modifier = { 
					factor = 0
					is_married = no
				}
				modifier = { 
					factor = 0
					spouse = { 
						NOT = { religion = ROOT }  #DRD-DIFF: avoid checking for distinct religions
					}
				}
				modifier = { 
					factor = 1.75
					spouse = { 
						trait = wroth
					}
				}
				modifier = { 
					factor = 1.75
					spouse = { 
						OR = { 
							trait = crowned_by_priest
							trait = crowned_by_bishop
							trait = crowned_by_pope
							trait = crowned_by_myself
						}
					}
				}
				modifier = { 
					factor = 1.5
					spouse = { 
						higher_real_tier_than = ROOT
					}
				}
				spouse = { character_event = { id = DRD_HF.20378 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 = DRD_HF.20384 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 = DRD_HF.20386 days = 100 random = 100 } #Court chaplain resigns in protest.
				} 
			}
			10 = { 
				modifier = { 
					factor = 0.5
					tier = EMPEROR
				}
				#DRD-DIFF: no reference to HRE
				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.
			}
		}
	}
}

################################################################################################################

#Generic Flavor events related to coronation and crowns.

#Peasants are restless because ruler is uncrowned.
character_event = {
	id = DRD_HF.20376
	desc = EVTDESCDRDHFA20376

	picture = GFX_evt_peasants
	border = GFX_event_normal_frame_diplomacy

	only_rulers = yes

	trigger = {  #DRD-DIFF: duplicate event for non-Catholics
                has_dlc = "Holy Fury"
		NOR = {
			religion = catholic
			religion = fraticelli
		}
		drd_ruler_is_uncrowned = yes  #SEE DRD_coronation_triggers.txt
		capital_scope = { religion = ROOT }
	}

	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 = DRD_HF.20377
	desc = EVTDESCDRDHFA20377

	picture = GFX_evt_bishop
	border = GFX_event_normal_frame_diplomacy

	only_rulers = yes

	trigger = {  #DRD-DIFF: duplicate event for non-Catholics
                has_dlc = "Holy Fury"
		NOR = {
			religion = catholic
			religion = fraticelli
		}
		drd_ruler_is_uncrowned = yes  #SEE DRD_coronation_triggers.txt
	}

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

#Spouse: Your spouse is still not crowned.
character_event = {
	id = DRD_HF.20378
	desc = EVTDESCHFA20378

	picture = GFX_evt_daughter_asking_father
	border = GFX_event_normal_frame_diplomacy

	trigger = {  #DRD-DIFF: duplicate event for non-Catholics 
		has_dlc = "Holy Fury"
		FROM = {
			is_married = ROOT
			drd_ruler_is_uncrowned = yes  #SEE DRD_coronation_triggers.txt
			NOR = { 
				religion = catholic
				religion = fraticelli
			}
		}
	}

	is_triggered_only = yes

	option = {
		name = EVTOPTAHF20378
		custom_tooltip = { text = spouse_informed_uncrowned }
		opinion = {
			modifier = opinion_uncrowned_failure
			years = 5
			who = FROM
		}
		hidden_tooltip = { FROM = { character_event = { id = DRD_HF.20379 } } }
		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 = DRD_HF.20379
	desc = EVTDESCHFA20379

	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 = { 
				#DRD-DIFF: more appropriate check than in vanilla, DOES include Catholic spouses
				drd_ruler_is_uncrowned = yes  #SEE DRD_coronation_triggers.txt
			} 
		}
		tooltip = {
			FROM = {
				prestige = -75
				opinion = {
					modifier = opinion_uncrowned_failure
					years = 5
					who = ROOT
				}
			}
		}
		add_rival = FROM
		hidden_tooltip = { FROM = { character_event = { id = DRD_HF.20380 } } }
		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 = DRD_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 = DRD_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 }
			}
		}
	}
}
#Spouse: Your spouse pointed out that you aren't crowned either.
character_event = {
	id = DRD_HF.20380
	desc = EVTDESCDRDHFA20380

	picture = GFX_evt_quarrel
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	option = {
		name = EVTOPTAHF20380
		prestige = -75
		add_rival = FROM
		ai_chance = { 	
			factor = 100
		}
	}
}

#Spouse: Used diplomacy on you.
character_event = {
	id = DRD_HF.20381
	desc = EVTDESCHFA20381

	picture = GFX_evt_daughter_asking_father
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	option = {
		name = EVTOPTAHF20381
		tooltip = {
			remove_opinion = {
				modifier = opinion_uncrowned_failure
				who = FROM
			}
		}
		ai_chance = { 	
			factor = 100
		}
	}
}

#Spouse: Used sex on you.
character_event = {
	id = DRD_HF.20382
	desc = EVTDESCHFA20382

	picture = GFX_evt_lovers
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	option = {
		name = EVTOPTAHF20382
		remove_opinion = {
			modifier = opinion_uncrowned_failure
			who = FROM
		}
		ai_chance = { 	
			factor = 90
			modifier = { 
				factor = 1.5
				FROM = { has_fair_trait_trigger = yes }
			}
			modifier = { 
				factor = 0.5
				FROM = { has_ugly_trait_trigger = yes }
			}
			modifier = { 
				factor = 0.25
				FROM = { trait = inbred }
			}
			modifier = { 
				factor = 0.5
				FROM = { trait = hunchback }
			}
			modifier = { 
				factor = 0.5
				FROM = { trait = harelip }
			}
			modifier = { 
				factor = 0.5
				NOT = { age = 40 }
				FROM = { age = 40 }
			}
			modifier = { 
				factor = 0.25
				NOT = { age = 60 }
				FROM = { age = 60 }
			}
			modifier = { 
				factor = 0.2
				any_lover = { NOT = { character = FROM } }
			}
			modifier = { 
				factor = 0
				is_rival = FROM
			}
			modifier = { 
				factor = 0
				trait = homosexual
			}
		}
	}
	option = {
		name = EVTOPTBHF20382
		hidden_tooltip = { FROM = { character_event = { id = DRD_HF.20383 } } }
		ai_chance = { 	
			factor = 10
			modifier = 	{ 
				factor = 0
				trait = lustful
			}
		}
	}
}

#Ruler: Spouse did not care for sex.
character_event = {
	id = DRD_HF.20383
	desc = EVTDESCHFA20383

	picture = GFX_evt_quarrel
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

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

#Chancellor: Should remember that liege is still uncrowned.
character_event = {
	id = DRD_HF.20384
	desc = EVTDESCHFA20384

	picture = GFX_evt_council
	border = GFX_event_normal_frame_diplomacy

	trigger = {  #DRD-DIFF: duplicate event for non-Catholics
		has_dlc = "Holy Fury"
		liege = {
			drd_ruler_is_uncrowned = yes  #SEE DRD_coronation_triggers.txt
			NOR = { 
				religion = catholic
				religion = fraticelli
			}
		}
	}

	is_triggered_only = yes

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

#Ruler: Chancellor reminded you that you are still uncrowned.
character_event = {
	id = DRD_HF.20385
	desc = EVTDESCHFA20385

	picture = GFX_evt_council
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	option = {
		name = EVTOPTAHF20385
		add_character_modifier = {
			name = chancellor_of_uncrowned
			duration = 3650
			stacking = yes
		}
		tooltip = {
			FROM = {
				show_scope_change = no	
				opinion = {
					modifier = opinion_uncrowned_ruler
					years = 5
					who = ROOT
				}
			}
		}
		opinion = {
			modifier = opinion_dislike
			years = 5
			who = FROM
		}
		ai_chance = { 	
			factor = 100
		}
	}
}

#Court Chaplain: You resign out of protest because liege is uncrowned.
character_event = {
	id = DRD_HF.20386
	desc = EVTDESCHFA20386

	picture = GFX_evt_council
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes
	trigger = {  #DRD-DIFF: duplicate event for non-Catholics
		has_dlc = "Holy Fury"
		liege = {
			drd_ruler_is_uncrowned = yes  #SEE DRD_coronation_triggers.txt
			NOR = {
				religion = catholic
				religion = fraticelli
			}
		}
	}

	option = {
		name = EVTOPTAHF20386
		hidden_tooltip = { FROM = { character_event = { id = DRD_HF.20387 } } }
		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
		}
	}
}

#Court Chaplain: You resign out of protest because liege is uncrowned.
character_event = {
	id = DRD_HF.20387
	desc = EVTDESCHFA20387

	picture = GFX_evt_council
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	option = {
		name = EVTOPTAHF20387
		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
		}
	}
}

#Emperor crowned in barn humbled.
character_event = {
	id = DRD_HF.20388
	desc = EVTDESCHFA20388

	picture = GFX_evt_knight_kneeling
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	trigger = { 
		tier = EMPEROR
		OR = { 
			trait = crowned_by_priest
			trait = crowned_by_bishop
			trait = crowned_by_pope
			trait = crowned_by_myself
		}
		has_character_modifier = crowned_in_barn
	 } 

	option = {
		name = EVTOPTADRDHF20388
		trigger = { NOT = { trait = humble } } 
		prestige = -100
		if = { 
			limit = { trait = proud }
			remove_trait = proud
		} 
		add_trait = humble
		ai_chance = { 	
			factor = 40
		}
	}
	option = {
		name = EVTOPTADRDHF20388  #DRD-NOTE: same text in vanilla
		trigger = { trait = humble } 
		tooltip_info = humble
		prestige = -150
		piety = 50
		ai_chance = { 	
			factor = 40
		}
	}
	option = {
		name = EVTOPTCHF20388
		piety = -50
		if = { 
			limit = { trait = humble }
			remove_trait = humble
		} 
		ai_chance = { 	
			factor = 20
		}
	}
}

#Peasants are still celebrating coronation.
character_event = {
	id = DRD_HF.20389
	desc = EVTDESCHFA20389

	picture = GFX_evt_market_hf
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	trigger = { 
		OR = { 
			trait = crowned_by_priest
			trait = crowned_by_bishop
			trait = crowned_by_pope
			trait = crowned_by_myself
		}
		has_character_modifier = extravagant_coronation
	 } 

	option = { #Use excitement to build trade
		name = EVTOPTAHF20389
		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 = EVTOPTBHF20389
		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 = EVTOPTCHF20389
		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 = DRD_HF.20390
	desc = EVTDESCHFA20390

	picture = GFX_evt_diplomatic_greeting
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	trigger = { 
		OR = { 
			trait = crowned_by_priest
			trait = crowned_by_bishop
			trait = crowned_by_pope
			trait = crowned_by_myself
		}
		has_character_modifier = extravagant_coronation
	 } 

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

#Festivities for the coronation have brought in more trade.
character_event = {
	id = DRD_HF.20391
	desc = EVTDESCHFA20391

	picture = GFX_evt_diplomatic_greeting
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	trigger = { 
		OR = { 
			trait = crowned_by_priest
			trait = crowned_by_bishop
			trait = crowned_by_pope
			trait = crowned_by_myself
		}
		has_character_modifier = extravagant_coronation
	 } 

	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 = DRD_HF.20392
	desc = {
		trigger = {
			has_character_modifier = crowned_in_barn
		}
		text = EVTDESCHFA20392		
	}
	desc = {
		trigger = {
			NOT = { has_character_modifier = crowned_in_barn }
		}
		text = EVTDESCHFB20392		
	}

	picture = GFX_evt_bad_news
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	trigger = { 
		FROMFROM = { has_character_modifier = extravagant_coronation }
		OR = { 
			has_character_modifier = crowned_in_barn
			NOR = { 
				trait = crowned_by_priest
				trait = crowned_by_bishop
				trait = crowned_by_pope
				trait = crowned_by_myself
			}
		}
	 } 
	option = { 
		name = EVTOPTAHF20392
		trigger = { trait = humble } 
		tooltip_info = humble
		piety = 50
		ai_chance = { 	
			factor = 50
		}
	}

	option = { 
		name = EVTOPTBHF20392
		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
		}
	}
}

###############################
#New Vassals must pay homage to a crowned King.

#On_death event for vassal of crowned ruler.
character_event = {
	id = DRD_HF.20393
	hide_window = yes

	is_triggered_only = yes

	only_rulers = yes

	trigger = {  #DRD-DIFF: Fixed and reworked trigger. Liege: crowned, religion must allow homage and be in the same group as the vassal's.
		has_dlc = "Holy Fury"
		OR = {
			religion_group = christian  #DRD-NOTE: as intended in vanilla, non-Catholic Christian vassals pay homage to crowned Christian lieges.
			drd_religion_allows_homage = yes  #SEE DRD_homage_triggers.txt
		}
		is_feudal = yes 
		independent = no
		higher_real_tier_than = COUNT #Avoid spamming.
		current_heir = { age = 12 } #At the very least
		liege = {
			NOT = { character = ROOT }
			ROOT = {  #DRD-NOTE: fix vanilla bug
				current_heir = {
					NOR = {
						character = PREVPREV
						vassal_of = PREVPREV  #Prevent same vassal from giving homage multiple times when inheriting new titles within the realm (from siblings and such)
					}
				} 
			}
			religion_group = ROOT
			drd_religion_allows_homage = yes  #SEE DRD_homage_triggers.txt
			drd_ruler_is_a_crowned_king = yes  #SEE DRD_coronation_triggers.txt
			in_command = no
		}
	 } 

	immediate = { 
		current_heir = { character_event = { id = DRD_HF.20394 days = 4 random = 4 } }
	}
}

#Heir is prompted to go to his liege.
character_event = {
	id = DRD_HF.20394
	desc = EVTDESCHFA20394		

	picture = GFX_evt_diplomatic_greeting
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	trigger = {  #DRD-DIFF: reworked trigger, mostly check if the liege is still in position to receive homage.
		independent = no
		age = 12
		is_feudal = yes 
		liege = {
			religion_group = ROOT
                        drd_religion_allows_homage = yes  #SEE DRD_homage_triggers.txt
                        drd_ruler_is_a_crowned_king = yes  #SEE DRD_coronation_triggers.txt
		}
	}

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

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

		liege = {
				show_scope_change = no	
			opinion = {
				modifier = opinion_didnot_pay_homage
				years = 100  #DRD-DIFF: at the very least, make it effectively life-long.
				who = ROOT
			}
		}
		ai_chance = {  #DRD-TODO: should probably happen less often, once more serious consequences are implemented.
			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 = DRD_HF.20395
	desc = EVTDESCHFA20395	

	picture = GFX_evt_courier
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	trigger = {  #DRD-DIFF: reworked trigger, mostly check if the liege is still in position to receive homage.
		religion_group = FROM
		drd_religion_allows_homage = yes  #SEE DRD_homage_triggers.txt
		drd_ruler_is_a_crowned_king = yes  #SEE DRD_coronation_triggers.txt
	}

	option = {
		name = EVTOPTAHF20395
		prestige = -50
		tooltip = {
			opinion = {
				modifier = opinion_didnot_pay_homage
				years = 100  #DRD-DIFF: at the very least, make it effectively life-long.
				who = FROM
			}
		}
		ai_chance = { 	
			factor = 100
		}
	}
	#DRD-TODO: this is treason! An ambiguous vassalage status should have serious consequences, and the liege be given the option to react more strongly.
}

#Liege receives homage from vassal.
character_event = {
	id = DRD_HF.20396
	desc = EVTDESCHFA20396

	picture = GFX_evt_emissary
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	trigger = {  #DRD-DIFF: reworked trigger, mostly check if the liege is still in position to receive homage.
		religion_group = FROM
		drd_religion_allows_homage = yes  #SEE DRD_homage_triggers.txt
		drd_ruler_is_a_crowned_king = yes  #SEE DRD_coronation_triggers.txt
	}

	option = { #Accept homage
		name = EVTOPTAHF20396
		custom_tooltip = { text = tooltip_HF20396_A }
		hidden_tooltip = { 
			random_list = { 
				20 = { 
					modifier = {
						factor = 0
						OR = {  #DRD-DIFF: check if the vassal is actually someone ROOT could call an "unbeliever"...
							AND = {
								religion_group = FROM
								NOT = { religion_group = pagan }
							}
							religion = FROM 
							is_heresy_of = FROM
							is_parent_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
						FROM = {  #DRD-DIFF: Unattractive trigger is too broad, only fire for characters that are PHYSICALLY repellent.
							OR = {
								has_fair_trait_trigger = yes
								NOR = {
									has_ugly_trait_trigger = yes
									has_trait = inbred
									has_trait = disfigured
									has_trait = leper
								}
							}
						}
					}
					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 = DRD_HF.20410 }
		}
		ai_chance = { 	
			factor = 95
		}
	}
	option = { #Refuse homage
		name = EVTOPTBHF20396
		hidden_tooltip = { FROM = { character_event = { id = DRD_HF.20398 } } }
		prestige = 100
		FROM = {
				show_scope_change = no	
			opinion = {
				modifier = opinion_offended
				years = 100  #DRD-DIFF: at the very least, make it effectively life-long.
				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 
					} 
				}
			}
		}
	}
}

#Vassal notified liege did not accept homage.
character_event = {
	id = DRD_HF.20398
	desc = EVTDESCHFA20398

	picture = GFX_evt_emissary
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	option = {
		name = EVTOPTAHF20398
		prestige = -75
		tooltip = {
			opinion = {
				modifier = opinion_offended
				years = 100  #DRD-DIFF: at the very least, make it effectively life-long.
				who = FROM
			}
		}
		ai_chance = { 	
			factor = 100
		}
	}
	#DRD-TODO see DRD_HF.20395, the vassal should be more upset, and have the opportunity to take this rejection quite literally.
}

#DRD-DIFF: did not copy events 20399-20404, related to artifact crowns.

#DRD-NOTE: ticking negative modifier for uncrowned rulers. Fired YEARLY (vanilla comment is inaccurate).
#DRD-DIFF: use a different modifier (but the same uncrowned_count) for non-Catholics.
character_event = {
	id = DRD_HF.20405
	hide_window = yes


	only_rulers = yes
	min_age = 16

	is_triggered_only = yes

	trigger = { 
		has_dlc = "Holy Fury"
		drd_ruler_is_uncrowned = yes  #SEE DRD_coronation_triggers.txt
		NOR = {
			religion = catholic
			religion = fraticelli
		}
		NOT = { check_variable = { which = uncrowned_count value = 30 } } #Stop at minus thirty.
		NOR =  { 
			has_character_flag = flag_crowned_by_priest
			has_character_flag = flag_crowned_by_bishop
			has_character_flag = flag_crowned_by_pope
			has_character_flag = flag_crowned_by_rh_strong_basileus
			has_character_flag = flag_crowned_by_rh_weak_basileus
		}
	}

	immediate = { 
		change_variable = { which = uncrowned_count value = 1 }
		add_character_modifier = {
			name = drd_uncrowned_modifier
			duration = -1
			stacking = yes
		}
	}
}

#DRD-DIFF: did not copy events 20406-20407, related to artifact crowns.

#On_conversion. Ruler converted when in the middle of a coronation, cancel everything.
character_event = {
	id = DRD_HF.20408
	desc = EVTDESCHFA20408  #DRD-DIFF: avoid checking for distinct religions

	picture = GFX_evt_heretic
	border = GFX_event_normal_frame_religion

	only_rulers = yes
	min_age = 11

	is_triggered_only = yes

	trigger = { 
		OR = { 
			has_character_flag = flag_preparing_coronation
			has_character_flag = flag_crowned_by_priest
			has_character_flag = flag_crowned_by_bishop
			has_character_flag = flag_crowned_by_pope
			has_character_flag = flag_crowned_by_rh_strong_basileus
			has_character_flag = flag_crowned_by_rh_weak_basileus
			has_character_flag = flag_antipope_for_coronation 
			has_character_flag = flag_excommunicated_for_coronation  
			has_character_flag = flag_pepin_for_coronation  
		} 

		FROM = {
			NOR = {  #DRD-NOTE: duplicate event for non-Catholics
				religion = catholic
				religion = fraticelli
			}
		}
	} 

	immediate = { 
		clr_character_flag = flag_preparing_coronation
		clr_character_flag = flag_crowned_by_priest
		clr_character_flag = flag_crowned_by_bishop
		clr_character_flag = flag_crowned_by_pope
		clr_character_flag = flag_antipope_for_coronation
		clr_character_flag = flag_excommunicated_for_coronation
		clr_character_flag = flag_pepin_for_coronation
	}
	option = { 
		name = EVTOPTAHF20408  #DRD-DIFF: avoid checking for distinct religions
		hidden_tooltip = { remove_trait = travelling }
		hidden_tooltip = { remove_character_modifier = out_traveling }
		hidden_tooltip = { set_variable = { which = coronation_count value = 0 } }
		clr_character_flag = flag_preparing_coronation #Still used when after waging wars
		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 = flag_crowned_by_pope
		clr_character_flag = flag_crowned_by_rh_strong_basileus
		clr_character_flag = flag_crowned_by_rh_weak_basileus

		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_character_modifier = out_traveling
				character_event = { id = DRD_HF.20409 }  #DRD-DIFF: fix vanilla bug
				remove_opinion = { 
					who = ROOT
					modifier = opinion_coronation_guest 
				}
			} 
			any_courtier_or_vassal = { 
				limit = { 
					has_opinion_modifier = { 
						who = ROOT
						modifier = opinion_coronation_guest 
					}
				}
				remove_trait = travelling
				remove_character_modifier = out_traveling
				character_event = { id = DRD_HF.20409 }
				remove_opinion = { 
					who = ROOT
					modifier = opinion_coronation_guest 
				}
			}
		}
	}
}
#Guest: King to be crowned converted. Coronation has been cancelled.
character_event = {
	id = DRD_HF.20409
	desc = EVTDESCHFA20409

	picture = GFX_evt_pope
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	option = {
		name = EVTOPTAHF20409
	}
}

#########################################################

#Liege receives homage from vassal - Expanded flavor.
character_event = {
	id = DRD_HF.20410
	desc = {
		text = EVTDESCHFA20410
		trigger = { 
			has_character_flag = flag_homage_infidel
		}
	}
	desc = {
		text = EVTDESCHFB20410
		trigger = { 
			has_character_flag = flag_homage_child
		}
	}
	desc = {
		text = EVTDESCHFC20410
		trigger = { 
			has_character_flag = flag_homage_old
		}
	}
	desc = {
		text = EVTDESCHFD20410
		trigger = { 
			has_character_flag = flag_homage_attractive
			FROMFROM = { is_female = no }
		}
	}
	desc = {
		text = EVTDESCHFDD20410
		trigger = { 
			has_character_flag = flag_homage_attractive
			FROMFROM = { is_female = yes }
		}
	}
	desc = {
		text = EVTDESCHFF20410
		trigger = { 
			has_character_flag = flag_homage_deformed
		}
	}
	desc = {
		text = EVTDESCHFG20410
		trigger = { 
			has_character_flag = flag_homage_sex
		}
	}
	desc = {
		text = EVTDESCHFH20410
		trigger = { 
			has_character_flag = flag_homage_evil
		}
	}
	desc = {
		text = EVTDESCHFI20410
		trigger = { 
			has_character_flag = flag_homage_good
		}
	}
	desc = {
		text = EVTDESCHFL20410
		trigger = { 
			has_character_flag = flag_homage_generic
		}
	}
	show_from_from = yes #Vassal

	picture = { 
		trigger = { 
			ROOT = { 
				is_female = no
			} 
		} 
		picture = GFX_evt_throne_room
	}
	picture = { 
		trigger = { 
			ROOT = { 
				is_female = yes
			} 
		} 
		picture = GFX_evt_homage_hf
	}
	border = GFX_event_normal_frame_diplomacy

	immediate = { 
		FROMFROM = { #Setup reaction for vassal.
			random_list = { 
				20 = { 
					modifier = {  #DRD-DIFF: only makes sense if the vassal's religion does not practice homage.
						factor = 0
                        			drd_religion_allows_homage = yes  #SEE DRD_homage_triggers.txt
					}
					set_character_flag = flag_homage_infidel
				}
				20 = { 
					modifier = {
						factor = 0
						ROOT = { age = 16 }
					}
					set_character_flag = flag_homage_child
				}
				20 = { 
					modifier = {
						factor = 0
						NOT = { ROOT = { age = 50 } }
					}
					set_character_flag = flag_homage_old
				}
				20 = { 
					modifier = {
						factor = 0
						NOT = { ROOT = { 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
						ROOT = {  # Unattractive trigger is too broad, only fire for characters that are PHYSICALLY repellent.
							OR = {
								has_fair_trait_trigger = yes
								NOR = {
									has_ugly_trait_trigger = yes
									has_trait = inbred
									has_trait = disfigured
									has_trait = leper
								}
							}
						}
					}
					set_character_flag = flag_homage_deformed
				}
				20 = { 
					modifier = {
						factor = 0
						ROOT = { is_female = no }
						OR = { 
							has_law = agnatic_succession
							has_law = cognatic_succession 
						}
					}
					modifier = {
						factor = 0
						ROOT = { is_female = yes }
						OR = { 
							has_law = enatic_cognatic_succession
							has_law = enatic_succession 
						}
					}
					set_character_flag = flag_homage_sex
				}
				20 = { 
					modifier = {
						factor = 0
						NOT = { ROOT = { is_evil_trigger = yes } }  
					}
					set_character_flag = flag_homage_evil
				}
				20 = { 
					modifier = {
						factor = 0
						NOT = { ROOT = { has_virtue_trigger = yes } }  
					}
					set_character_flag = flag_homage_good
				}
				1 = {
					set_character_flag = flag_homage_generic
				}
			}
		}
	}

	is_triggered_only = yes

	option = { #Children play
		name = EVTOPTAHF20410
		custom_tooltip = { text = tooltip_HF20410_A }
		trigger = { 
			has_character_flag = flag_homage_child 
			NOT = { age = 16 }
		}
		hidden_tooltip = { 
			random_list = {
				75 = {
					modifier = {
						factor = 0.5
						FROMFROM = { trait = timid }
					}
					modifier = {
						factor = 0.5
						FROMFROM = { trait = shy }
					}
					modifier = {
						factor = 1.5
						FROMFROM = { trait = playful }
					}
					modifier = {
						factor = 1.5
						FROMFROM = { trait = idolizer }
					}
					FROMFROM = { set_character_flag = flag_homage_play_success } 
				}
				25 = { 
					FROMFROM = { set_character_flag = flag_homage_play_failure } 
				}
			}
		} 
		ai_chance = { 	
			factor = 100
			modifier = {
				factor = 0.5
				trait = shy
			}
			modifier = {
				factor = 0.5
				trait = timid
			}
		}
	}
	option = { #Attracted
		name = EVTOPTBHF20410
		custom_tooltip = { text = tooltip_HF20410_B }
		trigger = { 
			has_character_flag = flag_homage_attractive 
			age = 16
			OR = { 
				AND = { 
					FROMFROM = { is_female = yes } 
					prefers_men_trigger = no
				}
				AND = { 
					FROMFROM = { is_female = no } 
					prefers_men_trigger = yes
				}
			}
		}
		hidden_tooltip = { 
			random_list = {
				50 = {
					modifier = {  #DRD-DIFF: already stated to be repulsed by the liege.
						factor = 0
						FROMFROM = { has_character_flag = flag_homage_deformed }
					}
					modifier = {  #DRD-DIFF: already stated to be attracted to the liege.
						factor = 2
						FROMFROM = { has_character_flag = flag_homage_attractive }
					}
					modifier = {
						factor = 0
						FROMFROM = { prefers_men_trigger = yes }
						is_female = yes
					}
					modifier = {
						factor = 0
						FROMFROM = { prefers_men_trigger = no }
						is_female = no
					}
					modifier = {
						factor = 0.5
						FROMFROM = { trait = chaste }
					}
					modifier = {
						factor = 0.1
						FROMFROM = { trait = celibate }
					}
					modifier = {
						factor = 0.25
						is_unattractive_trigger = yes
					}
					modifier = {
						factor = 1.75
						is_attractive_trigger = yes
					}
					modifier = {
						factor = 1.5
						FROMFROM = { trait = lustful }
					}
					modifier = {
						factor = 1.5
						FROMFROM = { trait = hedonist }
					}
					FROMFROM = { set_character_flag = flag_homage_seduce_success } 
				}
				50 = { 
					FROMFROM = { set_character_flag = flag_homage_seduce_failure } 
				}
			}
		}
		ai_chance = { 	
			factor = 50
			modifier = {
				factor = 0.5
				trait = chaste
			}
			modifier = {
				factor = 0
				trait = celibate
			}
			modifier = {
				factor = 1.5
				trait = lustful
			}
			modifier = {
				factor = 1.5
				trait = hedonist
			}
		}
	}
	option = { #Mock
		name = EVTOPTCHF20410
		custom_tooltip = { text = tooltip_HF20410_C }
		trigger = { 
			has_character_flag = flag_homage_deformed
		}
		prestige = 50
		hidden_tooltip = { 
			random_list = {
				30 = {
					modifier = {
						factor = 0.5
						FROMFROM = { trait = envious }
					}
					modifier = {
						factor = 0.1
						FROMFROM = { trait = proud }
					}
					modifier = {
						factor = 0.5
						FROMFROM = { trait = ambitious }
					}
					modifier = {
						factor = 0.5
						FROMFROM = { trait = wroth }
					}
					modifier = {
						factor = 1.75
						FROMFROM = { trait = humble }
					}
					modifier = {
						factor = 1.75
						FROMFROM = { trait = content }
					}
					modifier = {
						factor = 1.75
						FROMFROM = { trait = kind }
					}
					modifier = {
						factor = 1.75
						FROMFROM = { trait = patient }
					}
					FROMFROM = { set_character_flag = flag_homage_mock_success } 
				}
				70 = { 
					FROMFROM = { set_character_flag = flag_homage_mock_failure } 
				}
			}
		}
		ai_chance = { 	
			factor = 50
			modifier = {
				factor = 0.5
				trait = kind
			}
			modifier = {
				factor = 0.5
				trait = humble
			}
			modifier = {
				factor = 1.5
				trait = cruel
			}
			modifier = {
				factor = 1.5
				trait = envious
			}
		}
	}
	option = { #Formal greeting
		name = EVTOPTDHF20410
		custom_tooltip = { text = tooltip_HF20410_D }
		hidden_tooltip = { 
			random_list = {
				65 = {
					modifier = {
						factor = 0.5
						FROMFROM = { trait = gregarious }
					}
					modifier = {
						factor = 0.1
						FROMFROM = { trait = socializer }
					}
					modifier = {
						factor = 0.5
						FROMFROM = { trait = arbitrary }
					}
					modifier = {
						factor = 1.75
						FROMFROM = { trait = shy }
					}
					modifier = {
						factor = 1.75
						FROMFROM = { trait = content }
					}
					modifier = {
						factor = 1.75
						FROMFROM = { trait = trusting }
					}
					FROMFROM = { set_character_flag = flag_homage_formal_success } 
				}
				35 = { 
					FROMFROM = { set_character_flag = flag_homage_formal_failure } 
				}
			}
		}
		ai_chance = { 	
			factor = 30
			modifier = {
				factor = 0.5
				trait = gregarious
			}
			modifier = {
				factor = 0.5
				trait = socializer
			}
			modifier = {
				factor = 0.5
				trait = arbitrary
			}
			modifier = {
				factor = 1.5
				trait = paranoid
			}
		}
	}
	option = { #Informal greeting
		name = EVTOPTEHF20410
		custom_tooltip = { text = tooltip_HF20410_E }
		hidden_tooltip = { 
			random_list = {
				65 = {
					modifier = {  #DRD-DIFF: familiarity seems threatening.
						factor = 0.5
						FROMFROM = { has_character_flag = flag_homage_evil }
					}
					modifier = {  #DRD-DIFF: familiarity seems authentic.
						factor = 2
						FROMFROM = { has_character_flag = flag_homage_good }
					}
					modifier = {
						factor = 0.5
						FROMFROM = { trait = shy }
					}
					modifier = {  #DRD-DIFF: makes more sense than humble.
						factor = 0.5
						FROMFROM = { trait = ambitious }
					}
					modifier = {
						factor = 0.5
						FROMFROM = { trait = just }
					}
					modifier = {
						factor = 1.75
						FROMFROM = { trait = gregarious }
					}
					modifier = {
						factor = 1.5
						FROMFROM = { trait = proud }
					}
					modifier = {
						factor = 1.75
						FROMFROM = { trait = content }
					}
					modifier = {
						factor = 1.75
						FROMFROM = { trait = trusting }
					}
					FROMFROM = { set_character_flag = flag_homage_informal_success } 
				}
				35 = { 
					FROMFROM = { set_character_flag = flag_homage_informal_failure } 
				}
			}
		}
		ai_chance = { 	
			factor = 30
			modifier = {
				factor = 0.5
				trait = shy
			}
			modifier = {
				factor = 0.5
				trait = humble
			}
			modifier = {
				factor = 0.5
				trait = just
			}
			modifier = {
				factor = 1.5
				trait = trusting
			}
		}
	}
	after = { 
		clr_character_flag = flag_homage_infidel
		clr_character_flag = flag_homage_child
		clr_character_flag = flag_homage_old
		clr_character_flag = flag_homage_attractive
		clr_character_flag = flag_homage_deformed
		clr_character_flag = flag_homage_sex
		clr_character_flag = flag_homage_evil
		clr_character_flag = flag_homage_good
		clr_character_flag = flag_homage_generic
		hidden_tooltip = { FROMFROM = { character_event = { id = DRD_HF.20411 } } } 
	}
}

#Vassal receives homage from vassal - Expanded flavor.
character_event = {
	id = DRD_HF.20411
	desc = {
		text = EVTDESCHFA20411
		trigger = { 
			has_character_flag = flag_homage_infidel
		}
	}
	desc = {
		text = EVTDESCHFB20411
		trigger = { 
			has_character_flag = flag_homage_child
		}
	}
	desc = {
		text = EVTDESCHFC20411
		trigger = { 
			has_character_flag = flag_homage_old
		}
	}
	desc = {
		text = EVTDESCHFD20411
		trigger = { 
			has_character_flag = flag_homage_attractive
			is_female = no
		}
	}
	desc = {
		text = EVTDESCHFDD20411
		trigger = { 
			has_character_flag = flag_homage_attractive
			is_female = yes
		}
	}
	desc = {
		text = EVTDESCHFF20411
		trigger = { 
			has_character_flag = flag_homage_deformed
		}
	}
	desc = {
		text = EVTDESCHFG20411
		trigger = { 
			has_character_flag = flag_homage_sex
		}
	}
	desc = {
		text = EVTDESCHFH20411
		trigger = { 
			has_character_flag = flag_homage_evil
		}
	}
	desc = {
		text = EVTDESCHFI20411
		trigger = { 
			has_character_flag = flag_homage_good
		}
	}
	desc = {
		text = EVTDESCHFL20411
		trigger = { 
			has_character_flag = flag_homage_generic
		}
	}

	picture = { 
		trigger = { 
			ROOT = { 
				is_female = no
			} 
		} 
		picture = GFX_evt_emissary
	}
	picture = { 
		trigger = { 
			ROOT = { 
				is_female = yes
			} 
		} 
		picture = GFX_evt_homage_hf
	}
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	option = { #Pleased.
		name = {
			text = EVTOPTAHF20411_A
			trigger = { 
				OR = {
					has_character_flag = flag_homage_play_success
					has_character_flag = flag_homage_seduce_success
					has_character_flag = flag_homage_mock_success
					has_character_flag = flag_homage_formal_success 
					has_character_flag = flag_homage_informal_success
				}
			}
		}
		name = {
			text = EVTOPTAHF20411_B
			trigger = { 
				OR = {
					has_character_flag = flag_homage_play_failure
					has_character_flag = flag_homage_seduce_failure
					has_character_flag = flag_homage_mock_failure
					has_character_flag = flag_homage_formal_failure
					has_character_flag = flag_homage_informal_failure
				}
			}
		}
		if = {  #DRD-DIFF: actual effect of a positive outcome depends on the option chosen by the liege.
			limit = { has_character_flag = flag_homage_informal_success }
			opinion = {
				modifier = opinion_thoroughly_impressed
				who = FROM
				years = 20
			}
		}
		else_if = {
			limit = {
				OR = {
					has_character_flag = flag_homage_play_success
					has_character_flag = flag_homage_play_failure
				}
			}
			random_list = {
				50 = {
					trigger = {
						has_character_flag = flag_homage_play_failure
						NOT = { has_opinion_modifier = { modifier = opinion_budding_friendship who = FROM } }
						NOT = { is_friend = FROM }
					}
					opinion = {
						modifier = opinion_annoyed
						who = FROM
						years = 10
					}
				}
				40 = {
					trigger = {
						NOT = { has_opinion_modifier = { modifier = opinion_budding_friendship who = FROM } }
					}
					opinion = {
						modifier = opinion_budding_friendship
						who = FROM
						years = 10
					}
					reverse_opinion = {
						modifier = opinion_budding_friendship
						who = FROM
						years = 10
					}
				}
				10 = {
					add_friend = FROM
				}
			}
		}
		else_if = {
			limit = { has_character_flag = flag_homage_seduce_success }
			opinion = {
				modifier = opinion_seduced_attracted
				who = FROM
				years = 5
			}
			reverse_opinion = {
				modifier = opinion_seduced_attracted
				who = FROM
				years = 5
			}
		}
		else_if = {
			limit = {
				OR = {
					has_character_flag = flag_homage_mock_success
					has_character_flag = flag_homage_mock_failure
				}
			}
			prestige = -100
			random_list = {
				10 = {
					trigger = { NOT = { trait = humble } }
					add_trait = humble
				}
				10 = {
					trigger = { NOT = { trait = patient } }
					add_trait = patient
				}
				20 = {
					trigger = { has_character_flag = flag_homage_mock_failure }
					add_trait = craven
				}
				fallback = {
					piety = 50
				}
			}
		}
		else = {  # Default for formal or failed homages.
			opinion = {
				modifier = opinion_pleased
				who = FROM
				years = 5
			}
		}
		hidden_tooltip = { FROM = { character_event = { id = DRD_HF.20412 } } } 
		ai_chance = { 
			factor = 50
			modifier = {
				factor = 0
				OR = {
					has_character_flag = flag_homage_play_failure
					has_character_flag = flag_homage_seduce_failure
					has_character_flag = flag_homage_mock_failure
					has_character_flag = flag_homage_formal_failure
					has_character_flag = flag_homage_informal_failure
				}
			}
		}
	} 
	option = { #Offended
		name = {
			text = EVTOPTBHF20411_A
			trigger = { 
				OR = {
					has_character_flag = flag_homage_play_success
					has_character_flag = flag_homage_seduce_success
					has_character_flag = flag_homage_mock_success
					has_character_flag = flag_homage_formal_success 
					has_character_flag = flag_homage_informal_success
				}
			}
		}
		name = {
			text = EVTOPTBHF20411_B
			trigger = { 
				OR = {
					has_character_flag = flag_homage_play_failure
					has_character_flag = flag_homage_seduce_failure
					has_character_flag = flag_homage_mock_failure
					has_character_flag = flag_homage_formal_failure
					has_character_flag = flag_homage_informal_failure
				}
			}
		}
		if = {  #DRD-DIFF: actual effect of a negative outcome depends on the option chosen by the liege.
			limit = { has_character_flag = flag_homage_informal_failure }
			opinion = {
				modifier = opinion_insulted
				who = FROM
				years = 20
			}
		}
		else_if = {
			limit = {
				OR = {
					has_character_flag = flag_homage_play_success
					has_character_flag = flag_homage_play_failure
				}
			}
			opinion = {
				modifier = opinion_annoyed
				who = FROM
				years = 10
			}
		}
		else_if = {
			limit = { has_character_flag = flag_homage_seduce_failure }
			opinion = {
				modifier = opinion_seduced_repelled
				who = FROM
				years = 20
			}
		}
		else_if = {
			limit = {
				OR = {
					has_character_flag = flag_homage_mock_success
					has_character_flag = flag_homage_mock_failure
				}
			}
			prestige = -100
			add_rival = FROM
		}
		else = {  # Default for formal or successful homages.
			opinion = {
				modifier = opinion_irritated
				who = FROM
				years = 5
			}
		}
		hidden_tooltip = { FROM = { character_event = { id = DRD_HF.20413 } } } 
		ai_chance = { 
			factor = 50
			modifier = {
				factor = 0
				OR = {
					has_character_flag = flag_homage_play_success
					has_character_flag = flag_homage_seduce_success
					has_character_flag = flag_homage_mock_success
					has_character_flag = flag_homage_formal_success 
					has_character_flag = flag_homage_informal_success
				}
			}
		}
	}
	
	after = {  # DRD-DIFF: only clear success/failure flags after the liege is informed.
		clr_character_flag = flag_homage_infidel
		clr_character_flag = flag_homage_child
		clr_character_flag = flag_homage_old
		clr_character_flag = flag_homage_attractive
		clr_character_flag = flag_homage_deformed
		clr_character_flag = flag_homage_sex
		clr_character_flag = flag_homage_evil
		clr_character_flag = flag_homage_good
		clr_character_flag = flag_homage_generic
	}
}

#King notified: New vassal was pleased with your greeting.
character_event = {
	id = DRD_HF.20412
	desc = EVTDESCHFA20412

	picture = { 
		trigger = { 
			ROOT = { 
				is_female = no
			} 
		} 
		picture = GFX_evt_throne_room
	}
	picture = { 
		trigger = { 
			ROOT = { 
				is_female = yes
			} 
		} 
		picture = GFX_evt_homage_hf
	}
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	option = {
		name = EVTOPTAHF20412
		tooltip = { 
			FROM = {
				show_scope_change = no 
				if = {  #DRD-DIFF: actual effect of a positive outcome depends on the option chosen by the liege.
					limit = { has_character_flag = flag_homage_informal_success }
					opinion = {
						modifier = opinion_thoroughly_impressed
						who = ROOT
						years = 20
					}
				}
				else_if = {
					limit = {
						OR = {
							has_character_flag = flag_homage_play_success
							has_character_flag = flag_homage_play_failure
						}
					}
					if = {
						limit = { is_friend = ROOT }
						add_friend = ROOT
					}
					else_if = {
						limit = {
							has_opinion_modifier = { modifier = opinion_budding_friendship who = ROOT }
						}
						opinion = {
							modifier = opinion_budding_friendship
							who = ROOT
							years = 10
						}
					}
					else = {
						opinion = {
							modifier = opinion_annoyed
							who = ROOT
							years = 10
						}
					}
				}
				else_if = {
					limit = { has_character_flag = flag_homage_seduce_success }
					opinion = {
						modifier = opinion_seduced_attracted
						who = ROOT
						years = 5
					}
					reverse_opinion = {
						modifier = opinion_seduced_attracted
						who = ROOT
						years = 5
					}
				}
				else_if = {
					limit = {
						NOR = {
							has_character_flag = flag_homage_mock_success
							has_character_flag = flag_homage_mock_failure
						}
					}
					opinion = {
						modifier = opinion_pleased
						who = ROOT
						years = 5
					}
				}
			}
		}
	}
	after = {  # DRD-DIFF: clear success/failure flags now that the liege is informed.
		FROM = {
			clr_character_flag = flag_homage_play_success
			clr_character_flag = flag_homage_seduce_success
			clr_character_flag = flag_homage_mock_success
			clr_character_flag = flag_homage_formal_success
			clr_character_flag = flag_homage_informal_success
			clr_character_flag = flag_homage_play_failure
			clr_character_flag = flag_homage_seduce_failure
			clr_character_flag = flag_homage_mock_failure
			clr_character_flag = flag_homage_formal_failure
			clr_character_flag = flag_homage_informal_failure 
		}
	}
}
#King notified: New vassal was not pleased with your greeting.
character_event = {
	id = DRD_HF.20413
	desc = EVTDESCHFA20413

	picture = { 
		trigger = { 
			ROOT = { 
				is_female = no
			} 
		} 
		picture = GFX_evt_throne_room
	}
	picture = { 
		trigger = { 
			ROOT = { 
				is_female = yes
			} 
		} 
		picture = GFX_evt_homage_hf
	}
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	option = {
		name = EVTOPTAHF20413
		tooltip = { 
			FROM = {
				show_scope_change = no 
				if = {  #DRD-DIFF: actual effect of a negative outcome depends on the option chosen by the liege.
					limit = { has_character_flag = flag_homage_informal_failure }
					opinion = {
						modifier = opinion_insulted
						who = ROOT
						years = 20
					}
				}
				else_if = {
					limit = {
						OR = {
							has_character_flag = flag_homage_play_success
							has_character_flag = flag_homage_play_failure
						}
					}
					opinion = {
						modifier = opinion_annoyed
						who = ROOT
						years = 10
					}
				}
				else_if = {
					limit = { has_character_flag = flag_homage_seduce_failure }
					opinion = {
						modifier = opinion_seduced_repelled
						who = ROOT
						years = 20
					}
				}
				else_if = {
					limit = {
						OR = {
							has_character_flag = flag_homage_mock_success
							has_character_flag = flag_homage_mock_failure
						}
					}
					add_rival = ROOT
				}
				else = {
					opinion = {
						modifier = opinion_irritated
						who = ROOT
						years = 5
					}
				}
			}
		}
	}
	after = {  # DRD-DIFF: clear success/failure flags now that the liege is informed.
		FROM = {
			clr_character_flag = flag_homage_play_success
			clr_character_flag = flag_homage_seduce_success
			clr_character_flag = flag_homage_mock_success
			clr_character_flag = flag_homage_formal_success
			clr_character_flag = flag_homage_informal_success
			clr_character_flag = flag_homage_play_failure
			clr_character_flag = flag_homage_seduce_failure
			clr_character_flag = flag_homage_mock_failure
			clr_character_flag = flag_homage_formal_failure
			clr_character_flag = flag_homage_informal_failure 
		}
	}
}


#DRD-DIFF: did not copy events 20414-20415, related to artifact crowns.

#DRD-DIFF: On_conversion, check for either kind of "uncrowned" modifier (vanilla or DRD) if we need to remove them or transfer stacks between them.
character_event = {
	id = DRD_HF.20416
	hide_window = yes

	is_triggered_only = yes

	trigger = {
		OR = {
			has_character_modifier = uncrowned_modifier
			has_character_modifier = drd_uncrowned_modifier
		}
	}

	immediate = {
		if = {
			limit = {
				NOT = {
					drd_religion_allows_coronation = yes  #SEE DRD_coronation_triggers.txt
				}
			}
			remove_character_modifiers = { modifier = uncrowned_modifier amount = 30 } 	
			remove_character_modifiers = { modifier = drd_uncrowned_modifier amount = 30 } 	
			set_variable = { which = uncrowned_count value = 0 }
		}
		else_if = {
			limit = {
				OR = {
					religion = catholic
					religion = fraticelli
				}
				FROM = {
					drd_religion_allows_coronation = yes  #SEE DRD_coronation_triggers.txt
					NOR = {
						religion = catholic
						religion = fraticelli
					}
				}
			}
			while = {
				limit = { has_character_modifier = drd_uncrowned_modifier }
				remove_character_modifiers = { modifier = drd_uncrowned_modifier amount = 1 } 	
				add_character_modifier = {
					name = uncrowned_modifier
					duration = -1
					stacking = yes
				}
			}
			set_variable = { which = uncrowned_count value = 0 }
		}
		else_if = {  #DRD-NOTE: won't work properly as long as the vanilla event takes priority
			limit = {
				NOR = {
					religion = catholic
					religion = fraticelli
				}
				FROM = {
					OR = {
						religion = catholic
						religion = fraticelli
					}
				}
			}
			while = {
				limit = { has_character_modifier = uncrowned_modifier }
				remove_character_modifiers = { modifier = uncrowned_modifier amount = 1 } 	
				add_character_modifier = {
					name = drd_uncrowned_modifier
					duration = -1
					stacking = yes
				}
			}
			set_variable = { which = uncrowned_count value = 0 }
		}
	}
}
#DRD-DIFF: On_new_holder, clean up drd_uncrowned_modifier. FROMFROM = Title's old holder.
character_event = {
	id = DRD_HF.20417
	hide_window = yes

	is_triggered_only = yes

	trigger = {
		FROMFROM = {
			has_character_modifier = drd_uncrowned_modifier
			NOT = { #If no longer King-tier.
				higher_real_tier_than = DUKE
			}
		}
	}

	immediate = {
		FROMFROM = { 
			remove_character_modifiers = { modifier = drd_uncrowned_modifier amount = 30 } 
			set_variable = { which = uncrowned_count value = 0 }
		} 	
	}
}

#DRD-DIFF: did not copy events 20418-20420, related to Pope-specific event chains.
