Notices
For all updates, view the main page.

 Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.New threads in this forum are to be approved by a moderator before they are displayed.

#1
November 13th, 2011 (2:32 AM). Edited December 31st, 2011 by miksy91.
 miksy91 Dark Energy is back in action! ;) Join Date: Oct 2008 Location: A small country in the North Gender: Male Nature: Relaxed Posts: 1,432
Pokemon G/S Hacking Tutorial - How to create a new region by Miksy91

Notice that I'm explaining how to create a new region replacing either one of the regions that already exist in G/S. Without assembly, it's impossible to add a third one. Besides, this tutorial may be difficult to be understood because editing a region properly is not easy either so don't expect to find a more newbie-friendly tutorial elsewhere.

Step 1

Let's start with the basics. There is a table at \$92382 in Gold and Silver. That table contains four bytes for each area in Johto. The structure is like this: [X] [Y] [Pointer]
[X] and [Y] determine the location of the area determined by the [Pointer] in the town map, the [Pointer] leads to the name of the area.

The first four bytes, 00 00 46 69, tell the game that area "SPECIAL" is at (0,0) in town map. The next four bytes, 94 74 FE 64, determine that area "NEW BARK TOWN" is at (94, 74) in town map.

Well, now you should know how to edit the names of areas and determine their location in the town map.
Anyway, we still hardly know a thing yet.

Step 2

According to the table above, each area has its typical byte:
SPECIAL --> 00
NEW BARK TOWN --> 01
ROUTE 29 --> 02 etc. (depending on where the [Pointer] leads, make sure you don't confuse it with the order the area names in which CHERRYGROVE CITY would come after NEW BARK TOWN)

The order of these typical bytes also tells the game, which area is displayed when you click left or right -button when viewing the town map.
This typical table is used in another table at \$91BCC which I'll explain soon...

Step 3

Before moving on to the table at \$91BCC, let's see what we can find in another table at \$15319. If you've hacked G/S before, you may have changed the location where the game starts so you might be familiar with this offset already.

Anyways, at \$15319 is a table in this form: [Map Bank] [Map Number] [X] [Y] which tell either the blackout map (loaded when losing a battle) or the map where you can fly to.
The first four bytes are 18 07 03 03 which tell the starting position of the game as well. They also tell the game where you'll end up before if you lose and haven't been at any pokecenter yet.

The next four bytes are unused flying data for Viridian City PC, then the next four bytes determine the flying / blackout position when you've been in Pallet Town.

Now, look at this document by Koolboyman:

As you can see, the bit of "Your House" is 3200, "Viridian PC" is 3300, "Pallet Town" is 3400 etc. Basically, when 3200 is set, you'll end up in the place determined at 0x15319. When 3400 is set, you'll end up in the place determined at 0x15319 + (0x34 - 0x32) * 0x4 = 0x15321

Well, it's hard to explain this better because I don't know the ASM for flying or blackout positions but anyway, when 3400 is set, you're able to fly to Pallet Town but that doesn't mean you'll end up there after blackout. You'll only end up there after blackout if you haven't been to other towns after Pallet. Makes sense right ?

Anyway, when bit 4100 is set, the game knows that you've been in Cherrygrove City. Cherrygrove's flying data is at: 0x15319 + (0x41 - 0x32) * 0x4 = 0x15355

Then again, I was struggling with this thing myself;
Azalea Town's (4300) flying data is not at 0x15355 + 0x8 = 1535D
Instead, it's four bytes ahead at 0x15361.
\$1535D you can find the blackout data for Route 31 (where is a pokecenter). As you can see, bit number doesn't itself determine the offset where the game looks for the flying data although it seemed so.

Now, it's time to move on to the final step !

Step 4

It's time to return to table discussed earlier, the one at \$91BCC.
The table contains flying map & flying data for each area in Johto region and this is the form of it: [Typical byte] [Which place leads to]

As explained earlier, each area has its own typical byte depending on the [Pointer] in the table at \$92382. [Which place leads to] tells the game which list of bytes are loaded in the table at \$15319.

Complicated...but fun
Anyways, the first two bytes determine the flying data for NEW BARK TOWN (4000) which are 01 0E.

01 is used to display the flying map for the selected area and 0E loads the place where you'll end up when clicked A button.

01 loads the four bytes at 0x92382 + 0x1 * 0x4 = 0x92386 which contains the (x,y) location and pointer to "NEW BARK TOWN".

0E tells the game to load the flying data at 0x15319 + 0xE * 0x4 = 0x15351 which contains the [Map Bank] , [Map Number] and [X], [Y] location where you'll end up after having blackout or flown to the selected place.

As explained above though, you can't count the flying data location in the same way for places of which bit number is bigger than 4200 (due to the pokecenter being in Route 31). In those situations, you've to minus 4 from the offset calculator gives you.

I'm done !

That's all the info you'll need to create your own region and have it's town map and flying datas edited properly. To create town map easier, use Harrison's GSC Town Map Editor: http://hax.iimarck.us/topic/97/

P.S
The sixth byte in the primary header of each map tells the game in which area that map belongs.
__________________
My Rom Hack

CP of encountered pokemon in GO

Learn how to hack GB/C games:

Check my GameBoy/Color hacking videos in Youtube
-The video set uses Pokemon Silver (U) rom for demonstrations

#2
March 9th, 2012 (1:38 PM).
 Storm118 Join Date: Jan 2012 Gender: Male Nature: Timid Posts: 1
Thanks for this info, it has really helped.
#3
April 11th, 2014 (3:22 PM).
 com3tiin Soy chamber... Join Date: Jan 2013 Gender: Male Posts: 113
I will put into practice the information.

Thank you very much!
__________________