function GetUnitCollisionSize takes unit u returns real
local real r = 200 //max collision size
local real x = GetUnitX(u)
local real y = GetUnitY(u)
loop
exitwhen (r <= 0) or not IsUnitInRangeXY(u, x+r, y)
set r = r - 5 //decrements by 5, meaning this will only be
//accurate to 5 units of measurement.
endloop
if r < 0 then
set r = 0
endif
return r
endfunction