This topic has been disussed over and over in the forum and YANN already posted his solution. Still I would like to show you, how I would implment an inventory.
What you need to install, is Yann's Bitwise Plug-In At the point, I would like to give my biggest respect to Yann, who is allways very helpfull and has an extraordenery knowledge of the math required by a lot of games.
Additional you need the FUNCTION plug in.
As allways, you will find demo of my code HERE
And the CAPX again has all the artwork you need.
Having a RPG-Style inventory means, that you can pick up items and store them, depending on their function in different slots either on yor avatar, or in its backpack.
One could either handle this checking from the item, or the slot side. Since there will be less slottypes in compariosn to the items, it's wise to implement this on the side of the slot.
In my mind, the easiest way to do this, is by useing bitwise operation. I know, that alot of people are scared of this very "native" machine like stuff, but bear with me, I will try to explain it, so you can cope.
Bitwise Operation and Logic
One could think about BITs just like the little dipswitches you find in the radiocontrol of your garagedoor or any similar things. A bit is something like a small switch - it can only have two states. 0 or 1 (Yes, this is very close to a boolean...but...)
If you combine 8 bits, you'll have a byte . and this should ring a bell. I am sure you have heard about MegaBYTES...
Now, a byte can represent a number between 0 and 255 - so there are 256 ways how these 8 switches can be combined.
So what makes this unique? The answer is easy - with binary expressions, you are able to check for more then one condition at the same time.
Let's have a short example:
We have three bits, representing the following
1. Bit - if this is "set" (ie set = 1), allow this item to be placed in all slots
2. Bit - if this is "set", allow the item to be placed on the foot.
3. Bit - it "set", allow the item in the hand.
So, if you have an item like a gauntlet, you'd probably have this bit group looking like this 101 (if you transcribe this to our decimal system you'd have the number 5)
Now, the "Hand Slot" of you inventory would have the acceptance "number" of 1.
Why? Because 001 is 1 in our system.
Now we are ready for the "magic"!