HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

check if all units in rect are dead, help please

08-12-2004, 10:35 AM#1
MightyMonk
I use this check to know whether all units in rect are dead or not,
from some reason the unit aren't dead and it keeps get in the check even if they are alive,
don't treat the array and the memory clean up, I already remove it and it doesn't help.

Should I check it by the number of units, or use the function IsUnitGroupEmptyBJ
hmm well It will give almost same result I think.
by usually I hate to use blizzard function oh well

any idea ?

thanks for helping ;)

Code:
	local group array g
	set bj_wantDestroyGroup = true
	set g[0] = GetUnitsInRectAll(gg_rct_Force_1_Bottom_Creeps_Rect_1)
	set g[1] = GetUnitsInRectAll(gg_rct_Force_1_Bottom_Creeps_Rect_2)
	set g[2] = GetUnitsInRectAll(gg_rct_Force_1_Bottom_Creeps_Rect_3)
    
	if ( IsUnitGroupDeadBJ(g[0]) == true and IsUnitGroupDeadBJ(g[1]) == true and IsUnitGroupDeadBJ(g[2]) == true ) then
        return true
    endif
    
    //=== S: Memory Clean Up ===//
    call GroupClear(g[0])
    set g[0] = null
	call GroupClear(g[1])
    set g[1] = null
	call GroupClear(g[2])
    set g[2] = null
    //=== E: Memory Clean Up ===//

If you can delete it, I already figure it out sorry :P
08-12-2004, 02:37 PM#2
Cubasis
Heh,

The funny thing is... that you ARE using blizzard.j function ALL the time in your codes :). You should browse common.j more.

GetUnitsInRectAll is a blizzard.j function. bj_wantdestroygroup is a blizzard.j treat, which you are in reality using wrongly here. IsUnitGroupDeadBJ is a blizzard.j function. And lastly, you use DestroyGroup to clean up groups, not ClearGroup. :)

When working with groups while avoiding bj funcs, you start with initiating your local group variable.
local group mygroup = CreateGroup()

That's the start, then you pass this group in to common.j group functions. When you're done, you destroy them with DestroyGroup, and null the local.

~Cubasis