Warcraft III resources & community, 2003–2006 · archived

IntersectionGroups

not rated
Submitted by KaTTaNaVariable Change0 downloads
Returns the intersection of the two groups. That means that the returned group will contain all the units which are present in BOTH groups.

Source

function IntersectionGroups takes group One, group Two returns group
    local unit u
    local group result = CreateGroup()
    local group a = CreateGroup()

    call GroupAddGroup( One, a )

    loop
        set u = FirstOfGroup(a)
        exitwhen ( u==null )

        if ( IsUnitInGroup( u, Two ) ) then
            call GroupAddUnit( result, u )
        endif
        
        call GroupRemoveUnit( a, u )
    endloop
    
    call DestroyGroup( a )
    
    return result
endfunction

Comments

0

No comments.