Warcraft III resources & community, 2003–2006 · archived

SelectByUserData

not rated
Submitted by AIAndyFunctions0 downloads
Filters g for units that have / have not a certain user data. Mainly for usage in AI as it destroys g.
Usually used like this:
set g = SelectByUserData(g, 15, true)

Source

function SelectByUserData takes group g, integer d, boolean has_data returns group
     local unit u = null
     local group rg = CreateGroup()
     loop
       set u = FirstOfGroup(g)
       exitwhen u == null
       if (GetUnitUserData(u) == d) == has_data then
          call GroupAddUnit(rg, u )
       endif
       call GroupRemoveUnit(g, u )
     endloop
     call DestroyGroup(g)
     return rg
endfunction

Comments

0

No comments.