23495-GBA_|_Otros_|_ROUTINE_ASM:_Change_status_of_pokemon
#0
Andrea 25004
Hello guys today I would like to offer you a little routine for asm
change the status of a pokemon of our team ^^
first of all we need to know where is the offset required in this case:
offset_stato: 030043B0
Between each pokemon status distance themselves 100 bytes
this is the routine that we will use :

but we look for good everywhere:
ldr r0 , .8000
ldrh r0 , [ r0 ]

except in 8000 var r0
ldr r1, .100
mul r1, r0

So here we load the value "100" in r1 and then multiply it with r0 ( the var 8000)
because we did ? to choose the pokemon you want to change the status ^^
first of all we need to set the var 8000 with the number of pokemon to infect for example, the 2 pokemon in team
setvar 0x8000 0x1 ( -1 we have to do to place in the team : C)
we said that the bytes of the team move away from each other by 100 bytes then the routine will multiply 1 by 100
1 * 100 = 100
then adds +100 to pokemon_data and we will have the offset of the state of 2 pokemon ^^
(it's a slightly convoluted reasoning x'D I hope you understand otherwise leave a comment )
ldr r0 , . pokemon_data
add r0 , r0 , r1

as I said before, the routine loads the pokemon_data and the sum of the product of the variable * 100.
sum pokemon_data + product and puts everything in r0
mov r1 , # 0x80
strb r1, [ r0 ]

we r1 in the value of 80 ( he was poisoned ), and finally save the byte :)
Finally here's a sample script:

If you have any questions or concerns do not hesitate to ask ^^