Twine Version: 2.9
SugarCube 2.37
Simple Inventory 3 by Chapel
How can I pickup (all instances of) a random item from another inventory using Simple Inventory 3 by Chapel?
Twine Version: 2.9
SugarCube 2.37
Simple Inventory 3 by Chapel
How can I pickup (all instances of) a random item from another inventory using Simple Inventory 3 by Chapel?
Could something like this work?
<<set _randoObject to $inventory1.random()>>
<<pickup $inv2 _randoObject 1>>
(I don’t think there is a random pickup option, but I could be wrong? @Chapel? )
Didn’t worked, but gave me an idea. But I did write it the wrong way anyway. I need to have ALL items of that type in my inventory, so the quantity wouldn’t always be 1. I couldn’t find anything about this in the documentation.
I did it! This worked for me:
<<set _randomItem = either($inventory1.list)>>
<<pickup $inventory2 _randomItem $inventory1.count(_randomItem)>>
<<inv $inventory2>>
The first line gets a random item from the inventory list (only names, not quantities). The second line adds all instances of the random item using the count()
method provided in the guide.
Thanks for the help.
ah yeah
I don’t know why I assumed the first inventory was a basic array (and not an object…). should have asked
Yay for finding it you!