metapod23
Hardened Trainer
- 673
- Posts
- 16
- Years
- Seen Aug 18, 2016
I'm just reviving this thread to post that I figured out how to combine JPAN's routine of having a Pokemon obey once in a while and Jambo51's routine of having it only do so when a certain variable is or isn't set. Again, I want to thank colcolstyles, Jambo51, and JPAN for working on this for me! Thanks! :)
So here's the routine:
First place 00 49 08 47 at 0x0801D3F4, and the reversed pointer to the code below at 0x0801D3F8 (per JPAN's routine).
So here's the routine:
First place 00 49 08 47 at 0x0801D3F4, and the reversed pointer to the code below at 0x0801D3F8 (per JPAN's routine).
Code:
.text
.align 2
.thumb
.thumb_func
.global obedience
main:
cmp r0, #0x97 [b]@Mew's number, if you want it to disobey still[/b]
beq disobey
cmp r0, #0x05 [b]@Pokemon you want to disobey only sometimes [/b]
beq disobey [b](Charmeleon)[/b]
cmp r0, #0x06 [b]@Pokemon you want to disobey only sometimes[/b]
beq disobey [b](Charizard)[/b]
ldr r1, mew_check
bx r1
mew_check:
.word 0x0801D403
disobey:
ldr r0, =0x00006199 [b]@Variable you want to use[/b]
push {lr}
bl vardecrypt
pop {r1}
mov lr, r1
ldrh r0, [r0]
cmp r0, #0x00 [b]@the value of the variable you want to cause the[/b]
beq disobey2 [b]Pokemon to sometimes disobey[/b]
mov r0, #0x01
ldr r1, .RESUME
bx r1
disobey2:
ldr r1, random_addr
ldrb r1, [r1]
mov r0, #0xcd [b]the number, divided by 256, that will be the[/b]
cmp r1, r0 [b]percentage of how often the Pokemon disobeys[/b]
bgt is_obedient [b](in this case, cd (205)/256 = 80% disobey)[/b]
ldr r0, disobedient_ret_addr
bx r0
resume:
ldr r1, .RESUME
bx r1
vardecrypt:
ldr r1, .VARDEC
bx r1
is_obedient: mov r0, #0x1
pop {r4-r7,pc}
.hword 0x0000
.align 2
.RESUME:
.word 0x0801D42B
.DISOBEY:
.word 0x0801D415
.VARDEC:
.word 0x0806E455
random_addr:
.word 0x03005000
disobedient_ret_addr:
.word 0x0801d415