Tutorial General - Making Gates Close

Exide

I am amazingly focused right now!
Reaction score
448
Hi.
I have had a lot of problems with SC2's gates. I have finally figured out how to fix them, so I decided to make a tutorial - in case someone else has the same problems I did.


Step 1:
The very first step is to load the Liberty Campaign Dependency.
Do this by going to 'File -> Dependencies...'
Click on the 'Add Standard...' button. Check the box on the bottom of the list, named "Liberty Story (Campaign)", then press Ok. Then press Ok again.
StarEditor will now load triggers, units and what not used in Liberty Story (Campaign) Dependency. -For example the gate units, which are what we want.)

sc2tutorialgatescrn01.jpg



Step 2:
The next step is easy, simply place a gate (or more) any where on your map.
Start by changing to the unit Palette (hotkey: U), and search for "gate". (Make sure you don't have any filters on.)
In this Tutorial I will be using the very first gate. (It is lowered -aka open, by default.)
The second gate is a copy of the first one, only the second gate is closed by default.

sc2tutorialgatescrn02.jpg



Step 3:
Here comes the tricky part.
Open the Data Module (F7).
In the top-left, change "Data Type" to 'Buttons'.
Search for "open gate". -You will find only one button in the list, called "Open Gate".
Right-click on the button and copy it. (ctrl+c)
Right-click again and paste the button. (ctrl+v)
Now right-click on your new button, "Open Gate Copy", choose 'Modify Object...' (ctrl+m) and rename it to 'Close Gate'
Change the buttons ID from "GateOpen2" to "GateClose", then press Ok.
You should now have your new button ready. The broken buttons should now have been fixed, and updated automatically!


sc2tutorialgatescrn03.jpg



Step 4:
Close the Data Module.
Open the Trigger Module (F6).
Create a new trigger, name it "Open Gate".

Change the Event to 'Unit - Unit Enters/Leaves Range of Unit' (it can easily be found if you filter search for "range").

Change it to: Unit - Any Unit Enters a distance of 3.0 from Gate [27.00, 32.00]
Gate [27.00, 32.00] is your pre-placed gate. (Step two of this tutorial.)
Add the following action:
'Unit - Issue Order' (can easily be found by filtering for "order")
change it to: Unit - Order Gate [27.00, 32.00] to ( Open Gate) (Replace Existing Orders)

When you search for the order "Open Gate" you will get a ton of Open Gate orders. -They are basically the same, and will all work for your gate, as long as it is the same unit -type.
The gate that I pre-placed in the second step of this tutorial is of unit type: "DestructibleGate"; meaning that all "Open Gate" (as well as "Close Gate") orders that has an ability name starting with "DestructibleGate.." will work on this unit.

Make a new Trigger, call it 'Close Gate', do the same thing as you did with the 'Open Gate' trigger, only this time, make it look like this:

Code:
Close Gate
    Events
        Unit - Any Unit Leaves a distance of 3.0 from Gate [27.00, 32.00]
    Local Variables
    Conditions
    Actions
        Unit - Order Gate [27.00, 32.00] to ( Close Gate) (Replace Existing Orders)


Step 5:
Finally, place a unit on your map (for example a Marine). Save your map. Order your marine to go near the Gate. (It is already open, so nothing should happen the first time.)
Order your marine to walk away from the gate. The gate should now close. (As long as the marine got withint 3.0 range of the gate, obviously.)
Now move your marine back and forth from the gate, notice how it opens and closes.

That's it, your gate button has been fixed and your gates should now work correctly!




Additional Info:
Lowered (open) gates are unselectable by default. Meaning if you own a gate, and click on it's Open Gate - button, then deselect the gate, you cannot select it again. (Even not by using ctrl+1 groups.)
This can be fixed by going into each gates 'Unit' -Tab in the Data Module. And unchecking the box "Unselectable" under 'Flags'.


Here are pictures of the different gate unit types:

sc2tutorialgatescrn04.jpg


sc2tutorialgatescrn05.jpg


sc2tutorialgatescrn06.jpg
 

tom_mai78101

The Helper Connoisseur / Ex-MineCraft Host
Staff member
Reaction score
1,675
Is it possible to post a picture of opening/closing of the gate when any units walks through it? It will look nicely, in my opinion. :)
 

Jedimindtrixxx

┻━┻ ︵ ¯\(ツ)/¯ ︵ ┻━┻
Reaction score
168
its quite sad that they didnt use something as simple as the wc3 gates. those could be destroyed, or openedwith triggers and it always looked nice.
nice tut tho

if i memory serves me right the very first toss mission had some sort of gates that opened when you reached each prophecy. from what i recall the models looked pretty nice.
im actually gunna favourite this just incase i need to use a gate in a map
 

Exide

I am amazingly focused right now!
Reaction score
448
its quite sad that they didnt use something as simple as the wc3 gates. those could be destroyed, or openedwith triggers and it always looked nice.
nice tut tho

if i memory serves me right the very first toss mission had some sort of gates that opened when you reached each prophecy. from what i recall the models looked pretty nice.
im actually gunna favourite this just incase i need to use a gate in a map

Agreed.
It was so simple, and not bugged - too.

The first Zeratul mission, you mean?
I know that in Tosh' Outbreak there's Security Gates, but they only open (they don't close.)
The open gate button isn't broken, like the close gate button is.

Is it possible to post a picture of opening/closing of the gate when any units walks through it? It will look nicely, in my opinion. :)

Here you go:
89452055.jpg
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top