(assign, ":break_loop", 0),
(try_for_range, ":cur_lord", lords_begin, lords_end),
(eq, ":break_loop", 0),
(troop_get_slot, ":is_alive", ":cur_lord", slot_troop_is_alive),
(lt, ":is_alive", 1), ### dead or inactive
(assign, ":break_loop", 1), ### breaks loop
(call_script, "script_recycle_lord", ":cur_lord", ":faction_no"), ## recycle the mofo
(try_begin), ### CULTURE
(call_script, "script_get_random_culture_for_lord", ":faction_no"), ## gets a random culture based on proximity
(assign, ":cur_lord_culture", reg0),
(assign, ":cur_lord_culture", reg0),
(troop_set_slot, ":cur_lord", slot_troop_cur_culture, ":cur_lord_culture"), ## applies the culture to lord
(troop_set_faction, ":cur_lord", ":faction_no"), ## applies the faction
(str_store_troop_name, s6, ":cur_lord"),
(str_store_faction_name, s7, ":cur_lord_culture"),
(display_message, "@{s6} culture is {s7}."),
(try_end),
(try_begin), ### NAME
(call_script, "script_get_random_name_for_lord", ":faction_no", ":cur_lord_culture"), ## gets a random name based on culture
(str_clear, s4),
(str_store_string, s4, reg0),
(troop_set_name, ":cur_lord", s4),
(try_end),
(try_begin), ### CREATE PARTY
(assign, ":break_loop", 0),
(try_for_range, ":center_no", walled_centers_begin, walled_centers_end),
(eq, ":break_loop", 0),
(store_faction_of_party, ":cur_center_faction", ":center_no"),
(eq, ":faction_no", ":cur_center_faction"),
(assign, ":break_loop", 1), ### breaks loop
(call_script, "script_create_kingdom_hero_party", ":cur_lord", ":center_no"),
(assign, ":lords_party", "$pout_party"),
(party_attach_to_party, ":lords_party", ":center_no"),
(str_store_troop_name, s5, ":cur_lord"),
(party_set_name, "$pout_party", "str_s5_s_party"), ### sets the party name
(troop_set_slot, ":cur_lord", slot_troop_cur_center, ":center_no"),
(party_set_faction, ":cur_lord", ":faction_no"), ## applies the faction
(str_store_troop_name, s6, ":cur_lord"),
(str_store_faction_name, s7, ":center_no"),
(display_message, "@{s6} party created at {s7}."),
(try_end),
(try_end),
(troop_set_slot, ":cur_lord", slot_troop_is_alive, 1), ### he's active now