View Full Version : Scripting in Gold

June 15th, 2007, 9:42 AM
Hi. I'm a hacker from the 2nd Generation (Gold/Silver/Crystal) and I am about to start a new hack. I was wondering if there was a way to do scripting in GS like you can in RSE, or whether there was something similar to scripting for GS.

Long story short, is there a way of scripting GS (initiating legendary battles, etc.).

June 15th, 2007, 1:18 PM
Long story short, is there a way of scripting GS (initiating legendary battles, etc.).

Yes, there is. Here (http://magicstone.de/rhw/tutorials/pokemon/gs/scripting/scripting-doc.zip) you can find a really useful document about G/S scripting made by Tauwasser. Be aware that is in German so you could need some translations before fully understanding it.

June 18th, 2007, 4:10 PM
Tauwasser actually translated his document; you can find the English version at RHDN (http://www.romhacking.net/docs/322/).

June 19th, 2007, 9:51 PM
Cant beleive Aunty K didn't see this.

Currently construction Gold/Silver database for pokescript using above data..
Database will be posted online and will allow scripts to be written using pokescript style (commands will be different but layout will be the same and script inserted using bufrite)

We'll get back to you in a few days when we have the database built.

June 20th, 2007, 12:44 PM
It should also be noted that the scripting codes are slightly different in Crystal, due specifically to the Pokegear phone and the Mobile Adapter's removed functions.

Irish Witch
June 22nd, 2007, 9:27 AM
I'll keep that in mind.. I've found I'm going to have to re-engineer poketscript a little to make the database work.

Who ever heard of a three byte value?? Would never happen in most serious computer systems :P

A patched ver of the current pokescript will come out next week along with modifications to the pkmadv(rubikon) database. Hopefully soon after that pkmgsc will be released.

The file extentions will be
.gsc = script
.gsh = header

The buffer files will continue to have .buf extensions. It will be on your head to make sure you use the right .buf on the right rom.

June 25th, 2007, 8:59 AM
I've got the English guide, but how do you add the scripts to the game?

June 25th, 2007, 9:56 AM
Tauwasser once wrote an excellent post at Acmlm's detailing how to script.

So, first off, I have the English version rom of Pokmn Gold here. But I'm gonna D/L one instead and tell you it's CRC-32 and MD5, just for you to be sure. MD5: A6924CE1F9AD2228E1C6580779B23878 CRC-32: 6BDE3C3E
So, my rom is 0671 - Pokemon Gold.gbc dumped by Oldskool. So, where to begin.... Well, right. You hopefully know about mapheaders and the like. Off we are to 0x940ED. That's the map bank pointer table for your information. Every pointer stands for a map-bank and points to the first mapheader in the map bank. The list is FF-terminated.

There are bytes 2141 there, so let's go to our first mapheader for map 1.1 at 94121.


So. It's out first mapheader. It's a PokéCenter. Tileset 06. Permissionbyte 03. 2nd mapheader @ 25:5B6D. Location on world map is 0x1B. Music is 09. Time of day is 01, morning. Fishing byte is 01, a random set, because you obviously can't fish in a PokéCenter.

So, let's examine the 2nd mapheader @ 95B6D:


Border block is 00, a black block. Dimensions are 04x05, height times width. Blockdata/mapdata is at 2B:42E8. Scriptheader (see my doc for information) is at 51:4000. Events are at 51:40C5. Connections are none, hence 00.

Let's go to the event data. at 1440C5:

0000 Bytes with no use, just filler bytes (I checked the asm)
03 # of warps, 03
070301010E Warp #0
070401010E Warp #1
0700011401 Warp #2
00 no triggers, 00
00 no signposts either, 00
04 # of people events, 04
3705070600FFFF00000240FFFF people event #0
3B080C0501FFFF00000540FFFF people event #1
3A07060600FFFFA0000840FFFF people event #2
29050B0600FFFF00000B40FFFF people event #3

These are all generic People events, they all have only 3 byte codes in place. However, we're gonna play. Let's go to the first people event's script codes @ 51:4002 (see my doc), since all other scripts for other people follow that one.

@ 144002

0C0000 Script for people event #0
0C2D00 Script for people event #1
510E40 Script for people event #2
516740 Script for people event #3

You can check with my doc now.

So, the first one starts a pokécenter-dialog. That's the woman behind the counter. It's terminated after it finishes without a special code.

The second one is a happiness counseling dialog. It'll tell you something like "PKMN#1 is very happy" or so.

The other two actually refer to text within this rombank.

Two textcodes, one for text @ 51:400E and one @ 51:4067. This is, where your known codes happen. Both texts start off with 00Textextextextex and end with 57 (which will terminate the whole text process and not let any other codes take place. feel free to put a 50 for the first occurence of 57 and watch people event #2 say his text and event #3's text as well (of course, it'll screw up )

So. I said I'm gonna have phun. So basically, I'll tell you what to do. Either you do it, or you don't.

Set the scriptpointers for events #1 to #3 to 0x2812. That will make them not lose it, once we're done with the scripts and you enter that map.

So, that's event #0 left for us to play with. Let's make it a give-pokémon script instead of that oldfashioned pokécenter talk

So off we go. I'll make it so you can only get the pokémon once or else, it will be the PokéCenter lady talk.

311A00 - check whether pokémon was already given.
080B40 - If it wasn't already given, goto code for giving
0C0000 - PokéCenter dialog
331A00 - Set bit no so it won't be given twice.
47 - load font and start textbox, the code afterwards is gonna output something
2DFB050000 - Give a Pkmn Celbi at lvl 05 without item and with your own trainer ID
49 - rewrite sprite moving tiles to ram, we don't want ABCD's walking about.
90 - end script

Notice, how I used the bit no that s given by Elm once you got a pokémon, so it won't work unless you cheat your way there without a pokémon or have a handy cheat menu incorporated or manually edit the ram the bit is held.

Now for the test :Dhttp://acmlm.no-ip.org/archive3/thread.php?id=8786 (yeah I linked it, it's an archive anyway and you can't register)