Multiple Inventories

This forum is currently in read-only mode.
From the Asset Store
Inventory Aid
$4.90 USD
Create grid-based game inventories and items easily.
  • Okay this is getting pretty complicated. Currently my inventory is a layer with "emptyslot" sprites on it. If you drop an item on the inventory layer it moves to the nearest emptyslot. I wanted to create a separate inventory for my car too so I made another layer with empty slots and added several events to basically duplicate the actions of the Inventory layer. If you are adjacent to the car you can see the car inventory but if you are not the car inventory moves off screen.

    This works just fine for 2 inventories but what I really want to do is make many different backpacks, cars and npc's that can all have there own inventory. Obviously this will become unsustainable quickly with my current system. It took me a day to works the kinks out of a second inventory layer. There has to be a better way to do this, I would love to keep the basic principles of the visual drag and drop inventory the same, but I would understand if that is impossible or extremely complicated.

    Basically, It needs to be like the Bethesda games but instead of 1000's of containers I would only want to make around 30-50, you do not find items in containers, just on the floor. Also the containers would have to keep track of a couple of variables for each item, ie. health. The way I am doing this now is with private variable on the sprites themselves which are never destroyed when moving between ground and inventories.

    If anyone has any suggestions for how to tackle this I would really appreciate it.

  • Here's one idea:

    http://dl.dropbox.com/u/5426011/examples13/multi_inv.cap

    Basically the bags are in a container with an array, so each bag has an array for it's contents. When the player touches a bag the bag's inventory is displayed. The player's inventory is handled the same as the bags, except there is no array for the player's inventory, just the slots. One could be made later if needed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Actually I figured it out in a way that let's me keep all of my item data in the sprite itself, so each item is it's own entity that can exist in any box, I did it all with local variables, So far I can't find any bugs. Fingers crossed as I continue to add functionality. Basically I had a system that was about 40 events handling all of the differents items and whether or not they were in the inventory, I had to completely delete the entire group of events and start fresh, it was terrifying, that was about 12 hours ago, I feel way better now.

  • 67 Events in three separate groups but game now supports an infinite number of Inventory containers that are Super easy to create, and best of all it never destroys or spawns a sprite. I'm going to test it for couple more hours but so far I can't find any big problems. I feel so much better now.

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