Is there a good way to create a item stacking system?
Atokrad
14 Mar 2021, 02:54I am creating health pills in my game but I don't want the player's inventory to get cluttered, I would like one that creates a list of the objects so the player can select one to use, I would also like it to be able to handle different types of pills, like a magic pill for example.
K.V.
22 Mar 2021, 00:02Hello.
The Pixie has a library for that on GitHub:
https://github.com/ThePix/quest/wiki/Library:-Stackable-items
mrangel
22 Mar 2021, 10:10There's a bunch of different ways to do a stacking system. But I'm not entirely sure if that's what you want.
If you want a stack for each type of pills, there are a few different stacking systems available. I think Pixie's library is pretty good.
If you want to have different types of pills grouped together, it might make more sense to make a container like a pill box that you can put them in. It would be possible to make it so that when you pick them up, they are automatically added to the box. It should also be possible to make it so that the box's contents don't show up in the sidebar (possibly by making the contents scenery; or you might have to add some JS magic).