Registrarse

[ASM] E, FR | Scale Exp Gain by Level (NEW Formula Added 9.29)

icyred21023

Usuario de plata
(I just ported this over to FireRed , it matched up perfectly! Port is in Spoilers color matched )

This is for Pokemon Emerald US (BPEE )
( FireRed Port is for 1.0 US Squirrels Version )

*Just made new and improved formula for Emerald. Open Spoiler below this line to see*
Formula.png
Spreadsheet.png

To use just use this Assembled or Disassembled Code instead of whats in the Original Post. Enjoy!
Código:
1088FEB418490978184A642671435431
89180978164A127872435432154BD218
1278141C0B1C6427FE1A3D1B92194919
0D1C161C69437243D2011D1C01B4101C
0D4B00F00FF8021C01BCAC4203D9661B
75436D0840195043C009FEBC08608946
064800471847000020000402EC440202
704002024447020241752E086BA60408
.THUMB
.ALIGN 2

LDRH R0, [R2]
PUSH {R1-R7}
LDR R1, = 0x02040020 @Current Player PKM Slot
LDRB R1, [R1]
LDR R2, = 0x020244EC @Player Party Data
MOV R6, #0x64 @pkm Offset
MUL R1, R6
ADD R1, #0x54 @pkm LV Data Offset
ADD R1, R1, R2
LDRB R1, [R1] @PLAYER LEVEL
LDR R2, = 0x02024070 @Enemy PKM Slot
LDRB R2, [R2]
MUL R2, R6
ADD R2, #0x54
LDR R3, = 0x02024744 @Enemy Party Data
ADD R2, R2, R3
LDRB R2, [R2] @ENEMY LEVEL
MOV R4, R2 @R4 and R2 = Enemy Level
MOV R3, R1 @R3 and R1 = Player Level
MOV R7, #0x64
SUB R6, R7, R3
SUB R5, R7, R4
ADD R2, R6
ADD R1, R5
MOV R5, R1
MOV R6, R2
MUL R1, R5
MUL R2, R6
LSL R2, #0x7
MOV R5, R3
PUSH {R0}
MOV R0, R2
LDR R3, = 0x082E7540+1 @Division Routine Address
BL LINKER
MOV R2, R0
POP {R0}
CMP R4, R5
BLS UNDERFLOW_EQUAL
SUB R6, R4, R5
MUL R5, R6
LSR R5, #0x1
ADD R0, R5

UNDERFLOW_EQUAL:
MUL R0, R2
LSR R0, #0x7
POP {R1-R7}
STR R0, [R1]
MOV R9, R1
LDR R0, = 0x0804A66A+1
BX R0


LINKER:
BX R3 @Division R0 = R0 / R1



Hey guys so I just finished this writing 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)

emerald:
Enriquecido (Código BB):
 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

Enriquecido (Código BB):
 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 3 4
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 84 42 02 02 D0 3B 02 02 2C 40
02 02 AB 1D 02 08


Open Emerald Rom in HxD, and add the above code in free space (FF bytes) 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 ).

00021D80

At this offset, add in the code below.

Código:
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.
Código:
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
Código:
00 EB 30 00
2nd step
Código:
08 EB 30 00
3rd step
Código:
08 EB 30 01
4th step, reverse the bytes
Código:
01 30 EB 08
Now just put it all together and overwrite at Hook Offset !
Código:
00 48 00 47 (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 an exp value that is way bigger than it should be but I don't think so. Sorry if I didn't format this post that great, I don't post much lol. Any questions let me know! Enjoy! (Disassembled code below)

.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

.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, =0x02024284 @Player Party Pokemon Data
ADD R3, R3, R4
ADD R3, #0x54 @Adds offset for Level Data
LDRB R3, [R3]
LDR R4, = 0x02023BD0 @Current ENEMY Pokemon Slot
LDRB R4, [R4]
MUL R4, R6
LDR R5, = 0x0202402C @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, = 0x08021DAA+1
BX R0
 
Última edición:

Draizehn

Retired.
Miembro del equipo
Moderador/a
It looks good, I'm interested!

Can it be adapted for Fire Red, or is there already one?
 

icyred21023

Usuario de plata
It looks good, I'm interested!

Can it be adapted for Fire Red, or is there already one?
Thanks!

I'm almost certain my exact code can be ported to Fire Red. Ik the romhack Radical Red has its own version of this implemented, but as for guides to diy online, I couldnt find a thing so thats why I ended up doing this completely on my own. It definitely can be ported to Ruby/Sapphire, and im pretty confident I could port it to Fire Red if i have some free time soon to do it.
 

Draizehn

Retired.
Miembro del equipo
Moderador/a
Thanks!

I'm almost certain my exact code can be ported to Fire Red. Ik the romhack Radical Red has its own version of this implemented, but as for guides to diy online, I couldnt find a thing so thats why I ended up doing this completely on my own. It definitely can be ported to Ruby/Sapphire, and im pretty confident I could port it to Fire Red if i have some free time soon to do it.
Great!

I'll be looking forward to it, it wouldn't be bad to port it to Fire Red.
I hope you have that free time to pass the routine. ;)

- Bye
 

icyred21023

Usuario de plata
Great!

I'll be looking forward to it, it wouldn't be bad to port it to Fire Red.
I hope you have that free time to pass the routine. ;)

- Bye
I got it ported to FireRed! I added the port in my original post above!

The code was a perfect match for FireRed. I tested it out and it seems to be working correctly, if you or anybody else notice it acting weird in FireRed let me know 👍

-Cheers!
 

Draizehn

Retired.
Miembro del equipo
Moderador/a
I got it ported to FireRed! I added the port in my original post above!

The code was a perfect match for FireRed. I tested it out and it seems to be working correctly, if you or anybody else notice it acting weird in FireRed let me know 👍

-Cheers!
Very good, friend! I'm going to give it a try and see how it goes. Do you have Discord?
I'll let you know how it turns out.
Goodbye! 😁
 

icyred21023

Usuario de plata
Very good, friend! I'm going to give it a try and see how it goes. Do you have Discord?
I'll let you know how it turns out.
Goodbye!😁
Yeah I do, 9thgenBae#9831

Btw I found and corrected a bug with my code. When an HP stealing move was used to win a battle, it was corrupting the EXP value. I fixed it and updated it above. It was only 1 byte change, in case you already added!
 

icyred21023

Usuario de plata
Just added a New, and I believe, Improved Formula for Pokemon Emerald. Added it to main post above in spoilers.
Here are pictures showing the Equation and Real Examples
Formula.png


Spreadsheet.png
 

Vent

グラフィックの神
I tried the FR routine and doesn't work.
FR Scale Exp Doesn't Work.gif

Edit:
Now it works, here is the correct compiled routine:
Enriquecido (Código BB):
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 84 42 02 02 D0 3B 02 02 2C 40 02 02 AB 1D 02 08
Results:
FR Scale Exp Working.gif

(Eevee gains more Exp because that Doublade was Lv. 20)
 
Última edición:

Axcellerator

Pequeño saltamontes
I tried the improved one for Emerald today, and while it seems better than the previous one, there seems to be an issue when too much exp is given causing a "?" to appear before the number.
 
Arriba