• 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?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best places on the 'net to talk Pokémon and more! Community members will not see the bottom screen advertisements.
  • Want to share your adventures playing Pokémon?
    Check out our new Travel Journals forum for sharing playthroughs of ROM Hacks, Fan Games, and other Pokémon content!
  • IMPORTANT: Following a takedown request, the following hacks have been delisted from PokéCommunity:

    • Pokémon Glazed
    • Pokémon: Giratina Strikes Back
    • Pokémon Flora Sky
    • Pokémon Stranded
    The downloads and discussion threads for these hacks will no longer be accessible, and staff will be unable to return questions regarding accessing this content.

Om3GA ARS3NAL's Scripting Secrets

0m3GA ARS3NAL

Im comin' home...
1,816
Posts
16
Years
Hello all, and thanks for even opening this! ^-^

Anyways... I am not about to make this all flashy and pretty, because it isn't, these scripting techniques should not be tried unless you are sure you know what you are doing!
This is for Advanced - Expert Scripters, fluent in PokeCode. (XSE is preferable, since that is what I will be using.)
Also, in each special script I show you, I will use 'OFFSET-A', or 'OFFSET-B' as placeholders for whatever you want.

Okies...
here is the first thing I will be including in this document...
The quite sought after...
Explaining the Daycare Script

Ok, First off, lets post the WHOLE code, then I'll break it down, and explain each line individually.

Code:
#dynamic 0x800000

#org @start
lock
faceplayer
special 0x187
special2 LASTRESULT 0x178
compare LASTRESULT 0x1
if 0x1 goto @OFFSET-A
msgbox @OFFSET-B 0x5
compare LASTRESULT 0x0
if 0x1 goto @OFFSET-C
special2 LASTRESULT 0x84
compare LASTRESULT 0x1
if 0x1 goto @OFFSET-D
fadescreen 0x1
special 0xBC
waitstate
compare 0x8004 0x6
if 0x4 goto @OFFSET-E
special2 LASTRESULT 0x85
compare LASTRESULT 0x0
if 0x1 goto @OFFSET-H
special2 0x8005 0xBA
special 0x176
cmdc3 0x2F
release
end
Now, I know this is really scary, so big and burly, nasty and such, but it can all be explained, and that is what I will do...

Code:
#dynamic 0x800000

lock
faceplayer
-------------------------------
You know what these do...
Code:
special 0x187
-------------------
I am still doing research on this particular special command... but I suggest leaving it at the top, or the script wont go as planned...
Code:
special2 LASTRESULT 0x178
compare LASTRESULT 0x1
if 0x1 goto @OFFSET-A
-------------------------------
special2 LASTRESULT 0x178, assigns LASTRESULT with either 1, or 0, like a binary switch.
It set it to 1 if there ARE pokemon already stored using this script, 0 is set, if there are no pokemon previously stored.
compare LASTRESULT 0x1, checks if LASTRESULT is set to 1, for Pokemon already stored.
if 0x1 goto @OFFSET-A, means, if LASTRESULT is set to 1, go to the specified offset, usually used in order to either return the pokemon, or tell the player that they already have a pokemon deposited.
Code:
msgbox @OFFSET-B 0x5
compare LASTRESULT 0x0
if 0x1 goto @OFFSET-C
-----------------------
An experienced scripter such as yourself would know this bit of code.
I use this to ask the player if they WANT to deposit a pokemon.
If they say no, it goes to OFFSET-C.  [color="red"]This Portion of code is Optional, and may be removed if you are stealing a pokemon for an event of sorts.[/color]
Code:
special2 LASTRESULT 0x84
compare LASTRESULT 0x1
if 0x1 goto @snippet9
-------------------------
special2 LASTRESULT 0x84, sets LASTRESULT to be either 0 or 1, but this time, 1 means that you only have one pokemon in your party, and 0 means you have more than one.
This is useful, so the player doesn't accidentally give away his.her last pokemon!
You should know what the Compare and the IF commands do by now...
Code:
fadescreen 0x1
special 0xBC
waitstate
compare 0x8004 0x6
if 0x4 goto @OFFSET-E
----------------------------
A bigger chunk, but explainable.
You know what fadescreen does.
special 0xBC, brings up the pokemon selection screen, this is needed unfourtunatley... and I have yet to find away around needing this... if you were planning on having a pokemon stolen from the player at all in the game... so sorry...
waitstate, just waits for the Pokemon selection to be made, and waits for the screen to be faded back in.
compare 0x8004 0x6, checks if you pressed the B button, or pressed the cancel button in the pokemon menu.
if 0x4 goto @OFFSET-E, just says if you did press B, or cancel, then go to the offset. useful for canceling the script, and not causing an error by taking an undefined pokemon.
Code:
special2 LASTRESULT 0x85
compare LASTRESULT 0x0
if 0x1 goto @OFFSET-H
-----------------------------
special2 LASTRESULT 0x85, sets LASTRESULT, again, to be either 0, or 1.  This time, if LASTRESULT is 0, that means that if you were to give away the pokemon selected, your last pokemon would be an egg.  And if LASTRESULT is 1, that means that if you gave the selected pokemon away, that you will still have pokemon to defend yourself with.
This is VERY useful, in order to prevent the player from playing with nothing but an egg, which could lead to errors.
OFFSET-H is the offset to lead AWAY from this script if all that would be left is an egg.
Code:
special2 0x8005 0xBA
---------------------------
This sets 0x8005 to the value stored in 0xBA, 0xBA is the Pokemon Species # of the pokemon selected, [COLOR="Red"]this is optional[/COLOR], but recomended, it is also useful for making the pokemon cry happen, like when selecting a pokemon from Professor Oak.
Code:
special 0x176
cmdc3 0x2F
----------------
I am still doing research on these two commands, but I believe that when they are put in this order, and used together like this, they remove the selected pokemon from the party!
DO NOT change them, remove them, or do anything to them, or the script will not work!
Code:
release
end
-----------
If you need an explanation about this, you should not be reading this, you are not ready.
As you can see, I have explained how to take pokemon from the player, in (somewhat decent) detail.
If you have any questions, you know how to post here!

Don't ask about how to return taken pokemon to the player, I am still working out the kinks to that!
 
Last edited by a moderator:

Cy-Chan

GSC Hacker
152
Posts
19
Years
Nice tutorial. A long-ass method of returning the Pokémon would be to save the Pokémon's statistics into RAM (copybyte) at the end of this script, and then to copyvar them back in a different script.
 

Surf

...
1,196
Posts
15
Years
  • Age 29
  • Rust
  • Seen Jul 31, 2011
Yes you posted it!
You are seriously a scripting god Omega
I needed the take pokemon for globel earth
Tanks
 

0m3GA ARS3NAL

Im comin' home...
1,816
Posts
16
Years
Nice tutorial. A long-ass method of returning the Pokémon would be to save the Pokémon's statistics into RAM (copybyte) at the end of this script, and then to copyvar them back in a different script.

Actually, there is a command built into the game for returning the taken pokemon...

Hehe, I am just working out the kinks... and trying to find out how to copy a value loaded into [buffer1] into a variable...
If you can help me do that, then I'll post how to return pokemon, since that is needed to do so...
I've read your stuff, tutorials and such, but I like your style Cy-Chan, and you seem to know alot about the more advanced things about a Pokemon ROM... so I gotta ask, do you know how to copy [Buffer1] to a varialbe? (Like LASTRESULT or 0x8008?)
 
Last edited:

Ninja Caterpie

AAAAAAAAAAAAA
5,979
Posts
15
Years
Yeah, the only problem is, normally, returning Pokemon involves paying. To cancel that out, we just need to find out how much money is taken away and use givemoney to give that much. :\
 
1,104
Posts
16
Years
Nice tutorial. A long-ass method of returning the Pokémon would be to save the Pokémon's statistics into RAM (copybyte) at the end of this script, and then to copyvar them back in a different script.
Not necessarily. You could just go with a software interrupt or a DMA transfer, Although I've never really used the DMA transfers much.
But if you went that way, there isn't too much point in going with removing the Pokemon through ways of the in built scripting engine thing, you'd just go with this way.

... so I gotta ask, do you know how to copy [Buffer1] to a varialbe? (Like LASTRESULT or 0x8008?)
A variable's length is only two bytes long. Buffer1, if I'm not mistaken is a string. Unless the length of buffer1 is only two characters long, a copy from a buffer to a variable isn't what you want.

Then again, I haven't done too much lately and I could be wrong.
 

destinedjagold

You can contact me in PC's discord server...
8,593
Posts
16
Years
  • Age 33
  • Seen Dec 23, 2023
taking a pokemon, huh? it's really cool.
useful for my hack.

thanks for this. :)
 

Cy-Chan

GSC Hacker
152
Posts
19
Years
What thethethethe said pretty much sums it up, I'd think... I can't really expand on that.

Maybe if you tried checking where the Pokémon is stored in RAM, after being taken? In order to retrieve it, the data still has to be there, after all.
 

0m3GA ARS3NAL

Im comin' home...
1,816
Posts
16
Years
What thethethethe said pretty much sums it up, I'd think... I can't really expand on that.

Maybe if you tried checking where the Pokémon is stored in RAM, after being taken? In order to retrieve it, the data still has to be there, after all.

Hey now... I might be good, but I am not THAT good, I dont know how to do that...
 

Cy-Chan

GSC Hacker
152
Posts
19
Years
Hey now... I might be good, but I am not THAT good, I dont know how to do that...

VBA's memory viewer. 0x02024284 contains your team's stats. Make a copy of this script, and see where the lost Pokémon's data is moved to.

If it's not moved (the data simply disappears), then the game has no way of remembering the Pokémon deposited, and no return Pokémon script can be made from this script. If it is moved, well... good!
 

0m3GA ARS3NAL

Im comin' home...
1,816
Posts
16
Years
VBA's memory viewer. 0x02024284 contains your team's stats. Make a copy of this script, and see where the lost Pokémon's data is moved to.

If it's not moved (the data simply disappears), then the game has no way of remembering the Pokémon deposited, and no return Pokémon script can be made from this script. If it is moved, well... good!

So... I know about the Memory Viewer, and that particular offset... But I dont understand how I'll be able to move the "Moved" Pokemon back to the party. Wouldn't that require ASM? Or... Does the command movebyte hold some significance in this situation?
 

Cy-Chan

GSC Hacker
152
Posts
19
Years
Ah! Well, I'm not sure, really. I was just saying, the Pokémon needs to be stored in RAM after it's taken away, otherwise it can't be returned, right?
 

Gamer2020

Accept no Imitations!
1,062
Posts
15
Years
I thought of something that may or may not help. Don't ridicule me cause im only an ok scripter.

But maybe you can figure out a give pokemon script if you look at the daycare script. They always give back the pokemon and stuff. idk. it's just an idea.
 

Ninja Caterpie

AAAAAAAAAAAAA
5,979
Posts
15
Years
I thought of something that may or may not help. Don't ridicule me cause im only an ok scripter.

But maybe you can figure out a give pokemon script if you look at the daycare script. They always give back the pokemon and stuff. idk. it's just an idea.

That's exactly what he's doing. It's why he needs to give money to the player, so no money's lost. :D
 

Gamer2020

Accept no Imitations!
1,062
Posts
15
Years
That's exactly what he's doing. It's why he needs to give money to the player, so no money's lost. :D

Oh ok. (stupid me) It's still a useful script even without the give pokemon. For example you can somethingin the begining of a hack where you have a team but they get stolen or something.

EDIT* would this script work with ruby?
 

0m3GA ARS3NAL

Im comin' home...
1,816
Posts
16
Years
Oh ok. (stupid me) It's still a useful script even without the give pokemon. For example you can somethingin the begining of a hack where you have a team but they get stolen or something.

EDIT* would this script work with ruby?

I doubt it... I am certain that the special commands are different in Pokemon Ruby version...
But it is not hard to figure out... Just look at the Daycare script from ruby and do some testing with that!

(Also, this script is not very practical for stealing pokemon... since you have to select the pokemon yourself... but I think it might work like a phony pokemon daycare, like Cassidy and Burt did on an episode of pokemon... *Butch yells- I TOLD YOU, MY NAME IS BUTCH!*
 

Gamer2020

Accept no Imitations!
1,062
Posts
15
Years
I doubt it... I am certain that the special commands are different in Pokemon Ruby version...
But it is not hard to figure out... Just look at the Daycare script from ruby and do some testing with that!

(Also, this script is not very practical for stealing pokemon... since you have to select the pokemon yourself... but I think it might work like a phony pokemon daycare, like Cassidy and Burt did on an episode of pokemon... *Butch yells- I TOLD YOU, MY NAME IS BUTCH!*

Oh yeah I didn't think of that. But there has to be a way to do it without you picking your pokemon. Like in Gold with the bug catching contest. You could only use one pokemon. and the guy held the others.
 

0m3GA ARS3NAL

Im comin' home...
1,816
Posts
16
Years
Oh yeah I didn't think of that. But there has to be a way to do it without you picking your pokemon. Like in Gold with the bug catching contest. You could only use one pokemon. and the guy held the others.

You still had to select the pokemon you wanted to use though...
If I could figure out how to ASM hack... I would do it... does anyone know where I can find some semi-understandable ASM tutorials? (I have always wanted to learn ASM, but I could never find a tutorial that I could understand...)
 

Giga Universe

Working on a tool.
121
Posts
16
Years
Wow...

OMG. I have been trying to find this for ages, and here it is sticking out at me. This will really help me with my one script, so Thanks! All I need to do now is find out how to remove the select a Pokemon Special. Maybe it uses one of the special variables, such as 0x8002?
 
Back
Top