volley fire with spears, but only when the enemy is within a range because spears are hart to aim
and positioning and grouping before battle (both link very good to roman mods like mine)
and positioning and grouping before battle (both link very good to roman mods like mine)
插入代码块:
#1 at battle start positioning
common_battle_roman_army_begin = ( # hold, stand closer, ranks, hold fire
ti_on_agent_spawn, 0, 0, [],
[
(try_for_agents, ":agent"), # search all agents
(agent_is_alive, ":agent"), # exclude dead agentsx `
(agent_is_human, ":agent"), # exclude horses (and futuristic mod things)
(agent_is_active, ":agent"),
(get_player_agent_no, ":player_agent"), # get player agent
(neq, ":agent", ":player_agent"), # exclude player from search
(agent_get_team, ":roman_team", ":agent"),
(agent_get_troop_id, ":troop_no", ":agent"), #get troop of agents left
(this_or_next|eq, ":troop_no", "trp_swadian_recruit"), # roman infantry begin
(this_or_next|eq, ":troop_no", "trp_swadian_militia"),
(this_or_next|eq, ":troop_no", "trp_swadian_footman"),
(this_or_next|eq, ":troop_no", "trp_swadian_infantry"),
(this_or_next|eq, ":troop_no", "trp_swadian_infantry2"),
(this_or_next|eq, ":troop_no", "trp_swadian_sergeant"),
(eq, ":troop_no", "trp_swadian_man_at_arms"), # roman infantry end
(try_begin),
(eq, ":roman_team", 0),
(team_give_order, 0, grc_infantry, mordr_hold),
(team_give_order, 0, grc_infantry, mordr_stand_closer),
(team_give_order, 0, grc_infantry, mordr_stand_closer),
(team_give_order, 0, grc_infantry, mordr_stand_closer),
(team_give_order, 0, grc_infantry, mordr_stand_closer),
(team_give_order, 0, grc_infantry, mordr_hold_fire),
(else_try),
(eq, ":roman_team", 1),
(team_give_order, 1, grc_infantry, mordr_hold),
(team_give_order, 1, grc_infantry, mordr_stand_closer),
(team_give_order, 1, grc_infantry, mordr_stand_closer),
(team_give_order, 1, grc_infantry, mordr_stand_closer),
(team_give_order, 1, grc_infantry, mordr_stand_closer),
(team_give_order, 1, grc_infantry, mordr_hold_fire),
(try_end),
(try_end),
])
#2 massive pilum rain (very nice scripts for all spear units)
common_battle_pilum_rain = (
2, 0, 0, [],
[
(try_for_agents, ":agent"),
(agent_is_alive, ":agent"),
(agent_is_active, ":agent"),
(agent_is_human, ":agent"),
(get_player_agent_no, ":player"),
(neq, ":agent", ":player"),
(agent_get_troop_id, ":troop_no", ":agent"),
(this_or_next|eq, ":troop_no", "trp_swadian_recruit"), # roman infantry begin
(this_or_next|eq, ":troop_no", "trp_swadian_militia"),
(this_or_next|eq, ":troop_no", "trp_swadian_footman"),
(this_or_next|eq, ":troop_no", "trp_swadian_infantry"),
(this_or_next|eq, ":troop_no", "trp_swadian_infantry2"),
(this_or_next|eq, ":troop_no", "trp_swadian_sergeant"),
(eq, ":troop_no", "trp_swadian_man_at_arms"), # roman infantry end
(agent_get_team, ":roman_team", ":agent"),
(agent_get_position, pos1, ":agent"),
(try_end),
(try_for_agents, ":hostile"), #cause try_for_agents within try_for_agents causes SERIEUS lagg
(agent_is_alive, ":hostile"),
(agent_is_human, ":hostile"), #ofcoure we hit horses to but this will make us take troops as target
(agent_is_actvive, ":hostile"),
(neq, ":player", ":hostile"),
(agent_get_team, ":hostile_team"),
(neq, ":hostile_team", ":roman_team"),
(agent_get_position, pos2),
(try_end),
(try_begin),
#getting smallest distance
(assign, ":smallest_dist", -1),
(get_sq_distance_between_positions, ":dist", pos1, pos2),
(this_or_next|eq, ":smallest_dist", -1), #so the first time smallest distance becomes distance
(lt, ":dist", ":smallest_dist"),
(assign, ":smallest_dist", ":dist"), #after the first time we override dist if smaller
(try_end),
(try_begin),
#distance based spear throwing
(gt, ":smallest_dist", 12),
(assign, ":throw", 1), #hold fire
(else_try),
(le, ":smallest_dist", 12),
(ge, ":smallest_dist", 2), #[2, 12]
(assign, ":throw", 2), #fire at will
(else_try),
(lt, ":smallest_dist", 2),
(assign, ":throw", 3), #melee
(try_end),
(try_begin),
(eq, ":throw", 2), #fire at will
(agent_set_attack_action, ":agent", 0, 0), #Fire
(else_try),
(eq, ":throw", 1),
(agent_set_attack_action, ":agent", 0, 1), #Ready and Aim
#hold fire
#To do add out of ammo
(else_try),
(eq, ":throw", 3), #melee
(try_begin),
(eq, ":roman_team", 0),
(team_give_order, 0, grc_infantry, mordr_hold_fire),
(else_try),
(eq, ":roman_team", 1),
(team_give_order, 1, grc_infantry, mordr_hold_fire),
(try_end),
(try_end),


