0 votes
by (1.1k points)
How to make stackable items in an inventory system? I would like to know in Twine and JS, thanks guys.

1 Answer

0 votes
by (44.7k points)

My Universal Inventory System (UInv) for Twine/SugarCube 2 automatically stacks identical items, so you might want to use that in your project.  If you want to try it you can also get it directly from the UInv download page here.

The UInv help file includes an "Item Builder" you can use to generate the items for your game, and then you just insert the code it generates into the UInv code, and put all of that in your JavaScript section.  Once you've done that, you can use the UInv functions in your Twine game to manipulate your inventory, and it will handle all of the complicated details for you under the hood.

Hope that helps!  :-)