• 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.

How to detect the unit another one comes in range with?

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
"A unit comes withing 400 distance of unit X"

The Triggering Unit is the unit that came withint 400 distance, but how to detect the "UnitX" (specially if it has locust)?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Pick every unit doesn't detect units with locust.

And how to pick exactly the UnitX the other one came at range with?
 
You can always go to a quad tree approach, but that'd require quite a bit of coding =).
Would not make much sense, performance-wise, as I'm pretty sure area enumerations use a quad or boolean tree approach anyway, since the runtime varies a lot depending on how crowded the area is you are enuming, even if the number of units on the map is a constant.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
The thing was to do something for units within certain range, and remove the effects when they come further away. I decided just to pick units withing Range+10 or something, and periodically check distance (which i do anyway) and use a ITE based on that.

Thanks everyone!
 
Status
Not open for further replies.
Top