• 🏆 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 Opener/Closer v1.0.1.0

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: deepstrasz
A system I made when I saw my friend creating a trigger per gate... lol
Ok well its pretty obvious what this does... It opens and closes gates.
Alright well here are the triggers.
Put your gate type then insert this line below it.
call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
And viola, that gate will now open!

Example:

Set TempDestructibleType = Demonic Gate (Diagonal 1)
Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
  • Initialize Gates
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set GateHash = (Last created hashtable)
      • Set GateOpenRange = 300.00
      • Set GatePickingArea = 1000.00
      • Set TempDestructibleType = Demonic Gate (Diagonal 1)
      • Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
      • Set TempDestructibleType = Demonic Gate (Diagonal 2)
      • Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
      • Set TempDestructibleType = Demonic Gate (Horizontal)
      • Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
      • Set TempDestructibleType = Demonic Gate (Vertical)
      • Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
      • Set TempDestructibleType = Elven Gate (Diagonal 1)
      • Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
      • Set TempDestructibleType = Elven Gate (Diagonal 2)
      • Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
      • Set TempDestructibleType = Elven Gate (Horizontal)
      • Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
      • Set TempDestructibleType = Elven Gate (Vertical)
      • Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
      • Set TempDestructibleType = Gate (Diagonal 1)
      • Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
      • Set TempDestructibleType = Gate (Diagonal 2)
      • Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
      • Set TempDestructibleType = Gate (Horizontal)
      • Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
      • Set TempDestructibleType = Gate (Vertical)
      • Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
      • Set TempDestructibleType = Iron Gate (Diagonal 1)
      • Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
      • Set TempDestructibleType = Iron Gate (Diagonal 2)
      • Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
      • Set TempDestructibleType = Iron Gate (Horizontal)
      • Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
      • Set TempDestructibleType = Iron Gate (Vertical)
      • Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
      • Set TempDestructibleType = Iron Gate (Vertical)
      • Custom script: call SaveInteger(udg_GateHash,udg_TempDestructibleType,0,1)
      • Set TempPoint = (Center of (Playable map area))
      • Set GateRect = (Region centered at TempPoint with size (GatePickingArea, GatePickingArea))
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call DestroyTrigger(GetTriggeringTrigger())
  • Gate Open And Close
    • Events
      • Time - Every 0.30 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is A flying unit) Equal to False) and (((Matching unit) is dead) Equal to False))) and do (Actions)
        • Loop - Actions
          • Set TempPoint = (Position of (Picked unit))
          • Region - Center GateRect on TempPoint
          • Destructible - Pick every destructible in GateRect and do (Actions)
            • Loop - Actions
              • Set TempDestructible = (Picked destructible)
              • Set TempDestructibleType = (Destructible-type of TempDestructible)
              • Custom script: set udg_TempInteger = LoadInteger(udg_GateHash,udg_TempDestructibleType,0)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempInteger Equal to 1
                • Then - Actions
                  • Set TempPoint2 = (Position of TempDestructible)
                  • Set TempReal = (Distance between TempPoint and TempPoint2)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TempReal Less than or equal to GateOpenRange
                    • Then - Actions
                      • -------- Insert a condition here. Like if you want it to only open for 1 player or something. --------
                      • Destructible - Open TempDestructible
                    • Else - Actions
                      • Destructible - Close TempDestructible
                  • Custom script: call RemoveLocation(udg_TempPoint2)
                • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint)
Change Log

v1.0.0.0 - Uploaded.
v1.0.1.0 - Changed periodic time to 0.30, made the region permanent, and added configuration. I also pointed out within the code to where you can put conditions of gate opening.
Anyway have fun using this and remember that no credit is required when using any of my resources.

Keywords:
Gates, Gate, Gate Opening, Door Opener
Contents

Gate Opener (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 6 Dec 2011 Bribe: The line where you say the user should add some conditions for the gate ("Insert a condition here. Like if you want it to only open for 1 player or something.") should be...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

6 Dec 2011
Bribe: The line where you say the user should add some conditions for the gate ("Insert a condition here. Like if you want it to only open for 1 player or something.") should be where you have the conditions for "Picked unit is flying == false" and "Picked unit is dead == false". This will make your system easier to edit and it will also run more quickly especially if there are large numbers of units on the map.

Instead of creating a point for the region and removing the point as well, per every unit on the map throughout the entire game, do this from the looping trigger in place of the region/point stuff:
  • Custom script: call MoveRectTo(udg_GateRect, GetUnitX(GetEnumUnit()), GetUnitY(GetEnumUnit()))
. Then you don't need locations at all, save some lines of code, some RAM processing time and generally makes your system better overall.
 
Top