Temporarily disabling EXP gains from battle
It was brought to my attention by some requesters that for their battle/tournament events they wouldn't want their Pokemon leveling up. This routine disables the exp gains in battle. Note that the player can still use stuff like Rare Candy to level. The fix to that is exactly the same as this, but with slight modifications. I hope you don't give the player a chance to rare candy in battle though or I will go to your hack's thread and severly criticize your lack of common sense :c
How to insert:
Compile and insert the following routine into free space:
Spoiler:
.text
.align 2
.thumb
.thumb_func
main:
push {r0-r3}
mov r0, #0xFF
lsl r0, r0, #0x1
add r0, r0, #0x4
ldr r2, =(0x806E6D0 +1) @checkflag 0xFF *0x2 + 4 = 0x202
bl linker
cmp r0, #0x1
beq skip
pop {r0-r3}
cmp r0, #0x64
beq noCrash
ldr r0, =(0x8021D24 +1)
bx r0
skip:
pop {r0-r3}
noCrash:
ldr r1, [r5]
add r1, #0x53
ldrb r0, [r1]
ldr r2, =(0x8021D04 +1)
linker:
bx r2
.align 2
Here's a compiled version:
0F B4 FF 20 40 00 04 30 07 4A 00 F0 0C F8 01 28 04 D0 0F BC 64 28 02 D0 04 48 00 47 0F BC 29 68 53 31 08 78 02 4A 10 47 D1 E6 06 08 25 1D 02 08 05 1D 02 08
Now navigate to 0x21CFA and insert the following byte changes:
00 00 00 49 08 47 XX XX XX 08
Where XX XX XX is the reverse hex pointer to where you inserted this routine +1.
Usage:
If flag 0x202 is set, the EXP gains will be disabled. Obviously, to re-enable just clear the flag.
Currently the way I'm doing this is by making the game act like the player's party is already max level, so therefore they don't gain exp :)