# Formations triggers v2 by motomataru, Warband port
# Global variables *_formation_type holds type of formation: see "Formation modes" in module_constants
# *_formation_move_order hold the current move order for the formation
# *_space hold the multiplier of extra space ordered into formation by the player
formations_triggers = [
(ti_before_mission_start, 0, 0, [], [
(assign, "$gk_order", 0),
(assign, "$gk_order_hold_over_there", 0),
(assign, "$infantry_formation_type", formation_default), #type set by first call; depends on faction
(assign, "$archer_formation_type", formation_default),
(assign, "$cavalry_formation_type", formation_wedge),
(assign, "$infantry_space", 2), #give a little extra space for ease of forming up
(assign, "$archer_space", 2),
(assign, "$cavalry_space", 0),
(assign, "$min_troops_for_formation", 5),
(assign, "$fclock", 1)
]),
# Start troops in formation
(ti_after_mission_start, 0, 0, [], [
(display_message, "@Forming ranks."),
(call_script, "script_player_attempt_formation", grc_infantry, formation_default),
(call_script, "script_player_attempt_formation", grc_cavalry, formation_wedge),
(call_script, "script_player_attempt_formation", grc_archers, formation_default),
#init troops for when formation ends
(get_player_agent_no, "$fplayer_agent_no"),
(agent_get_team, "$fplayer_team_no", "$fplayer_agent_no"),
(set_show_messages, 0),
(try_for_range, ":dummy", 0, "$infantry_space"),
(team_give_order, "$fplayer_team_no", grc_infantry, mordr_spread_out),
(try_end),
(try_for_range, ":dummy", 0, "$archer_space"),
(team_give_order, "$fplayer_team_no", grc_archers, mordr_spread_out),
(try_end),
(try_for_range, ":dummy", 0, "$cavalry_space"),
(team_give_order, "$fplayer_team_no", grc_cavalry, mordr_spread_out),
(try_end),
(set_show_messages, 1),
(try_begin),
(gt, ":dummy", 0), #suppress compile warning
(try_end),
]),
#form ranks command
(0, 0, 1, [(key_clicked, key_j)], [
(str_store_string, s1, "@ranks"),
(call_script, "script_player_attempt_formation", grc_infantry, formation_ranks)
]),
#form shield wall command
(0, 0, 1, [(key_clicked, key_k)], [
(str_store_string, s1, "@shield wall"),
(call_script, "script_player_attempt_formation", grc_infantry, formation_shield)
]),
#form wedge command
(0, 0, 1, [(key_clicked, key_l)], [
(str_store_string, s1, "@wedge"),
(call_script, "script_player_attempt_formation", grc_infantry, formation_wedge),
(call_script, "script_player_attempt_formation", grc_cavalry, formation_wedge)
]),
#form square command
(0, 0, 1, [(key_clicked, key_semicolon)], [
(str_store_string, s1, "@square"),
(call_script, "script_player_attempt_formation", grc_infantry, formation_square)
]),
#end formation command
(0, 0, 1, [(key_clicked, key_u)], [
(get_player_agent_no, ":player"),
(agent_get_team, "$fplayer_team_no", ":player"),
(try_begin),
(neq, "$infantry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_infantry),
(call_script, "script_formation_end", "$fplayer_team_no", grc_infantry),
(display_message, "@Infantry formation disassembled."),
(assign, "$infantry_formation_type", formation_none),
(try_end),
(try_begin),
(neq, "$cavalry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
(call_script, "script_formation_end", "$fplayer_team_no", grc_cavalry),
(display_message, "@Cavalry formation disassembled."),
(assign, "$cavalry_formation_type", formation_none),
(try_end),
(try_begin),
(neq, "$archer_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_archers),
(call_script, "script_formation_end", "$fplayer_team_no", grc_archers),
(display_message, "@Archer starting line disassembled. Use HOLD to reform."),
(assign, "$archer_formation_type", formation_none),
(try_end),
]),
(0, .3, 0, [(game_key_clicked, gk_order_1)], [
(eq, "$gk_order", gk_order_1), #next trigger set MOVE menu?
(game_key_is_down, gk_order_1), #BUT player is holding down key?
(assign, "$gk_order_hold_over_there", 1),
(assign, "$gk_order", 0),
]),
(0, 0, 0, [(game_key_clicked, gk_order_1)], [
(try_begin),
(eq, "$gk_order", 0),
(assign, "$gk_order", gk_order_1),
(display_message, "@MOVE menu"),
(else_try),
(try_begin),
(eq, "$gk_order", gk_order_1), #HOLD
(try_begin),
(neq, "$infantry_formation_type", formation_none),
(call_script, "script_player_attempt_formation", grc_infantry, "$infantry_formation_type"),
(try_end),
(try_begin),
(neq, "$cavalry_formation_type", formation_none),
(call_script, "script_player_attempt_formation", grc_cavalry, "$cavalry_formation_type"),
(try_end),
(try_begin),
(neq, "$archer_formation_type", formation_none),
(call_script, "script_player_attempt_formation", grc_archers, "$archer_formation_type"),
(try_end),
(assign, "$gk_order", 0),
(display_message, "@HOLD"),
(else_try),
(eq, "$gk_order", gk_order_2), #ADVANCE
(try_begin),
(neq, "$infantry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_infantry),
(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_infantry, "$fplayer_agent_no", "$infantry_formation_type"),
(try_begin), #on change of orders cancel order position
(neq, "$infantry_formation_move_order", mordr_advance),
# (team_set_order_position, "$fplayer_team_no", grc_infantry, pos63),
(call_script, "script_set_formation_position", "$fplayer_team_no", grc_infantry, pos63),
(try_end),
(call_script, "script_formation_move_position", "$fplayer_team_no", grc_infantry, pos63, 1),
(call_script, "script_form_infantry", "$fplayer_team_no", "$fplayer_agent_no", "$infantry_space", "$infantry_formation_type"),
(assign, "$infantry_formation_move_order", mordr_advance),
(try_end),
(try_begin),
(neq, "$cavalry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_cavalry, "$fplayer_agent_no", "$cavalry_formation_type"),
(try_begin), #on change of orders cancel order position
(neq, "$cavalry_formation_move_order", mordr_advance),
# (team_set_order_position, "$fplayer_team_no", grc_cavalry, pos63),
(call_script, "script_set_formation_position", "$fplayer_team_no", grc_cavalry, pos63),
(try_end),
(call_script, "script_formation_move_position", "$fplayer_team_no", grc_cavalry, pos63, 1),
(call_script, "script_form_cavalry", "$fplayer_team_no", "$fplayer_agent_no", "$cavalry_space"),
(assign, "$cavalry_formation_move_order", mordr_advance),
(try_end),
(try_begin),
(neq, "$archer_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_archers),
(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_archers, "$fplayer_agent_no", "$archer_formation_type"),
(try_begin), #on change of orders cancel order position
(neq, "$archer_formation_move_order", mordr_advance),
# (team_set_order_position, "$fplayer_team_no", grc_archers, pos63),
(call_script, "script_set_formation_position", "$fplayer_team_no", grc_archers, pos63),
(try_end),
(call_script, "script_formation_move_position", "$fplayer_team_no", grc_archers, pos63, 1),
(call_script, "script_form_archers", "$fplayer_team_no", "$fplayer_agent_no", "$archer_space"),
(assign, "$archer_formation_move_order", mordr_advance),
(try_end),
(assign, "$gk_order", 0),
(display_message, "@ADVANCE"),
(else_try),
(eq, "$gk_order", gk_order_3), #HOLD FIRE
(assign, "$gk_order", 0),
(display_message, "@HOLD FIRE"),
(try_end),
(try_end),
]),
(0, 0, 0, [(game_key_clicked, gk_order_2)], [
(try_begin),
(eq, "$gk_order", 0),
(assign, "$gk_order", gk_order_2),
(display_message, "@FORMATION menu"),
(else_try),
(try_begin),
(eq, "$gk_order", gk_order_1), #FOLLOW
(try_begin),
(neq, "$infantry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_infantry),
(assign, "$infantry_formation_move_order", mordr_follow),
(try_end),
(try_begin),
(neq, "$cavalry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
(assign, "$cavalry_formation_move_order", mordr_follow),
(try_end),
(try_begin),
(neq, "$archer_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_archers),
(assign, "$archer_formation_move_order", mordr_follow),
(try_end),
(assign, "$gk_order", 0),
(display_message, "@FOLLOW"),
(else_try),
(eq, "$gk_order", gk_order_2), #FALL BACK
(try_begin),
(neq, "$infantry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_infantry),
(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_infantry, "$fplayer_agent_no", "$infantry_formation_type"),
(try_begin), #on change of orders cancel order position
(neq, "$infantry_formation_move_order", mordr_fall_back),
# (team_set_order_position, "$fplayer_team_no", grc_infantry, pos63),
(call_script, "script_set_formation_position", "$fplayer_team_no", grc_infantry, pos63),
(try_end),
(call_script, "script_formation_move_position", "$fplayer_team_no", grc_infantry, pos63, -1),
(call_script, "script_form_infantry", "$fplayer_team_no", "$fplayer_agent_no", "$infantry_space", "$infantry_formation_type"),
(assign, "$infantry_formation_move_order", mordr_fall_back),
(try_end),
(try_begin),
(neq, "$cavalry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_cavalry, "$fplayer_agent_no", "$cavalry_formation_type"),
(try_begin), #on change of orders cancel order position
(neq, "$cavalry_formation_move_order", mordr_fall_back),
# (team_set_order_position, "$fplayer_team_no", grc_cavalry, pos63),
(call_script, "script_set_formation_position", "$fplayer_team_no", grc_cavalry, pos63),
(try_end),
(call_script, "script_formation_move_position", "$fplayer_team_no", grc_cavalry, pos63, -1),
(call_script, "script_form_cavalry", "$fplayer_team_no", "$fplayer_agent_no", "$cavalry_space"),
(assign, "$cavalry_formation_move_order", mordr_fall_back),
(try_end),
(try_begin),
(neq, "$archer_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_archers),
(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_archers, "$fplayer_agent_no", "$archer_formation_type"),
(try_begin), #on change of orders cancel order position
(neq, "$archer_formation_move_order", mordr_fall_back),
# (team_set_order_position, "$fplayer_team_no", grc_archers, pos63),
(call_script, "script_set_formation_position", "$fplayer_team_no", grc_archers, pos63),
(try_end),
(call_script, "script_formation_move_position", "$fplayer_team_no", grc_archers, pos63, -1),
(call_script, "script_form_archers", "$fplayer_team_no", "$fplayer_agent_no", "$archer_space"),
(assign, "$archer_formation_move_order", mordr_fall_back),
(try_end),
(assign, "$gk_order", 0),
(display_message, "@FALL BACK"),
(else_try),
(eq, "$gk_order", gk_order_3), #FIRE AT WILL
(assign, "$gk_order", 0),
(display_message, "@FIRE AT WILL"),
(try_end),
(try_end),
]),
(0, 0, 0, [(game_key_clicked, gk_order_3)], [
(try_begin),
(eq, "$gk_order", 0),
(assign, "$gk_order", gk_order_3),
(display_message, "@WEAPON menu"),
(else_try),
(try_begin),
(eq, "$gk_order", gk_order_1), #CHARGE
(try_begin),
(neq, "$infantry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_infantry),
(call_script, "script_formation_end", "$fplayer_team_no", grc_infantry),
(display_message, "@Infantry formation disassembled."),
(assign, "$infantry_formation_type", formation_none),
(try_end),
(try_begin),
(neq, "$cavalry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
(call_script, "script_formation_end", "$fplayer_team_no", grc_cavalry),
(display_message, "@Cavalry formation disassembled."),
(assign, "$cavalry_formation_type", formation_none),
(try_end),
(try_begin),
(neq, "$archer_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_archers),
(call_script, "script_formation_end", "$fplayer_team_no", grc_archers),
(display_message, "@Archer starting line disassembled. Use HOLD to reform."),
(assign, "$archer_formation_type", formation_none),
(try_end),
(assign, "$gk_order", 0),
(display_message, "@CHARGE"),
(else_try),
(eq, "$gk_order", gk_order_2), #SPREAD OUT
(try_begin),
(neq, "$infantry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_infantry),
(val_add, "$infantry_space", 1),
# (team_get_order_position, pos1, "$fplayer_team_no", grc_infantry),
(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_infantry),
(call_script, "script_form_infantry", "$fplayer_team_no", "$fplayer_agent_no", "$infantry_space", "$infantry_formation_type"),
(try_end),
(try_begin),
(neq, "$cavalry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
(val_add, "$cavalry_space", 1),
# (team_get_order_position, pos1, "$fplayer_team_no", grc_cavalry),
(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_cavalry),
(call_script, "script_form_cavalry", "$fplayer_team_no", "$fplayer_agent_no", "$cavalry_space"),
(try_end),
(try_begin),
(neq, "$archer_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_archers),
(val_add, "$archer_space", 1),
# (team_get_order_position, pos1, "$fplayer_team_no", grc_archers),
(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_archers),
(call_script, "script_form_archers", "$fplayer_team_no", "$fplayer_agent_no", "$archer_space"),
(try_end),
(assign, "$gk_order", 0),
(display_message, "@SPREAD OUT"),
(else_try),
(eq, "$gk_order", gk_order_3), #BLUNT WEAPONS
(assign, "$gk_order", 0),
(display_message, "@BLUNT WEAPONS"),
(try_end),
(try_end),
]),
(0, 0, 0, [(game_key_clicked, gk_order_4)], [
(try_begin),
(eq, "$gk_order", gk_order_1), #STAND GROUND
(try_begin),
(neq, "$infantry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_infantry),
(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_infantry, "$fplayer_agent_no", "$infantry_formation_type"),
(copy_position, pos1, pos63),
(call_script, "script_form_infantry", "$fplayer_team_no", "$fplayer_agent_no", "$infantry_space", "$infantry_formation_type"),
(call_script, "script_set_formation_position", "$fplayer_team_no", grc_infantry, pos63),
(try_end),
(try_begin),
(neq, "$cavalry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_cavalry, "$fplayer_agent_no", "$cavalry_formation_type"),
(copy_position, pos1, pos63),
(call_script, "script_form_cavalry", "$fplayer_team_no", "$fplayer_agent_no", "$cavalry_space"),
(call_script, "script_set_formation_position", "$fplayer_team_no", grc_cavalry, pos63),
(try_end),
(try_begin),
(neq, "$archer_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_archers),
(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_archers, "$fplayer_agent_no", "$archer_formation_type"),
(copy_position, pos1, pos63),
(call_script, "script_form_archers", "$fplayer_team_no", "$fplayer_agent_no", "$archer_space"),
(call_script, "script_set_formation_position", "$fplayer_team_no", grc_archers, pos63),
(try_end),
(assign, "$gk_order", 0),
(display_message, "@STAND GROUND"),
(else_try),
(eq, "$gk_order", gk_order_2), #STAND CLOSER
(try_begin),
(neq, "$infantry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_infantry),
(gt, "$infantry_space", 0),
(val_sub, "$infantry_space", 1),
# (team_get_order_position, pos1, "$fplayer_team_no", grc_infantry),
(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_infantry),
(call_script, "script_form_infantry", "$fplayer_team_no", "$fplayer_agent_no", "$infantry_space", "$infantry_formation_type"),
(try_end),
(try_begin),
(neq, "$cavalry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
(gt, "$cavalry_space", 0),
(val_sub, "$cavalry_space", 1),
# (team_get_order_position, pos1, "$fplayer_team_no", grc_cavalry),
(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_cavalry),
(call_script, "script_form_cavalry", "$fplayer_team_no", "$fplayer_agent_no", "$cavalry_space"),
(try_end),
(try_begin),
(neq, "$archer_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_archers),
(gt, "$archer_space", 0),
(val_sub, "$archer_space", 1),
# (team_get_order_position, pos1, "$fplayer_team_no", grc_archers),
(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_archers),
(call_script, "script_form_archers", "$fplayer_team_no", "$fplayer_agent_no", "$archer_space"),
(try_end),
(assign, "$gk_order", 0),
(display_message, "@STAND CLOSER"),
(else_try),
(eq, "$gk_order", gk_order_3), #ANY WEAPON
(assign, "$gk_order", 0),
(display_message, "@ANY WEAPON"),
(try_end),
]),
(0, 0, 0, [(game_key_clicked, gk_order_5)], [
(try_begin),
(eq, "$gk_order", gk_order_1), #RETREAT
(assign, "$gk_order", 0),
(display_message, "@RETREAT"),
(else_try),
(eq, "$gk_order", gk_order_2), #MOUNT
(assign, "$gk_order", 0),
(display_message, "@MOUNT"),
(try_end),
]),
(0, 0, 0, [(game_key_clicked, gk_order_6)], [
(eq, "$gk_order", gk_order_2), #DISMOUNT
(try_begin),
(neq, "$cavalry_formation_type", formation_none),
(get_player_agent_no, ":player"),
(agent_get_team, "$fplayer_team_no", ":player"),
(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
(call_script, "script_formation_end", "$fplayer_team_no", grc_cavalry),
(display_message, "@Cavalry formation disassembled."),
(assign, "$cavalry_formation_type", formation_none),
(try_end),
(assign, "$gk_order", 0),
(display_message, "@DISMOUNT"),
]),
(0, 0, 0, [
(this_or_next|key_clicked, key_1),
(this_or_next|key_clicked, key_2),
(this_or_next|key_clicked, key_3),
(this_or_next|key_clicked, key_4),
(this_or_next|key_clicked, key_5),
(this_or_next|key_clicked, key_6),
(this_or_next|key_clicked, key_7),
(this_or_next|key_clicked, key_8),
(this_or_next|key_clicked, key_9),
(this_or_next|key_clicked, key_0),
(key_clicked, key_escape) #doesn't work because ESC is omitted during command selection
], [
(display_message, "@Back out of menu"),
(assign, "$gk_order", 0)
]),
#implement HOLD OVER THERE when player lets go of key
(.5, 0, 0, [(eq, "$gk_order_hold_over_there", 1),(neg|game_key_is_down, gk_order_1)], [
(agent_get_position, pos49, "$fplayer_agent_no"),
(try_begin),
(neq, "$infantry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_infantry),
(team_get_order_position, pos61, "$fplayer_team_no", grc_infantry),
(call_script, "script_team_get_average_position_of_enemies_augmented", pos60, "$fplayer_team_no", grc_everyone),
(call_script, "script_point_y_toward_position", pos61, pos60),
(agent_set_position, "$fplayer_agent_no", pos61), #fake out script_cf_formation
(try_begin), #ignore script failure
(call_script, "script_cf_formation", "$fplayer_team_no", grc_infantry, "$infantry_space", "$infantry_formation_type"),
(try_end),
(assign, "$infantry_formation_move_order", mordr_hold),
(try_end),
(try_begin),
(neq, "$cavalry_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
(team_get_order_position, pos61, "$fplayer_team_no", grc_cavalry),
(call_script, "script_team_get_average_position_of_enemies_augmented", pos60, "$fplayer_team_no", grc_everyone),
(call_script, "script_point_y_toward_position", pos61, pos60),
(agent_set_position, "$fplayer_agent_no", pos61), #fake out script_cf_formation
(try_begin), #ignore script failure
(call_script, "script_cf_formation", "$fplayer_team_no", grc_cavalry, "$cavalry_space", "$cavalry_formation_type"),
(try_end),
(assign, "$cavalry_formation_move_order", mordr_hold),
(try_end),
(try_begin),
(neq, "$archer_formation_type", formation_none),
(class_is_listening_order, "$fplayer_team_no", grc_archers),
(team_get_order_position, pos61, "$fplayer_team_no", grc_archers),
(call_script, "script_team_get_average_position_of_enemies_augmented", pos60, "$fplayer_team_no", grc_everyone),
(call_script, "script_point_y_toward_position", pos61, pos60),
(agent_set_position, "$fplayer_agent_no", pos61), #fake out script_cf_formation
(try_begin), #ignore script failure
(call_script, "script_cf_formation", "$fplayer_team_no", grc_archers, "$archer_space", "$archer_formation_type"),
(try_end),
(assign, "$archer_formation_move_order", mordr_hold),
(try_end),
(agent_set_position, "$fplayer_agent_no", pos49),
(display_message, "@HOLD OVER THERE"),
(assign, "$gk_order_hold_over_there", 0)
]),
(1, 0, 0, [ #attempt to avoid simultaneous formations function calls
(neg|key_clicked, key_j),
(neg|key_clicked, key_k),
(neg|key_clicked, key_l),
(neg|key_clicked, key_semicolon),
(neg|key_clicked, key_u),
(neg|game_key_clicked, gk_order_1),
(neg|game_key_clicked, gk_order_2),
(neg|game_key_clicked, gk_order_3),
(neg|game_key_clicked, gk_order_4),
(neg|game_key_clicked, gk_order_5),
(neg|game_key_clicked, gk_order_6)
], [
(store_mod, ":fifth_second", "$fclock", 5),
(try_begin),
(neq, "$infantry_formation_type", formation_none),
(try_begin),
(eq, "$infantry_formation_move_order", mordr_follow),
(call_script, "script_cf_formation", "$fplayer_team_no", grc_infantry, "$infantry_space", "$infantry_formation_type"),
(else_try), #periodically reform
(eq, ":fifth_second", 0),
# (team_get_order_position, pos1, "$fplayer_team_no", grc_infantry),
(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_infantry),
(call_script, "script_form_infantry", "$fplayer_team_no", "$fplayer_agent_no", "$infantry_space", "$infantry_formation_type"),
(try_end),
(try_end),
(try_begin),
(neq, "$cavalry_formation_type", formation_none),
(try_begin),
(eq, "$cavalry_formation_move_order", mordr_follow),
(call_script, "script_cf_formation", "$fplayer_team_no", grc_cavalry, "$cavalry_space", "$cavalry_formation_type"),
(else_try), #periodically reform
(eq, ":fifth_second", 0),
# (team_get_order_position, pos1, "$fplayer_team_no", grc_cavalry),
(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_cavalry),
(call_script, "script_form_cavalry", "$fplayer_team_no", "$fplayer_agent_no", "$cavalry_space"),
(try_end),
(try_end),
(try_begin),
(neq, "$archer_formation_type", formation_none),
(try_begin),
(eq, "$archer_formation_move_order", mordr_follow),
(call_script, "script_cf_formation", "$fplayer_team_no", grc_archers, "$archer_space", "$archer_formation_type"),
(else_try), #periodically reform
(eq, ":fifth_second", 0),
# (team_get_order_position, pos1, "$fplayer_team_no", grc_archers),
(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_archers),
(call_script, "script_form_archers", "$fplayer_team_no", "$fplayer_agent_no", "$archer_space"),
(try_end),
(try_end),
(val_add, "$fclock", 1),
]),
]
#end formations triggers