HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Boolexpr filter parameter

11-14-2007, 01:36 PM#1
Silvenon
I know the thread like this already exists, but somebody tested it and it didn't work, so I want to know for sure if it works.

Can you use the boolexpr parameter in TriggerRegister functions as a condition (with GetTriggerUnit() replaced with GetFilterUnit()) of triggers? Does that work? Example:

Collapse JASS:
function Test_Cond takes nothing returns boolean
    return not IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)
endfunction

function Test_Act takes nothing returns nothing
    call DoSomething()
endfunction

function InitTrig_Test takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterPlayerUnitEvent(t, Player(0), EVENT_PLAYER_UNIT_WHATEVER, Condition(function Test_Cond))
    call TriggerAddAction(t, function Test_Act)
    set t = null
endfunction
11-17-2007, 10:52 AM#2
Silvenon
*Bump*........no one knows??
11-17-2007, 11:07 AM#3
Malf
GetFilterUnit() is used for.. Filtering units. Usually in enumerating units by GroupEnumUnitsInRange()

You should use the appropriate event responses for your event, like GetDyingUnit() for a unit dies event and etc,.
11-17-2007, 04:53 PM#4
Salbrismind
From what someone just taught me, it seems like there is no difference between "GetFilterUnit()" and "GetTriggerUnit()"
11-17-2007, 07:08 PM#5
Silvenon
Quote:
Originally Posted by Salbrismind
From what someone just taught me, it seems like there is no difference between "GetFilterUnit()" and "GetTriggerUnit()"

Oh yes, I forgot that event responses can be transfered using Condition()/Filter()........wait, there's not event response yet because the trigger didn't fire......hmmm weird, I'm gonna test that later. I would've test it sooner, but I don't have WE so I asked you guys if you can test it for me.

Btw, GetDyingUnit() == GetTriggerUnit() (and also faster)
11-18-2007, 03:54 AM#6
Pyrogasm
Yes, Silvenon, you can do that. The problem being that the only unit you can reference is the triggering unit... not the target of a spell.
11-18-2007, 08:00 AM#7
Iron_Doors
I just tested this a few days ago and noticed that GetFilterUnit()==null and GetTriggerUnit()!=null in triggerconditions. I dont remember the event i used though.... I tested them like this:
Collapse JASS:
call BJDebugMsg("filter unit: "+I2S(H2I(GetFilterUnit())))

If that displays 0 then it means that the handle is null.
11-18-2007, 09:48 AM#8
Silvenon
Oh, I thought you can use event responses like that.......too bad. Then you can't even check if the spell id is right.