From bcabc5f7ca09c838137443354b3a0d634fee2476 Mon Sep 17 00:00:00 2001 From: smithk200 <116670266+smithk200@users.noreply.github.com> Date: Thu, 9 Nov 2023 15:33:51 -0600 Subject: [PATCH] Created Changing the Battle Music Depending on the Opponent (markdown) --- ...-Battle-Music-Depending-on-the-Opponent.md | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Changing-the-Battle-Music-Depending-on-the-Opponent.md diff --git a/Changing-the-Battle-Music-Depending-on-the-Opponent.md b/Changing-the-Battle-Music-Depending-on-the-Opponent.md new file mode 100644 index 0000000..84f273c --- /dev/null +++ b/Changing-the-Battle-Music-Depending-on-the-Opponent.md @@ -0,0 +1,26 @@ +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. + +Search for `u16 GetBattleBGM(void)`. + +In the `switch (trainerClass)` statement, add a statement like this: +```diff + case TRAINER_CLASS_ELITE_FOUR: ++ if (gTrainerBattleOpponent_A == TRAINER_SIDNEY) ++ return MUS_VS_GYM_LEADER; + return MUS_VS_ELITE_FOUR; +``` +And that's it! + +## Copy and paste the code (optional) + +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; +``` \ No newline at end of file