Warcraft III resources & community, 2003–2006 · archived

SelectByPlayer

not rated
Submitted by AIAndyFunctions0 downloads
Filters g for units that belong to a certain player. Mainly for usage in AI as it destroys g.
Usually used like this:
set g = SelectByPlayer(g, Player(0))

Source

function SelectByPlayer takes group g, player p returns group
     local unit u = null
     local group rg = CreateGroup()
     loop
       set u = FirstOfGroup(g)
       exitwhen u == null
       if GetOwningPlayer(u) == p then
          call GroupAddUnit(rg, u )
       endif
       call GroupRemoveUnit(g, u )
     endloop
     call DestroyGroup(g)
     return rg
endfunction

Comments

1
hey do u think u can make umm where unit is clicked remove health then clicked again and do the same?