Ok, on my topic at taleworlds found
here on pages 13-16, I am working on a custom battle mod that will feature more than 1 unit. It is possible as you can tell if you look at the screen shots. I am having a problem selecting player units though. The text only shows that the first and last unit is being selected (so any in between are being skipped). The other problem is that when I tell the unit to hold (the last), the first unit moves, even if the last unit is selected.
Here are my message displays if I hit u twice and then h:
Peasant Bowmen Unit 1 selected
Man-at-arms Unit 3 selected
2
52 (because the 3rd unit slot number is 52, unit 1 50, unit 2 51)
Unit moving to hold position
So even though it shows that the 3rd unit is selected, the first unit moves. The only thing that I can think of, is that there is a problem with how I am assigning unit leaders, and if so Ill have to post that code, and that will be a pain to look at. If you need more info tell me...
# select unit
(0, 0, 0,
[(key_clicked, key_u), #u for next unit
],
[
(assign, "$qb_us", 1),
(val_add, "$qb_unit_tracker", 1),
(store_add, ":tracker", "$qb_unit_tracker", slot_scene_unit1),
(try_begin),
(scene_slot_eq,"$quick_battle_map",":tracker",0),
(assign, "$qb_unit_tracker", 0),
(store_add, ":tracker", "$qb_unit_tracker", slot_scene_unit1),
(try_end),
(scene_get_slot,":unit","$quick_battle_map",":tracker"),
(item_get_slot,":troop_id",":unit",slot_item_unit_troop1),
(item_get_slot,":unit_no",":unit",slot_item_unit_no),
(assign, reg35, ":unit_no"),
(str_store_troop_name,s35,":troop_id"),
(display_message, "@{s35} Unit {reg35}"),
]),
# unit hold
(0, 0, 0,
[(key_clicked, key_h), # h for hold
(try_begin),
(neq, "$qb_us", 1),
(display_message, "@No unit selected"),
(try_end),
(eq, "$qb_us", 1),
],
[
(assign, reg45, "$qb_unit_tracker"),
(display_message, "@qb tracker: {reg45}"),
(store_add, ":tracker", "$qb_unit_tracker", slot_scene_unit1),
(assign, reg45, ":tracker"),
(display_message, "@qb tracker: {reg45}"),
(scene_get_slot,":unit","$quick_battle_map", ":tracker"),
(item_get_slot,":unit_leader",":unit",slot_item_unit_leader),
(get_player_agent_no,":player_a_no"),
(agent_get_position,pos36,":player_a_no"),
(agent_clear_scripted_mode,":unit_leader"),
(agent_set_scripted_destination,":unit_leader",pos36,1),
(display_message, "@Unit moving to hold position"),
(item_set_slot,"$qb_unit_selected",slot_item_unit_order,mordr_hold),
(position_get_x,":x",pos36),
(position_get_y,":y",pos36),
(position_get_z,":z",pos36),
(item_set_slot,"$qb_unit_selected",slot_item_unit_order_position_x,":x"),
(item_set_slot,"$qb_unit_selected",slot_item_unit_order_position_y,":y"),
(item_set_slot,"$qb_unit_selected",slot_item_unit_order_position_z,":z"),
]),
# end commands