action_can_assign_guardian = {
	priority = 350
	combine_into_one = yes

	check_create_action = {
    every_close_or_extended_family_member = {
      limit = {
        is_adult = no
				num_of_relation_guardian = 0
				age >= childhood_education_start_age
				exists = liege
				liege = root
				root = {
					is_character_interaction_valid = {
						recipient = prev
						interaction = educate_child_interaction
					}
				}
      }
      try_create_important_action = {
    		important_action_type = action_can_assign_guardian
    		actor = root
    		recipient = this
    		secondary_recipient = this
    	}
    }
	}

  unimportant = {
  	scope:recipient = {
  		OR = {
  			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 = educate_child_interaction
			actor = scope:actor
			recipient = scope:actor
			secondary_recipient = scope:secondary_recipient
		}
	}
}


action_close_family_can_marry = {
  priority = 400
  combine_into_one = yes

	check_create_action = {
		every_child = {
			if = {
				limit = {
					is_landed = 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_landed = yes
					}
					is_married = no
					is_betrothed = no
					is_adult = yes
					is_close_or_extended_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 = {
			OR = {
				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_can_pay_ransom = {
  priority = 300
  combine_into_one = yes

  check_create_action = {
    every_close_or_extended_family_member = {
      limit = {
        is_imprisoned = yes
        NOT = {
          is_imprisoned_by = root
        }
        liege = root
      }
      try_create_important_action = {
        important_action_type = action_can_pay_ransom
        actor = root
        recipient = this
      }
    }
  }

  unimportant = {
    scope:recipient = {
      NOT = {
        is_child_of = root
      }
    }
  }

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