This page describes how to create a Poké Mart. More generally, it describes buying and selling items.
Buying and selling
When an item is defined, one of the pieces of information is the price of the item. This is the price the player will need to pay in order to buy that item from a Mart. When the player sells an item to the Mart, they will sell it for half of this price (or its selling price if one is defined for the item).
If an item has a defined price of 0, then it cannot be sold to a Mart. Also, important items (i.e. Key Items, TMs and HMs) cannot be sold to a Mart, regardless of their defined price. An important item can still be bought from a Mart, though; in which case, only one of it can be bought at once, and it will disappear from the list of available items if the player already owns it (including immediately after buying it).
The purchase and selling prices may be altered for an individual Mart; see below.
If the player buys 10 or more of any kind of Poké Ball in a single transaction, they will be given a free Premier Ball. The setting
MORE_BONUS_PREMIER_BALLS determines whether the player gets just one free Premier Ball per transaction (specifically buying regular Poké Balls), or one for each 10 Poké Balls (of any kind) bought in a transition.
Creating a Mart
To create an NPC that will buy/sell items in a Poké Mart, put the script
pbPokemonMart() in an event as follows:
@>Script: pbPokemonMart([ : : :POKEBALL, :GREATBALL, : : :POTION, :SUPERPOTION, : : :ANTIDOTE, :PARALYZEHEAL, : : :AWAKENING, :BURNHEAL, :ICEHEAL, : : :ESCAPEROPE, : : :REPEL : : ]) @>
The scripts which display the Mart screen are in the script section UI_PokeMart.
Changing the cost of an item in a Mart
It is possible to change the price of an item in a particular Poké Mart, or change how much you can sell a given item to that Mart for (or both). There is no limit to how many item prices can be modified this way.
Before the script
pbPokemonMart() is run, you can use one of the following scripts:
setPrice(:POTION, 250) setSellPrice(:POTION, 200) setPrice(:POTION, 250, 200)
The first script will set the buying price of Potions from the Mart to $250, rather than the default $300. The selling price (i.e. how much a player will get by offloading a Potion onto the Mart) is half of this value, i.e. $125 rather than the default $150.
The second script will set the selling price of Potions to $200, rather than the default $150. The buying price of Potions (i.e. how much the player has to pay to get a Potion) will still be the default $300, therefore the selling price is not necessarily half of the buying price.
The third script is a combination of the first two. It sets both the buying and selling price of Potions.
You can use as many of these scripts as you like. You do not need to put them in the same Script event command as
pbPokemonMart(). Their effects are stored in a temporary variable, and will affect only the next Mart that is accessed, so it makes sense to simply put them immediately before the Mart is accessed. It is entirely possible to end up using a whole lot of these scripts, depending on how much you want to micromanage your game's economy.
Creating a vendor NPC
A vendor is an NPC that sells items, but is not a Mart (i.e. the player cannot sell items to them, and the shop screen is not displayed). This kind of NPC may sell exotic/rare items, or items at a reduced price.
The vendor NPC's event will contain messages and choice branches that ask whether the player wants to buy their item. The actual transaction (i.e. taking the money, giving the item) can be inserted easily into the event by including the following comment:
The number is the price that the item is being sold for. When the game is compiled, this comment is turned into the following set of event commands:
@>Conditional Branch: Gold 150 or more @>Conditional Branch: Script: $bag.can_add?(:POTION) @>Change Gold: - 150 @>Text: \GHere you go! @> Script: pbReceiveItem(:POTION) @> : Else @>Text: \GYou have no room left in the Bag. @> : Branch End @> : Else @>Text: \GYou don't have enough money. @> : Branch End @>
If the price of the item is 0, then the outer Conditional Branch and the references to the player's gold are omitted. However, in this case the NPC would be simply giving the player an item, and this would be a long-winded way of doing so. However, it may still be a useful shortcut to use.
Note that the commands will ONLY perform the actual transaction. You will still need to include text and choices that let the player choose whether they want to buy the item in the first place.
- The more recent Pokémon games (and the examples that come with Essentials) vary the items available to buy depending on the number of Gym Badges the player has. Simply use Conditional Branches which check this number, and call a different version of
pbPokemonMartin each case (with different stocks).
- You could also give each location's Poké Mart a special item to sell that can't be bought from any other Poké Mart.
- You could have some Marts which covet different items depending on various factors, e.g. a Mart in a desert will pay more for drinks, or a Mart discounts certain items as a limited time promotion.