Go Back   The PokéCommunity Forums > ROM Hacking > Research & Development
Reload this Page Development Mega Animation for 3rd Gen

For all updates, view the main page.

Research & Development Got a well-founded knack with ROM hacking? Love reverse-engineering the Pokémon games? Or perhaps you love your assembly language. This is the spot for polling and gathering your ideas, and then implementing them! Share your hypothesis, get ideas from others, and collaborate to create!
Research & Development programs in this forum are subject to moderator approval before they are displayed.

Closed Thread
Thread Tools
Old May 26th, 2014 (12:39 PM). Edited May 27th, 2014 by Christos.
vizor vizor is offline
Join Date: Dec 2011
Gender: Female
Posts: 24
Hi there,

i finally have managed it, to do MegaEvolutions in the 3rd Gen. I show you this, in order to get feedback, but also to help me with the desing of the new Mega-Pokemon.
This system will not be availible for the public, but i definitly want to get feedback (and of course also some publicity for my hack pokemon violet). If somebody has done any further research on the battle system (especially for the "display text callback at 0x03004FE0), it would be great, if you could post it here or pm me.
Also Pm me if you want to help me with the sprite desing.

Here is a link to Pokemon Violet - also subscribe my channel if you want to. I will post my research on the battle system (which is merly enough to perform a mega evolution), but keep in mind that all ROM-Offsets (and eventually some RAM Offsets as well) are only for FireRed German.

The Battle System is parted into many sequenzes, e.g. oponent makes a move, you open the bag etc. Which sequence is executed next is stored on a callback handler. A callbacks loops every frame, and if it has finished it pushes an other callback to this handler. There are many callbacks, and i dont know how many there are, but most of the time RAM: 0x03004FE0 is used for the callbacks.

There are some callbacks i reserached so far, but notice that they will all return to the "normal" battle once they have finished.

  • 0x08108BCC | 1 : Return to the Battle, executes an item script form a table (usually your moves ends after that, because an item script from this table ends the move, but e.g. not for item 0x0)
  • 0x080A1FE0 | 1 : text is loaded, which text is related to an table which i have not found so far
As you might see now these callbacks are meant to be used in combination with an item. I use this callbacks in my mega_evolution, because they can be used in a item_battle_script safely.

Everybody who has hacked items so far knows, that battle_scripts are executed kinda weird. The ASM snippet seems to prepeare what has to be done afterwards. The pokeball for example just loads data into the RAM, then uses the "Return to Battle" callback. Because the item slot is pokeball (im RAM) the callback from the table is executed, and a pokeballs effect is now active, even thogh the code on the pokeballs data itself has been executed long ago.

Unfortunatley that is almost everything i figured out so far
Old May 27th, 2014 (1:19 PM).
Shiny Quagsire's Avatar
Shiny Quagsire Shiny Quagsire is offline
I'm Still Alive, Elsewhere
Join Date: May 2009
Location: Hoenn Safari Zone
Age: 17
Gender: Male
Nature: Jolly
Posts: 691
Simply amazing. The more we learn about battle scripts the better, this is literally one of the last frontiers of Gen III hacking we have yet to discover and now we are one step closer to fully understanding the battle engine.

Old May 27th, 2014 (1:38 PM).
Agastya's Avatar
Agastya Agastya is offline
Grinding failed. Item Grind level dropped by 3.
Join Date: Feb 2010
Nature: Quiet
Posts: 68
this method seems a little wonky - from the current implementation it appears you could mega then switch or mega then use an item

it also seems that you'll use the mega's base speed for the turn it evolves instead of the non-mega's base speed

it's still impressive and a step in the "right" direction (as far as hacking goes), don't get me wrong, but hopefully now that the baseline has been figured out it can be improved to be as accurate as possible instead of sticking with it with the community's typical "good enough" mentality that's stuck around for a little too long
Old May 27th, 2014 (2:31 PM).
DoesntKnowHowToPlay's Avatar
DoesntKnowHowToPlay DoesntKnowHowToPlay is offline
some loser
Join Date: Jan 2012
Posts: 225
This system will not be availible for the public,
cool advertisement

To make this not just a blatant ad thread and actually have some content, I'm gonna dump some stuff I figured out from an old attempt at creating Relic Song that might be useful for creating mega evolutions.

Forms, in almost all cases, are most easily created using extra slots. There's a few reasons for this- the biggest in my opinion is that it trivializes changing base stats. Normally you'd have to do a bunch of obnoxious math to calculate the Mega's stats, but by tying the mon to a different slot you can just call the game's stat-recalc function (x3e47c) to do it for you after you change the mon's species to the new form's slot. More pragmatically, this method simplifies changing their sprites, abilities, type, weight, and cry. It also means you don't have to add a mega or form identifier anywhere as you can just check the species. As far as the pokedex goes, you can map every form of a mon to the same dex number, so encountering Rotom-W would get you Rotom's dex page if you used this method for it.

So, to implement mega evolution, you'd want to change the mon to the mega species provided that no other mega pokemon exist in the party (done by checking their species). You'd also want to update the battle structs to the new mon's stats, typing, species, and ability. You'd also need to run a routine that scans the party for mega-evolved pokemon (again, a species check) and changes their species to the appropriate normal mon at the end of every battle.

I think it should go without saying that ASM would be involved, especially in an implementation consistent with X/Y since it would need to happen after the player selects their command and turn order is decided but before any of the Pokemon actually move.

Here's some helpful offsets for changing a mon's species during battle:

x02023D6B: bank of the mon that is currently attacking. 0 is player's first mon, 1 is enemy's first mon, 2 is player's second mon (in doubles), 3 is enemy's second mon. Relevant if you want to do Relic Song or Stance Change, but not as much for properly implemented Megas.
x02023BCE: stores which party slot the active pokemon are mapped to. Somewhat non-intuitively, these are half-words, and are sorted in the same order as the above banks. (player's first mon, enemy's first mon, player's second mon, enemy's second mon). Values range from 0-5.
x02024284: player's party data. Each entry is 100 (x64) bytes long, encrypted- structure is same as documented here: http://bulbapedia.bulbagarden.net/wi...Generation_III
x0202402C: enemy's party data, stored same way as above.
x02023be4: Battle structs. There are four of them, each 88 (x58) bytes long. These store temporary data for the active pokemon, such as type changes, volatile status (curse/leech seed), stat modifiers, etc. This is *not* directly tied to the pokemon data- if you change the mon's species in pokemon data you'll need to update this yourself. They are documented in what should be a sticky thread here: http://www.pokecommunity.com/archive.../t-215644.html
x02023bde: turn order- four bytes, holding the values 00, 01, 02, and 03 in the order those banks will move (just 00 and 01 in single battles).

x0803fbe8: decrypter- function used to read the pokemon data elegantly. Takes a Pokemon struct's address in R0 and an index to read in R1.
x0804037c: encrypter- function used to change the pokemon data elegantly. Takes a Pokemon struct's address in R0, an index to change in R1, and a pointer to the new data in R2.
x0803e47c: stat recalc- function used the recalculate a pokemon's stats to accommodate changed EVs or base stats.

Yet Another Fire Red Hack

Physical/Special Split
Old May 30th, 2014 (10:38 AM).
Kakarot1212's Avatar
Kakarot1212 Kakarot1212 is offline
Resident Programmer
Join Date: Oct 2013
Location: Phillipines
Gender: Male
Nature: Naughty
Posts: 530
Woah, this a cool finding! Another leap towards hacking.

But this,
This system will not be available for the public
Simply disappointing. No, really..
Old May 30th, 2014 (12:12 PM).
Varion Bluefire's Avatar
Varion Bluefire Varion Bluefire is offline
A.K.A The Glitch
Join Date: Apr 2013
Age: 21
Gender: Male
Nature: Naughty
Posts: 663
Send a message via Skype™ to Varion Bluefire
it is a real shame you'er not making this public, it'd be a good feature for all.

Just strollin' to my next destination...
Old June 7th, 2014 (6:29 PM).
Ethanb900 Ethanb900 is offline
Join Date: Mar 2014
Gender: Male
Posts: 55
It does seem like a really good idea. I never even thought about putting it as an in-bag item. Unfortunately, you're not having it available to the people.
Old August 24th, 2014 (2:37 AM).
Lance32497's Avatar
Lance32497 Lance32497 is offline
LanceKoijer of Pokemon_Addicts
Join Date: Aug 2014
Location: Criscanto town-Ginoa Region xD
Gender: Male
Nature: Adamant
Posts: 583
why you dont want to share that?
My Threads

Old August 28th, 2014 (2:59 AM).
persian_17's Avatar
persian_17 persian_17 is offline
Join Date: Jun 2007
Location: far away island
Nature: Adamant
Posts: 29
i think this is fake, you probably edited the video
Old August 28th, 2014 (4:48 AM).
vizor vizor is offline
Join Date: Dec 2011
Gender: Female
Posts: 24
are you kidding me?

How could this be fake? xD
Old August 28th, 2014 (4:54 AM).
AkimotoBubble AkimotoBubble is offline
Join Date: Aug 2014
Gender: Male
Posts: 32
Oh, good, I am thinking how to make the pokemon image distortion, do you have any good ideas?
i am bubble,and sorry my english is not good ......
Old August 28th, 2014 (7:12 AM).
Gexeys's Avatar
Gexeys Gexeys is offline
Location: Ilex Forest shrine
Join Date: Dec 2013
Gender: Male
Nature: Adamant
Posts: 70
This system will not be availible for the public, but i definitly want to get feedback (and of course also some publicity for my hack pokemon violet). If somebody has done any further research on the battle system (especially for the "display text callback at 0x03004FE0), it would be great, if you could post it here or pm me.
How are you expecting the public to help you on something you're not going to give to the public?
Old August 28th, 2014 (12:25 PM).
cscof's Avatar
cscof cscof is offline
pretty coolish guy
Join Date: Nov 2013
Gender: Male
Nature: Impish
Posts: 52
So, you finally cracked one of the hardest eggs so far, and you're just keeping it for yourself? Disappointing.
This signature has been disabled.
Exceeding the height limit.
Please review and fix the issues by reading the signature rules.

You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
Old August 28th, 2014 (2:50 PM). Edited August 28th, 2014 by Urist McHemlock.
Urist McHemlock's Avatar
Urist McHemlock Urist McHemlock is offline
Jack Frost of the Jack Brothers
Join Date: Sep 2008
Location: Astral Void
Age: 19
Gender: Male
Nature: Quirky
Posts: 463
Stop being a selfish person.
Old August 28th, 2014 (5:27 PM).
karatekid552's Avatar
karatekid552 karatekid552 is offline
What happens if I push it?....
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Posts: 1,767
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
I'm going to close this thread. I personally do not agree with keeping this to yourself seeing as you posted in R&D and not a personal hack thread. R&D is for PUBLIC development and research, not personal feedback. Make a hack with this in it and then you can request feedback.

Btw, sharing will make you far more respected. Trust me.


Paired with Simba
Closed Thread
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are UTC -8. The time now is 11:10 AM.