-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Changing the Battle Music Depending on the Opponent
Goal: To make different trainers use different battle themes. This could be really useful for giving each Gym Leader or Elite Four member a different theme, or something.
For this tutorial, I'm going to replace Sidney of the Elite Four's battle with the Gym Leader theme. Note that the other Elite Four members will use the Elite Four battle theme.
Open src/pokemon.c.
Underneath the last #include
, add #include "constants/opponents.h"
on a new line. THIS IS IMPORTANT! DON'T FORGET TO ADD THIS OTHERWISE YOUR COMPILER WILL THROW AN ERROR!
Next, search for u16 GetBattleBGM(void)
.
In the switch (trainerClass)
statement, add a statement like this:
case TRAINER_CLASS_ELITE_FOUR:
+ if (gTrainerBattleOpponent_A == TRAINER_SIDNEY)
+ return MUS_VS_GYM_LEADER;
return MUS_VS_ELITE_FOUR;
And that's it!
Here's the statement so you can copy-and-paste it (I always found it annoying to delete the pluses when I wanted to copy-and-paste statements written in a diff format)
case TRAINER_CLASS_ELITE_FOUR:
if (gTrainerBattleOpponent_A == TRAINER_SIDNEY)
return MUS_VS_GYM_LEADER;
return MUS_VS_ELITE_FOUR;