Button Attack

Level 2
Joined
Aug 15, 2007
Messages
9
hey i would like to know how to make a unit attack an enemy unit when you press a certain button, preferably without using a spell, but if that is the only way then that would be fine too

but if it could be a sword attack that would be great, i would also take a ranged attack too

aslo, if it includes using JASS i need to know how to apply that because ive never used JASS before

thnx much
 
Level 6
Joined
Feb 25, 2005
Messages
230
Using a spell makes it very easy, and if u want it without a spell, i guess you need JASS.
Anyways, if youre using a spell, this would work:

  1. Create a custom Unit Ability based on 'Howl of Terror' (Or any ability without targets)

  2. Set its values to what you want, most important the hotkey will be the button.
    You should set: Targets Allowed = None , Mana Cost = 0, etc.

  3. Add the Ability to the Unit you're talking about

  4. Make a trigger, looking like this:

    • Button Attack
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Button Attack
      • Actions
        • Unit - Order (Triggering unit) to Attack ("Some unit")
You are not so clear about which unit is to be attacked. A random unit in range? Or a specific unit? Anyways you can just make sure you set "Some unit" to the unit that should be attacked.

Everything clear?
 
Level 2
Joined
Aug 15, 2007
Messages
9
thnx that was very helpful


btw i want the guy to attack everything in front of him


Edit: i just tried this out but i cannot get him to attack any faster, is this possible?
 
Last edited:
Level 9
Joined
Sep 8, 2004
Messages
633
To attack everything in front of him you'd have to make it more complicated, e.a. create a trigger to select all units in a certain zone in front of him and then apply some damage, yet these triggers are very sensitive to memory leaks. You will also have to learn to use coordinates and facings. Since you would want all units within certain coordinates, facing in front of the attacker be damaged.

Attacking faster isn't always possible, there's several things that can restrain:
- Ability cooldown
- Global ability cooldown
- Animations

People can probably think of more. I think the best think you can do at this point is scour the spells section for something similar or put a request up at the request forum. This spell would become a bit too complicated if you didn't know how to trigger the simple version in the first place.
 
Level 6
Joined
Feb 25, 2005
Messages
230
@ El13urrito:

Sorry, I dont really get what you're saying.

If you want the unit to attack "everything in front of him", you should simply use this action:

  • Unit - Order (Triggering unit) to Attack-Move To (Position of (Triggering unit))
---

If you want him to move a bit aswell, use another point. Attack move orders the unit to move to the point, attacking anyone around him as he goes (as you may know).

  • Unit - Order (Triggering unit) to Attack-Move To ((Position of (Triggering unit)) offset by 500.00 towards (Facing of (Triggering unit)) degrees)
---

This trigger orders him to attack move to a point at 500 range in front of him.

Hope that helped, but i didnt really understand what you meant about having him attack faster... can you be more clear perhaps?
 
Level 2
Joined
Aug 15, 2007
Messages
9
i need him to basically attack whenever i hit a button (doesn't matter), i already knew about the spell hotkey method, but i was trying to stay away from that because it is too slow

i know that ive seen the kind of attack i want in an Uther Party mini-game with arthas, that's the kind of thing im going for
 
Level 5
Joined
Apr 16, 2005
Messages
153
I made a map awhile ago that has a system i think is excatly what your looking for. see attachment
 

Attachments

  • Steel_Cold's RPG test.w3x
    56.9 KB · Views: 56
Top