• 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?".
  • 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.

[ASM & Hex] Changing recover effect

  • 5
    Posts
    11
    Years
    • Seen Aug 18, 2023
    Hello everyone,

    I am trying to edit the Recover effect to heal a set percentage, instead of 50%. For example : heals for 25%, heals for 75%, etc...

    Here is the effect code :
    Code:
    00 02 03 7B FB 9E 2D 08 01 09 0A 35 80 42 02 02 00 01 00 00 0B 01 0C 01 10 4B 00 12 40 00 28 4E 8A 2D 08

    The code for MILK DRINK is almost similar :
    Code:
    00 02 03 7B FB 9E 2D 08 00 09 0A 35 80 42 02 02 00 01 00 00 0B 00 0C 00 10 4B 00 12 40 00 28 4E 8A 2D 08 39 20 00 10 4C 00 12 40 00 28 4E 8A 2D 08
    I guess the extra section is for on map use.

    Does anybody have experience with this ?
    BTW this is Emerald but I guess in this case FR code would be the same
     
  • 990
    Posts
    4
    Years
    Hello everyone,

    I am trying to edit the Recover effect to heal a set percentage, instead of 50%. For example : heals for 25%, heals for 75%, etc...

    Here is the effect code :
    Code:
    00 02 03 7B FB 9E 2D 08 01 09 0A 35 80 42 02 02 00 01 00 00 0B 01 0C 01 10 4B 00 12 40 00 28 4E 8A 2D 08

    The code for MILK DRINK is almost similar :
    Code:
    00 02 03 7B FB 9E 2D 08 00 09 0A 35 80 42 02 02 00 01 00 00 0B 00 0C 00 10 4B 00 12 40 00 28 4E 8A 2D 08 39 20 00 10 4C 00 12 40 00 28 4E 8A 2D 08
    I guess the extra section is for on map use.

    Does anybody have experience with this ?
    BTW this is Emerald but I guess in this case FR code would be the same

    How can the code of two different games be same? Every item entry is different between the two games.
     
  • 5
    Posts
    11
    Years
    • Seen Aug 18, 2023
    It can still help me understand how it works. Also while values may be different the structure is likely to be the same.
     
    Last edited:
  • 5
    Posts
    11
    Years
    • Seen Aug 18, 2023
    Sorry for posting here then I guess it's too much for a beginner to ask for help.
     

    itsdarsh

    Contender
  • 20
    Posts
    4
    Years
    Here is the effect code :
    Code:
    00 02 03 7B FB 9E 2D 08 01 09 0A 35 80 42 02 02 00 01 00 00 0B 01 0C 01 10 4B 00 12 40 00 28 4E 8A 2D 08

    You won't be able to change anything directly from here, because this is just a list of the scripts the game runs each time the move is used. Going through the first few:
    Code:
    00                // attackcanceler
    02                // attackstring
    03                // ppreduce
    7B FB 9E 2D 08 01 // tryhalfhealhealth (if full, jump to BattleScript_AlreadyAtFullHp, apply healing to user)
    09                // attackanimation
    0A                // waitanimation
    ...

    Obviously the command that would be of interest is 7B FB 9E 2D 08 01 but this just tells the game to run the tryhealhalfhealth command, where to jump to if HP is full, and who to heal, and says nothing about how much to heal. The fact that half HP is healed is actually hard-coded into the command, and there really isn't an alternative for other health values. You can actually see the decompiled code of this command here: https://github.com/pret/pokeemerald/blob/master/src/battle_script_commands.c#L6852

    I'll throw in the caveat that I am not really proficient with 3gen hacking (2gen is more of my forte) but the script engine works pretty similarly in both games on a conceptual level. You could change tryhalfhealhealth to instead take a parameter as the amount to heal (0x19 for quarter health, 0x32 for half health, 0x4b for 3/4 health, etc) rather than just a hard-coded 50% but that is a much more in-depth change and well beyond my expertise.
     
    Back
    Top