• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Trigger help: Item sorting system

Status
Not open for further replies.
Level 1
Joined
Sep 21, 2009
Messages
2
I am trying to make a trigger to sort a heroes inventory based on what type of item they pick up. I would like to make it so that weapons go in the first slot of their inventory, helmets go in the second, etc. but I can't figure out a way to get that to work. Any help would be much appreciated =)
 
Level 9
Joined
Dec 21, 2006
Messages
490
you have to make the items drop and pick up in the order you want them in the inventory. so all weapons should have the custom value 1 for example and armor 2. if some1 picks up something you have to drop all items and pick them up in the order of the custom value.
if you have no items and pick up a custom value 6 item you need 5 dummy items picked up, then the item itself and remove the dummy items again.
you have to make the items undropable in order to keep them at the right spot.
one way to create that system is with regions. you move all items to a region, pick all items with value 1 and in region x - give to hero. if there is none with custom value 1 create 1 dummyitem and give to hero.
at the end pick all items of type dummyitem and remove them
 
Level 6
Joined
Aug 22, 2008
Messages
123
This method would work, but it may be quite ineffective, depending on your usage of special triggers fireing on "unit requires an item".
You can order a unit to put a certain item into a specified slot, that works exactly the same way as if you were doing it manually.

Sorting
You start from the item type you want to be put in slot 1 and move that item to slot 1, if it is not already there.
Afterwards you pick the itemtype that is supposed to be put in slot 2 and do the equivalent actions.
You go on using that method until you reached slot 6.

Troubleshoot
This method will be working properly as long as a hero carries only one item of each type. This means that you will have to check first whether he is using 2 items of the same type and drop the item that violated this rule. If the hero did not have another item of that type, you may start with that sorting.

This system can be improved to assure that there are empty slots when not having an item that fits into the specified types, but this should work well enough:wink:
 
Status
Not open for further replies.
Top