motomataru said:
(gt, ":column", ":rank_dimension"), #next rank?
(position_move_y, pos1, ":neg_distance", 0),
(try_begin),
(neq, ":form_left", 1),
(assign, ":form_left", 1),
(position_move_x, pos1, ":neg_distance", 0),
(else_try),
(assign, ":form_left", 0),
(position_move_x, pos1, ":distance", 0),
(try_end),
(assign, ":column", 1),
(val_add, ":rank", 1),
(end_try),
(try_begin),
(agent_get_position, pos2, ":agent"),
(get_distance_between_positions,":dist",pos1,pos2),
(eq, ":rank", 1),
(try_begin),
(le, ":dist", formation_minimum_spacing),
(call_script, "script_equip_best_melee_weapon", ":agent", 0, 1),
(else_try),
(gt, ":dist", formation_minimum_spacing),
(try_end),
(else_try),
(agent_get_position, pos2, ":agent"),
(get_distance_between_positions,":dist",pos1,pos2),
(eq, ":rank", 1),
(try_begin),
(le, ":dist", formation_minimum_spacing),
(call_script, "script_equip_best_melee_weapon", ":agent", 0, 1),
(else_try),
(gt, ":dist", formation_minimum_spacing),
(try_end),
(try_end),
(end_try),
(spear is not braced?),
(brace spear),
("get_centering_amount", [
(store_script_param, ":troop_formation", 1),
(store_script_param, ":num_troops", 2),
(store_script_param, ":extra_spacing", 3),
(store_script_param, ":sd_type", 4),
(store_mul, ":troop_space", ":extra_spacing", 50),
(val_add, ":troop_space", formation_minimum_spacing),
(assign, reg0, 0),
(try_begin),
(eq, ":troop_formation", formation_wedge),
(eq, ":sd_type", sdt_archer),
(val_add, ":troop_space", 500),
(store_mul, reg0, ":num_troops", ":troop_space"),
(val_div, reg0, 2), #archers in 2 ranks
(val_sub, reg0, ":troop_space"),
(else_try),
(eq, ":troop_formation", formation_square),
(convert_to_fixed_point, ":num_troops"),
(store_sqrt, reg0, ":num_troops"),
(val_mul, reg0, ":troop_space"),
(convert_from_fixed_point, reg0),
(val_sub, reg0, ":troop_space"),
(else_try),
(call_script, "script_get_centering_amount", ":fformation", ":num_troops", ":formation_extra_spacing", sdt_archer),
(call_script, "script_get_centering_amount", formation_default, ":num_troops", ":formation_extra_spacing", 0),
SCRIPT ERROR ON OPCODE23: INVALID SCRIPT PARAMETER ID: 3; LINE NO; 3
At script get centering amount
Dain Ironfoot said:
(gt, ":column", ":rank_dimension"), #next rank?
(position_move_y, pos1, ":neg_distance", 0),
(try_begin),
(neq, ":form_left", 1),
(assign, ":form_left", 1),
(position_move_x, pos1, ":neg_distance", 0),
(else_try),
(assign, ":form_left", 0),
(position_move_x, pos1, ":distance", 0),
(try_end),
(assign, ":column", 1),
(val_add, ":rank", 1),
("get_centering_amount", [
(store_script_param, ":troop_formation", 1),
(store_script_param, ":num_troops", 2),
(store_script_param, ":troop_type", 3),
(store_script_param, ":extra_spacing", 4,),
(store_mul, ":troop_space", ":extra_spacing", 50),
(val_add, ":troop_space", formation_minimum_spacing),
(assign, reg0, 0),
(try_begin),
(eq, ":troop_formation", formation_wedge),
(eq, ":troop_type", grc_archers),
(val_add, ":troop_space", 500),
(store_mul, reg0, ":num_troops", ":troop_space"),
(val_div, reg0, 2), #archers in 2 ranks
(val_sub, reg0, ":troop_space"),
(else_try),