• 🏆 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!

Auto Attack Off? (Both Hero With Worker Classification)

Status
Not open for further replies.
Level 2
Joined
Jun 15, 2011
Messages
13
Hello, I figured out how to turn auto attack off by triggering the peon-type unit on heroes however I want all heroes to not auto attack which leads me to adding the peon-type unit to each of them.

This leads me to having them auto attack back if harmed or attacked, is there anyway that I could not have them not attack back at all if attacked?

Like, is there a trigger to detect auto attack so that I can trigger 'Unit - Order Stop' or something every time they auto attack? Because adding worker classification to every hero leads them all to auto attack back anyway if attacked which I don't want.
 
Level 2
Joined
Jun 15, 2011
Messages
13
What about if you use the ''Hold Position'' ability, that will prevent units from auto-attack targets!

I already have that changed to a 'Back' button so I can't use it :/

There is a trigger event that runs when a unit is about to attack. (Unit attacks a unit, or something like that)

'Unit - When Attacked'

I tried that when the unit attacks then 'Unit - Stop' however he still continues to auto attack and I tried to do 'Unit - Move (Instantly)' too but he still attacking...
 
If the regular stop order doesn't work then you can order it to move to its location.

No, this is a bad idea. It will look goofy because the unit will turn around when a target comes near and it is very inefficient. Having a trigger run for every unit that comes within acquisition range of an enemy is not good and won't really work either. It is much better to affect the unit's behavior with OE settings.
 
Flux's solution should work, but I don't understand. Workers do not attack back (they flee or keep working unless ordered otherwise) ... so do you want them to or not? Maybe worker heroes do because that's an odd mix. Setting the acquisition range to 0 should do it too. When I said 5 above I was thinking that you did want them to attack if attacked. But if not, then try 0 a.r. or Flux's solution. Trigger's are a sloppy way to do this.
 
Last edited:
Level 21
Joined
Mar 27, 2012
Messages
3,232
Setting acquisition range to 0 breaks stuff as well. Attack-move will not work, as the unit will act like it's a move order. It also reduces the attack range when set lower than it.
I remember pausing units being problematic for some reasons too, but don't remember the exact reasons. There are discussions about this around, especially near pause systems.

In any case, you can also disable the unit's attack with Cargo Hold(Burrow). Then remove this ability when the unit is supposed to attack. I don't know if this fits your case, you'll just have to pick one of the solutions.
 
Then why not just pause the unit instead? This is what the poster of this thread describ above
Setting acquisition range to 0 then the unit will do nothing, it's like u pause that unit

Pause will make it so the unit cannot move or cast. He wants it just to ignore attacks and never auto attack. A.R. to 0 does this. You can still attack units but it must be done manually. This is what he wants, I believe. I wonder why he hasn't commented in a while. It breaks nothing, it does not affect range, just the auto acquire target.
 
Setting acquire range to 0 in object editor sets the attack range to 0 as well.
Yes, it looks crappy for ranged units. Looks great on melee units though. I tested it just now and it allows you to attack when ordered or when attacked, however, the acquisition range must be set to 1 not 0. Zero is like setting it to 9999999. It makes it infinite. Setting it to 1 is exactly what he wants and it is the most efficient solution if he is using melee units.

What about if he could just change the ownership of this unit (make player red threat player blue as neutral passive, for example)
That's a good idea but it makes it so your units will never attack once attacked.

However, you could trigger it to change if a unit is attacked. Skulesta! What kind of game is this? Will you have multiple units for each player?

I think he may not be checking in any longer.
 
Last edited:
Level 11
Joined
Jun 2, 2013
Messages
613
Why don't you want them to attack back?

I'm not sure if this will work but you could try this:

Make the player being attacked (Owner of your Hero-peon units) treat the attacking player as neutral with no vision, through a trigger.

This way, the attacking player would always auto-attack, but the attacked player's hero would only attack if ordered by the 'Attack' command (via hotkey).

Example:

Player 1 Treats Player 2 as Neutral with no vision ---> Player 1's units should not engage Player 2's units - even when attacked.

Player 2 Treats Player 1 as an Enemy with no Vision ---> Player 2's units will always auto-attack Player 1, but Player 1 will not engage unless directly ordered.

EDIT** Just saw this was already mentioned above. Oops :)
 
Status
Not open for further replies.
Top