• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Staff applications for our PokéCommunity Daily and Social Media team are now open! Interested in joining staff? Then click here for more info!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[FireRed] Hidden Abilities

  • 417
    Posts
    9
    Years
    • Seen Nov 20, 2016
    I've been dragging my feet on writing this up, but today I bring you hidden abilities for FireRed.

    Prerequisites
    - Basic experience inserting ASM
    - A hex editor
    - The ability to read and write simple routines is a plus, though not required

    I'll try to be detailed with what specifically each step is doing in order to make modifications easier. If you don't care about that, simply look for the walls of code.

    Step 1: New Method for Determining Abilities
    Spoiler:

    Step 2: Everywhere the Game Calls the Function
    Spoiler:
    Step 3: Base Stats Table
    Spoiler:
    Step 4: Pokemon Generation
    Spoiler:
    Step 5: Wild Pokemon
    Spoiler:

    Step 6: NPC Wild Encounters
    Spoiler:
    Step 7: Daycare
    Spoiler:
    Step 8: Egg Hatching
    Spoiler:

    Step 9: Trainers
    Spoiler:

    And we're done! But a few more comments.

    All of the above steps were done with a vanilla FireRed ROM. I haven't tested much with them, so I could imagine contributions to the Ability Resource/Move Resource Threads having conflicting hooks or more hooks being necessary for new and updated abilities/attacks. If necessary, I'll attempt to make updates to remedy any incompatibilities. I'll also be adding a method for triggering hidden abilities with rods sometime in the future. I haven't even looked into it yet because, to be frank, it isn't something I really cared about. But rest assured I'll find another hook for completeness sake.

    Credits:
    A big thanks to Touched for providing the necessary hooks for many of these routines as well as walking me through a good amount of ASM reading and logic in general.

    Also instrumental was the valuable research in knizz's idb, IMO the greatest tool in a FireRed hacker's arsenal.

    DoesntKnowHowToPlay's Trainer EV Hack saved me a good amount of time with trainer research.

    Any questions/comments welcome.

    Extras
    Spoiler:
     
    Last edited:
    Well, since no one has said anything, this is fantastic. I've been wondering when someone would get along to doing this.

    I have one problem that is very minor though. That unused half word is used in a routine to give wild Pokemon there own wild battle theme. That's very minute, but still a thing.

    I am going to give my tool support for editing that byte, so no one here will have to hex edit anymore. (Just something to make it a little less tedious).
    Thanks a lot!

    And really? I had no idea because they're zeroes all the way down. Do you know where that theme routine is? I don't understand why it would need that halfword of zeroes. I could either try to alter that routine or use free space to store the hidden abilities. It by no means needs to be in the base stats table; that was only for convenience.
     
    well done, and thanks for sharing such a good feature !

    Other than congrat you, I wanted to say that feature shouldn't be a problem for new abilities. They are implemented in the battle engine while you're hooking in get_attr or set_attr, so no worries

    For abilities with effect in the overworld though, slight modification should be done (flame body...)
     
    well done, and thanks for sharing such a good feature !

    Other than congrat you, I wanted to say that feature shouldn't be a problem for new abilities. They are implemented in the battle engine while you're hooking in get_attr or set_attr, so no worries

    For abilities with effect in the overworld though, slight modification should be done (flame body...)

    Pretty sure the only ability that works outside of battle in vanilla Firered is Pickup. Actually, maybe not even that. Doesn't Pickup work after winning a battle? So that probably doesn't count.
     
    Pretty sure the only ability that works outside of battle in vanilla Firered is Pickup. Actually, maybe not even that. Doesn't Pickup work after winning a battle? So that probably doesn't count.

    Hackmew implemented the latest flame body effect : make eggs hatch faster when you carry a poke with flame body.
    I don't know for pickup how that works.
    Also I was talking about future abilities we could implement, because azurile talked about the resource thread.

    Oh and I'm reading the article on bulbapedia, there's actually many abilities that have effect in the field, number of them where already present in genIII
     
    Hackmew implemented the latest flame body effect : make eggs hatch faster when you carry a poke with flame body.
    I don't know for pickup how that works.
    Also I was talking about future abilities we could implement, because azurile talked about the resource thread.

    Oh and I'm reading the article on bulbapedia, there's actually many abilities that have effect in the field, number of them where already present in genIII

    Didn't realize that you were talking about future abilities that could be implemented, my bad!

    But all of the abilities that have field effects gained their field effect in Emerald. That wasn't a feature at all until then.
     
    It is 00's in a vanilla ROM. Darthatron made a routine some time a while back that uses those halfwords though. I'm sure it can be modified to use only a byte though. That would allow for both routines to be used at the same time.
    Ah, that makes more sense. I thought you were referring to a routine that was naturally in the game and I was very confused.

    Other than congrat you, I wanted to say that feature shouldn't be a problem for new abilities. They are implemented in the battle engine while you're hooking in get_attr or set_attr, so no worries
    Thanks! And that's good to know. The reason I wasn't sure was that there were a few hooks checking for abilities like Water Absorb and Flash Fire. I wasn't sure if they were for AI logic or something like that.

    Pretty sure the only ability that works outside of battle in vanilla Firered is Pickup. Actually, maybe not even that. Doesn't Pickup work after winning a battle? So that probably doesn't count.
    Pickup is the reason for the "sixth_routine" in step 2.
    There's also a Stench and Illuminate check after "tenth_routine," but no one cares about those abilities so they're always forgotten.

    Hackmew implemented the latest flame body effect : make eggs hatch faster when you carry a poke with flame body.
    I don't know for pickup how that works.
    Also I was talking about future abilities we could implement, because azurile talked about the resource thread.

    Oh and I'm reading the article on bulbapedia, there's actually many abilities that have effect in the field, number of them where already present in genIII
    Yeah, I can create an "extras" section with optional added field effects. Even if they're not specific to FireRed or hidden abilities, I think it would make sense to add them to avoid conflicting hooks. I'm not familiar with Hackmew's Flame Body hack, but I already have one written up that works with hidden abilities; I'm sure it is basically the same thing. Effects related to encounter rates could probably be added around Stench and Illuminate. Magnet Pull-esque effects could be a little tricker, but worst case scenario you could load the list of all possible wild Pokemon and manually check each of them for a type. I'd predict that personality based effects like Synchronize and Cute Charm could be hooked in around "Step 5: Wild Pokemon." Honey Gather at the same spot as Pickup. I think that I'm looking at the same list that you are, and most of them seem pretty doable.
     
    Last edited:
    This is an absolutely fantastic achievement!

    I'm a bit unsure about the first example of the YYY flag. Does it mean that the game randomly sets the flag, and then generates a HA Pokemon when the flag is set, and then turns it off?

    Or is it a matter of you're in a specific map bank, and it sets the flag?

    What I think may be best is as you do with the NPC Routine, making it trigger on two flags. One flag that is set in a script, so you could make every Pokemon in a certain map or location have a hidden ability, and then the seperate randomly generated flag.

    But either way, absolutely fantastic work! Great job :)
     
    This is an absolutely fantastic achievement!

    I'm a bit unsure about the first example of the YYY flag. Does it mean that the game randomly sets the flag, and then generates a HA Pokemon when the flag is set, and then turns it off?

    Or is it a matter of you're in a specific map bank, and it sets the flag?

    What I think may be best is as you do with the NPC Routine, making it trigger on two flags. One flag that is set in a script, so you could make every Pokemon in a certain map or location have a hidden ability, and then the seperate randomly generated flag.

    But either way, absolutely fantastic work! Great job :)
    I appreciate the feedback! Reading it over now, I see that I never explicitly said that you were meant to set the flag in the overworld. Nothing in the example routine was random, though I see how my follow up "prng" comment helped to further muddle the message. Oops. The idea was that you have some event and set a flag that makes the next Pokemon you find in the grass/water have a hidden ability, or perhaps you have level scripts on certain maps that set the flag. Now that I'm actually thinking it over, however, that seems quite inconvenient as there is nothing to turn the flag off when you enter a "non hidden" map without putting another level script on just about every other map with wild encounters.

    Off the top of my head, I think that maybe a better way would be to make a table with a list of 2 byte entries of map bank and map number (or something like that) and make comparisons to whether or not the map you are in matches any of the maps in that table. The following uses more bytes than possible without a hook, but something like:
    Code:
    	ldr r0, current_map_bank_offset
    	ldrh r0, [r0] @load bank and number simultaneously
    	ldr r1, list_of_hidden_ability_maps
    	mov r3, (number of maps on hidden ability maps list)
    
    loop:
    	cmp r3, #0x0
    	beq end @none of the maps on the list match the map you're in
    	ldrh r2, [r1]
    	add r1, r1, #0x2 @move to offset of next map on table
    	sub r3, #0x1
    	cmp r0, r2
    	bne loop
    	mov r0, #0x1
    store_hidden_ability_result:
    
    . . . . . . .
    
    current_map_bank_offset: .word 0x02031DBC
    list_of_hidden_ability_maps: .word 0x08YYYYYY
    But really, basically anything would work; I was aiming to give the maximum possible flexibility to someone who knows purely scripting commands.

    Just letting you know my new update to my editor now supports your routine. You can test it if you want to.
    That's good the hear! Unfortunately, I have a Mac, and I'm assuming your tool hasn't been ported yet, so I can't personally test it :/ But I can't wait for a version that I can use!

    On an unrelated note, I'll slowly be adding overworld abilities to the OP. As a mini update, I've added Flame Body and Magma Armor because they're easy to do they're super useful.
     
    I appreciate the feedback! Reading it over now, I see that I never explicitly said that you were meant to set the flag in the overworld. Nothing in the example routine was random, though I see how my follow up "prng" comment helped to further muddle the message. Oops. The idea was that you have some event and set a flag that makes the next Pokemon you find in the grass/water have a hidden ability, or perhaps you have level scripts on certain maps that set the flag. Now that I'm actually thinking it over, however, that seems quite inconvenient as there is nothing to turn the flag off when you enter a "non hidden" map without putting another level script on just about every other map with wild encounters.

    Off the top of my head, I think that maybe a better way would be to make a table with a list of 2 byte entries of map bank and map number (or something like that) and make comparisons to whether or not the map you are in matches any of the maps in that table. The following uses more bytes than possible without a hook, but something like:
    Code:
    	ldr r0, current_map_bank_offset
    	ldrh r0, [r0] @load bank and number simultaneously
    	ldr r1, list_of_hidden_ability_maps
    	mov r3, (number of maps on hidden ability maps list)
    
    loop:
    	cmp r3, #0x0
    	beq end @none of the maps on the list match the map you're in
    	ldrh r2, [r1]
    	add r1, r1, #0x2 @move to offset of next map on table
    	sub r3, #0x1
    	cmp r0, r2
    	bne loop
    	mov r0, #0x1
    store_hidden_ability_result:
    
    . . . . . . .
    
    current_map_bank_offset: .word 0x02031DBC
    list_of_hidden_ability_maps: .word 0x08YYYYYY
    But really, basically anything would work; I was aiming to give the maximum possible flexibility to someone who knows purely scripting commands.

    Oh sure I understand completely! Sorry I thought I read something that said the flag was turned off in the battle. To be honest I think how it is is fine. I thought setting level scripts to turn them on / off would make the most sense and isn't too annoying.

    Though the map bank idea sounds pretty good as well. Ulltimately the more options there are the better I think!

    I'll look into porting this to Emerald soon :)
     
    hey when your done developing that tool pm me. And if possible can you make it compatible with pokémon Emerald?
     
    I dont know why such an awesome thread has few replies...
    .
    on my second attempt to read it, i finally knew how to give a pokemon hidden ability, thanks for it :)

    Because people expect to have everything handed to them on a silver platter. Patch this, patch that, no ASM, no hex.
    Just look at that thread. Azurile not only shared his code for the hidden abilities, but explained the whole process in detail. The only thing one could pick on is that you have to do all that stuff manually, a script(not a (tfu) patch, obviously) could save you some time.
     
    Because people expect to have everything handed to them on a silver platter. Patch this, patch that, no ASM, no hex.
    Just look at that thread. Azurile not only shared his code for the hidden abilities, but explained the whole process in detail. The only thing one could pick on is that you have to do all that stuff manually, a script(not a (tfu) patch, obviously) could save you some time.

    Well such explained tutorials are great...
    .
    I too like them,
    but my one problem with this thing is tools dont provide the option to edit that byte responsible for hidden abilities...
    .
    if tools like PGE could include this feature it would be too awesome.
    as firstly identifying the hex number for abilities (Thankfully Azurile has done that task)
    and then identify the proper position of that byte and then edit it for all pokemons would take a lot of time,
    and one would need a lot of patience for that...
    .
    I Hope tools soon add this feature :)
     
    Well such explained tutorials are great...
    .
    I too like them,
    but my one problem with this thing is tools dont provide the option to edit that byte responsible for hidden abilities...
    .
    if tools like PGE could include this feature it would be too awesome.
    as firstly identifying the hex number for abilities (Thankfully Azurile has done that task)
    and then identify the proper position of that byte and then edit it for all pokemons would take a lot of time,
    and one would need a lot of patience for that...
    .
    I Hope tools soon add this feature :)

    [PokeCommunity.com] [FireRed] Hidden Abilities

    [PokeCommunity.com] [FireRed] Hidden Abilities
     
    Back
    Top