﻿
send_child_to_holy_order_effect = {
	scope:$GRANDMASTER$ = {
		add_courtier = scope:recipient
		if = {
			limit = {
				scope:recipient = {
					is_close_family_of = scope:actor
				}
			}
			add_opinion = {
				target = scope:actor
				modifier = pleased_opinion
				opinion = 20
			}
		}
	}
	scope:recipient = {
		add_trait = order_member
		add_piety_level = 1
		if = {
			limit = { is_ruler = yes }
			depose = yes
		}
		if = {
			limit = {
				faith != scope:$GRANDMASTER$.faith
			}
			set_character_faith = scope:$GRANDMASTER$.faith
		}
		if = {
			limit = {
				is_married = yes
			}
			every_spouse = {
				divorce = scope:recipient
			}
		}
		if = {
			limit = {
				exists = betrothed
			}
			break_betrothal = betrothed
			if = {
				limit = {
					has_been_promised_grand_wedding = yes
				}
				break_grand_wedding_betrothal_effect = yes
			}
		}
		if = {
			limit = {
				is_concubine = yes
			}
			this.concubinist = {
				remove_concubine = scope:recipient
			}
		}
		if = {
			limit = {
				number_of_concubines > 0
			}
			every_concubine = {
				scope:recipient = {
					remove_concubine = prev
				}
			}
		}
		create_character_memory = {
			type = lmf_memory_sent_to_holy_order
			participants = {
				sender = scope:actor
			}
		}
		scope:new_memory = {
			set_variable = {
				name = new_order
				value = scope:$GRANDMASTER$.primary_title
			}
			if = {
				limit = { exists = var:sender_title }
				#To prevent 'unused except in loc' errors :catto:
			}
		}
	}
}

send_child_to_clergy_effect = {
	scope:recipient = {
		add_opinion = {
			modifier = demanded_taking_vows
			target = scope:actor
		}
		create_character_memory = {
			type = lmf_memory_sent_to_be_devoted
			participants = {
				sender = scope:actor
			}
		}
		scope:new_memory = {
			set_variable = {
				name = devoted_faith
				value = scope:recipient.faith
			}
			set_variable = {
				name = sender_title
				value = scope:actor.primary_title
			}
		}
		simplified_clergy_effect = { RECIPIENT = scope:recipient }
	}
}

