targetted_decisions = {
	set_transfer_recipient = {
		filter = all_including_me # realm # only transfers within the realm
		ai_target_filter = self

		from_potential = {
			ai = no
		}

		potential = {
			always = yes
		}

		allow = {
			always = yes
		}

		effect = {
			any_character = {
				limit = { has_character_flag = recipient_for_@FROM }
				clr_character_flag = recipient_for_@FROM
			}
			ROOT = {
				set_character_flag = recipient_for_@FROM
			}
#	Used to work this way:
# 			FROM = {
# 				any_opinion_modifier_target = {
# 					limit = {
# 						FROM = {
# 							has_opinion_modifier = {
# 								who = PREV
# 								modifier = transfer_recipient
# 							}
# 						}
# 					}
# 					FROM = {
# 						hidden_tooltip = {
# 							remove_opinion = {
# 								who = PREV
# 								modifier = transfer_recipient
# 							}
# 						}
# 					}
# 				}
# 				hidden_tooltip = {
# 					opinion = {
# 						who = ROOT
# 						modifier = transfer_recipient
# 					}
# 				}
# 			}
		}
	}

	transfer_vassalage_v = {
		filter = all_including_me # realm # only transfers within the realm
		ai_target_filter = self

		from_potential = {
			ai = no
		}

		potential = {
			always = yes
		}

		allow = {
			always = yes
		}

		effect = {
			any_character = {
				limit = { has_character_flag = recipient_for_@FROM }
				ROOT = {
					set_defacto_liege = PREV
				}
				break = yes
			}
			ROOT = {
				set_defacto_liege = FROM
			}
#	Used to work this way:
# 			FROM = {
# 				if = {
# 					limit = { has_any_opinion_modifier = transfer_recipient }
# 					random_opinion_modifier_target = {
# 						limit = {
# 							FROM = {
# 								has_opinion_modifier = {
# 									who = PREV
# 									modifier = transfer_recipient
# 								}
# 							}
# 						}
# 						ROOT = {
# 							set_defacto_liege = PREV
# 						}
# 					}
# 				}
# 				if = {
# 					limit = { NOT = { has_any_opinion_modifier = transfer_recipient } }
# 					ROOT = {
# 						set_defacto_liege = PREV
# 					}
# 				}
# 			}
		}
	}
}

title_decisions = {
	transfer_vassalage_t = {
		filter = all # realm_owned # only transfers within the realm
		ai_target_filter = owned

		from_potential = {
			ai = no
		}

		potential = {
			always = yes
		}

		allow = {
			always = yes
		}

		effect = {
			any_character = {
				limit = { has_character_flag = recipient_for_@FROM }
				ROOT = {
					holder_scope = {
						set_defacto_liege = PREVPREV
					}
				}
				break = yes
			}
			ROOT = {
					holder_scope = {
						set_defacto_liege = FROM
					}
			}
#	Used to work this way:
# 			FROM = {
# 				if = {
# 					limit = { has_any_opinion_modifier = transfer_recipient }
# 					random_opinion_modifier_target = {
# 						limit = {
# 							FROM = {
# 								has_opinion_modifier = {
# 									who = PREV
# 									modifier = transfer_recipient
# 								}
# 							}
# 						}
# 						ROOT = {
# 							holder_scope = {
# 								set_defacto_liege = PREVPREV
# 							}
# 						}
# 					}
# 				}
# 				if = {
# 					limit = { NOT = { has_any_opinion_modifier = transfer_recipient } }
# 					ROOT = {
# 						holder_scope = {
# 							set_defacto_liege = PREV
# 						}
# 					}
# 				}
# 			}
		}
	}

	transfer_title = {
		filter = all # realm_owned # only transfers within the realm
		ai_target_filter = owned

		from_potential = {
			ai = no
		}

		potential = {
			always = yes
		}

		allow = {
			always = yes
		}

		effect = {
			any_character = {
				limit = { has_character_flag = recipient_for_@FROM }
				ROOT = {
					grant_title = PREV
				}
				break = yes
			}
			ROOT = {
				grant_title = FROM
			}
#	Used to work this way:
# 			FROM = {
# 				if = {
# 					limit = { has_any_opinion_modifier = transfer_recipient }
# 					random_opinion_modifier_target = {
# 						limit = {
# 							FROM = {
# 								has_opinion_modifier = {
# 									who = PREV
# 									modifier = transfer_recipient
# 								}
# 							}
# 						}
# 						ROOT = {
# 							grant_title = PREV
# 						}
# 					}
# 				}
# 				if = {
# 					limit = { NOT = { has_any_opinion_modifier = transfer_recipient } }
# 					ROOT = {
# 						grant_title = PREV
# 					}
# 				}
# 			}
		}
	}
}
