Advertiser Content

Tutorial [Ruby] Adding New Types

Started by destinedjagold November 17th, 2013 9:48 PM
  • 26491 views
  • 81 replies

destinedjagold

You Can Contact me in PC's Discord

Age 29
Male
Philippines
Seen 4 Weeks Ago
Posted May 6th, 2019
8,596 posts
12.5 Years
Note...

This tutorial will teach you how to add new types to your Ruby ROMs.
However, it will sacrifice the Contest Move types. So if you don't plan on adding the Contests in your ROM, then this tutorial is for you.
Also note that I absolutely have no idea where the type palletes are located.

And if you want a FireRed/LeafGreen version of this tutorial, check out Dragoon's thread.


Things You'll Need...

- Hex Editor
- Unlz-GBA


Steps...

0. Save a back-up copy of your ROM.

1. Open your ROM with Unlz-GBA.

Spoiler:
This message should appear when you open your ROM via Unlz-GBA.

If the tool immediately loads your ROM, then please close Unlz-GBA, and delete the .pal and .spr files.

And then open your ROM with Unlz-GBA once again.


2. Go to 1485 in Unlz-GBA.
Spoiler:


For easy editing, I suggest you click the circled buttons.


3. Save the image and open it to any image-editing programs (like MSPaint) and add your new type.
Spoiler:


4. Import the new type image back.
Spoiler:


If you'll get this message...

...it means that your new image is larger, and needs to be repointed.

To repoint, open your ROM with a hex editor and look for an offset with a lot of free space (FF).
Spoiler:


After you found an offset with a lot of free space for repointing, close your Hex Editor...
Spoiler:
(because Unlz-GBA will not function properly if there are other programs opening your ROM)

...and Import your new type image again on Unlz-GBA.
This time, check the [Automatically Fix Pointers] checkbox, and write the offset on the [Image Offset] box.


Click [OK] and done.


6. Close Unlz-GBA and open your ROM with a Hex Editor.

7. Move the strength and weakness table, which is found in address 1F9720, to a new offset.
Spoiler:
Go to (CTRL + G) the 1F9720 address.

Go to Edit > Select Block, and then choose 333 decimal bytes of data.
Spoiler:


Copy the selected area.
Spoiler:


Search for free space, then go to Edit > Select Block, and then choose 333 decimal bytes of data.
Spoiler:


Paste the copied data to the new selected area.
Spoiler:


8. Repoint the strength and weakness table to your new offset.
Spoiler:
Reverse the offset of the type strength and weakness table, and your new offset.
(Swap the red ones and then add 08 at the end)
Old Table: 1F9720 -> 20971F08
New Table: 800A00 -> 000A8008

Hit Ctrl + H on your Hex Editor and put the reversed old table offset on the [Find] field, and your reversed new table offset on the [Replace] field.
Spoiler:

Congratulations!
You have successfully repointed the type strengths and weaknesses table to a new offset location.
Now, you can add new type strengths and weaknesses by just adding new ones at the end of the new location.


9. Add new strength/weakness values on your new table.
Spoiler:

You'll only need to add 3 bytes to add a new formula in the strengths and weaknesses.
The first byte is the one attack. The second value is the type being attacked. The final byte is the damage multiplier.
So, if we want to add a [Fairy does [Super Effective] against Dragons], we'll add this...
Spoiler:

The first value, which is the one who will attack, is 12, because that is where we inserted our new [Fairy] type.
Spoiler:

The second value, the defending type, is 10, because that is the hex number of the [Dragon] type.
The third value is the damage multiplier, which is 14, because that is the value of a super-effective.
Note that if two types are neutral against each other, then no need to add them in the table, e.g. Fairy against Normal.


10. Update your editing tool's .ini file.
Spoiler:

Note that YAPE will not be able to open your ROM if you'll change your PKMN's type to new ones. YAPE however, can still open your ROM if only the attack's types are only changed.


11. Repoint the type names table.
Spoiler:
Go to 1F9870 and select 7B (hex) bytes of data.

Copy the highlighted data.


Find some free space, select 7B (hex) bytes of data once again, and paste.


Hit [Ctrl + H] and replace [70981F08] with your new table address.


Save.


12. Insert new type names.
Spoiler:
Spoiler:
In case you don't know what I am referring to as [type names].


Each type name ends with [FF]. The very last type in a Ruby ROM is the [DARK] type, so, obviously, that type will be at the very last.

DARK in hex is BEBBCCC5.

In this tutorial, we added the [FAIRY] type right after the [DARK] type.

So, we will add the [FAIRY] text right after [DARK].

Put the FAIRY text, which is C0BBC3CCD3 in hex.


If you wish to know the hex values of texts, you can simply download my simple tool.
Note that this tool can't convert symbols or spaces.


Save, then test it in game, during a battle, in the attack selection screen.
If nothing shows up, or your new type isn't displaying right, like for example, instead of [Fairy], in-game it only displays as [iry], then you will need to add [00] data.
How many [00] you need to insert depends on how many letters your new type lacks.


Reference...


Strengths And Weaknesses Table Address

Spoiler:
Red and Blue: 3E474
Yellow: 3E62D
Gold and Silver: 34D01
Crystal: 34BB1

Ruby: 1F9720
Sapphire: 1F96B0
Emerald: 31ACE8
Fire Red: 24F050
Leaf Green: 24F02C

Diamond: 1DE1B8

Types' Hex Values
Spoiler:
00 = Normal
01 = Fighting
02 = Flying
03 = Poison
04 = Ground
05 = Rock
06 = Bug
07 = Ghost
08 = Steel
09 = ???
0A = Fire
0B = Water
0C = Grass
0D = Electric
0E = Psychic
0F = Ice
10 = Dragon
11 = Dark

Damage Multiplier
Spoiler:
00 - No damage/Immune - e.g. Ground against Flying
05 - Not very effective - e.g. Electric against Grass
0A - Normal damage, but not needed - e.g. Fire against Fighting
14 - Super effective - e.g. Ice against Dragon
FE - Limit of the damage value, which is MURDER.


Credits...

- Coolboyman's Type Strengths and Weaknesses Table Thread.
- Dragoon's contribution in the Adding New Types Research Thread.


Resource...

destinedjagold

You Can Contact me in PC's Discord

Age 29
Male
Philippines
Seen 4 Weeks Ago
Posted May 6th, 2019
8,596 posts
12.5 Years
I had no idea It's that easy XD

Thanks.. If I will ever hack Ruby again, I might use it!

Do you have an idea where the Strength/Weakness is in FireRed?
I linked Coolboyman's documentation on the Credits section of the tutorial.
Anyway...

Fire Red: 24F050
Hm...
Maybe I should include the addresses on the Reference section.

LCCoolJ95

Limited Capacity

Age 24
Male
The World That Never Was
Seen 1 Day Ago
Posted 4 Weeks Ago
608 posts
10.5 Years
Here's the number for Emerald for the type pictures: 2110
"The greatest obstacle in life is Yourself. Overcome it, and you will achieve the greatest accomplishment of all." -Art Beins, 1982

Pokémon Theta Emerald EX: https://www.pokecommunity.com/showthread.php?t=386240

TheShinyMew

Ravioli ravioli, give me the formuoli.

Age 29
Female
Unknown
Seen 11 Hours Ago
Posted August 6th, 2018
110 posts
9.5 Years
<b>
Things You'll Need...

- Hex Editor
- Unlz-GBA

</b>
<b>

6. Close Unlz-GBA and open your ROM with a Hex Editor.

7. Move the strength and weakness table, which is found in address 1F9720, to a new offset.

Spoiler:
Go to Edit > Select Block, and then choose 333 decimal bytes of data.
Spoiler:


Copy the selected area.
Spoiler:


Search for free space, then go to Edit > Select Block, and then choose 333 decimal bytes of data.
Spoiler:


Paste the copied data to the new selected area.
Spoiler:


8. Repoint the strength and weakness table to your new offset.
Spoiler:
Reverse the offset of the type strength and weakness table, and your new offset.
(Swap the red ones and then add 08 at the end)
Old Table: 1F9720 -> 20971F08
New Table: 800A00 -> 000A8008

Hit Ctrl + H on your Hex Editor and put the reversed old table offset on the [Find] field, and your reversed new table offset on the [Replace] field.
Spoiler:

Congratulations!
You have successfully repointed the type strengths and weaknesses table to a new offset location.
Now, you can add new type strengths and weaknesses by just adding new ones at the end of the new location.


9. Add new strength/weakness values on your new table.
Spoiler:

You'll only need to add 3 bytes to add a new formula in the strengths and weaknesses.

So, if we want to add a [Fairy does [Super Effective] against Dragons], we'll add this...
Spoiler:

The first value, which is the one who will attack, is 12, because that is where we inserted our new [Fairy] type.
Spoiler:

The second value, the defending type, is 10, because that is the hex number of the [Dragon] type.
The third value is the damage multiplier, which is 14, because that is the value of a super-effective.
Note that if two types are neutral against each other, then no need to add them in the table, e.g. Fairy against Normal.

</b>
Wait, what kind of Hex-Editing program did you use?
~Welcome! Where's my land?~

destinedjagold

You Can Contact me in PC's Discord

Age 29
Male
Philippines
Seen 4 Weeks Ago
Posted May 6th, 2019
8,596 posts
12.5 Years
Wait, what kind of Hex-Editing program did you use?
Any hex editing program will work.
But I normally use Hex Workshop v6, since that's the hex editing program I first used when I started ROM hacking.

DoesntKnowHowToPlay

Tiny Umbrella with Lots and Lots of Good

Seen February 12th, 2019
Posted June 15th, 2017
258 posts
7.8 Years
YAPE can still open a ROM with mons that have new types- you just need to change the MaxTypeVal variable, which is defined in data\common\romdata.ini.

It's also worth noting that near the end of the 3rd gen type chart you'll find an FE FE 00 entry- this is important, as any match-ups after stop taking effect when Foresight or Odor Sleuth are used.

karatekid552

What happens if I push it?....

Male
Do you really want to know? Really?
Seen January 12th, 2015
Posted December 14th, 2014
DJG, just a suggestion, but use offsets with UnLz along with the numbers since not everyone is working on a vanilla rom. Some of the newcomers might not have a good grasp on UnLz's numbering system and won't know what to do when the image is in a different location. Other than that, nice tutorial.:)

Also, for anyone that needs the palettes, try using the logger that is built into VBA to find them. If that doesn't work, find them in the palette viewer and then use APE to search the rom.

Edit: I wonder if we can add new types to FR by expanding the image and the table.... Might be a cool feature for the 649 patch once I stabilize it.

Paired with Simba
Male
Seen May 23rd, 2014
Posted November 29th, 2013
12 posts
6 Years
DJG, just a suggestion, but use offsets with UnLz along with the numbers since not everyone is working on a vanilla rom. Some of the newcomers might not have a good grasp on UnLz's numbering system and won't know what to do when the image is in a different location. Other than that, nice tutorial.:)

Also, for anyone that needs the palettes, try using the logger that is built into VBA to find them. If that doesn't work, find them in the palette viewer and then use APE to search the rom.

Edit: I wonder if we can add new types to FR by expanding the image and the table.... Might be a cool feature for the 649 patch once I stabilize it.
Hey karatekid, i see you are also interested in adding new types to firered. If you want to help I have a thread in the research and development section so far I have everything except how to add the new type's icon to the image since it doesn't have contest moves to override in firered. Your help would be great.

Also DJG,
You might want to add how to change the types name in the game so it doesn't make a bunch of weird symbols there instead.
New but advanced in ROM Hacking, Hex Editing, Mapping , Java and C.
Trying to learn Assembly.

destinedjagold

You Can Contact me in PC's Discord

Age 29
Male
Philippines
Seen 4 Weeks Ago
Posted May 6th, 2019
8,596 posts
12.5 Years
Also DJG,
You might want to add how to change the types name in the game so it doesn't make a bunch of weird symbols there instead.
Oh...right...that...
Forgot about that... >.>
I'll add that part later this weekend.


edit: done~

TheShinyMew

Ravioli ravioli, give me the formuoli.

Age 29
Female
Unknown
Seen 11 Hours Ago
Posted August 6th, 2018
110 posts
9.5 Years
Any hex editing program will work.
But I normally use Hex Workshop v6, since that's the hex editing program I first used when I started ROM hacking.
I have a Notepad with a Hex Editor plugin, but I didn't see the select "block status".
~Welcome! Where's my land?~

karatekid552

What happens if I push it?....

Male
Do you really want to know? Really?
Seen January 12th, 2015
Posted December 14th, 2014
I have a Notepad with a Hex Editor plugin, but I didn't see the select "block status".
Plugins have soooo many less features. Use a real hex editor like HxD or HexWorkshop.:p

Paired with Simba

destinedjagold

You Can Contact me in PC's Discord

Age 29
Male
Philippines
Seen 4 Weeks Ago
Posted May 6th, 2019
8,596 posts
12.5 Years
hey, ??? Type can be replaced with fairy type? A friend told me that it can't. :(
And I tried to repoint, but to verify message appeared when "Write to ROM" in unlz.gba :(

LOL...When i save it in my pc it says it is 16 colours, but when i start editing it with same colours it says it is not 16
Yes, you can replace the [???] type, but that might mess with the [Struggle] move. =/

Also, you are probably using a Win7 or Win8 version of MS Paint. Those versions remove the 16 color thingy-thingy of the image.
Try using this instead -> http://www.mediafire.com/download/ki99ug9z8wbtu9y/mspaint.exe

karatekid552

What happens if I push it?....

Male
Do you really want to know? Really?
Seen January 12th, 2015
Posted December 14th, 2014
Yes, you can replace the [???] type, but that might mess with the [Struggle] move. =/

Also, you are probably using a Win7 or Win8 version of MS Paint. Those versions remove the 16 color thingy-thingy of the image.
Try using this instead -> http://www.mediafire.com/download/ki99ug9z8wbtu9y/mspaint.exe
Struggle bypasses the type chart completely. ??? is used for Curse and eggs.;) Just fyi.

Paired with Simba

destinedjagold

You Can Contact me in PC's Discord

Age 29
Male
Philippines
Seen 4 Weeks Ago
Posted May 6th, 2019
8,596 posts
12.5 Years
I cannot seem to find "1F96B0" using HxD in Win8.1.

You think I'm doing something wrong?



What do I do in step 7?
Go to (CTRL + G) the 1F96B0 (hex) address, and then proceed of doing Step 7.

Male
South Plainfield, NJ
Seen November 29th, 2016
Posted November 25th, 2016
30 posts
6.1 Years
=/
What about this one here?

Spoiler:
Found. But when I select the block, I put 333 in "length" with "hex" and ignore the rest right? Also how do I do this- "(Swap the red ones and then add 08 at the end)" And last question: When I repoint the types tables, I do it in the Sapphire Rom right, not in YAPE?

Sorry for the noobish questions and thanks again! I'm only trying to add the Fairy type in Sapphire and nothing else.

Edit: I'm using HxD but I also have Hex Workshop

Screenshot (165).png

destinedjagold

You Can Contact me in PC's Discord

Age 29
Male
Philippines
Seen 4 Weeks Ago
Posted May 6th, 2019
8,596 posts
12.5 Years
Found. But when I select the block, I put 333 in "length" with "hex" and ignore the rest right?
No, not hex. Use decimals, since that's what I said in the tutorial, anyway.
But if you want to use hex, then just convert 333 to hex, which would be 14D. :3


Also how do I do this- "(Swap the red ones and then add 08 at the end)" And last question: When I repoint the types tables, I do it in the Sapphire Rom right, not in YAPE?
Well, since you're using Sapphire, the offset would be 1F96B0, right?
You'll just have to swap the places of the first two values and the last two values.
So, 1F96B0. The firs two values are [1F], and the last two would be [B0]. Just swap them, and then, you'll end up with B0961F, and then, add 08 at the end, and you'll have B0961F08. ;3


Edit: I'm using HxD but I also have Hex Workshop
I never actually used HxD though, so I don't really know what's the difference between the two hex editors. =/

Male
South Plainfield, NJ
Seen November 29th, 2016
Posted November 25th, 2016
30 posts
6.1 Years
No, not hex. Use decimals, since that's what I said in the tutorial, anyway.
But if you want to use hex, then just convert 333 to hex, which would be 14D. :3




Well, since you're using Sapphire, the offset would be 1F96B0, right?
You'll just have to swap the places of the first two values and the last two values.
So, 1F96B0. The firs two values are [1F], and the last two would be [B0]. Just swap them, and then, you'll end up with B0961F, and then, add 08 at the end, and you'll have B0961F08. ;3




I never actually used HxD though, so I don't really know what's the difference between the two hex editors. =/
Ok so Ive gotten to step 9. How do I know where the new table starts and ends? :3

Thanks for ur help though! :)
Advertiser Content