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

(EMERALD) Scale EXP Gain by Level (ASM)

6
Posts
1
Years
    • Seen Jan 26, 2024
    Hey guys so I just finished writing this routine. What it does is change how much EXP you get depending on your Pokemon's Level compared to Opponent's Level. Specifically, for every 1 level difference, EXP will go up or down by about 13%. Increase is uncapped, decreased is capped at 65%. Example: 100 exp gained for beating a lv 15 with a lv 10 will become ~162 Exp with this mod.

    The Assembled Routine is ... (Disassembled at bottom)

    Code:
    10 88 F8 B4 00 25 14 4B 1B 78 64 26 73 43 13 4C 1B 19 54 33 1B 78 12 4C 24 78 74 43 11 4D 64 19 54 34 24 78 A3 42 11 D0 A3 42 05 D5 E3 1A 05 1C ED 08 6B 43 C0 18 09 E0 1B 1B 05 2B 04 D5 05 1C ED 08 6B 43 C0 1A 01 E0 05 23 F8 E7 F8 BC 08 60 89 46 05 48 00 47 00 00 20 00 04 02 EC 44 02 02 70 40 02 02 44 47 02 02 6B A6 04 08


    Open Emerald Rom in HxD, and add the above code in free space (bytes FF) in HxD. Write down the offset you added it. I added mine to 0x00EB3000


    Now to hook the routine and make it run, in HxD, now goto 0004A644 (This is our Hook Offset). At this offset, add in the code below.

    Code:
    00 48 00 47 (XX XX XX XX)




    Replace the XX's with a POINTER made from the offset you added the first code at (must turn offset into pointer).

    So mine looks like this.
    Code:
    00 48 00 47 01 30 EB 08

    To make the Pointer, take your offset (mine was 00EB3000), replace the first 0 byte to 08 (signifies Rom Memory) , add a 1 to the last byte, and then write the 4 bytes in reverse. Look below to see exactly how.

    1st step
    Code:
    00 EB 30 00

    2nd step
    Code:
    08 EB 30 00

    3rd step
    Code:
    08 EB 30 01

    Final step, reverse the bytes
    Code:
    01 30 EB 08

    And that is it. I just made this, tested it out and everything seems to be working in good order so far. There's a chance an error could come up in the math, like a exp value that is way bigger than it should be but i dont think so. Sorry if i didnt format this post that great, I don't post much lol. Any questions lemme know! Enjoy ! (Disassembled code below)

    Code:
    .THUMB
    .ALIGN 2
    
    LDRH R0, [R2]
    PUSH {R3-R7}
    MOV R5, #0
    LDR R3, = 0x02040020   @Current Player Pokemon Slot 
    LDRB R3, [R3]
    MOV R6, #0x64
    MUL R3, R6
    LDR R4, = 0x020244EC   @Player Party Pokemon Data
    ADD R3, R3, R4
    ADD R3, #0x54            @Adds offset for Level Data
    LDRB R3, [R3]
    LDR R4, = 0x02024070   @Current ENEMY Pokemon Slot
    LDRB R4, [R4]
    MUL R4, R6
    LDR R5, = 0x02024744   @ENEMY Party Pokemon Data
    ADD R4, R4, R5
    ADD R4, #0x54
    LDRB R4, [R4]
    CMP R3, R4
    BEQ RETURN
    CMP R3, R4
    BPL HIGHER_SAME
    SUB R3, R4, R3
    MOV R5, R0
    LSR R5, #0x3
    MUL R3, R3, R5
    ADD R0, R0, R3
    B RETURN
    
    HIGHER_SAME:
    SUB R3, R3, R4
    CMP R3, #0x5
    BPL FIVE_LV_OR_MORE
    
    CONT:
    MOV R5, R0
    LSR R5, #0x3
    MUL R3, R3, R5
    SUB R0, R0, R3
    B RETURN
    
    FIVE_LV_OR_MORE:
    MOV R3, #0x5
    B CONT
    
    
    
    RETURN:
    POP {R3-R7}
    STR R0, [R1]
    MOV R9, R1
    LDR R0, = 0x0804A66A+1
    BX R0
     
    Last edited:
    Back
    Top