• 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] Gate trigger

Status
Not open for further replies.
Level 2
Joined
Aug 15, 2011
Messages
8
I am relatively new to this, so please bear with me. I did some readings on gate triggers already, but I still couldn't figure out what mistakes I made on my triggers.


Goal:
To make a gate that:
1. opens when player 1-5 approach it, and closes shortly afterwards.
2. stay shut when player 6-10 approach it.

There are several ways for player 6-10 to get past the gate:
1. Destroy the gate.
2. Destroy a lever placed behind the gate and the gate will open.
3. Rush in as player 1-5 are passing through the gate.

If the gate and/or the lever are destroyed, they will ressurect 60 seconds later.




Problem that I have:
1. If the gate is destroyed, it will stay dead for 60 seconds. No problem. But it resets if player 1-5 approach it, and thats no good.
2. If the lever is destroyed, gate will stay open, but it resets when player 1-5 approach it. Same problem.

I know that the problem comes from my trigger event, "When a unit enters a region", but I don't know what else to change it to. OR how should I script the condition to avoid the gate reseting after it died and before the 60 second is up. Here's what I have tried so far. I am still rather new, so I might have make some retarded mistake somewhere.


Please refer to the trigger HERE. The old one was removed since there's too many stupid mistakes

I would be really grateful if someone can point out what mistake I made or perhaps suggest an alternative method. Thanks.
 
Last edited:
Tons of stuff to mention, but I will begin with a few:
* You resurrect gate (horizontal) 0003 or 0000 with the max life of (Last created destructable). Change that to Gate Horizontal 0003 or 0000 <gen>.

*If you are up to making a comparison of players, you can use this one instead:
  • For each (Integer C) from 1 to 5, do (Actions)
    • Loop - Actions
      • If (All conditions are true) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering player) Equal to Player(C)
        • Then - Actions
          • ----- Actions here -----
          • Skip remaining actions
        • Else - Actions
* Remove "Do nothing" actions; they indeed do nothing. If there is nothing placed by you in the branches "Then/Else", the code will ignore them, so Do Nothing makes no difference (it does, it calls an empty function for no reason).

* In your "Friendly approaching Gate 1" trigger, the second if/then/else resurrects the gate (horizontal) no matter what; the condition checks whether both the lever and the gate are dead or alive. Whatever it is, they will resurrect it, that's why it resets itself, when 1-5 players' units approach.
 
Level 2
Joined
Aug 15, 2011
Messages
8
Alright, I don't know what got into my head when I first started working on this trigger.... must be the lack of sleep. -_-

After further reading and trying, I figure it would make more sense to
  • Gate 3 Open
  • Events
    • Unit - A Unit enters Southern Gate 3 <gen>
  • Conditions
    • (Current life of Horizontal Gate 0002 <gen>) Greater than 0.00
    • (Current life of Lever 0007 <gen>) Greater than 0.00
    • Or - Any (Conditions) are true
      • (Owner of (Entering unit)) Equal to Player 1 (Red)
      • (Owner of (Entering unit)) Equal to Player 2 (Blue)
      • (Owner of (Entering unit)) Equal to Player 3 (Teal)
      • (Owner of (Entering unit)) Equal to Player 4 (Purple)
      • (Owner of (Entering unit)) Equal to Player 5 (Yellow)
  • Actions
    • Set HorizontalGate0002Life = (Current life of Horizontal Gate 0002 <gen>)
    • Set Lever0007Life = (Current life of Lever 0007 <gen>)
    • If (All conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • HorizontalGate0002Life Less than or equal to 0.00
        • Lever0007Life Less than or equal to 0.00
      • Then - Actions
        • Skip remaining actions
      • Else - Actions
    • Destructible - Open Horizontal Gate 0002 <gen>
  • Gate 3 Close
  • Events
    • Unit - A unit leaves Southern Gate 3 <gen>
  • Conditions
    • Or - Any (Conditions) are true
      • (Owner of (Leaving unit)) Equal to Player 1 (Red)
      • (Owner of (Leaving unit)) Equal to Player 2 (Blue)
      • (Owner of (Leaving unit)) Equal to Player 3 (Teal)
      • (Owner of (Leaving unit)) Equal to Player 4 (Purple)
      • (Owner of (Leaving unit)) Equal to Player 5 (Yellow)
    • ((Number of units in (Units in Southern Gate 3 <gen> owned by Player 1 (Red))) + (Number of units in (Units in Southern Gate 3 <gen> owned by Player 2 (Blue))) +(Number o Equal to 0
    • HorizontalGate0002Life Greater than 0.00
    • Lever0007Life Greater than 0.00
  • Actions
    • Destructible - Close Horizontal Gate 0002 <gen>
    • Destructible - Set life of Horizontal Gate 0002 <gen> to HorizontalGate0002Life
  • Gate 3 Dead
  • Events
    • Destructible - Horizontal Gate 0002 <gen> dies
  • Conditions
  • Actions
    • Game - Display to (All enemies of Player 6 (Orange)) for 15.00 seconds the text: One of your gate...
    • Wait 20.00 seconds
    • Destructible - Ressurect Horizontal Gate 0002 <gen> with (Max life of (Last created destructible)) life and Show birth animation
  • Gate 3 Lever Dead
  • Events
    • Destructible - Lever 0007 <gen> dies
  • Conditions
    • (Horizontal Gate 0002 <gen> is alive) Equal to True
  • Actions
    • Set HorizontalGate0002Life = (Current life of Horizontal Gate 0002 <gen>)
    • Game - Display to (All enemies of Player 6 (Orange)) for 15.00 seconds the text: You heard a familiar...
    • Destructible - Open Horizontal Gate 0002 <gen>
    • Wait 20.00 seconds
    • Destructible - Resurrect Lever 0007 <gen> with (Max life of (Last created destructible)) life and Hide birth animation
    • Destructible - Close Horizontal Gate 0002 <gen>
    • Destructible - Set life of Horizontal Gate 0002 <gen> to HorizontalGate0002Life
It is working well and all but I was wondering if there's a way to improve it.
As you all can see, the gate resurrects x seconds after it was destroyed, so lets assume a scenario like this:
1. You are a player at the south and your enemy is trying to invade your territory.
2. They destroyed your gate and their units are inside the fort fighting your defenders.
3. The battle dragged on for more than x seconds.
4. The gate resurrects and cut off the invading player's retreat.

That doesn't seem very pleasant. I was wondering if there is a way to stop the gate resurrecting after the invading player is driven outside the gate. I have included a map in case that make things easier.
 

Attachments

  • (10)RagingStream.w3x
    207.5 KB · Views: 56
Last edited:
Level 2
Joined
Aug 15, 2011
Messages
8
You need a region or a location(point) RIGHT in the middle of the area and you have to know the radius of the area, then pick up every unit in the region or around the point and check if they are enemy. If they are then stop resurrection timer (or even reset it?)

I am thinking of the same thing.
I can check if the sum of units belonging to player 6-10 in the gate region is equal to 0 or not before resurrecting the gate 60 seconds later, but I am stuck after that.

  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Number of units in (Units in Southern Gate 3 <gen> owned by Player 6 (Orange))) + ((Number of units in (Units in Southern Gate 3 <gen> owned by Player 7 (Green))) + ((Number o Equal to 0
      • Then - Actions
        • Wait 60.00 seconds
        • Destructible - Resurrect Horizontal Gate 0002 <gen> with (Max life of (Last created destructible)) life and Show birth animation
      • Else - Actions
What to put in else so that it keeps checking if there is enemy units in the region?

Gonna keep looking for a way to do that in the mean time..
 
Level 2
Joined
Aug 15, 2011
Messages
8
This way you'll have to make a trigger for every gate. You should try starting over without waits (to be MUI) using maybe hashtables to track the time. That way you would spare your time ^^


I am aware that if I am doing what I am doing now, I will have to make a trigger for each of my 8 gates.

It's not like I wanted to do that, but at the moment I am still trying to understand how hashtable works (reading guides by wyrmlord and a few other people atm). Since I am still in the dark on how to use hashtables, making triggers for each of the gate is my only option now :\
 
Status
Not open for further replies.
Top