p3_assign_variable_personality = {
  random_list = {
    25 = { set_variable = { name = p3_trait_target value = 1 } }
    35 = { set_variable = { name = p3_trait_target value = 2 } }
    25 = { set_variable = { name = p3_trait_target value = 3 } }
    10 = { set_variable = { name = p3_trait_target value = 4 } }
    4  = { set_variable = { name = p3_trait_target value = 5 } }
    1  = { set_variable = { name = p3_trait_target value = 6 } }
  }
  scripted_effect = p3_fill_personality_to_target
}
p3_assign_birth_personality = {
  random_list = {
    60 = { set_variable = { name = p3_trait_target value = 1 } }
    35 = { set_variable = { name = p3_trait_target value = 2 } }
    5  = { set_variable = { name = p3_trait_target value = 3 } }
  }
  scripted_effect = p3_fill_personality_to_target
}
p3_fill_personality_to_target = {
  while = { limit = { check_variable = { which = p3_trait_target value > personality_traits_count } personality_traits_count < 6 } add_random_personality_trait = yes }
  clr_variable = p3_trait_target
}
p3_house_cooperation = { if = { limit = { p3_is_same_house_or_dynasty = yes } add_opinion = { target = scope:other modifier = p3_house_bond duration = 3650 } add_alliance = scope:other } }
p3_try_form_confederation = {
  if = { limit = { p3_region_has_eligible_cluster = yes }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes save_scope_as = confed_title }
    every_independent_ruler = { limit = { realm_size <= 200 NOT = { at_war = yes } } random = 0.15 add_alliance = scope:confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes } }
  }
}
p3_push_culture_union = {
  if = { limit = { scope:target.is_independent = yes scope:me.culture = scope:target.culture opinion = { who = scope:me value >= 50 } scope:target.realm_size <= 25 NOT = { at_war = yes } } scope:target = { become_vassal = scope:me } }
}
p3_push_faith_union = {
  if = { limit = { scope:target.is_independent = yes scope:me.faith = scope:target.faith opinion = { who = scope:me value >= 60 } scope:target.realm_size <= 20 } scope:target = { become_vassal = scope:me } }
}