Warcraft III resources & community, 2003–2006 · archived

UnitAliveInGroup

not rated
Submitted by AIAndyAI0 downloads
Returns if a unit is alive in the group. Dead units at the beginning of the group are removed. If there are none alive, the group is destroyed.
This uses the native UnitAlive that is only available in AI. For non AI usage it has to be replaced with IsUnitAliveBJ or similar stuff.

Source

function UnitAliveInGroup takes group g returns boolean
  local unit u = null

  loop
    set u = FirstOfGroup(g)
    if u == null then
      call DestroyGroup(g)
      return false
    endif
    if UnitAlive(u) then
      return true
    endif
    call GroupRemoveUnit(g,u)
  endloop
  return true // never reached
endfunction

Comments

0

No comments.