Get Party Pokemon Data
4.18
Description Loading...
Credits:
Defa
How To
Add the following ASM routine to free space (see guide 1.10) and note the offset
push {lr}
ldr r1, =(0x020370C0) @var4
ldrh r0, [r1]
mov r2, #100
mul r2, r0
ldr r0, =(0x02024284) @gPlayerParty
add r0, r0, r2
ldrh r1, [r1, #2] @var5
ldr r2, =(0x02021CD0) @buffer1
ldr r3, =(0x0803FBE9) @GetMonData
bl linker
ldr r1, =(0x020370D0) @varResult
strh r0, [r1, #0]
pop {pc}
linker: bx r3
Set var4 to the party slot
Set var5 to the number of the data you want to retrieve (List Here)
Use callasm <offset+1> as usual. The returning value is stored in varResult
NOTE: If you set var5 to 2 (nickname) or 7 (OT name), the text string is stored in buffer1; varResult is set to the maximum length of the text string (10 for nickname, 3 for nickname if it's an Egg, 7 for nickname if it's a Bad Egg, 7 for OT name). NOTE: Avoid to set var5 to 81 (known Moves), it's a bit complicated to set up and the returning value is not easy to interpret. If you need to check whether a Pokémon knows a certain Move, set var5 to 13 (Move 1), then make a loop where you check whether varResult is equal to the Move id and add 1 to var5 three times to check all Move slots.
Example Script:
section0:
setvar var4 0 #first party slot
setvar var5 13 #Mon_Data_Move1
goto section1 #loop
section1:
callasm <offset+1> #routine
if.compare.goto varResult == 7 section2 #check for Fire Punch (Move id 7)
addvar var5 1 #check the next Move slot
if.compare.goto var5 < 17 section1 #loop back
msgbox.npc <auto> #loop ends, the Pokemon does not know the Move
{
The Pokémon does not know Fire Punch.
}
end
section2: #the Pokemon knows the Move
subvar var5 12 #optional, if you want to know the slot
buffernumber buffer1 0x8005 #var5
msgbox.npc <auto>
{
The Pokémon knows Fire Punch,
it's in slot [buffer1].
}
endHappy Hacking!
