• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Cyndy, May, Hero (Conquest), or Wes - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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.

[Script] Instant Egg Hatcher script

luuma

searching for Meaning, offering HA numel
  • 162
    Posts
    11
    Years
    Here is a script that will hatch all the eggs a player is holding at once, and charge for each of them separately. Handy if you're implementing breeding mechanics and have discovered that running round in straight lines actually does not count as fun gameplay!

    This is a remarkably easy script to implement! Every single asm script required is already written in the rom. The script below is written for Emerald, but can be adapted to firered very easily.

    Credit to redriders180 for the basic idea, back in 2013 in the quick r&d thread
    Code:
    '---------------
    #dynamic 0xe70000 //[I]DECIDE ON THIS YOURSELF, choose the pointer you want to start searching from[/I]
    #org @delia //[I]call whatever offset you put this in to activate the script[/I]
    lockall
    faceplayer
    setvar 0x8007 0x0 
    setvar 0x8006 0x0
    showmoney 0x0 0x0 0x0 // [I]displays your player's dolla[/I]
    msgbox @helloimtheegghatcher MSG_YESNO '"Hello! I'm Delia the Egg hatcher,\..."
    compare LASTRESULT 0x1
    if 0x1 goto @hatchloop // [I]Always ask for consent before activating anyone's eggs[/I]
    msgbox @oh MSG_KEEPOPEN
    hidemoney 0x0 0x0
    relea[I]seall
    end
    
    #org [/I]@hatchloop
    Copyvar 0x8004 0x8007//[I]var 0x8004 (often known by its gamer tag of "lastresult") will be the input for special 149, which will look at the pokemon in the slot number given by this variable[/I]
    special2 0x8005 0x149 //[I]or 0x147 for frlg[/I]
    compare 0x8005 0x19C
    if 0x1 call @incubator //[I] if it is an egg, we hatch it and charge the player, then we try for the next pokemon[/I]
    addvar 0x8007 0x1
    compare 0x8007 0x6
    if 0x1 goto @finished //[I]and we stop once we've tried all 6[/I]
    goto @hatchloop
    
    #org @incubator
    checkmoney 0x3e8 0x0// [I]ADJUST EGG COST HERE (in hexadecimal)[/I]
    compare LASTRESULT 0x0
    if 0x1 goto @nomoneyleft
    special 0xC5 //[I]or 0xc2 for frlg[/I]
    waitstate
    paymoney 0x3E8 0x0// [I]ADJUST EGG COST HERE (in hexadecimal)[/I]
    showmoney 0x0 0x0 0x0
    setvar 0x8006 0x1
    return
    
    #org @finished
    compare 0x8006 0x1
    if 0x1 goto @hatchedegg
    msgbox @youidiotwhydidyoutellmetohatcheggswhenyoudidntevenhaveany Msg_keepopen// [I]tells you you have no eggs[/I]
    hidemoney 0x0 0x0
    releaseall
    end
    
    #org @nomoneyleft
    msgbox @lolyourepoor MSG_KEEPOPEN//[I] tells you you have run out of money but still have eggs[/I]
    hidemoney 0x0 0x0
    releaseall
    end
    
    
    #org @hatchedegg
    msgbox @tada MSG_KEEPOPEN// congratulates you on becoming a father
    hidemoney 0x0 0x0
    releaseall
    end
    
    '---------
    ' Strings
    '---------
    #org @helloimtheegghatcher
    = Hello! I'm Delia the Egg Hatcher,\nbut you can call me Eggs Dee!\pFor 1000[$] each, I can hatch your eggs!
    
    #org @oh
    = Oh. Some other time?
    
    #org @lolyourepoor
    = Oh! You haven't enough money\nto hatch all your eggs!
    
    #org @youidiotwhydidyoutellmetohatcheggswhenyoudidntevenhaveany
    = Oh[.] You don't have any eggs[.]
    
    #org @tada
    = All done! Take care of your new Pokémon!
     
    Last edited:
    Back
    Top