The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary Hack Research & Development (https://www.pokecommunity.com/forumdisplay.php?f=195)
-   -   Development Wild double / triple battles (https://www.pokecommunity.com/showthread.php?t=253371)

jabberjabber8 May 29th, 2011 11:56 PM

Wild double / triple battles
 
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 May 30th, 2011 3:01 PM

Quote:

Originally Posted by jabberjabber8 (Post 6667234)
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 May 30th, 2011 3:24 PM

Quote:

Originally Posted by Fireworks (Post 6668419)
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 May 31st, 2011 5:04 AM

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...

sonic1 May 31st, 2011 9:38 AM


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, http://img685.imageshack.us/img685/1653/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 May 31st, 2011 10:51 AM

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 May 31st, 2011 11:35 AM

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 May 31st, 2011 11:56 AM

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 May 31st, 2011 12:13 PM

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 May 31st, 2011 12:24 PM

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 May 31st, 2011 12:34 PM

You want vba-link? Here: http://www.vbalink.info/download/vbalink180b0.zip

You'll be also needing Hamachi to create a network. If you want, we could do it both, just send me your mail.

sonic1 May 31st, 2011 12:46 PM

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

Jambo51 May 31st, 2011 12:55 PM

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 May 31st, 2011 12:57 PM

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

sonic1 May 31st, 2011 1:17 PM

Quote:

Originally Posted by Team Fail (Post 6670003)

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 May 31st, 2011 2:07 PM

Quote:

Originally Posted by sonic1 (Post 6670040)

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 May 31st, 2011 2:19 PM

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 May 31st, 2011 2:48 PM

Quote:

Originally Posted by sonic1 (Post 6670161)
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.

slawter666 June 1st, 2011 8:01 AM

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 June 1st, 2011 1:35 PM

@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...).

slawter666 June 2nd, 2011 2:51 PM

Quote:

Originally Posted by TheDarkShark (Post 6671879)
@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...).

Thanks for the reply.

Could a (roughly) 256 colour background could be done using a similar method to Black Charizard's 256/240 colour Titlescreen? However he removed how he did it (although it might still be in some quotes, I haven't checked).

Meta Paradox June 2nd, 2011 11:20 PM

Okay, if the double wild battle needs changing every so often EXTERNALLY with a hex editor, wouldn't writebytetooffset work? At least for wildbattle scripts?

Jambo51 June 3rd, 2011 3:39 AM

Quote:

Originally Posted by Meta Paradox (Post 6674462)
Okay, if the double wild battle needs changing every so often EXTERNALLY with a hex editor, wouldn't writebytetooffset work? At least for wildbattle scripts?

No. The byte in question is always written with the standard routine. And it's always written as 0x0. This needs some investigation. It is possible for me to make a routine which reads from lastresult for ghe wildbattle type, though.

I've got the game generating 2 random wild pokemon from the map's pokemon. Although i'm struggling to find where the buggy things are, atm.

POKEMONMASTER260 June 3rd, 2011 5:22 AM

Is it possible to implement this in a Ruby ROM hack, instead of just a memory hack?

miksy91 June 3rd, 2011 9:16 AM

This is pretty much impossible if you ask me.

Reason:
It would be a difficult thing to make it so that 2 pokemon could appear at the same time but the real problem would be the coding for the battle not to end if you caught one pokemon (of course if the hacker wanted it to be so that the battle would end leaving the other pokemon uncatchable it would be possible, maybe).


All times are GMT -8. The time now is 8:59 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.