• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Trigger] Help with opening gates with levers

Status
Not open for further replies.
Level 2
Joined
Feb 17, 2018
Messages
5
Hi everyone! Thanks in advance for your help!

I have a gate on a fortress, and inside the fortress I have two levers. On one lever I have a trigger that when the lever dies, the gate will open and the lever will resurrect. The other lever closes the gate. This system works just fine, and I can open and close the gate using the levers with no problem.

The problem is that if another player destroys my gate, all I have to do is hit one of the levers again and it resurrects my gate. I can't figure out how to make this not happen.
I've tried making a condition where the lever checks to see if the gate is alive first before opening and closing it, and I've also tried setting a trigger where when the gate is destroyed, it also removes the levers. But both of these triggers mess up my original triggers for some strange reason. They make it so that once I hit the levers to open or close the gate, the levers no longer resurrect. I don't know how to fix it.

I've attached pictures of one of my triggers.

Thanks so much for your help!

asdfasd-png.18888
 
Level 2
Joined
Feb 17, 2018
Messages
5
Yes, I've tried that too. I don't know why, but any additional trigger that I put on there somehow breaks the lever's resurrection trigger. I can't figure out how to fix it. I've uploaded a copy of it just in case anyone feels like they want to experiment with it. It's gonna be a really fun map once this one problem is resolved.

Another problem I noticed when I was testing this map with some friends is that if a friend is attacking my gate, all I have to do is open and close it, and the gate comes back to full health.
 

Attachments

  • GOLD GRAB.w3x
    188.2 KB · Views: 48
Level 37
Joined
Jul 22, 2015
Messages
3,485
It's because of the "trick" Blizzard uses to open & close gates.

JASS:
function ModifyGateBJ takes integer gateOperation, destructable d returns nothing
    if (gateOperation == bj_GATEOPERATION_CLOSE) then
        if (GetDestructableLife(d) <= 0) then
            call DestructableRestoreLife(d, GetDestructableMaxLife(d), true)
        endif
        call SetDestructableAnimation(d, "stand")
    elseif (gateOperation == bj_GATEOPERATION_OPEN) then
        if (GetDestructableLife(d) > 0) then
            call KillDestructable(d)
        endif
        call SetDestructableAnimation(d, "death alternate")
    elseif (gateOperation == bj_GATEOPERATION_DESTROY) then
        if (GetDestructableLife(d) > 0) then
            call KillDestructable(d)
        endif
        call SetDestructableAnimation(d, "death")
    else
        // Unrecognized gate state - ignore the request.
    endif
endfunction

When you want to close the gate, it sets its hp to the maximum value.
When you want to open the gate, it kills the destructable (which breaks the idea I suggested about turning off the trigger).
 
Status
Not open for further replies.
Top