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

[Trigger] Opening/Close Gates

Status
Not open for further replies.
Level 3
Joined
May 22, 2012
Messages
50
Okay, I've seen this done in ALOT of maps, so it shouldn't be too hard...

  • Gate Close
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Close Gate
    • Actions
      • Unit - Turn collision for (Casting unit) On
      • Animation - Play (Casting unit)'s Stand animation
      • Unit - Add Open Gate to (Casting unit)
      • Unit - Remove Close Gate from (Casting unit)
That SHOULD open the gate, while giving it the ability to close itself... That part works fine! The issue is, my guys can't go tough it... I can't even build where the gate is! (I hope THAT part stays, but from what I've seen in maps, it doesn't do that...) Here is the one for closing...

  • Gate Close
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Close Gate
    • Actions
      • Unit - Turn collision for (Casting unit) On
      • Animation - Play (Casting unit)'s Stand animation
      • Unit - Add Open Gate to (Casting unit)
      • Unit - Remove Close Gate from (Casting unit)
 
Level 17
Joined
Feb 11, 2011
Messages
1,860
Hmmm. Are you using abilities to open and close gates? Try something like:

  • Open
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Open Gate
    • Actions
      • Unit - Remove Open Gate from (Triggering unit)
      • Unit - Add Close Gate to (Triggering unit)
      • Destructible - Open yourGate
  • Close
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Close Gate
    • Actions
      • Unit - Remove Close Gate from (Triggering unit)
      • Unit - Add Open Gate to (Triggering unit)
      • Destructible - Close yourGate
yourGate is the variable name of a destructable based off a gate (such as Elven Gate).
 
Level 3
Joined
May 22, 2012
Messages
50
Hmmm. Are you using abilities to open and close gates? Try something like:

  • Open
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Open Gate
    • Actions
      • Unit - Remove Open Gate from (Triggering unit)
      • Unit - Add Close Gate to (Triggering unit)
      • Destructible - Open yourGate
  • Close
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Close Gate
    • Actions
      • Unit - Remove Close Gate from (Triggering unit)
      • Unit - Add Open Gate to (Triggering unit)
      • Destructible - Close yourGate
yourGate is the variable name of a destructable based off a gate (such as Elven Gate).

Okay... I was hoping I wouldn't have to do that... I did it before, just didn't do it with triggers... I'll try it, then get back to you...
Edit: Errr, wait, that's not what I thought you said... I will have more than one gate... They are built by my workers.... So will this work with more than 1 gate?
 
Level 3
Joined
May 22, 2012
Messages
50
Umm, I want it to work with gates that aren't destructible's... They are objects that my workers can build...
 
Level 4
Joined
Jul 14, 2012
Messages
100
Honestly if I was doing something like this I would make a building called Gate, like you did. Then I would make a trigger like so.

scrnsht5.png


Of course, instead of the tower it would be the Gate. Instead of the fruit stand, it would a Lever, which would have the ability to open and close the gate as a destructible with the trigger you used. The lever would also be invisible, so it doesnt matter where it is, because enemies wont be able to see it. The structure basically becomes a destructible so that it can be walked through when opened.

But i dont know, Maybe i just made it complicated.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
So your "Gate" is basically a "Unit" ? Not a "Destructible" ?
Because you can build the "Gate", that will make it as "Unit" instead of "Destructible" don't you think ?
And "Unit" has collision (if you allow it in Object Editor).

What Lysho suggested was more appealing since it replace your "Unit" with "Destructible right upon creation of that "Gate".

Hey Lysho, you can post trigger in more easy manner you know ?

1. Go to Trigger Editor
2. Right-click your Trigger Name (Trigger Name on the right-side, not the left-side, it's under Trigger Functions:) and select "Copy As Text"
3. Now, go to reply field on forum and type this code out:
[trigger]PASTE YOUR TRIGGER HERE (usually just press CTRL + V since you have copied it just now)[/trigger]

Your trigger will look something like this;
  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Channel
    • Actions
      • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (Real((Strength of (Triggering unit) (Include bonuses)))) damage of attack type Spells and damage type Normal
This way, it will be more easier, you don't have to take screenshot per trigger you want to show.
 
Level 4
Joined
Jul 14, 2012
Messages
100
:O omg no way. that would save sooo much more time xD

Yea but anyway my idea would replenish the targets health every time its opened or close, now that I think about it. You'll need to save the amount of health the gate has before being opened as an integer then make the gate's health once opened equal to that integer.
 
Level 3
Joined
May 22, 2012
Messages
50
So your "Gate" is basically a "Unit" ? Not a "Destructible" ?
Because you can build the "Gate", that will make it as "Unit" instead of "Destructible" don't you think ?
And "Unit" has collision (if you allow it in Object Editor).

What Lysho suggested was more appealing since it replace your "Unit" with "Destructible right upon creation of that "Gate".

Hey Lysho, you can post trigger in more easy manner you know ?

1. Go to Trigger Editor
2. Right-click your Trigger Name (Trigger Name on the right-side, not the left-side, it's under Trigger Functions:) and select "Copy As Text"
3. Now, go to reply field on forum and type this code out:
[trigger]PASTE YOUR TRIGGER HERE (usually just press CTRL + V since you have copied it just now)[/trigger]

Your trigger will look something like this;
  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Channel
    • Actions
      • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (Real((Strength of (Triggering unit) (Include bonuses)))) damage of attack type Spells and damage type Normal
This way, it will be more easier, you don't have to take screenshot per trigger you want to show.
Yes, it is a unit building... And I have workers that can build it... I've seen it in other maps, where you would cast an ability that the gate has, and it would just simply open/close it... And people could go though it.... I wish they had gates/walls part of the game... Would be SO much easyer....
 
Level 4
Joined
Jul 14, 2012
Messages
100
Okay then about you make it a structure, but like this...

  • open gate
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Unit - Replace (Triggering unit) with a Barracks using The old unit's relative life and mana
      • Animation - Play (Last replaced unit)'s Death Alternate animation
"Animate Dead" would be Open Gate. It would replace the gate with a duplicate except the duplicate has no pathing map, and has the Close Gate ability instead. Once the new gate is created, it would cast its "open" animation.

But i dont know, ive never done gates. Try to give that a shot? Or if someone can correct me here

EDIT: Yea what i proposed right above works like a charm. I attached the test map so you can see how it works...

View attachment workinggate.w3x
 
Level 3
Joined
May 22, 2012
Messages
50
Okay then about you make it a structure, but like this...

  • open gate
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Unit - Replace (Triggering unit) with a Barracks using The old unit's relative life and mana
      • Animation - Play (Last replaced unit)'s Death Alternate animation
"Animate Dead" would be Open Gate. It would replace the gate with a duplicate except the duplicate has no pathing map, and has the Close Gate ability instead. Once the new gate is created, it would cast its "open" animation.

But i dont know, ive never done gates. Try to give that a shot? Or if someone can correct me here

EDIT: Yea what i proposed right above works like a charm. I attached the test map so you can see how it works...

View attachment 116077

Thanks, I was planning on doing that in the beggining, but I thought there was a better way... Anyway, thanks! I'll try it once I get the chance!
 
Level 4
Joined
Jul 14, 2012
Messages
100
Wait wait, i just noticed that it doesnt work if a unit is blocking the gate. It just moves the gate to where its not being blocked.. I just took a crack at seeing if i could fix that but no dice D: maybe someone else here knows? Unless you manage how :D

EDIT: Okay so after some time I think I've got it fixed. Heres the map that actually has a gate that doesnt teleport when a unit is blocking it o_o This one actually works so if you want to make that gate, try to duplicate this.

View attachment workinggate.w3x
 
Last edited:
Level 3
Joined
May 22, 2012
Messages
50
Wait wait, i just noticed that it doesnt work if a unit is blocking the gate. It just moves the gate to where its not being blocked.. I just took a crack at seeing if i could fix that but no dice D: maybe someone else here knows? Unless you manage how :D

EDIT: Okay so after some time I think I've got it fixed. Heres the map that actually has a gate that doesnt teleport when a unit is blocking it o_o This one actually works so if you want to make that gate, try to duplicate this.

View attachment 116080
OOh wow, thanks! Saved me a bit of time! I'll take a look at it!
 
Level 3
Joined
May 22, 2012
Messages
50
Okay, it works!!! Only 1 issue.... If the units are too far away from the center, it can stil close on them... But I'll fine tune it to make it work, PERFECTLY..... Thanks!
 
Level 4
Joined
Jul 14, 2012
Messages
100
Oh yea, just change the "within range" to a bit bigger. Lol i didn't fine tune it because i didn't know what size gate you were using so i figured it wouldnt matter lol. Anyway no problem man :D
 
Status
Not open for further replies.
Top