#############################################
#
# Events for Family Members
#
# Event ID 37000-37999 is reserved
#
#############################################

###################################################
# Relative demands a title
###################################################

# Relative demands inheritance due to ambition
character_event = {
	id = 37000
	desc = EVTDESC37000
	picture = GFX_evt_son_asking_father

	min_age = 20
	capable_only = yes
	prisoner = no
	lacks_dlc = "Zeus"

	trigger = {
		has_ambition = obj_wants_landed_title
		liege = {
			is_close_relative = ROOT
			war = no
			any_demesne_title = {
				can_be_given_away = yes
				tier = count
				is_feudal = yes
				location = { is_capital = no }
			}
		}
		NOT = { has_character_flag = flag_denied_title }
		NOT = { has_character_flag = flag_promised_title }
		OR = {
			NOT = { has_character_flag = flag_later_title }
			had_character_flag = { flag = flag_later_title days = 1825 }
		}
	}

	mean_time_to_happen = {
		months = 9

		modifier = {
			factor = 0.5
			trait = ambitious
		}
		modifier = {
			factor = 0.5
			trait = diligent
		}
		modifier = {
			factor = 5.0
			trait = slothful
		}
		modifier = {
			factor = 5.0
			trait = content
		}
	}

	option = {
		name = EVTOPTA37000 # Ask liege for a title
		liege = { character_event = { id = 37001 days = 3 tooltip = EVTTOOLTIP37001 } }
	}
}

# Liege responds to the request
character_event = {
	id = 37001
	desc = EVTDESC37001
	picture = GFX_evt_son_asking_father

	is_triggered_only = yes

	option = {
		name = EVTOPTA37001 # Promise that you'll arrange it
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0.25
				demesne_efficiency = 1.5
			}
			modifier = {
				factor = 0.25
				demesne_efficiency = 2.0
			}
			modifier = {
				factor = 5
				NOT = { demesne_efficiency = 1.1 }
			}
			modifier = {
				factor = 0.1
				primary_title = {
					has_law = succ_gavelkind
				}
			}
			modifier = {
				factor = 10
				FROM = { is_primary_heir = yes }
			}
		}
		FROM = { character_event = { id = 37002 tooltip = EVTTOOLTIP37002 } }
	}

	option = {
		name = EVTOPTB37001 # Say he's not ready yet
		trigger = {
			NOT = { diplomacy = 8 }
		}
		
		FROM = { character_event = { id = 37004 tooltip = EVTTOOLTIP37004 } }
		
		if = {
			limit = {
				ai = no
				independent = yes
				FROM = {
					NOT = { trait = content }
					NOT = { trait = patient }
					NOT = { trait = craven }
					NOT = { age = 65 }
					has_character_flag = flag_later_title
				}
			}
			custom_tooltip = { text = evt_relative_might_revolt }
		}
	}
	
	option = {
		name = EVTOPTC37001 # Mention a Church career...
		tooltip_info = diplomacy
		trigger = {
			religion_group = christian
			diplomacy = 8
		}
		FROM = { character_event = { id = 37003 tooltip = EVTTOOLTIP37003 } }
	}
	
	option = {
		name = EVTOPTD37001 # Diplomatically refuse
		tooltip_info = diplomacy
		trigger = {
			NOT = { religion_group = christian }
			diplomacy = 8
		}
		FROM = { character_event = { id = 37003 tooltip = EVTTOOLTIP37003 } }
	}

}

# The relative is filled with anticipation
character_event = {
	id = 37002
	desc = EVTDESC37002
	picture = GFX_evt_son_asking_father

	is_triggered_only = yes

	option = {
		name = EVTOPTA37002 # It had better not be hollow words...
		opinion = {
			who = FROM
			modifier = opinion_promised_title
			months = 36
		}
		set_character_flag = flag_promised_title
		add_character_modifier = { name = promised_a_title duration = -1 }
		
		hidden_tooltip = {
			if = {
				limit = {
					OR = {
						trait = slothful
						trait = content
					}
					NOT = { trait = ambitious }
				}
				character_event = { id = 37005 days = 865 random = 200 }
			}
			if = {
				limit = {
					NOT = { trait = slothful }
					NOT = { trait = content }
					NOT = { trait = ambitious }
				}
				character_event = { id = 37005 days = 385 random = 200 }
			}
			if = {
				limit = {
					trait = ambitious
				}
				character_event = { id = 37005 days = 365 random = 50 }
			}
		}

	}
}

# The relative is deeply offended
character_event = {
	id = 37003
	desc = EVTDESC37003
	picture = GFX_evt_bad_news

	is_triggered_only = yes

	option = {
		name = EVTOPTA37003 # This will not stand!
		opinion = {
			who = FROM
			modifier = opinion_denied_title
			years = 10
		}
		set_character_flag = flag_denied_title
		set_character_flag = obj_landed_title
		cancel_ambition = yes
	}
}

# The relative is disappointed
character_event = {
	id = 37004
	desc = EVTDESC37004
	picture = GFX_evt_bad_news

	is_triggered_only = yes

	option = {
		name = EVTOPTE37004 # I can accept this
		ai_chance = {
			factor = 50
			modifier = {
				factor = 5.0
				trait = content
			}
			modifier = {
				factor = 5.0
				trait = humble
			}
			modifier = {
				factor = 2.0
				trait = charitable
			}
			modifier = {
				factor = 2.0
				trait = kind
			}
		}
		set_character_flag = obj_landed_title
		cancel_ambition = yes
	}
	option = {
		name = EVTOPTA37004 # I'll ask again later...
		trigger = {
			NOT = { has_character_flag = flag_later_title }
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 2.0
				trait = greedy
			}
			modifier = {
				factor = 2.0
				trait = proud
			}
			modifier = {
				factor = 5.0
				trait = ambitious
			}
			modifier = {
				factor = 5.0
				trait = envious
			}
		}
		set_character_flag = flag_later_title
	}
	
	option = {
		name = EVTOPTB37004 # Not again!
		trigger = {
			has_character_flag = flag_later_title
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 2.0
				trait = greedy
			}
			modifier = {
				factor = 2.0
				trait = proud
			}
			modifier = {
				factor = 5.0
				trait = ambitious
			}
			modifier = {
				factor = 5.0
				trait = envious
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_denied_title
			years = 10
		}
		set_character_flag = obj_landed_title
		cancel_ambition = yes
	}
	
	option = {
		name = EVTOPTB37007 #I WILL have what is mine!
		trigger = {
			has_character_flag = flag_later_title
			NOT = { trait = content }
			NOT = { trait = patient }
			NOT = { trait = craven }
			NOT = { age = 65 }
			liege = {
				independent = yes
			}
		}	
		ai_chance = {
			factor = 100
			modifier = {
				factor = 2.5
				trait = ambitious
			}
			modifier = {
				factor = 5.0
				religion_group = muslim
			}
			modifier = {
				factor = 0.25
				trait = slothful
			}
		}	
		opinion = {
			who = FROM
			modifier = opinion_broken_title_promise
			months = 120
		}
		clr_character_flag = flag_promised_title
		remove_character_modifier = promised_a_title
		set_character_flag = flag_denied_title
		
		character_event = { id = 37010 days = 45 }
	}

}

# Relative reminds liege of promised title
character_event = {
	id = 37005
	desc = EVTDESC37005
	picture = GFX_evt_son_asking_father

	is_triggered_only = yes

	trigger = {
		independent = no
		is_ruler = no
		prisoner = no
		NOT = { trait = incapable }
		has_ambition = obj_wants_landed_title
		has_character_flag = flag_promised_title
		liege = {
			war = no
			any_demesne_title = {
				can_be_given_away = yes
				tier = count
				is_feudal = yes
				location = { is_capital = no }
			}
		}
	}
	
	option = {
		name = EVTOPTA37005 # Ask liege for a title
		liege = { character_event = { id = 37006 tooltip = EVTTOOLTIP37006 } }
	}
}

# Liege responds to the reminder
character_event = {
	id = 37006
	desc = EVTDESC37006
	picture = GFX_evt_son_asking_father

	is_triggered_only = yes

	trigger = {
		FROM = {
			is_alive = yes
		}
	}

	option = {
		name = EVTOPTA37006 # Oh, very well!
		random_demesne_title = {
			limit = {
				can_be_given_away = yes
				tier = count
				is_feudal = yes
				location = { is_capital = no }
			}
			grant_title = FROM
		}
	}
	
	option = {
		name = EVTOPTB37006 # I've had it with his whining!
		FROM = { character_event = { id = 37007 days = 2 tooltip = EVTTOOLTIP37007 } }
		if = {
			limit = {
				ai = no
				independent = yes
				FROM = {
					NOT = { trait = content }
					NOT = { trait = patient }
					NOT = { trait = craven }
					NOT = { age = 65 }
				}
			}
			custom_tooltip = { text = evt_relative_might_revolt }
		}
	}
}

# Liege breaks the promise
character_event = {
	id = 37007
	desc = EVTDESC37007
	picture = GFX_evt_bad_news

	is_triggered_only = yes

	option = {
		name = EVTOPTA37007 # This is an outrage!
		ai_chance = {
			factor = 500
		}
		opinion = {
			who = FROM
			modifier = opinion_broken_title_promise
			years = 10
		}
		set_character_flag = obj_landed_title
		cancel_ambition = yes
		clr_character_flag = flag_promised_title
		remove_character_modifier = promised_a_title
		set_character_flag = flag_denied_title
	}
	option = {
		name = EVTOPTB37007 # I will not stand for this! REVOLT!
		
		trigger = {
			NOT = { trait = content }
			NOT = { trait = patient }
			NOT = { trait = craven }
			NOT = { age = 65 }
			liege = {
				independent = yes
			}
		}
		
		ai_chance = {
			factor = 100
			modifier = {
				factor = 2.5
				trait = ambitious
			}
			modifier = {
				factor = 5.0
				religion_group = muslim
			}
			modifier = {
				factor = 0.25
				trait = slothful
			}
		}
		
		opinion = {
			who = FROM
			modifier = opinion_broken_title_promise
			months = 120
		}
		set_character_flag = obj_landed_title
		cancel_ambition = yes
		clr_character_flag = flag_promised_title
		remove_character_modifier = promised_a_title
		set_character_flag = flag_denied_title
		
		character_event = { id = 37010 days = 45 }
	}
}

# Character goes into exile to raise an army
character_event = {
	id = 37010
	
	hide_window = yes
	
	is_triggered_only = yes
	
	trigger = {
		independent = no
		is_ruler = no
		prisoner = no
		NOT = { trait = incapable }
		FROMFROM = {
			is_alive = yes
			independent = yes
		}
		liege = {
			capital_scope = {
				any_independent_ruler = {
					religion_group = ROOT
					is_landed = yes
					NOT = { character = PREVPREV }
					capital_scope = {
						NOT = {
							distance = {
								where = PREVPREV
								distance = 400
							}
						}
					}
				}
			}
		}
	}
	
	immediate = {
		liege = {
			capital_scope = {
				random_independent_ruler = {
					limit = {
						religion_group = ROOT
						is_landed = yes
						NOT = { character = PREVPREV }
						capital_scope = {
							NOT = {
								distance = {
									where = PREVPREV
									distance = 400
								}
							}
						}
					}
					character_event = { id = 37011 } # Notify the new host
					ROOT = {
						move_character = PREV
					}
				}
			}
		}
	}
}

# The ruler who hosts the pretender is notified
character_event = {
	id = 37011
	desc = EVTDESC37011
	picture = GFX_evt_large_army
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA37011 # Interesting
		
		hidden_tooltip = {
			FROMFROMFROM = { character_event = { id = 37012 } } # Notify the old liege
		}
	}
}

# The old liege is notified
character_event = {
	id = 37012
	desc = EVTDESC37012
	picture = GFX_evt_large_army
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA37012 # The traitorous git!
		
		opinion = {
			who = FROMFROM
			modifier = opinion_traitor
		}
		
		hidden_tooltip = {
			opinion = {
				who = FROMFROM
				modifier = opinion_targeted_by_adventurer
				months = 12
			}
			FROMFROM = { character_event = { id = 37015 days = 365 } } # The event that actually fires the revolt
		}
	}
}

# The pretender launches the attack
character_event = {
	id = 37015
	
	hide_window = yes
	
	is_triggered_only = yes
	
	trigger = {
		independent = no
		is_ruler = no
		prisoner = no
		NOT = { trait = incapable }
		FROM = {
			is_alive = yes
			independent = yes
		}
		liege = {
			character = FROMFROM
		}
	}
	
	immediate = {
		liege = {
			capital_scope = {
				ROOT = {
					set_defacto_liege = ROOT
					create_title = {
						tier = DUKE
						landless = yes
						temporary = yes
						culture = ROOT
						name = "CLAIMANT_ADVENTURE"
						holder = ROOT
						ruler = "LORD"
						ruler_female = "LADY"
					}
				}
				FROM = {
					ROOT = {
						set_character_flag = claimant_adventurer
						random_list = {
							34 = {
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									leader = THIS
									match_character = PREV
									match_mult = 0.125
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									match_character = PREV
									match_mult = 0.125
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									match_character = PREV
									match_mult = 0.125
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									match_character = PREV
									match_mult = 0.125
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									match_character = PREV
									match_mult = 0.125
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									match_character = PREV
									match_mult = 0.125
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
							}
							33 = {
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									leader = THIS
									match_character = PREV
									match_mult = 0.1
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									match_character = PREV
									match_mult = 0.1
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									match_character = PREV
									match_mult = 0.1
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									match_character = PREV
									match_mult = 0.1
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									match_character = PREV
									match_mult = 0.1
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									match_character = PREV
									match_mult = 0.1
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
							}
							33 = {
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									leader = THIS
									match_character = PREV
									match_mult = 0.075
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									match_character = PREV
									match_mult = 0.075
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									match_character = PREV
									match_mult = 0.075
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									match_character = PREV
									match_mult = 0.075
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									match_character = PREV
									match_mult = 0.075
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
								spawn_unit = {
									province = PREVPREV
									home = PREVPREV
									owner = THIS
									match_character = PREV
									match_mult = 0.075
									match_min = 300
									match_max = 5000
									attrition = 0.25
									earmark = claimant_adventure
									disband_on_peace = yes
								}
							}
						}
					}
				}
			}
		}
		
		# Create some decent commander characters
		create_random_soldier = {
			random_traits = yes
			dynasty = none
			religion = ROOT
			culture = ROOT
			female = no
			age = 30
		}
		create_random_soldier = {
			random_traits = yes
			dynasty = none
			religion = ROOT
			culture = ROOT
			female = no
			age = 25
		}
		create_random_soldier = {
			random_traits = yes
			dynasty = none
			religion = ROOT
			culture = ROOT
			female = no
			age = 33
		}
		create_random_soldier = {
			random_traits = yes
			dynasty = none
			religion = ROOT
			culture = ROOT
			female = no
			age = 29
		}
		
		# Create a fleet, just to be sure
		spawn_fleet = {
			province = closest # closest sea zone
			owner = ROOT
			disband_on_peace = yes
			troops =
			{
				galleys = { 150 150 }
			}
			earmark = claimant_adventure
		}
		
		FROM = {
			# Prioritize going for secondary empires
			if = {
				limit = {
					num_of_emperor_titles = 2
				}
				random_demesne_title = {
					limit = {
						tier = EMPEROR
						is_primary_holder_title = no
					}
					add_claim = ROOT
					holder_scope = {
						reverse_war = {
							target = ROOT
							casus_belli = claim
							thirdparty_title = PREV
						}
					}
				}
			}
			
			# Next, secondary kingdoms
			if = {
				limit = {
					num_of_king_titles = 2
					NOT = { war_with = ROOT }
				}
				random_demesne_title = {
					limit = {
						tier = KING
						is_primary_holder_title = no
					}
					add_claim = ROOT
					holder_scope = {
						reverse_war = {
							target = ROOT
							casus_belli = claim
							thirdparty_title = PREV
						}
					}
				}
			}
		
			# Otherwise, just go for the primary title
			if = {
				limit = {
					NOT = { war_with = ROOT }
				}
				primary_title = {
					add_claim = ROOT
					holder_scope = {
						reverse_war = {
							target = ROOT
							casus_belli = claim
							thirdparty_title = PREV
						}
					}
				}
			}
		}
	}
}


# IDs to 37049 reserved for more events concerning this ambition

##############################################################
# Close relative asks to get married due to obj_get_married
##############################################################

# First event of the series

character_event = {
	id = 37049
	
	hide_window = yes
	
	ai = no
	capable_only = yes
	prisoner = no
	religion_group = christian
	war = no
	
	trigger = {
		any_courtier = {
			is_close_relative = ROOT
			religion = ROOT
			has_ambition = obj_get_married
			is_ruler = no
			is_adult = yes
			prisoner = no
			is_betrothed = no
			is_consort = no
			is_married = no
			liege = { character = ROOT }
			NOR = {
				age = 40
				trait = incapable
				trait = bastard
				has_minor_title = title_regent
				has_character_flag = flag_denied_marriage
				has_character_flag = flag_promised_marriage
			}
		}
	}
	
	mean_time_to_happen = {
		months = 24
	}

	immediate = {
		random_courtier = {
			limit = {
				religion = ROOT
				has_ambition = obj_get_married
				is_ruler = no
				is_adult = yes
				prisoner = no
				is_betrothed = no
				is_consort = no
				is_married = no
				liege = { character = ROOT }
				is_close_relative = ROOT
				NOR = {
					age = 40
					trait = incapable
					trait = bastard
					has_minor_title = title_regent
					has_character_flag = flag_denied_marriage
					has_character_flag = flag_promised_marriage
				}
			}
			character_event = { id = 37050 }
		}
	}
}

character_event = {
	id = 37050

	hide_window = yes

	is_triggered_only = yes
	
	immediate = {
		liege = { character_event = { id = 37051 days = 3 } }
	}
	
}

# Liege responds to marriage request
character_event = {
	id = 37051
	desc = EVTDESC37051
	picture = GFX_evt_marriage

	is_triggered_only = yes

	option = {
		name = EVTOPTA37051 # Promise that you'll arrange it
		FROM = { character_event = { id = 37052 tooltip = EVTTOOLTIP37052 } }
	}

	option = {
		name = EVTOPTB37051 # Mention a Church career...
		trigger = {
			religion_group = christian
			FROM = { religion_group = christian }
		}
		FROM = { character_event = { id = 37053 tooltip = EVTTOOLTIP37053 } }
	}
}

# The relative is delighted
character_event = {
	id = 37052
	desc = EVTDESC37052
	picture = GFX_evt_marriage

	is_triggered_only = yes

	option = {
		name = OK # Great news!
		set_character_flag = flag_promised_marriage
		add_character_modifier = { name = promised_a_marriage duration = -1 }
		opinion = {
			who = FROM
			modifier = opinion_promised_marriage
			years = 10
		}
	}
}

# The relative is disappointed
character_event = {
	id = 37053
	desc = EVTDESC37053
	picture = GFX_evt_bad_news

	is_triggered_only = yes

	option = {
		name = OK # Bleak news
		set_character_flag = flag_denied_marriage
		opinion = {
			who = FROM
			modifier = opinion_denied_marriage
			years = 10
		}
	}
}

# Relative reminds liege of promised marriage
character_event = {
	id = 37054
	desc = EVTDESC37054
	picture = GFX_evt_marriage

	min_age = 20
	capable_only = yes
	prisoner = no
	lacks_dlc = "Zeus"
	is_married = no

	trigger = {
		is_ruler = no
		is_betrothed = no
		NOT = {
			trait = bastard
		}
		has_ambition = obj_get_married
		liege = {
			is_close_relative = ROOT
			ROOT = {
				has_opinion_modifier = { who = PREV modifier = opinion_promised_marriage }
			}
		}
		had_character_flag = { flag = flag_promised_marriage days = 365 }
	}

	mean_time_to_happen = {
		months = 4

		modifier = {
			factor = 0.25
			is_female = yes
			trait = lustful
		}
		modifier = {
			factor = 0.5
			trait = ambitious
		}
		modifier = {
			factor = 2.0
			trait = slothful
		}
		modifier = {
			factor = 5.0
			trait = content
		}
	}

	option = {
		name = EVTOPTA37054 # Ask dad
		liege = { character_event = { id = 37055 days = 3 tooltip = EVTTOOLTIP37055 } }
	}
}

# The liege is reminded of the promise
character_event = {
	id = 37055
	desc = EVTDESC37055
	picture = GFX_evt_marriage

	is_triggered_only = yes

	option = {
		name = EVTOPTA37055 # Alright, alright!
		trigger = {
			FROM = {
				is_married = no
			}
			any_courtier = {
				OR = {
					is_female = no
					NOT = { age = 45 }
				}
				can_marry = FROM
			}
		}
		remove_character_modifier = promised_a_marriage
		clr_character_flag = flag_promised_marriage
		random_courtier = {
			limit = {
				OR = {
					is_female = no
					NOT = { age = 45 }
				}
				can_marry = FROM
				religion = FROM
			}
			add_spouse = FROM
		}
	}

	option = {
		name = EVTOPTB37055 # You're off to the monastery!
		trigger = {
			religion_group = christian
			FROM = { religion_group = christian }
			FROM = {
				is_married = no
			}
			any_realm_lord = {
				is_theocracy = yes
			}
		}
		random_realm_lord = {
			limit = {
				is_theocracy = yes
			}
			reverse_banish = FROM
		}
		FROM = {
			cancel_ambition = yes
			remove_character_modifier = promised_a_marriage
			clr_character_flag = flag_promised_marriage
			opinion = {
				who = ROOT
				modifier = opinion_sent_to_church
				years = 10
			}
		}
	}

	option = {
		name = EVTOPTC37055 # I haven't found anyone for you...
		trigger = {
			FROM = {
				is_married = no
			}
		}
		FROM = {
			set_character_flag = flag_denied_marriage
			clr_character_flag = flag_promised_marriage
			remove_character_modifier = promised_a_marriage
		}
	}
	option = {
		name = EVTOPTD37055
		trigger = {
			FROM = {
				is_married = yes
				spouse = {
					is_alive = yes
				}
			}
		}
	}
}

# Male relative who was denied decides to marry in secret
character_event = {
	id = 37056
	desc = EVTDESC37056
	picture = GFX_evt_marriage

	min_age = 20
	only_men = yes
	capable_only = yes
	prisoner = no
	has_character_flag = flag_denied_marriage
	lacks_dlc = "Zeus"

	trigger = {
		is_ruler = no
		is_betrothed = no
		has_ambition = obj_get_married
		any_courtier = {
			is_female = yes
			NOT = { age = 40 }
			can_marry = ROOT
		}
	}

	mean_time_to_happen = {
		months = 120

		modifier = {
			factor = 0.25
			trait = lustful
		}
		modifier = {
			factor = 0.5
			trait = ambitious
		}
		modifier = {
			factor = 2.0
			trait = slothful
		}
		modifier = {
			factor = 5.0
			trait = content
		}
	}

	option = {
		name = EVTOPTA37056 # I'm getting married right now
		random_courtier = {
			limit = {
				is_female = yes
				NOT = { age = 40 }
				can_marry = ROOT
				religion = ROOT
			}
			add_spouse = ROOT
		}
		liege = { character_event = { id = 37057 tooltip = EVTTOOLTIP37057 } }
	}
}

# The liege is informed of the secret marriage
character_event = {
	id = 37057
	desc = EVTDESC37057
	picture = GFX_evt_marriage

	is_triggered_only = yes

	option = {
		name = EVTOPTA37057 # Ah well
		tooltip_info = kind
		trigger = {
			trait = kind
		}
	}

	option = {
		name = EVTOPTB37057 # The insolence!
		trigger = {
			NOT = { trait = kind }
		}
		opinion = {
			who = FROM
			modifier = opinion_secret_marriage
			years = 10
		}
	}

	option = {
		name = EVTOPTC37057 # They will both pay for this!
		trigger = {
			OR = {
				trait = wroth
				trait = envious
			}
		}
		FROM = {
			opinion = {
				who = ROOT
				modifier = opinion_arrest_attempt
				months = 240
			}
			imprison = ROOT
		}
		FROM = {
			spouse = {
				opinion = {
					who = ROOT
					modifier = opinion_arrest_attempt
					months = 240
				}
				imprison = ROOT
			}
		}
	}
}

# IDs to 37149 reserved for more events concerning this ambition

#Common interest with spouse
character_event = {
	id = 37250
	hide_window = yes

	min_age = 16
	only_capable = yes
	is_married = yes

	trigger = {
		NOT = { trait = blinded }
		any_spouse = {
			has_prev_education_trigger = yes
			opinion = { who = ROOT value = 20 }
		}
		NOT = { has_character_flag = spouse_offered_help }
	}
	
	is_triggered_only = yes

	weight_multiplier = {
		days = 1
		modifier = {
			factor = 2
			has_focus = focus_family
		}
		modifier = {
			factor = 1.5
			has_pleasant_personality_trigger = yes
		}
		modifier = {
			factor = 0.75
			has_unpleasant_personality_trigger = yes
		}
		modifier = {
			factor = 0.5
			num_of_lovers = 1
		}
	}

	immediate = {
		set_character_flag = spouse_offered_help
		random_spouse = {
			limit = { 
				has_prev_education_trigger = yes
				opinion = { who = ROOT value = 20 }
			}

			character_event = { id = 37251 }
		}
	}
}

character_event = {
	id = 37251
	hide_window = yes
	
	is_triggered_only = yes

	immediate = {
		FROM = { character_event = { id = 37252 days = 1 } } #First event
	}	
}

#Want help?
character_event = {
	id = 37252
	desc = EVTDESC_37252
	picture = GFX_evt_courtiers_talking
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	#Yes
	option = {
		name = EVTOPTA_37252
		custom_tooltip = { text = EVTOPTA_37252_TOOLTIP }
		hidden_tooltip = { FROM = { character_event = { id = 37254 } } }
	}

	#No
	option = {
		name = EVTOPTB_37252
		custom_tooltip = { text = EVTOPTB_37252_TOOLTIP }

		random = {
			chance = 30
			add_trait_proud_effect = yes
		}

		reverse_opinion = {
			who = FROM
			modifier = opinion_ungrateful
			years = 5
		}
	}
}


character_event = {
    id = 37254
    hide_window = yes
    is_triggered_only = yes
    immediate = { FROM = { character_event = { id = 37253 days = 7 } } }
}

character_event = {
	id = 37253
	desc = EVTDESC_37253
	picture = GFX_evt_courtiers_talking
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes


	#Bonding over common interests and getting work done
	option = {
		name = EVTOPTA_37253
		custom_tooltip = { text = EVTOPTA_37253_TOOLTIP }

		opinion = {
			who = FROM
			modifier = common_interests_opinion
			years = 10
		}

		reverse_opinion = {
			who = FROM
			modifier = common_interests_opinion
			years = 10
		}

		if = {
			limit = { has_education_martial_trigger = yes }
			military_techpoints = 50
		}
		if = {
			limit = { has_education_stewardship_trigger = yes }
			economy_techpoints = 50
		}
		if = {
			limit = { 
				OR = {
					has_education_diplomacy_trigger = yes 
					has_education_learning_trigger = yes
				}
			}
			culture_techpoints = 50
		}
		if = {
			limit = { has_education_intrigue_trigger = yes }
			military_techpoints = 15
			culture_techpoints = 15
			economy_techpoints = 15
		}
	}

	#Let's go to bed
	option = {
		trigger = { NOT = { is_lover = FROM } }
		name = EVTOPTB_37253
		custom_tooltip = { text = EVTOPTB_37253_TOOLTIP }

		add_lover = FROM
	}
}
#Get married ambition success is a ruler
character_event = {
	id = 37255
	hide_window = yes
	is_triggered_only = yes
	only_rulers = yes

	trigger = {
		FROM = { has_ambition = obj_get_married }
	}

	immediate = {
		FROM = {
			opinion = {
				who = FROM
				modifier = opinion_fulfilled_marriage_wish
				years = 5
			}
		}
	}
}