Jambo51
Glory To Arstotzka
- 736
- Posts
- 14
- Years
- Seen Jan 28, 2018
Ever wondered how the Incense items are handled in Gen 3, and have you ever wondered about adding NEW Incense items? Well, wonder no more! As always, what I present works on BPRE 1.0 only, but could easily be ported over to RSE.
First up, some more ASM code to assemble:
Now, navigate to 0x45FB4, and put in an ASM branch by changing the code to:
Where the XX's are to point to the insert location of your routine + 1 for THUMB mode.
Finally, you need to add a new table to your ROM, and repoint the newtable: .word 0x08FFFFFF to it. The table should be arranged as such:
Now, I head you ask, why are there 2 species? Well, the first species ID is the baby Pokémon. That is, if we were adding Marill to the table, the species ID we would put first would be Azurill's. Get it? Remember, you must put the index number of the Pokémon, NOT it's national dex number.
After that, you put in the ID of the item which allows you to breed to the baby species. Simple enough.
Finally, you put the species that it should revert to if the item is absent. So, in the above example, I'd put Marill's index number.
Thus, the final result (if I were doing Marill/Azurill egg changing) would be:
You simply repeat this until you have completed all the new Pokémon, and then tag on a FE FE 00 00 to finish it off
The FEFE0000 at the end is necessary to limit the table length. On reading that number, the game will stop searching for egg species.
The table can be as long or as short as you desire. Just ensure it's correctly aligned and has the FEFE0000 delimiter at the end.
Please note, you should not put Azurill/Marill or Wynaut/Wobbuffet on your new table because they are handled before this routine. This table is explicitly for NEW incense style items/pokemon combinations!
First up, some more ASM code to assemble:
Code:
.text
.align 2
.thumb
.thumb_func
.global eggspecieschangeitem
main:
mov r0, #0xAF
lsl r0, r0, #0x1
cmp r1, r0
bne newchecks
ldr r0, returnone
bx r0
newchecks: bl getparentdata
push {r3-r5,r7}
ldr r7, terminator
ldr r4, newtable
mov r0, #0x0
loop: lsl r3, r0, #0x1
add r3, r3, r0
lsl r3, r3, #0x1
add r3, r3, r4
ldrh r5, [r3, #0x0]
cmp r5, r7
beq end
cmp r1, r5
bne skip
ldrh r5, [r3, #0x2]
cmp r2, r5
beq end
cmp r6, r5
beq end
ldrh r1, [r3, #0x4]
b end
skip: add r0, #0x1
b loop
end: pop {r3-r5,r7}
add r0, r1, #0x0
strh r0, [r4, #0x0]
pop {r4-r7}
pop {r0}
bx r0
getparentdata: push {lr}
push {r1}
add r0, r5, #0x0
mov r1, #0xC
bl decrypt
add r6, r0, #0x0
add r0, r5, #0x0
add r0, #0x8C
mov r1, #0xC
bl decrypt
add r2, r0, #0x0
pop {r1}
pop {r0}
bx r0
decrypt: ldr r2, decry
bx r2
.align
terminator: .word 0x0000FEFE
newtable: .word 0x08FFFFFF
returnone: .word 0x08045FB9
decry: .word 0x0803FD45
Now, navigate to 0x45FB4, and put in an ASM branch by changing the code to:
Code:
00 48 00 47 XX XX XX 08
Where the XX's are to point to the insert location of your routine + 1 for THUMB mode.
Finally, you need to add a new table to your ROM, and repoint the newtable: .word 0x08FFFFFF to it. The table should be arranged as such:
Code:
[Species - Half-Word][Held Item - Half-Word][Species 2 - Half-Word]
Now, I head you ask, why are there 2 species? Well, the first species ID is the baby Pokémon. That is, if we were adding Marill to the table, the species ID we would put first would be Azurill's. Get it? Remember, you must put the index number of the Pokémon, NOT it's national dex number.
After that, you put in the ID of the item which allows you to breed to the baby species. Simple enough.
Finally, you put the species that it should revert to if the item is absent. So, in the above example, I'd put Marill's index number.
Thus, the final result (if I were doing Marill/Azurill egg changing) would be:
Code:
5E 01 DC 00 B7 00
You simply repeat this until you have completed all the new Pokémon, and then tag on a FE FE 00 00 to finish it off
Code:
5E 01 DC 00 B7 00 FE FE 00 00
The FEFE0000 at the end is necessary to limit the table length. On reading that number, the game will stop searching for egg species.
The table can be as long or as short as you desire. Just ensure it's correctly aligned and has the FEFE0000 delimiter at the end.
Please note, you should not put Azurill/Marill or Wynaut/Wobbuffet on your new table because they are handled before this routine. This table is explicitly for NEW incense style items/pokemon combinations!