p3_seed_confederations = { set_variable = { name = p3_confed_spawned value = 0 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = west_slavic } } } scripted_effect = p3_spawn_confed_1 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = czech } } } scripted_effect = p3_spawn_confed_2 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = polish } } } scripted_effect = p3_spawn_confed_3 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = sorbian } } } scripted_effect = p3_spawn_confed_4 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = ruthenian } } } scripted_effect = p3_spawn_confed_5 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = novgorodian } } } scripted_effect = p3_spawn_confed_6 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = east_slavic } } } scripted_effect = p3_spawn_confed_7 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = south_slavic } } } scripted_effect = p3_spawn_confed_8 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = croatian } } } scripted_effect = p3_spawn_confed_9 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = serbian } } } scripted_effect = p3_spawn_confed_10 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = bulgarian } } } scripted_effect = p3_spawn_confed_11 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = vlach } } } scripted_effect = p3_spawn_confed_12 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = greek } } } scripted_effect = p3_spawn_confed_13 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = armenian } } } scripted_effect = p3_spawn_confed_14 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = georgian } } } scripted_effect = p3_spawn_confed_15 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = albanian } } } scripted_effect = p3_spawn_confed_16 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = hungarian } } } scripted_effect = p3_spawn_confed_17 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = bohemian } } } scripted_effect = p3_spawn_confed_18 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = moravian } } } scripted_effect = p3_spawn_confed_19 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = baltic } } } scripted_effect = p3_spawn_confed_20 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = lithuanian } } } scripted_effect = p3_spawn_confed_21 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = prussian } } } scripted_effect = p3_spawn_confed_22 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = latvian } } } scripted_effect = p3_spawn_confed_23 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = finnish } } } scripted_effect = p3_spawn_confed_24 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = sami } } } scripted_effect = p3_spawn_confed_25 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = swedish } } } scripted_effect = p3_spawn_confed_26 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = norwegian } } } scripted_effect = p3_spawn_confed_27 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = danish } } } scripted_effect = p3_spawn_confed_28 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = frisian } } } scripted_effect = p3_spawn_confed_29 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = saxon } } } scripted_effect = p3_spawn_confed_30 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = bavarian } } } scripted_effect = p3_spawn_confed_31 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = swabian } } } scripted_effect = p3_spawn_confed_32 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = frankish } } } scripted_effect = p3_spawn_confed_33 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = occitan } } } scripted_effect = p3_spawn_confed_34 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = catalan } } } scripted_effect = p3_spawn_confed_35 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = castilian } } } scripted_effect = p3_spawn_confed_36 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = basque } } } scripted_effect = p3_spawn_confed_37 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = breton } } } scripted_effect = p3_spawn_confed_38 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = welsh } } } scripted_effect = p3_spawn_confed_39 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = irish } } } scripted_effect = p3_spawn_confed_40 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = anglo_saxon } } } scripted_effect = p3_spawn_confed_41 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = norse } } } scripted_effect = p3_spawn_confed_42 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = berber } } } scripted_effect = p3_spawn_confed_43 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = maghrebi } } } scripted_effect = p3_spawn_confed_44 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = bedouin } } } scripted_effect = p3_spawn_confed_45 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = mashriqi } } } scripted_effect = p3_spawn_confed_46 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = kurdish } } } scripted_effect = p3_spawn_confed_47 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = persian } } } scripted_effect = p3_spawn_confed_48 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = daylamite } } } scripted_effect = p3_spawn_confed_49 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = tajik } } } scripted_effect = p3_spawn_confed_50 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = ethiopian } } } scripted_effect = p3_spawn_confed_51 }
  if = { limit = { any_independent_ruler = { culture = { has_culture = somali } } } scripted_effect = p3_spawn_confed_52 }
  if = { limit = { check_variable = { which = p3_confed_spawned value < 50 } } repeat = { times = 10 scripted_effect = p3_spawn_confed_fallback } } }

p3_spawn_confed_1 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_WEST_SLAVIC save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = west_slavic } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_2 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_CZECH save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = czech } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_3 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_POLISH save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = polish } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_4 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_SORBIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = sorbian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_5 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_RUTHENIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = ruthenian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_6 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_NOVGORODIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = novgorodian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_7 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_EAST_SLAVIC save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = east_slavic } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_8 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_SOUTH_SLAVIC save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = south_slavic } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_9 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_CROATIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = croatian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_10 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_SERBIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = serbian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_11 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_BULGARIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = bulgarian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_12 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_VLACH save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = vlach } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_13 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_GREEK_BALKANS save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = greek } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_14 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_ARMENIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = armenian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_15 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_GEORGIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = georgian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_16 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_ALBANIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = albanian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_17 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_HUNGARIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = hungarian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_18 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_BOHEMIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = bohemian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_19 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_MORAVIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = moravian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_20 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_BALTIC save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = baltic } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_21 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_LITHUANIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = lithuanian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_22 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_PRUSSIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = prussian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_23 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_LATGALIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = latvian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_24 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_FINNISH save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = finnish } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_25 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_SAMI save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = sami } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_26 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_SWEDISH save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = swedish } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_27 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_NORWEGIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = norwegian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_28 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_DANISH save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = danish } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_29 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_FRISIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = frisian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_30 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_SAXON save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = saxon } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_31 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_BAVARIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = bavarian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_32 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_SWABIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = swabian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_33 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_FRANKISH save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = frankish } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_34 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_OCCITAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = occitan } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_35 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_CATALAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = catalan } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_36 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_CASTILIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = castilian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_37 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_BASQUE save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = basque } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_38 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_BRETON save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = breton } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_39 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_WELSH save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = welsh } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_40 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_IRISH save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = irish } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_41 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_ANGLO_SAXON save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = anglo_saxon } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_42 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_NORSE save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = norse } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_43 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_BERBER_ATLAS save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = berber } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_44 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_MAGHREBI save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = maghrebi } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_45 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_BEDOUIN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = bedouin } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_46 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_MASHRIQI save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = mashriqi } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_47 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_KURDISH save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = kurdish } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_48 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_PERSIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = persian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_49 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_DAYLAMITE save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = daylamite } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_50 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_TAJIK save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = tajik } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_51 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_ETHIOPIAN save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = ethiopian } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_52 = {
  if = {
    limit = { check_variable = { which = p3_confed_spawned value < 65 } }
    create_title = { tier = duchy landless = yes temporary = yes custom_created = yes name = P3_CONFED_SOMALI save_scope_as = p3_confed_title }
    every_independent_ruler = {
      limit = { culture = { has_culture = somali } realm_size <= 80 NOT = { at_war = yes } }
      random = 0.25 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes }
    }
    change_variable = { which = p3_confed_spawned value = 1 }
  }
}

p3_spawn_confed_fallback = {
  create_title = { tier = duchy landless = yes temporary = yes custom_created = yes save_scope_as = p3_confed_title }
  every_independent_ruler = { limit = { realm_size <= 60 NOT = { at_war = yes } } random = 0.10 add_alliance = scope:p3_confed_title add_character_modifier = { modifier = p3_confed_member hidden = yes } }
  change_variable = { which = p3_confed_spawned value = 1 }
}
