• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Open and Closing "Gates"

Status
Not open for further replies.
Level 4
Joined
Sep 29, 2004
Messages
52
Has anyone played that Heroes and Empires map?

In that it has a structure that looks like a tiny block (the pathing size of a barrel) and its a "gate". On each block it has an ability where when you click it, the block "sinks" into the ground and units can walk over it. When you press the button again, the gate rises. Now, I tried using bear form as a base spell for this and making 2 structures. One structure with collision and the other with no collision. So, I gave it a try and worked.....sorta...if any units are on the structure with no collison when the ability is activated, the game crashes. So, I tried triggering it, but this did not turn out so well.

In Heroes and Empires when your closing the gate, it actucally sends a warning that units are too close to it, so the ability doesnt finish. To check out the map and see the gates in game, use this address http://hiveworkshop.com/resources_new/maps/802/

So, can anyone help me with triggering this ability?
 
Level 6
Joined
Mar 2, 2006
Messages
306
there are two events you should know about:
1) unit begins casting an ability
2) unis starts the effect of an ability

first one fires as soon as your unit enters the casting range (distance) but slightly BEFORE the spell is cast and mana is spent.

so how do we use it:
if casting conditions are not met then
-> issue order to triggering unit - Stop


and we have a reliable system for checking all kinds od conditions before casting a spell, we can even print an error message when we order the unit to cancel the spell.

this event fires before mana is reduced and cooldown timer is activated so you wil never ever use this event for implementing trigger-enhanced spells. it should only be used for checks.

for a triggered spell, you use the second event (fires if the spell is not canceled by the first trigger) for the actual spell actions.
 
Level 4
Joined
Sep 29, 2004
Messages
52
I already know about those two events, and I have actucally tried this approach before posting. And it looks like this...
  • Events:
    • A unit begins casting an ability.
  • Conditions:
    • (Ability being cast) equal to Close Gate
  • Actions:
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • Conditions:
        • Number of units in(Units within 200.00 of (Position of(Casting Unit)))) equal to 0
        • ((Entering Unit) is A Structure) equal to False
      • Then - Actions:
        • Unit - Create 1 Gate (Closed) for Owner of (Casting Unit)) at (Position of (Casting Unit)) facing default building degrees
        • Wait 0.01 Seconds
        • Unit - Remove (Casting Unit) from the game
        • Skip remaining actions
      • Else - Actions:
        • Unit - Order (Casting Unit) to Stop
...now when I try this trigger it works (sorta), but the new open gate unit doesnt appear exactly on top of where the closed gate was.
 
Last edited by a moderator:
Level 6
Joined
Mar 2, 2006
Messages
306
first remove the old gate, then create the new one.

replace this ("then" section):
Unit - Create 1 Gate (Closed) for Owner of (Casting Unit)) at (Position of (Casting Unit)) facing default building degrees
Wait 0.01 Seconds
Unit - Remove (Casting Unit) from the game

with this:
set GateLocation = Position of (Casting Unit)
set GateOwner = Owner of (Casting Unit))
Unit - Remove (Casting Unit) from the game
Unit - Create 1 Gate (Closed) for GateOwner at GateLocation facing default building facing degrees
Custom Script - call RemoveLocation( udg_GateLocation )

that's it.
 
Level 6
Joined
Mar 2, 2006
Messages
306
Now, wouldn't that make the spell non-multinstancable if I start using those variables?....Cuz the game I'm making is gonna be multiplayer.
just don't put waits in there. if you don't, my way (with 2 vars) will work fine. one trigger can not interrupt other one at any place - it can only happen while a trigger is waiting.
 
Level 7
Joined
Apr 23, 2007
Messages
326
isnt there a simpler way to do this without a trigger like using bear form and having closed gate have a pathing size of 4x4 and then having the open gate have no size

Edit: ok heres exactly wut u do this is simpler than a trigger and will indefinately work in multiplayer

make a unit to be the open gate then go to unit editor select the unit and go to its value for Pathing- Pathing Map and set that to none so u have a unit that u can select but it will have no physical size so units can walk over it with out a trigger

and if you want the gate to look like it goes down make the model a elevator doodad and set the closed gate to stand second and it will be above ground
 
Level 4
Joined
Sep 29, 2004
Messages
52
isnt there a simpler way to do this without a trigger like using bear form and having closed gate have a pathing size of 4x4 and then having the open gate have no size

Edit: ok heres exactly wut u do this is simpler than a trigger and will indefinately work in multiplayer

make a unit to be the open gate then go to unit editor select the unit and go to its value for Pathing- Pathing Map and set that to none so u have a unit that u can select but it will have no physical size so units can walk over it with out a trigger

and if you want the gate to look like it goes down make the model a elevator doodad and set the closed gate to stand second and it will be above ground

Yea....Kaboom have you actucally tried that? Because then you would know that if you try this, when you try to close the gate, if any units are nearby the gate, the game will crash. I always try the easiest way out first, before I have to use any triggers of some sort. And...

alright first of all why does nobody use the TRIGGER tags, and second of all unless there is more than one gate you do not need to worry about MUI(I Think) and instead of bear ability i would use Illidians metamorphosis ability instead i seem to have much more success with that ability

Why would I have only 1 gate in a multiplayer map, its not some hero defense lol. And edge, thank you very much, that trigger worked perfectly that and I didnt know about the whole wait and variables thing. Props to you, your the man (or woman)!
 
Last edited:
Level 3
Joined
Jun 14, 2007
Messages
33
Easy and Simple

If you want a very Simple one, here...

Opening Trigger--

Event--
Unit-A unit enters "Region"
Condition--
Triggerring Unit is a ______ Equal to True
Action--
Destructible- Open _____ Gate


Closing Trigger--

Event--
Unit-A unit leaves "Region"
Condition--
Triggerring unit is a ______ Equal to True
Action--
Destructible- Close _____ Gate


I used two SEPERATE Triggers just to make things go more smoothly, and guess what, it actually works... All I did was Guess and Test :thumbs_up: Have Fun! :grin:
 
Level 5
Joined
May 27, 2007
Messages
132
Event: Unit uses an Ability
Conditions: Ability is equal to (Close Gate)
Event: Play Death Animation got (triggering unit)

Just use the Barrel model(it's a destructible/doodad) and it'll sink into the ground because that's it's death animation.

Create one to play whatever animation just sitting there is when it's "closed", make it so it has no pathing, and create a pathing blocker when it's up and destroy it when the gate goes down.
 
Status
Not open for further replies.
Top