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

Buildable way gate

Status
Not open for further replies.
Level 2
Joined
Sep 4, 2021
Messages
4
Hi.

Excuse my english and in case the triggers are not written as in the editor. I've seen many forums of people trying to make a buildable Way gate or recreate the Nydus canal from Starcraft, so I ended up making a system that might work.

Four skills are required:
  1. Load
  2. Unload
  3. Cargo
  4. One based on Channel

The range of Unload must be increased to 99999. The duration of Cargo will be 0. The ability based on Channel should be marked as a target unit and have a range of 99999.

Once this is done, we will only give the Way gate the Load and Channel ability in the object editor. Because if we give it Unload, it will be able to unload units in any area of the map and we don't want that. And we do not give Cargo to be able to differentiate the incomplete Way Gates from the complete ones. Now we will need 3 detonators for it to work.

The first trigger is to give the finished Way gates the Cargo ability. This prevents incomplete Way gates from being valid targets to Unload.

  • Add Cargo
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Way gate
    • Actions
      • Unit - Add Cargo to (Constructed structure)
I recommend using this path for the Way gate: PathTextures\8x8unbuildable.tga).
If you want to unload units from your own gate to an ally one, you must add some conditions (both players must share units).
  • Unload
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • And
        • (Ability begin cast) Equal to Channel
        • (Level of Cargo for (Target unit of ability being cast)) Equal 1
        • Or
          • (Owner of (Casting unit)) Equal to (Owner of (Target unit of ability being cast))
          • (Owner of (Target unit of ability being cast)) is giving (Owner of (Casting unit)) Shared units
          • (Owner of (Target unit of ability being cast)) is giving (Owner of (Casting unit)) Full shared units
    • Actions
      • Unit - Add Unload to (Casting unit)
      • Unit - Order (Casting unit) to Unload all in (Position of (Target unit of ability being cast))
      • Unit - Remove Unload from (Casting unit)
And for some reason the Way gate after using the trigger once, the next time you load a unit you can use Unload. I'm not sure why, so the third trigger is to prevent this from happening.
  • Fix Unload
    • Events
      • Unit - A unit Load on a transport
    • Conditions
      • (Level of Unload for (Transporting unit)) Equal to 1
    • Actions
      • Unit - Remove Unload from (Transporting unit)
Points in favor:
  • It is buildable.
  • It can only be used by the owner of the building.
  • All Way gates are connected (This could be negative if you are looking for a bi-directional gate like Nydus canal from Starcraft 1).
  • Units are downloaded instantly (If you are looking for them to be discharged one by one, it may work by adding a trigger that verifies when the ability is finished casting/canceled or one of the Way gates dies to remove the ability).

Points against:
  • It's a bit silly, as it takes two clicks to load units into the Way gate (The first to bring them closer to the Load range of the Way gate and the second to charge them when they are within range).
  • Its 10-slot limit makes it slow to move armies.

I hope it helps someone, it is not necessary to give credits, you can modify it to suit what you are looking for and if you do not know how to do it you can ask to see if I can help.
 
Last edited:
Level 2
Joined
Sep 4, 2021
Messages
4
You're right, I call it Way gate for aesthetics, I think "variant" was more accurate.
Something I forgot to mention is that it doesn't work with pre-placed buildings in the editor (unless you add Cargo with triggers).
 
Level 2
Joined
Sep 4, 2021
Messages
4
I was not sure how the Nydus Canal worked in Starcraft 2 but after investigating, I would say that the mechanics are similar, although you must use a worker to build all gates and as I explained, the way to move units is a bit clumsy.
 
Level 2
Joined
Sep 4, 2021
Messages
4
The Rally ability does not work on unloaded units (if I'm wrong it would be great), that's why an indexer should be used, it's not my strong suit but I made it work halfway because all the functions of the rally point would have to be recreated.
An alternative would be to use the Rally ability and have a single command (move to, attack-move, whatever).

For this alternative, six variables are needed:
  1. Gate (Unit array (1))
  2. Rally (Point array (1))
  3. Loaded (Unit Group array (128)) (You must initialize a Unit group for it to work)
  4. Index (Integer)
  5. Loop (Integer)
  6. Destiny (Integer)
I will not explain much about how this works (as I said, it is not my strong suit), I recommend watching a tutorial.

  • Add Cargo
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Way gate
    • Actions
      • Unit - Add Cargo to (Constructed structure)
      • Set Index = (Index + 1)
      • Set Gate[Index] = (Constructed structure)
      • Set Rally[Index] = (Position of Gate[Index])
I use loops to find the unit I am looking for, I don't know if there will be a better way.

  • Fix Unload
    • Events
      • Unit - A unit Load on a transport
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Unload for (Transporting unit)) Equal to 1
        • Then - Actions
          • Unit - Remove Unload from (Transporting unit)
        • Else - Actions
      • For each (Integer Loop) from 1 to Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Transporting unit) Equal to Gate[Loop]
                  • ((Loadind unit) is in Loaded[Loop]) Equal to False
            • Then - Actions
              • Unit Group - Add (Loading unit) to Loaded[Loop]
            • Else - Actions
  • Unload
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Ability begin cast) Equal to Channel
          • (Level of Cargo for (Target unit of ability being cast)) Equal 1
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Casting unit)) Equal to (Owner of (Target unit of ability being cast))
              • (Owner of (Target unit of ability being cast)) is giving (Owner of (Casting unit)) Shared units
              • (Owner of (Target unit of ability being cast)) is giving (Owner of (Casting unit)) Full shared units
    • Actions
      • For each (Integer Loop) from 1 to Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Target unit of ability being cast) Equal to Gate[Loop]
            • Then - Actions
              • Set Destiny = Loop
              • Else - Actions
      • Unit - Add Unload to (Casting unit)
      • Unit - Order (Casting unit) to Unload all in (Position of (Target unit of ability being cast))
      • Unit - Remove Unload from (Casting unit)
Rally can have two orders: "setrally" when you click on the icon and choose a target, and "smart" when you click directly with the mouse.

  • Rally point
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(setrally))
          • (Issued order) Equal to (Order(smart))
    • Actions
      • For each (Integer Loop) from 1 to Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ordered unit) Equal to Gate[Loop]
            • Then - Actions
              • Set Rally[Loop] = (Target point of issued order)
              • Else - Actions
The last condition is to avoid something unwanted, you see, when the Gate loads a unit (other than the unit being loaded in it), it also tries to mark it with the rally point, but when the unit is loaded it does not end that action, however , that fires the detonator and without the distance condition, the Rally variable would be set where the loaded unit was before loading, which we don't want.

  • Rally object
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(setrally))
          • (Issued order) Equal to (Order(smart))
    • Actions
      • For each (Integer Loop) from 1 to Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ordered unit) Equal to Gate[Loop]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Issued order) Equal to (Order(setrally))
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Target destructible of issued order) Equal to No destructible
                    • Then - Actions
                      • Set Rally[Loop] = (Position of (Target unit of issued order))
                    • Else - Actions
                      • Set Rally[Loop] = (Position of (Target destructible of issued order))
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between (Position of (Target unit of issued order)) and (Position of Gate[Loop])) Greater or equal to 80.00
                    • Then - Actions
                      • Set Rally[Loop] = (Position of (Target unit of issued order))
                    • Else - Actions
              • Else - Actions
In case you did not know, when a unit is unloaded, it receives the order to stop, we can take advantage of that, because for a unit that has been loaded to receive an order, it must first be unloaded.

  • Order
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(stop))
    • Actions
      • For each (Integer Loop) from 1 to Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ordered unit) is in Loaded[Loop] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Destiny Equal to 0
                • Then - Actions
                  • Set Destiny = Loop
                • Else - Actions
              • Unit - Order (Ordered unit) to Move to Rally[Destiny]
              • Unit Group - Remove (Ordered unit) from Loaded[Loop]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Loaded[Loop] is empty) Equal to True
                • Then - Actions
                  • Set Destiny = 0
                • Else - Actions
            • Else - Actions
  • Gate dies
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer Loop) from 1 to Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Dying unit) Equal to Gate[Loop]
            • Then - Actions
              • Set Gate[Loop] = Gate[Index]
              • Set Loaded[Loop] = Loaded[Index]
              • Set Rally[Loop] = Rally[Index]
              • Set Index = (Index - 1)
            • Else - Actions

Basically one point is saved for each Gate built and the units it loads.
And when using the Channel ability, we save the entire number of the exit gate, that way we can then order each unloaded unit to move towards the exit gate rally point.

It's simple if you know the basics of an indexer, but it has flaws:
Setting the rally point of a Gate to a unit will actually only save the point of its current position, so even if the flag is seen over the unit, when unloading units at that Gate, they will only move to the point previously. saved (that is, it does not update as the unit moves).
And as I said at the beginning, it is limited to one action (move, attack-move, patrol, etc).

In fact, it would be interesting to perfect the mechanics of giving a rally point to a transport (although I think that if it had movement there would be a collision with loading).
 
Level 14
Joined
Sep 28, 2011
Messages
968
Trick: instead of indexing you can look at the portal the unit was brought to and check if its rally is an unit or a destructible or a point(there is commands for "rally point of X as unit" and "rally point of X as point" and "rally point of X as destructible") and order the unit to do an action in function.
It is definitively more intensive in calculations however but since variables are limited it can be desirable to minimise the number of indexes.
The fact you could make this index based method work so good is quite impressive.
 
Last edited:
Status
Not open for further replies.
Top