HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

GroupEnumUnitsSelected doesn't work?

04-25-2009, 03:14 PM#1
tamisrah
Can someone tell my why this:
Collapse JASS:
private function StopAggression takes unit u returns nothing
 local integer i = 0
    call SyncSelections()
    loop
        exitwhen i>bj_MAX_PLAYERS
        call GroupEnumUnitsSelected(tempG,Player(i),BOOLEXPR_TRUE)
        set i = i+1
    endloop
    call BJDebugMsg(I2S(CountUnitsInGroup(tempG)))
endfunction

returns 0, whereas that:
Collapse JASS:
private function StopAggression takes unit u returns nothing
 local integer i = 0
    loop
        exitwhen i>bj_MAX_PLAYERS
        call GroupAddGroup(GetUnitsSelectedAll(Player(i)),tempG)
        set i = i+1
    endloop
    call BJDebugMsg(I2S(CountUnitsInGroup(tempG)))
endfunction
returns 2, when 2 units actually are selected?
04-25-2009, 05:52 PM#2
Bobo_The_Kodo
Because you have this in the first one?:
Collapse JASS:
    call SyncSelections()
04-25-2009, 06:09 PM#3
tamisrah
EDIT: OK, scrap that all...

If you call GroupEnum[...] on a group it is cleared.
04-25-2009, 06:20 PM#4
Bobo_The_Kodo
So does player 12 have something selected?

Because all you're doing right now is getting units selected by player 12 in the first example...