• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Question about triggering riddle

Status
Not open for further replies.
Level 3
Joined
Sep 7, 2009
Messages
22
Ok, so this is my very first map, so please explain things noob friendly! :grin:
What I have so far is a riddle that will direct you to drink one of seven potions (all identical obviously). If you drink the correct one, it will move you to a region and replace the potion to it's original position. If you drink one of the six incorrect potions you will be killed and the potion will be replaced in it's original location. Another thing I want to happen is when the player picks up the potion, they don't click it in their inventory like they would a health potion. It will just be used automatically.
I know that sounds really complicated... it probably is. But if you could explain it, PLEASE do so in a step by step noob friendly way.
+rep to whoever gives the best answer!!

Thanks! :thumbs_up:
 
Level 6
Joined
Jan 31, 2009
Messages
166
Riddle potion system

The first thing you need to do is just object editor work Open the object editor and make 2 items I sujest you base them off of spell immunity potion rename them to Riddle potion (this will be the correct one) and Riddle potion 2 (this will be the poison one) ( to stop us from confuzing ourselves you must give them 2 different names you can change this when you are done with the triggers). Set there stats so that there buff lasts 0.01 seconds (if you set it to 0 it lasts forever) then Open the Region pallet

Set a region around each area you want one of the potions to spawn the one with the correct potion shold be called "Item spawn 1" then the incorect ones shold be called "Item spawn 2" "through Item spawn 7" and one region that incompases all the spawns "called All item area" and finaly a region for the place you want to teleport your hero

Open the trigger editor and create a custum variable (the little golden x button) name the variable TempPoint and make it a point variable (don't check array).

Finaly Add in the fallowing trigger
  • Correct potion
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Riddle potion
    • Actions
      • Set TempPoint = (Random point in (Playable map area))
      • Unit - Move (Triggering unit) instantly to (Center of (Playable map area))
      • Custom script: call RemoveLocation( udg_TempPoint )
      • 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
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Riddle potion
                  • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Riddle potion2
            • Then - Actions
              • Item - Remove (Item carried by (Triggering unit) in slot (Integer A))
            • Else - Actions
      • Item - Pick every item in All item Area <gen> and do (Actions)
        • Loop - Actions
          • Item - Remove (Picked item)
      • Set TempPoint = (Center of Item Spawn 1 <gen>)
      • Item - Create Riddle potion at TempPoint
      • Custom script: call RemoveLocation( udg_TempPoint )
      • Set TempPoint = (Center of Item Spawn 2 <gen>)
      • Item - Create Riddle potion2 at TempPoint
      • Custom script: call RemoveLocation( udg_TempPoint )
      • Set TempPoint = (Center of Item Spawn 3 <gen>)
      • Item - Create Riddle potion2 at TempPoint
      • Custom script: call RemoveLocation( udg_TempPoint )
      • Set TempPoint = (Center of Item Spawn 4 <gen>)
      • Item - Create Riddle potion2 at TempPoint
      • Custom script: call RemoveLocation( udg_TempPoint )
      • Set TempPoint = (Center of Item Spawn 5 <gen>)
      • Item - Create Riddle potion2 at TempPoint
      • Custom script: call RemoveLocation( udg_TempPoint )
      • Set TempPoint = (Center of Item Spawn 6 <gen>)
      • Item - Create Riddle potion2 at TempPoint
      • Custom script: call RemoveLocation( udg_TempPoint )
      • Set TempPoint = (Center of Item Spawn 7 <gen>)
      • Item - Create Riddle potion2 at TempPoint
      • Custom script: call RemoveLocation( udg_TempPoint )
now I will explane the trigger. First we check when a unit uses an item and make sure its the right one which is the event part and the condition.

Secondly We set TempPont(a variable) to the place we want the unit to be teleported to (this is to avoid data leaks which will be explained later)

Then we move unit instanly to temp point and remove temppoint (again the removal part is to deal with Data leaks)

Next we remove all the items in Region all items (to clear any items the player did not pick up)

Then we remove all the items from there inventory so they don't take the poison potions along with them (the conditions are to make sure it doesnt remove other items from there inventory)

Finaly we spawn new poison potions and non poison potions at the regions they started in (the TempPoint / remove temp point part is to deal with Dataleaks for more information on them look at the fallowing tutoral http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/basic-memory-leaks-5889/ if you don't want to look at the tutorial just copy my trigger be sure to spell the stuff in the custom script correctly and use the same capitalization.

Now for trigger 2
  • Incorect potion
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Riddle potion2
    • 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
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Riddle potion
                  • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Riddle potion2
            • Then - Actions
              • Item - Remove (Item carried by (Triggering unit) in slot (Integer A))
            • Else - Actions
      • Unit - Kill (Triggering unit)
      • Item - Pick every item in All item Area <gen> and do (Actions)
        • Loop - Actions
          • Item - Remove (Picked item)
      • Set TempPoint = (Center of Item Spawn 1 <gen>)
      • Item - Create Riddle potion at TempPoint
      • Custom script: call RemoveLocation( udg_TempPoint )
      • Set TempPoint = (Center of Item Spawn 2 <gen>)
      • Item - Create Riddle potion2 at TempPoint
      • Custom script: call RemoveLocation( udg_TempPoint )
      • Set TempPoint = (Center of Item Spawn 3 <gen>)
      • Item - Create Riddle potion2 at TempPoint
      • Custom script: call RemoveLocation( udg_TempPoint )
      • Set TempPoint = (Center of Item Spawn 4 <gen>)
      • Item - Create Riddle potion2 at TempPoint
      • Custom script: call RemoveLocation( udg_TempPoint )
      • Set TempPoint = (Center of Item Spawn 5 <gen>)
      • Item - Create Riddle potion2 at TempPoint
      • Custom script: call RemoveLocation( udg_TempPoint )
      • Set TempPoint = (Center of Item Spawn 6 <gen>)
      • Item - Create Riddle potion2 at TempPoint
      • Custom script: call RemoveLocation( udg_TempPoint )
      • Set TempPoint = (Center of Item Spawn 7 <gen>)
      • Item - Create Riddle potion2 at TempPoint
      • Custom script: call RemoveLocation( udg_TempPoint )
Ok as you can probably see this one is almost identical to the first one so I sujest you copy paste the first one then change things as you need.

The only real difference in this one is that the condition is different (so it checks for the poison potion rather than the normal one) and that it kills you rather than teleports you

Finlay change the name of Riddle potion 2 to Riddle potion so the player cant just read the name (don't do this tell everything else is done or you will just confuse yourself)

Here is a map with the triggers set up on it Maphttp://www.hiveworkshop.com/forums/pastebin_data/9z3auy/_files/Riddle%20potion.w3x

Ok that should work
I hope that helps you and you understand it feel free to message me at this form at my email ([email protected]) or via private messages
 
Last edited:
Status
Not open for further replies.
Top