1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Ride into the sunset with the 32nd Modeling Contest.
    Dismiss Notice
  4. This adventure has come to an end. Congratulate our heroes in the 16th Mini Mapping Contest Results.
    Dismiss Notice
  5. From the gates of hell, the 5th Special Effect Contest Results have emerged.
    Dismiss Notice
  6. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

How to Make Buildable Gates

Discussion in 'Trigger (GUI) Editor Tutorials' started by Mashintao, Apr 21, 2008.

  1. Mashintao

    Mashintao

    Joined:
    Feb 1, 2008
    Messages:
    25
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    How to Make Buildable Gates!


    Introduction
    This tutorial will show you in a step by step process, how to make both horizontal and vertical 'smart gates' that may be built by any standard builder unit. It requires you to make 6 rects, 5 variables, 5 triggers, 4 custom abilities, 4 gates, and 1 builder unit. No uploading is required. The gates will open and close by selecting them and clicking on the open/close abilities. If a unit is blocking the gate while it is closing, then the unit will be moved out of the way in a direction depending on which side of the gate they are on. (Note: Vertical gates will appear to be Horizontal until they are fully constructed.)
    -----------------------------------------------------------------------------------------------------------------------


    Part 1: The Abilities
    Okay, time to get started! Open the Object Editor by pressing F6, and switch over to the "Abilities" tab. Here, you are going to make two sets of Open and Close abilities that your gates will utilize.
    • Under the "Neutral Hostile - Units" list, right-click the "Summon Sea Elemental" spell and select "New Custom Ability." Name this new ability as "Open Gate" and hit 'OK'. Then, copy the newly created "Open Gate" spell and paste it 3 more times so you have a total of 4 custom abilities.
    • Edit their names so that you have 2 "Open Gate" abilities and two "Close Gate" abilities - one of each for vertical and horizontal gates. Also change the "Editor Suffix" property to show (vertical) and (horizontal) so that you can distinguish between the two types.
    • Change the "Data - number of units summoned" to 0 for all of the abilities, edit the Tooltips and Icons to display something appropriate for a gate opening/closing ability. You may want to set the duration, cooldown, and mana cost to 0, and the Button Position (X,Y) to 0 also.
    • You should now have 4 properly labeled abilities that have no effect.
    How it should look
    [​IMG]


    Part 2: The Gates
    Now you can create the gates themselves! With the Object Editor still open, switch over to the Units tab. You will need to select a starter building to base your gate off of. Let's use a Human Farm to make things easier.
    • Right-click on Farm (located in Human -> Melee -> Buildings) and select "New custom Unit," name it as "Gate" and hit "OK."
    • Again copy the newly created Gate unit and paste it 3 more times so you have 4 Gates total.
    • Edit the Editor Suffix properties to say (open)(horizontal), (open)(vertical), (closed)(horizontal), and (closed)(vertical) so you can distinguish between the 4 gates.
    • For each gate, change the "Abilities - Normal" property to its corresponding Open/Close abilities. You should give the following gates these abilities:
      Gate(open)(horizontal) = Close Gate(horizontal)
      Gate(closed)(horizontal) = Open Gate(horizontal)
      Gate(open)(vertical) = Close Gate(vertical)
      Gate(closed)(vertical) = Open Gate(vertical)
    • Now you need to change the statistics to be more Gate appropriate. For all 4 Gates, make the following changes: Model File = Doodads\LordaeronSummer\Terrain\Gate\Gate.mdl ; Unit Soundset = NONE ; Food Produced = 0 ; Techtree - Upgrades Used = NONE ; Ground Texture = NONE
    • For your vertical gates only: Art - Shadow Texture = ShadowGate3 ; Pathing Map = PathTextures\RoundDoor1Path.tga ; Button Position (X) = 1.
    • For your horizontal gates only: Art - Shadow Texture = ShadowGate1 ; Pathing Map = PathTextures\Gate1Path.tga ; Button Postion (X) = 0.
    • Lastly, change the tooltips to say something relative to which gate type they are, and change the Collision Size of the (open) Gates to 0 and the Pathing Map to NONE.
    How it should look
    [​IMG]


    Part 3: The Triggers
    These are the triggers which make your gates function properly. Also, there is a bug that these triggers fix, where if a unit is inside of a gate while it is being closed the gate would hop to a new location. These triggers will instead move the unit out of the way so that the gate can close properly. A separate trigger is necessary to rotate the vertical gates due to the fact that there is no model for them. So here are the triggers you need to make in the trigger editor. I trust you will be able to duplicate them properly? (note that I used "H" and "V" to abbreviate horizontal and vertical.)
    • Before you begin making the triggers, you need to create 6 rects (also known as region) and 5 point variables with the following names and dimensions (the dimensions don't have to be exact, just close):
      HoriDetect : 1000 x 200
      HoriTop : 500 x 200
      HoriBottom : 500 x 200
      HoriTP : (point Variable)
      HoriBP : (point Variable)
      VertDetect : 200 x 1000
      VertLeft : 200 x 500
      VertRight : 200 x 500
      VertLP : (point Variable)
      VertRP : (point Variable)
      VertLocation : (point Variable)
      (points variables are created in the Variable Editor, which can be accessed by pressing Ctrl + B from the trigger editor)
      If you are wondering about how to make the Rect (region) variables have the right dimensions, just create your regions anywhere on the map and edit the "right" and "top" fields to the proper dimensions. Set the "left" and "bottom" fields to 0. The "right" field needs to have the first dimension value and the "top" field needs to have the second value. Here is how it should look:
      Example of HoriDetect Dimensions
      [​IMG]
    • Trigger for opening Horizontal Gates:

      Horizontal Gate Opening Trigger
      • H Gate Open
        • Events
          • Unit - A unit Begins casting an ability
        • Conditions
          • (Ability being cast) Equal to Open Gate (H)
        • Actions
          • Unit - Replace (Casting unit) with a Gate (opened)(horizontal) using The old unit's relative life and mana
          • Animation - Play (Last replaced unit)'s Death Alternate animation
    • Trigger for closing Horizontal Gates:
      Horizontal Gate Closing Trigger
      • H Gate Close
        • Events
          • Unit - A unit Begins casting an ability
        • Conditions
          • (Ability being cast) Equal to Close Gate (H)
        • Actions
          • Rect - Center HoriDetect <gen> on (Position of (Casting unit))
          • Rect - Center HoriTop <gen> on ((Position of (Casting unit)) offset by (0.00, 100.00))
          • Rect - Center HoriBottom <gen> on ((Position of (Casting unit)) offset by (0.00, -100.00))
          • Set HoriBP = ((Position of (Casting unit)) offset by (-200.00, -300.00))
          • Set HoriTP = ((Position of (Casting unit)) offset by (200.00, 300.00))
          • Wait 0.02 seconds
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units in HoriDetect <gen>((((Matching unit) is A structure) Equal to False) and (((Matching unit) is A ground unit) Equal to True))) and do (Actions)
            • Loop - Actions
              • If ((HoriTop <gen> contains (Picked unit)) Equal to True) then do (Unit - Move (Picked unit) instantly to HoriTP) else do (Do nothing)
              • If ((HoriBottom <gen> contains (Picked unit)) Equal to True) then do (Unit - Move (Picked unit) instantly to HoriBP) else do (Do nothing)
          • Wait 0.02 seconds
          • Custom script: call RemoveLocation(udg_HoriTP)
          • Custom script: call RemoveLocation(udg_HoriBP)
          • Unit - Replace (Casting unit) with a Gate (closed)(horizontal) using The old unit's relative life and mana
          • Animation - Play (Last replaced unit)'s stand animation
    • Trigger for making Vertical Gates actually be Vertical:
      Vertical Gate Rotation Trigger
      • V Gate Rotate
        • Events
          • Unit - A unit Finishes construction
        • Conditions
          • (Unit-type of (Constructed structure)) Equal to Gate (closed)(vertical)
        • Actions
          • Set VertLocation = (Position of (Constructed structure))
          • Unit - Remove (Constructed structure) from the game
          • Unit - Create 1 Gate (closed)(vertical) for (Owner of (Constructed structure)) at VertLocation facing 0.00 degrees
          • Custom script: call RemoveLocation(udg_VertLocation)
    • Trigger for opening Vertical Gates:
      Vertical Gate Opening Trigger
      • V Gate Open
        • Events
          • Unit - A unit Begins casting an ability
        • Conditions
          • (Ability being cast) Equal to Open Gate (V)
        • Actions
          • Unit - Replace (Casting unit) with a Gate (opened)(vertical) using The old unit's relative life and mana
          • Animation - Play (Last replaced unit)'s Death Alternate animation
    • Trigger for closing Vertical Gates:
      Vertical Gate Closing Trigger
      • V Gate Close
        • Events
          • Unit - A unit Begins casting an ability
        • Conditions
          • (Ability being cast) Equal to Close Gate (V)
        • Actions
          • Rect - Center VertDetect <gen> on (Position of (Casting unit))
          • Rect - Center VertLeft <gen> on ((Position of (Casting unit)) offset by (-100.00, 0.00))
          • Rect - Center VertRight <gen> on ((Position of (Casting unit)) offset by (100.00, 0.00))
          • Set VertLP = ((Position of (Casting unit)) offset by (-300.00, -200.00))
          • Set VertRP = ((Position of (Casting unit)) offset by (300.00, 200.00))
          • Wait 0.02 seconds
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units in VertDetect <gen>((((Matching unit) is A structure) Equal to False) and (((Matching unit) is A ground unit) Equal to True))) and do (Actions)
            • Loop - Actions
              • If ((VertLeft <gen> contains (Picked unit)) Equal to True) then do (Unit - Move (Picked unit) instantly to VertLP) else do (Do nothing)
              • If ((VertRight <gen> contains (Picked unit)) Equal to True) then do (Unit - Move (Picked unit) instantly to VertRP) else do (Do nothing)
          • Wait 0.02 seconds
          • Custom script: call RemoveLocation(udg_VertRP)
          • Custom script: call RemoveLocation(udg_VertLP)
          • Unit - Replace (Casting unit) with a Gate (closed)(vertical) using The old unit's relative life and mana
          • Animation - Play (Last replaced unit)'s stand animation
    • I apologize for the length of these, but it is necessary for determining which side of the gate to move blocking units to.


    Part 4: The Builder
    I have saved the most difficult part for last!
    • Copy a builder of your choice! (peon, peasant, etc) And then Paste a new one entitled "Gate Builder!"
    • Edit his Techtree - Structures Built to "Gate (closed)(horizontal)" and "Gate (closed)(vertical)"!
    • Wow, that was rough wasn't it?! Of course, you could simply just edit the structures built of the original builder unit instead of making a whole new one. But that wouldn't be quite as original now, would it?


    Additional Information
    There are other methods of making gates work, but this is a simple version that should suit most purposes just fine. If you are capable of making or acquiring a custom Vertical Gate model yourself, then that would cut out the need for the rotation trigger.
    A few side notes:
    • This tutorial was designed for use with World Editor Unlimited 1.20. I see no reason that you might encounter any problems with other editors, but just FYI...
    • If you decide to change the size of your gates, be sure that you scale the size of all the rects to match the size of your gate. The triggers will also have to be altered to properly place the rects on each side of the gate to ensure that blocking units are detected and moved properly.
    • If you prefer to use to chat input or unit proximity to open your gates instead of using abilities, this is also possible, but the method to do so is not included in this tutorial.
    • I hope this helped you some!
     
    Last edited: May 4, 2009
  2. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    You can have the gates morph using Metamorphosis provided you give them the Zone Indicator pathing rather than none at all for the open forms (A blank pathing map will cause a game crash upon metamorphosis).
     
  3. Mashintao

    Mashintao

    Joined:
    Feb 1, 2008
    Messages:
    25
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    I suppose they could morph, yes, but what would that change? One action from each trigger? The vertical model rotation would still be required, the ability detection for death alternate/stand animations would still be required, and the blocking unit mover would be needed still too.

    I guess I could put that in as an alternative method..? That might make things more complicated though... hmmm..... o.0
     
  4. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    You need no triggers with the alternate method, if you import a vertical gate model (15 kb or so, pretty much just rotated on the axis), and it at least saves the triggers for horizontal gates even if you don't (Needs no triggers). You can just add an Animation Tag to the open gate so that you don't need to play the animation via triggers.
     
  5. Mashintao

    Mashintao

    Joined:
    Feb 1, 2008
    Messages:
    25
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    One purpose of this tutorial was to provide a way of having functional gates without doing any model editing or importing. I am well aware that there are 'cleaner' methods for gates, but they are much more complicated (assuming you do the model editing yourself instead of begging), and what I have shown here in my tutorial suits most purposes just as well.

    So far I have been unable to reproduce a triggerless gate opening ability with metamorphosis. Structures with the gate model do no properly display their death alternate animation unless they are first replaced with a new version of itself and then prompted to display it with a trigger. This may work with a destructible doodad, but a worker cannot build a destructible, which is also the purpose of this tutorial.

    I followed your description of making a permanent metamorphosis ability that changes a closed gate into an opened model with "death,alternate" (or "death alternate") as the required animation name, but I am getting no results aside from client crashes. And yes, I put zone indicator as the pathing map, too. But if you say there is a way, then I will keep working at it.
     
  6. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    If you can't get it to work, don't bother, it's not that big of a deal.

    Fix up the leaks in the triggering and this will be approvable.
     
  7. Mashintao

    Mashintao

    Joined:
    Feb 1, 2008
    Messages:
    25
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Leaks fixed to the best of my ability.
     
  8. underscore

    underscore

    Joined:
    Mar 17, 2008
    Messages:
    150
    Resources:
    0
    Resources:
    0

    Q: What is your best ability?

    Anyways, good tutorial helpful for pro and noob users.
     
  9. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    • You stored the points in the variables correctly, but forgot to remove them via
      RemoveLocation
      .
    • You need to destroy the Regions you make, too, via
      RemoveRect
      . Not sure if there is a GUI equivalent for this one.
     
  10. Mashintao

    Mashintao

    Joined:
    Feb 1, 2008
    Messages:
    25
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Erm, yeah I forgot the most important part didn't I? Should be fixed up now. I was tired last night. :croll:


    0.o I have yet to figure that out!
     
  11. Mashintao

    Mashintao

    Joined:
    Feb 1, 2008
    Messages:
    25
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Wait a minute, why do those regions need to be removed if they are created in the editor and not by the trigger? Repositioning them shouldn't leak, right? They are being reused and not having new ones created. If they are removed then new ones would have to be remade.

    (updated triggers, 4/25/08)
     
    Last edited: Apr 26, 2008
  12. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    Didn't see that you were repositioning them, whoops.

    However, you still need to
    RemoveLocation
    all your locations.
     
  13. Mashintao

    Mashintao

    Joined:
    Feb 1, 2008
    Messages:
    25
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Final update is now done... hopefully...
     
  14. Archian

    Archian

    Site Director

    Joined:
    Jan 1, 2006
    Messages:
    2,898
    Resources:
    12
    Skins:
    1
    Tutorials:
    11
    Resources:
    12
    Thread approved.
     
  15. ray12342

    ray12342

    Joined:
    Nov 23, 2006
    Messages:
    63
    Resources:
    0
    Resources:
    0
    Good tutorial But theres about 50 ways i can think of to make buildable gates some only useing 2 triggers and 2 abilitys
     
  16. BlinkBoy

    BlinkBoy

    Joined:
    Nov 11, 2004
    Messages:
    2,108
    Resources:
    12
    Models:
    4
    Icons:
    1
    Tools:
    1
    StarCraft II Resources:
    1
    Tutorials:
    3
    JASS:
    2
    Resources:
    12
    There's a way in which the only thing you need is photoshop and 1 Morphing ability.

    all you do is to create a full Magenta pathmap to the gate, then takes that map path and color the middle with blue. Afterwards you create 2 gates and you assign each of the new pathmaps, then you add a morphing ability between the 2 and that's it.
     
  17. SiK

    SiK

    Joined:
    Jun 29, 2008
    Messages:
    6
    Resources:
    0
    Resources:
    0
    Inthresting... Very usefull to do the real time strategy games! :thumbs_up:
     
  18. Johny F.

    Johny F.

    Joined:
    Jun 4, 2008
    Messages:
    309
    Resources:
    5
    Models:
    4
    Maps:
    1
    Resources:
    5
    could be lots of simpeler but i want i tut to make a waygate
    that i dunno how to do
     
  19. Archimondus

    Archimondus

    Joined:
    Apr 11, 2008
    Messages:
    50
    Resources:
    0
    Resources:
    0
    The builder isn't the hardest part. . . Its easy. . . Its for newbs.
     
  20. Statharas

    Statharas

    Joined:
    Jul 9, 2008
    Messages:
    2,332
    Resources:
    14
    Tools:
    1
    StarCraft II Resources:
    5
    Tutorials:
    8
    Resources:
    14
    Transform

    Have you noticed that with this way you can make spells like Transformation?
    Like:Unit Uses ability
    Conditions:Unit:Druid uses ability:Tree of Life (Part of WoW's spells from druid class)
    Actions:Wait 2 seconds
    |_Change Trigering unit to Tree of Life
    Same Life-mana
    and the oposite
    Conditions:Unit:Tree of Life uses ability:Druid
    Actions:Wait 2 seconds
    |_Change Trigering unit to Druid
    Same Life-mana

    Would work......:):grin::grin::grin::ned::ned::cute:hehe..