Shop Stock

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
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.



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



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 shop


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...



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



Notes

Visually, it is unappealing. You will likely have to customize how it looks to suit your game.
 
Last edited by a moderator:

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
520
First Language
Javascript
Primarily Uses
RMMZ
Cool script, I like this idea. :) How would I add the items I sell back to the shop to the amount available?
 
Last edited by a moderator:

mary674

Veteran
Veteran
Joined
Jul 6, 2012
Messages
42
Reaction score
2
First Language
French
Primarily Uses
Very nice, I will be using this. Thank you.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
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.
 
Last edited by a moderator:

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
520
First Language
Javascript
Primarily Uses
RMMZ
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?
 

Ksi

~RTP Princess~
Restaff
Joined
Mar 13, 2012
Messages
2,083
Reaction score
1,674
First Language
English
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).
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
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.

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.
 
Last edited by a moderator:

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
520
First Language
Javascript
Primarily Uses
RMMZ
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.

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
 
Last edited by a moderator:

mary674

Veteran
Veteran
Joined
Jul 6, 2012
Messages
42
Reaction score
2
First Language
French
Primarily Uses
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?)
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
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.
 
Last edited by a moderator:

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
520
First Language
Javascript
Primarily Uses
RMMZ
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
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
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
 
Last edited by a moderator:

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
520
First Language
Javascript
Primarily Uses
RMMZ
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.

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. :)
 
Last edited by a moderator:

wsensor

Villager
Member
Joined
May 2, 2012
Messages
20
Reaction score
5
First Language
English
Primarily Uses
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...
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
520
First Language
Javascript
Primarily Uses
RMMZ
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.
 
Last edited by a moderator:

Kasutajanimi

Warper
Member
Joined
Jul 19, 2015
Messages
1
Reaction score
0
First Language
Russian
Primarily Uses
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?
 

Sakurahan01

Sakurahan
Veteran
Joined
May 4, 2016
Messages
31
Reaction score
5
First Language
English
Primarily Uses
I tried to get the plugin but the dropbox link is not working is there any other way i can get it?
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,085
Members
137,583
Latest member
write2dgray
Top