Repurposing the Link Battle placeholders - pret/pokeemerald GitHub Wiki
Goal: Allow players to add up to four all-new trainers to the game through the reuse of Link Battle placeholders.
This tutorial is meant as an extension to the guide for adding a new trainer battle and will reference it at several points throughout. It will also use Porymap a lot, so download this program if it isn't already installed.
If you've read the aforementioned new trainer battle guide, you will know that it's not actually "new" per se, instead repurposing existing trainer data. This guide is technically the same, but it repurposes Trainer data that the player will never encounter in-game and thus seems like it's adding a new Trainer.
Step 1: Disabling the Cable Club
If the player can access the Cable Club, this Trainer's data may end up overwritten. Fire up Porymap for your project, then go through each interiors folder and find the Pokemon Centers' first floors. The League building also has an escalator. Add solid tiles to prevent the player from accessing the escalators.
Step 2: Figure out their Trainer data
Each good Trainer in Gen 3 has these pieces of data:
- Trainer class
- Encounter music
- Sprite
- Trainer name (must be less than 12 characters unless said limit is modified)
- Items (up to four)
- AI flags (controls their behavior)
- Party
- Intro speech
- Defeat speech
- Post-battle dialogue
You should figure out what each will be prior to going into the data to make the Trainer.
For encounter music, sprite and AI flags, you can just reference other trainers of the same class.
Parties can be one of four types: NO_ITEM_DEFAULT_MOVES
(used for most random minor trainers), ITEM_DEFAULT_MOVES
(for minor Trainers with items), NO_ITEM_CUSTOM_MOVES
(for important trainers without items) and ITEM_CUSTOM_MOVES
(for most major trainers). Choose which type you want.
Step 3: Follow steps 2-3 of the normal trainer guide
This part is identical between repurposing a normal Trainer vs. a Link Battle one.
Step 4: Change the placeholders' code
Open up and scroll down to the very bottom of src/data/trainers.h
(line 10216 down) and src/data/trainer_parties.h
(line 12406) down. There lies the data for four Trainers: TRAINER_RED
, TRAINER_LEAF
, TRAINER_BRENDAN_PLACEHOLDER
, and TRAINER_MAY_PLACEHOLDER
.
Alter the data listed here to whatever you wish, but make sure to leave alone the names of the Trainer entry and party entry (e.g. TRAINER_RED
and sParty_Red
, not the trainer name string). For this demo I altered Leaf.
Step 5: Follow steps 7-8 of the normal trainer guide
This part is also identical between repurposing a normal Trainer vs. a Link Battle one.
Step 6: Make the ROM and test it
If everything goes right, the make process will throw no errors and you'll see something similar to what I have here:
And voila! Up to four trainers seemingly created out of thin air!