#Shield Bash Script
("shield_bash",[
(this_or_next|multiplayer_is_server),
(neg|game_in_multiplayer_mode),
(get_player_agent_no,":player_agent"),
(store_skill_level,":shield_level", "skl_shield", "trp_player"),
(store_sub, ":player_shield_bash_time", 13, ":shield_level"),
(store_mission_timer_a, ":current_time"),
(agent_get_slot, ":slot_last_shield_bash_time", ":player_agent", 27),
(store_add, ":time_to_shield_bash", ":player_shield_bash_time",":slot_last_shield_bash_time"),
(try_begin),
(ge, ":current_time", ":time_to_shield_bash"),
(try_begin),
(gt, ":player_agent", 0),
(agent_get_animation, ":anim", ":player_agent",0),
(agent_get_horse, ":my_horse", ":player_agent"),
(agent_get_wielded_item, ":shield_item", ":player_agent", 1),
(try_begin),
(neq, ":anim", "anim_shield_bash"),
(eq, ":my_horse", -1),
(item_get_type, ":item_type", ":shield_item"),
(eq, ":item_type", itp_type_shield),
(agent_set_animation, ":player_agent","anim_shield_bash"),
(agent_get_position, pos63,":player_agent"),
(position_move_y,pos63,75),#75 cm directly ahead, so it's not a cuboid space around player center
(agent_get_troop_id, ":id", ":player_agent"),
(troop_get_type, ":type", ":id"),
(try_begin),
(eq, ":type", tf_male),
(agent_play_sound, ":player_agent", "snd_man_yell"),
(agent_set_slot, ":player_agent", 27, ":current_time"),
(else_try),
(agent_play_sound, ":player_agent", "snd_woman_yell"),
(agent_set_slot, ":player_agent", 27, ":current_time"),
(try_end),
(try_for_agents,":agent"),
(gt, ":agent", 0),
(neg|agent_is_ally,":agent"),#don't bash allies
(agent_is_human, ":agent"),#stop if not human
(agent_is_active,":agent"),
(agent_is_alive,":agent"),
(try_begin),
(agent_get_position,pos62,":agent"),
(get_distance_between_positions,":dist",pos63,pos62),
(lt,":dist",100),#Set this to whatever you like- 1 meter radius clears a big section of crowd
(agent_get_horse, ":horse", ":agent"),
(eq, ":horse", -1),
(neq,":agent",":player_agent"),
(agent_play_sound, ":player_agent", "snd_wooden_hit_low_armor_high_damage"),
(position_move_y,pos62,-25),
(agent_set_position, ":agent", pos62),
(agent_set_animation, ":agent","anim_shield_strike"),
(try_end),
(try_end),
(try_end),
(try_end),
(else_try),
(display_message, "@You don't have enough shield skill to shield bash again this soon."),
(try_end),
]),
#End Shield Bash Script