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

[Solved] Trigger Emergency! (With a terrible title)

Status
Not open for further replies.
Level 4
Joined
Nov 17, 2015
Messages
91
Hey guys, this is the most frustrating problem i've had yet.
Sometimes the function works and hides the units, other times the key just stays in your inventory and it doesn't hide the doors. :goblin_jawdrop:

  • Door 1
    • Events
      • Unit - A unit enters Region 159 <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item carried by (Triggering unit) in slot 1)) Equal to Purple Key
        • Then - Actions
          • Item - Remove (Item carried by (Triggering unit) in slot 1)
          • Unit - Hide Door 0160 <gen>
          • Unit - Hide Door 0164 <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item carried by (Triggering unit) in slot 2)) Equal to Purple Key
        • Then - Actions
          • Item - Remove (Item carried by (Triggering unit) in slot 2)
          • Unit - Hide Door 0160 <gen>
          • Unit - Hide Door 0164 <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item carried by (Triggering unit) in slot 3)) Equal to Purple Key
        • Then - Actions
          • Item - Remove (Item carried by (Triggering unit) in slot 3)
          • Unit - Hide Door 0160 <gen>
          • Unit - Hide Door 0164 <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item carried by (Triggering unit) in slot 4)) Equal to Purple Key
        • Then - Actions
          • Item - Remove (Item carried by (Triggering unit) in slot 4)
          • Unit - Hide Door 0160 <gen>
          • Unit - Hide Door 0164 <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item carried by (Triggering unit) in slot 5)) Equal to Purple Key
        • Then - Actions
          • Item - Remove (Item carried by (Triggering unit) in slot 5)
          • Unit - Hide Door 0160 <gen>
          • Unit - Hide Door 0164 <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item carried by (Triggering unit) in slot 6)) Equal to Purple Key
        • Then - Actions
          • Item - Remove (Item carried by (Triggering unit) in slot 6)
          • Unit - Hide Door 0160 <gen>
          • Unit - Hide Door 0164 <gen>
        • Else - Actions
      • Trigger - Turn off (This trigger)
new_bitmap_image2_by_darkvinylscratch-d9pgu5n.jpg


new_bitmap_image_by_darkvinylscratch-d9pgu7r.jpg
:goblin_jawdrop:

List of things i tried:
Extending the triggering region.
Putting the key in every slot, and testing it.

Can you help me make it a 100% chance to open these pesky doors of mine? :goblin_good_job:
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Aside from the poorly executed trigger (no offense), I don't see why this wouldn't work. Are you actually ordering the Hero/unit to walk over the region? Placing a unit in the editor over the region will not trigger it.

You should also change the layout of your trigger to something like this:
  • Find Key
    • Events
      • Unit - A unit enters Your Region
    • Conditions
    • Actions
      • Set TempUnit = (Triggering unit)
      • For each (Integer LoopInt) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by TempUnit in slot LoopInt)) Equal to KeyItem
            • Then - Actions
              • Game - Display to (All players) the text: Found Item!
              • Custom script: exitwhen true
            • Else - Actions
              • Game - Display to (All players) the text: Still searching...

Somewhere on map init, you can store the Purple key into a variable:
  • Map Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set KeyItem = Purple Key


Also, this should have been posted in Triggers & Scripts, not World Editor Help Zone xP
 
Level 4
Joined
Nov 17, 2015
Messages
91
Aside from the poorly executed trigger (no offense), I don't see why this wouldn't work. Are you actually ordering the Hero/unit to walk over the region? Placing a unit in the editor over the region will not trigger it.

You should also change the layout of your trigger to something like this:
  • Find Key
    • Events
      • Unit - A unit enters Your Region
    • Conditions
    • Actions
      • Set TempUnit = (Triggering unit)
      • For each (Integer LoopInt) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by TempUnit in slot LoopInt)) Equal to KeyItem
            • Then - Actions
              • Game - Display to (All players) the text: Found Item!
              • Custom script: exitwhen true
            • Else - Actions
              • Game - Display to (All players) the text: Still searching...

Somewhere on map init, you can store the Purple key into a variable:
  • Map Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set KeyItem = Purple Key


Also, this should have been posted in Triggers & Scripts, not World Editor Help Zone xP

Yes, I did make the unit repeatedly enter it.
Sorry about that, if an admin could move this there that would be swell!
I'll try your solution and report back if it works.
Lastly, sorry, I'm new to triggers xD
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Level 4
Joined
Nov 17, 2015
Messages
91
Aside from the poorly executed trigger (no offense), I don't see why this wouldn't work. Are you actually ordering the Hero/unit to walk over the region? Placing a unit in the editor over the region will not trigger it.

You should also change the layout of your trigger to something like this:
  • Find Key
    • Events
      • Unit - A unit enters Your Region
    • Conditions
    • Actions
      • Set TempUnit = (Triggering unit)
      • For each (Integer LoopInt) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by TempUnit in slot LoopInt)) Equal to KeyItem
            • Then - Actions
              • Game - Display to (All players) the text: Found Item!
              • Custom script: exitwhen true
            • Else - Actions
              • Game - Display to (All players) the text: Still searching...

Somewhere on map init, you can store the Purple key into a variable:
  • Map Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set KeyItem = Purple Key


Also, this should have been posted in Triggers & Scripts, not World Editor Help Zone xP

PS: Hey um, I'd like it to remove the item in the slot its found in, how would I do that?
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
The same Item - Remove function you used above.

Just to make sure to remove the messages lol.
  • Find Key
    • Events
      • Unit - A unit enters Region 000 <gen>
    • Conditions
    • Actions
      • Set TempUnit = (Triggering unit)
      • For each (Integer LoopInt) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set Item = (Item carried by TempUnit in slot LoopInt)
          • Set ItemType = (Item-type of Item)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ItemType Equal to KeyItem
            • Then - Actions
              • Item - Remove Item
              • Custom script: exitwhen true
            • Else - Actions
 
Level 4
Joined
Nov 17, 2015
Messages
91
The same Item - Remove function you used above.

Just to make sure to remove the messages lol.
  • Find Key
    • Events
      • Unit - A unit enters Region 000 <gen>
    • Conditions
    • Actions
      • Set TempUnit = (Triggering unit)
      • For each (Integer LoopInt) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set Item = (Item carried by TempUnit in slot LoopInt)
          • Set ItemType = (Item-type of Item)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ItemType Equal to KeyItem
            • Then - Actions
              • Item - Remove Item
              • Custom script: exitwhen true
            • Else - Actions

Hey! I tested it three times, and it appears to work now!
Thanks for making all my future door triggers less time consuming, and teaching me this. :goblin_good_job:
 
Status
Not open for further replies.
Top