General - Making Gates Close

Tutorial by Exide

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.)

(Image)


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.

(Image)


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!


(Image)


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:

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:

(Image)

(Image)

(Image)
Click here to comment on this tutorial.
Tutorials submitted by users are copyright of the original author. All other content on this site is copyright TheHelper.net.
Copyright is secured automatically upon creation, and does not require registration