• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Auto (Responsive) Attack

Status
Not open for further replies.
Level 6
Joined
Jan 2, 2007
Messages
189
I have just been messing around and I was wondering how i can detect attacks. not like the player ordered attacks but when an enemy unit initiates the attack (the enemy comes in range or attacks). How do i detect this?

basically i want to see if you can stop some units from auto aquiring units all together. like an enemy can be right next to them and attacking it but the unit just stands there and takes it, making the player have to manually right click to attack units.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Just give them the worker classification.

If you don't want them to show up as an "Idle Worker", simply add the classification to them when they are created, rather than in the object editor.

If you still care about how to detect autoacquire, it's the event Unit - Acquires a Target, EVENT_UNIT_ACQUIRE_TARGET in Jass. However, there is no Generic (playerunitevent) equivalent.
 
Level 6
Joined
Jan 2, 2007
Messages
189
the only problem with that is when the unit is attacked it runs away a short distance. you can trigger the unit to stop whenever it is attacked, but if the unit is attacked while it attacks then its attack gets cancled. so is there another way to make the unit not react at all when it is attacked?
 
Level 5
Joined
Nov 14, 2007
Messages
161
im not sure if this is right, but in the object editor, under units, find that unit and change the "Stats - Can Flee" to False. i believe that will make him not run if he is attacked, but again, not 100% sure on it.

goodluck
 
Status
Not open for further replies.
Top