
namespace = PSUCB

character_event = {
id = PSUCB.0000					

is_triggered_only = yes
hide_window = yes					

trigger = { 
    has_game_rule = {
   		name = attribute_succession
 		value = diplomacy
    }
	has_law = most_prestige_succession_law_1
	is_ruler = yes
	is_theocracy = no
	is_republic = no
	is_merchant_republic = no
}


option = {
	name = PSUCB.0000	
	
		primary_title = {
			save_event_target_as = prestige_title
		}
		export_to_variable = { which = global_wealthtransfer value = wealth }
		any_close_relative = {
			# DYNASTY
			if = {					# Es gibt volljhrige Kinder
				limit = {
					is_child_of = ROOT
					dynasty = ROOT
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_child_of = ROOT
											dynasty = ROOT
											is_female = yes
											age = 16
											OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
												is_ruler = no
												AND = { 
													is_ruler = yes
													primary_title = { 
														NOR = { 
															holy_order = yes
															mercenary  = yes
														}
													} 
												}
											}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_child_of = ROOT
											dynasty = ROOT
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}																						
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}
					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 1 }
			}
			else_if = {				# Es gibt volljhrige Enkel
				limit = {
					NOT = { is_variable_equal = { which = global_relativesone value = 1 } } 	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
					is_grandchild_of = ROOT
					dynasty = ROOT
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_grandchild_of = ROOT
											dynasty = ROOT
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}																						
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_grandchild_of = ROOT
											dynasty = ROOT
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}																						
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 2 }
			}
			else_if = {				# Es gibt volljhrige Geschwister
				limit = {
					NOR = { 	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
						is_variable_equal = { which = global_relativesone value = 1 } 
						is_variable_equal = { which = global_relativesone value = 2 }
					}
					sibling = ROOT
					dynasty = ROOT
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											sibling = ROOT
											dynasty = ROOT
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											sibling = ROOT
											dynasty = ROOT
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 3 }
			}
			else_if = {				# Es gibt volljhrige Nephen
				limit = {
					NOR = {  	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
						is_variable_equal = { which = global_relativesone value = 1 } 
						is_variable_equal = { which = global_relativesone value = 2 }
						is_variable_equal = { which = global_relativesone value = 3 }
					}
					is_nibling_of = ROOT
					dynasty = ROOT
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_nibling_of = ROOT
											dynasty = ROOT
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_nibling_of = ROOT
											dynasty = ROOT
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 4 }
			}
			else_if = {				# Es gibt volljhrige Tanten/Onkel
				limit = {
					NOR = {  	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
						is_variable_equal = { which = global_relativesone value = 1 } 
						is_variable_equal = { which = global_relativesone value = 2 }
						is_variable_equal = { which = global_relativesone value = 3 }
						is_variable_equal = { which = global_relativesone value = 4 }
					}
					is_aunt_uncle_of = ROOT
					dynasty = ROOT
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_aunt_uncle_of = ROOT
											dynasty = ROOT
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_aunt_uncle_of = ROOT
											dynasty = ROOT
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 5 }
			}
			
			else_if = {				# Es gibt minderjhrige Kinder
				limit = {
					NOR = {  	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
						is_variable_equal = { which = global_relativesone value = 1 } 
						is_variable_equal = { which = global_relativesone value = 2 }
						is_variable_equal = { which = global_relativesone value = 3 }
						is_variable_equal = { which = global_relativesone value = 4 }
						is_variable_equal = { which = global_relativesone value = 5 }
					}
					is_child_of = ROOT
					dynasty = ROOT
					NOT = { age = 16 }
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_child_of = ROOT
											dynasty = ROOT
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_child_of = ROOT
											dynasty = ROOT
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 6 }
			}
			else_if = {				# Es gibt minderjhrige Enkel
				limit = {
					NOR = {  	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
						is_variable_equal = { which = global_relativesone value = 1 } 
						is_variable_equal = { which = global_relativesone value = 2 }
						is_variable_equal = { which = global_relativesone value = 3 }
						is_variable_equal = { which = global_relativesone value = 4 }
						is_variable_equal = { which = global_relativesone value = 5 }
						is_variable_equal = { which = global_relativesone value = 6 }
					}
					is_grandchild_of = ROOT
					dynasty = ROOT
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_grandchild_of = ROOT
											dynasty = ROOT
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_grandchild_of = ROOT
											dynasty = ROOT
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 7 }
			}
			else_if = {				# Es gibt minderjhrige Geschwister
				limit = {
					NOR = {  	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
						is_variable_equal = { which = global_relativesone value = 1 } 
						is_variable_equal = { which = global_relativesone value = 2 }
						is_variable_equal = { which = global_relativesone value = 3 }
						is_variable_equal = { which = global_relativesone value = 4 }
						is_variable_equal = { which = global_relativesone value = 5 }
						is_variable_equal = { which = global_relativesone value = 6 }
						is_variable_equal = { which = global_relativesone value = 7 }
					}
					sibling = ROOT
					dynasty = ROOT
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											sibling = ROOT
											dynasty = ROOT
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											sibling = ROOT
											dynasty = ROOT
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 8 }
			}
			else_if = {				# Es gibt minderjhrige Nephen
				limit = {
					NOR = {  	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
						is_variable_equal = { which = global_relativesone value = 1 } 
						is_variable_equal = { which = global_relativesone value = 2 }
						is_variable_equal = { which = global_relativesone value = 3 }
						is_variable_equal = { which = global_relativesone value = 4 }
						is_variable_equal = { which = global_relativesone value = 5 }
						is_variable_equal = { which = global_relativesone value = 6 }
						is_variable_equal = { which = global_relativesone value = 7 }
						is_variable_equal = { which = global_relativesone value = 8 }
					}
					is_nibling_of = ROOT
					dynasty = ROOT
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_nibling_of = ROOT
											dynasty = ROOT
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_nibling_of = ROOT
											dynasty = ROOT
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 9 }
			}
			else_if = {				# Es gibt minderjhrige Tanten/Onkel
				limit = {
					NOR = {  	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
						is_variable_equal = { which = global_relativesone value = 1 } 
						is_variable_equal = { which = global_relativesone value = 2 }
						is_variable_equal = { which = global_relativesone value = 3 }
						is_variable_equal = { which = global_relativesone value = 4 }
						is_variable_equal = { which = global_relativesone value = 5 }
						is_variable_equal = { which = global_relativesone value = 6 }
						is_variable_equal = { which = global_relativesone value = 7 }
						is_variable_equal = { which = global_relativesone value = 8 }
						is_variable_equal = { which = global_relativesone value = 9 }
					}
					is_aunt_uncle_of = ROOT
					dynasty = ROOT
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_aunt_uncle_of = ROOT
											dynasty = ROOT
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_aunt_uncle_of = ROOT
											dynasty = ROOT
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 10 }
			}
			
			# NON-DYNASTY
			else_if = {				# Es gibt volljhrige Kinder
				limit = {
					is_child_of = ROOT
					NOT = { dynasty = ROOT }
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_child_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											age = 16
											OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
												is_ruler = no
												AND = { 
													is_ruler = yes
													primary_title = { 
														NOR = { 
															holy_order = yes
															mercenary  = yes
														}
													} 
												}
											}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_child_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}																						
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}
					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 1 }
			}
			else_if = {				# Es gibt volljhrige Enkel
				limit = {
					NOT = { is_variable_equal = { which = global_relativesone value = 1 } } 	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
					is_grandchild_of = ROOT
					NOT = { dynasty = ROOT }
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_grandchild_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}																						
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_grandchild_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}																						
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 2 }
			}
			else_if = {				# Es gibt volljhrige Geschwister
				limit = {
					NOR = { 	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
						is_variable_equal = { which = global_relativesone value = 1 } 
						is_variable_equal = { which = global_relativesone value = 2 }
					}
					sibling = ROOT
					NOT = { dynasty = ROOT }
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											sibling = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											sibling = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 3 }
			}
			else_if = {				# Es gibt volljhrige Nephen
				limit = {
					NOR = {  	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
						is_variable_equal = { which = global_relativesone value = 1 } 
						is_variable_equal = { which = global_relativesone value = 2 }
						is_variable_equal = { which = global_relativesone value = 3 }
					}
					is_nibling_of = ROOT
					NOT = { dynasty = ROOT }
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_nibling_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_nibling_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 4 }
			}
			else_if = {				# Es gibt volljhrige Tanten/Onkel
				limit = {
					NOR = {  	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
						is_variable_equal = { which = global_relativesone value = 1 } 
						is_variable_equal = { which = global_relativesone value = 2 }
						is_variable_equal = { which = global_relativesone value = 3 }
						is_variable_equal = { which = global_relativesone value = 4 }
					}
					is_aunt_uncle_of = ROOT
					NOT = { dynasty = ROOT }
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_aunt_uncle_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_aunt_uncle_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 5 }
			}
			
			else_if = {				# Es gibt minderjhrige Kinder
				limit = {
					NOR = {  	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
						is_variable_equal = { which = global_relativesone value = 1 } 
						is_variable_equal = { which = global_relativesone value = 2 }
						is_variable_equal = { which = global_relativesone value = 3 }
						is_variable_equal = { which = global_relativesone value = 4 }
						is_variable_equal = { which = global_relativesone value = 5 }
					}
					is_child_of = ROOT
					NOT = { dynasty = ROOT }
					NOT = { age = 16 }
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_child_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_child_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 6 }
			}
			else_if = {				# Es gibt minderjhrige Enkel
				limit = {
					NOR = {  	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
						is_variable_equal = { which = global_relativesone value = 1 } 
						is_variable_equal = { which = global_relativesone value = 2 }
						is_variable_equal = { which = global_relativesone value = 3 }
						is_variable_equal = { which = global_relativesone value = 4 }
						is_variable_equal = { which = global_relativesone value = 5 }
						is_variable_equal = { which = global_relativesone value = 6 }
					}
					is_grandchild_of = ROOT
					NOT = { dynasty = ROOT }
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_grandchild_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_grandchild_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 7 }
			}
			else_if = {				# Es gibt minderjhrige Geschwister
				limit = {
					NOR = {  	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
						is_variable_equal = { which = global_relativesone value = 1 } 
						is_variable_equal = { which = global_relativesone value = 2 }
						is_variable_equal = { which = global_relativesone value = 3 }
						is_variable_equal = { which = global_relativesone value = 4 }
						is_variable_equal = { which = global_relativesone value = 5 }
						is_variable_equal = { which = global_relativesone value = 6 }
						is_variable_equal = { which = global_relativesone value = 7 }
					}
					sibling = ROOT
					NOT = { dynasty = ROOT }
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											sibling = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											sibling = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 8 }
			}
			else_if = {				# Es gibt minderjhrige Nephen
				limit = {
					NOR = {  	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
						is_variable_equal = { which = global_relativesone value = 1 } 
						is_variable_equal = { which = global_relativesone value = 2 }
						is_variable_equal = { which = global_relativesone value = 3 }
						is_variable_equal = { which = global_relativesone value = 4 }
						is_variable_equal = { which = global_relativesone value = 5 }
						is_variable_equal = { which = global_relativesone value = 6 }
						is_variable_equal = { which = global_relativesone value = 7 }
						is_variable_equal = { which = global_relativesone value = 8 }
					}
					is_nibling_of = ROOT
					NOT = { dynasty = ROOT }
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_nibling_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_nibling_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 9 }
			}
			else_if = {				# Es gibt minderjhrige Tanten/Onkel
				limit = {
					NOR = {  	# Vergewissert sich, dass es im Vorfeld nicht bereits einen Treffer gab (also z.B. das volljhrige Kinder gefunden wurden)
						is_variable_equal = { which = global_relativesone value = 1 } 
						is_variable_equal = { which = global_relativesone value = 2 }
						is_variable_equal = { which = global_relativesone value = 3 }
						is_variable_equal = { which = global_relativesone value = 4 }
						is_variable_equal = { which = global_relativesone value = 5 }
						is_variable_equal = { which = global_relativesone value = 6 }
						is_variable_equal = { which = global_relativesone value = 7 }
						is_variable_equal = { which = global_relativesone value = 8 }
						is_variable_equal = { which = global_relativesone value = 9 }
					}
					is_aunt_uncle_of = ROOT
					NOT = { dynasty = ROOT }
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_aunt_uncle_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_aunt_uncle_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				export_to_variable = { which = prestigecomp value = diplomacy }		# Jedes Kind erhlt eine Variable, die seinem Prestige-Wert entspricht
				if = {									# Falls eine dieser individuellen Prestige-Werte grer als der globale Prestige-Vergleichswert ist, wird dieser auch auf den entsprechenden Prestige-Wert gesetzt (so ist zum Schluss der globale Wert = dem hchsten Prestige-Wert, der unter den Kandidaten zu finden ist)
					limit = {
						check_variable = { which = prestigecomp which = global_prestigecomp } 	# prestigecomp >= global_prestigecomp
					}
					export_to_variable = { which = global_prestigecomp value = diplomacy }
				}
				set_variable = { which = global_relativesone value = 10 }
			}
		}
 		any_close_relative = {			# Diese separate Klammer ist ntig, weil sonst die erste any_close_relative Klammer nicht fr alle betroffenen Charaktere durchluft, bevor dieser zweite Teil hier startet.
			# DYNASTY
			if = {				# Es gibt volljhrige Kinder
				limit = {
					is_variable_equal = { which = global_relativesone value = 1 }
					is_child_of = ROOT
					dynasty = ROOT
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_child_of = ROOT
											dynasty = ROOT
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_child_of = ROOT
											dynasty = ROOT
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			else_if = {			# Es gibt volljhrige Enkelkinder
				limit = {
					is_variable_equal = { which = global_relativesone value = 2 }
					is_grandchild_of = ROOT
					dynasty = ROOT
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_grandchild_of = ROOT
											dynasty = ROOT
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_grandchild_of = ROOT
											dynasty = ROOT
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			else_if = {			# Es gibt volljhrige Geschwister
				limit = {
					is_variable_equal = { which = global_relativesone value = 3 }
					sibling = ROOT
					dynasty = ROOT
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											sibling = ROOT
											dynasty = ROOT
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											sibling = ROOT
											dynasty = ROOT
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			else_if = {			# Es gibt volljhrige Neffen
				limit = {
					is_variable_equal = { which = global_relativesone value = 4 }
					is_nibling_of = ROOT
					dynasty = ROOT
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_nibling_of = ROOT
											dynasty = ROOT
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_nibling_of = ROOT
											dynasty = ROOT
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			else_if = {			# Es gibt volljhrige Tanten/Onkel
				limit = {
					is_variable_equal = { which = global_relativesone value = 5 }
					is_aunt_uncle_of = ROOT
					dynasty = ROOT
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_aunt_uncle_of = ROOT
											dynasty = ROOT
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_aunt_uncle_of = ROOT
											dynasty = ROOT
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			
			else_if = {			# Es gibt minderjhrige Kinder
				limit = {
					is_variable_equal = { which = global_relativesone value = 6 }
					is_child_of = ROOT
					dynasty = ROOT
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_child_of = ROOT
											dynasty = ROOT
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_child_of = ROOT
											dynasty = ROOT
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			else_if = {			# Es gibt minderjhrige Enkel
				limit = {
					is_variable_equal = { which = global_relativesone value = 7 }
					is_grandchild_of = ROOT
					dynasty = ROOT
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_grandchild_of = ROOT
											dynasty = ROOT
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_grandchild_of = ROOT
											dynasty = ROOT
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			else_if = {			# Es gibt minderjhrige Geschwister
				limit = {
					is_variable_equal = { which = global_relativesone value = 8 }
					sibling = ROOT
					dynasty = ROOT
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											sibling = ROOT
											dynasty = ROOT
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											sibling = ROOT
											dynasty = ROOT
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			else_if = {			# Es gibt minderjhrige Neffen
				limit = {
					is_variable_equal = { which = global_relativesone value = 9 }
					is_nibling_of = ROOT
					dynasty = ROOT
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_nibling_of = ROOT
											dynasty = ROOT
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_nibling_of = ROOT
											dynasty = ROOT
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			else_if = {			# Es gibt minderjhrige Tanten/Onkel
				limit = {
					is_variable_equal = { which = global_relativesone value = 10 }
					is_aunt_uncle_of = ROOT
					dynasty = ROOT
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_aunt_uncle_of = ROOT
											dynasty = ROOT
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_aunt_uncle_of = ROOT
											dynasty = ROOT
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 

			# NON-DYNASTY			
			else_if = {			# Es gibt volljhrige Kinder
				limit = {
					is_variable_equal = { which = global_relativesone value = 1 }
					is_child_of = ROOT
					NOT = { dynasty = ROOT }
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_child_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_child_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			else_if = {			# Es gibt volljhrige Enkelkinder
				limit = {
					is_variable_equal = { which = global_relativesone value = 2 }
					is_grandchild_of = ROOT
					NOT = { dynasty = ROOT }
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_grandchild_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_grandchild_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			else_if = {			# Es gibt volljhrige Geschwister
				limit = {
					is_variable_equal = { which = global_relativesone value = 3 }
					sibling = ROOT
					NOT = { dynasty = ROOT }
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											sibling = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											sibling = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			else_if = {			# Es gibt volljhrige Neffen
				limit = {
					is_variable_equal = { which = global_relativesone value = 4 }
					is_nibling_of = ROOT
					NOT = { dynasty = ROOT }
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_nibling_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_nibling_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			else_if = {			# Es gibt volljhrige Tanten/Onkel
				limit = {
					is_variable_equal = { which = global_relativesone value = 5 }
					is_aunt_uncle_of = ROOT
					NOT = { dynasty = ROOT }
					age = 16 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_aunt_uncle_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_aunt_uncle_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											age = 16
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			
			else_if = {			# Es gibt minderjhrige Kinder
				limit = {
					is_variable_equal = { which = global_relativesone value = 6 }
					is_child_of = ROOT
					NOT = { dynasty = ROOT }
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_child_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_child_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			else_if = {			# Es gibt minderjhrige Enkel
				limit = {
					is_variable_equal = { which = global_relativesone value = 7 }
					is_grandchild_of = ROOT
					NOT = { dynasty = ROOT }
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_grandchild_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_grandchild_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			else_if = {			# Es gibt minderjhrige Geschwister
				limit = {
					is_variable_equal = { which = global_relativesone value = 8 }
					sibling = ROOT
					NOT = { dynasty = ROOT }
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											sibling = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											sibling = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			else_if = {			# Es gibt minderjhrige Neffen
				limit = {
					is_variable_equal = { which = global_relativesone value = 9 }
					is_nibling_of = ROOT
					NOT = { dynasty = ROOT }
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_nibling_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_nibling_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			} 
			else_if = {			# Es gibt minderjhrige Tanten/Onkel
				limit = {
					is_variable_equal = { which = global_relativesone value = 10 }
					is_aunt_uncle_of = ROOT
					NOT = { dynasty = ROOT }
					NOT = { age = 16 } 
					OR = {		# Geschlechtsvoraussetzungen basierend auf der Erbfolgeregelung
						AND = {
							ROOT = { has_law = enatic_succession }
							is_female = yes
						}
						AND = {
							ROOT = { has_law = agnatic_succession }
							is_female = no
						}
						AND = {
							ROOT = { has_law = enatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist weiblich oder es gibt keine volljhrigen, weiblichen Verwandten
								is_female = yes
								ROOT = {
									NOT = {
										any_close_relative = {
											is_aunt_uncle_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = yes
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						AND = {
							ROOT = { has_law = agnatic_cognatic_succession }
							OR = {									# Entweder der Verwandte ist mnnlich oder es gibt keine volljhrigen, mnnlichen Verwandten
								is_female = no
								ROOT = {
									NOT = {
										any_close_relative = {
											is_aunt_uncle_of = ROOT
											NOT = { dynasty = ROOT }
											is_female = no
											NOT = { age = 16 }
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}											
											# brigen Voraussetzungen
											NOR = { 
												trait = crusader_king 
												trait = crusader_queen
											} 
											OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
												any_liege = { 
													character = ROOT
												} 
												is_ruler = no
												ROOT_FROMFROM = { holder_scope = { independent = yes } }
												NOR = { 
													ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
													ROOT_FROMFROM = { has_law = crown_authority_3 } 
													ROOT_FROMFROM = { has_law = crown_authority_4 } 
												} 
											} 
											OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
												AND = {
													is_ruler = yes
													is_landed = yes
													is_republic = no
													is_merchant_republic = no
													is_theocracy = no
												}
												NOR = {
													any_heir_title = {
														is_republic = yes
													}
													any_heir_title = {
														is_merchant_republic = yes
													}
													any_heir_title = {
														is_theocracy = yes
													}
												}
											}
											OR = { #If the title controls the religion, candidates must be of the same religion.
												ROOT = { 
													NOT = { 
														controls_religion = yes
													}
												}
												religion = ROOT
											}
											NOR = {
												trait = nordicfemale
												trait = cat
												trait = disinherited
												trait = horse
												trait = eunuch
												trait = bastard
												is_ascetic_trigger = yes
												is_theocracy = yes
												is_republic = yes
												is_merchant_republic = yes
											}											
										}
									}
								}
							}
						}
						ROOT = { has_law = true_cognatic_succession }
					}
					OR = {		# Kandidat ist entweder kein Herrscher oder der Primrtitel ist nicht ein Ritterorden oder ein Sldnertrupp
						is_ruler = no
						AND = { 
							is_ruler = yes
							primary_title = { 
								NOR = { 
									holy_order = yes
									mercenary  = yes
								}
							} 
						}
					}					
							# brigen Voraussetzungen
							NOR = { 
								trait = crusader_king 
								trait = crusader_queen
							} 
							OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
								any_liege = { 
									character = ROOT
								} 
								is_ruler = no
								ROOT_FROMFROM = { holder_scope = { independent = yes } }
								NOR = { 
									ROOT_FROMFROM = { has_law = out_of_realm_inheritance_law_1 } 
									ROOT_FROMFROM = { has_law = crown_authority_3 } 
									ROOT_FROMFROM = { has_law = crown_authority_4 } 
								} 
							} 
							OR = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
								AND = {
									is_ruler = yes
									is_landed = yes
									is_republic = no
									is_merchant_republic = no
									is_theocracy = no
								}
								NOR = {
									any_heir_title = {
										is_republic = yes
									}
									any_heir_title = {
										is_merchant_republic = yes
									}
									any_heir_title = {
										is_theocracy = yes
									}
								}
							}
							OR = { #If the title controls the religion, candidates must be of the same religion.
								ROOT = { 
									NOT = { 
										controls_religion = yes
									}
								}
								religion = ROOT
							}
							NOR = {
								trait = nordicfemale
								trait = cat
								trait = disinherited
								trait = horse
								trait = eunuch
								trait = bastard
								is_ascetic_trigger = yes
								is_theocracy = yes
								is_republic = yes
								is_merchant_republic = yes
							}
				}
				character_event = { id = PSUCB.0001 } 
			}
		} 
	}
}


character_event = {			
id = PSUCB.0001					


is_triggered_only = yes
hide_window = yes									


option = {
	name = PSUCB.0001

		if = {		# Wenn weder Courtier, noch unabhngiger Herrscher, noch liege ist der Verstorbene (man ist also ein Vasall eines fremden Herrschers)
			limit = {
				NOR = {
					is_ruler = no
					AND = {
						is_ruler = yes
						independent = yes
					}
					liege = { character = FROM }
				}
			}
			liege = { 	# speichert alle potentiellen lieges als event targets
				save_event_target_as = old_liege_count
				primary_title = {
					save_event_target_as = liege_title_count
				}
				liege = { 
					save_event_target_as = old_liege_duke
					primary_title = {
						save_event_target_as = liege_title_duke
					}
					liege = { 
						save_event_target_as = old_liege_king
						primary_title = {
							save_event_target_as = liege_title_king
						}
						liege = { 
							save_event_target_as = old_liege_emperor
							primary_title = {
								save_event_target_as = liege_title_emperor
							}
						}
					}
				}
			}
		}
		if = {		# Wenn das individuelle Prestige eines Chrakter gleich dem Max-Prestige ist, welches unter den Kandidaten zu finden ist, (d.h. wenn der Char derjenige mit dem hchsten Prestige ist) erhlt er den Titel
			limit = {
				check_variable = { which = prestigecomp which = global_prestigecomp }
			}
			inherit = FROM
			FROM = {					# Transferiert Artefakte
				any_artifact = {
					transfer_artifact = { from = FROM to = ROOT } 
				} 
			} 
			wealth = global_wealthtransfer	# bertrgt Geld und setzt es danach auf 0
			FROM = { clear_wealth = yes } 
			
			# Geht alle lieges durch (angefangen mit dem geringsten) und guckt, wo sich der Char, nachdem er den neuen Titel geerbt hat, einordnet
			if = {	# Wenn der alte liege (vorausgesetzt es gab einen) einen hhren Titel hatte als der geerbte Titel, wird man Vassal des alten lieges
				limit = {
					OR = {
						AND = {
							event_target:prestige_title = {
								tier = BARON
							}
							event_target:liege_title_count = {
								higher_tier_than = BARON
							}
						}
						AND = {
							event_target:prestige_title = {
								tier = COUNT
							}
							event_target:liege_title_count = {
								higher_tier_than = COUNT
							}
						}
						AND = {
							event_target:prestige_title = {
								tier = DUKE
							}
							event_target:liege_title_count = {
								higher_tier_than = DUKE
							}
						}
						AND = {
							event_target:prestige_title = {
								tier = KING
							}
							event_target:liege_title_count = {
								higher_tier_than = KING
							}
						}
					}
				}
				set_defacto_liege = event_target:old_liege_count
			}
			else_if = {	# Wenn der alte liege (vorausgesetzt es gab einen) einen hhren Titel hatte als der geerbte Titel, wird man Vassal des alten lieges
				limit = {
					OR = {
						AND = {
							event_target:prestige_title = {
								tier = BARON
							}
							event_target:liege_title_duke = {
								higher_tier_than = BARON
							}
						}
						AND = {
							event_target:prestige_title = {
								tier = COUNT
							}
							event_target:liege_title_duke = {
								higher_tier_than = COUNT
							}
						}
						AND = {
							event_target:prestige_title = {
								tier = DUKE
							}
							event_target:liege_title_duke = {
								higher_tier_than = DUKE
							}
						}
						AND = {
							event_target:prestige_title = {
								tier = KING
							}
							event_target:liege_title_duke = {
								higher_tier_than = KING
							}
						}
					}
				}
				set_defacto_liege = event_target:old_liege_duke
			}
			else_if = {	# Wenn der alte liege (vorausgesetzt es gab einen) einen hhren Titel hatte als der geerbte Titel, wird man Vassal des alten lieges
				limit = {
					OR = {
						AND = {
							event_target:prestige_title = {
								tier = BARON
							}
							event_target:liege_title_king = {
								higher_tier_than = BARON
							}
						}
						AND = {
							event_target:prestige_title = {
								tier = COUNT
							}
							event_target:liege_title_king = {
								higher_tier_than = COUNT
							}
						}
						AND = {
							event_target:prestige_title = {
								tier = DUKE
							}
							event_target:liege_title_king = {
								higher_tier_than = DUKE
							}
						}
						AND = {
							event_target:prestige_title = {
								tier = KING
							}
							event_target:liege_title_king = {
								higher_tier_than = KING
							}
						}
					}
				}
				set_defacto_liege = event_target:old_liege_king
			}
			else_if = {	# Wenn der alte liege (vorausgesetzt es gab einen) einen hhren Titel hatte als der geerbte Titel, wird man Vassal des alten lieges
				limit = {
					OR = {
						AND = {
							event_target:prestige_title = {
								tier = BARON
							}
							event_target:liege_title_emperor = {
								higher_tier_than = BARON
							}
						}
						AND = {
							event_target:prestige_title = {
								tier = COUNT
							}
							event_target:liege_title_emperor = {
								higher_tier_than = COUNT
							}
						}
						AND = {
							event_target:prestige_title = {
								tier = DUKE
							}
							event_target:liege_title_emperor = {
								higher_tier_than = DUKE
							}
						}
						AND = {
							event_target:prestige_title = {
								tier = KING
							}
							event_target:liege_title_emperor = {
								higher_tier_than = KING
							}
						}
					}
				}
				set_defacto_liege = event_target:old_liege_emperor
			}
		}		
		if = {		# Wenn der Primrtitel nicht mehr vom Verstorbenen (sondern von einem Kandidaten) gehalten wird, wird die Max-Prestige Variable auf 0 zurckgesetzt
			limit = {
				NOT = {
					event_target:prestige_title = {
						holder_scope = { character = FROM }
					}
				}
			}
			set_variable = { which = global_prestigecomp value = 0 }
			set_variable = { which = global_relativesone value = 0 }
			set_variable = { which = global_wealthtransfer value = 0 }
		}
	}
}