Shop Stock

● ARCHIVED · READ-ONLY
Started by Tsukihime 20 posts View original ↗
  1. Shop Stock

    -Tsukihime

    This script adds a "stock" count to each shop good.

    Once a shop good's stock reaches 0, it will no longer be available in the shop.

    shopStock4.jpg

    The stock is set up for individual shops. One shop's stock does not affect another shop's stock.

    The stock is only setup once: if you leave and come back, the stock remains the same

    Download

    Script: http://db.tt/Ka1gnmd0

    Required: Shop Manager

    Compatible with Yanfly's Ace Shop Options, as shown above

    Usage

    shopStock0.jpg

    In your event, before the Shop Processing command, use the following script call. If you don't set a stock count, then it is assumed to be unlimited.

    @shop_stock[id] = amountUsing the Shop Manager, the shop stocks are setup for each individual shopshopStock1.jpg

    So let's say the player bought 6 potions. The picture doesn't show it, but the player actually left the shop, went to explore a dungeon, and then came back to buy more potions. Unfortunately, we have limited potions in stock...

    shopStock2.jpg

    And once you buy up all the potions, that's it.

    shopStock3.jpg

    Notes

    Visually, it is unappealing. You will likely have to customize how it looks to suit your game.
  2. Cool script, I like this idea. :) How would I add the items I sell back to the shop to the amount available?
  3. Very nice, I will be using this. Thank you.
  4. ct_bolt said:
    Cool script, I like this idea.  :)   It seems though I am able to buy even with no money though. :unsure: B)
    Ah, looks like I accidentally overwrote a method in the shop manager which prevents you from buying items you can't afford.

    Update shop manager and it should be fine.
  5. Tsukihime said:
    Ah, looks like I accidentally overwrote a method in the shop manager which prevents you from buying items you can't afford.

    Update shop manager and it should be fine.
    Yup working great now, thanks. How would I add the items I sell back to the shop to the amount available?
  6. Or allow for the shop to replenish stock at intervals? Like, they sold out of potions and antidotes, but later you do a sidequest that adds more potions to the store (but not antidotes).
  7. ct_bolt said:
    Yup working great now, thanks. How would I add the items I sell back to the shop to the amount available?
    That is not available in this script.

    I am writing another script that will allow you to sell items back to the shop.

    Basically you need a way to convert a raw item (RPG::Item, RPG::Weapon, etc) into a shop good.

    Liberty said:
    Or allow for the shop to replenish stock at intervals? Like, they sold out of potions and antidotes, but later you do a sidequest that adds more potions to the store (but not antidotes).
    It is not very user-friendly at the moment.

    Here is something that you might say

    # get the specific shop.shop = ShopManager.get_shop(map_id, event_id)# get the specific good.good = shop.shop_goods[id]# now increase stock by 20good.increase_stock(20)But that's pretty annoying to do. A better solution would be needed to make it easy to setup replenishment.
  8. Liberty said:
    Or allow for the shop to replenish stock at intervals? Like, they sold out of potions and antidotes, but later you do a sidequest that adds more potions to the store (but not antidotes).
    Oh that is a great idea! :) I would love to be able to add a quest like that.

    Tsukihime said:
    That is not available in this script.

    I am writing another script that will allow you to sell items back to the shop.

    Basically you need a way to convert a raw item (RPG::Item, RPG::Weapon, etc) into a shop good.
    Awesome, looking forward to that new script. BD
  9. Maybe I misunderstood your script, but when I use the call

    @shop_stock[id] = amountit stocks the shop with the item id using the database's id.

    I thought it was supposed to use the shop item id?

    (As I said, maybe I misunderstood, or it might be a script incompatibility?)
  10. Yes, it is the shop item ID, so if you type 4, then it's the fourth item on the shop list.


    Update the shop manager I found a bug where I was using the wrong name. That might be the problem.
  11. Tsukihime said:
    Yes, it is the shop item ID, so if you type 4, then it's the fourth item on the shop list.

    Update the shop manager I found a bug where I was using the wrong name. That might be the problem.
    Yup I was having the same issue, but now it works great. BD
  12. One of the issues with the visual aspect is that long names will cover up the stock count.


    I mean, I just kind of threw it in there cause the default shop window really doesn't seem to have much room for anything...


    Maybe the stock count should at least appear first, followed by the name


    Also, related to selling items to shops, I am having trouble figuring out how to deal with the stock count.


    Basically, if you sell an item to a shop, then presumably it's not going to be unlimited cause otherwise your players will just go "lol dupe bug" when they sell a rare item and find that the shopkeeper has a limitless supply of it now.


    My idea for this is


    1. if the good already exists, then we use the existing properties


    2. if the good doesn't exist, then add it to the shop, with limited stock
  13. Tsukihime said:
    One of the issues with the visual aspect is that long names will cover up the stock count.

    I mean, I just kind of threw it in there cause the default shop window really doesn't seem to have much room for anything...

    Maybe the stock count should at least appear first, followed by the name
    Yeah I'd prefer it to be "(# in stock) x (Item Name) (Cost)"  (without the quotes & parentheses) for now at least.

    Tsukihime said:
    Also, related to selling items to shops, I am having trouble figuring out how to deal with the stock count.

    Basically, if you sell an item to a shop, then presumably it's not going to be unlimited cause otherwise your players will just go "lol dupe bug" when they sell a rare item and find that the shopkeeper has a limitless supply of it now.

    My idea for this is

    1. if the good already exists, then we use the existing properties

    2. if the good doesn't exist, then add it to the shop, with limited stock
    Yup sounds like it would work to me... about number 2 the limited stock would be the amount you sold I would believe, correct?

    Best of luck to ya. :)
  14. It would be cool if you made a way to sell items to specific shops and once those shops get X number of items they might produce different goods.

    IE: A Healers Shop sells healing items. Now they have a low amount of stock but if you sell them different items you find they replenish stock and might stock new items based on what is sold to them.

    Lets say selling them 1x Glass Bottle and 2x Healing Herbs they might make 1 potion. Now if you also sold them something else that Healing potion might end up turning into a Mid Potion etc...
  15. wsensor said:
    It would be cool if you made a way to sell items to specific shops and once those shops get X number of items they might produce different goods.

    IE: A Healers Shop sells healing items. Now they have a low amount of stock but if you sell them different items you find they replenish stock and might stock new items based on what is sold to them.

    Lets say selling them 1x Glass Bottle and 2x Healing Herbs they might make 1 potion. Now if you also sold them something else that Healing potion might end up turning into a Mid Potion etc...
    That is a good idea... it sounds kind of like Shop Clouts by Kread-EX. :)

    Which I can't get to work properly, I think I have some incompatible scripts (might be this one) or maybe I just don't know how to use it... it's a bit odd.
  16. Hi. I'm trying to implement stock limit of goods in my shop.
    I used this script and Shop Manager script from the link in this topic. I also use Yanfly Shop Option script(https://yanflychannel.wordpress.com/rmvxa/menu-scripts/ace-shop-options/), which is shown on screenshots.
    I set @shop_stock[1] = 5 before shop processing event, but when I launch the game it doesn't show me 5 limit for 1st good in the list like on a screenshots above. And I still can buy as many goods as I want  :(
    What am I doing wrong? 

    Do I need to somehow initialise Shop Manager in script editor or event menu in the editor?
  17. I tried to get the plugin but the dropbox link is not working is there any other way i can get it?
  18. For those wanting to restock their shop, you can input this before Shop Processing.
    Code:
    ShopManager.refresh_shop("SHOP_NAME")
    Stock counts and goods can be changed in this way too.