Gate stays vulnerable?

_whelp

New Member
Reaction score
54
I have this trigger, which when a specific crate is killed, the gate becomes vulnerable. The problem is that the gate won't be invulnerable before the crate dies. Do you know what I did wrong?

JASS:

//Noob-ish code...

scope LevelOne initializer InitTrig
    globals
        private destructable Crates = gg_dest_LTcr_0001
        private destructable Gate = gg_dest_DTg7_0002
        private timer T = CreateTimer()
    endglobals
    
    private function Update takes nothing returns nothing
        if(GetDestructableLife(Crates) <= 0) then
            call PauseTimer(T)
            call BJDebugMsg("Gate is now vulnerable.")
            call SetDestructableInvulnerable(Gate, false)
        endif
    endfunction
    
    private function InitTrig takes nothing returns nothing
        call SetDestructableInvulnerable(Gate, true)
        call TimerStart(T, .01, true, function Update)
    endfunction
endscope
 

_whelp

New Member
Reaction score
54
Okay, the event fixed one problem, but the gate stays invulnerable still.
JASS:

scope LevelOne initializer InitTrig
    globals
        private destructable Crates = gg_dest_LTcr_0001
        private destructable Gate = gg_dest_DTg7_0002
        private timer T = CreateTimer()
    endglobals
    
    private function Actions takes nothing returns boolean
        call SetDestructableInvulnerable(Gate, false)
        return false
    endfunction
    
    private function InitTrig takes nothing returns nothing
        local trigger trig = CreateTrigger()
        call SetDestructableInvulnerable(Gate, true)
        call TriggerRegisterDeathEvent(trig, Crates)
        call TriggerAddCondition(trig, Condition(function Actions))
    endfunction
endscope
 

Azlier

Old World Ghost
Reaction score
461
The problem is in your globals block. You're setting some globals to preplaced gg_dest objects. It won't work because those don't exist, yet. They're currently null. You need to set your globals in the initializer.

Using conditions and not actions? Very nice.
 

_whelp

New Member
Reaction score
54
Okay, I'll try, but someone's sleeping in the room with the computer with Wc3 in it.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top