Limited AoE

Users who are viewing this thread

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
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),
    ])
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?
 
Oh Do you want to hit 2 troops?
I can give you a idea。
you can limit the distance of agent
(lt,":dist",150), so you will not hit  too many  agents :smile:but it a long weapon
I think must have other idears
For example  you can turn you look position make look position on your right\left then limit “neg|position_is_behind_position”
that only a few agents you can attack……
 
Oh good call but the neg|pos_is_behind_position check is already in.  The sword only does 180 degree damage.  Somehow I'd like the code to only hit two agents then stop.
 
Berserker Pride is aiming for an effect like this:

Berserk%20-%20v01c03p186-167%20copy.jpg
i guess this pretty much hits the nail...

EDIT: I mean he is not looking for the body-cleaving but more for the fact that one guy hits two enemies with 1 strike.
 
Yeah Hokie has a magics that can do that too! ^_^ cept it can destroy way too many in its way Look into flame magic in Medikia ^_^
 
why not make a variable at the begining of the code and set it to 2.  Each agent you hit reduces this number.  When it is 0, no longer deal damage.
 
jik said:
why not make a variable at the beginning of the code and set it to 2.  Each agent you hit reduces this number.  When it is 0, no longer deal damage.

sounds good to me
But how in the world do you do that?
 
Thats a good idea jik thats kinda what I was wanting to do.  I'm just not sure what operation I can use to see if a single agent is killed.  The try for agents command takes everyone as a group how would you check for just one agent.
Ok I'm trying setting the variable to two at the beginning and subtracting one from the variable at the end of the consequences block.  With a check that the variable is greater than 0 in the middle. I hope it works.

EDIT: Amazingly it did.  Here is the code.
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"),
    (assign,"$two_enemies",2),############
                                  ],
    [#(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),
      (gt,"$two_enemies",0),###########
      (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),
      (val_max,":cur_hit_points",0),
      (agent_set_hit_points,":agent",":cur_hit_points",1),
      (val_sub,"$two_enemies",1),################
      (try_begin),
        (lt,":cur_hit_points",1),
        (agent_deliver_damage_to_agent,":player_agent",":agent"),
      (try_end),
    (try_end),
    ])
The lines with ####### are the new ones.  It seems to pick the two agents at random.  I'd like to make the two agents hit be the closest to the player.   
 
Back
Top Bottom