Discounts

How to add an apply discounts to items.


This feature allows you to apply discounts to all items in a store.

1
def someVendingMachine
2
advancedVendingMachine([
3
:POKEBALL, :GREATBALL,
4
:POTION, :SUPERPOTION, :HYPERPOTION,
5
:REPEL, :SUPERREPEL,
6
:REVIVE,
7
:ANTIDOTE, :PARALYZEHEAL,
8
], speech: "ProVend", discount: 26)
9
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
26 => [0, 1, 4, 9, -11]
3
}
  • 26 is the Game Variable ID.
  • The array values are used base on the variable's value (treated as an index).
Game VariableDiscount Used
00%
11%
24%
39%
4-11%
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 and Third way - Item + Game Variable(s) and Direct Value Use

You can refer to the discounts page of the poke market documentations as the setup is exactly the same.