action_close_family_can_marry = {
	combine_into_one = yes
	priority = 400
	check_create_action = {

		every_child = {
			if = {
				limit = {
					is_playable_character = yes
					is_married = no
					is_betrothed = no
					is_adult = yes
					can_marry_trigger = yes
					root = {
						is_character_interaction_valid = {
							recipient = prev
							interaction = marry_off_interaction
						}
					}
				}
				try_create_important_action = {
					important_action_type = action_close_family_can_marry
					actor = root
					recipient = this
				}
			}
		}
		every_courtier = {
			if = {
				limit = {
					NAND = {
						is_child_of = root
						is_playable_character = yes
					}
					is_married = no
					is_betrothed = no
					is_adult = yes
					is_close_family_of = root
					can_marry_trigger = yes
					root = {
						is_character_interaction_valid = {
							recipient = prev
							interaction = marry_off_interaction
						}
					}
					is_visibly_fertile = yes
				}
				try_create_important_action = {
					important_action_type = action_close_family_can_marry
					actor = root
					recipient = this
				}
			}
		}
	}

	unimportant = {
		scope:recipient = {
			NOT = { is_heir_of = root }
			OR = { #Either not a child of root, or not one of the three oldest
				NOT = { is_child_of = root }
				any_sibling = {
					is_alive = yes
					is_child_of = root
					age > scope:recipient.age
					count >= 3
				}
			}
		}
	}

	effect = {
		open_interaction_window = {
			interaction = marry_off_interaction
			actor = scope:actor
			recipient = scope:recipient
		}
	}
}

action_courtier_can_marry = {
	combine_into_one = yes
	priority = 370
	check_create_action = {
		every_courtier = {
			if = {
				limit = {
					NAND = {
						is_close_family_of = root
					}
					is_married = no
					is_betrothed = no
					is_adult = yes
					can_marry_trigger = yes
					root = {
						is_character_interaction_valid = {
							recipient = prev
							interaction = marry_off_interaction
						}
					}
					is_visibly_fertile = yes
				}
				try_create_important_action = {
					important_action_type = action_courtier_can_marry
					actor = root
					recipient = this
				}
			}
		}
	}
	effect = {
		open_interaction_window = {
			interaction = marry_off_interaction
			actor = scope:actor
			recipient = scope:recipient
		}
	}
}