Multiples of same item

Is there a way to allow a player to carry multiples of the same item (without creating a stack item)? So, if I have an item, say "Mushroom" and the player picks one, I add the item to the inventory. But if I add it again, it doesn't give him a second copy of it.

If you add an item to the inventory when it's already there, you're just moving it from the inventory to the inventory.

If you want it to appear more than once, you'll need to clone it.

CloneObjectAndMove (mushrooms, game.pov)

When you do this, note that you will have objects named "mushrooms1", "mushrooms2" etc. in the inventory. Their aliases will be the same, so the player doesn't see the numbers. But if another script refers to them, you'll need to make sure you use the right one. So, for example, in the object's verbs you need to remember to use this rather than the name of the object.

I believe Wooterslw wants only a single item to show even if there is more than one in inventory. Perhaps an integer before the item to keep count. I have seen this done here in the forums but don't remember where.

mrangel explains it here

Log in to post a reply.