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.
2506036D5B1B090101
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:
0004052BE842510040C54000
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 :D