﻿#Events for spy Scheme

namespace = find_spouse_ongoing

#######################
# The search starts
#######################

find_spouse_ongoing.1001 = {
	type = character_event
	title = find_spouse_ongoing.1001.t
	desc = find_spouse_ongoing.1001.desc
	theme = marriage
	override_background = { reference = sitting_room }
	left_portrait = {
		character = root
		animation = worry
	}
	right_portrait = {
		character = scope:friend
		animation = personality_rational
	}
	lower_right_portrait = scope:learned
	lower_left_portrait = scope:chancellor
	lower_center_portrait = scope:spymaster

	trigger = {
		is_married = no
		is_betrothed = no
		is_ai = no
	}
	

	immediate = {
		if = {
			limit = {exists = cp:councillor_chancellor
			cp:councillor_chancellor = {
			is_available = yes
			NOR = {has_relation_lover = root
											is_heir_of = root}}}
			cp:councillor_chancellor = {save_scope_as = chancellor}
		}
		if = {
			limit = {exists = cp:councillor_spymaster
			cp:councillor_spymaster = {
			is_available = yes
			NOR = {has_relation_lover = root
											is_heir_of = root}}}
			cp:councillor_spymaster = {save_scope_as = spymaster}
		}
		if = {
			limit = {employs_court_position = court_physician_court_position}
				random_court_position_holder = {
					type = court_physician_court_position
					limit = {is_available = yes
					NOR = {has_relation_lover = root
							is_heir_of = root}}
					save_scope_as = learned
				}
		}
		else_if = {
			limit = {exists = cp:councillor_court_chaplain
			cp:councillor_court_chaplain = {
			is_available = yes
			NOR = {has_relation_lover = root
											is_heir_of = root}}}
			cp:councillor_court_chaplain = {save_scope_as = learned}
		}
		if = {
			limit = {any_relation = {
						type = friend
						is_available = yes}}
			random_relation = {
				type = friend 
				limit = {
				is_available = yes
				NOR = {						
				this = scope:chancellor
				this = scope:spymaster
				this = scope:learned
				has_relation_lover = root
				is_heir_of = root}}
			weight = {
				base = 1
				modifier = {
				add = 50
				has_relation_best_friend = root
				}
				modifier = {
				add = 25
				highest_held_title_tier >= root.highest_held_title_tier
				}
			}
			save_scope_as = friend
			}
		}
	
	}

	option = { #my chancellor
		name = find_spouse_ongoing.1001.a
		trigger = {exists = scope:chancellor}
		scope:chancellor = {save_scope_as = herald}
		trigger_event = {
			id = find_spouse_ongoing.1002
			days = 14
		}
		
	}
	option = { #my spymaster
		name = find_spouse_ongoing.1001.b
		trigger = {exists = scope:spymaster}
		scope:spymaster = {save_scope_as = herald}
		trigger_event = {
			id = find_spouse_ongoing.1003
			days = 14
		}
		
	}
	option = { #learned
		name = find_spouse_ongoing.1001.c
		trigger = {exists = scope:learned}
		scope:learned = {save_scope_as = herald}
		trigger_event = {
			id = find_spouse_ongoing.1004
			days = 14
		}
		
	}
	
	option = { #a friend
		name = find_spouse_ongoing.1001.d
		trigger = {exists = scope:friend}
		trigger_event = {
			id = find_spouse_ongoing.1005
			days = 14
		}
	}
	
	option = { #changed my mind
		name = find_spouse_ongoing.1001.e
		remove_decision_cooldown = find_spouse_decision
		
	}

}

find_spouse_ongoing.1002 = {
	type = character_event
	hidden = yes 
	
	trigger = {
	is_ai = no
	exists = scope:herald
	}
	
	immediate = {
		if = {
				limit = {
					allowed_to_marry_same_sex_trigger = no
				}
			every_opposite_sex_spouse_candidate = {
					limit = {
						NOR = {
							is_imprisoned = yes
							has_character_flag = partially_spied_2
							has_character_flag = partially_spied_3
							faith.religious_head = this
						}
						is_capable_adult = yes
						in_diplomatic_range = root
						NOT = {is_close_or_extended_family_of = root}
						root = {is_character_interaction_potentially_accepted = {
								recipient = prev
								secondary_actor = root
								secondary_recipient = prev
								interaction = arrange_marriage_interaction
							}}	
						faith = root.faith
						exists = dynasty
						NOT = {has_trait = bastard}
						OR = {
							top_liege = root.top_liege
							top_liege = {character_is_realm_neighbor = root.top_liege}
							highest_held_title_tier >= tier_kingdom}
						OR = {
							dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
							highest_held_title_tier >= root.highest_held_title_tier
						AND = {
							exists = liege
							is_ruler = no
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}
						}
					}
					add_to_temporary_list = candidates
				}
			random_in_list = {
			list = candidates
			limit = {
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { always = yes }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_1
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
			random_in_list = {
			list = candidates 
			limit = {
			NOT = {this = scope:candidate_1}
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOT = {this = scope:candidate_1} }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_2
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		if = {
			limit = {scope:herald = {diplomacy >= 5}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
										this = scope:candidate_2} 
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOR = {this = scope:candidate_1
										this = scope:candidate_2}  }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_3
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			diplomacy > 8}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3}
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3} }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_4
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			diplomacy > 12}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4}
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4} }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_5
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			diplomacy > 16}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4
								this = scope:candidate_5}
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4
								this = scope:candidate_5} }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_6
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
	}
	else_if = {
				limit = {
					allowed_to_marry_same_sex_trigger = yes
				}
			every_opposite_sex_spouse_candidate = {
					limit = {
						NOR = {
							is_imprisoned = yes
							has_character_flag = partially_spied_2
							has_character_flag = partially_spied_3
							faith.religious_head = this
						}
						is_capable_adult = yes
						in_diplomatic_range = root
						NOT = {is_close_or_extended_family_of = root}
						root = {is_character_interaction_potentially_accepted = {
								recipient = prev
								secondary_actor = root
								secondary_recipient = prev
								interaction = arrange_marriage_interaction
							}}	
						faith = root.faith
						exists = dynasty
						NOT = {has_trait = bastard}
						OR = {
							top_liege = root.top_liege
							top_liege = {character_is_realm_neighbor = root.top_liege}
							highest_held_title_tier >= tier_kingdom}
						OR = {
							dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
							highest_held_title_tier >= root.highest_held_title_tier
						AND = {
							exists = liege
							is_ruler = no
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}
						}
					}
					add_to_temporary_list = candidates
				}
				every_same_sex_spouse_candidate = {
					limit = {
						NOR = {
							is_imprisoned = yes
							has_character_flag = partially_spied_2
							has_character_flag = partially_spied_3
							faith.religious_head = this
						}
						is_capable_adult = yes
						in_diplomatic_range = root
						NOT = {is_close_or_extended_family_of = root}
						root = {is_character_interaction_potentially_accepted = {
								recipient = prev
								secondary_actor = root
								secondary_recipient = prev
								interaction = arrange_marriage_interaction
							}}	
						faith = root.faith
						exists = dynasty
						NOT = {has_trait = bastard}
						OR = {
							top_liege = root.top_liege
							top_liege = {character_is_realm_neighbor = root.top_liege}
							highest_held_title_tier >= tier_kingdom}
						OR = {
							dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
							highest_held_title_tier >= root.highest_held_title_tier
						AND = {
							exists = liege
							is_ruler = no
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}
						}
					}
					add_to_temporary_list = candidates
				}
			random_in_list = {
			list = candidates
			limit = {
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { always = yes }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_1
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
			random_in_list = {
			list = candidates 
			limit = {
			NOT = {this = scope:candidate_1}
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOT = {this = scope:candidate_1} }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_2
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		if = {
			limit = {scope:herald = {diplomacy >= 5}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
										this = scope:candidate_2} 
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOR = {this = scope:candidate_1
										this = scope:candidate_2}  }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_3
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			diplomacy > 8}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3}
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3} }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_4
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			diplomacy > 12}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4}
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4} }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_5
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			diplomacy > 16}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4
								this = scope:candidate_5}
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4
								this = scope:candidate_5} }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_6
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
	}
}
	option = {
	name = find_spouse_ongoing.1002.a
	trigger = {
	scope:herald = {
	is_available = yes
	OR = {is_councillor_of = root
	is_courtier_of = root}
	is_alive = yes}
	OR = {
	exists = scope:candidate_2
	exists = scope:candidate_3
	exists = scope:candidate_1}}
	trigger_event = find_spouse_ongoing.1006
	}
	
	option = {
	name = find_spouse_ongoing.1002.b
	trigger = {scope:herald = {
	is_available = yes
	OR = {is_councillor_of = root
	is_courtier_of = root}
	is_alive = yes}
	NOR = {exists = scope:candidate_2
	exists = scope:candidate_3
	exists = scope:candidate_1}}
	trigger_event = find_spouse_ongoing.1008
	}
	
	option = {
	name = find_spouse_ongoing.1002.c
	trigger = {scope:herald = {is_alive = no}}
	trigger_event = find_spouse_ongoing.1011
	}
	
	option = {
	name = find_spouse_ongoing.1002.d
	trigger = {scope:herald = {
	OR = {is_available = no
	NOR = {is_councillor_of = root
	is_courtier_of = root}}
	is_alive = yes}}
	trigger_event = find_spouse_ongoing.1012
	}

}

find_spouse_ongoing.1003 = { #Spymaster
	type = character_event
	hidden = yes 
	
	trigger = {
	is_ai = no
	exists = scope:herald
	}
	
	immediate = {
		if = {
				limit = {
					allowed_to_marry_same_sex_trigger = no
				}
			every_opposite_sex_spouse_candidate = {
					limit = {
						NOR = {
							is_imprisoned = yes
							has_character_flag = partially_spied_2
							has_character_flag = partially_spied_3
							faith.religious_head = this
						}
						is_capable_adult = yes
						in_diplomatic_range = root
						NOT = {is_close_or_extended_family_of = root}
						root = {is_character_interaction_potentially_accepted = {
								recipient = prev
								secondary_actor = root
								secondary_recipient = prev
								interaction = arrange_marriage_interaction
							}}
					}
					add_to_temporary_list = candidates
				}
			random_in_list = {
			list = candidates
			limit = {scope:herald = {likes_character_trigger = {CHARACTER = root}}
						age < 40
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
						}}
			alternative_limit = {always = yes}
			weight = {
					base = 0.1
					modifier = {
						add = 90
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 60
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 30
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						sum_of_all_skills_value < 35
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_1
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			add_character_flag = {
				flag = partially_spied_3
				months = 3
				}
			}
			random_in_list = {
			list = candidates 
			limit = {NOT = {this = scope:candidate_1}
				scope:herald = {likes_character_trigger = {CHARACTER = root}}
						age < 40
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
						}}
			alternative_limit = {NOT = {this = scope:candidate_1}}
			weight = {
					base = 0.1
					modifier = {
						add = 90
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 60
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 30
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						sum_of_all_skills_value < 35
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_2
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			add_character_flag = {
				flag = partially_spied_3
				months = 3
				}
			}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
								this = scope:candidate_2}
					scope:herald = {likes_character_trigger = {CHARACTER = root}}
						age < 40
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
						}}
			alternative_limit = {NOR = {this = scope:candidate_1
									this = scope:candidate_2}}
			weight = {
					base = 0.1
					modifier = {
						add = 90
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 60
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 30
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						sum_of_all_skills_value < 35
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_3
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			add_character_flag = {
				flag = partially_spied_3
				months = 3
				}
			}

		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			intrigue > 8}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3}}
			weight = {
					base = 0.1
					modifier = {
						add = 90
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 60
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 30
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						sum_of_all_skills_value < 35
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_4
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			add_character_flag = {
				flag = partially_spied_3
				months = 3
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			intrigue > 12}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4}}
			weight = {
					base = 0.1
					modifier = {
						add = 90
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 60
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 30
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						sum_of_all_skills_value < 35
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_5
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			add_character_flag = {
				flag = partially_spied_3
				months = 3
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			intrigue > 16}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4
								this = scope:candidate_5}}
			weight = {
					base = 0.1
					modifier = {
						add = 90
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 60
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 30
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						sum_of_all_skills_value < 35
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_6
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			add_character_flag = {
				flag = partially_spied_3
				months = 3
				}
			}
		}
	}
	else_if = {
				limit = {
					allowed_to_marry_same_sex_trigger = yes
				}
			every_opposite_sex_spouse_candidate = {
					limit = {
						NOR = {
							is_imprisoned = yes
							has_character_flag = partially_spied_2
							has_character_flag = partially_spied_3
							faith.religious_head = this
						}
						is_capable_adult = yes
						in_diplomatic_range = root
						NOT = {is_close_or_extended_family_of = root}
						root = {is_character_interaction_potentially_accepted = {
								recipient = prev
								secondary_actor = root
								secondary_recipient = prev
								interaction = arrange_marriage_interaction
							}}
					}
					add_to_temporary_list = candidates
				}
			every_same_sex_spouse_candidate = {
					limit = {
						NOR = {
							is_imprisoned = yes
							has_character_flag = partially_spied_2
							has_character_flag = partially_spied_3
							faith.religious_head = this
						}
						is_capable_adult = yes
						in_diplomatic_range = root
						NOT = {is_close_or_extended_family_of = root}
						root = {is_character_interaction_potentially_accepted = {
								recipient = prev
								secondary_actor = root
								secondary_recipient = prev
								interaction = arrange_marriage_interaction
							}}
					}
					add_to_temporary_list = candidates
				}
			random_in_list = {
			list = candidates
			limit = {scope:herald = {likes_character_trigger = {CHARACTER = root}}
						age < 40
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
						}}
			alternative_limit = {always = yes}
			weight = {
					base = 0.1
					modifier = {
						add = 90
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 60
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 30
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						sum_of_all_skills_value < 35
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_1
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			add_character_flag = {
				flag = partially_spied_3
				months = 3
				}
			}
			random_in_list = {
			list = candidates 
			limit = {NOT = {this = scope:candidate_1}
				scope:herald = {likes_character_trigger = {CHARACTER = root}}
						age < 40
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
						}}
			alternative_limit = {NOT = {this = scope:candidate_1}}
			weight = {
					base = 0.1
					modifier = {
						add = 90
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 60
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 30
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						sum_of_all_skills_value < 35
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_2
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			add_character_flag = {
				flag = partially_spied_3
				months = 3
				}
			}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
								this = scope:candidate_2}
					scope:herald = {likes_character_trigger = {CHARACTER = root}}
						age < 40
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
						}}
			alternative_limit = {NOR = {this = scope:candidate_1
									this = scope:candidate_2}}
			weight = {
					base = 0.1
					modifier = {
						add = 90
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 60
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 30
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						sum_of_all_skills_value < 35
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_3
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			add_character_flag = {
				flag = partially_spied_3
				months = 3
				}
			}

		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			intrigue > 8}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3}}
			weight = {
					base = 0.1
					modifier = {
						add = 90
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 60
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 30
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						sum_of_all_skills_value < 35
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_4
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			add_character_flag = {
				flag = partially_spied_3
				months = 3
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			intrigue > 12}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4}}
			weight = {
					base = 0.1
					modifier = {
						add = 90
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 60
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 30
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						sum_of_all_skills_value < 35
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_5
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			add_character_flag = {
				flag = partially_spied_3
				months = 3
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			intrigue > 16}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4
								this = scope:candidate_5}}
			weight = {
					base = 0.1
					modifier = {
						add = 90
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 60
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 30
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						sum_of_all_skills_value < 35
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_6
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			add_character_flag = {
				flag = partially_spied_3
				months = 3
				}
			}
		}
	}
}
	option = {
	name = find_spouse_ongoing.1003.a
	trigger = {
	scope:herald = {
	is_available = yes
	OR = {is_councillor_of = root
	is_courtier_of = root}
	is_alive = yes}
	OR = {
	exists = scope:candidate_2
	exists = scope:candidate_3
	exists = scope:candidate_1}}
	trigger_event = find_spouse_ongoing.1006
	}
	
	option = {
	name = find_spouse_ongoing.1003.b
	trigger = {scope:herald = {
	is_available = yes
	OR = {is_councillor_of = root
	is_courtier_of = root}
	is_alive = yes}
	NOR = {
	exists = scope:candidate_2
	exists = scope:candidate_3
	exists = scope:candidate_1}}
	trigger_event = find_spouse_ongoing.1008
	}
	option = {
	name = find_spouse_ongoing.1003.c
	trigger = {scope:herald = {is_alive = no}}
	trigger_event = find_spouse_ongoing.1011
	}
	option = {
	name = find_spouse_ongoing.1003.d
	trigger = {scope:herald = {
	OR = {is_available = no
	NOR = {is_councillor_of = root
	is_courtier_of = root}}
	is_alive = yes}}
	trigger_event = find_spouse_ongoing.1012
	}

}

find_spouse_ongoing.1004 = { ###LEARNED
	type = character_event
	hidden = yes 
	
	trigger = {
	is_ai = no
	exists = scope:herald
	}
	
	immediate = {
		if = {
				limit = {
					allowed_to_marry_same_sex_trigger = no
				}
			every_opposite_sex_spouse_candidate = {
					limit = {
						NOR = {
							is_imprisoned = yes
							has_character_flag = partially_spied_2
							has_character_flag = partially_spied_3
							faith.religious_head = this
						}
						is_capable_adult = yes
						in_diplomatic_range = root
						NOT = {is_close_or_extended_family_of = root}
						root = {is_character_interaction_potentially_accepted = {
								recipient = prev
								secondary_actor = root
								secondary_recipient = prev
								interaction = arrange_marriage_interaction
							}}	
						faith = root.faith
						OR = {
							top_liege = root.top_liege
							top_liege = {character_is_realm_neighbor = root.top_liege}}
						can_have_children = yes
						age < 35
						fertility > 0.5
					}
					add_to_temporary_list = candidates
				}
			random_in_list = {
			list = candidates
			weight = {
					base = 0.1
					modifier = {
						add = 95
						fertility >= 0.75
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 55
						fertility >= 0.75
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
						modifier = {
						add = 70
						OR = {
						has_trait = beauty_good_1
						has_trait = beauty_good_2
						has_trait = beauty_good_3
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 30
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 15
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						fertility <= 0.5
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_1
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
			random_in_list = {
			list = candidates 
			limit = {NOT = {this = scope:candidate_1}}
			weight = {
					base = 0.1
					modifier = {
						add = 95
						fertility >= 0.75
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 55
						fertility >= 0.75
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
						modifier = {
						add = 70
						OR = {
						has_trait = beauty_good_1
						has_trait = beauty_good_2
						has_trait = beauty_good_3
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 30
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 15
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						fertility <= 0.5
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_2
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		if = {
			limit = {scope:herald = {learning >= 5}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
								this = scope:candidate_2}}
			weight = {
					base = 0.1
					modifier = {
						add = 95
						fertility >= 0.75
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 55
						fertility >= 0.75
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
						modifier = {
						add = 70
						OR = {
						has_trait = beauty_good_1
						has_trait = beauty_good_2
						has_trait = beauty_good_3
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 30
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 15
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						fertility <= 0.5
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_3
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			learning > 8}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3}}
			weight = {
					base = 0.1
					modifier = {
						add = 95
						fertility >= 0.75
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 55
						fertility >= 0.75
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
						modifier = {
						add = 70
						OR = {
						has_trait = beauty_good_1
						has_trait = beauty_good_2
						has_trait = beauty_good_3
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 30
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 15
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						fertility <= 0.5
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_4
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			learning > 12}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4}}
			weight = {
					base = 0.1
					modifier = {
						add = 95
						fertility >= 0.75
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 55
						fertility >= 0.75
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
						modifier = {
						add = 70
						OR = {
						has_trait = beauty_good_1
						has_trait = beauty_good_2
						has_trait = beauty_good_3
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 30
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 15
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						fertility <= 0.5
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_5
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			learning > 16}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4
								this = scope:candidate_5}}
			weight = {
					base = 0.1
					modifier = {
						add = 95
						fertility >= 0.75
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 55
						fertility >= 0.75
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
						modifier = {
						add = 70
						OR = {
						has_trait = beauty_good_1
						has_trait = beauty_good_2
						has_trait = beauty_good_3
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 30
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 15
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						fertility <= 0.5
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_6
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
	}
	else_if = {
				limit = {
					allowed_to_marry_same_sex_trigger = yes
				}
			every_opposite_sex_spouse_candidate = {
					limit = {
						NOR = {
							is_imprisoned = yes
							has_character_flag = partially_spied_2
							has_character_flag = partially_spied_3
							faith.religious_head = this
						}
						is_capable_adult = yes
						in_diplomatic_range = root
						NOT = {is_close_or_extended_family_of = root}
						root = {is_character_interaction_potentially_accepted = {
								recipient = prev
								secondary_actor = root
								secondary_recipient = prev
								interaction = arrange_marriage_interaction
							}}	
						faith = root.faith
						OR = {
							top_liege = root.top_liege
							top_liege = {character_is_realm_neighbor = root.top_liege}}
						can_have_children = yes
						age < 35
						fertility > 0.5
					}
					add_to_temporary_list = candidates
				}
			every_same_sex_spouse_candidate = {
					limit = {
						NOR = {
							is_imprisoned = yes
							has_character_flag = partially_spied_2
							has_character_flag = partially_spied_3
							faith.religious_head = this
						}
						is_capable_adult = yes
						in_diplomatic_range = root
						NOT = {is_close_or_extended_family_of = root}
						root = {is_character_interaction_potentially_accepted = {
								recipient = prev
								secondary_actor = root
								secondary_recipient = prev
								interaction = arrange_marriage_interaction
							}}	
						faith = root.faith
						OR = {
							top_liege = root.top_liege
							top_liege = {character_is_realm_neighbor = root.top_liege}}
						can_have_children = yes
						age < 35
						fertility > 0.5
					}
					add_to_temporary_list = candidates
				}
			random_in_list = {
			list = candidates
			weight = {
					base = 0.1
					modifier = {
						add = 95
						fertility >= 0.75
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 55
						fertility >= 0.75
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
						modifier = {
						add = 70
						OR = {
						has_trait = beauty_good_1
						has_trait = beauty_good_2
						has_trait = beauty_good_3
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 30
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 15
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						fertility <= 0.5
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_1
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
			random_in_list = {
			list = candidates 
			limit = {NOT = {this = scope:candidate_1}}
			weight = {
					base = 0.1
					modifier = {
						add = 95
						fertility >= 0.75
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 55
						fertility >= 0.75
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
						modifier = {
						add = 70
						OR = {
						has_trait = beauty_good_1
						has_trait = beauty_good_2
						has_trait = beauty_good_3
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 30
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 15
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						fertility <= 0.5
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_2
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		if = {
			limit = {scope:herald = {learning >= 5}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
								this = scope:candidate_2}}
			weight = {
					base = 0.1
					modifier = {
						add = 95
						fertility >= 0.75
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 55
						fertility >= 0.75
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
						modifier = {
						add = 70
						OR = {
						has_trait = beauty_good_1
						has_trait = beauty_good_2
						has_trait = beauty_good_3
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 30
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 15
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						fertility <= 0.5
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_3
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			learning > 8}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3}}
			weight = {
					base = 0.1
					modifier = {
						add = 95
						fertility >= 0.75
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 55
						fertility >= 0.75
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
						modifier = {
						add = 70
						OR = {
						has_trait = beauty_good_1
						has_trait = beauty_good_2
						has_trait = beauty_good_3
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 30
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 15
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						fertility <= 0.5
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_4
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			learning > 12}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4}}
			weight = {
					base = 0.1
					modifier = {
						add = 95
						fertility >= 0.75
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 55
						fertility >= 0.75
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
						modifier = {
						add = 70
						OR = {
						has_trait = beauty_good_1
						has_trait = beauty_good_2
						has_trait = beauty_good_3
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 30
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 15
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						fertility <= 0.5
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_5
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			learning > 16}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4
								this = scope:candidate_5}}
			weight = {
					base = 0.1
					modifier = {
						add = 95
						fertility >= 0.75
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 55
						fertility >= 0.75
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
						modifier = {
						add = 70
						OR = {
						has_trait = beauty_good_1
						has_trait = beauty_good_2
						has_trait = beauty_good_3
							}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						OR = {
						sum_of_all_skills_value >= 45
						has_trait = intellect_good_1
						has_trait = intellect_good_2
						has_trait = intellect_good_3
						has_trait = shrewd
							}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 40
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 20
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 30
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 15
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 60
						OR = {
						fertility <= 0.5
						has_trait = intellect_bad_1
						has_trait = intellect_bad_2
						has_trait = intellect_bad_3
						has_trait = dull
						has_trait = beauty_bad_1
						has_trait = beauty_bad_2
						has_trait = beauty_bad_3
							}
						scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
						}
					}
			save_scope_as = candidate_6
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
	}
}
	option = {
	name = find_spouse_ongoing.1004.a
	trigger = {
	scope:herald = {
	is_available = yes
	OR = {is_councillor_of = root
	is_courtier_of = root}
	is_alive = yes}
	OR = {
	exists = scope:candidate_2
	exists = scope:candidate_3
	exists = scope:candidate_1}}
	trigger_event = find_spouse_ongoing.1006
	}
	
	option = {
	name = find_spouse_ongoing.1004.b
	trigger = {scope:herald = {
	is_available = yes
	OR = {is_councillor_of = root
	is_courtier_of = root}
	is_alive = yes}
	NOR = {
	exists = scope:candidate_2
	exists = scope:candidate_3
	exists = scope:candidate_1}}
	trigger_event = find_spouse_ongoing.1008
	}
	option = {
	name = find_spouse_ongoing.1004.c
	trigger = {scope:herald = {is_alive = no}}
	trigger_event = find_spouse_ongoing.1011
	}
	option = {
	name = find_spouse_ongoing.1004.d
	trigger = {scope:herald = {
	OR = {is_available = no
	NOR = {is_councillor_of = root
	is_courtier_of = root}}
	is_alive = yes}}
	trigger_event = find_spouse_ongoing.1012
	}


}

find_spouse_ongoing.1005 = { ###FRIEND
	type = character_event
	hidden = yes 
	
	trigger = {
	is_ai = no
	exists = scope:friend
	}
	
	immediate = {
		if = {
				limit = {
					allowed_to_marry_same_sex_trigger = no
				}
			every_opposite_sex_spouse_candidate = {
					limit = {
						NOR = {
							is_imprisoned = yes
							has_character_flag = partially_spied_2
							has_character_flag = partially_spied_3
							faith.religious_head = this
						}
						is_capable_adult = yes
						in_diplomatic_range = root
						NOT = {is_close_or_extended_family_of = root}
						root = {is_character_interaction_potentially_accepted = {
								recipient = prev
								secondary_actor = root
								secondary_recipient = prev
								interaction = arrange_marriage_interaction
							}}	
						OR = {
							top_liege = scope:friend.top_liege
							top_liege = {character_is_realm_neighbor = scope:friend.top_liege}}
						
						OR = {
						is_close_family_of = scope:friend
						AND = {
						age <= root.age
						OR = {
						has_trait = intellect_good_3
						has_trait = beauty_good_3
						has_trait = beauty_good_2
						has_trait = shrewd
						has_trait = beauty_good_1
						attraction >= medium_positive_attraction
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						AND = {
						trait_compatibility = { target = root value >= high_positive_trait_compatibility }
						attraction >= 0
									}
								}
							}
						}
					}
					add_to_temporary_list = candidates
				}
			random_in_list = {
			list = candidates
			weight = {
					base = 1
					modifier = {
						add = 50
						attraction >= medium_positive_attraction
						}
					modifier = {
						add = 90
						is_close_family_of = scope:friend
						}
					modifier = {
						add = 40
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level						
						}
					}
			save_scope_as = candidate_1
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			if = {
				limit = {is_close_family_of = scope:friend}
				add_character_flag = {
				flag = partially_spied_3
				months = 3
					}
				}
			}
		if = {
			limit = {scope:friend = {highest_held_title_tier >= tier_county}}
			random_in_list = {
			list = candidates 
			limit = {
			NOT = {this = scope:candidate_1}}
			weight = {
					base = 1
					modifier = {
						add = 50
						attraction >= medium_positive_attraction
						}
					modifier = {
						add = 90
						is_close_family_of = scope:friend
						}
					modifier = {
						add = 40
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level						
						}
					}
			save_scope_as = candidate_2
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			if = {
				limit = {is_close_family_of = scope:friend}
				add_character_flag = {
				flag = partially_spied_3
				months = 3
					}
				}
			}
		}
		if = {
			limit = {scope:friend = {highest_held_title_tier >= tier_duchy}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
								this = scope:candidate_2}}
			weight = {
					base = 1
					modifier = {
						add = 50
						attraction >= medium_positive_attraction
						}
					modifier = {
						add = 90
						is_close_family_of = scope:friend
						}
					modifier = {
						add = 40
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level						
						}
					}
			save_scope_as = candidate_3
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			if = {
				limit = {is_close_family_of = scope:friend}
				add_character_flag = {
				flag = partially_spied_3
				months = 3
					}
				}
			}
		}
		if = {
			limit = {scope:friend = {
			highest_held_title_tier >= tier_duchy}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3}}
			weight = {
					base = 1
					modifier = {
						add = 50
						attraction >= medium_positive_attraction
						}
					modifier = {
						add = 90
						is_close_family_of = scope:friend
						}
					modifier = {
						add = 40
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level						
						}
					}
			save_scope_as = candidate_4
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			if = {
				limit = {is_close_family_of = scope:friend}
				add_character_flag = {
				flag = partially_spied_3
				months = 3
					}
				}
			}
		}
		if = {
			limit = {scope:friend = {
			highest_held_title_tier >= tier_kingdom}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4}}
			weight = {
					base = 1
					modifier = {
						add = 50
						attraction >= medium_positive_attraction
						}
					modifier = {
						add = 90
						is_close_family_of = scope:friend
						}
					modifier = {
						add = 40
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level						
						}
					}
			save_scope_as = candidate_5
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			if = {
				limit = {is_close_family_of = scope:friend}
				add_character_flag = {
				flag = partially_spied_3
				months = 3
					}
				}
			}
		}
		if = {
			limit = {scope:friend = {
			highest_held_title_tier >= tier_kingdom}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4
								this = scope:candidate_5}}
			weight = {
					base = 1
					modifier = {
						add = 50
						attraction >= medium_positive_attraction
						}
					modifier = {
						add = 90
						is_close_family_of = scope:friend
						}
					modifier = {
						add = 40
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level						
						}
					}
			save_scope_as = candidate_6
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			if = {
				limit = {is_close_family_of = scope:friend}
				add_character_flag = {
				flag = partially_spied_3
				months = 3
					}
				}
			}
		}
	}
	else_if = {
				limit = {
					allowed_to_marry_same_sex_trigger = yes
				}
			every_opposite_sex_spouse_candidate = {
					limit = {
						NOR = {
							is_imprisoned = yes
							has_character_flag = partially_spied_2
							has_character_flag = partially_spied_3
							faith.religious_head = this
						}
						is_capable_adult = yes
						in_diplomatic_range = root
						NOT = {is_close_or_extended_family_of = root}
						root = {is_character_interaction_potentially_accepted = {
								recipient = prev
								secondary_actor = root
								secondary_recipient = prev
								interaction = arrange_marriage_interaction
							}}	
						OR = {
							top_liege = scope:friend.top_liege
							top_liege = {character_is_realm_neighbor = scope:friend.top_liege}}
						
						OR = {
						is_close_family_of = scope:friend
						AND = {
						age <= root.age
						OR = {
						has_trait = intellect_good_3
						has_trait = beauty_good_3
						has_trait = beauty_good_2
						has_trait = shrewd
						has_trait = beauty_good_1
						attraction >= medium_positive_attraction
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						AND = {
						trait_compatibility = { target = root value >= high_positive_trait_compatibility }
						attraction >= 0
									}
								}
							}
						}
					}
					add_to_temporary_list = candidates
				}
				every_same_sex_spouse_candidate = {
					limit = {
						NOR = {
							is_imprisoned = yes
							has_character_flag = partially_spied_2
							has_character_flag = partially_spied_3
							faith.religious_head = this
						}
						is_capable_adult = yes
						in_diplomatic_range = root
						NOT = {is_close_or_extended_family_of = root}
						root = {is_character_interaction_potentially_accepted = {
								recipient = prev
								secondary_actor = root
								secondary_recipient = prev
								interaction = arrange_marriage_interaction
							}}	
						OR = {
							top_liege = scope:friend.top_liege
							top_liege = {character_is_realm_neighbor = scope:friend.top_liege}}
						
						OR = {
						is_close_family_of = scope:friend
						AND = {
						age <= root.age
						OR = {
						has_trait = intellect_good_3
						has_trait = beauty_good_3
						has_trait = beauty_good_2
						has_trait = shrewd
						has_trait = beauty_good_1
						attraction >= medium_positive_attraction
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						AND = {
						trait_compatibility = { target = root value >= high_positive_trait_compatibility }
						attraction >= 0
									}
								}
							}
						}
					}
					add_to_temporary_list = candidates
				}
			random_in_list = {
			list = candidates
			weight = {
					base = 1
					modifier = {
						add = 50
						attraction >= medium_positive_attraction
						}
					modifier = {
						add = 90
						is_close_family_of = scope:friend
						}
					modifier = {
						add = 40
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level						
						}
					}
			save_scope_as = candidate_1
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			if = {
				limit = {is_close_family_of = scope:friend}
				add_character_flag = {
				flag = partially_spied_3
				months = 3
					}
				}
			}
		if = {
			limit = {scope:friend = {highest_held_title_tier >= tier_county}}
			random_in_list = {
			list = candidates 
			limit = {
			NOT = {this = scope:candidate_1}}
			weight = {
					base = 1
					modifier = {
						add = 50
						attraction >= medium_positive_attraction
						}
					modifier = {
						add = 90
						is_close_family_of = scope:friend
						}
					modifier = {
						add = 40
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level						
						}
					}
			save_scope_as = candidate_2
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			if = {
				limit = {is_close_family_of = scope:friend}
				add_character_flag = {
				flag = partially_spied_3
				months = 3
					}
				}
			}
		}
		if = {
			limit = {scope:friend = {highest_held_title_tier >= tier_duchy}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
								this = scope:candidate_2}}
			weight = {
					base = 1
					modifier = {
						add = 50
						attraction >= medium_positive_attraction
						}
					modifier = {
						add = 90
						is_close_family_of = scope:friend
						}
					modifier = {
						add = 40
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level						
						}
					}
			save_scope_as = candidate_3
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			if = {
				limit = {is_close_family_of = scope:friend}
				add_character_flag = {
				flag = partially_spied_3
				months = 3
					}
				}
			}
		}
		if = {
			limit = {scope:friend = {
			highest_held_title_tier >= tier_duchy}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3}}
			weight = {
					base = 1
					modifier = {
						add = 50
						attraction >= medium_positive_attraction
						}
					modifier = {
						add = 90
						is_close_family_of = scope:friend
						}
					modifier = {
						add = 40
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level						
						}
					}
			save_scope_as = candidate_4
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			if = {
				limit = {is_close_family_of = scope:friend}
				add_character_flag = {
				flag = partially_spied_3
				months = 3
					}
				}
			}
		}
		if = {
			limit = {scope:friend = {
			highest_held_title_tier >= tier_kingdom}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4}}
			weight = {
					base = 1
					modifier = {
						add = 50
						attraction >= medium_positive_attraction
						}
					modifier = {
						add = 90
						is_close_family_of = scope:friend
						}
					modifier = {
						add = 40
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level						
						}
					}
			save_scope_as = candidate_5
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			if = {
				limit = {is_close_family_of = scope:friend}
				add_character_flag = {
				flag = partially_spied_3
				months = 3
					}
				}
			}
		}
		if = {
			limit = {scope:friend = {
			highest_held_title_tier >= tier_kingdom}}
			random_in_list = {
			list = candidates 
			limit = {NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4
								this = scope:candidate_5}}
			weight = {
					base = 1
					modifier = {
						add = 50
						attraction >= medium_positive_attraction
						}
					modifier = {
						add = 90
						is_close_family_of = scope:friend
						}
					modifier = {
						add = 40
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level						
						}
					}
			save_scope_as = candidate_6
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			if = {
				limit = {is_close_family_of = scope:friend}
				add_character_flag = {
				flag = partially_spied_3
				months = 3
					}
				}
			}
		}
	}
}
	option = {
	name = find_spouse_ongoing.1005.a
	trigger = {
	scope:friend = {
	is_available = yes
	has_relation_friend = root
	is_alive = yes}
	OR = {
	exists = scope:candidate_2
	exists = scope:candidate_3
	exists = scope:candidate_1}}
	trigger_event = find_spouse_ongoing.1009
	}
	
	option = {
	name = find_spouse_ongoing.1005.b
	trigger = {scope:friend = {
	is_available = yes
	has_relation_friend = root
	is_alive = yes}
	NOR = {
	exists = scope:candidate_2
	exists = scope:candidate_3
	exists = scope:candidate_1}}
	scope:friend = {save_scope_as = herald}
	trigger_event = find_spouse_ongoing.1008
	}
	option = {
	name = find_spouse_ongoing.1005.c
	trigger = {scope:friend = {is_alive = no}}
	scope:friend = {save_scope_as = herald}
	trigger_event = find_spouse_ongoing.1011
	}
	
	option = {
	name = find_spouse_ongoing.1005.d
	trigger = {scope:friend = {
	OR = {
	NOT = {is_available = yes}
	NOT = {has_relation_friend = root}}
	is_alive = yes}}
	scope:friend = {save_scope_as = herald}
	trigger_event = find_spouse_ongoing.1012
	}

}

find_spouse_ongoing.1006 = {
	type = character_event
	title = find_spouse_ongoing.1006.t
	desc = find_spouse_ongoing.1006.desc
	theme = marriage
	override_background = { reference = throne_room }
	right_portrait = {
		character = root
		animation = personality_compassionate
	}
	left_portrait = {
		character = scope:herald
		animation = chancellor
	}
	lower_right_portrait = scope:candidate_1
	lower_center_portrait = scope:candidate_2
	lower_left_portrait = scope:candidate_3

	trigger = {
	is_ai = no
	OR = {
	exists = scope:candidate_2
	exists = scope:candidate_3
	exists = scope:candidate_1}
	}
	
	option = { #more
		name = find_spouse_ongoing.1006.a
		trigger = { exists = scope:candidate_4}
		trigger_event = find_spouse_ongoing.1007
		
	}
	
	option = { #leave it
		name = find_spouse_ongoing.1006.b
		trigger = { NOT = {exists = scope:candidate_4}}
		add_character_flag = {
				flag = two_years_to_marry
				years = 2
				}
		trigger_event = {
			id = find_spouse_ongoing.1013
			months = 4
		}
		
	}

}

find_spouse_ongoing.1007 = {
	type = character_event
	title = find_spouse_ongoing.1006.t
	desc = find_spouse_ongoing.1006.desc
	theme = marriage
	override_background = { reference = throne_room }
	right_portrait = {
		character = root
		animation = chancellor
	}
	left_portrait = {
		character = scope:herald
		animation = personality_honorable
	}
	lower_right_portrait = scope:candidate_4
	lower_center_portrait = scope:candidate_5
	lower_left_portrait = scope:candidate_6

	trigger = {
	is_ai = no
	exists = scope:candidate_4
	}

	
	option = { #leave it
		name = find_spouse_ongoing.1006.b
		add_character_flag = {
				flag = two_years_to_marry
				years = 2
				}
		trigger_event = {
			id = find_spouse_ongoing.1013
			months = 4
		}
	}

}

find_spouse_ongoing.1008 = {
	type = character_event
	title = find_spouse_ongoing.1008.t
	desc = find_spouse_ongoing.1008.desc
	theme = marriage
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = stress
	}

	trigger = {
		is_married = no
		is_betrothed = no
		is_ai = no
	}
	
	
	option = { #changed my mind
		name = find_spouse_ongoing.1008.a
		remove_decision_cooldown = find_spouse_decision

		
	}

}


find_spouse_ongoing.1009 = {
	type = character_event
	title = find_spouse_ongoing.1009.t
	desc = find_spouse_ongoing.1009.desc
	theme = marriage
	override_background = { reference = sitting_room }
	right_portrait = {
		character = scope:friend
		animation = personality_compassionate
	}
	left_portrait = {
		character = root
		animation = personality_rational
	}
	lower_right_portrait = scope:candidate_1
	lower_center_portrait = scope:candidate_2
	lower_left_portrait = scope:candidate_3

	trigger = {
	is_ai = no
	OR = {
	exists = scope:candidate_2
	exists = scope:candidate_3
	exists = scope:candidate_1}
	}
	
	option = { #more
		name = find_spouse_ongoing.1009.a
		trigger = { exists = scope:candidate_4}
		trigger_event = find_spouse_ongoing.1010
		
	}
	
	option = { #leave it
		name = find_spouse_ongoing.1009.b
		trigger = { NOT = {exists = scope:candidate_4}}
		add_character_flag = {
				flag = two_years_to_marry
				years = 2
				}
		trigger_event = {
			id = find_spouse_ongoing.1013
			months = 4
		}
		
	}

}

find_spouse_ongoing.1010= {
	type = character_event
	title = find_spouse_ongoing.1009.t
	desc = find_spouse_ongoing.1009.desc
	theme = marriage
	override_background = { reference = sitting_room }
	right_portrait = {
		character = scope:friend
		animation = personality_content
	}
	left_portrait = {
		character = root
		animation = personality_rational
	}
	lower_right_portrait = scope:candidate_4
	lower_center_portrait = scope:candidate_5
	lower_left_portrait = scope:candidate_6

	trigger = {
	is_ai = no
	exists = scope:candidate_4
	}

	
	option = { #leave it
		name = find_spouse_ongoing.1009.b
		add_character_flag = {
				flag = two_years_to_marry
				years = 2
				}
		trigger_event = {
			id = find_spouse_ongoing.1013
			months = 4
		}
	}

}

find_spouse_ongoing.1011 = {
	type = character_event
	title = find_spouse_ongoing.1011.t
	desc = find_spouse_ongoing.1011.desc
	theme = marriage
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = stress
	}
	lower_right_portrait = scope:herald

	trigger = {
	is_ai = no
		scope:herald = {is_alive = no}
	}
	
	
	option = { 
		name = find_spouse_ongoing.1011.a
		remove_decision_cooldown = find_spouse_decision
		
	}

}

find_spouse_ongoing.1012 = {
	type = character_event
	title = find_spouse_ongoing.1012.t
	desc = find_spouse_ongoing.1012.desc
	theme = marriage
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = sadness
	}
	lower_right_portrait = scope:herald

	trigger = {is_ai = no}
	
	option = { #
		name = find_spouse_ongoing.1012.a
		remove_decision_cooldown = find_spouse_decision
		
	}

}

find_spouse_ongoing.1013 = {
	type = character_event
	title = find_spouse_ongoing.1013.t
	desc = find_spouse_ongoing.1013.desc
	theme = marriage
	override_background = { reference = garden }
	right_portrait = {
		character = root
		animation = boredom
	}
	
	trigger = {is_ai = no
		is_betrothed = no
				is_married = no
				has_character_flag = two_years_to_marry}
				
	on_trigger_fail = {
		if = {
			limit = {
				OR = {
				is_ai = yes
				is_incapable = yes
				has_contagious_deadly_disease_trigger = yes}
			}
			remove_character_flag = two_years_to_marry
		}
		else_if = {
			limit = {
				is_betrothed = no
				is_married = no
			}
			trigger_event = {
				id = find_spouse_ongoing.1013
				days = 15
			}
		}
		else = {
		remove_character_flag = two_years_to_marry
		}
	}
				

	
	option = { #patient
		name = find_spouse_ongoing.1013.a
		remove_character_flag = two_years_to_marry
		add_character_flag = {
				flag = had_1013_patient
				years = 3
				}
		stress_impact = {
			seducer = medium_stress_impact_gain
			lustful = minor_stress_impact_gain
			depressed_1 = minor_stress_impact_gain
			depressed_genetic = minor_stress_impact_gain
			chaste = minor_stress_impact_loss
			reclusive = minor_stress_impact_loss
			impatient = medium_stress_impact_gain
			
		}
		trigger_event = {
			id = find_spouse_ongoing.1014
			years = 2
		}
	}
	option = { #hurry
		name = find_spouse_ongoing.1013.b
		remove_character_flag = two_years_to_marry
		add_character_flag = {
				flag = had_1013_hurry
				years = 2
				}
		stress_impact = {
			seducer = medium_stress_impact_loss
			lustful = minor_stress_impact_loss
			depressed_1 = miniscule_stress_impact_gain
			depressed_genetic = miniscule_stress_impact_gain 
			chaste = minor_stress_impact_gain
			reclusive = minor_stress_impact_gain
			patient = medium_stress_impact_gain
		}
		trigger_event = {
			id = find_spouse_ongoing.1015
			months = 6
		}
	}

}

find_spouse_ongoing.1014 = {
	type = character_event
	title = find_spouse_ongoing.1014.t
	desc = find_spouse_ongoing.1014.desc
	theme = marriage
	override_background = { reference = study }
	right_portrait = {
		character = root
		animation = personality_content
	}
	
	trigger = {is_ai = no
		is_imprisoned = no
		is_incapable = no
		has_contagious_deadly_disease_trigger = no
		is_betrothed = no
				is_married = no
				has_character_flag = had_1013_patient}
				
	on_trigger_fail = {
		if = {
			limit = {
				OR = {
				is_ai = yes
				is_incapable = yes
				has_contagious_deadly_disease_trigger = yes}
			}
			remove_character_flag = had_1013_patient
		}
		else_if = {
			limit = {
				is_betrothed = no
				is_married = no
			}
			trigger_event = {
				id = find_spouse_ongoing.1014
				days = 15 
			}
		}
		else = {
		remove_character_flag = had_1013_patient
		}
	}
				

	
	option = { #
		name = find_spouse_ongoing.1014.a
		remove_character_flag = had_1013_patient
		add_character_modifier = {
				modifier = obf_lingering_solitude_modifier
				years = 3
					}
		stress_impact = {
			seducer = medium_stress_impact_gain
			lustful = minor_stress_impact_gain
			depressed_1 = minor_stress_impact_gain
			depressed_genetic = minor_stress_impact_gain
			chaste = minor_stress_impact_loss
			reclusive = miniscule_stress_impact_loss
			impatient = minor_stress_impact_gain
			content = miniscule_stress_impact_loss

		}
	}

}

find_spouse_ongoing.1015 = {
	type = character_event
	title = find_spouse_ongoing.1015.t
	desc = find_spouse_ongoing.1015.desc
	theme = marriage
	override_background = { reference = sitting_room }
	left_portrait = {
		character = root
		animation = stress
	}
	
	trigger = {is_ai = no
		is_imprisoned = no
		is_incapable = no
		has_contagious_deadly_disease_trigger = no
		is_betrothed = no
				is_married = no
				has_character_flag = had_1013_hurry}
				
	on_trigger_fail = {
		if = {
			limit = {
				OR = {
				is_ai = yes
				is_incapable = yes
				has_contagious_deadly_disease_trigger = yes}
			}
			remove_character_flag = had_1013_hurry
		}
		else_if = {
			limit = {
				is_betrothed = no
				is_married = no
			}
			trigger_event = {
				id = find_spouse_ongoing.1015
				days = 15 
			}
		}
		else = {
		remove_character_flag = had_1013_hurry
		}
	}
				

	
	option = { #
		name = find_spouse_ongoing.1015.a
		remove_character_flag = had_1013_hurry
		add_character_modifier = {
				modifier = obf_fleeting_endeavor_modifier
				years = 3
					}
		stress_impact = {
			seducer = medium_stress_impact_gain
			lustful = minor_stress_impact_gain
			chaste = miniscule_stress_impact_loss
			reclusive = miniscule_stress_impact_loss
			patient = medium_stress_impact_gain
			shy = miniscule_stress_impact_loss
		}
	}

}

find_spouse_ongoing.2001 = {
	type = character_event
	hidden = yes 
	
	trigger = {
	is_ai = no
	exists = cp:councillor_chancellor
	cp:councillor_chancellor = {
			is_available = yes}
	}
	
	immediate = {
	if = {
			limit = {exists = cp:councillor_chancellor
			cp:councillor_chancellor = {
			is_available = yes}}
			cp:councillor_chancellor = {save_scope_as = herald}
		}
		scope:child_candidate = {
			if = {
				limit = {
					allowed_to_marry_same_sex_trigger = no
				}
			every_opposite_sex_spouse_candidate = {
					limit = {
						NOR = {
							is_imprisoned = yes
							has_character_flag = partially_spied_2
							has_character_flag = partially_spied_3
							faith.religious_head = this
						}
						in_diplomatic_range = root
						NOT = {is_close_or_extended_family_of = root}
						root = {is_character_interaction_potentially_accepted = {
								recipient = prev
								secondary_actor = scope:child_candidate
								secondary_recipient = prev
								interaction = arrange_marriage_interaction
							}}	
						faith = root.faith
						exists = dynasty
						NOT = {has_trait = bastard}
						OR = {
							top_liege = root.top_liege
							top_liege = {character_is_realm_neighbor = root.top_liege}
							highest_held_title_tier >= tier_kingdom}
						OR = {
							dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
							highest_held_title_tier >= root.highest_held_title_tier
						AND = {
							exists = liege
							is_ruler = no
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}
						}
					}
					add_to_temporary_list = candidates
				}
			random_in_list = {
			list = candidates
			limit = {
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { always = yes }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_1
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
			random_in_list = {
			list = candidates 
			limit = {
			NOT = {this = scope:candidate_1}
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOT = {this = scope:candidate_1} }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_2
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		if = {
			limit = {scope:herald = {diplomacy >= 5}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
										this = scope:candidate_2} 
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOR = {this = scope:candidate_1
										this = scope:candidate_2}  }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_3
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			diplomacy > 8}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3}
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3} }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_4
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			diplomacy > 12}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4}
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4} }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_5
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			diplomacy > 16}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4
								this = scope:candidate_5}
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4
								this = scope:candidate_5} }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_6
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
	}
	else_if = {
				limit = {
					allowed_to_marry_same_sex_trigger = yes
				}
			every_opposite_sex_spouse_candidate = {
					limit = {
						NOR = {
							is_imprisoned = yes
							has_character_flag = partially_spied_2
							has_character_flag = partially_spied_3
							faith.religious_head = this
						}
						in_diplomatic_range = root
						NOT = {is_close_or_extended_family_of = root}
						root = {is_character_interaction_potentially_accepted = {
								recipient = prev
								secondary_actor = scope:child_candidate
								secondary_recipient = prev
								interaction = arrange_marriage_interaction
							}}	
						faith = root.faith
						exists = dynasty
						NOT = {has_trait = bastard}
						OR = {
							top_liege = root.top_liege
							top_liege = {character_is_realm_neighbor = root.top_liege}
							highest_held_title_tier >= tier_kingdom}
						OR = {
							dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
							highest_held_title_tier >= root.highest_held_title_tier
						AND = {
							exists = liege
							is_ruler = no
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}
						}
					}
					add_to_temporary_list = candidates
				}
				every_same_sex_spouse_candidate = {
					limit = {
						NOR = {
							is_imprisoned = yes
							has_character_flag = partially_spied_2
							has_character_flag = partially_spied_3
							faith.religious_head = this
						}

						in_diplomatic_range = root
						NOT = {is_close_or_extended_family_of = root}
						root = {is_character_interaction_potentially_accepted = {
								recipient = prev
								secondary_actor = scope:child_candidate
								secondary_recipient = prev
								interaction = arrange_marriage_interaction
							}}	
						faith = root.faith
						exists = dynasty
						NOT = {has_trait = bastard}
						OR = {
							top_liege = root.top_liege
							top_liege = {character_is_realm_neighbor = root.top_liege}
							highest_held_title_tier >= tier_kingdom}
						OR = {
							dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
							highest_held_title_tier >= root.highest_held_title_tier
						AND = {
							exists = liege
							is_ruler = no
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}
						}
					}
					add_to_temporary_list = candidates
				}
			random_in_list = {
			list = candidates
			limit = {
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { always = yes }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_1
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
			random_in_list = {
			list = candidates 
			limit = {
			NOT = {this = scope:candidate_1}
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOT = {this = scope:candidate_1} }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_2
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		if = {
			limit = {scope:herald = {diplomacy >= 5}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
										this = scope:candidate_2} 
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOR = {this = scope:candidate_1
										this = scope:candidate_2}  }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_3
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			diplomacy > 8}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3}
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3} }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_4
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			diplomacy > 12}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4}
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4} }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_5
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
		if = {
			limit = {scope:herald = {
			likes_character_trigger = {CHARACTER = root}
			diplomacy > 16}}
			random_in_list = {
			list = candidates 
			limit = {
			NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4
								this = scope:candidate_5}
			scope:herald = {likes_character_trigger = {CHARACTER = root}}
						OR = {
							highest_held_title_tier >= tier_kingdom
						AND = {
							exists = liege
							liege = {highest_held_title_tier >= tier_kingdom}
							OR = {
								is_primary_heir_of = liege
								root = {yields_alliance = {
									candidate = root
									target = prev.liege
									target_candidate = prev
									}}}}
						
						}
					}
			alternative_limit = { NOR = {this = scope:candidate_1
							this = scope:candidate_2
								this = scope:candidate_3
								this = scope:candidate_4
								this = scope:candidate_5} }
					weight = {
					base = 0.1
					modifier = {
						add = 90
						highest_held_title_tier >= tier_kingdom
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 50
						highest_held_title_tier >= tier_kingdom
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 75
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 35
						exists = liege
						is_primary_heir_of = liege
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 50
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 25
						exists = liege
						root = {
							yields_alliance = {
							candidate = root
							target = prev.liege
							target_candidate = prev
							}}
						is_ruler = no
						liege = {highest_held_title_tier >= tier_kingdom}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					modifier = {
						add = 15
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						scope:herald = {likes_character_trigger = {CHARACTER = root}}
						}
					modifier = {
						add = 10
						OR = {
						highest_held_title_tier >= root.highest_held_title_tier
						dynasty.dynasty_prestige_level >= root.dynasty.dynasty_prestige_level
						}
						NOR = {scope:herald = {does_not_like_character_trigger = {CHARACTER = root}}
								scope:herald = {likes_character_trigger = {CHARACTER = root}}}
						}
					}
			save_scope_as = candidate_6
			add_character_flag = {
				flag = partially_spied
				years = 1
				}
			add_character_flag = {
				flag = partially_spied_2
				months = 6
				}
			}
		}
	}
	}
}
	option = {
	name = find_spouse_ongoing.2001.a
	trigger = {
	scope:herald = {
	is_available = yes
	OR = {is_councillor_of = root
	is_courtier_of = root}
	is_alive = yes}
	OR = {
	exists = scope:candidate_2
	exists = scope:candidate_3
	exists = scope:candidate_1}}
	trigger_event = find_spouse_ongoing.2002
	}
	
	option = {
	name = find_spouse_ongoing.2001.b
	trigger = {scope:herald = {
	is_available = yes
	OR = {is_councillor_of = root
	is_courtier_of = root}
	is_alive = yes}
	NOR = {exists = scope:candidate_2
	exists = scope:candidate_3
	exists = scope:candidate_1}}
	trigger_event = find_spouse_ongoing.2004
	}
	
	option = {
	name = find_spouse_ongoing.2001.c
	trigger = {scope:herald = {is_alive = no}}
	trigger_event = find_spouse_ongoing.2005
	}
	
	option = {
	name = find_spouse_ongoing.2001.d
	trigger = {scope:herald = {
	OR = {is_available = no
	NOR = {is_councillor_of = root
	is_courtier_of = root}}
	is_alive = yes}}
	trigger_event = find_spouse_ongoing.2006
	}

}


find_spouse_ongoing.2002 = {
	type = character_event
	title = find_spouse_ongoing.2002.t
	desc = find_spouse_ongoing.2002.desc
	theme = marriage
	override_background = { reference = throne_room }
	right_portrait = {
		character = root
		animation = chancellor
	}
	left_portrait = {
		character = scope:herald
		animation = personality_compassionate
	}
	lower_right_portrait = scope:candidate_1
	lower_center_portrait = scope:candidate_2
	lower_left_portrait = scope:candidate_3

	trigger = {
	is_ai = no
	OR = {
	exists = scope:candidate_2
	exists = scope:candidate_3
	exists = scope:candidate_1}
	}
	
	option = { #more
		name = find_spouse_ongoing.1006.a
		trigger = { exists = scope:candidate_4}
		trigger_event = find_spouse_ongoing.2003
		
	}
	
	option = { #leave it
		name = find_spouse_ongoing.1006.b
		trigger = { NOT = {exists = scope:candidate_4}}
		
	}

}

find_spouse_ongoing.2003 = {
	type = character_event
	title = find_spouse_ongoing.2002.t
	desc = find_spouse_ongoing.2002.desc
	theme = marriage
	override_background = { reference = throne_room }
	right_portrait = {
		character = root
		animation = chancellor
	}
	left_portrait = {
		character = scope:herald
		animation = personality_compassionate
	}
	lower_right_portrait = scope:candidate_4
	lower_center_portrait = scope:candidate_5
	lower_left_portrait = scope:candidate_6

	trigger = {
	is_ai = no
	exists = scope:candidate_4
	}

	
	option = { #leave it
		name = find_spouse_ongoing.1006.b
	}

}

find_spouse_ongoing.2004 = {
	type = character_event
	title = find_spouse_ongoing.2004.t
	desc = find_spouse_ongoing.2004.desc
	theme = marriage
	override_background = { reference = study }
	left_portrait = {
		character = scope:child_candidate
		animation = idle
	}
	
	
	option = { #changed my mind
		name = find_spouse_ongoing.2004.a

		
	}

}
find_spouse_ongoing.2005 = {
	type = character_event
	title = find_spouse_ongoing.2005.t
	desc = find_spouse_ongoing.2005.desc
	theme = marriage
	override_background = { reference = study }
	left_portrait = {
		character = scope:child_candidate
		animation = idle
	}
	lower_right_portrait = scope:herald

	trigger = {
	is_ai = no
		scope:herald = {is_alive = no}
	}
	
	
	option = { 
		name = find_spouse_ongoing.2005.a
		
	}

}

find_spouse_ongoing.2006 = {
	type = character_event
	title = find_spouse_ongoing.2006.t
	desc = find_spouse_ongoing.2006.desc
	theme = marriage
	override_background = { reference = study }
	left_portrait = {
		character = scope:child_candidate
		animation = idle
	}
	lower_right_portrait = scope:herald

	trigger = {is_ai = no}
	
	option = { #
		name = find_spouse_ongoing.2006.a
		
	}

}
