Condition checking if unit is within x range of unit

Yoshii

New Member
Reaction score
74
As it says in the title, is there a way to do this that im not aware of?

I dont think its possible to determine how far away the unit is that easily, what you could do is create a region by trigger in a square form over the unit and have a trigger verify if there is another unit.

unless there are function that return the distance from one position to another which im unaware
edit: return distance seem to be (Distance between (Position of (Triggering unit)) and (Position of (Triggering unit))) == Value 2
 

chanta45

New Member
Reaction score
19
Hmm im making a region around the point of the unit and checking if units within 1 range (i think thats range for adjacent) are the ones I need
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Well, you could periodically run a trigger that will get all units within the range of your unit, within a range, within a circle, so it's the actual range. And, if need be, run filters for those units.

Edit: Nevermind. Yet, I think .1 is the melee range for units. For the range, if that's the area you want it to be. o.o
 

chanta45

New Member
Reaction score
19
Yah basically, I need whenever a road is finished to check if there is another road nearby, then check if is custom value is x1 or x2, and if said then do whatever
 

WildTurkey

Previously known as giv_me_rep
Reaction score
87
((Triggering unit) is in (Region((Position of (Triggering unit)), 150.0))) == true

you get through it by going to unit is in region.
change to region to (covert circle to region)
then just set the beginning point and radius

Copied from Hive. This is earlier on Google Search so i thought we should have the answer here.
 

X-maul

AKA: Demtrod
Reaction score
201
Well... this thread is close to 3 years old.

Please do not necro bumb threads like this.
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
camelCase is not to blame in this case. give_me_rep replied earlier that day.

As for camelCase's suggestion, it's a good idea and it can be a good way to learn more about vectors. However I think the best way to do it is to just use the "Distance between Points" function and use the "Position of Unit" function to get the position of the two units.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top