Berserker Pride
Grandmaster Knight
Ok I'm back in my quest for perfect AoE. I got area of effect working for a melee weapon. I started wondering how would I code area of effect that only wounded two or three troops in a swing rather than everyone in range. My current code looks like this
The dragonslayer is a really long weapon thats why the range is set to 300. The only problem with this code is its too powerful. I reduced the effect to only happen every 15 seconds. I would rather have constant AoE with the weapon that only hit 2 troops in addition to the actual agent hit by the blade. To make it look good I'd prefer if those were the two closest agents to the player. How would you put a check in the code so that it stopped after the closest two agents were hit?
dragonslayer_trigger = (0, 0, 15, [
(key_clicked, key_left_mouse_button),
(key_is_down, key_left_control),
(neg|main_hero_fallen,0),
(get_player_agent_no, ":player_agent"),
(agent_get_wielded_item,":wielded_item",":player_agent",0),
(eq,":wielded_item","itm_dragonslayer"),
],
[#(agent_get_team,":player_team", ":player_agent"),
(get_player_agent_no, ":player_agent"),
(agent_get_position,pos1,":player_agent"),
(agent_set_animation,":player_agent","anim_release_slashright_twohanded"),
(particle_system_burst,"psys_special_attack",pos1,100),
(try_for_agents,":agent"),
(agent_is_alive,":agent"),
#(agent_is_human,":agent"),
(neq,":agent",":player_agent"),
#(neg|agent_is_ally,":agent"),
(agent_get_position,pos2,":agent"),
(neg|position_is_behind_position,pos2,pos1),
(get_distance_between_positions,":dist",pos1,pos2),
(lt,":dist",300),
(particle_system_burst,"psys_game_blood",pos2,200),
(agent_play_sound,":agent","snd_man_die"),
(agent_play_sound,":agent","snd_metal_hit_high_armor_high_damage"),
(agent_set_animation,":agent","anim_force_knocked"),
(store_agent_hit_points, ":cur_hit_points",":agent",1),
(val_sub,":cur_hit_points",70),
#(try_begin),
#(lt,":cur_hit_points",0),
(val_max,":cur_hit_points",0),
#(try_end),
(agent_set_hit_points,":agent",":cur_hit_points",1),
(try_begin),
(lt,":cur_hit_points",1),
(agent_deliver_damage_to_agent,":player_agent",":agent"),
(try_end),
(try_end),
])
(key_clicked, key_left_mouse_button),
(key_is_down, key_left_control),
(neg|main_hero_fallen,0),
(get_player_agent_no, ":player_agent"),
(agent_get_wielded_item,":wielded_item",":player_agent",0),
(eq,":wielded_item","itm_dragonslayer"),
],
[#(agent_get_team,":player_team", ":player_agent"),
(get_player_agent_no, ":player_agent"),
(agent_get_position,pos1,":player_agent"),
(agent_set_animation,":player_agent","anim_release_slashright_twohanded"),
(particle_system_burst,"psys_special_attack",pos1,100),
(try_for_agents,":agent"),
(agent_is_alive,":agent"),
#(agent_is_human,":agent"),
(neq,":agent",":player_agent"),
#(neg|agent_is_ally,":agent"),
(agent_get_position,pos2,":agent"),
(neg|position_is_behind_position,pos2,pos1),
(get_distance_between_positions,":dist",pos1,pos2),
(lt,":dist",300),
(particle_system_burst,"psys_game_blood",pos2,200),
(agent_play_sound,":agent","snd_man_die"),
(agent_play_sound,":agent","snd_metal_hit_high_armor_high_damage"),
(agent_set_animation,":agent","anim_force_knocked"),
(store_agent_hit_points, ":cur_hit_points",":agent",1),
(val_sub,":cur_hit_points",70),
#(try_begin),
#(lt,":cur_hit_points",0),
(val_max,":cur_hit_points",0),
#(try_end),
(agent_set_hit_points,":agent",":cur_hit_points",1),
(try_begin),
(lt,":cur_hit_points",1),
(agent_deliver_damage_to_agent,":player_agent",":agent"),
(try_end),
(try_end),
])