Thread: Development: In-Battle Evolutions
View Single Post
Old September 21st, 2011 (12:57 AM).
JPAN JPAN is offline
pokemon rom researcher
Join Date: Dec 2008
Posts: 104
There are several big problems while trying to implement this. I've been trying to do do this for some time now, more specifically a temporary evolution during battle.

Mine works something like this:
  • Item is used in battle;
  • Party screen shows up, item gets used;
  • Pokemon evolves (now silently), stats get re-calculated;
  • Evolved pokemon appears on screen if it was the one out at the time.
While the data part wasn't that hard to make, the graphical part with the Evolution screen was the one that was giving me me a headache. After I was willing to abdicate the "X is evolving" screen, things went much smoother.

Any change made to your pokemon in the party screen is carried to the battle data as soon as you quit it, and any change made in the battle screen (that has some impact on the Pokemon 100 bytes) will carry to the Party screen as soon as you enter it, or as soon as the battle ends.
Therefore, items used on the party, such as potions, affect the 100 bytes only, and the game engine carries that change by itself to the battle structure. That is why there is only need for one item coding for both situations (Battle-only items like X Attack are the exception, because they change the battle structure directly, and have no effect outside of it).

I created an item that would access the hacked engine's pokemon decrypt function, changed data in it (in this case, pokemon species, but any other field can be changed), encrypt it, and called the game's stat calculator to fix the last 20 bytes of the data. The menu exited and my pokemon was evolved (a squirtle became a blastoise, although still named squirtle, and at level 13).

The reverting part (my case) was done by having a group of 8 flags in memory (only 6 needed) indicating which had evolved using this method, and 8 bytes (your case, 12 needed) Indicating which pokemon to revert to.

Although this time I cannot provide any code (most functions were tested by using breakpoints in VBA+introducing data by hand), know that evolution during battle is possible, and with some studying of the LV up script, it would be possible to evolve a pokemon without calling the evolution screen.
Denying evolution could be implemented by listening directly to the B key in the Input register, and not evolving if pressed.
Changing the battle sprite if it was the pokemon out could be hard, but best bet would be studying the form-change code for Castform, and use that.

PS: The in-game battle stat recalculator is placed at 0x0803E47C in Fire Red, and given in R0 the pokemon slot address, recalculates the ending 20 bytes of the 100byte structure.
Here are the links for my work

Currently working on:
Battle Script Documentation
Another large project
Reply With Quote