Hello! As subject, Is there a way to remove 1, 2 or more RANDOM inv items from my inventory? Basically, I set up my inv as a deck of cards, and I need to remove 2 random cards If my character loose a battle. Thank you so much!
EDIT: I was thinkhing of using a simple random roll with inventory ID array. I have to test it yet, but may be a problem because it can happens often to have more than one of the same card ID in my inv. Any suggestion?
As long as "Display multiple items multiple times" is checked, this should do the trick:
if (InventoryWindow.ItemCount > 0)
{
r = Random(InventoryWindow.ItemCount - 1);
player.LoseInventory(InventoryWindow.ItemAtIndex[r]);
}
if (InventoryWindow.ItemCount > 0)
{
r = Random(InventoryWindow.ItemCount - 1);
player.LoseInventory(InventoryWindow.ItemAtIndex[r]);
}
If you have stacked cards you'd need some modifications.
Wow, It really seems to work! Thank you so much, and I also have learn something new about inventory properties!
not to worry because I display every items multiple times, to create the Illusion of the card deck.
Thanks a lot!