| 04-13-2003, 07:44 AM | #1 |
is their any way to set a unit variable to closest unit matching condition? |
| 04-13-2003, 02:03 PM | #2 |
Simply change the filter as the situation calls for. I think it will correctly, as its the same used for the closet goldmine. Code:
function filter takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit()) == udg_type
endfunction
function f2 takes location loc returns unit
local group g = null
local unit rc = null
local boolexpr myFilter
set g = CreateGroup()
set myFilter = Filter(function filter)
call GroupEnumUnitsInRangeOfLoc(g, loc, 2*bj_CELLWIDTH, myFilter)
set rc = FirstOfGroup(g)
return rc
endfunction |
