This script enhances the game shop, providing useful options that allow you to customize each shop good individually.
This script provides functionality for remembering a shop’s “state”. Each shop is uniquely identified by a shop ID, and if you visit the same shop repeatedly, you should see the same settings as when you left. For example, if a shop holds 10 potions, and you bought 5, then you can expect that the next time you visit the shop, it will only have 5 potions remaining.
The Shop Manager provides the following functions for setting up shops
- Hide conditions – hide goods from being displayed
- Disable conditions – prevent goods from being selected
- Price formulas – use a formula to set the price of an item
Additional shop-related functionality can be easily added using the Shop API.
Note that one event can only have one shop, because all of the information is tied to that event.
Script: download here
The shop manager allows you to assign an ID to your shop. This is the name that you will use to refer to a specific shop throughout the game.
The ID can be anything you want, but you may want to use something that is easy to remember and organize.
To access a specific shop, you first start by making a script call
Followed by the shop processing command. Here is an example of how it might look:
If you ever need to refer to a specific shop in a different event, you can simply use the same shop ID.
This script provides a number of built-in shop options for you to customize your shop goods for each shop.
Each shop option requires you to pass in a “good ID”, which is basically the order that the items appear in your “shop processing” list. The shop good at the top of the list has a good ID of 1, the next has a good ID of 2, and so on.
All shop options must be set before the shop processing command.
The following variables are available for all formulas:
v - game variables s - game switches p - game party
You can prevent a shop good from appear in the shop list by using a “hide formula”. To set a hide formula for a particular good, use the script call
Disabling a shop good means the player can’t buy it, but it will still appear on the list. The default windows simply change the color of the good to indicate that it can’t be selected. You can disable a shop good using a “disable formula”, and can be set using the script call
Each shop good can have a custom price by defining a “price formula”. The price is evaluated when the player visits the shop, so it is dynamically generated based on the current game state. To set a price formula, use the script call
Adding shop goods
You can add shop goods programmatically using script calls. To add a shop good, use
add_shop_good(good_id, item_type, item_id) add_shop_good(good_id, item_type, item_id, price)
good_id is the ID that will be assigned to this shop good, the
item_type is one of :item, :weapon, or :armor, and the
item_id is the ID of the item. If the price is not specified, then the default price is used. Note that price formulas are not available in this script call unfortunately.
Here are some specifications that I have written.
Have a look through each class to see what is available for use.
If you have any suggestions that will improve the base script (ie: this),
I will consider adding them.
This module serves are the interface for all shop-related queries. It handles
how shops are stored for you so that it is easy to properly obtain a reference
to a shop.
This script treats a shop as a concrete object. A shop is created the first
time it is accessed, and will be stored with the game for the remainder of
A very basic shop is provided, which manages what items are available for sale.
All shops are stored in a global Game_Shops hash in $game_shops
This script assumes shops are only called through events or common events.
Troop events are not supported.
A shop, by default, is identified by a map ID and an event ID.
Shops that are called via common events will have a map ID of 0.
If you specify a custom shop ID using the
get_shop call, then that will be the shop ID that is used instead of the map ID and event ID.
In order to determine whether a normal event or a common event called the
shop, the “depth” of the interpreter is used.
When depth = 0, then it is a normal event
When depth > 0, then it is a common event
The shop processing should be handled appropriately depending on the depth
This script assumes that an event is triggered through “normal” interaction;
that is, you can only interact with events within a map. Any events that should
be treated as the same event should be done as a common event call.
Rather than storing all goods as a simple array of values, this script
provides a Game_ShopGood class. You can use this to store any additional
information that you want.
All shop related scenes and windows MUST provide support for handling shop
goods. While backwards compatibility is provided for the default scripts,
additional methods have been defined to allow you to retrieve the currently
selected shop good.
Since there isn’t actually a way to setup individual shop goods, external
approaches must be used. There is not much specification here yet, so it
is up to you how you wish to populate your ShopGood objects.
I have provided the following method in Game_Interpreter that you can
use for setting up shop goods
def setup_good(good, id) end
It receives a ShopGood object as its first parameter, and the good ID as its second.
More information on shop options can be found here