experimenting with random items at shop

So basically Im trying to figure out how to make it so when you go to a shopkeeper,you can't choose EXACTLY what to buy.

I want it so that after you buy a random ration,the item shows up on the floor for you to pick it up.

example "Let's see what i have in storage right now" then there's only one option called ration which could range from food to poison and disease items.I want to make it so that the random item shows up on the floor as one of those things, randomly.How would i go about doing this?

Would it be possible to use one event and have each page with a different picture in it representing the item?
Yes. Use a variable as a condition on each page. Page 1 will have the variable == 1 as the condition, page 2 will have it == 2, and so on.


When you want it to appear, do a Control Variables (variable id) : Random number between 1 and however many different items you want it to be.


When the item is picked up, change the variable back to 0 so the item is no longer there.
Alternatively, you can use a script with shop conditions - there is a shop script from Tsukihime where you can place conditions on items to decide whether they should be purchasable or not.


Originally that was intended to allow special items only to be purchasable after quests or storypoints had been reached, but you can add variable checks there as well. This is probably less work than making multiple event pages for basic shops, but it does require adding a script (which requires checks for compatibility and basic scripting knowledge).

Original thread: https://forums.rpgmakerweb.com/threads/experimenting-with-random-items-at-shop.21313/