• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

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)?
 
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.
 
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.
Back
Top