This article 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 the defined price. These prices may be altered for an individual Mart; see below.
If an item has a defined price of 0, then it cannot be sold to a Mart. Also, important items (i.e. Key Items and HMs, and also TMs if they are set to infinite use items) 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).
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,:PARLYZHEAL, : : :AWAKENING,:BURNHEAL, : : :ICEHEAL,:ESCAPEROPE, : : :REPEL : : ]) @>
The scripts which display the Mart screen are in the script section PokemonMart.
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 a Mart will buy a given item 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 the item will be 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: $PokemonBag.pbCanStore?(PBItems::POTION) @>Change Gold: - 150 @>Text: \GHere you go! @> Script: Kernel.pbReceiveItem(PBItems::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 vary the items available to buy depending not on location but 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 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.