HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Can't add a unit to group.

08-11-2006, 12:33 AM#1
The_AwaKening
For some reason, no matter what I try, a particular unit type I am creating will not group or add to a group for me. It used to work, and I was doing some optimization and I'm not sure what I changed that would fook it up. What kind of settings would make a unit ungroupable?

Tried this:
Collapse JASS:
function grouptest takes nothing returns nothing
 local group g = CreateGroup()
    call GroupEnumUnitsInRect(g,gg_rct_test1,null)
    call BJDebugMsg(I2S(CountUnitsInGroup(g))
endfunction
It returns 0 no matter how many of the wisps I have created in that region, and it's not a mistake with the rect; I tested with other units.

I've also tried setting the units to global unit variables.
Collapse JASS:
function grouptest takes nothing returns nothing
 local integer i=0
 local group g = CreateGroup()
    loop
        exitwhen i>10
        call BJDebugMsg(GetUnitName(udg_spirit[i]))
        call GroupAddUnit(g,udg_spirit[i])
        set i=i+1
    endloop
    call BJDebugMsg(I2S(CountUnitsInGroup(g))
endfunction
I know the unit is there because it will display the unit's name, but still returns 0 in the unitgroup.
08-11-2006, 12:35 AM#2
The)TideHunter(
It cant be those functions you shown us, they work fine for me.
Maybe you have something else? whats crashing the thread?
08-11-2006, 12:38 AM#3
The_AwaKening
Ya, I know the functions are ok, I'm just wondering what would keep a unit from grouping. The thread doesn't crash. I have another trigger that loops about 20 times and never crashes, but never returns a unit in the group for me.
08-11-2006, 01:13 AM#4
PipeDream
Locust has this effect.
08-11-2006, 01:18 AM#5
The_AwaKening
I wondered about that one, but can't find that I have locust on the unit anywhere. In the object editor, I have ghost, and invulnerable, but these didn't cause problems before. I must be doing something to the unit in another trigger. Let me know if anything else comes to mind. Thanks

--edit
After doing more testing, I've found that all of my Triggers using GroupEnum are buggy now. Sometimes they work and sometimes they don't. What the hell.
08-11-2006, 03:01 AM#6
Vexorian
Tried FirstOfGroup instead of CountUnitsInGroup?
08-11-2006, 04:23 AM#7
The_AwaKening
Yes, FirstOfGroup was returning null. I'm not sure what happened, but for some reason, after a while, it will start working periodically. Most of the optimization I did that screwed it up somewhere was with cleaning up group leaks. I'm wondering if I may have mistakingly destroyed something or nullified something that I shouldn't have.

Gonna take a break from it for a while, my eyes hurt.