Entrance Abilities - haven1433/HexManiacAdvance GitHub Wiki

Broken

Note that the Entrance ability script does not work. You shouldn't use it! This may be revisited in a future update.

Bulbasaur with Imposter

The Goal

This tutorial lets you add new entrance abilities to FireRed. You'll be able to make custom abilities (or change existing abilities) so that the pokemon runs a battle script when you switch to that pokemon or when the battle starts. It also rewrites a few existing abilities to use this system, so that you can use them as a starting point or example. This includes the abilities Sand Stream, Drizzle, Drought, and Intimidate.

Download the script: Right click this text and choose Save link as...

Using the Script

  1. (Optional) Open this script in your favorite text editor and read it to understand what it does. The script basically does 3 things: it adds a new table, it adds code that knows how to read the new table, and it hooks that code into the existing AbilityBattleEffects in battle_util.c.
  2. Open your FireRed romhack in HexManiacAdvance and then drag-drop the script over your rom. This will add the code for the custom abilities.
  3. Go to data.abilities.names and use the Add X New button to increase the size of the table. The table can be no more than 256 abilities long, but there's only 80 by default, so there's plenty of space. Change the names for the new abilities, then repoint the descriptions and add custom descriptions. The description can only be a single line.
  4. Go to data.abilities.entrance and add your new abilities to the table. The format is:
  • The ability that you want to have an entrance effect.
  • (Optional) a move to associate with the ability. This move's animation will be used if you call attackanimation and the move name will be used if you call attackstring.
  • A pointer to a battle script. It's recommended that you first make this value null, then ask HMA to create new data, and then write your script in the new offset HMA provided for you.

Example Table

  1. Add Haven's Entrance Abilities to your hack's Credits.

Writing Ability Battle Scripts

The most important thing to remember: ability battle scripts must end with end3, while moves end with end.

To get started, you can try making an ability that has an effect identical to an existing move. For example, if you look at the effect for Transform, you'll see:

1D712F:
  attackcanceler
  attackstring
  ppreduce
  transformdataexecution
  attackanimation
  waitanimation
  printfromtable <3FE5B4>
  waitmessage 64
  goto <1D694E>
1D694E:
  setbyte 2023FD8 0
  moveend 0 0
  end

You can use this as a starting point to build the following script for Imposter, an ability that casts the Transform effect:

Imposter:
  transformdataexecution
  attackanimation
  waitanimation
  printfromtable <3FE5B4>
  waitmessage 64
  setbyte 2023FD8 0
  moveend 0 0
  end3

Note that all that changed was the removal of attackcanceler, attackstring, and ppreduce, as well as removing the goto and replacing the end with end3. Congratulations, you now have a working Imposter ability!

⚠️ **GitHub.com Fallback** ⚠️