How do you do a condition with Or?

MasterRofl

New Member
Reaction score
8
I have this:
JASS:
private function Conds takes nothing returns boolean
    return GetUnitTypeId(GetAttacker()) == 'u002'
    return GetUnitTypeId(GetAttacker()) == 'u003'
    return GetUnitTypeId(GetAttacker()) == 'u000'
endfunction
but my trigger isn't working correctly, so I'm assuming that's wrong.

But just in case, here's the entire trigger:
JASS:
library Entangle initializer Init
    
private struct Entangle
    unit a
    unit d
    unit t
    real x
    real y
        method onDestroy takes nothing returns nothing
            set.a = null
            set.d = null
            set.t = null
        endmethod
endstruct
    
private function Actions takes nothing returns nothing
    local Entangle e = Entangle.create()
    set e.a = GetAttacker()
    set e.t = GetTriggerUnit()
    set e.x = GetUnitX(e.t)
    set e.y = GetUnitY(e.t)
    if GetRandomInt(1, 100) < 81 then
        set e.d = CreateUnit( GetOwningPlayer(e.a), 'n000', e.x, e.y, 0. )
        call UnitAddAbility(e.d, 'A02R')
        call SetUnitAbilityLevel(e.d, 'A02R', 1)
        call IssueTargetOrder(e.d, "entanglingroots", e.t)
        //call RemoveUnit(e.d)
        call UnitApplyTimedLife(e.d, 'BTLF', 1.)
    endif
    call e.destroy()
endfunction
        
private function Conds takes nothing returns boolean
    return GetUnitTypeId(GetAttacker()) == 'u002'
    return GetUnitTypeId(GetAttacker()) == 'u003'
    return GetUnitTypeId(GetAttacker()) == 'u000'
endfunction
    
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ATTACKED)
    call TriggerAddCondition(t, Condition( function Conds ))
    call TriggerAddAction(t, function Actions)
    set t = null
endfunction

endlibrary
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top