• 🏆 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] Destroy killed gates

Status
Not open for further replies.
Level 5
Joined
Jul 8, 2007
Messages
146
I desperately need a trigger that when a gate is killed, it stays dead and turns off the triggers that allow it to be opened/closed. Let me explain... btw i have tried EVERYTHING that is obvious.... :(
  • Open Gate 3
    • Events
      • Unit - A unit comes within 50.00 of Open Gate 0052 <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Destructible - Open Empire Gate (Horizontal) 0205 <gen>
      • Destructible - Open Empire Gate (Horizontal) 0001 <gen>
So that's the trigger to open the gates.

  • Close Gate 3
    • Events
      • Unit - A unit comes within 50.00 of Close Gate 0054 <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Destructible - Close Empire Gate (Horizontal) 0205 <gen>
      • Destructible - Close Empire Gate (Horizontal) 0001 <gen>
That's the one to close them. (By the way, "Open Gate 0052 <gen>" and "Close Gate 0054 <gen>" are the two circles of power in which you have to step on to close/open the gates.
Now, here is what I basically want the destroy trigger to do, in other words the trigger I tried to use but it failed...

  • Destroy Gate 3
    • Events
      • Destructible - Empire Gate (Horizontal) 0205 <gen> dies
      • Destructible - Empire Gate (Horizontal) 0001 <gen> dies
    • Conditions
    • Actions
      • Trigger - Turn off Open Gate 3 <gen>
      • Trigger - Turn off Close Gate 3 <gen>
      • Destructible - Kill Empire Gate (Horizontal) 0205 <gen>
      • Destructible - Kill Empire Gate (Horizontal) 0001 <gen>
The problem with that trigger is that the Actions occur during map initialization. Please help me...
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
First, the fact that you can attack the gate implies that it is destructible. IIRC, whenever you open/close the gate, its hp will be resetted, thus it's going to be bugged, allowing you to easily repair a gate by just stepping on a CoP.

To avoid this bug, assign an integer (or real, I forgot which one) to each gate and whenever you open the gate, set the assigned integer value to the HP of the gate. Whenever you close it, you do the opposite: you set the HP of the destructible to the assigned integer. I think this also solves your problem, since, whenever you try to close a destroyed gate, its hp will be set to 0, destroying it anyway.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
now that I have WE open: I noticed you used a UNIT as the gate (since the event is: a unit comes within range of a unit), while you use the action "destructible - open gate". That definatelly won't work on a unit. Therefor, I suggest you find another way to open a gate. For instance: create a scout tower (or a unit based on it) and give it an ability "Open gate" based on e.g. Roar. Give it another ability "close gate".

If you have more than 2 gates, it'd be useful to take a different approach, putting the gates in an array. But since it's only 2 gates:

Variables:
GateHP : Real : Init value of 0 : Array of 2 (or: amount of gates you have)

  • Open Gate 1
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Open Gate
    • Actions
      • Set GateHP[1] = (Current life of Demonic Gate (Horizontal) 0000 <gen>)
      • Destructible - Open Demonic Gate (Horizontal) 0000 <gen>
  • Close Gate 1
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Close Gate
    • Actions
      • Destructible - Close Demonic Gate (Horizontal) 0000 <gen>
      • Destructible - Set life of Demonic Gate (Horizontal) 0000 <gen> to GateHP[1]
Repeat this for the other gate...
 
Level 5
Joined
Jul 8, 2007
Messages
146
no, the unit is the circle of power lol, and when the unit gets in the circle of power, the destructible gate opens :p But i like the way u did that... I think it will work much better... :p
Oh, but what do i do if it is 3 gates? 2 of my castles have 3 gates
and btw.... you.... have.... been... REPPED! lol ^^
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Well, basically, for each gate you need to make 2 triggers. Since for multiple gates this is much work, you can use loops.

For example: if I have 6 gates (I understand you do: 2 castles featuring 3 gates), I'll need 12 triggers. Sorry, I don't like much work, even if it's just c&p.
These are the variables I need:
Gate : Destructible : Array of 6 (amount of gates)
GateHP : Real : Array of 6 (amount of gates)
GateOpener : Unit : array of 6 (amount of gates)

These are the triggers:
  • Map Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Gate[1] = Demonic Gate (Horizontal) 0001 <gen>
      • Set Gate[2] = Demonic Gate (Horizontal) 0002 <gen>
      • Set Gate[3] = Demonic Gate (Horizontal) 0003 <gen>
      • Set Gate[4] = Demonic Gate (Horizontal) 0004 <gen>
      • Set Gate[5] = Demonic Gate (Horizontal) 0005 <gen>
      • Set Gate[6] = Demonic Gate (Horizontal) 0006 <gen>
      • Set GateOpener[1] = Gate Controller 0001 <gen>
      • Set GateOpener[2] = Gate Controller 0002 <gen>
      • Set GateOpener[3] = Gate Controller 0003 <gen>
      • Set GateOpener[4] = Gate Controller 0004 <gen>
      • Set GateOpener[5] = Gate Controller 0005 <gen>
      • Set GateOpener[6] = Gate Controller 0006 <gen>
Make sure GateOpener[1] is the Tower (which controls whether the gate is open or closed) near Gate[1] etc. Else it might happen that Tower 1 will open Gate 2, which shouldn't happen.

  • Open Gate
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Open Gate
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Casting unit) Equal to GateOpener[(Integer A)]
            • Then - Actions
              • Set GateHP[(Integer A)] = (Current life of Gate[(Integer A)])
              • Destructible - Open Gate[(Integer A)]
            • Else - Actions
This trigger will open any gate.

  • Close Gate
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Casting unit) Equal to GateOpener[(Integer A)]
            • Then - Actions
              • Destructible - Close Gate[(Integer A)]
              • Destructible - Set life of Gate[(Integer A)] to GateHP[(Integer A)]
            • Else - Actions
This trigger will close any gate.
 
Status
Not open for further replies.
Top