Thread: Research: Adding New Moves to Gen 3
View Single Post
  #80    
Old December 28th, 2012 (11:29 AM).
DoesntKnowHowToPlay's Avatar
DoesntKnowHowToPlay
some loser
 
Join Date: Jan 2012
So I figured out a nifty trick that would have been nice to know earlier:

The command 2A can be used in battle scripts to read arbitrary halfwords and jump depending on their value- by checking x02023D4a, this can be used to detect which attack is calling the script. This is actually done by the game to detect Surf and Whirlpool so it can make them pierce Dive. For example:

Quote:
2A 00 4A 3D 02 02 5D 01 FB 85 1D 08
This command will cause a jump to x1D85FB if the move being used is x15D- Dragon Dance. If the move is not Dragon Dance, the script simply continues. We can utilize this to map different effects to a single effect byte- this allows us to make our new attacks AI-friendly by mapping them to similar effect bytes. For example, if we put Shift Gear's script after this check, we can give it Dragon Dance's effect byte, and the AI will treat Dragon Dance and Shift Gear the same way. It also allows us to easily take advantage of effects that aren't handled by script- we can make Flare Blitz defrost the user by giving it script x7D (Flame Wheel) without losing the recoil effect, for example. It also means there is no need to repoint the battle script table, as we only need to branch off the existing scripts rather than add new ones to the table.

Speaking of defrosting- if any moves in the expanded move table have effect byte x7D (such as Scald and Flare Blitz), they will produce garbage text when they defrost the user. To fix this, go to 0xD7E96 and place six 00s there.
__________________

Yet Another Fire Red Hack

Physical/Special Split
Reply With Quote