
namespace = Plus

#reserved: Plus.970 to Plus.999

#######################################
# CONVENIENCE EVENTS
# Written by Rylock
#######################################

### NO HASSLES VASSALS

narrative_event = { # Begin
	id = Plus.970
	title = EVTNAME_Plus_970
	desc = EVTDESC_Plus_970
	picture = GFX_evt_council
	border = GFX_event_narrative_frame_diplomacy
	
	is_triggered_only = yes
	hide_from = yes
	
	option = {
		name = EVTOPTA_Plus_970
	}
}

character_event = { # Vassalize All Titles
	id = Plus.974
	desc = EVTDESC_Plus_974
	picture = "GFX_evt_council"
	
	is_triggered_only = yes
	hide_from = yes
	
	option = {
		name = EVTOPTA_Plus_974
		hidden_tooltip = {
			if = {
				limit = {
					NOT = {
						any_demesne_title = {
							tier = baron
							is_capital = no
							is_patrician = no
							location = { NOT = { has_province_flag = keep_baronies } }
						}
					}
					any_demesne_title = {
						tier = baron
						is_capital = yes
						is_patrician = no
						location = { NOT = { has_province_flag = keep_it } }
					}
				}
				character_event = { id = Plus.990 }
			}
			if = {
				limit = {
					any_demesne_title = {
						tier = baron
						is_capital = no
						is_patrician = no
						location = { NOT = { has_province_flag = keep_baronies } }
					}
				}
				character_event = { id = Plus.989 }
			}
		}
	}
}

character_event = { # Vassalize Baronies
	id = Plus.975
	desc = EVTDESC_Plus_975
	picture = "GFX_evt_council"

	is_triggered_only = yes
	hide_from = yes

	option = {
		name = EVTOPTA_Plus_975
		hidden_tooltip = {
			set_character_flag = baronies_only
			if = {
				limit = {
					any_demesne_title = {
						tier = baron
						is_capital = no
						is_patrician = no
						location = { NOT = { has_province_flag = keep_baronies } }
					}
				}
				character_event = { id = Plus.989 }
			}
		}
	}
}


### RANSOM ALL

character_event = { #Prisoner receives ransom demand
	id = Plus.985
	desc = EVTDESC_Plus_985
	picture = GFX_evt_into_the_dungeon
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_Plus_985 # Will pay
		
		ai_chance = { factor = 100 }
				
		#require money for ransom
		if = {
            limit = {
				tier = emperor
				wealth = 385
			} 

			wealth = -385
			host = {
				wealth = 385
			}
			prisoner = no
        }
                
		if = {
            limit = {
				tier = king
				wealth = 250
			} 
		
			wealth = -250
			host = {
				wealth = 250
			}
			prisoner = no
        }
		
        if = {
            limit = {
				tier = duke
				mercenary = no
				wealth = 145
			} 
			
			wealth = -145
			host = {
				wealth = 145
			}
			prisoner = no
        }
		
		if = {
            limit = {
				tier = duke
				mercenary = yes
			} 
			
			wealth = -145
			host = {
				wealth = 145
			}
			prisoner = no
        }
				
        if = {
            limit = {
				tier = count
				wealth = 70
			} 
		
			wealth = -70
			host = {
				wealth = 70
			}
			prisoner = no
        }
				
        if = {
            limit = {
				tier = baron
				wealth = 25
			} 
		
			wealth = -25
			host = {
				wealth = 25
			}
			prisoner = no
        }
				
        if = {
            limit = {
				is_ruler = no
				wealth = 10
			} 

			wealth = -10
			host = {
				wealth = 10
			}
			prisoner = no
        }
        if = {
            limit = {
				is_ruler = no
				NOT = { wealth = 10 }
				NOT = { liege = { character = FROM } }
			} 
			liege = { character_event = { id = Plus.986 } }
        }
		
	}
	
	option = {
		name = EVTOPTB_Plus_985 # will not pay
		ai_chance = {
			factor = 0
		}
	}
}

character_event = { #Liege of landless prisoner receives ransom demand
	id = Plus.986
	desc = EVTDESC_Plus_986
	picture = GFX_evt_into_the_dungeon
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_Plus_986 # Will pay
		ai_chance = { 
			factor = 1
			modifier = {
				factor = 2 
				trait = charitable
			}
			modifier = {
				factor = 2 
				trait = kind
			}
			modifier = {
				factor = 2 
				trait = just
			}
			modifier = {
				factor = 1.25 
				wealth = 200
			}
			modifier = {
				factor = 1.5 
				wealth = 250
			}
			modifier = {
				factor = 2 
				wealth = 300
			}
			modifier = {
				factor = 50 
				wealth = 400
			}
			modifier = {
				factor = 100 
				wealth = 500
			}
			modifier = {
				factor = 100 
				FROM = { is_close_relative = ROOT } 
			}	
		}
		ROOT = { wealth = -10 }
		FROMFROM = { wealth = 10 }
		FROM = { prisoner = no }
	}
	option = {
		name = EVTOPTB_Plus_986 #will not

		ai_chance = {
			factor = 0.5
			modifier = {
				factor = 2 
				trait = greedy
			}
			modifier = {
				factor = 2 
				trait = wroth
			}
			modifier = {
				factor = 1.5 
				trait = cruel
			}
			modifier = {
				factor = 2.5 
				NOT = { wealth = 75 } 
			}
			modifier = {
				factor = 5 
				NOT = { wealth = 50 } 
			}
			modifier = {
				factor = 10 
				NOT = { wealth = 25} 
			}
		}
		FROMFROM = { character_event = { id = Plus.987 } }
	}
}

character_event = { #Jailer is informed of denied ransom
	id = Plus.987
	desc = EVTDESC_Plus_987
	picture = GFX_evt_into_the_dungeon
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_Plus_987 # denied
	}
}

# Assign rulers to baronies
character_event = {
	id = Plus.989
	
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		random_demesne_title = {
			limit = {
				tier = baron
				is_capital = no
				is_patrician = no
				location = { NOT = { has_province_flag = keep_baronies } }
			}
			if = {
				limit = {
					ROOT = {
						primary_title = { has_law = true_cognatic_succession }
					}
					NOT = { holding_type = temple }
				}
				random_list = {
					75 = {
						create_character = {
							random_traits = yes
							dynasty = random
							female = no
							religion = ROOT
							culture = ROOT
						}
					}
					25 = {
						create_character = {
							random_traits = yes
							dynasty = random
							female = yes
							religion = ROOT
							culture = ROOT
						}
					}
				}
			}
			if = {
				limit = {
					ROOT = {
						primary_title = {
							OR = {
								has_law = enatic_succession
								has_law = enatic_cognatic_succession
							}
						}
					}
					NOT = { holding_type = temple }
				}
				random_list = {
					30 = {
						create_random_diplomat = {
							random_traits = yes
							dynasty = random
							female = yes
							religion = ROOT
							culture = ROOT
						}
					}
					30 = {
						create_random_intriguer = {
							random_traits = yes
							dynasty = random
							female = yes
							religion = ROOT
							culture = ROOT
						}
					}
					30 = {
						create_random_steward = {
							random_traits = yes
							dynasty = random
							female = yes
							religion = ROOT
							culture = ROOT
						}
					}
					10 = {
						create_random_soldier = {
							random_traits = yes
							dynasty = random
							female = yes
							religion = ROOT
							culture = ROOT
						}
					}
				}
			}
			if = {
				limit = {
					ROOT = {
						primary_title = {
							OR = {
								has_law = agnatic_succession
								has_law = cognatic_succession
							}
						}
					}
					NOT = { holding_type = temple }
				}
				random_list = {
					50 = {
						create_random_soldier = {
							random_traits = yes
							dynasty = random
							female = no
							religion = ROOT
							culture = ROOT
						}
					}
					50 = {
						create_character = {
							random_traits = yes
							dynasty = random
							female = no
							religion = ROOT
							culture = ROOT
						}
					}
				}
			}
			if = {
				limit = {
					holding_type = temple
					ROOT = {
						religion_allows_female_temple_holders = no
					}
				}
				create_character = {
					random_traits = yes
					dynasty = random
					female = no
					religion = ROOT
					culture = ROOT
				}
			}
			if = {
				limit = {
					holding_type = temple
					ROOT = {
						religion_allows_female_temple_holders = yes
					}
				}
				random_list = {
					40 = {
						create_random_priest = {
							random_traits = yes
							dynasty = random
							female = no
							religion = ROOT
							culture = ROOT
						}
					}
					40 = {
						create_random_priest = {
							random_traits = yes
							dynasty = random
							female = yes
							religion = ROOT
							culture = ROOT
						}
					}
					20 = {
						create_character = {
							random_traits = yes
							dynasty = random
							female = no
							religion = ROOT
							culture = ROOT
						}
					}
				}
			}
			new_character = {
				set_defacto_liege = ROOT
				grant_title = PREV
			}
		}
		if = {
			limit = {
				NOT = { has_character_flag = baronies_only }
				NOT = {
					any_demesne_title = {
						tier = baron
						is_capital = no
						is_patrician = no
						location = { NOT = { has_province_flag = keep_baronies } }
					}
				}
				any_demesne_title = {
					tier = baron
					is_capital = yes
					is_patrician = no
					location = { NOT = { has_province_flag = keep_it } }
				}
			}
			character_event = { id = Plus.990 }
		}
		if = {
			limit = {
				has_character_flag = baronies_only
				NOT = {
					any_demesne_title = {
						tier = baron
						is_capital = no
						is_patrician = no
						location = { NOT = { has_province_flag = keep_baronies } }
					}
				}
			}
			clr_character_flag = baronies_only
		}
		if = {
			limit = {
				any_demesne_title = {
					tier = baron
					is_capital = no
					is_patrician = no
					location = { NOT = { has_province_flag = keep_baronies } }
				}
			}
			character_event = { id = Plus.989 }
		}
	}
}

# Assign rulers to counties
character_event = {
	id = Plus.990
	
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		random_demesne_title = {
			limit = {
				tier = baron
				is_capital = yes
				is_patrician = no
				location = { NOT = { has_province_flag = keep_it } }
			}
			if = {
				limit = {
					ROOT = {
						primary_title = { has_law = true_cognatic_succession }
					}
					NOT = { holding_type = temple }
				}
				random_list = {
					75 = {
						create_character = {
							random_traits = yes
							dynasty = random
							female = no
							religion = ROOT
							culture = ROOT
						}
					}
					25 = {
						create_character = {
							random_traits = yes
							dynasty = random
							female = yes
							religion = ROOT
							culture = ROOT
						}
					}
				}
			}
			if = {
				limit = {
					ROOT = {
						primary_title = {
							OR = {
								has_law = enatic_succession
								has_law = enatic_cognatic_succession
							}
						}
					}
					NOT = { holding_type = temple }
				}
				random_list = {
					30 = {
						create_random_diplomat = {
							random_traits = yes
							dynasty = random
							female = yes
							religion = ROOT
							culture = ROOT
						}
					}
					30 = {
						create_random_intriguer = {
							random_traits = yes
							dynasty = random
							female = yes
							religion = ROOT
							culture = ROOT
						}
					}
					30 = {
						create_random_steward = {
							random_traits = yes
							dynasty = random
							female = yes
							religion = ROOT
							culture = ROOT
						}
					}
					10 = {
						create_random_soldier = {
							random_traits = yes
							dynasty = random
							female = yes
							religion = ROOT
							culture = ROOT
						}
					}
				}
			}
			if = {
				limit = {
					ROOT = {
						primary_title = {
							OR = {
								has_law = agnatic_succession
								has_law = cognatic_succession
							}
						}
					}
					NOT = { holding_type = temple }
				}
				random_list = {
					50 = {
						create_random_soldier = {
							random_traits = yes
							dynasty = random
							female = no
							religion = ROOT
							culture = ROOT
						}
					}
					50 = {
						create_character = {
							random_traits = yes
							dynasty = random
							female = no
							religion = ROOT
							culture = ROOT
						}
					}
				}
			}
			if = {
				limit = {
					holding_type = temple
					ROOT = {
						religion_allows_female_temple_holders = no
					}
				}
				create_random_priest = {
					random_traits = yes
					dynasty = random
					female = no
					religion = ROOT
					culture = ROOT
				}
			}
			if = {
				limit = {
					holding_type = temple
					ROOT = {
						religion_allows_female_temple_holders = yes
					}
				}
				random_list = {
					40 = {
						create_random_priest = {
							random_traits = yes
							dynasty = random
							female = no
							religion = ROOT
							culture = ROOT
						}
					}
					40 = {
						create_random_priest = {
							random_traits = yes
							dynasty = random
							female = yes
							religion = ROOT
							culture = ROOT
						}
					}
					20 = {
						create_character = {
							random_traits = yes
							dynasty = random
							female = no
							religion = ROOT
							culture = ROOT
						}
					}
				}
			}
			new_character = {
				set_defacto_liege = ROOT
				grant_title = PREV
			}
		}
		if = {
			limit = {
				any_demesne_title = {
					tier = baron
					is_capital = yes
					is_patrician = no
					location = { NOT = { has_province_flag = keep_it } }
				}
			}
			character_event = { id = Plus.990 }
		}
	}
}

### CUSTOMIZE RULER DESIGNED CHARACTERS

# Verify relation to target
character_event = {
	id = Plus.991
	desc = EVTDESC_Plus_991
	picture = GFX_evt_book_carolingian_script
	
	is_triggered_only = yes
	
	option = { #Parent
		name = EVTOPTA_Plus_991
		trigger = {
			FROM = {
				is_older_than = ROOT
				age_diff = { who = ROOT years = 16 }
				OR = {
					is_female = no
					is_married_matrilineally = yes
				}
				OR = {
					is_female = yes
					is_married_matrilineally = no
					is_married = no
				}
			}
		}
		if = {
			limit = { NOT = { trait = bastard } }
			tooltip = { dynasty = FROM }
		}
		FROM = {
			save_event_target_as = new_parent
			if = {
				limit = { is_female = no }
				custom_tooltip = { text = WILL_BECOME_FATHER }
			}
			if = {
				limit = { is_female = yes }
				custom_tooltip = { text = WILL_BECOME_MOTHER }
			}
			if = {
				limit = {
					ROOT = {
						NOT = { trait = bastard }
						NOT = { trait = legit_bastard }
					}
					spouse_even_if_dead = {
						OR = {
							is_alive = no
							age_diff = { who = ROOT years = 16 }
						}
					}
				}
				spouse_even_if_dead = {
					if = {
						limit = { is_female = no }
						custom_tooltip = { text = WILL_BECOME_FATHER }
					}
					if = {
						limit = { is_female = yes }
						custom_tooltip = { text = WILL_BECOME_MOTHER }
					}
				}
			}
		}
		hidden_tooltip = {
			character_event = { id = Plus.992 }
		}
	}
	option = { #Sibling
		name = {
			text = EVTOPTB_Plus_991_brother
			trigger = { FROM = { is_female = no } }
		}
		name = {
			text = EVTOPTB_Plus_991_sister
			trigger = { FROM = { is_female = yes } }
		}
		trigger = {
			NOT = { age_diff = { who = FROM years = 16 } }
			FROM = {
				NOT = { age_diff = { who = ROOT years = 16 } }
				OR = {
					father_even_if_dead = {
						dynasty = PREV
						OR = {
							is_alive = no
							age_diff = { who = ROOT years = 16 }
						}	
					}
					mother_even_if_dead = {
						dynasty = PREV
						OR = {
							is_alive = no
							age_diff = { who = ROOT years = 16 }
						}	
					}
				}
			}
		}
		if = {
			limit = { NOT = { trait = bastard } }
			tooltip = { dynasty = FROM }
		}
		if = {
			limit = {
				FROM = {
					father_even_if_dead = {
						dynasty = PREV
						OR = {
							is_alive = no
							age_diff = { who = ROOT years = 16 }
						}	
					}
				}
			}
			FROM = {
				father_even_if_dead = {
					save_event_target_as = new_parent
					if = {
						limit = { is_female = no }
						custom_tooltip = { text = WILL_BECOME_FATHER }
					}
					if = {
						limit = { is_female = yes }
						custom_tooltip = { text = WILL_BECOME_MOTHER }
					}
					if = {
						limit = {
							ROOT = {
								NOT = { trait = bastard }
								NOT = { trait = legit_bastard }
							}
							spouse_even_if_dead = {
								OR = {
									is_alive = no
									age_diff = { who = ROOT years = 16 }
								}
							}
						}
						spouse_even_if_dead = {
							if = {
								limit = { is_female = no }
								custom_tooltip = { text = WILL_BECOME_FATHER }
							}
							if = {
								limit = { is_female = yes }
								custom_tooltip = { text = WILL_BECOME_MOTHER }
							}
						}
					}
				}
			}
			hidden_tooltip = { ROOT = { character_event = { id = Plus.992 } } }
			break = yes
		}
		if = {
			limit = {
				FROM = {
					mother_even_if_dead = {
						dynasty = PREV
						OR = {
							is_alive = no
							age_diff = { who = ROOT years = 16 }
						}	
					}
				}
			}
			FROM = {
				mother_even_if_dead = {
					save_event_target_as = new_parent
					if = {
						limit = { is_female = no }
						custom_tooltip = { text = WILL_BECOME_FATHER }
					}
					if = {
						limit = { is_female = yes }
						custom_tooltip = { text = WILL_BECOME_MOTHER }
					}
					if = {
						limit = {
							ROOT = {
								NOT = { trait = bastard }
								NOT = { trait = legit_bastard }
							}
							spouse_even_if_dead = {
								OR = {
									is_alive = no
									age_diff = { who = ROOT years = 16 }
								}
							}
						}
						spouse_even_if_dead = {
							if = {
								limit = { is_female = no }
								custom_tooltip = { text = WILL_BECOME_FATHER }
							}
							if = {
								limit = { is_female = yes }
								custom_tooltip = { text = WILL_BECOME_MOTHER }
							}
						}
					}
				}
			}
			hidden_tooltip = { ROOT = { character_event = { id = Plus.992 } } }
		}		
	}
	option = { #Nephew/Niece
		name = {
			text = EVTOPTC_Plus_991_nephew
			trigger = { FROM = { is_female = no } }
		}
		name = {
			text = EVTOPTC_Plus_991_niece
			trigger = { FROM = { is_female = yes } }
		}
		trigger = {
			is_older_than = FROM
			age_diff = { who = FROM years = 16 }
			FROM = {
				OR = {
					father_even_if_dead = {
						dynasty = PREV
						OR = {
							father_even_if_dead = {
								dynasty = PREV
								OR = {
									is_alive = no
									age_diff = { who = ROOT years = 16 }
								}
							}
							mother_even_if_dead = {
								dynasty = PREV
								OR = {
									is_alive = no
									age_diff = { who = ROOT years = 16 }
								}
							}
						}
					}
					mother_even_if_dead = {
						dynasty = PREV
						OR = {
							father_even_if_dead = {
								dynasty = PREV
								OR = {
									is_alive = no
									age_diff = { who = ROOT years = 16 }
								}
							}
							mother_even_if_dead = {
								dynasty = PREV
								OR = {
									is_alive = no
									age_diff = { who = ROOT years = 16 }
								}
							}
						}
					}
				}
			}
		}
		if = {
			limit = { NOT = { trait = bastard } }
			tooltip = { dynasty = FROM }
		}
		if = {
			limit = {
				FROM = {
					father_even_if_dead = {
						dynasty = PREV
						father_even_if_dead = {
							dynasty = PREV
							OR = {
								is_alive = no
								age_diff = { who = ROOT years = 16 }
							}
						}
					}
				}
			}
			FROM = {
				father_even_if_dead = {
					father_even_if_dead = {
						save_event_target_as = new_parent
						if = {
							limit = { is_female = no }
							custom_tooltip = { text = WILL_BECOME_FATHER }
						}
						if = {
							limit = { is_female = yes }
							custom_tooltip = { text = WILL_BECOME_MOTHER }
						}
						if = {
							limit = {
								ROOT = {
									NOT = { trait = bastard }
									NOT = { trait = legit_bastard }
								}
								spouse_even_if_dead = {
									OR = {
										is_alive = no
										age_diff = { who = ROOT years = 16 }
									}
								}
							}
							spouse_even_if_dead = {
								if = {
									limit = { is_female = no }
									custom_tooltip = { text = WILL_BECOME_FATHER }
								}
								if = {
									limit = { is_female = yes }
									custom_tooltip = { text = WILL_BECOME_MOTHER }
								}
							}
						}
					}
				}
			}
			hidden_tooltip = { ROOT = { character_event = { id = Plus.992 } } }
			break = yes
		}
		if = {
			limit = {
				FROM = {
					father_even_if_dead = {
						dynasty = PREV
						mother_even_if_dead = {
							dynasty = PREV
							OR = {
								is_alive = no
								age_diff = { who = ROOT years = 16 }
							}
						}
					}
				}
			}
			FROM = {
				father_even_if_dead = {
					mother_even_if_dead = {
						save_event_target_as = new_parent
						if = {
							limit = { is_female = no }
							custom_tooltip = { text = WILL_BECOME_FATHER }
						}
						if = {
							limit = { is_female = yes }
							custom_tooltip = { text = WILL_BECOME_MOTHER }
						}
						if = {
							limit = {
								ROOT = {
									NOT = { trait = bastard }
									NOT = { trait = legit_bastard }
								}
								spouse_even_if_dead = {
									OR = {
										is_alive = no
										age_diff = { who = ROOT years = 16 }
									}
								}
							}
							spouse_even_if_dead = {
								if = {
									limit = { is_female = no }
									custom_tooltip = { text = WILL_BECOME_FATHER }
								}
								if = {
									limit = { is_female = yes }
									custom_tooltip = { text = WILL_BECOME_MOTHER }
								}
							}
						}
					}
				}
			}
			hidden_tooltip = { ROOT = { character_event = { id = Plus.992 } } }
			break = yes
		}
		if = {
			limit = {
				FROM = {
					mother_even_if_dead = {
						dynasty = PREV
						father_even_if_dead = {
							dynasty = PREV
							OR = {
								is_alive = no
								age_diff = { who = ROOT years = 16 }
							}
						}
					}
				}
			}
			FROM = {
				mother_even_if_dead = {
					father_even_if_dead = {
						save_event_target_as = new_parent
						if = {
							limit = { is_female = no }
							custom_tooltip = { text = WILL_BECOME_FATHER }
						}
						if = {
							limit = { is_female = yes }
							custom_tooltip = { text = WILL_BECOME_MOTHER }
						}
						if = {
							limit = {
								ROOT = {
									NOT = { trait = bastard }
									NOT = { trait = legit_bastard }
								}
								spouse_even_if_dead = {
									OR = {
										is_alive = no
										age_diff = { who = ROOT years = 16 }
									}
								}
							}
							spouse_even_if_dead = {
								if = {
									limit = { is_female = no }
									custom_tooltip = { text = WILL_BECOME_FATHER }
								}
								if = {
									limit = { is_female = yes }
									custom_tooltip = { text = WILL_BECOME_MOTHER }
								}
							}
						}
					}
				}
			}
			hidden_tooltip = { ROOT = { character_event = { id = Plus.992 } } }
			break = yes
		}
		if = {
			limit = {
				FROM = {
					mother_even_if_dead = {
						dynasty = PREV
						mother_even_if_dead = {
							dynasty = PREV
							OR = {
								is_alive = no
								age_diff = { who = ROOT years = 16 }
							}
						}
					}
				}
			}
			FROM = {
				mother_even_if_dead = {
					mother_even_if_dead = {
						save_event_target_as = new_parent
						if = {
							limit = { is_female = no }
							custom_tooltip = { text = WILL_BECOME_FATHER }
						}
						if = {
							limit = { is_female = yes }
							custom_tooltip = { text = WILL_BECOME_MOTHER }
						}
						if = {
							limit = {
								ROOT = {
									NOT = { trait = bastard }
									NOT = { trait = legit_bastard }
								}
								spouse_even_if_dead = {
									OR = {
										is_alive = no
										age_diff = { who = ROOT years = 16 }
									}
								}
							}
							spouse_even_if_dead = {
								if = {
									limit = { is_female = no }
									custom_tooltip = { text = WILL_BECOME_FATHER }
								}
								if = {
									limit = { is_female = yes }
									custom_tooltip = { text = WILL_BECOME_MOTHER }
								}
							}
						}
					}
				}
			}
			hidden_tooltip = { ROOT = { character_event = { id = Plus.992 } } }
		}
	}
	option = { #Distant Relation
		name = EVTOPTE_Plus_991
		trigger = { NOT = { trait = bastard } }
		clr_character_flag = customizing_ruler
		hidden_tooltip = { remove_trait = customize_ruler }
		dynasty = FROM
		any_child = { dynasty = FROM }
	}
	option = { #Never Mind
		name = EVTOPTF_Plus_991
		clr_character_flag = customizing_ruler
	}
}

# Set the appropriate character as the father
character_event = {
	id = Plus.992
	
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		clr_character_flag = customizing_ruler
		remove_trait = customize_ruler
		event_target:new_parent = {
			if = {
				limit = { ROOT = { NOT = { trait = bastard } } }
				ROOT = {
					dynasty = PREV
					any_child = { dynasty = PREVPREV }
				}
			}
			if = {
				limit = { is_female = no }
				ROOT = { set_father = PREV }
			}
			if = {
				limit = { is_female = yes }
				ROOT = { set_mother = PREV }
			}
			if = {
				limit = {
					ROOT = {
						NOT = { trait = bastard }
						NOT = { trait = legit_bastard }
					}
					spouse_even_if_dead = {
						OR = {
							is_alive = no
							age_diff = { who = ROOT years = 16 }
						}
					}
				}
				spouse_even_if_dead = {
					if = {
						limit = { is_female = no }
						ROOT = { set_father = PREV }
					}
					if = {
						limit = { is_female = yes }
						ROOT = { set_mother = PREV }
					}
					recalc_succession = yes
				}
			}
			recalc_succession = yes
		}
		recalc_succession = yes
		
		#add new relative opinions
		character_event = { id = Plus.993 }
		any_child = { character_event = { id = Plus.993 } }
	}
}

# Add new relations for the player
character_event = {
	id = Plus.993
	
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		#add opinion for cousins
		if = {
			limit = {
				OR = {
					father_even_if_dead = { always = yes }
					mother_even_if_dead = { always = yes }
				}
				OR = {
					NOT = { has_character_flag = start_of_game_character }
					ai = no
					AND = {
						is_playable = yes
						num_of_dynasty_members = 3
					}
				}
			}
			any_character = {
				limit = {
					NOR = {
						character = ROOT
						has_opinion_modifier = { who = ROOT modifier = opinion_cousin }
						father_even_if_dead = { is_father = ROOT }
						mother_even_if_dead = { is_mother = ROOT }
					}
					OR = {
						father_even_if_dead = {
							any_sibling_even_if_dead = {
								OR = {
									is_father = ROOT
									is_mother = ROOT
								}
							}
						}
						mother_even_if_dead = {
							any_sibling_even_if_dead = {
								OR = {
									is_father = ROOT
									is_mother = ROOT
								}
							}
						}
					}
				}
				reverse_opinion = { who = ROOT modifier = opinion_cousin years = 100 }
				opinion = { who = ROOT modifier = opinion_cousin years = 100 }
			}
		}
	}
}

# Remove RD traits - bounce event
character_event = {
	id = Plus.994
	
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		any_playable_ruler = {
			character_event = { id = Plus.995 }
		}
	}
}
# Remove RD traits
character_event = {
	id = Plus.995
	
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		OR = {
			AND = {
				trait = customize_ruler
				NOT = { has_character_flag = customizing_ruler }
			}
			trait = minority_culture
		}
	}

	immediate = {
		if = {
			limit = { trait = customize_ruler }
			remove_trait = customize_ruler
		}
		if = {
			limit = { trait = minority_culture }
			remove_trait = minority_culture
			if = {
				limit = {
					top_liege = {
						any_realm_province = {
							culture = ROOT
						}
					}
				}
				break = yes
			}
			capital_scope = {
				culture = ROOT
				any_neighbor_province = {
					if = {
						limit = {
							owner = { character = ROOT }
						}
						random = {
							chance = 50
							culture = ROOT
						}
					}
				}
			}
		}
	}
}

