Skip to content

Elite Four Members play Gym Leader Battle Theme

YakiNeen edited this page Apr 28, 2023 · 6 revisions

This code made the Elite Four members (Lorelei, Bruno, Agatha and Lance) play the MUSIC_GYM_LEADER_BATTLE instead MUSIC_TRAINER_BATTLE.

PlayBattleMusic.notGymLeaderBattle in audio\play_battle_music.asm

PlayBattleMusic::
...
.notGymLeaderBattle
	ld a, [wCurOpponent]
	cp OPP_ID_OFFSET
	jr c, .wildBattle
+	cp OPP_LORELEI
+	jr z, .Elite4Battle
+	cp OPP_BRUNO
+	jr z, .Elite4Battle
+	cp OPP_AGATHA
+	jr z, .Elite4Battle
+	cp OPP_LANCE
+	jr z, .Elite4Battle
	cp OPP_RIVAL3
-	jr z, .finalBattle
-	cp OPP_LANCE
-	jr nz, .normalTrainerBattle
-	ld a, MUSIC_GYM_LEADER_BATTLE ; lance also plays gym leader theme
+	jr nz, .normalTrainerBattle
+	ld a, MUSIC_FINAL_BATTLE
	jr .playSong
+.Elite4Battle
+	ld a, MUSIC_GYM_LEADER_BATTLE
+	jr .playSong
.normalTrainerBattle
        ld a, MUSIC_TRAINER_BATTLE
        jp PlayMusic
-.finalBattle
-	ld a, MUSIC_FINAL_BATTLE
-	jr .playSong
.wildBattle
	ld a, MUSIC_WILD_BATTLE
.playSong
	jp PlayMusic

For edit Defeated Music:

TrainerBattleVictory.gymleader in engine\battle\core.asm

...
TrainerBattleVictory:
	call EndLowHealthAlarm
	ld b, MUSIC_DEFEATED_GYM_LEADER
	ld a, [wGymLeaderNo]
	and a
	jr nz, .gymleader
	ld b, MUSIC_DEFEATED_TRAINER
.gymleader
	ld a, [wTrainerClass]
	cp RIVAL3 ; final battle against rival
-	jr nz, .notrival
+	jr z, .special1998
+	cp LORELEI
+	jr z, .special1998
+	cp BRUNO
+	jr z, .special1998
+	cp AGATHA
+	jr z, .special1998
+	cp LANCE
+	jr nz, .notrival
+.special1998
	ld b, MUSIC_DEFEATED_GYM_LEADER
+	cp RIVAL3 ; final battle against rival
+	jr nz, .notrival
	ld hl, wFlags_D733
	set 1, [hl]
.notrival
	ld a, [wLinkState]
	cp LINK_STATE_BATTLING
	ld a, b
...
Clone this wiki locally