The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Creative Discussions > Emulation & ROM Hacking > Research & Development
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Research & Development Got a well-founded knack with ROM hacking? Love reverse-engineering the Pokémon games? Or perhaps you love your assembly language. This is the spot for polling and gathering your ideas, and then implementing them! Share your hypothesis, get ideas from others, and collaborate to create!
New threads in this forum are to be approved by a moderator before they are displayed. The thread revival limit does not apply here.


Reply
 
Thread Tools
  #1    
Old March 6th, 2010, 12:44 PM
metapod23's Avatar
metapod23
Hardened Trainer
 
Join Date: Mar 2009
Gender: Male
Nature: Timid
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
Spoiler:
Sets a Pokémon species # to variable 0x8004. In this case it's Pikachu, since we used 0x19.
special2 LASTRESULT 0x17C compare LASTRESULT 0x1 if 0x1 goto @start2
Spoiler:
This checks to see if the player has said Poké in his party. If so it goes to @start2.
release end
Spoiler:
If the player doesn't have said Poké in his party, the script ends.
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
Spoiler:
calls @menu, which brings up the select a Pokémon menu
special2 LASTRESULT 0x84
Spoiler:
this checks to see if you have only one Poké in your party
compare LASTRESULT 0x1 if 0x1 goto @cant
Spoiler:
if you have only one Poké, script goes to @cant
compare 0x8004 0x6 if 0x4 goto @goback
Spoiler:
this checks to see if you hit B to go back. If so, it takes you to @goback
special2 LASTRESULT 0x85
Spoiler:
checks to see if last Poké is an egg
compare LASTRESULT 0x0 if 0x1 goto @cant
Spoiler:
if your last Poké would be an egg, goes to @cant
special2 0x8005 0xBA
Spoiler:
this sets the Pokémon species # selected in the menu to variable 0x8005 - this is very important to this script
setvar 0x8004 0x19
Spoiler:
This sets a Pokemon species to variable 0x8004. For this example I'm using Pikachu, who's Pokémon species # is 0x19. This is the particular Pokémon you want to make sure the player releases.
bufferpokemon 0x0 0x8005
Spoiler:
This stores the name of the Poké selected from the menu in a buffer. Only necessary if you're writing a dialogue in which that Poké's name will be spoken.
comparevars 0x8005 0x8004
Spoiler:
This compares the information in variables 0x8005 and 0x8004 to each other. If you'll recall, the info for the Pokémon species selected from the menu was stored in 0x8005, and the info for the Pokémon species we want to be taken from the player was stored in 0x8004.
if 0x0 goto @notthesame
Spoiler:
If the the species numbers of the Poké stored in 0x8004 and 0x8005 do not match, the script goes to @notthesame.
goto @continue
Spoiler:
goes to @continue only if none of the above things occur
'--------------- #org @menu special 0x9F waitstate lock faceplayer copyvar 0x800A 0x8004 return
Spoiler:
This part of the script pretty much brings up the Pokémon selection menu
'--------------- #org @cant msgbox @add MSG_NORMAL special 0x3C
Spoiler:
this special opens up the Pokémon PC - only use this if it's imperative to give away the Poké at this time. Otherwise just have the script release and end here.
goto @start2 '--------------- #org @goback msgbox @no MSG_NORMAL goto @start2
Spoiler:
This is the script for if the player chooses to hit B and go back when he's in the Pokémon selection menu. If forcing the player to give away a certain Pokémon, then have this script return to the beginning. If not, then have it end here.
'--------------- #org @notthesame msgbox @thatsnot MSG_NORMAL goto @start2
Spoiler:
This is the script for if the Poké selected doesn't match the one we want the player to give up. Again, if it's imperative that the player give up the Poké, have him go back to the beginning. If not, have the script end.
'--------------- #org @continue special 0x176 cmdc3 0x2F goto @release
Spoiler:
This code puts the Pokémon selected in the Daycare, then goes to @release.
'--------------- #org @release msgbox @bye MSG_NORMAL fanfare 0x101 waitfanfare release end
Spoiler:
shows the @bye message, plays a fanfare, and ends the script. Yep, the Pokémon you wanted the player to release is definitely gone!
'--------------- @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
Spoiler:
This is the dynamic offset for the beginning of your script :)
call @pokemenu
Spoiler:
calls dynamic offset for @pokemenu, which opens the Pokemon menu to select a Pokemon from your party
special2 LASTRESULT 0x84
Spoiler:
special 0x84 counts the # of Pokemon in your party (countpokemon could probably work here as well) and stores it in variable indicated (in this case - lastresult)
compare LASTRESULT 0x1 if 0x1 goto @cant
Spoiler:
this compares the # stored in lastresult (# of Pokemon in party) to 0x1 - if you only have 1 Pokemon, takes you to dynamic offset @cant, which ends the script
compare 0x8004 0x6
Spoiler:
checks to see if you hit the Back button (B on GBA, X on comp)
if 0x4 goto @goback
Spoiler:
if you hit Back, goes to dynamic offset @goback, which ends the script
special2 LASTRESULT 0x85
Spoiler:
special 0x85 gets Pokemon data and stores it in the selected variable (lastresult in this case) - it's used for determining if your last Pokemon would be an egg
compare LASTRESULT 0x0 if 0x1 goto @cant
Spoiler:
determine the data gotten from special 0x85 is an egg or not. If the last pokemon would be an egg, goes to dynamic offset @cant, which ends the script
special2 0x8005 0xBA
Spoiler:
gets the # of the Pokemon you selected and stores it in indicated variable (in this case, variable 0x8005)
bufferpokemon 0x0 0x8005
Spoiler:
Buffers the name of the Pokemon you selected to the first buffer
goto @continue
Spoiler:
if none of the above conditions are meant, the script is safe to continue - goes to dynamic offset @continue
'--------------- #org @pokemenu special 0x9F waitstate return
Spoiler:
special 0x9f opens the Pokemon menu and (with waitstate) waits for you to make a selection
'--------------- #org @cant msgbox @cant2 MSG_NORMAL release end
Spoiler:
exits the Pokemon menu and plays @cant2 message
#org @cant2 = You can't release your last\nPOKéMON! '--------------- #org @goback msgbox @goback2 MSG_NORMAL end
Spoiler:
exits the Pokemon menu and plays @goback2 message
#org @goback2 = I'd rather not release Pikachu [.] '--------------- #org @continue compare 0x8005 0x19
Spoiler:
compares the Pokemon you selected from the Pokemon menu to see if it is a Pikachu
if 0x1 goto @erase
Spoiler:
If it is Pikachu, goes to dynamic offset @erase
goto @notpikachu
Spoiler:
Otherwise, goes to dynamic offset @notpikachu
'--------------- #org @notpikachu msgbox @notpikachu2 MSG_NORMAL end
Spoiler:
exits the Pokemon menu and plays @notpikachu2 message
#org @notpikachu2 = That's a [buffer1], not a Pikachu! '--------------- #org @erase callasm 0x800001
Spoiler:
calls HackMew's ASM routine for erasing Pokemon. Normally we would have to set 0x8004 to the correct slot # in our party, making things difficult, but luckily special 0x9f has already stored the slot # of the Pokemon we selected in variable 0x8004 for us. With the slot # already stored in the correct variable by this special, we can just call HackMew's ASM to erase the Pokemon we selected :)
goto @done
Spoiler:
after running HackMew's routine, goes to dynamic offset @done
'--------------- #org @done msgbox @done2 MSG_KEEPOPEN closeonkeypress release end
Spoiler:
plays the @done2 message and ends the script
#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
__________________

Last edited by metapod23; April 20th, 2011 at 01:06 PM.
Reply With Quote
  #2    
Old March 16th, 2010, 10:27 AM
Giga Universe's Avatar
Giga Universe
Working on a tool.
 
Join Date: Aug 2007
Location: South Africa
Age: 19
Gender: Male
Nature: Calm
Send a message via ICQ to Giga Universe Send a message via AIM to Giga Universe Send a message via Yahoo to Giga Universe Send a message via Skype™ to Giga Universe
You don't need to learn ASM to remove Pokémon. Several ASM hackers have done it already, all you have to do is assemble their code, and compile a much shorter and more easy to understand script. Here is a link to HackMew's routine, for all versions.
http://www.pokecommunity.com/showthread.php?t=206138
You don't even need to understand it to get it to work.
__________________
Reply With Quote
  #3    
Old February 17th, 2011, 08:57 AM
LightOfTruth's Avatar
LightOfTruth
Likes Hacks and Official Games
 
Join Date: Feb 2010
Why would one would want a script to remove Pokemon from there party if they can remove Pokemon via the PC. I think I would rather have the daycare so its not for me. Unless its just for a certain length of time like the S zone
__________________

Get some Sims 3 stuff now




Reply With Quote
  #4    
Old February 17th, 2011, 09:25 AM
Crimson5M's Avatar
Crimson5M
Please call me Crimson
 
Join Date: Feb 2011
Location: Scotland
Age: 18
Gender: Male
Nature: Quiet
Quote:
Originally Posted by LightOfTruth View Post
Why would one would want a script to remove Pokemon from there party if they can remove Pokemon via the PC. I think I would rather have the daycare so its not for me. Unless its just for a certain length of time like the S zone
Because this way permanently removes the Pokemon. For instance, you could have a sidequest where you have to take a Pokemon somewhere and give it to someone, or a thief steals your Pokemon.
__________________

Because it should've won HotY.
Pear
Frodo Baggins
Twitter
Youtube
CBC
Reply With Quote
  #5    
Old February 22nd, 2011, 06:37 PM
metapod23's Avatar
metapod23
Hardened Trainer
 
Join Date: Mar 2009
Gender: Male
Nature: Timid
Quote:
Originally Posted by LightOfTruth View Post
Why would one would want a script to remove Pokemon from there party if they can remove Pokemon via the PC. I think I would rather have the daycare so its not for me. Unless its just for a certain length of time like the S zone
I've needed it countless times for my hack. Storing it in the PC wouldn't work for events where the Pokemon is stolen, released, given away, etc.

And also, I added a second tutorial that shows you how to do this with HackMew's custom ASM, which would allow you to not use the Daycare Center script. I just left the Daycare tutorial for anyone who might need to know how to do this for a script in which they need the Pokemon taken away and then returned again afterward.
__________________
Reply With Quote
  #6    
Old May 22nd, 2011, 10:05 PM
Roboto-kun's Avatar
Roboto-kun
is an Ace Trainer.
 
Join Date: Apr 2011
Gender: Male
Nature: Jolly
Hey, Metapod! Uhm, Pikachu is 0x19... How do you know it's 0x19? Can you give me a list or something? o.O As far as I know, Pikachu is 25 in Pokedex. Thanks. :]

Edit: Uhm, nevermind. They're hex numbers.
Reply With Quote
  #7    
Old October 25th, 2011, 08:53 AM
Leafbarrett's Avatar
Leafbarrett
 
Join Date: Mar 2009
Age: 21
This sounds like a silly question, but is it possible to make a script that releases a pokemon when it faints?
Reply With Quote
  #8    
Old October 26th, 2011, 02:33 PM
metapod23's Avatar
metapod23
Hardened Trainer
 
Join Date: Mar 2009
Gender: Male
Nature: Timid
Quote:
Originally Posted by Leafbarrett View Post
This sounds like a silly question, but is it possible to make a script that releases a pokemon when it faints?
It may be possible with JPAN's hacked engine and only scripting (as opposed to using ASM, in which it should be doable, but much harder to execute).

You could try using the walking script, activate it and write a script that checks each Pokemon in your party's HP and if it's zero, erase it. You could also have the same script execute at the end of each battle by just writing it into each trainer battle script. Lastly, you could edit the healing scripts (the script that activates when all your Pokemon have fainted in Centers or with healers) to do the same check and erase those Pokemon.

The walking script and the healing scripts might be the most practical, as it doesn't require adding anything extra to battles and should (for the most part) do the trick. To make it perfect with just scripting, you'd have to include a script at the conclusion of each battle, though, and this still wouldn't erase the Pokemon right away after wild battles (you'd have to take one step if the walking script is activated).

ASM would be the optimal way of doing it, but I can't help with that.
__________________
Reply With Quote
  #9    
Old March 25th, 2013, 10:48 AM
agentL
Unhatched Egg
 
Join Date: Feb 2013
Gender: Male
Sorry if this is a stupid question.

but I tryed to use hackmew's script, but I didn't work. :/
How do I do this callasm thing? Isn't there someone a guide for this?
Reply With Quote
  #10    
Old January 16th, 2014, 04:40 AM
wael96
 
Join Date: Jul 2013
Gender: Male
(Maybe my question is childlike)May I know the purpose of variables from 0x8000 to 0x8009?
Reply With Quote
  #11    
Old January 16th, 2014, 04:33 PM
Merak's Avatar
Merak
Because reasons.
 
Join Date: Jul 2013
Age: 17
Gender: Male
Nature: Quiet
Quote:
Originally Posted by wael96 View Post
(Maybe my question is childlike)May I know the purpose of variables from 0x8000 to 0x8009?


I don't know if this is the thread to ask that sort of question. Perhaps try the simple questions thread instead?
__________________
"it is nearly 11 pm and we're discussing an alien eating the personification of humanity's evil desires
help"


Credit for the userbar goes to xVaporeon; credit for the avatar goes to Snakeyem12.
MY WRITING
Reply With Quote
  #12    
Old January 16th, 2014, 06:00 PM
gogojjtech's Avatar
gogojjtech
 
Join Date: Nov 2012
Location: Earth
Age: 15
Gender: Male
Nature: Quiet
Quote:
Originally Posted by agentL View Post
Sorry if this is a stupid question.

but I tryed to use hackmew's script, but I didn't work. :/
How do I do this callasm thing? Isn't there someone a guide for this?
Xse script
.....
Callasm 0x(offset+1)
.....
__________________
I believe in Jesus Christ my Savior. If you do too, and aren't scared to admit it, then copy and paste this in your signature.
My Music Hacking Videos
Proof that I'm the third best Temple Run player in the Universe "You callin' me a liar?" "I ain't callin' ya for dinner."
The SoulSilver Music Patch - The Black Music Patch - Mega-Huge Sappy Tutorial - Time-Based Events - Yet Another Sprite Resource
­
Pokémon Platinum Red
Pokémon Platinum Blue
Pokémon Platinum Red
Pokémon Platinum Blue
Pokémon Platinum Red
Pokémon Platinum Blue
Pokémon Platinum Red
Pokémon Platinum Blue
­

Join me in the chat! Get help or just talk, I really don't care :D | Click here: http://chat.linkandzelda.com:9090/?c...omhacking,GoGo
Reply With Quote
  #13    
Old 3 Weeks Ago, 04:17 PM
Rhysy27
 
Join Date: Apr 2012
Gender: Male
I know the script ends if the chosen pokemon is the only one you have but is there a way for it to work in that sense? I want the only pokemon that the player has to be stolen. Is that possible?
Reply With Quote
Reply
Quick Reply

Sponsored Links


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 10:58 AM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.