• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[GUI or JASS] - Single attack

Status
Not open for further replies.
Level 1
Joined
Mar 22, 2008
Messages
4
Basically I'm looking for a way to trigger a unit to attack something once, and then stop. I'm making a pseudo FPS map, similar to the simple flash FPS games out there, so obviously want to be able to have attack once per click, as opposed to continually attacking after a single click.

The unit's (Rifleman 0001) attack speed it 0.25 seconds, and I've got two triggers at the moment, the first;

Code:
Event: Time - Every 0.01 seconds of game time
Condition: None
Action: Game - Force Player 1 (Red) to press the key A

To simply allow the player to click to shoot, and the second;

Code:
Event: Rifleman 0001 <gen> Is issued an order targeting an object
Condition: None
Action: Wait 0.25 seconds
 [B][/B] [B][/B] [B][/B] [B][/B] [B][/B] [B][/B] [B][/B] Unit - Order Rifleman 0001 <gen> to Stop

To attempt to stop after a single attack.

I tried toying around with the delay, but increasing it leads to often attacking several times per click, and decreasing it leads to often not attacking at all. Being example 0.25 seconds works to an extent, though sometimes leads to either of the previous scenarios. I've tried a few other ways of getting around it with the GUI, but couldn't find anything that worked. I'm unfamiliar with JASS.

Anyone able to suggest a way around it?
 
Level 3
Joined
Jul 20, 2008
Messages
41
I suggest using a damage detection system so you can order the unit to stop when it has dealt the damage not before or after.
 
I wouldn't use the default A attack.
There are two things to consider:
a) The fact that I wouldn't use the default "A" if I were you. Instead, I would make a custom spell and worked around with "Unit - A unit starts the effect of an ability". Set acquistion range of your unit to 0 and use the action "Unit - Order (Triggering unit) to Attack Once (Target unit of ability being cast)". There might be a need of a timer that will expire in 0.00 seconds to do that, but try things out.

b) This map: http://www.hiveworkshop.com/forums/submissions-414/trackable2-124888/
It detects the clicks of the mouse. You can "shoot" once the left button is clicked.
 
Status
Not open for further replies.
Top