- 162
- Posts
- 7
- Years
- Seen Mar 1, 2023
Pok?mon FireRed: trainerbattle script triggers twice (Solved)
I've made a custom Champion battle for my Pok?mon FireRed romhack, included with different music for the final battle. Namely, Deoxys' battle theme.
However, for some reason the Trainerbattle script is triggered twice. Once with the Deoxys battle theme, and once with the regular battle theme. It's the same battle twice as well, so I don't think there's an issue with the rematch script.
The code I'm using is as follows:
Does anybody know what might be causing this problem?
---UPDATE---
I've managed to solve the problem. As it turns out, there's an issue with trainerbattle 0x3 that causes it to play a second time with the default music if the music is changed with special 0x3B and playsong. The way to fix this is to rework it into a different battle type. I personally used trainerbattle 0x0, which turned out to work perfectly.
I've made a custom Champion battle for my Pok?mon FireRed romhack, included with different music for the final battle. Namely, Deoxys' battle theme.
However, for some reason the Trainerbattle script is triggered twice. Once with the Deoxys battle theme, and once with the regular battle theme. It's the same battle twice as well, so I don't think there's an issue with the rematch script.
The code I'm using is as follows:
Spoiler:
'---------------
#org 0x162B76
lockall
textcolor 0x0
setflag 0x2
applymovement MOVE_PLAYER 0x88068D6
waitmovement 0x0
pause 0x14
checkflag 0x82C
if 0x0 call 0x88063C8
checkflag 0x82C
if 0x1 call 0x88063D2
special 0x187
compare LASTRESULT 0x2
if 0x1 goto 0x88063DC
setflag 0x3
setflag 0x5
playsong2 0x138
checkflag 0x844
if 0x0 call 0x88070B2
checkflag 0x844
if 0x1 call 0x88070C4
setflag 0x4
clearflag 0x5
setflag 0x4BC
setflag 0x4
msgbox 0x8806403 MSG_KEEPOPEN
playsong 0x159 0x0
showsprite 0x2
msgbox 0x880648D MSG_KEEPOPEN
closeonkeypress
applymovement MOVE_PLAYER 0x88068E2
applymovement 0x1 0x88068EE
applymovement 0x2 0x88068FA
waitmovement 0x0
pause 0x19
special2 LASTRESULT 0x162
bufferpokemon 0x0 LASTRESULT
msgbox 0x8806498 MSG_KEEPOPEN
applymovement 0x2 0x8806908
applymovement 0x1 0x880690B
waitmovement 0x0
msgbox 0x880655A MSG_KEEPOPEN
closeonkeypress
applymovement 0x2 0x880690E
waitmovement 0x0
pause 0x14
msgbox 0x8806646 MSG_KEEPOPEN
closeonkeypress
pause 0xD
applymovement 0x2 0x8806911
applymovement MOVE_PLAYER 0x880691C
waitmovement 0x0
setvar 0x4001 0x1
warp 0x1 0x50 0xFF 0x5 0xC
waitstate
releaseall
end
'---------------
#org 0x8063C8
msgbox 0x88066D4 MSG_KEEPOPEN
return
'---------------
#org 0x8063D2
msgbox 0x88067F8 MSG_KEEPOPEN
return
'---------------
#org 0x8063DC
call 0x88063FC
releaseall
end
'---------------
#org 0x8070B2
special 0x3B
playsong 0x153 0x0
trainerbattle 0x3 0x19D 0x0 0x88068A9 (PROBLEM IS HERE)
return
'---------------
#org 0x8070C4
special 0x3B
playsong 0x153 0x0
trainerbattle 0x3 0x2E2 0x0 0x88068A9
return
'---------------
#org 0x8063FC
setvar 0x4001 0x1
return
#org 0x162B76
lockall
textcolor 0x0
setflag 0x2
applymovement MOVE_PLAYER 0x88068D6
waitmovement 0x0
pause 0x14
checkflag 0x82C
if 0x0 call 0x88063C8
checkflag 0x82C
if 0x1 call 0x88063D2
special 0x187
compare LASTRESULT 0x2
if 0x1 goto 0x88063DC
setflag 0x3
setflag 0x5
playsong2 0x138
checkflag 0x844
if 0x0 call 0x88070B2
checkflag 0x844
if 0x1 call 0x88070C4
setflag 0x4
clearflag 0x5
setflag 0x4BC
setflag 0x4
msgbox 0x8806403 MSG_KEEPOPEN
playsong 0x159 0x0
showsprite 0x2
msgbox 0x880648D MSG_KEEPOPEN
closeonkeypress
applymovement MOVE_PLAYER 0x88068E2
applymovement 0x1 0x88068EE
applymovement 0x2 0x88068FA
waitmovement 0x0
pause 0x19
special2 LASTRESULT 0x162
bufferpokemon 0x0 LASTRESULT
msgbox 0x8806498 MSG_KEEPOPEN
applymovement 0x2 0x8806908
applymovement 0x1 0x880690B
waitmovement 0x0
msgbox 0x880655A MSG_KEEPOPEN
closeonkeypress
applymovement 0x2 0x880690E
waitmovement 0x0
pause 0x14
msgbox 0x8806646 MSG_KEEPOPEN
closeonkeypress
pause 0xD
applymovement 0x2 0x8806911
applymovement MOVE_PLAYER 0x880691C
waitmovement 0x0
setvar 0x4001 0x1
warp 0x1 0x50 0xFF 0x5 0xC
waitstate
releaseall
end
'---------------
#org 0x8063C8
msgbox 0x88066D4 MSG_KEEPOPEN
return
'---------------
#org 0x8063D2
msgbox 0x88067F8 MSG_KEEPOPEN
return
'---------------
#org 0x8063DC
call 0x88063FC
releaseall
end
'---------------
#org 0x8070B2
special 0x3B
playsong 0x153 0x0
trainerbattle 0x3 0x19D 0x0 0x88068A9 (PROBLEM IS HERE)
return
'---------------
#org 0x8070C4
special 0x3B
playsong 0x153 0x0
trainerbattle 0x3 0x2E2 0x0 0x88068A9
return
'---------------
#org 0x8063FC
setvar 0x4001 0x1
return
Does anybody know what might be causing this problem?
---UPDATE---
I've managed to solve the problem. As it turns out, there's an issue with trainerbattle 0x3 that causes it to play a second time with the default music if the music is changed with special 0x3B and playsong. The way to fix this is to rework it into a different battle type. I personally used trainerbattle 0x0, which turned out to work perfectly.
Last edited: