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

Pick units in a line?

Status
Not open for further replies.
Level 20
Joined
Apr 14, 2012
Messages
2,901
Something like this:
  • Line Detect
  • Events
  • Conditions
  • Actions
    • Set Point[1] = Position of Unit
    • Set Point[2] = Target Point
    • For Each Integer A from 1 to 12, do (Actions)
      • Loop
        • Set TempReal = TempReal + 200
        • Unit Group - Pick Every unit in Point offset by TempReal towards Angle from Point[1] to Point[2] and do Actions
          • Loop
?
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
Pick every unit works by picking in a circular area of radius equal to the distance you select, if I'm not wrong. Sure you could do that, but it wouldn't really be a line. I think rects (GUI “regions”) is what you're looking for — they're quadrangular.

P.S. — For more complex forms, you should probably search for a snippet.
 
Level 7
Joined
Nov 18, 2012
Messages
272
Well... I was able to make it check once every 2 triggers.
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Check[M_Int] Equal to True
    • Then - Actions
      • Do the Big Loop
      • Set Check[M_Int] = False
    • Else - Actions
      • Set Check[M_Int] = True
Hope it doesn't lag when multiple spells of this are cast (at once)

Also, regions won't do because they don't work well on diagonals.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Well, how about make a region that has a shape of line and has this thickness.... Worth a try but has some flaws maybe and worst might not work.

Approximating a region might make sense if you use the same line over and over again because there is the function

native IsUnitInRegion (region whichRegion, unit whichUnit) returns boolean

so you do not need to get the unit's coordinates nor do calculations.
 
Status
Not open for further replies.
Top