press key to attack

vinknight

New Member
Reaction score
0
well i have some problems with this. I'm trying to make a hero attack when a is pressed and a projectile will be sent in the direction. The projectile will fly till it expires or hits something. This is similar to "elimination tournament". Please guide me:)
 

Summoned

New Member
Reaction score
51
This is probably a lot more complex than you think it is. :p

You'll need a trigger to detect when the "a" key is pressed. Then set the animation of the current selected unit (if it belongs to the triggering player) to its "attack" animation.

After that, you'll need to create a dummy projectile unit and slide it along in the facing angle of the selected unit until it comes within, say, 100 range of an enemy unit or until it flies too far.
 

jackall

You can change this now in User CP.
Reaction score
37
you have to detect when a unit is given the order "attack" not when the "a" key is pressed
 

jackall

You can change this now in User CP.
Reaction score
37
well... i dont think you can detect when the a key is pressed, only arrows
 

Summoned

New Member
Reaction score
51
well... i dont think you can detect when the a key is pressed, only arrows
I guess it's doable if he creates a custom ability with the hotkey A then, and detect when that ability is used. Attack will have to be disabled for the unit, though.
 

Rainther

I guess I should write something of value here...
Reaction score
61
Which also requires the unit to be marked and controlled (duh). Can't detect the "a" button otherwise.
 

tmow

New Member
Reaction score
7
Well i know default keys are the arrow keys...so make it

Event: up arrow is pressed..

Condition:

Action: order all units in UnitGroup to attack *target
 

OMGedDude

New Member
Reaction score
5
If you know where to find the attack icon, you can create a custom dummy ability with the hotkey set to 'A', the icon set the the attack icon, the spell animation to 'attack', and set the coordinates to where the attack button should be to create a mock attack button. Then use triggers to detect the unit starting the effect of the ability and trigger the rest accordingly.
You would need to disable attacking for the unit though
 

vinknight

New Member
Reaction score
0
omg i don't understand what you guys are saying... because im new to this type of thing. i mean press A and click to shoot a projectile, not pressing a and then a projectile comes out.
 

Nexor

...
Reaction score
74
Just create an ability based on berserk, set the buff's duration to 0.01 and set it's hotkey to A, and of yource you should set the cooldown of the ability. then just make a trigger with the event: A unit starts the effect of an ability, with the condition: Ability being cast equal to Attack (berserk based)


EDIT: Sorry I just read your last post, then you should make the ability based on any point-casting ability, like a modified version of Channel
 

WilliamPa

Active Member
Reaction score
51
Elimination Tournament is faaaaaaaaar more difficult to make than you think. You are gonna need some jass to create as efficient shooting system as it has. Probably you will be using GetLocationZ mostly.

Elimination tournament does not just slide it, but it also changes height and even checks terrain height in front of the bullet to check should it remove the bullet(hits ground). At the shooting point, not just the angle matters but the exact spot you click, since the projectile height changes depending whether you clicked on a spot lower than you are, higher than you are or on the same level.
 

vinknight

New Member
Reaction score
0
Elimination Tournament is faaaaaaaaar more difficult to make than you think. You are gonna need some jass to create as efficient shooting system as it has. Probably you will be using GetLocationZ mostly.

Elimination tournament does not just slide it, but it also changes height and even checks terrain height in front of the bullet to check should it remove the bullet(hits ground). At the shooting point, not just the angle matters but the exact spot you click, since the projectile height changes depending whether you clicked on a spot lower than you are, higher than you are or on the same level.

oh i see. No way to do in GUI?
 

Slinky

New Member
Reaction score
0
On a slightly side note-

Is there a trick to starting a unit's walk or movement animation?

I am able to start the attack animation (in GUI), but not walk animation.

Anyone able to help please?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top