Gamble Item Shop

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.



Script: download here
Required: Shop Manager

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.

Setup shop


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.

You may also like...

18 Responses

  1. Flungsumpoo says:

    Hi I need help. I have the gamble shop working but for whatever reason it disables my event merchants from selling (it won't show up on the listing of items for sale) anything else but gamble items. Is there an easy way to have my standard merchants sell potions and things like that?


  2. Johnny says:

    really loves the script!!!!!!!!!
    But when it’s opening the box (the massage going on)
    and you press the space(usurlly to speed it up in a normal massage)
    It can select items from the shop… Then it would cause a bug ……..
    Is their anyway to fix that?

  3. Tesaigo says:

    After looking for a while the Script code I menaged how to do that! Thanks, and congratulations for the nice script! 😀

  4. Tesaigo says:

    Hi there! You probably don’t remember me… anyway, is it possible to gamble an item in the inventory? I mean, you get the Gamble Iten (Luck Chest for example) anywhere, from a NPC. Is it possible to when te actor use the item in tem inventory, the system gamble the item? If you don’t undestand i’ll try tho explain it better… By the way, nice script!

  5. Vani says:

    it’s not working…
    after purchased item w/ gambling, it only show the item in the first line
    ex :
    i23: 0.5 <<< this item always wins, even with 0,1
    w4: 0.2
    a17: 0.4

    can you help me?

    -srry 4 bad english-

  6. does the system randomizes the items by using the chances as weights?

    like if item1 has chance of 1, item2 of 3 and item3 of 5

    the actual chances would be: 5/9 chance to obtain item3, 3/9 chance to obtain item2 and 1/9 chance to obtain item1?

Leave a Reply

Your email address will not be published. Required fields are marked *