top of page

Hatch Eggs Instantly & Silently

5.26

This assembly routine hatches all Eggs in party and skips the hatch animation. Useful for debugging or if you want to add an Npc or a machine in your romhack that offers this as a service. It also increments the "hatched Eggs" game stat and sets varResult to the number of Eggs hatched this way.

HMA Discord Link 2.png

Credits:

Defa


How To

Use callasm <offset+1> as usual in a script to run the routine.


Add the following routine to free space and note the offset:

@All Eggs in party are hatched instantly,
@without hatching animation or message boxes.
@Also increments "hatched Eggs" game stat counter.
@Sets varResult to the number of Eggs hatched.
main:
    push  {r4-r6, lr}
    mov   r4, #0 @loop index
    ldr   r5, =(0x02024284) @gPlayerParty
    mov   r6, #0 @count Eggs hatched
loop:
    mov   r0, r5
    mov   r1, #11 @MON_DATA_SPECIES
    ldr   r3, GetMonData
    bl    linker
    cmp   r0, #0
    beq   end @empty slot, no other Pokemon after it
    mov   r0, r5
    mov   r1, #45 @MON_DATA_IS_EGG
    ldr   r3, GetMonData
    bl    linker
    cmp   r0, #0
    beq   skip
    mov   r0, r4
    ldr   r3, =(0x08046D61) @AddHatchedMonToParty
    bl    linker
    mov   r0, #13 @GAME_STAT_HATCHED_EGGS
    ldr   r3, =(0x08054E91) @IncrementGameStat
    bl    linker
    add   r6, r6, #1
skip:
    add   r4, r4, #1
    add   r5, r5, #100
    cmp   r4, #6
    blt   loop
end:
    ldr   r0, =(0x020370D0) @varResult
    strh  r6, [r0]
    pop   {r4-r6, pc}
GetMonData: .word 0x0803FBE9
linker: bx r3

Happy Hacking!

 


bottom of page