Inventory stacking // containing multiple items // Rule for multiple of the same item

If you want multiple identical, stackable items to exist, you need to create them as a kind, not an instance of a kind; in your code above, “Copper Zorkmid” is a specific instance so it’s not going to do what you want, but you could write things like “there are six zorkmids in the chest” and then the player would be able to pick them up individually or at once, and they’d stack.

Another approach to a money system is the “have a single object with a quantity property” one you mention later in your post, but these are pretty much mutually exclusive - I’d pick one or the other. There have been some good recent threads laying out that approach, like this one.

In theory either can work, though my personal experience is that working with identical interchangeable objects can get pretty finicky, so I’d recommend the property route.

3 Likes