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

Open Gates Created INGAME

Status
Not open for further replies.
Level 3
Joined
Jan 20, 2009
Messages
24
Hello, i would like to ask something. How do i create a trigger where it opens a gate that was created in game, with a certain item.
I know you can set variables to the specific gate and item and all that blah blah blah.
The real issue that i am having is that i need this to work.
  • fhfd
    • Events
      • Unit - A unit comes within 256.00 of Blue Door
    • Conditions
      • ((Triggering unit) has an item of type Blue Key) Equal to True
      • (Unit-type of (Triggering unit)) Equal to Mazer
    • Actions
      • Destructible - Open Blue Door
      • Wait 5.00 seconds
      • Destructible - Remove Blue Door
The main issue is, i want a destructible OF type, to be the event. help.
So, my request is to make a trigger like that. You can use Custom Script even. Thanks for helping :)
 
Level 18
Joined
Mar 7, 2005
Messages
824
It's pretty simple.. you could have made it yourself, but you didn't know the fact that destructables can't be used as events like you want to use them.

So what we're going to do is using a normal unit instead. Just create a new custom Unit based of a normal building, let's say the human barracks. Remove all unneeded things, like can produce units, build-requirements, etc. After that change the Model of the Building to your Gate you want to use and also add the shadow path from the Gate to it, or it could look a bit strange. Now scroll down to the Path options, you have to set the Gate as a path, so no units can pass it easily and it will fit with the model you choosed, some adjustments here and there, maybe about selection scaling and you're done with the Gate.

Now here's the Trigger that will only open the Gate if the trespassing Unit has the needed item(s).

  • Open Gate
    • Events
      • Unit - A unit comes within 150.00 of Gate (closed) 0004 <gen>
    • Conditions
      • (Triggering unit) Equal Mazer 0002 <gen>
      • ((Triggering unit) has an item of type Gate-Key XY) Equal True
    • Actions
      • Unit - Replace Gate (closed) 0004 <gen> with a Gate (open) using new Unit's: Standard - life and mana
      • Animation - Play (Last replaced unit)'s death alternate animation
Info
Event: Just choose the Gate you want to open for this trigger and change it with "Gate (closed) 0004 <gen>" in the trigger

Actions: You just need to copy the "Gate Closed" Unit and paste it to the object editor. after that just edit the path from normal Gate to "Gate <dead>" path, so the units can pass it after it was opened.
Hope you get it, good luck trying this ;) Already tested it, and it definitly works!

Greetings,
Tr!KzZ
 
Level 3
Joined
Jan 20, 2009
Messages
24
Thanks for the attempt of helping but thats not what i stated needed help with. I dont need a SPECIFIC GATE that is NOT a variable. It is a gate that the player can create multiple of in game. So i cant select a certain unit. sorry for your time but it helped me none at all :p.
 
Level 18
Joined
Mar 7, 2005
Messages
824
Uhm it will help you :p

1.
You can do this with this trigger easily.. just use variables.. set Blue Gate[x] (variable with array, x = number that raises, like x= x+1 after each use) = Last created Unit (Your Gate)

Later on set the Key into variables. BlueKey[y] = Blue Key Item XYZ.
If Unit comes within Range of Gate[x] he needs BlueKey[y], which for example could be key1 or 5 or whatever.. You just need to control that x=y in that moment, so Key5 only works for Gate5, not for Gate4.

2.
You could create a invisible Unit near the Gate, store it into a variable and then just use this unit to open the gate, like Mazer comes close to Unit XY, open gate, if he has the Key..

That's all I can help you for now, if this don't helps you at all, I just tried it ;) Good Luck with it!
 
Ok, I made a small system, here:
  • One
    • Events
      • Unit - A unit Acquires an item
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Blood Key
    • Actions
      • Custom script: local group g
      • Custom script: if GetTriggerEventId() == EVENT_PLAYER_UNIT_PICKUP_ITEM then
      • Custom script: set g = CreateGroup()
      • Custom script: call SaveGroupHandle (udg_Hash, GetHandleId (GetTriggerUnit()), StringHash("group"), g)
      • Unit Group - Add (Triggering unit) to KeyGroup
      • Trigger - Turn on Two <gen>
      • Custom script: else
      • Unit Group - Pick every unit in (Load (Key group) of (Key (Triggering unit)) in Hash) and do (Actions)
        • Loop - Actions
          • Unit - Kill (Load (Key ghostgate) of (Key (Picked unit)) in Hash)
          • Unit - Remove (Load (Key ghostgate) of (Key (Picked unit)) in Hash) from the game
          • Unit - Unhide (Picked unit)
          • Unit Group - Remove (Picked unit) from (Load (Key group) of (Key (Triggering unit)) in Hash)
          • Unit Group - Remove (Picked unit) from OpenedGates
          • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hash
          • Custom script: call RemoveLocation (udg_Points[3])
      • Unit Group - Remove (Triggering unit) from KeyGroup
      • Custom script: call DestroyGroup (LoadGroupHandle (udg_Hash, GetHandleId (GetTriggerUnit()), StringHash("group")))
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in Hash
      • Custom script: endif
      • Custom script: set g = null
  • Two
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (KeyGroup is empty) Equal to False
        • Then - Actions
          • Unit Group - Pick every unit in KeyGroup and do (Actions)
            • Loop - Actions
              • Set Points[1] = (Position of (Picked unit))
              • Set Bearer = (Picked unit)
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units within 300.00 of Points[1] matching (((((Matching unit) is in OpenedGates) Equal to False) and (((Matching unit) is in UnderConstruction) Equal to False)) and (((Unit-type of (Matching unit)) Equal to Gate) and (((Matching unit) is in (Load (Key group) and do (Actions)
                • Loop - Actions
                  • Set Points[2] = (Position of (Picked unit))
                  • Unit Group - Add (Picked unit) to (Load (Key group) of (Key Bearer) in Hash)
                  • Unit - Hide (Picked unit)
                  • Unit - Create 1 (Unit-type of (Picked unit)) for (Owner of (Picked unit)) at Points[2] facing Default building facing degrees
                  • Custom script: call UnitAddAbility (GetLastCreatedUnit(), 'Aloc')
                  • Animation - Play (Last created unit)'s death alternate animation
                  • Unit Group - Add (Picked unit) to OpenedGates
                  • Hashtable - Save Handle Of(Last created unit) as (Key ghostgate) of (Key (Picked unit)) in Hash
                  • Custom script: call RemoveLocation (udg_Points[2])
              • Unit Group - Pick every unit in (Load (Key group) of (Key (Picked unit)) in Hash) and do (Actions)
                • Loop - Actions
                  • Set Points[3] = (Position of (Picked unit))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between Points[1] and Points[3]) Greater than 305.00
                    • Then - Actions
                      • Unit - Kill (Load (Key ghostgate) of (Key (Picked unit)) in Hash)
                      • Unit - Remove (Load (Key ghostgate) of (Key (Picked unit)) in Hash) from the game
                      • Unit - Unhide (Picked unit)
                      • Unit Group - Remove (Picked unit) from (Load (Key group) of (Key Bearer) in Hash)
                      • Unit Group - Remove (Picked unit) from OpenedGates
                      • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hash
                    • Else - Actions
                  • Custom script: call RemoveLocation (udg_Points[3])
              • Custom script: call RemoveLocation (udg_Points[1])
        • Else - Actions
          • Trigger - Turn off (This trigger)
  • Three
    • Events
      • Unit - A unit Begins construction
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Gate
    • Actions
      • Custom script: if GetTriggerEventId() == EVENT_PLAYER_UNIT_CONSTRUCT_START then
      • Unit Group - Add (Triggering unit) to UnderConstruction
      • Custom script: else
      • Unit Group - Remove (Triggering unit) from UnderConstruction
      • Custom script: endif
 

Attachments

  • Automatically Open Gates.w3x
    28.8 KB · Views: 40
Status
Not open for further replies.
Top