use this in script call event:
$gameParty.loseItem($dataItems[Math.randomInt($dataItems.length)], 1)
The other problem with this method is that you're selecting a random item from the database without any reason to believe the party
has one to lose. Unless you're late in the game and a hoarder, there's every chance that this will get called and simply do nothing. Caethyril's method of using the $gameParty containers assures that
something will be lost when the function is called.
Math.randomInt(size, min, max)
What is "size" supposed to represent in that? In your own example, you call it with the supposed min and max being 2-20, and you get a result of 157. So...how is it "working quite well"?
😛
You can see the code in rpg_core.js, and it only takes one argument. In JavaScript you can overload a function call with additional arguments and not get an error, but neither does it
do anything with them.