- Joined
- Jan 7, 2009
- Messages
- 44
Hello everyone, is there a function (in JASS) to select units in a line instead of selecting unit groups thousand times using PolarProjection. Can anyone post it here if it even exist?
EDIT: I found it by my self (GroupEnumUnitsInLine - made by Tossrock)
EDIT: I found it by my self (GroupEnumUnitsInLine - made by Tossrock)
JASS:
function GroupEnumUnitsInLine takes group g, real x1, real y1, real x2, real y2, real width returns nothing
local real angle = Atan2(y2-y1,x2-x1)
local real dist = SquareRoot( (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1) )
local real cdist = 0
local group temp
loop
exitwhen (cdist > dist)
set temp = CreateGroup()
call GroupEnumUnitsInRange(temp,x1,y1,width/2,null)
set bj_wantDestroyGroup = true
call GroupAddGroup(temp,g)
set x1 = x1+((width/4)*Cos(angle))
set y1 = y1+((width/4)*Sin(angle))
set cdist = cdist + (width/4)
endloop
set temp = null
endfunction
Last edited: