Discounts

How to add an apply discounts to items.


This feature allows you to apply discounts to all items in a store.
Currently, there's no way to exclude specific items - but that migiht change in the future.

1
def pbSomeMart
2
pbPokemonMart([
3
:POKEBALL, :GREATBALL, :ULTRABALL,
4
:POTION, :SUPERPOTION, :HYPERPOTION, :MAXPOTION,
5
:FULLRESTORE, :REVIVE,
6
:ANTIDOTE, :PARALYZEHEAL, :AWAKENING, :BURNHEAL, :ICEHEAL,
7
:FULLHEAL,
8
:REPEL, :SUPERREPEL, :MAXREPEL,
9
:ESCAPEROPE
10
], useCat: true, discount: 27)
11
end

To enable discounts, add discount: followed by a Game Variable ID.


You can set up discounts in three ways:


First way - Game Variable + Array

Use a Game Variable and assign it an array of percentage values (e.g., 4 = 4% discount).

1
Discounts = {
2
27 => [0, 1, 4, 7, 11]
3
}
  • 27 is the Game Variable ID.
  • The array values are used base on the variable's value (treated as an index).
Game VariableDiscount Used
00%
1-1%
2-4%
3-7%
4-11%
Image 0 not found
0% Discount
Image 1 not found
1% Discount
Image 2 not found
4% Discount
Image 3 not found
7% Discount
Image 4 not found
11% Discount
Hint

Each value in the array is accessed by index. If the variable is set too high and the index doesn't exist, you'll be warned in-game.


Second way - Item + Game Variable(s)

You can combine an item requirement with one or more Game Variables.

1
Discounts = {
2
:COUPONA => {
3
26 => [0, 3, 6, 8, 10],
4
28 => [0, -2, -5]
5
},
6
}
  • Player must have the :COUPONA item.
  • Each key (26, 28) is a Game Variable ID.
  • Negative values are allowed - they result is overcharges.

Example for Variable 26:

Game VariableDiscount Used
00%
1-3%
2-6%
3-8%
4-10%
Image 0 not found
0% Discount
Image 1 not found
3% Discount
Image 2 not found
6% Discount
Image 3 not found
8% Discount
Image 4 not found
10% Discount

Example for Variable 28 (Overcharges):

Game VariableOverchage Used
00%
1+2%
2+5%
Image 0 not found
0% Overcharge
Image 1 not found
2% Overcharge
Image 2 not found
5% Overcharge

You can combine discount and overcharge values - just be careful not to duplicate the same Game Variable ID under the same item, or you may get unpredictable results.


Example - Scaling Discounts and Overcharges

1
Discounts = {
2
29 => [10, 8, 6, 4, 2, 0, -2, -4, -6, -8, -10, -12]
3
}

Or with an item requirement:

1
Discounts = {
2
:COUPONB => {
3
29 => [10, 8, 6, 4, 2, 0, -2, -4, -6, -8, -10, -12]
4
}
5
}

This lets you gradually reduce a player's discount the more they do something (e.g. blacking out), and eventually start overcharging.


  • Player must have the :COUPONB item.
  • Each key (29) is a Game Variable ID.

Game VariableDiscount/Overcharge Used
0-10%
1-8%
2-6%
3-4%
4-2%
50%
6+2%
7+4%
8+6%
9+8%
10+10%
11+12%
Image 0 not found
10% Discount
Image 1 not found
8% Discount
Image 2 not found
6% Discount
Image 3 not found
4% Discount
Image 4 not found
2% Discount


Third way - Direct Value Use

This method skips the array setup and uses the Game Variable's actual value as the discount or overchage.


So discount: 30 will directly pull the value of Game Variable 30.


  • 10 = 10% discount
  • -5 = 5% overcharge
  • 0 = no change

This gives you more flexibility and lets you reuse the same variable across different Mart events.