• 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?".
  • Forum moderator applications are now open! Click here for details.
  • 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.

Development: Fancy Knowledge #3 - Using Two Different Musics In One Event

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
#org $script
setvar 0x7030 0x297
setvar 0x7033 0xblah
trainerbattle 0x00 0x0001 $see $win
$see 1 = Battle me!
$win 1 = I lost.
message $after
$after 1 = You're tough.
boxset 6
release
end

This my script for pokescript
Is it the same for xse :)

This script won't work. Trainerbattles ONLY work if the first command in the script is the trainerbattle itself. The only exception to this is type 0x1 of trainerbattles.

That's why this method is limited. It can execute changes like regional music, or class based music if you're extremely careful and clever, but it's incapable of more complex changes.
 
13
Posts
13
Years
  • Seen Jan 31, 2014
This script won't work. Trainerbattles ONLY work if the first command in the script is the trainerbattle itself. The only exception to this is type 0x1 of trainerbattles.

That's why this method is limited. It can execute changes like regional music, or class based music if you're extremely careful and clever, but it's incapable of more complex changes.

Thanks Jambo51 for this input :D
Also, your last video on youtube was so
amazing i am really a fan but anyways so where
do i put the setvars or i should redue this script. :)

#org $script
trainerbattle 0x1 0x1 $see $win
$see 1 = Blah
$win 1 = Blah Blah.
message $after
$after 1 = Blah Blah Blah.
boxset 6
setvar 0x7030 0x297
setvar 0x7033 0xblah
release
end

Redid the script
 
Last edited:

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
No, it's not possible to use this method to change the music for each trainer. This is because that setvar won't be used until after the battle is finished. It works for rival style trainers, since they execute parts of scripts before battling, but it won't work with normal trainers for the aforementioned reason. You can set the vars in a level script if all trainers in the area need a different music (a Team Rocket takeover of a place, for example), but you can't set each trainer in an area individually.
 
13
Posts
13
Years
  • Seen Jan 31, 2014
Okay I see what you are saying and its makes perfect
sense.

So the level script

#org $script
setvar 0x7030 0x297
setvar 0x7033 0xblah
release
end

and i put this in advance map
the area i chose (like you said a bad guys area)
script it to one of the green boxes idk lol
This is confusing in a good way :)
 
13
Posts
13
Years
  • Seen Jan 31, 2014
Thanks thanethane98 :)
And also Jambo51 :)
The credit goes to both of you.

It finally work!!!!
I will keep this link in mind.
 

thanethane98

Self Proclaimed Expert
82
Posts
11
Years
  • Seen Nov 16, 2013
I'm currently looking for the offsets for this in emerald. I'll update this post when I find them.
 

sonic1

ASM is my life now...
77
Posts
15
Years
Don't bother.

Here they are:
0x086B49C0 -> Offset of channel table
0x086B49F0 -> Offset of Music Table.

And the offsets you must start overwriting is 0x2E0130 (the music_loader routine)
~Sonic1
 
Last edited:

tajaros

Hi I'm dawg
855
Posts
11
Years
Since the revival rule doesn't work around here, I'm gonna post a fancy idea I thought about earlier this morning.

Some midi from later generations have more than 10 tracks which cannot be inserted in a gen 3 rom. But I think my idea can make a Firered or another rom like ruby and emerald play midi from new generations with tracks higher than 10. First split it into two parts, midi will have 10 tracks and the other 6. This is the case if the midi you want to play in your hack has 16 tracks. So I guess you have to loop the two at the same time and play them both at the same time and tada! A music with more than 10 tracks.

Though I haven't tested this out yet but when I do I'll be sure to inform you guys if it's working or not.
 

Omega Zero

Is back...
444
Posts
14
Years
Since the revival rule doesn't work around here, I'm gonna post a fancy idea I thought about earlier this morning.

Some midi from later generations have more than 10 tracks which cannot be inserted in a gen 3 rom. But I think my idea can make a Firered or another rom like ruby and emerald play midi from new generations with tracks higher than 10. First split it into two parts, midi will have 10 tracks and the other 6. This is the case if the midi you want to play in your hack has 16 tracks. So I guess you have to loop the two at the same time and play them both at the same time and tada! A music with more than 10 tracks.

Though I haven't tested this out yet but when I do I'll be sure to inform you guys if it's working or not.

First of all this - http://www.pokecommunity.com/showpost.php?p=7559059&postcount=316
That alone gives you the ability to use up to 12 direct tracks in Pokemon firered, why would you need any more?
Yeah 16 would be nice but you can nearly always find dumbed down version of songs and most midis
have nearly duplicate tracks.

Second, how would you go about playing two songs at the same time?
 

tajaros

Hi I'm dawg
855
Posts
11
Years
First of all this - http://www.pokecommunity.com/showpost.php?p=7559059&postcount=316
That alone gives you the ability to use up to 12 direct tracks in Pokemon firered, why would you need any more?
Yeah 16 would be nice but you can nearly always find dumbed down version of songs and most midis
have nearly duplicate tracks.

Second, how would you go about playing two songs at the same time?

Hmm... It seems I misunderstood what this thread really for I have not really read the OP fully.

Haha, I thought this was for having two songs play at the same time haha... xD

Sorry for that disregard my previous post.
 
1,323
Posts
16
Years
  • Seen Dec 9, 2023
First of all this - http://www.pokecommunity.com/showpost.php?p=7559059&postcount=316
That alone gives you the ability to use up to 12 direct tracks in Pokemon firered, why would you need any more?
Nonono you don't understand. What you linked to extends the Direct Sound limit from 5 to 12. In the GBA games, only 5 Direct Sound instruments can be playing at once. This allows 12. This does NOT allow a Sappy song to have 12 instruments, the limit is still 10. All it does it make it so that up to 12 Direct Sound instruments can be playing at once, which is possible even with 10 tracks, since you can have a single track play more than one note at the same time. In other words, in the GBA games unmodified, you can only have 5 Direct Sound instruments playing at once, and 5 "Game Boy" instruments playing at once, but you must limit it to 10 Sappy tracks total. With this extension, you can now have up to 12 Direct Sound instruments playing at once, and 5 "Game Boy" instruments playing at once, but you're still limited to 10 Sappy tracks.

What tajaros was talking about is if its possible to extend the maximum amount of Sappy tracks to 16. The thing you linked to just makes it so that you can have 12 Direct Sound notes playing at once, but the track limit is still 10.
 

tajaros

Hi I'm dawg
855
Posts
11
Years
Nonono you don't understand. What you linked to extends the Direct Sound limit from 5 to 12. In the GBA games, only 5 Direct Sound instruments can be playing at once. This allows 12. This does NOT allow a Sappy song to have 12 instruments, the limit is still 10. All it does it make it so that up to 12 Direct Sound instruments can be playing at once, which is possible even with 10 tracks, since you can have a single track play more than one note at the same time. In other words, in the GBA games unmodified, you can only have 5 Direct Sound instruments playing at once, and 5 "Game Boy" instruments playing at once, but you must limit it to 10 Sappy tracks total. With this extension, you can now have up to 12 Direct Sound instruments playing at once, and 5 "Game Boy" instruments playing at once, but you're still limited to 10 Sappy tracks.

What tajaros was talking about is if its possible to extend the maximum amount of Sappy tracks to 16. The thing you linked to just makes it so that you can have 12 Direct Sound notes playing at once, but the track limit is still 10.

Actually that's not what I am talking about. I should have explained further for example we have a 20 tracked Midi and you want it to be played in your game let's say we split the Midi to 10 each and just have the two songs play at the same time so it will look like you have the Midi playing as one.

Though if it's possible to make two music play at the same time.
 
1,323
Posts
16
Years
  • Seen Dec 9, 2023
Actually that's not what I am talking about. I should have explained further for example we have a 20 tracked Midi and you want it to be played in your game let's say we split the Midi to 10 each and just have the two songs play at the same time so it will look like you have the Midi playing as one.

Though if it's possible to make two music play at the same time.
I knew what you're talking about, but, Omega Zero thought the Direct Sound extension lets you have up to 12 tracks playing, which is false, the Direct Sound extension just lets you have 12 Direct Sound notes playing at any given time.
 

Shiny Quagsire

I'm Still Alive, Elsewhere
697
Posts
14
Years
Actually that's not what I am talking about. I should have explained further for example we have a 20 tracked Midi and you want it to be played in your game let's say we split the Midi to 10 each and just have the two songs play at the same time so it will look like you have the Midi playing as one.

Though if it's possible to make two music play at the same time.

I doubt that it's possible to play two songs at the same time, since even with sounds, it usually has to stop one track to play the sound depending on how many tracks the song is. Either that or there are a few tracks (probably 2-6) reserved specifically for sound effects.
 

tajaros

Hi I'm dawg
855
Posts
11
Years
I doubt that it's possible to play two songs at the same time, since even with sounds, it usually has to stop one track to play the sound depending on how many tracks the song is. Either that or there are a few tracks (probably 2-6) reserved specifically for sound effects.

That would be cool if we can do that! We can play BW music properly haha... xD
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Yes, sounds and fanfares have separate memory, so that the main music pauses and resumes. No, you cannot abuse this fact to extend the number of tracks available in a song since it is a physical limit of the M4AA engine inside the given game. You'd have to rewrite the engine and vastly optimise it to be able to do what you want. Or did you think we didn't try numbers higher than 0xC in the limiter? Lol

ETA: the Sfx don't generally stop the music from playing, whereas fanfares do. You could exploit this behaviour to have "indefinite" fanfares, which would, in effect, emulate BW's behaviour with regard to certain music.

2 issues with this being, the game doesn't support indefinite fanfares (requires a length in music ticks (I think) to operate), and the physical coding to have this happen would not be easy.
 
Last edited:
8
Posts
12
Years
  • Seen Apr 17, 2014
Don't bother.

Here they are:
0x086B49C0 -> Offset of channel table
0x086B49F0 -> Offset of Music Table.

And the offsets you must start overwriting is 0x2E0130 (the music_loader routine)
~Sonic1

I've tried inserting using these offsets, but all I get is a buzzing sound.
(with black and white flashing screen)
Haven't been able to even load the rom :/

Any help will be seriously seriously appreciated, as I've been looking at this for a long, long time.


EDIT:

As a matter of fact,
I've tried to "get the method correct" first for Firered.

I've copied everything, even the original addresses the OP used.
End result:

It's loads the intro, and hangs before "Press Start" is displayed.
 
Last edited:
Back
Top