How to make property based inventory!

Hi! I have 2 questions:
First one is how to script inventory based on properties, so it has limit of 12 slots and…
Player contains a lot of properties containing IDs of itmes, like item1(int) value 3 means so player has got 3 dirt blocks or item3(int) value 5 means so player has got 5 shotgun ammo, etc. How do I make cell-based inventory, where player can hold one type of item per slot? Basicly, there should be inserted property in the cell, when something, like a module gets activated(IDK what). Than it should copy the value from player property with the same name. And… If there is already slot with that property and than the same module(or something) activates, it shouldn’t do nothing, just update player’s data about his items.
Second problem is to know how to make GUI, altought it is much simpler.
Please, post some tutorials and, most important, examples…

I’m actually working on something that might be similar to what you’re looking for…

Mine has 8 slots for general items like keys and stuff, health drinks and ammo are not yet represented in the UI but they have variables for how many you’ve picked up.

I followed Goran’s tutorial on here: https://www.youtube.com/watch?v=7DM_oSwqXfE, but mine’s a bit different.

What I did:

I attached an “empty” to the player which will represents the item list. Kinda like an invisible “backpack” for the player. Added general properties like health, health drinks, ammo etc…, I have them as integers, but the other props are added to it as the player picks them up.

Now, whenever I call the UI (for me it’s on an overlay scene) it checks the properties of this “empty” in the main scene, and sets the number of cells depending on how many items there are in the backpack (how many properties there are in “empty”)

I don’t have visual representations for the items yet cause the items are just random like can of coke and stuff haha.

Anyways mine’s a work in progress and might not even be what you’re looking for, but that’s how I would go on about it. Just think of the backpack :slight_smile: Oh and watch Goran’s tutorial, it’s very cool!

Pete

I use a list, and have the player cycle the list to choose,

The same system could generate a inventory screen with

For items in list, add plane, set texture, set index of plane so clicking the plane sets the index, selecting the item.

OK! Bout that tutorial- how to make player unable to place items out of cells? How to make that inventory as overlay scene(I mean, the property transfer- is it messages or globalDict)? How to add item to inventory, when player has positive collision with item? How to limit size of inventory? That is what I need to make inventorty.

check this out

it’s not complete but very simple
with the system
1 script = grab value from icon
other script = drop item on surface drop

Attachments

InventroyBase.blend (489 KB)

Your description is a bit confusing. You mix requirements with technical details.

let me translate this

into that:

Honestly I do not understand your “(int)” things and what you want to do with properties. I simply assume it does not matter.

Inventory
An inventory itself is not that complicated. Lets think about the operations you can perform on it:

A) store an item (removed from source + added to inventory)
B) retrieve an item (removed from inventory + added to destination)

These are the basic operations of an inventory. You might want some additional operations:
A’) store multiple items
B’) retrieve multiple items
B’') remove item(s)
They can be build from the basic operations.

Inventory Builder
To get an configurable inventory you can create an inventory builder. You can setup the configuration at that object. The only operation on the inventory builder is:
A) create inventory

So you see no need to mix creating and operating an inventory. The builder can create you as much inventories as you like. It can even create inventories with different setup.

Anyway. There is something else you want:
Inventory Viewer
The inventory viewer allows you to interact with the inventory. It is not necessary to operate the inventory (as it is a separate object), but it helps the user to use it.
A typical inventory viewer consists of several graphical objects, plus some controls (buttons). Beside the representation of slots you need a representation of each possible item type too. [You never ever add the real collected item to the inventory, you just collect the statement that it is collected.] The item representation in the inventory viewer does not need to match the collected object.
Honestly you could even output text.

Anyway. Enough about design. Here is an example:
http://blenderartists.org/forum/showthread.php?361011 (it does not use multi-item-slots, but you can extend it that way)

Here is my own design… it’s similar to Diablo but without the ability to hold multiple copies of some objects (yet)

it uses 3 small scripts to place, and retrieve item string data, and replace mesh.

Attachments

InventroyWorking.blend (529 KB)

Actually, all the moethods looks nice but not that what I want:D They work, but I want an inventory like in Minecraft, but reduced size(maybe like in Resident evil 1/2/3.

Resident Evil huh? Best off doing what I did then… :stuck_out_tongue: