Hidden Shop Goods

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

In RPG Maker MV, when you create shops, you start by specifying a list of items that will be sold, along with their prices.

hiddenShopGoods2

The engine then handles the rest for you so that when the player talks to the shopkeeper, the items you’ve set up will be displayed.

hiddenShopGoods3

However, what happens if you want to make it so that certain items are not shown depending on certain conditions? For example, if a weaponsmith offers different types of weapons, you might want to hide certain weapon types if no one in the party can use it. If your actor can only use swords, you might want to hide all the bows and spears.

This plugin allows you to hide shop goods quickly and easily using a simple command. Just create your event the way you normally do and hide shop goods!

Download

Plugin: download here (right-click, save as)

Installation

Download the plugin and place it in the “plugins” folder in your project’s “js” folder. Then open your Plugin Manager (F10), double-click an empty row, and select the HiddenShopGoods plugin.

Once it is in your list of plugins, turn the plugin on.

Usage

For this plugin, you will be referencing shop goods. For example, if you want to hide the second shop good, you will need to know how to number them.  Take a look at this illustration:

shopGoodsNumbering1

This is the numbering system that will be used to number the goods. You will use these numbers when hiding shop goods.

There are two ways to hide shop goods.

1. Using a plugin command

hiddenShopGoods4

Create a plugin command and write

hide_good shopGoodNumber

Where the `shopGoodNumber` is the number of the shop good that you would like to hide.

For example, if you want to hide the third shop good on the list, you can write

hide_good 3

It is up to you to create conditional branches to determine when a shop good will be hidden.

2. Using a script call

Create a script call and write

hide_good(shopGoodNumber, condition)

Where the `shopGoodNumber` is the number of the shop good that you would like to hide.

The condition is any valid javascript expression that evaluates to true or false. If the condition is true, then the shop good will be hidden.

For example, if you want to hide the fourth shop good if the party  leader’s level is less than 10, you can make the script call

hide_good(4, "$gameParty.leader().level < 10")

Don't forget the quotation marks around the condition.

Working with Multiple Shop Processing Commands

When you hide goods, these settings only apply to the first shop processing command. If you have another shop processing command afterwards, you will need to hide them separately.

My recommended way to hide goods is to try to group the hide commands right before the shop processing like this:

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

You may also like...

9 Responses

  1. Sundricat says:

    Would the following script call disable good 2 if Variable 1 is less than -1?
    hide_good(2, “$gameVariables.value(1) < -1”)

  2. Sundricat says:

    This plugin is going to save me the headaches with an increasing item variety for my Item Shops.

  3. wsensor says:

    Now all I need is a script that lets one sell items for other items.
    IE: Apothecary shop where a potion costs 2 healing herbs and only shows up if you have more than 2 herbs.
    Guess for now one could use variables and do a trade in of the items and enable selling those items in the shop.

    I really like your scripts.

    • Hime says:

      When working with custom costs, there are two parts to it

      1: setting up the custom cost. This isn’t too difficult.
      2: figuring out how to present it

      With the default shop scene, this isn’t suitable. You may need to come up with a design for it.

      Oh, and please share my plugins if you like them! You can also write tutorials showing how to use the scripts to implement certain mechanics.

Leave a Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax