The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary Hack Research & Development (https://www.pokecommunity.com/forumdisplay.php?f=195)
-   -   Development Forms and Formes (https://www.pokecommunity.com/showthread.php?t=341547)

daniilS January 1st, 2015 1:15 PM

Forms and Formes
 
Alright, I have been asked to share the routines I made for form(e) changing in Platinum Red & Blue multiple times, and I finally found the time to do so. This thread will be updated as I clean up old routines and create new ones. Enjoy.

Rotom & Deoxys
Spoiler:
This routine simply changes the index number of a Pokémon in your party.
Code:

.thumb

getpokeoffset:
        push {r4, lr}
        ldr r0, var8004
        ldrh r2, [r0]
        mov r0, #100
        mul r2, r0
        ldr r0, poke_slot_1
        add r4, r2, r0
getandsetnewindexnumber:
        ldr r2, var8005
        mov r1, #0xB
        mov r0, r4
        ldr r3, pokemon_setattr
        bl jump
recalc20bytes:
        mov r0, r4
        ldr r3, pokemon_calc_effective_stats
        bl jump
        pop {r4, pc}
jump:
        mov pc, r3

.align 2
        var8004:                        .word 0x020270B8 + 0x8004 * 2
        poke_slot_1:                        .word 0x02024284
        var8005:                        .word 0x020270B8 + 0x8005 * 2
        pokemon_setattr:                .word 0x0804037C
        pokemon_calc_effective_stats:        .word 0x0803e47c

/*insert anywhere. set var 0x8004 to the desired pokemon's slot and 0x8005 to the new index number, then callasm this routine+1.*/




Burmy
Spoiler:
These routines will transform any Burmy that enters the battlefield according to the terrain.

The first routine, burmytransformjump:
Code:

.thumb

main:
        ldr r3, burmytransform
        mov pc, r3

burmytransform:        .word 0x________        @address of burmytransform.asm here

continue:
        str r0, [sp]

/*insert at 08030D40*/


That routine loads a second routine, burmytransform:
Code:

.thumb

getdex:
        mov r1, #0xB
        ldr r3, pokemon_getattr
        bl jump
        mov r6, r0
        ldr r3, species_to_pokedex_index
        bl jump
compareburmy:
        ldr r1, burmy_dex
        cmp r0, r1
        bne ender
getform:
        ldr r0, idx_for_battle_screen_elements_by_env
        ldrb r0, [r0]
        lsl r0, #0x1
        ldr r2, area_to_burmy_cloak_table
        add r2, r0
        ldrh r0, [r2]
        cmp r0, #0x0
        beq ender
burmeeeeeeeeeeeeeeeeeeh:
        mov r0, r4
        mov r1, #0xB
        ldr r3, pokemon_setattr
        bl jump
ender:
        mov r0, r6
        ldr r3, return
jump:
        mov pc, r3

.align
        pokemon_getattr:                        .word 0x0803FBE8
        species_to_pokedex_index:                .word 0x08043298
        idx_for_battle_screen_elements_by_env:        .word 0x02022B50
        area_to_burmy_cloak_table:                .word 0x________        @pointer to burmytable here
        pokemon_setattr:                        .word 0x0804037C
        return:                                        .word 0x08030D48
        burmy_dex:                                .word ____                @dex number of burmy here

/*insert anywhere. place a pointer to this routine in burmytransformjump.*/


Now, this routine uses a so-called burmytable. It has ten halfword entries, being either zero or the index number of the following forms:
Code:

plant plant sandy 0000 0000 0000 sandy sandy trash plant


Insert it anywhere, and place a pointer to it in the routine above.


A note on spelling
Spoiler:
Please use the word forme for legendaries and form for other Pokémon. Thank you.

Joexv January 1st, 2015 2:27 PM

Oh my gosh you've finally RELEASED IT!!
I hope you release the arceus forms soon.

daniilS January 1st, 2015 2:46 PM

Quote:

Originally Posted by joexv (Post 8558927)
Oh my gosh you've finally RELEASED IT!!
I hope you release the arceus forms soon.

Yup, they're next! :D
Quote:

Originally Posted by Dark Zeta (Post 8558956)
I came home from work to this. I exploded from joy...

I really can't wait for the rest, but I do have a question. Will you be doing the moves related to Rotom?

Nope, the moves can be handled from the script. Ask Bela if you want an example


(by the way guys, an ugly version of this first routine has been available for quite some time :/)

LCCoolJ95 January 2nd, 2015 5:16 AM

....I'm lost, what does this routine do, and how can I implement it?

daniilS January 2nd, 2015 5:18 AM

Quote:

Originally Posted by LCCoolJ95 (Post 8560624)
....I'm lost, what does this routine do, and how can I implement it?

It changes the index number of the Pokémon in party slot X (var 0x8004) to Y (var 0x8005). Instructions on how to implement it are in the last line of the routine, as always.

Lance32497 January 2nd, 2015 6:55 AM

so the script

Quote:

...
special 0x9F
waitstate
compare 0x8004 0x0
if false goto @1
setvar 0x8005 0x85
callasm 0x800000
...
by the way, thanks for this routine

mkarthick98 January 2nd, 2015 8:30 AM

Yay, this is amazing! I have a doubt on this. Can I PM you?

daniilS January 2nd, 2015 8:58 AM

Quote:

Originally Posted by Lance32497 (Post 8560724)
so the script
by the way, thanks for this routine

I used this:
Code:

compare 0x8004 0x5
if 0x2 goto @end


Quote:

Originally Posted by mkarthick98 (Post 8560851)
Yay, this is amazing! I have a doubt on this. Can I PM you?

Of course

wally-217 January 2nd, 2015 10:02 AM

Apologies if this doesn't contribute much to the thread but when you say "Platinum Red & Blue", what do you mean by that? Which rom is this for?
- Thanks,

daniilS January 2nd, 2015 10:06 AM

Quote:

Originally Posted by wally-217 (Post 8560966)
Apologies if this doesn't contribute much to the thread but when you say "Platinum Red & Blue", what do you mean by that? Which rom is this for?
- Thanks,

By that I mean they're the routines used in this hack: link
Everything is just FR so far, until somebody ports it.

Lance32497 January 2nd, 2015 3:41 PM

Quote:

Originally Posted by daniilS (Post 8560884)
I used this:
Code:

compare 0x8004 0x5
if 0x3 goto @end


Of course

I dont get it xD
what is 0x3?

CosmicBlazer January 2nd, 2015 9:19 PM

Could this asm be used in a way to get Mega Evolutions? Just a theory. I dont know much about ASM xD so yeah.

daniilS January 3rd, 2015 3:34 AM

Quote:

Originally Posted by CosmicBlazer (Post 8562462)
Could this asm be used in a way to get Mega Evolutions? Just a theory. I dont know much about ASM xD so yeah.

Not in its current form. Touched and I might create something for it later.

Trainer 781 January 3rd, 2015 4:53 AM

Quote:

Originally Posted by daniilS (Post 8562765)
Not in its current form. Touched and I might create something for it later.

Will you work on Stance Change?

daniilS January 3rd, 2015 4:57 AM

Quote:

Originally Posted by KDS (Post 8562809)
Will you work on Stance Change?

Maybe later, together with megas (and Cherrim)

CosmicBlazer January 3rd, 2015 7:13 AM

Quote:

Originally Posted by daniilS (Post 8562765)
Not in its current form. Touched and I might create something for it later.

Alright well good luck on it. Thanks for everything you contribute.

daniilS January 3rd, 2015 8:10 AM

Quote:

Originally Posted by Lance32497 (Post 8561708)
I dont get it xD
what is 0x3?

I'm sorry, didn't see this one at first. Typo: I meant 0x2 , which means if greater than. Special 0x9F will return a party slot from 0 to 5, and 7 if no pokemon is selected.
Also, for the full script you need to check if the selected pokemon is in fact a Rotom or Deoxys too, of course.

EDIT: whoops, seems like I missed the fact that in Platinum you never actually have to select a Rotom or a Deoxys... :/
Derp here, so I guess this would require one of FBI's routines instead.

AtecainCorp. January 3rd, 2015 1:25 PM

It was any possible to convert this code into RUBY or EMERALD?

daniilS January 3rd, 2015 1:55 PM

Quote:

Originally Posted by Dark Zeta (Post 8563408)
Just a question.

Will you be going all out on Shaymin's formes?

Yes
Quote:

Originally Posted by Ksiazek Bartlomiej (Post 8563462)
It was any possible to convert this code into RUBY or EMERALD?

Yes

dangitpcwhydomypostsevenneedtobe25charactersthisisridiculous

BlackStorm20x January 3rd, 2015 2:09 PM

AWESOME. I'll need this for my hack. :D

Lance32497 January 3rd, 2015 3:15 PM

Quote:

Originally Posted by daniilS (Post 8563041)
I'm sorry, didn't see this one at first. Typo: I meant 0x2 , which means if greater than. Special 0x9F will return a party slot from 0 to 5, and 7 if no pokemon is selected.
Also, for the full script you need to check if the selected pokemon is in fact a Rotom or Deoxys too, of course.

EDIT: whoops, seems like I missed the fact that in Platinum you never actually have to select a Rotom or a Deoxys... :/
Derp here, so I guess this would require one of FBI's routines instead.

ahhhhh.... thanks I was just confused what and why 0x3

daniilS January 3rd, 2015 3:56 PM

Arceus and Giratina will have to wait because Game Freak ignored logic when coding the Pokémon Storage System. However, the first post has been updated for BURMY!

daniilS January 3rd, 2015 4:44 PM

Quote:

Originally Posted by Dark Zeta (Post 8563704)
Thank you for this.

On another note, what exactly were you referring to with Arceus and Giratina?

The routine that changes the index number based on hold item (and location).

daniilS January 4th, 2015 2:38 AM

Quote:

Originally Posted by Dark Zeta (Post 8563872)
I meant as to how it was messing up?

FR contains wayyyyyyyyyyyyy too many routines for giving/taking items while you're at the PC. So I have to edit them all! :D

Xencleamas January 5th, 2015 4:47 PM

Great job yo! How to port this on Emerald... does changing the offsets will work?


All times are GMT -8. The time now is 8:40 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.