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

Picking Item

Status
Not open for further replies.
Level 1
Joined
Aug 16, 2011
Messages
3
what i am trying to do is to specify the items for categories, i ll be more obvious i have 3 classes for example Wizard, Thief , Swordsman
i want to specify 5 type of items for each class, so when Wizard unit type try to pick the "any item that not specified to him" from the ground, the item will be dropped automatically
i tried to create a temple for that to make it more obvious .

http://www.hiveworkshop.com/pastebin/f11ab7bbe13c95d3d7033fcba0122ad26679/

so Wizard unit cant pick the items type which specified for thief classification when finding such thief item on ground. (no one can pick the item type of other Hero Classification)

Please when answering, answer it with [TRIGGER) so it will be more obvious to be understood.

Best Regards.

p/s. i tried to make it as i explained it in the pastebin link above, the problem is all the players can pick each other items type (wizard can pick the items which specified for thief and swordsman) so its not working.
 
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,657
You need to attach a value to each item type.
The most simpe way to do it is use a hashtable and store an integer which will represent the class id (Wizard 1, Thief 2, Swordsman 3) and an integer that wil represent the item type id (Helmet 1, Armor 2, Boots 3, WeaponL 4, WeaponR 5)

When you acquire an item, you check if the unit is of the appropriate class and check the weapon type.
Checking this is done by loading the value from the hashtable and compare it to what you need.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,178
Hashtables may be useful for this. They can allow one to map data at unique keys to item types. This is because item types are integers, the same as hashtable keys. This would allow you to resolve what "class" an item belongs to with near O(1) complexity. One can do something similar with unit types. This would be useful for discerning which classes of items the unit can use.

This is similar to what Wietlol is saying.
 
Level 1
Joined
Aug 16, 2011
Messages
3
When reffering to Acquires/Loses an item use "Item Being Manipulated" instead of "Picked Item", Picked Item should be used only for "Pick every itens..." actions.
This problem has been asked countless time in Hive, try searching to find more info.

btw, in the trigger, it's not (picked item). should be (item being manipulated)

Edited but still same problem http://www.hiveworkshop.com/pastebin/d32a12f9e87c2292ad008428f98081e56683/ , i ll try Wietlol and super good way
 
Level 11
Joined
Oct 9, 2015
Messages
721
Why don't you use an item class for each character? You could set Permanent itens for the warrior classes, Charged items for the Caster clases, Artifact for the Ranger classes, then if a warrior acquires an item that is not of Permanent class, you call a function to drop it.
 
Level 3
Joined
Jul 15, 2013
Messages
54
Edited but still same problem http://www.hiveworkshop.com/pastebin/d32a12f9e87c2292ad008428f98081e56683/ , i ll try Wietlol and super good way
Try using your trigger, it works for me. However, use Wietlol's way is smarter and more efficient :S
  • Untitled Trigger 001
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Crown of Kings +5
          • (Item-type of (Item being manipulated)) Equal to Arcanite Shield
          • (Item-type of (Item being manipulated)) Equal to Runed Gauntlets
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Paladin
              • (Unit-type of (Triggering unit)) Equal to Mountain King
        • Then - Actions
        • Else - Actions
          • Hero - Drop (Item being manipulated) from (Triggering unit)
 
Status
Not open for further replies.
Top