HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How to check the existence of destructables...

05-15-2007, 09:46 AM#1
UnMi
Hmm, how would I be able to see wether there are destructables in an area/rect/whatever or not!?
05-15-2007, 10:34 AM#2
Tide-Arc Ephemera
I am not purely sure but I think this actually a condition. If I'm not sure, I'm sorry. If this isn't it, try looking for "count"

Integer - Destructibles in region is equal to or greater that 0

OR make a trigger that picks all doodads in a region, then add 1 to that varible, then make a comparison that will check that variable.

There could also be a boolean but I'm not sure...
05-15-2007, 11:26 AM#3
UnMi
Wow, I just found the BJ function RandomDestructableInRectSimpleBJ, which like, works ...o_O.
It has the same concept like you said, but while I was bothering how to save and receive the integer Count, BJ just used some random bj_ variables? =.=;
It's even multi-instanceable, not bad for a BJ.
Still, I have no idea about the true mechanics about it...(what are bj_ variables?)
Collapse JASS:
function RandomDestructableInRectBJEnum takes nothing returns nothing
    set bj_destRandomConsidered = bj_destRandomConsidered + 1
    if (GetRandomInt(1,bj_destRandomConsidered) == 1) then
        set bj_destRandomCurrentPick = GetEnumDestructable()
    endif
endfunction

function RandomDestructableInRectBJ takes rect r, boolexpr filter returns destructable
    set bj_destRandomConsidered = 0
    set bj_destRandomCurrentPick = null
    call EnumDestructablesInRect(r, filter, function RandomDestructableInRectBJEnum)
    call DestroyBoolExpr(filter)
    return bj_destRandomCurrentPick
endfunction