Items and Inventories.


Minecraft. :D
Reaction score

My goal: Heroes can carry only 1 of each item class/type. They can carry only 1 weapon, 1 armor, 1 helm, 1 ring....etc.

I've seen rpg maps where they've done this. I'm trying to achieve something like Ace's Item Restrictions, but I want a vJass system that is efficient and can handle lots of items without lots of code.

What's the best way to implement it? I looked through kingking's Advanced Item Indexing and Unit Inventory Data, but they look like they handle only individual items, not item classes, which is what I want.

My initial thought about the best way to do it: Make all weapons "artifacts", all armors "permanent", all rings "miscellaneous", etc. Then when the item is acquired, I check if the hero is already carrying an item of that same class. Is this the best way?


I've seen maps that use backpack systems, such as Gaia's Retaliation. They use an extra hero as the "backpack". Are there any systems around for this type of thing? I assume its just creating a hero with no model, and using a high-frequency timer, periodically move the backback unit to the same position as the hero?
I have fiddled with inventories a lot in the past, check these out you will find what you need.


  • BagSys.w3x
    13.7 KB · Views: 259
  • GUI Equipment System.w3x
    19.1 KB · Views: 282
  • Equipment System The_Flood(Flood) V 1.3.w3x
    76.4 KB · Views: 269
  • Tuto inventaire 12 slots MapExemple.w3x
    23.1 KB · Views: 270
  • EZ Extra Inventory V 2.0.w3x
    47.7 KB · Views: 255
Thank you for the reply, but none of those systems are what I'm looking for, plus I won't use GUI.
They can be converted to jass. Well the best way would be to separate all the item types into the item classifications then when an item is picked up run through the items the unit owns and test each one.
First, converted jass is not vJass. Secondly, none of your systems do what I need. The only exception is the GUI Equipment System, but its not in vJass.

I'm wondering if there is already a vJass system out there for what I need. If not, then obviously I have to do it myself.
Well, I really loved this inventory system. Although it has a bug (forgot what it was exactly), but it can be easily fixed. There's a higher version on WC3C, but I was lazy to find it (got to go soon). It's also based on a custom item struct, which is the best way IMO (I'm not using any fancy inventory system in my map and I'm still using a custom struct)
Check this out, don't mind the title.


  • DamageDemo.w3x
    831.3 KB · Views: 316
I dunno if you linked the wrong Map, cause there is nothing in there about items or inventories. ?
i have two maps with almost the same name lol... edited the post. Check it now
Hm... A thread about items and inventories and not a signle mention about:


In my opinion it's the system which almost all other full screen inventories have tried to fork/emulate, although I think the idea behind it was actually from another system called fsgui.

It really "raises the bar" really high and makes all other inventory system look unimpressive. Although the problem for me is that it's documentation is not that great, has a huge learning curve and thus I still don't have a clue how to use it =) ...
I have its first version as well (I have a damn huge collection of WC3 systems on my HDD), but yep, I must agree it's quite hard to get used to it. That's mostly the reason I didn't mention it, plus, OP was not asking for such a complicated and complex system, he just needed a simple and cool way to separate item types.
Thanks everyone for your help. I decided to write up some code myself. It only took about 10 minutes. :)
I suggest you the following (in case you haven't tested the map i provided above)
Instead of looping through the unit's inventory constantly, create a boolean array for each item type and use the unit's custom value as its index.
static boolean array hasWeapon
if not hasWeapon[GetUnitUserData(unit)] then
What's the difference between

private boolean array hasWeapon


static boolean array hasWeapon


EDIT: If I used a boolean, I would need to create an additional function to set the boolean to false whenever a unit drops an item. In that case, I would either need to (1) loop through the inventory anyway, because whenever a unit drops an item due to already having one, it would incorrectly set the boolean to false. Or (2) I would need to destroy an item and create a new one whenever a unit picked it up and already had it. So it doesn't seem like it would be that much better than simply looping through the inventory in the first place like I'm already doing.
When it drops an item check for the item's type, i saw that you assigned a custom type to each one so it would work applying the logic...

if (type of item dropped) == Artifact then
set hasWeapon[unit index] = false

no need for loops, and again please check my map.

"private" and "static" are completely different things, private i assume you already know of, it's for encapsulation, means that you cant access that variable outside the current scope.
static is used for ONLY struct members (and static ifs, but not relevant) remember that structs are meant to handle arrays attached to instances. If a variable is static it means that it works like a common global

struct Test
static integer what

is the same as

integer test_wat
If you didn't fix the slot with the type, like Slot 0-> Weapon, Slot 1-> Armor, then it will be all right, needless to bother with moving item in slots. :)
pk here is an old system that restricts units from using items that aren't their class or if they already have the item type.
To link unit classes and item classes i used the custom values and to restrict item types i used item levelsView attachment Item Controler.w3x
gimme some credit if u use this ;)
The classes are unlimited so are the types, so you can have as many as u want
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper: is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example:
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser
  • The Helper The Helper:
    Happy Thursday!
  • Ghan Ghan:
    I'm not so sure, there's still a lot of Thursday left for it to become unhappy.
  • The Helper The Helper:
    still a few hours
  • The Helper The Helper:
    Its Friday!!!!
  • Ghan Ghan:
    Thursday 7/10 would Thursday again

      The Helper Discord

      Members online


      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.