• 🏆 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!

Openable/Closable Gates

Status
Not open for further replies.
Level 7
Joined
May 30, 2018
Messages
290
Hey guys,

I am in a rather dire situation. For the map Iam creating I need gates that can be opened or closed (I got it to work with destructible-triggers pretty simple) but the big problem is the following: When the gate gets destroyed by say an enemy , the owner of the gate can just "revive" it by closing it again ....Is there a way around this. I just need a simple gate, which can open/close on demand and also can be ultimately destroyed by enemies (without respawning by closing). :/ I hope somebody can help me....I already looked for solutions here and on other boards, but nothing seems to work.


Thanks in advance!
 
Level 7
Joined
May 30, 2018
Messages
290
Add a Boolean condition to your trigger that checks if the gate is alive. The condition you're looking for is "Destructible - Destructible is alive".

Thank you for your answer. I tried to implement this condition but there is a new problem now: the gates "die" when they open, so the close command doesn't work on them anymore after they are opened once (cause they "die" when opened).

  • Close Gate 1
    • Events
      • Player - Player 1 (Red) types a chat message containing -close as An exact match
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Gate (Horizontal) 2734 <gen> is alive) Equal to True
        • Then - Actions
          • Destructible - Close Gate (Horizontal) 2734 <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Gate (Horizontal) 2726 <gen> is alive) Equal to True
        • Then - Actions
          • Destructible - Close Gate (Horizontal) 2726 <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Gate (Horizontal) 2732 <gen> is alive) Equal to True
        • Then - Actions
          • Destructible - Close Gate (Horizontal) 2732 <gen>
        • Else - Actions
this is how I tried it. Oh yeah I forgot to mention that 3 Gates are opened/closed simultaneously.

  • Open Gate 1
    • Events
      • Player - Player 1 (Red) types a chat message containing -open as An exact match
    • Conditions
    • Actions
      • Destructible - Open Gate (Horizontal) 2732 <gen>
      • Destructible - Open Gate (Horizontal) 2726 <gen>
      • Destructible - Open Gate (Horizontal) 2734 <gen>
that is the trigger to open the gates
 
Level 6
Joined
Dec 31, 2017
Messages
138
Put gates' alive status into a boolean:
  • Open Gate 1
    • Events
      • Player - Player 1 (Red) types a chat message containing -open as An exact match
    • Conditions
    • Actions
      • Destructible - Open Gate (Horizontal) 2732 <gen>
      • Set Gate1Alive = True
      • Destructible - Open Gate (Horizontal) 2726 <gen>
      • Set Gate2Alive = True
      • Destructible - Open Gate (Horizontal) 2734 <gen>
      • Set Gate3Alive = True
Restore when closed:
  • Close Gate 1
    • Events
      • Player - Player 1 (Red) types a chat message containing -close as An exact match
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Gate1Alive) Equal to True
        • Then - Actions
          • Destructible - Close Gate (Horizontal) 2734 <gen>
          • Set Gate1Alive = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Gate2Alive) Equal to True
        • Then - Actions
          • Destructible - Close Gate (Horizontal) 2726 <gen>
          • Set Gate2Alive = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Gate3Alive) Equal to True
        • Then - Actions
          • Destructible - Close Gate (Horizontal) 2732 <gen>
          • Set Gate3Alive = False
        • Else - Actions
 
Level 5
Joined
Jul 12, 2016
Messages
59
Thank you for your answer. I tried to implement this condition but there is a new problem now: the gates "die" when they open, so the close command doesn't work on them anymore after they are opened once (cause they "die" when opened).

Oh right, sorry. I forgot that gates "died" when they open.

Put gates' alive status into a boolean:

The issue with this system is that after the gates are destroyed, if you open them you also set the boolean to true, so you still "revive" them.

I've made a new system using Deserted's idea of using Boolean variables. It's a bit clunky, but it gets the job done. You'll need to make a Boolean variable for each gate, I've only used one gate in my example below but you can add more just like you already have:

  • Open Gate
    • Events
      • Player - Player 1 (Red) types a chat message containing -open as An exact match
    • Conditions
    • Actions
      • Trigger - Turn off Gate Destroyed <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Boolean_Gate1Destroyed Equal to False
        • Then - Actions
          • Destructible - Open Gate (Horizontal) 0000 <gen>
        • Else - Actions
      • Trigger - Turn on Gate Destroyed <gen>
  • Close Gate
    • Events
      • Player - Player 1 (Red) types a chat message containing -close as An exact match
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Boolean_Gate1Destroyed Equal to False
        • Then - Actions
          • Destructible - Close Gate (Horizontal) 0000 <gen>
        • Else - Actions
The two triggers above are basically the same as before. Notable difference is that the opening trigger disables the trigger below at the start and enables it at the end again. The trigger below fires whenever a gate dies and turns on its boolean variable to flag that it's been destroyed.

  • Gate Destroyed
    • Events
      • Destructible - A destructible within (Entire map) dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Dying destructible) Equal to Gate (Horizontal) 0000 <gen>
        • Then - Actions
          • Set VariableSet Boolean_Gate1Destroyed = True
        • Else - Actions
If you intend to add many more gates then this whole thing could be made a lot more easy on your copy+paste keys using variable arrays and looping functions.

As a sidenote, I found out while testing that the gate restores to full health whenever it's closed. I dunno if it's going to be an issue in your map, but I figured it'd be worth to mention.
 
Level 7
Joined
May 30, 2018
Messages
290
Oh right, sorry. I forgot that gates "died" when they open.



The issue with this system is that after the gates are destroyed, if you open them you also set the boolean to true, so you still "revive" them.

I've made a new system using Deserted's idea of using Boolean variables. It's a bit clunky, but it gets the job done. You'll need to make a Boolean variable for each gate, I've only used one gate in my example below but you can add more just like you already have:

  • Open Gate
    • Events
      • Player - Player 1 (Red) types a chat message containing -open as An exact match
    • Conditions
    • Actions
      • Trigger - Turn off Gate Destroyed <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Boolean_Gate1Destroyed Equal to False
        • Then - Actions
          • Destructible - Open Gate (Horizontal) 0000 <gen>
        • Else - Actions
      • Trigger - Turn on Gate Destroyed <gen>
  • Close Gate
    • Events
      • Player - Player 1 (Red) types a chat message containing -close as An exact match
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Boolean_Gate1Destroyed Equal to False
        • Then - Actions
          • Destructible - Close Gate (Horizontal) 0000 <gen>
        • Else - Actions
The two triggers above are basically the same as before. Notable difference is that the opening trigger disables the trigger below at the start and enables it at the end again. The trigger below fires whenever a gate dies and turns on its boolean variable to flag that it's been destroyed.

  • Gate Destroyed
    • Events
      • Destructible - A destructible within (Entire map) dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Dying destructible) Equal to Gate (Horizontal) 0000 <gen>
        • Then - Actions
          • Set VariableSet Boolean_Gate1Destroyed = True
        • Else - Actions
If you intend to add many more gates then this whole thing could be made a lot more easy on your copy+paste keys using variable arrays and looping functions.

As a sidenote, I found out while testing that the gate restores to full health whenever it's closed. I dunno if it's going to be an issue in your map, but I figured it'd be worth to mention.

Thats amazing. Thank you for your enormous effort! Iam going to try this out as soon as I can.
Yeah the health of the gates is a little problematic as it should not reset upon closing/opening :/
After all I came to the conclusion that it maybe would be simpler to just make a gate "unit" (not destructible) ....I already made a post about this, because I have no clue whatsoever on how to make a open/closable gate "unit"....but I guess it would make life easier :s

Thank you anyways!
 
Level 7
Joined
May 30, 2018
Messages
290
Put gates' alive status into a boolean:
  • Open Gate 1
    • Events
      • Player - Player 1 (Red) types a chat message containing -open as An exact match
    • Conditions
    • Actions
      • Destructible - Open Gate (Horizontal) 2732 <gen>
      • Set Gate1Alive = True
      • Destructible - Open Gate (Horizontal) 2726 <gen>
      • Set Gate2Alive = True
      • Destructible - Open Gate (Horizontal) 2734 <gen>
      • Set Gate3Alive = True
Restore when closed:
  • Close Gate 1
    • Events
      • Player - Player 1 (Red) types a chat message containing -close as An exact match
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Gate1Alive) Equal to True
        • Then - Actions
          • Destructible - Close Gate (Horizontal) 2734 <gen>
          • Set Gate1Alive = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Gate2Alive) Equal to True
        • Then - Actions
          • Destructible - Close Gate (Horizontal) 2726 <gen>
          • Set Gate2Alive = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Gate3Alive) Equal to True
        • Then - Actions
          • Destructible - Close Gate (Horizontal) 2732 <gen>
          • Set Gate3Alive = False
        • Else - Actions

Thanks for the support mate! Ill try it!
 
Status
Not open for further replies.
Top