How Do I Manipulate Item Storage/Inventory System?

0 favourites
  • 11 posts
From the Asset Store
Cartoon Funny Item Interface Sound Pack comes with 426 high-quality sound effects
  • Whatsup everyone,

    Im looking for any examples of some kind of Item Chests used for storing in-game items.

    What im trying to do is simple in terms,but is rather difficult for me to fathom.Ive gotten help in the past with this but alot of what i gotten in return from others just didnt fit what i was aiming to do.

    Im trying to create a simple inventory system that allows me to drag and drop items from my Inventory Array,To my Item treasure chest for storage purposes.

    My game is made for mobile so everything is going to be done using touch screens.

    Im not asking anyone to make an example for me,i do understand the time it takes to mess around with Data Storage,I just need guided in the right direction,truthfully i dont understand arrays for inventory as much as i understand them for terrain generation.

  • Basically, what it boils down to is how to represent your items. Usually, items are a collection of values look like this {ItemID: 1, ItemName: "Small life potion", ItemPower: 25...}. Once you have your "database" of item, you can then create lists of item IDs, that could represent your inventory or chests content.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I used this to create my inventory. Works great now. ... -inventory

  • Magistross Tekniko If i wanted to use this method to make my Hotbar it would work fine.

    What i dont understand is could i be able to move slots wherever i want?

    I have a backpack that the player will keep all of his ingame items and it will not always be visible to the player and i would love to know if i can create slots where they are needed and if so how would i do that?

    Or am i limited to how the array is drawn? I would love to have my main slots seperate from my hotbar slots.

  • Anyone know how i can make my inventory appear where i want it too? Any info regarding this would help me alot

  • bump Im really trying to figure out how to move my inventory slots around.

    I am not understanding how to make my slots appear where i want them to.

    Im understanding everything else in the tutorial but i dont see any explanation on how to move the slots from one place to another.

  • Just add some sort of ID to where the items are, and show accordingly.

    Like, if you have a list somewhere of items in possession, add:

    backpack = ID 1

    hotslots = ID 2

    chest = ID 3

    pick objects with certain ID when you need to fetch them to show them somewhere.

    You could even do it with textual location IDs, such as backpack, hotslots etc

  • lennaert I understand the concept behind what you are saying but its not adding up completely to me.

    Is there any example that show how to show your slots where needed?

    From my understanding of how the example is made,i see no real way to dictate the position of the slots.

    Everything makes sense to me but this.

    I really hoped to find some help within some older posts in the forums but it seems that alot of the example capX files are lacking information regarding how to put the inventory together.

    I know that there aare multiple ways to make an inventory but i wish we could have a Universal Solution to making inventory systems.

    Ive spent months trying to figure out how to make it work,im not a stupid individual but this definitley makes me feel like i am.

    I really wish it was alot easier to make happen.

  • Imagine having 2 arrays.

    1 array defines the items, values, worths, extras, like:

    existing_items_array (static array of items, predefined during development)

    itemID (Y0) | name(X0) | color (X1)

    0 | sword1 | blue

    1 | sword2 | red

    2 | potionheal | green

    3 | gold | yellow

    Then you have a dynamic array for your users inventory:

    InventoryID (Y0) | ItemID (X0) | amount(X1) | location (X2)

    0 | 1 | 2 | chest

    1 | 2 | 5 | belt

    2 | 2 | 15 | chest

    3 | 3 | 100 | backpack

    4 | 3 | 1000 | chest

    5 | 0 | 1 | equipped

    2 red swords in the chest, 5 heal potions on his belt and 15 more in the chest, 100 gold in the backpack, and 1000 more in the chest. Also carries 1 blue sword which is equipped.

    Say you pick up some gold, you add it to player inventory array where X0 = 3 (gold id) and X2 = backpack (location).

    Imagine opening your inventory screen, select all items from array where X2 = backpack.

    Say you open a chest next to it, show all items from user inventory array where X2 = chest.

    You will need a method to move objects from one location to another, this is done with a temp variable.

    Like moving your gold from your backpack to your chest.

    Upon selecting the gold in the backpack, store the Y0 (inventory id) after clicking it.

    Then if you place it in another position, update Y0 it's X2 (location).

  • ... -inventory


    This isnt adding up to me.I feel like im missing information.

    I am using this method to create my inventory.

    What im not seeing is what you are talking about within this tutorisl or any ca px ive seen.

    it really shouldnt be this hard to create inventory systems.People who know nothing about coding are left

    in the dark when it comes to arrays.I just need to figure out how to make my slots appear where I want them to.This Is maddness that I have spent over 2 months trying to get it down and I can honestly say that this is the only thing that stand between me and actually selling this game to the public.Could someone please try and break this down for me.Thanks guys and im sorry for being frustrated. Its not your guys fault.

  • You can use the array index to dictate the position.

    Supposing your array goes something like this :

    (ItemID, ItemQuantity),

    (ItemID, ItemQuantity),

    (ItemID, ItemQuantity),


    Using an expression like Array.At(0,0) would give you the ItemID of the first item slot, and Array.At(1,0) its quantity.

    Or you could use dictionnaries, and use keys that goes like "slot1_ID", "slot1_qty", "slot2_ID", "slot2_qty", etc.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)