Shop option: price formula

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

The Shop Manager now supports a new shop option called “price formula”. This allows you to set the price of a good using a formula.

The basic use case is to allow you to enter arbitrary prices (for example, an easy way to set prices over 999999).

shopOptions4

The real power of price formulas comes in when you begin using formulas. For example, you can base the price on game variables or switches to have the prices fluctuate over-time. You can base the price on your actor’s levels or stats. Perhaps you have a script that provides you with a “merchant” skill level, and you want to base the price on this skill level.

As with any other shop option, they apply to a single good for that specific shop.

Download

This is built into the Shop Manager

Usage

To specify a price formula, in your event, before the shop processing command, make the script call

price_good(good_id, formula)

Where the good_id is the ID of the shop good that you want to apply this formula to (where 1 is the first item on the list, 2 is the second item, etc), and `formula` is the formula you want to use.

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

4 Responses

  1. Disponi says:

    So I’m not really sure I understand how to base a formula off of a character’s stats. I want to base the price off the difference between each character’s max HP and MP and their current HP and MP.

    • Hime says:

      If you need to get each actor’s HP differences you would need to write a long formula. See if this works

      $game_party.members.inject(0) {|r, actor| r + (actor.mhp – actor.hp) }

  2. Mega says:

    Ah man, I thought this would let me create a shop that would sell items that would require a certain amount of a certain variable like reputation or something. This was not what I had expected but then again that's my own misunderstanding.

    • Hime says:

      The formula only supports a number as a final value and uses that to pull from your bank. How are you showing the cost based on some variable?

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