This script allows you to create a shop that sells “gamble items”. Gamble items are shop goods where the player has a random chance of obtaining an item from a pre-determined set of items.
You will also need the Scene Interpreter to display messages in the shop scene
Place this script below Shop Manager and above Main
Setup gamble items
To setup an item as a gamble item, go to the Items tab in the database editor and note-tag an item with a tag of the form
<gamble item> i23: 0.5 w4: 0.2 a17: 0.4 </gamble item>
The ID on the left indicates the type of item (item, weapon, armor), and the corresponding database ID. The number on the right is the probability of
obtaining that item, as a weight. So the example note-tag shows that there is a relatively higher chance of obtaining item 23 compared to weapon 4.
The chances are treated as ratios. So the chances of obtaining weapon 4 is 0.2/1.1, where 1.1 is the total of all of the chances.
In the event, before the “Shop Processing” command, make a script call.
@shop_type = "GambleItemShop"
The list of items should be a list of gamble items that have been set up appropriately above.