First off, a massive thank you to Spherical Ice who was kind enough to send me these scripts and routines for his "Mrs. Nature" feature in the upcoming version of Gaia. I posted this question earlier in the ASM ressource thread, but figured it might get a little more attention here. I'm just completely stuck on this, and any help would be massively appreciated. :)
Anyway, Spherical Ice sent me these scripts and routines for me to edit to implement the "Madam Celadon" NPC feature from the Let's Go games into my Fakemon FireRed hack - you know, an NPC you talk to which predicts the nature for future encounters, at least for a set amount of time - or, steps. The first two scripts and the first asm routine I don't have any trouble editing and inserting, but the second asm routine gives me some error messages that I don't really know how to tackle. I hope it's cool if I post everything here.
The "Mrs. Nature" script is inserted at 3B1B44
The "Nature manipulation" routine is inserted at 34F050
The "Wore off" script is inserted at 3ADDD4
And the "Pedometer" routine is supposed to be inserted at 3ADE14, but I can't convert it to a .bin file without getting these error messages:
I'm wondering if there's a different way I'm supposed to convert these, though, the only way I know is to put the .asm file in the same folder as thumb.bat, then navigate there with command prompt and type in "thumb routine.asm routine.bin". I've noticed that this gives me some ridiculously long files with these routines - I can tell that it's because the new routine is generated at the specified offset, and the new pointer is included and everything, I'm just wondering if I'm supposed to be doing something different.
Anyway, here's what I got from Spherical Ice, all credit goes to him. I hope it's okay to post this here, he was a little too busy himself. Everything is pretty much the way I've inserted it - I'll edit the dialogue later, but other than that, the offsets and everything should match the way I've been inserting these.
Anyway, Spherical Ice sent me these scripts and routines for me to edit to implement the "Madam Celadon" NPC feature from the Let's Go games into my Fakemon FireRed hack - you know, an NPC you talk to which predicts the nature for future encounters, at least for a set amount of time - or, steps. The first two scripts and the first asm routine I don't have any trouble editing and inserting, but the second asm routine gives me some error messages that I don't really know how to tackle. I hope it's cool if I post everything here.
The "Mrs. Nature" script is inserted at 3B1B44
The "Nature manipulation" routine is inserted at 34F050
The "Wore off" script is inserted at 3ADDD4
And the "Pedometer" routine is supposed to be inserted at 3ADE14, but I can't convert it to a .bin file without getting these error messages:
Code:
pedometer.asm:30: Warning: Failed to find real start of function: call_via_r2
pedometer.asm:39: Warning: Failed to find real start of function: call_via_r2
pedometer.asm:51: Warning: Failed to find real start of function: call_via_r2
pedometer.asm:58: Warning: Failed to find real start of function: call_via_r2
pedometer.asm:61: Warning: Failed to find real start of function: call_via_r2
pedometer.asm:28: Error: invalid offset, value too big (0xFFFFFFFC)
I'm wondering if there's a different way I'm supposed to convert these, though, the only way I know is to put the .asm file in the same folder as thumb.bat, then navigate there with command prompt and type in "thumb routine.asm routine.bin". I've noticed that this gives me some ridiculously long files with these routines - I can tell that it's because the new routine is generated at the specified offset, and the new pointer is included and everything, I'm just wondering if I'm supposed to be doing something different.
Anyway, here's what I got from Spherical Ice, all credit goes to him. I hope it's okay to post this here, he was a little too busy himself. Everything is pretty much the way I've inserted it - I'll edit the dialogue later, but other than that, the offsets and everything should match the way I've been inserting these.
Spoiler:
"Mrs. Nature" XSE script:
Nature manipulation ASM routine:
"Fortune wore off" XSE script:
Pedometer ASM routine: (This is the one that's giving me trouble, when I try to convert it to a .bin file)
Spoiler:
Code:
#dynamic 0x3B1B44
#define VAR_FLOWER_TO_WATER 0x40A9
#define VAR_FLOWER_TO_THIN 0x40AB
#define VAR_NATURE 0x40B0
#define VAR_FORTUNE_PEDOMETER 0x40B1
#org @start
lock
textcolor 0x1
msgbox @string1 MSG_KEEPOPEN
showmoney 0x0 0x0 0x0
msgbox @string2 MSG_YESNO
compare LASTRESULT 0x1
if 0x1 goto @snippet1
msgbox @string3 MSG_NORMAL
hidemoney 0x0 0x0
release
end
#org @snippet1
checkmoney 0x2710 0x0
compare LASTRESULT 0x1
if 0x5 goto @snippet2
hidemoney 0x0 0x0
msgbox @string4 MSG_KEEPOPEN
preparemsg @string5
multichoice 0x0 0x0 0x1E 0x1
copyvar 0x8004 LASTRESULT
compare 0x8004 0x0
if 0x1 goto @snippet3
compare 0x8004 0x1
if 0x1 goto @snippet4
compare 0x8004 0x2
if 0x1 goto @snippet5
compare 0x8004 0x3
if 0x1 goto @snippet6
compare 0x8004 0x4
if 0x1 goto @snippet7
goto @snippet8
#org @snippet2
msgbox @string6 MSG_NORMAL
hidemoney 0x0 0x0
release
end
#org @snippet3
setvar VAR_FLOWER_TO_WATER 0x1
goto @snippet9
#org @snippet4
setvar VAR_FLOWER_TO_WATER 0x2
goto @snippet9
#org @snippet5
setvar VAR_FLOWER_TO_WATER 0x3
goto @snippet9
#org @snippet6
setvar VAR_FLOWER_TO_WATER 0x4
goto @snippet9
#org @snippet7
setvar VAR_FLOWER_TO_WATER 0x5
goto @snippet9
#org @snippet8
msgbox @string7 MSG_NORMAL
release
end
#org @snippet9
msgbox @string8 MSG_KEEPOPEN
preparemsg @string9
multichoice 0x0 0x0 0x1E 0x1
copyvar 0x8004 LASTRESULT
compare 0x8004 0x0
if 0x1 goto @snippet10
compare 0x8004 0x1
if 0x1 goto @snippet11
compare 0x8004 0x2
if 0x1 goto @snippet12
compare 0x8004 0x3
if 0x1 goto @snippet13
compare 0x8004 0x4
if 0x1 goto @snippet14
goto @snippet8
#org @snippet10
setvar VAR_FLOWER_TO_THIN 0x1
goto @snippet15
#org @snippet11
setvar VAR_FLOWER_TO_THIN 0x2
goto @snippet15
#org @snippet12
setvar VAR_FLOWER_TO_THIN 0x3
goto @snippet15
#org @snippet13
setvar VAR_FLOWER_TO_THIN 0x4
goto @snippet15
#org @snippet14
setvar VAR_FLOWER_TO_THIN 0x5
goto @snippet15
#org @snippet15
msgbox @string10 MSG_NORMAL
spriteface 0x1 0x2
pause 0x10
msgbox @string11 MSG_NORMAL
pause 0x10
spriteface 0x1 0x1
msgbox @string12 MSG_KEEPOPEN
sound 0x15
applymovement 0x1 @move1
waitmovement 0x0
checksound
call @snippet16
msgbox @string13 MSG_KEEPOPEN
pause 0x30
closeonkeypress
showmoney 0x0 0x0 0x0
msgbox @string14 MSG_KEEPOPEN
sound 0xF8
paymoney 0x2710 0x0
updatemoney 0x0 0x0 0x0
checksound
closeonkeypress
setvar VAR_FORTUNE_PEDOMETER 0x0
hidemoney 0x0 0x0
release
end
#org @snippet16
compare VAR_FLOWER_TO_WATER 0x1
if 0x1 goto @snippet17
compare VAR_FLOWER_TO_WATER 0x2
if 0x1 goto @snippet18
compare VAR_FLOWER_TO_WATER 0x3
if 0x1 goto @snippet19
compare VAR_FLOWER_TO_WATER 0x4
if 0x1 goto @snippet20
goto @snippet21
#org @snippet17
compare VAR_FLOWER_TO_THIN 0x1
if 0x1 call @snippet22
compare VAR_FLOWER_TO_THIN 0x2
if 0x1 call @snippet23
compare VAR_FLOWER_TO_THIN 0x3
if 0x1 call @snippet24
compare VAR_FLOWER_TO_THIN 0x4
if 0x1 call @snippet25
compare VAR_FLOWER_TO_THIN 0x5
if 0x1 call @snippet26
return
#org @snippet18
compare VAR_FLOWER_TO_THIN 0x1
if 0x1 call @snippet27
compare VAR_FLOWER_TO_THIN 0x2
if 0x1 call @snippet28
compare VAR_FLOWER_TO_THIN 0x3
if 0x1 call @snippet29
compare VAR_FLOWER_TO_THIN 0x4
if 0x1 call @snippet30
compare VAR_FLOWER_TO_THIN 0x5
if 0x1 call @snippet31
return
#org @snippet19
compare VAR_FLOWER_TO_THIN 0x1
if 0x1 call @snippet32
compare VAR_FLOWER_TO_THIN 0x2
if 0x1 call @snippet33
compare VAR_FLOWER_TO_THIN 0x3
if 0x1 call @snippet34
compare VAR_FLOWER_TO_THIN 0x4
if 0x1 call @snippet35
compare VAR_FLOWER_TO_THIN 0x5
if 0x1 call @snippet36
return
#org @snippet20
compare VAR_FLOWER_TO_THIN 0x1
if 0x1 call @snippet37
compare VAR_FLOWER_TO_THIN 0x2
if 0x1 call @snippet38
compare VAR_FLOWER_TO_THIN 0x3
if 0x1 call @snippet39
compare VAR_FLOWER_TO_THIN 0x4
if 0x1 call @snippet40
compare VAR_FLOWER_TO_THIN 0x5
if 0x1 call @snippet41
return
#org @snippet21
compare VAR_FLOWER_TO_THIN 0x1
if 0x1 call @snippet42
compare VAR_FLOWER_TO_THIN 0x2
if 0x1 call @snippet43
compare VAR_FLOWER_TO_THIN 0x3
if 0x1 call @snippet44
compare VAR_FLOWER_TO_THIN 0x4
if 0x1 call @snippet45
compare VAR_FLOWER_TO_THIN 0x5
if 0x1 call @snippet46
return
#org @snippet22
setvar VAR_NATURE 0x1
bufferstring 0x0 @string15
return
#org @snippet23
setvar VAR_NATURE 0x2
bufferstring 0x0 @string16
return
#org @snippet24
setvar VAR_NATURE 0x4
bufferstring 0x0 @string17
return
#org @snippet25
setvar VAR_NATURE 0x5
bufferstring 0x0 @string18
return
#org @snippet26
setvar VAR_NATURE 0x3
bufferstring 0x0 @string19
return
#org @snippet27
setvar VAR_NATURE 0x6
bufferstring 0x0 @string20
return
#org @snippet28
setvar VAR_NATURE 0x7
bufferstring 0x0 @string21
return
#org @snippet29
setvar VAR_NATURE 0x9
bufferstring 0x0 @string22
return
#org @snippet30
setvar VAR_NATURE 0xA
bufferstring 0x0 @string23
return
#org @snippet31
setvar VAR_NATURE 0x8
bufferstring 0x0 @string24
return
#org @snippet32
setvar VAR_NATURE 0x10
bufferstring 0x0 @string25
return
#org @snippet33
setvar VAR_NATURE 0x11
bufferstring 0x0 @string26
return
#org @snippet34
setvar VAR_NATURE 0x13
bufferstring 0x0 @string27
return
#org @snippet35
setvar VAR_NATURE 0x14
bufferstring 0x0 @string28
return
#org @snippet36
setvar VAR_NATURE 0x12
bufferstring 0x0 @string29
return
#org @snippet37
setvar VAR_NATURE 0x15
bufferstring 0x0 @string30
return
#org @snippet38
setvar VAR_NATURE 0x16
bufferstring 0x0 @string31
return
#org @snippet39
setvar VAR_NATURE 0x18
bufferstring 0x0 @string32
return
#org @snippet40
setvar VAR_NATURE 0x19
bufferstring 0x0 @string33
return
#org @snippet41
setvar VAR_NATURE 0x17
bufferstring 0x0 @string34
return
#org @snippet42
setvar VAR_NATURE 0xB
bufferstring 0x0 @string35
return
#org @snippet43
setvar VAR_NATURE 0xC
bufferstring 0x0 @string36
return
#org @snippet44
setvar VAR_NATURE 0xE
bufferstring 0x0 @string37
return
#org @snippet45
setvar VAR_NATURE 0xF
bufferstring 0x0 @string38
return
#org @snippet46
setvar VAR_NATURE 0xD
bufferstring 0x0 @string39
return
#org @string1
= Hmm[.]\p[.]\pAha!\nYes!\pShall I foresee the Nature of\nthose allies you have yet to meet?
#org @string2
= I'll charge you just [$]10,000.\nWouldn't you like to know?
#org @string3
= Hmm[.]\nYes, perhaps it's best[.]
#org @string4
= Well then, let me ask you a few\nquestions.
#org @string5
= [red_fr]There are five flowers before you.\nWhich do you water?
#org @string6
= You don't have enough money!\nSomething so powerful isn't free!
#org @string7
= Hm[.] Well, return when you change\nyour mind.
#org @string8
= Heh.\nI see, I see[.]
#org @string9
= [red_fr]Now, among the flowers I mentioned,\nwhich would you thin, if needed?
#org @string10
= Understood[.]\nNow I will look into your future.
#org @string11
= [.] [.] [.] [.]\n[.] [.] [.] [.]\p[.] [.] [.] [.]\n[.] [.] [.] [.]\p[.] [.] [.] [.]\n[.] [.] [.] [.]\pAha!
#org @string12
= Fate is guiding your path.\pThe encounters you will have are\nlikely to have[.]
#org @string13
= Yes!\nA[buffer1][red_fr] Nature!
#org @string14
= I will accept your payment now.\nThank you!
#org @string15
= [green_fr]Hardy
#org @string16
= [green_fr]Lonely
#org @string17
= n [green_fr]Adamant
#org @string18
= [green_fr]Naughty
#org @string19
= [green_fr]Brave
#org @string20
= [green_fr]Bold
#org @string21
= [green_fr]Docile
#org @string22
= n [green_fr]Impish
#org @string23
= [green_fr]Lax
#org @string24
= [green_fr]Relaxed
#org @string25
= [green_fr]Modest
#org @string26
= [green_fr]Mild
#org @string27
= [green_fr]Bashful
#org @string28
= [green_fr]Rash
#org @string29
= [green_fr]Quiet
#org @string30
= [green_fr]Calm
#org @string31
= [green_fr]Gentle
#org @string32
= [green_fr]Careful
#org @string33
= [green_fr]Quirky
#org @string34
= [green_fr]Sassy
#org @string35
= [green_fr]Timid
#org @string36
= [green_fr]Hasty
#org @string37
= [green_fr]Jolly
#org @string38
= [green_fr]Naive
#org @string39
= [green_fr]Serious
#org @move1
#raw 0x62
#raw 0xFE
Nature manipulation ASM routine:
Spoiler:
Code:
.thumb
.equ free, 0x34F050
.equ VAR_NATURE, 0x40B0
.equ ABILITY_SYNCHRONIZE, 0x1C
.equ rom, 0x08000000
.org 0x3DDA4, 0xFF
ldr r0, =(rom + main + 1)
bx r0
.pool
.org free, 0xFF
main:
ldr r0, [sp, #0x2C]
lsl r0, r0, #0x18
lsr r5, r0, #0x18
lsl r1, r1, #0x10
lsr r1, r1, #0x10
mov r8, r1
lsl r2, r2, #0x18
lsr r7, r2, #0x18
lsl r3, r3, #0x18
lsr r6, r3, #0x18
fortune_check:
push {r5}
ldr r0, =(VAR_NATURE)
bl var_load
lsl r0, r0, #0x18
lsr r5, r0, #0x18
fortune:
cmp r5, #0
beq skip_fortune
cmp r5, #24
bhi skip_fortune
sub r0, r5, #1
pop {r5}
mov r5, r0
b end
skip_fortune:
pop {r5}
bl rand
lsl r0, r0, #0x18
lsr r0, r0, #0x18
cmp r0, #0
bls end
synccheck:
ldr r0, party_player
mov r1, #0x2E
mov r2, #0x0
bl getattr
mov r4, r0
ldr r0, party_player
mov r1, #0xB
mov r2, #0x0
bl getattr
ldr r2, base_stats
ldr r2, [r2]
mov r1, #0x1C
mul r0, r1
add r2, r0, r2
cmp r4, #0x0
beq ability0
ability1:
ldrb r1, [r2, #0x17]
b checkability
ability0:
ldrb r1, [r2, #0x16]
checkability:
cmp r1, #ABILITY_SYNCHRONIZE
bne end
copynature:
ldr r0, party_player
mov r1, #0x0
mov r2, #0x0
bl getattr
bl getnature
lsl r0, r0, #0x18
lsr r5, r0, #0x18
end:
ldr r0, return
bx r0
rand:
ldr r3, =(0x08044EC8|1)
bx r3
getattr:
ldr r3, =(0x0803FBE8|1)
bx r3
getnature:
ldr r3, =(0x08042EB4|1)
bx r3
var_load:
ldr r1, =(0x0806E568|1)
bx r1
.align 2
.pool
base_stats: .word 0x080001BC
return: .word 0x0803DDB8|1
party_player: .word 0x02024284
"Fortune wore off" XSE script:
Spoiler:
Code:
#dynamic 0x3ADDD4
#org @start
msgbox @string1 MSG_SIGN
end
#org @string1
= It seems as if the fortune\nforetold has worn off[.]
Pedometer ASM routine: (This is the one that's giving me trouble, when I try to convert it to a .bin file)
Spoiler:
Code:
.thumb
.equ free, 0x3ADE14
.equ VAR_FORTUNE_PEDOMETER, 0x40B1
.equ STEPS_TO_RESET_PEDOMETER, 2999
.equ scr_fortune_wore_off, 0x3ADDD4
.equ rom, 0x08000000
.org 0x3DDA4, 0xFF
ldr r0, =(rom + main + 1)
bx r0
.pool
.org free, 0xFF
main:
push {r4-r6,lr}
bl fortune_teller_pedometer
end:
pop {r4-r6}
pop {r2}
call_via_r2:
bx r2
fortune_teller_pedometer:
push {lr}
ldr r0, fortune_teller_nature
ldr r2, =(0x0806E568|1)
bl call_via_r2
lsl r0, r0, #0x10
lsr r0, r0, #0x10
cmp r0, #0
beq fortune_teller_return
ldr r4, =(VAR_FORTUNE_PEDOMETER)
ldr r5, =(STEPS_TO_RESET_PEDOMETER)
mov r0, r4
ldr r2, =(0x0806E568|1)
bl call_via_r2
lsl r0, r0, #0x10
lsr r1, r0, #0x10
ldr r2, =(0x0806E584|1)
cmp r1, r5
bhi fortune_teller_pedometer_at_max
fortune_teller_increment:
add r1, #1
lsl r1, r1, #0x10
lsr r1, r1, #0x10
mov r0, r4
bl call_via_r2
b fortune_teller_return
fortune_teller_pedometer_at_max:
ldr r0, =VAR_FORTUNE
mov r1, #0
ldr r2, =(0x0806E584|1)
bl call_via_r2
ldr r0, =(0x083ADDD4|1)
ldr r2, =(0x08069AE4|1)
bl call_via_r2
fortune_teller_return:
pop {pc}
.pool