Warcraft III resources & community, 2003–2006 · archived

SelectUnittype

not rated
Submitted by AIAndyFunctions0 downloads
Filters g for units belonging to / not belonging to a given unittype (UNIT_TYPE_STRUCTURE, ...). Mainly for usage in AI as it destroys g.
Usually used like this:
set g = SelectUnittype(g, UNIT_TYPE_STRUCTURE, true)

Source

function SelectUnittype takes group g, unittype typ, boolean is_of_type returns group
     local unit u = null
     local group rg = CreateGroup()
     loop
       set u = FirstOfGroup(g)
       exitwhen u == null
       if IsUnitType(u, typ) == is_of_type then
          call GroupAddUnit(rg, u ) 
       endif
       call GroupRemoveUnit(g, u )
     endloop
     call DestroyGroup(g)
     return rg
endfunction

Comments

0

No comments.