• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Controlling Trainer Battle Music (No ASM)

Crocky

SuperScarlet!
97
Posts
15
Years
  • Seen Jul 23, 2020
Hey All,
Today I stumbled across this thread, which made me find out you can change the wild Pokémon music without ASM. I thought, hey, if you could do this with wild Pokémon, why not trainers?

Introducing the script that makes it all happen, using XSE:

Spoiler:


If you instert this into a FireRed game using XSE, you will find yourself in a battle with an unnamed cooltrainer who uses a level 5 Ekans, with the great Hoenn trainer battle music instead of the default Kanto trainer battle music. This is because the Hoenn Trainer battle music is still in the FRLG Game, and so are the leftover RS trainer sprites. (You can easily change the trainer you would like to battle, and the music to any music in the Fire Red game)

The way this script works is that it makes the trainer you are interacting with face you, then check to see if you already battled said trainer, because without this you can just re battle the trainer whenever you talk to them. If you didn't, it plays the male trainer encounter (this also can easily be changed) theme, and proceeds to enter the battle. It then plays your selected music for the battle and ends normally.

Currently, this script doesn't work when you give the trainer any amount of view radius above 0. If any of you know a way to stop the trainer battle from looping without the checktrainerflag, I believe it will work with view radius.
 
1,771
Posts
15
Years
This had been left unapproved for a number of days since I wasn't too sure of its validity as a tutorial (it works, but it could do with being developed further). As such, I've approved it in the hopes that it CAN be developed further, and have its kinks worked out.

Furthermore, the following thread is generally very similar, something I only realised upon approving this thread:
http://www.pokecommunity.com/showthread.php?t=305091
 

xGal

Mhm
241
Posts
12
Years
Great :)

Nice found!

Anyway, I think it's better you'll just show the command and not the script itself :)

What I meant is to just show the:
Code:
special 0x03B
 playsong 0x10A 0x0
 trainerbattle 0x0 0x9 0x0 @before @after
and then, an example of it in a script :).

I was looking for this a lot of time, thanks!

EDIT:

Crocky said:
If any of you know a way to stop the trainer battle from looping without the checktrainerflag, I believe it will work with view radius

Code:
#dynamic 0x800000
 
#org #start
special 0x3B
playsong 0x10A 0x0
trainerbattle 0x0 0x9 0x0 @before @after
msgbox @1 [B][URL="file://\\This"]\\This[/URL] is the message will play after you defeat the trainer. No checktrainerflag is needed.[/B]
release
end
 
#org @before
= Let me battle you
 
#org @after
= I battled you!
 
#org @1
= No more battles again.

Also, I have been talking a little with Jambo51 about it and he said it's very limited - it only works with trainers who don't have encounters.

But after all, it can help a little for guys with poor hex editing knowledge ;).
 
Last edited:

Wobbu

bunger bunger bunger bunger
2,794
Posts
12
Years
ALL OF THIS IS FOR EMERALD

Well, I don't know if this helps, but here's something.

Code:
'---------------
#org 0xEC4617
special 0x139
playsong 0x1FF 0x0
trainerbattle 0x0 0xCE 0x1 0x8EC4637 0x8EC464C
msgbox 0x8EC4656 0x6 '"Did it work?"
release
end


'---------
' Strings
'---------
#org 0xEC4637
= This is a test yo!

#org 0xEC464C
= I lost.

#org 0xEC4656
= Did it work?

If you talk to the trainer, the encounter music will play. If you press A quick enough, then you'll proceed to the battle with the normal battle music. If you don't press A, then you'll battle a ? Pokémon while the encounter music is still playing. After you run or defeat it (catching it will freeze the game), the battle will end like normal. Then you'll be paused in the overworld with the normal map music playing, and then the normal trainer battle will start. After you talk to the trainer again, Gary's champ music will play (playsong 0x1FF 0x0) and the trainer's last used Pokémon will battle you as a wild Pokémon with zero HP.
 

xGal

Mhm
241
Posts
12
Years
ALL OF THIS IS FOR EMERALD

Well, I don't know if this helps, but here's something.

Code:
'---------------
#org 0xEC4617
special 0x139
playsong 0x1FF 0x0
trainerbattle 0x0 0xCE 0x1 0x8EC4637 0x8EC464C
msgbox 0x8EC4656 0x6 '"Did it work?"
release
end
 
 
'---------
' Strings
'---------
#org 0xEC4637
= This is a test yo!
 
#org 0xEC464C
= I lost.
 
#org 0xEC4656
= Did it work?

If you talk to the trainer, the encounter music will play. If you press A quick enough, then you'll proceed to the battle with the normal battle music. If you don't press A, then you'll battle a ? Pokémon while the encounter music is still playing. After you run or defeat it (catching it will freeze the game), the battle will end like normal. Then you'll be paused in the overworld with the normal map music playing, and then the normal trainer battle will start. After you talk to the trainer again, Gary's champ music will play (playsong 0x1FF 0x0) and the trainer's last used Pokémon will battle you as a wild Pokémon with zero HP.

Nice! I will try to improve it on my free time!
 

AtecainCorp.

Rejishan awake...
1,377
Posts
15
Years
This code need small remade bro. When I test it in game. It was been script of never ending Battle. I figured way how to use your script <mEYBE ONly Ruby make that failure. But I fix it> This is small fix of this script. But Important to CHECKFLAG section.

#dynamic 0x800000
#org @start
lock
faceplayer
checkflag 0x9
if 0x1 goto @alreadybattled
playsong 0x11D 0x0
msgbox @before 0x6
special 0x03B
playsong 0x10A 0x0
trainerbattle 0x0 0x9 0x0 @before @after
setflag 0x9
release
end

#org @alreadybattled
msgbox @beaten 0x6
release
end

#org @before
= Go, all my fight!

#org @after
= Tch!

#org @beaten
= Your good at this!


And done... It now read flag changes and give you text after Trainer Battle.

We allways set OW People event in 0000 flag. Rom change our flag to that which we needed. And make it new flag known as 1F00 <In my example> Thank you for this script. I use it in my Pokemon Ruby Renev hack. I need post there Team Rocket and Johto Trainer Battle themes. Now with your script i know what to do. Only one task which I must figured is How change by script WIld Battle Theme.

By This limiting I've seen that is Ideal Script for GYM LEADERS and for E4 and CHAMPIONS. By This you can inster separate E4 theme in FRLG.
 
Last edited:

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
Flag 0x9 is not safe in any game we hack here.
 
457
Posts
10
Years
  • Age 28
  • Seen Apr 9, 2024
Can you manipulate victory themes?
I'm doing a FireRed hack and I want to have the villain team to have its own victory theme when beaten, same for the elite four would be the gym leader's victory, and the champion would have its own victory theme. Can you help me out? This is one of my dilemmas. :/
 
7
Posts
7
Years
  • Age 28
  • Seen Apr 17, 2024
Hello guys!
I just figured out how to engage a trainer battle with custom music on Fire Red!
Here:
#dynamic 0x80000 --That's what I use..

#org @trainer
lock
faceplayer
checkflag "Put yourflag here"
if 0x1 call @done -Checks if the trainer is beaten, If yes then the script will call @done
msgbox @intro 0x6 -Intro here!!!
playsong "song to play in battle" 0x0
special 0x3B -Required for trainer battle!!
trainerbattle 0x1 "trainer to battle" 0x0 @intro @defeat @after -0x1 for no endless
call @after -It worked for me after i called the subscript @after here

#org @after
-Reminder:
You can continue making a script here, but you can also
just set the flag and end the script by releasing the NPC
setflag "the flag you set at checkflag"
release
end

#org @done
msgbox @battled 0x6
release
end

--Strings Now

#org @intro
= Yo! Let's battle

#org @defeat
= Dammit!

#org @battled
= I'm wasted!

Oh yeah.. Can somebody help me on engaging a wild battle with custom music on FR/LG?
 
Last edited:
56
Posts
7
Years
  • Age 29
  • Seen Aug 31, 2020
I was just wondering if this would work, but I hadn't tried it yet. Awesome!
 
4
Posts
8
Years
  • Age 29
  • Seen Jun 27, 2019
Do you know a way to make this work for a trainer that you fight when they see you instead of you activating them?
 
Back
Top