• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Gate Trigger

Status
Not open for further replies.
Level 2
Joined
Feb 27, 2011
Messages
6
Hey guys.


I'm making a map with gates. The commands for the gates are simply "-open main" and "-close main", using that as an example. However I want it so that when a gate is destroyed, the trigger for "-open main" and "-close main" are removed. So I make a trigger that makes it so when "main gate" dies, the triggers "-open main" and "-close main" are removed. Here's the problem:

I start up the map and I type "-open main" and the main gate opens like it's supposed to. Yet when I type "-close main" nothing happens. So I disable the trigger that removes the "-open main" and "-close main" triggers when the main gate dies. I start up the map again and type "-open main" and it opens and "-close main" and it closes, working perfectly.

Anyone know how to fix my problem? I want it so that when a gate is destroyed, players cannot do "-open main" or "-close main" so that the gate is back alive, yet when I make a trigger for that, I cannot close the gates.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
When the gate dies, turn off the trigger for the command "-open main" and "-close main" trigger

Example:
This is for Open and Close trigger
  • Open and Close
    • Events
      • Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Entered chat string) Equal to -open main
        • Then - Actions
          • Destructible - Open *YourGate*
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Entered chat string) Equal to -close main
            • Then - Actions
              • Destructible - Close *YourGate*
            • Else - Actions
This is for preventing the player to activate it ever again
  • Turn Off Trigger
    • Events
      • Destructible - *YourGate* dies
    • Conditions
    • Actions
      • Trigger - Turn off Open and Close <gen>
 
Level 2
Joined
Feb 27, 2011
Messages
6
Wow I wasn't even close in terms of gate trigger. Mine was simply:


  • Untitled Trigger 010
    • Events
      • Player - Player 1 (Red) types a chat message containing -open main as An exact match
    • Conditions
    • Actions
      • Destructible - Open Maradon Gate (Horizontal) 1230 <gen>
  • Untitled Trigger 011
    • Events
      • Player - Player 1 (Red) types a chat message containing -close main as An exact match
    • Conditions
    • Actions
      • Destructible - Close Maradon Gate (Horizontal) 1230 <gen>



That was it. Haha, thanks a lot for your help! MUCH appreciated!


EDIT: I just tried it, and it still won't close after I open it.


  • Close HQ
    • Events
      • Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
      • Player - Player 2 (Blue) types a chat message containing <Empty String> as A substring
      • Player - Player 3 (Teal) types a chat message containing <Empty String> as A substring
      • Player - Player 4 (Purple) types a chat message containing <Empty String> as A substring
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Entered chat string) Equal to -open main
        • Then - Actions
          • Destructible - Open Maradon Gate (Horizontal) 1230 <gen>
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Entered chat string) Equal to -close main
            • Then - Actions
              • Destructible - Close Maradon Gate (Horizontal) 1230 <gen>
            • Else - Actions
  • Main
    • Events
      • Destructible - Maradon Gate (Horizontal) 1230 <gen> dies
    • Conditions
    • Actions
      • Trigger - Turn off Close HQ <gen>

Gates still won't close after I open them. I disabled the second trigger, "Close HQ" and it worked again but it would come back if I typed "-open main" after I killed it.
 
Store the life of the gate in a variable before opening it (because that kills the destructable) and then upon closing, restore its life. (or you can even just set it to its max life, it is up to you)

  • Close HQ
    • Events
      • Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
      • Player - Player 2 (Blue) types a chat message containing <Empty String> as A substring
      • Player - Player 3 (Teal) types a chat message containing <Empty String> as A substring
      • Player - Player 4 (Purple) types a chat message containing <Empty String> as A substring
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Entered chat string) Equal to -open main
        • Then - Actions
          • Set MaradonLife = (Current life of (Maradon Gate (Horizontal) 1230 <gen>))
          • Destructible - Open Maradon Gate (Horizontal) 1230 <gen>
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Entered chat string) Equal to -close main
            • Then - Actions
              • Destructible - Close Maradon Gate (Horizontal) 1230 <gen>
              • Destructible - Set life of Maradon Gate (Horizontal) 1230 <gen> to MaradonLife
            • Else - Actions
Try that and see if it works. :)
 
Level 2
Joined
Feb 27, 2011
Messages
6
  • Close HQ
    • Events
      • Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
      • Player - Player 2 (Blue) types a chat message containing <Empty String> as A substring
      • Player - Player 3 (Teal) types a chat message containing <Empty String> as A substring
      • Player - Player 4 (Purple) types a chat message containing <Empty String> as A substring
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Entered chat string) Equal to -open main
        • Then - Actions
          • Destructible - Set life of Maradon Gate (Horizontal) 1230 <gen> to (Max life of Maradon Gate (Horizontal) 1230 <gen>)
          • Destructible - Open Maradon Gate (Horizontal) 1230 <gen>
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Entered chat string) Equal to -close main
            • Then - Actions
              • Destructible - Close Maradon Gate (Horizontal) 1230 <gen>
              • Destructible - Set max life of Maradon Gate (Horizontal) 1230 <gen> to (Max life of Maradon Gate (Horizontal) 1230 <gen>)
            • Else - Actions
Still doesn't work. Gah. Why does opening a gate kill it? That's so stupid!
 
Level 2
Joined
Feb 27, 2011
Messages
6
Guys, I just changed how I'm gonna do gates. Thanks for all the help, but that was getting frustrating and it was the only thing keeping the map from being completed.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You cannot relate it together, wanna know why ?
It is because the gate is "dead" when we use the action "Open Gate"
And when it is "dead", the other trigger that checks the gate's condition, if die = Turn off trigger
That's where the issue comes
 
Status
Not open for further replies.
Top