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

Checking if an hero has an item when entering a region

Level 24
Joined
Feb 28, 2007
Messages
3,480
Checking if an hero has an item when entering a region tutorial
This tutorial is about items and regions in a combinaton. For example, there is a closed gate which will only opened if you reach it with an item, in this case, a key. This tutorial will cover what will happen if you reach the gate with the key, and without it. This is a really simple trigger actually, and only requires one event and a few actions.

1. We will need to check when the hero does enter the region, with or without the key, for this we will use the event Unit - A unit enters region.
  • The key and the gate
    • Events
      • Unit - A unit enters MyRegion
    • Conditions
    • Actions
2. Now that the hero has entered our region, we shall check whatever or not he has the key needed to open the door, for this we use the action If / Then Else, it is a easy trigger to use, If checks whatever a condition you pick is true or not. Set this to Boolean Comparison - Hero - Hero has item of type, pick the unit and the key item. Then occours when you do have the key, runs the action for opening the door. Set this to for example Destructible - Open Gate for example. Then runs the action for whatever should happen if you dont have the key, here you can put either Do Nothing to ignore it, or you can put a Game - Message, and put it to like "The Gate is closed, find the key and open it."
  • The key and the gate
    • Events
      • Unit - A unit enters MyRegion
    • Conditions
    • Actions
      • If ((MyHero 0000 <gen> has an item of type MyKey) equal to true) then do (Destructible - Open Gate 0000 <gen>) else do (Dispay to (All players) the text: The Gate is closed, find the key and open it. )
3. If done correct you got a working key and gate system, usable for lots of things, good luck with triggering in the future!
 
Level 8
Joined
May 27, 2007
Messages
170
This tutorial covers something so simple it beggars beleif, and I think most people could work out how to do that on their own with a minute or two's inspection of the trigger editor. It needs expanding on, your trigger would only work if either you had just one gate, or you wanted a skeleton key which opens all the gates in the map. You need to expand on this tutorial a lot, you need to go into some more advanced ideas. Tell people how you would set up a seperate key for each gate without creating a new type of key for each, or maybe describe a lock and unlock system for gates. Whatever, just make it more useful and advanced. :thumbs_up:
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
This tutorial covers something that is just too simple to be of any use. Even the most beginner triggerer will use logic to create this since it is almost obvious. Tutorials are there for eithor describing a lot of easy things or for explaining how to do something that people really strugle doing (jass, modles, art, tools) and so this really is not approvable.

Tutorial Buried
 
Top