View Single Post
September 20th, 2011 (4:48 AM).
Glory To Arstotzka
Originally Posted by
that the battle ASM just acts directly on the player's Pokemon data -- the six 100-byte data structures stored at 0x02024284. That's the persistent storage area for the player's party, and
preceding it is the storage area used by battle ASM to hold up to six enemy Pokemon.
(My reasoning here is that... If you use "setwildbattle", it prepares the six enemy slots appropriately but doesn't start the battle. You can then modify the Pokemon it loads to the first enemy slot and
call "dowildbattle", and your modifications will remain intact (assuming either that you edited the non-protected stat data, or that you repaired the checksum after editing). The game doesn't back up loaded enemy Pokemon to some special location when it processes a battle, so why would the player's Pokemon be any different?)
So you could just modify the Pokemon; no need to move the data elsewhere, though. The stats in "the battle RAM" are
stats. Now, showing the updated data on-screen is another matter.
Sadly, your suspicions are incorrect. The game relies on seperate battle data, with some of it being copied from the party data, and some of it being calculated and written from the Pokémon base data in the ROM, during battle.
This data is at 0x02023BE4. There are 4 slots, each 0x58 (88) bytes long.
This is a short list of what i've discovered in the battle data:
0x0 - Species (2 bytes)
0x2 - Stats (12 bytes - 2 bytes per stat)
0x18 - Stat raising/falling trackers (6 bytes)
0x20 - Ability (1 byte)
0x21 - Types (2 bytes)
0x24 - Current PP (4 bytes - 1 byte per attack)
0x28 - Current HP (1 byte)
0x2C - Total HP (1 byte)
0x30 - Nickname (13 bytes)
0x3C - OT Name (8 bytes)
0x54 - Personality Value (4 bytes).
The game links battle data slots to party slots by using the following method:
At 0x02023BC4 is a byte which tells the game which battle slot data to use. Further, it is also used to tell the game which party slot is linked to each battle slot.
The even numbered slots are the player's, while the odd numbered slots are the opponent's.
Starting with 0x02023BCE are an array of bytes which link battle data slots to party data slots.
It works out as such:
Party Slot ID = [02023BC4]*2 + 02023BCE
The byte stored in this location is the party slot of the Pokémon represented by the battle data in slot [02023BC4].
Hopefully this helps.
Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! -
Joined Jun 2009
View Public Profile
Send a private message to Jambo51
Find all posts by Jambo51
Find threads started by Jambo51
Ignore Posts by Jambo51