Multiples of same item

wooterslw
11 Mar 2020, 07:18

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.


mrangel
11 Mar 2020, 09:09

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.


Forgewright
11 Mar 2020, 15:18

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.


Forgewright
11 Mar 2020, 18:39

http://textadventures.co.uk/forum/quest/topic/f7xuslhku02xkpxf8mjqsa/show-object-counter-in-inventory

mrangel explains it here