Warcraft III resources & community, 2003–2006 · archived

LastOfGroup

not rated
Submitted by Nantuko_HuskFunctions0 downloads
this acts same as FirstOfGroup with the difference that this one returns the last unit of the given gruop.

Source

function LastOfGroup takes group g returns unit
local unit u
local group y=g

if CountUnitsInGroup(y)<1 then
return FirstOfGroup(y) //actually now will return a null if the group is empty or something similiar..
endif

loop
exitwhen CountUnitsInGroup(y)==1
set u=FirstOfGroup(y)
call GroupRemoveUnit(y,u)
endloop
set u=FirstOfGroup(y)
call DestroyGroup(y)
set y=null
return u
endfunction

Comments

0

No comments.