Note: This is a tutorial for Fire Red only.
A couple of people have asked about this, so I'm going to post a tutorial on it. It's a bit of a complicated script, but nothing too earth-shattering.
There are two ways to do this - the first way is without compiling any ASM codes and using the Daycare Center code that is already in the game. The second is by using
HackMew's ASM code. Both work, but for a Pokemon you want to erase forever, the latter is the way to go, and it's very easy to assemble and put in your game if you know what you're doing. To understand how to do that, I recommend
HackMew's Knowledge as a tut.
Release Pokemon with Daycare Script (No ASM compiling)
Release Pokemon with HackMew's Routine (ASM Compiling Required)
So first I will give you the Daycare Center way of doing it:
Releasing Pokemon with the Daycare Center Script
First, be aware that in order to use this script, you have to use the
Pokémon Daycare Center script. So you'll need to remove Daycare Center from the game or alter the Daycare script itself. Otherwise, you'll need to learn ASM and use this
this thread to create a custom routine. Otherwise, for those who are ASM-deficient (like me) this is probably the best way to do this.
The script I'll be posting as a tutorial also checks to make sure you're releasing only a specific Pokémon. This is important if you're trying to create an event where a specific Pokémon needs to be taken from the player's party and not just any Pokémon selected by the player from his party. An example of this is in my AshGray hack, where I had to release Butterfree and only Butterfree, as Ash did in the Anime. If it can be any Poké, then just use the Daycare Center script, or compile that ASM routine thingie posted above.
Thanks to
this thread for helping me understand the Daycare Center script.
First, the whole script in all its glory, then the explanation:
Code:
#org @start
setvar 0x8004 0x19
special2 LASTRESULT 0x17C
compare LASTRESULT 0x1
if 0x1 goto @start2
release
end
'---------------
#org @start2
call @menu
special2 LASTRESULT 0x84
compare LASTRESULT 0x1
if 0x1 goto @cant
compare 0x8004 0x6
if 0x4 goto @goback
special2 LASTRESULT 0x85
compare LASTRESULT 0x0
if 0x1 goto @cant
special2 0x8005 0xBA
setvar 0x8004 0x19
bufferpokemon 0x0 0x8005
comparevars 0x8005 0x8004
if 0x0 goto @notthesame
goto @continue
'---------------
#org @menu
special 0x9F
waitstate
lock
faceplayer
copyvar 0x800A 0x8004
return
'---------------
#org @cant
msgbox @add MSG_NORMAL
special 0x3C
goto @start2
'---------------
#org @goback
msgbox @no MSG_NORMAL
goto @start2
'---------------
#org @notthesame
msgbox @thatsnot MSG_NORMAL
goto @start2
'---------------
#org @continue
special 0x176
cmdc3 0x2F
goto @release
'---------------
#org @release
msgbox @bye MSG_NORMAL
fanfare 0x101
waitfanfare
release
end
'---------------
@add
= Please add another Pokemon to your\nparty first!
'---------------
@no
= Come on! Don't you want to give up\nPikachu?
'---------------
@thatsnot
= Huh? That's [buffer1]! Not Pikachu!
'---------------
@bye
= Goodybe, Pikachu!
Now for the explanation (in spoilers):
This first part is needed if you want to force the player to give up a specific Pokémon. First thing we have to do is make sure that Poké is in their party! For this example, I'll use Pikachu as the Poké we want to check for. Pikachu is 0x19 in hex.
Code:
#org @start
setvar 0x8004 0x19
special2 LASTRESULT 0x17C
compare LASTRESULT 0x1
if 0x1 goto @start2
release
end
Now that we know the player has the Poké we want him to give up in his party, we can move on to the script that will have him "release" it by storing it in Daycare.
Code:
#org @start2
call @menu
special2 LASTRESULT 0x84
compare LASTRESULT 0x1
if 0x1 goto @cant
compare 0x8004 0x6
if 0x4 goto @goback
special2 LASTRESULT 0x85
compare LASTRESULT 0x0
if 0x1 goto @cant
special2 0x8005 0xBA
setvar 0x8004 0x19
bufferpokemon 0x0 0x8005
comparevars 0x8005 0x8004
if 0x0 goto @notthesame
goto @continue
'---------------
#org @menu
special 0x9F
waitstate
lock
faceplayer
copyvar 0x800A 0x8004
return
'---------------
#org @cant
msgbox @add MSG_NORMAL
special 0x3C
goto @start2
'---------------
#org @goback
msgbox @no MSG_NORMAL
goto @start2
'---------------
#org @notthesame
msgbox @thatsnot MSG_NORMAL
goto @start2
'---------------
#org @continue
special 0x176
cmdc3 0x2F
goto @release
'---------------
#org @release
msgbox @bye MSG_NORMAL
fanfare 0x101
waitfanfare
release
end
'---------------
@add
= Please add another Pokemon to your\nparty first!
'---------------
@no
= Come on! Don't you want to give up\nPikachu?
'---------------
@thatsnot
= Huh? That's [buffer1]! Not Pikachu!
'---------------
@bye
= Goodybe, Pikachu!
Okay, so that's the script! Now, because the Poké released isn't actually released, but just in daycare, it can be retrieved, in case you have an event where you have to give a Poké and receive it again later. This part of the Daycare script seems to do that:
Code:
setvar 0x8004 0x0
special2 LASTRESULT 0x17A
special 0xC6
copyvar 0x8008 LASTRESULT
countpokemon
subvar LASTRESULT 0x1
Just keep in mind, if you release a Poké by storing it in Daycare, and then release another Poké by storing it in Daycare later, the previous one is lost forever (which is essentially the same as releasing it - am I right? :)) - so it can only be retrieved if no other Pokémon are "released" in the same manner.
Now, moving on to the more efficient way using HackMew's erase Pokemon assembly code:
Release Specific Pokemon with HackMew's ASM
For this, I will just assume that you placed the ASM code at offset 0x800000. If not, just remember to add a 1 to whatever offset you put the ASM code at when using it in the script. Also, I will assume you want to release
Pikachu, whose # is 0x19.
And now, the script:
Code:
#org @start
call @pokemenu
special2 LASTRESULT 0x84
compare LASTRESULT 0x1
if 0x1 goto @cant
compare 0x8004 0x6
if 0x4 goto @goback
special2 LASTRESULT 0x85
compare LASTRESULT 0x0
if 0x1 goto @cant
special2 0x8005 0xBA
bufferpokemon 0x0 0x8005
goto @continue
'---------------
#org @pokemenu
special 0x9F
waitstate
return
'---------------
#org @cant
msgbox @cant2 MSG_NORMALOKéM..."
release
end
#org @cant2
= You can't release your last\nPOKéMON!
'---------------
#org @goback
msgbox @goback2 MSG_NORMAL
end
#org @goback2
= I'd rather not release Pikachu [.]
'---------------
#org @continue
compare 0x8005 0x19
if 0x1 goto @erase
goto @notpikachu
'---------------
#org @notpikachu
msgbox @notpikachu2 MSG_NORMAL
end
#org @notpikachu2
= That's a [buffer1], not a Pikachu!
'---------------
#org @erase
callasm 0x800001
goto @done
'---------------
#org @done
msgbox @done2 MSG_KEEPOPEN
closeonkeypress
release
end
#org @done2
= [player] released [buffer1]!\nGoodbye, [buffer1]!
Now, a brief explanation of how it works:
Code:
#org @start
call @pokemenu
special2 LASTRESULT 0x84
compare LASTRESULT 0x1
if 0x1 goto @cant
compare 0x8004 0x6
if 0x4 goto @goback
special2 LASTRESULT 0x85
compare LASTRESULT 0x0
if 0x1 goto @cant
special2 0x8005 0xBA
bufferpokemon 0x0 0x8005
goto @continue
'---------------
#org @pokemenu
special 0x9F
waitstate
return
'---------------
#org @cant
msgbox @cant2 MSG_NORMAL
release
end
#org @cant2
= You can't release your last\nPOKéMON!
'---------------
#org @goback
msgbox @goback2 MSG_NORMAL
end
#org @goback2
= I'd rather not release Pikachu [.]
'---------------
#org @continue
compare 0x8005 0x19
if 0x1 goto @erase
goto @notpikachu
'---------------
#org @notpikachu
msgbox @notpikachu2 MSG_NORMAL
end
#org @notpikachu2
= That's a [buffer1], not a Pikachu!
'---------------
#org @erase
callasm 0x800001
goto @done
'---------------
#org @done
msgbox @done2 MSG_KEEPOPEN
closeonkeypress
release
end
#org @done2
= [player] released [buffer1]!\nGoodbye, [buffer1]!
And there you go :)
I want to thank HackMew and his
Taking Away Pokemon Routine, as well as JPAN and his
Study on the Special and Special2 commands, for helping me understand some of the specials and how to get them to work.
Thanks for reading :)