• 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: Wild double / triple battles

jabberjabber8

../\..
213
Posts
13
Years
I don't own a copy of black or white or even a DS for the matter but a friend told me there were double battles with 2 wild Pokemon every so often.
Now i was wondering if it were possible to implement that in a fire red hack. Reading less specific threads on this topic I think it is possible to create double battles but not triples...

Sorry if this has been asked before.
 

marcc5m

what
1,116
Posts
13
Years
I don't own a copy of black or white or even a DS for the matter but a friend told me there were double battles with 2 wild Pokemon every so often.
Now i was wondering if it were possible to implement that in a fire red, Ruby or Emerald hack. Reading less specific threads on this topic I think it is possible to create double battles but not triples...

Sorry if this has been asked before.


Fixed it for you.
But yeah, it should probably be possible. Difficult, but possible. I'll leave it for the experts (Knizz, Colcolstyles, Darthatron, Jambo etc.) because I'm a n00b at this stuff.
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Fixed it for you.
But yeah, it should probably be possible. Difficult, but possible. I'll leave it for the experts (Knizz, Colcolstyles, Darthatron, Jambo etc.) because I'm a n00b at this stuff.

ROFLMAO, I'm no expert!!

Nonetheless, this is something I hope to have a look at in the near-ish future, probably some time after i've finished the 649 Patch.

I know that there's code in FR for it too, but it currently duplicates the first generated Pokémon. I'll see if I can find out why that is, and complete the code for it. Here's hoping, eh?
 

jabberjabber8

../\..
213
Posts
13
Years
Thanks for the help i was reading a black white remake thread. Dont know where i got it from but they were using a fire red base and claimed to be able to do it (if I read it write) ill edit the thread in if i can find it again...
 
Last edited:

sonic1

ASM is my life now...
77
Posts
15
Years

For Firered:
Ok, i'm totally onboard with this idea. I too was also researching, and (thanks to JPAN and Interdepth) came up with a solution. The solution is quite simple, but the battle system is quite buggy. In fact, it involves setting a byte to the battle flag (thats the name I gave to it, in fact, its just an offset in ram, 02022B4B).

How? As soon as the wild battle music starts, BEFORE THE BLACK SCREEN,
wildbattlemoment.png
, set 02022B4C to 01. Continue to the battle. Voilà! Its a double wild battle.

There are some bugs,tough. The 2nd pokemon in the wild battle is a integral copy of the first one (all the data is the same), and so, if you defeat one of them, the battle ends, as the game just assumes that both of them were defeated because the HP data was the same for both (in theory, if you hit one, the other will suffer too). HOWEVER, if you load the 2nd pokemon in the 2nd battle slot, the battle is totally fine, without any bug except you can only capture on of them.

~Sonic1
 

sonic1

ASM is my life now...
77
Posts
15
Years
It's indeed present on other versions. Ruby/Sapph and Emer.

The process is the same: setting 1 to that offset.

For ruby (US) the offset is: 020239F8.
For emerald, i'm still researching the offset. I'll post when i find it.
 

sonic1

ASM is my life now...
77
Posts
15
Years
Ok for emerald the offset is 02022FEC.

The trick for double battle is just adding 01 to the value that it's currently there. This means, for example trainerbattle, the value is 08. If you put 09, it will turn into a double trainer battle.Simple, isnt it?

Its a matter of writting a routine that hooks that process. I already have that done. If you want it, i can post the offsets and the routine, so you can investigate more.

~Sonic1
 

sonic1

ASM is my life now...
77
Posts
15
Years
Are you researching firered? Because that where i have more data uncovered to begin with, so i would like for you to talk in firered's rom.

Anyways, back in my first post in this thread, i named the offset 02022B4C "Battle Flag". Thats because that offset is crucial to every battle: Its there that's set the type of battle before going to the battle loading according to the type.

And i'm sorry, i dont have the knowledge to write gameshark codes :(

~Sonic1
 

sonic1

ASM is my life now...
77
Posts
15
Years
That value is 80, and if you put 81, it will make a double Safari battle.

But this one is filled with bugs, like the previous ones from normal wild battles, plus the fact that safari pokemon cant attack and you release your pokemon instead of fighting with rock and bait.

~Sonic1
 

sonic1

ASM is my life now...
77
Posts
15
Years
Well now thats thinking afar! I like it xD.

Anyway, i thinks its more possible than you think.But not that possible without big changes. I dont know if you know binary, but i think the values for the B.Flag work by bits. Thats the only reason for the double battle work for everybattle. You set the first bit to 1 (like ASM, to declare a routine THUMB instead of ARM) and the other bits are setup to whatever the battle type was. But now there's a problem. How are we going to generate wild pokemon in both sides (the two players). And even if we sucessefuly did that, i think we would control 1 of our pokemon and the wild pokemon or something like that.
Funny xD

~Sonic1
 

sonic1

ASM is my life now...
77
Posts
15
Years
Hey, you dont have to go trough that hassle to test it. If you have a decent connection, you can "fool" the emulator and connect to yourself. Select "NETWORK" and with one emulator you start the server and with the other connect to the server by typing localhost in the textbox!

;)

~Sonic1
 
Last edited:

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
I had a very quick look at this and was able to make the game generate 2 separate wild pokémon, as opposed to 1 duplicated one, and, despite some odd bugs (like the battle music stopping after the first KO), i'm pretty pleased with this for an hour's work.

http://www.youtube.com/watch?v=nSfJ3OYvq30

As you can see, the first wild battle doesn't work (I don't know why this happens), but every subsequent battle generates a different Genesect and Pikachu combination.

The battle continues until either you catch one of the two (i'll hack that so that it's like DPPt eventually, only allowing a Poké Ball throw when there's only 1 Pokémon left), or until BOTH are KO'd. The music is a slight problem, but should be easily fixable.

Currently, because I haven't found the routine which picks the Pokémon from the Pokémon in a map, the Pikachu is hard coded. In other words, the second Pokémon will always be a Pikachu, but it will always be a randomly generated Pikachu, almost certainly different from the last one.

All in all, for an hour's hacking, i'm quite chuffed at the result.
 

sonic1

ASM is my life now...
77
Posts
15
Years
Yeah i knew that. That why naming the offset as battle flag isn't correct. Its more like a var, but as i said, it works on bits,because the first part matters to put the type, and the next part takes care of old man, items cant be used and ghost battles. Like, 80,90,A0 and B0(i think) they put the battle to ghost battle. And that part works by bits too, because try BF. It will tell you that items cant be used or something (not testing out, its just by memory, which can be not correct, as i discovered this 8/9 months ago)

~Sonic1


EDIT: Seems you Jambo posted in the middle of my writting time, so the responses were "intersected" xD. this post is for Team Fail
 
Last edited:

sonic1

ASM is my life now...
77
Posts
15
Years

I Just found out why it pulls up a wild battle using Archie, but Sonic1 already most likely knows why. If you use the same thing while entering a trainer battle, it makes it a double trainer battle. Since it is trying to activate a Trainer battle in a Wild battle scenario, it pulls the first default trainer in the list, being that Archie. Since there is no default party set, it just sends out ??? Pokemon as it's placeholder and warrants 1 exp. per kill.

That is correct.
Jambo, mind telling us how you loaded the pokemon in the 2nd slot?
I mean, you surelly know that the first slot is in 202402c and the second in 202402c + 0x64.
The way i load into there is manually, using data from another pokemon of another battle, saving his data into a file and then loading it to the offset when battle is about to start.

Did you used a routine or manually loaded the data?

~Sonic1
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
That is correct.
Jambo, mind telling us how you loaded the pokemon in the 2nd slot?
I mean, you surelly know that the first slot is in 202402c and the second in 202402c + 0x64.
The way i load into there is manually, using data from another pokemon of another battle, saving his data into a file and then loading it to the offset when battle is about to start.

Did you used a routine or manually loaded the data?

~Sonic1

I made the routine repeat the generation if the battle type was wild double. It currently generates a wild Pikachu (always) because of how I had to design it for now. But it shouldn't be outwith reach to have the game generate 2 random wild Pokémon.
 

sonic1

ASM is my life now...
77
Posts
15
Years
About the 2 random generated pokemon, according to what JPAN told me, it isn't hard to make the mod in the game in order to get it.

The routine that does the wildbattles is in 0x08082AEC, but only creates 1 pokemon. To change that, we must do a copy of the routine at 0x080829FC, which is the one who creates the pokemon at enemy slot 1. If we could create a hack that asked the game to create a pokemon in the next slot, we could even have 6 wild pokemons at once. I think it would'n be hard to do it.

~Sonic1
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
About the 2 random generated pokemon, according to what JPAN told me, it isn't hard to make the mod in the game in order to get it.

The routine that does the wildbattles is in 0x08082AEC, but only creates 1 pokemon. To change that, we must do a copy of the routine at 0x080829FC, which is the one who creates the pokemon at enemy slot 1. If we could create a hack that asked the game to create a pokemon in the next slot, we could even have 6 wild pokemons at once. I think it would'n be hard to do it.

~Sonic1

I already did that. I got the game to generate 2 wild pokémon, and yes, it could easily generate 6. The game would hang badly though, and there is no code in the game for triple battles, never mind sextuple battles.

The bigger issues are the music playing the "you won" music at the wrong point, and the ability/lack of ability to catch the Pokémon on screen.

Once we deal with these issues, and deal with the lack of ability to run from the battle. We'll be in a good position to start implementing this hack into actual hacks.
 
106
Posts
15
Years
  • Seen May 29, 2019
As we're on the topic of battles. How difficult would it be to implement more advanced battlegrounds? i.e. 256 colour backgrounds, animated backgrounds, a different background depending on the time of day (and maybe seasons too), one for specific areas (such as one for each elite four + the champion) etcetera.
 

TheDarkShark

Metal Headed Hacker
56
Posts
13
Years
@slawter666: driver implemented a battle BG hack in BPRD (Firered German) which loads different bgs depending on a variable. Shouldn't be hard to port, but I'm not sure if he actually released the info. I'm not an ASM expert, but an animated background could go with the extended BG-loading routine easily, I guess. Same goes for different BGs for daytimes/seasons. A 256 bg should be possible somehow, but it is possible, that there are some background colors used in the standard battle screen. If this is true, it would be very hard to make 256 colors load properly (actually impossible without loading the other bg-palletes into the OBJ-palette...).
 
Back
Top