Pokémon Gym

This page describes how to set up a **Pokémon Gym**. It also describes Gym Badges, and touches upon the Elite Four.

## Pokémon Gyms

There is nothing inherently special about a Pokémon Gym. It is filled with trainers, one of whom is a Gym Leader who rewards the player with a Gym Badge and a TM once they are defeated.

The trainers, including the Gym Leader, are set up just like any other trainer in the game. The one difference is that, after the Gym Leader is defeated, no other trainers in the Gym should challenge the player to a battle, even if they hadn't been defeated beforehand. To arrange this, do the following:

1. When the Gym Leader is defeated, turn a Game Switch ON. This Switch indicates that the player has defeated that Gym Leader.
2. Include a third page in each trainer's event, which depends on this Game Switch being ON, and which contains text to the effect of: "You've defeated the Gym Leader!"

You can also use this Game Switch in other events, e.g. have the Gym Guy at the entrance say something different, change the contents of a sign, make an obstacle disappear, etc.

There are some predefined Game Switches in Essentials intended for this use.

## Gym Badges

When the player defeats a Gym Leader, they will reward the player with a Gym Badge. Badges are stored in the array `$player.badges`, where each entry is either TRUE or FALSE depending on whether that Badge is owned or not. Note that it starts at zero, so `$player.badges[0]` is the first Badge, `$player.badges[1]` is the second Badge and so on.

To give the player a Badge, simply set the appropriate entry in this array to TRUE, e.g.

```
$player.badges[2] = true

```

You can have as many Badges as you like. The script `$player.badge_count` will return the number of Badges the player has.

The Badges are displayed in the Trainer card, which by default assumes that each region has 8 Gym Badges and will display the (owned) Badges corresponding to the region the player is currently in.

### What Gym Badges do

Gym Badges have a few effects in Essentials:

* Pokémon at level 10 or lower always obey.
* 1 Badge - All Pokémon at level 20 or lower always obey.
* 2 Badges - All Pokémon at level 30 or lower always obey.
* 3 Badges - All Pokémon at level 40 or lower always obey.
* 4 Badges - All Pokémon at level 50 or lower always obey.
* 5 Badges - All Pokémon at level 60 or lower always obey.
* 6 Badges - All Pokémon at level 70 or lower always obey.
* 7 Badges - All Pokémon at level 80 or lower always obey.
* 8 or more Badges - All Pokémon always obey.

 Power up stats
* 1 or more Badges - Attack is multiplied by 1.1.
* 3 or more Badges - Speed is multiplied by 1.1.
* 5 or more Badges - Defense is multiplied by 1.1.
* 7 or more Badges - Special Attack is multiplied by 1.1.
* 7 or more Badges - Special Defense is multiplied by 1.1.

 Money lost when losing a battle
* 0 Badges - 8 times the highest Pokémon level in the player's party.
* 1 Badge - 16 times the highest Pokémon level in the player's party.
* 2 Badges - 24 times the highest Pokémon level in the player's party.
* 3 Badges - 36 times the highest Pokémon level in the player's party.
* 4 Badges - 48 times the highest Pokémon level in the player's party.
* 5 Badges - 64 times the highest Pokémon level in the player's party.
* 6 Badges - 80 times the highest Pokémon level in the player's party.
* 7 Badges - 100 times the highest Pokémon level in the player's party.
* 8 or more Badges - 120 times the highest Pokémon level in the player's party.

 Allows HMs to be used out of battle

Badges have a few other effects in the main games, but those effects haven't been included in Essentials.

## Tips

* Make the Gyms creative. Most Gyms in the main games have puzzles to solve, and while not all of them can be easily replicated in RPG Maker XP, you can still come up with a few different kinds of puzzle (and many variants of each one).
* Gym Leaders will have well-trained Pokémon, so why not give all their Pokémon high IVs and/or good natures or abilities? They typically also have custom movesets, which usually contain the move taught by the TM they hand out.
* You will likely want to change the order in which HMs are unlocked for use outside of battle, based on the order of progression in your game. Edit the relevant settings in the script section **Settings** to do so.
	+ You can have all HM moves usable outside of battle immediately, by just making them depend on the player having at least 0 badges.