random item

i want an item to be given to a npc and they give you a 1 of 3 items at random how would i make this happen?
i want an item to be given to a npc and they give you a 1 of 3 items at random how would i make this happen?
A quick port my RandomLoot plugin to MZ for you.. might be helpful?
Spoiler: Event Setup - Example Screenshot
1659654460385.png

Spoiler: Demo Gameplay Video


Plugin Download Link:
I would pull this off with variables and conditional branches.

Make a variable for the random item drop, and in the part of the event where the random item is given, put in a control variable command and randomize it 1-3, then split it into 3 separate conditional branches depending on the value of the variable you made.
Or without a plugin, very simple to setup...

1659657520110.png


Edit: Ninja'd @devisous above... same solution XD
i do this a similar way @devisous and @Ahuramazda describe.
if you dont want all items to have the same chances of being picked (ie. item 3 is rarer then items 1-2) you can use random 1~100 instead. (doing it this way requires "else" branches so it doesnt try to check higher numbers after its already found an item to give you)
ie. if RNG <= 40 : get item 1 (40% chance (1-40))
else if RNG <= 80 : get item 2 (40% chance (41~80))
else if RNG <=100 : get item 3 (20% chance (81-100))

Original thread: https://forums.rpgmakerweb.com/threads/random-item.150102/