• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Fire Red]: Adding New Incense Items

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:

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!
 

Elaitenstile

I am legend
1,908
Posts
11
Years
  • Age 24
  • Seen Feb 27, 2015
This is AWESOME. I can only imagine the load of finding the offsets and that routine must've been a terror. It's nice to know that you've finally found a way to do this. Another reason why you are so awesome is this.

#nextbestthingtonewevostones

With this I may be able to get in Happiny and Mantyke without having to make them preavailable or direct breeding so many thanks, and Imma taking this rightaway!

Great work!

Er... another question. Can I make it like two items for a Pokémon A, and if item A is held then the egg contains Pokémon B, but if item B is held by the same Pokémon A, the egg contains Pokémon C?

This'd help me out with Fakemon ideas.
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
No, it's explicitly an extension of the existing system. To do anything more complex, like what you suggest, would require new custom ASM.
 
457
Posts
10
Years
  • Age 29
  • Seen Apr 9, 2024

Emerald New Incense Items Routine

Sorry for reviving an old thread... but, I have finally found the correct offsets for Emerald and here is the routine:
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 0x0807075D
decry:		.word 0x0806A675

Now, navigate to 0x70758, 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.

The next instructions are on the original post and it has the same procedure for Emerald. That's it! Credits to PurpleOrange for correcting me the r1's word.
 
Last edited:
Back
Top