View Single Post
Old February 7th, 2012 (9:38 AM).
robosllim's Avatar
robosllim robosllim is offline
    Join Date: Jan 2012
    Gender: Male
    Posts: 13
    Originally Posted by robosllim View Post
    Here's the way things are now. There's a particular trainer, Battle Girl Lauren, who is known to cause problems. So I moved her to my debug location using Advance Map. She has a Hitmonlee with AI Value 200. She has an Antidote, a Burn Heal, a Full Heal, and a Full Restore. I poison the Hitmonlee and, consistently, she uses a Super Repel one turn, followed by a ?????? the next turn. Each will say "Foe HITMONLEE's SUPER REPEL/?????? cured POISON!" without actually doing so.

    So next, I remove all of her items and set Hitmonlee's AI Value to 0. I confirm that these changes take effect through HxD. I also change her name to confirm I'm loading the right ROM in VBA. So now, when Battle Girl Laurrrrrr battles me, she still uses a Super Repel and a ?????? when her Hitmonlee gets poisoned. Same behavior as before, even though her data changed.

    Now, I've figured out all the bytes in the trainer Pokemon data section (AI, level, dex number, item, and attacks), but I've got some holes in the trainer data:

    0-1   - ???
    2-3   - Music and Sprite
    4-15  - Name
    16-23 - Items
    24-27 - ???
    28    - Type (07 is story battle, I think)
    29-31 - ???
    32    - Pokemon count
    33-35 - ???
    36-39 - The address of the Pokemon data
    I'm wondering if any of the blanks could be causing issues. So, two questions: First, can anyone fill in my blanks? Second, is there anything else that may account for the weird item behavior? It definitely seems to be tied to particular trainers, rather than some corruption of the battle code... though I obviously am not certain.
    I haven't posted in a while, but I just wanted to give an update for future reference and to ask a new, hopefully simpler, question.

    After a lot of tracing through code, I found that the game simply wasn't loading item data from the right spot. It loaded the trainer's name, Pokemon, sprite, everything else correctly, but the items were just wrong.

    In this ROM, the trainer table is in a different location, due to being expanded. And even though most things worked, I discovered there was one place where the pointer was still pointing to the old table location. So it was essentially loading garbage data, or other code, in place of the items and using those somehow. After changing that pointer to the right value, everything is fine again.

    The new question: why didn't that pointer get updated? I didn't expand the trainer data myself, but are there any caveats we should be aware of in the future?