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

[Solved] Open/Close Gate Ability + Trigger

Status
Not open for further replies.
Level 11
Joined
Mar 31, 2016
Messages
657
I'm having trouble getting this gate to open + close via abilities and triggers.

The abilities don't work as intended in that they don't play animations from Art - Animation Names. I'm using a copied trimmed down 'war stomp' with morph and morph alternate tags to open and close the gate. Somehow the abilities' animations only work if I upgrade a gate or cancel the upgrade cast the ability after - but then the gate just stays opens, stuck on stand alternate (Trigger might be affecting that maybe?). If its a freshly built gate nothing happens for some odd reason...

The triggers don't work at all. Here they are. Collision doesn't change, neither does the reset.

g3rUMVG.jpg
 
Level 13
Joined
May 10, 2009
Messages
868
Use the function below instead:
  • -------- Open --------
  • Animation - Add the alternate animation tag to (Triggering unit)
  • -------- Close --------
  • Animation - Remove the alternate animation tag to (Triggering unit)
//=====

Regarding the collision, you could remove it from the gate, and preplace some pathing blockers around your gates. Then, do something like this:
  • Set point = (Position of (Triggering unit))
  • Destructible - Pick every destructible within 256.00 of point and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Destructible-type of (Picked destructible)) Equal to Pathing Blocker (Ground)
        • Then - Actions
          • -------- Remove collision --------
          • Destructible - Kill (Picked destructible)
          • -------- Add collision --------
          • Destructible - Resurrect (Picked destructible) with (Max life of (Picked destructible)) life and Hide birth animation
        • Else - Actions
  • Custom script: call RemoveLocation(udg_point)
Here's an example:

First, I created the custom gate as a unit in the object editor, then I made a custom pathing blocker texture (8 x 4 - Horizontal). After that, I preplaced a custom pathing blocker in the middle of the gate, and added a few standard pathing blockers around both columns.

It looks like this:
Screenshot A:
sB54un1.jpg

Screenshot B:
teJYR5u.jpg


At last, a basic testing trigger:
  • Test
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Custom script: set udg_boolean = not udg_boolean
      • Set point = (Position of Gate 0003 <gen>)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • boolean Equal to True
        • Then - Actions
          • Animation - Add the alternate animation tag to Gate 0003 <gen>
          • Destructible - Pick every destructible within 64.00 of point and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Destructible-type of (Picked destructible)) Equal to Pathing Blocker (8x4 - Ground)
                • Then - Actions
                  • Destructible - Kill (Picked destructible)
                • Else - Actions
        • Else - Actions
          • Animation - Remove the alternate animation tag to Gate 0003 <gen>
          • Destructible - Pick every destructible within 64.00 of point and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Destructible-type of (Picked destructible)) Equal to Pathing Blocker (8x4 - Ground)
                • Then - Actions
                  • Destructible - Resurrect (Picked destructible) with (Max life of (Picked destructible)) life and Hide birth animation
                • Else - Actions
      • Custom script: call RemoveLocation(udg_point)
 

Attachments

  • Gate.w3x
    35.7 KB · Views: 68
Last edited:
Level 11
Joined
Mar 31, 2016
Messages
657
Is the gate you're using a unit or destructible?
Unit

Use the function below instead:
  • -------- Open --------
  • Animation - Add the alternate animation tag to (Triggering unit)
  • -------- Close --------
  • Animation - Remove the alternate animation tag to (Triggering unit)
//=====

Regarding the collision, you could remove it from the gate, and preplace some pathing blockers around your gates. Then, do something like this:
  • Set point = (Position of (Triggering unit))
  • Destructible - Pick every destructible within 256.00 of point and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Destructible-type of (Picked destructible)) Equal to Pathing Blocker (Ground)
        • Then - Actions
          • -------- Remove collision --------
          • Destructible - Kill (Picked destructible)
          • -------- Add collision --------
          • Destructible - Resurrect (Picked destructible) with (Max life of (Picked destructible)) life and Hide birth animation
        • Else - Actions
  • Custom script: call RemoveLocation(udg_point)
Here's an example:

First, I created the custom gate as a unit in the object editor, then I made a custom pathing blocker texture (8 x 4 - Horizontal). After that, I preplaced a custom pathing blocker in the middle of the gate, and added a few standard pathing blockers around both columns.

It looks like this:
Screenshot A:
sB54un1.jpg

Screenshot B:
teJYR5u.jpg


At last, a basic testing trigger:
  • Test
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Custom script: set udg_boolean = not udg_boolean
      • Set point = (Position of Gate 0003 <gen>)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • boolean Equal to True
        • Then - Actions
          • Animation - Add the alternate animation tag to Gate 0003 <gen>
          • Destructible - Pick every destructible within 64.00 of point and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Destructible-type of (Picked destructible)) Equal to Pathing Blocker (8x4 - Ground)
                • Then - Actions
                  • Destructible - Kill (Picked destructible)
                • Else - Actions
        • Else - Actions
          • Animation - Remove the alternate animation tag to Gate 0003 <gen>
          • Destructible - Pick every destructible within 64.00 of point and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Destructible-type of (Picked destructible)) Equal to Pathing Blocker (8x4 - Ground)
                • Then - Actions
                  • Destructible - Resurrect (Picked destructible) with (Max life of (Picked destructible)) life and Hide birth animation
                • Else - Actions
      • Custom script: call RemoveLocation(udg_point)
Wow - you really know what you're doing. Great work! Alright, I changed the function. Will this trigger work for a unit ?
 
Level 11
Joined
Mar 31, 2016
Messages
657
Well - I'm pretty lost. No idea how what triggers to substitute destructible with unit. And your trigger is for a pre-existing unit, what trigger do I use for a construct-able building? Also I have 2 abilities and I'm not sure how to make open for one ability, and close for the other ability.

Or can you maybe remake the trigger so it suits my map a bit better?

Thanks
 
Level 13
Joined
May 10, 2009
Messages
868
You have to activate your trigger whenever a gate casts open/close ability. Then, you just destroy/resurrect the custom pathing blocker in order to allow units to pass through it or block them.

All right, I created those abilities, but I add one to the gate at once. When a user casts one of them, the ability gets removed and the other one is added.

Some info about the variables:
Code:
OCG_Gate = Your Gate
OCG_Ability_Open = Open Gate ability
OCG_Ability_Close = Close Gate ability
OCG_Blocker_Columns = It's the pathing blocker placed under the columns
OCG_Blocker_Path = The custom pathing blocker (path)
OCG_Path_Area = This is used for detecting custom pathing blockers. Since It's already in the middle of the gate, the area doesn't need to be large.
OCG_Total_Area = Used for detecting the normal pathing blocker under the columns. Useful for clearing the area whenever a gate dies, and it was closed prior to its death.
OCG_Gate_AnimTag = The animation tag that your gate uses.

When map loads:
  • OCG Init
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set OCG_Gate = Gate
      • Set OCG_Ability_Open = Open Gate
      • Set OCG_Ability_Close = Close Gate
      • Set OCG_Blocker_Columns = Pathing Blocker (Ground)
      • Set OCG_Blocker_Path = Pathing Blocker (8x4 - Ground)
      • Set OCG_Path_Area = 32.00
      • Set OCG_Total_Area = 256.00
      • Set OCG_Gate_AnimTag = alternate
Gate casts an ability:
  • OCG OpenClose
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to OCG_Gate
    • Actions
      • Set unit = (Triggering unit)
      • Set point = (Position of unit)
      • -------- Gate casts open ability --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to OCG_Ability_Open
        • Then - Actions
          • Unit - Remove OCG_Ability_Open from unit
          • Unit - Add OCG_Ability_Close to unit
          • Animation - Add the OCG_Gate_AnimTag animation tag to unit
          • Destructible - Pick every destructible within OCG_Path_Area of point and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Destructible-type of (Picked destructible)) Equal to OCG_Blocker_Path
                • Then - Actions
                  • Destructible - Kill (Picked destructible)
                • Else - Actions
        • Else - Actions
          • -------- Gate casts close ability --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to OCG_Ability_Close
            • Then - Actions
              • Unit - Remove OCG_Ability_Close from unit
              • Unit - Add OCG_Ability_Open to unit
              • Animation - Remove the OCG_Gate_AnimTag animation tag to unit
              • Destructible - Pick every destructible within OCG_Path_Area of point and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Destructible-type of (Picked destructible)) Equal to OCG_Blocker_Path
                    • Then - Actions
                      • Destructible - Resurrect (Picked destructible) with (Max life of (Picked destructible)) life and Hide birth animation
                    • Else - Actions
            • Else - Actions
      • Custom script: call RemoveLocation(udg_point)
A gate dies:
  • OCG Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to OCG_Gate
    • Actions
      • -------- If this gate dies, then we should remove all pathing blockers around it. --------
      • Set point = (Position of (Triggering unit))
      • Destructible - Pick every destructible within OCG_Total_Area of point and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Destructible-type of (Picked destructible)) Equal to OCG_Blocker_Columns
                  • (Destructible-type of (Picked destructible)) Equal to OCG_Blocker_Path
            • Then - Actions
              • Destructible - Kill (Picked destructible)
            • Else - Actions
      • Custom script: call RemoveLocation(udg_point)
 

Attachments

  • Gate.w3x
    37.9 KB · Views: 73
Level 11
Joined
Mar 31, 2016
Messages
657
Dammit, I can't even figure out how to assign the variables correctly - pathing variables can't be matched with imported files, or at least idk how. I'm also unsure about what type of trigger some lines are... And I tried copying over your trigger for template ease but then jazz helper gets errors during saving and freezes, even after I took out all the red lines.

Can I just send you my map and you can implement the trigger? I will add your name in credits for sure. Actually before you do, I'm going to try another method - bear form morph ability between opened and closed gates. Hopefully, this time it works.

Also, are you really good with triggers? I need help with some other triggers too. Mainly though, I'm also trying to figure out how to implement a buildable walkable wall system from @MassiveMaster 's Castle Defense map, however its too complicated for me to figure out how to reimplement. If you could explain how to start adapting it to my map or can assist me with implementing it I'd be in your debt.
 
Level 11
Joined
Mar 31, 2016
Messages
657
Well, I got it working using the bear form ability - however - it crashes a second after it finishes casting... I can't figure out why. So, at this point, I'm sending it to you via PM. Feel free to delete the old abilities and make new ones. Thanks again
 
Level 11
Joined
Mar 31, 2016
Messages
657
Well, I was doing some testing. The ones already prebuilt on the map work 100% however when I take the wall, upgrade it to a gate - that gate will have no pathing at all, plus open and close works with animations but pathing is still missing. Maybe its a loophole in the trigger or something?
 
Level 11
Joined
Mar 31, 2016
Messages
657
To be honest, I didn't know a player could upgrade them - heh. I'll take a look at it.

That would be my bad - in the map I sent you the upgrades were only available for the vertical walls. The horizontal walls are missing the upgrade to horizontal gates.
Should I send you an updated map or can you work around it?

Edit: Grammar usage. Also, pretty much every single unit and building has upgrade-able tiers.
 
Last edited:
Status
Not open for further replies.
Top