The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary Hack Tutorials (https://www.pokecommunity.com/forumdisplay.php?f=66)
-   -   [Ruby] Adding New Types (https://www.pokecommunity.com/showthread.php?t=313163)

destinedjagold November 17th, 2013 9:48 PM

[Ruby] Adding New Types
 
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.

http://i40.*.com/33f3x2u.jpg
Things You'll Need...

- Hex Editor
- Unlz-GBA

http://i40.*.com/33f3x2u.jpg
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.
http://i40.*.com/2gxebnd.jpg
If the tool immediately loads your ROM, then please close Unlz-GBA, and delete the .pal and .spr files.
http://i39.*.com/13z0kmc.jpg
And then open your ROM with Unlz-GBA once again.


2. Go to 1485 in Unlz-GBA.
Spoiler:
http://i40.*.com/24c9op0.jpg

For easy editing, I suggest you click the circled buttons.
http://i40.*.com/25jxw8o.jpg


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


4. Import the new type image back.
Spoiler:
http://i43.*.com/33e7czd.jpg

If you'll get this message...
http://i42.*.com/eb7all.jpg
...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).


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)
http://i42.*.com/148faw.jpg

...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.
http://i44.*.com/2zhei6c.jpg

Click [OK] and done.
http://i44.*.com/122i16v.jpg


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.


Copy the selected area.


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


Paste the copied data to the new selected area.


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.

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:
http://i40.*.com/13z0abb.jpg
You'll only need to add 3 bytes to add a new formula in the strengths and weaknesses.
Quote:

Originally Posted by Coolboyman
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:
http://i44.*.com/2b33tz.jpg
The first value, which is the one who will attack, is 12, because that is where we inserted our new [Fairy] type.

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:
http://i42.*.com/2qa7hbm.jpg
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.
http://i41.*.com/2h7j9nd.jpg
Copy the highlighted data.
http://i39.*.com/suwuf4.jpg

Find some free space, select 7B (hex) bytes of data once again, and paste.
http://i44.*.com/2dboxv9.jpg

Hit [Ctrl + H] and replace [70981F08] with your new table address.
http://i39.*.com/2yvl5ib.jpg

Save.


12. Insert new type names.
Spoiler:
Spoiler:
In case you don't know what I am referring to as [type names].
http://i40.*.com/29455wi.jpg


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.
http://i43.*.com/2qsmexx.jpg
DARK in hex is BEBBCCC5.

In this tutorial, we added the [FAIRY] type right after the [DARK] type.
http://i41.*.com/2gxrbiv.jpg
So, we will add the [FAIRY] text right after [DARK].

Put the FAIRY text, which is C0BBC3CCD3 in hex.
http://i39.*.com/dm8ket.jpg

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.
http://i42.*.com/vq1o1y.jpg

http://i40.*.com/33f3x2u.jpg
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.

http://i40.*.com/33f3x2u.jpg
Credits...

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

http://i40.*.com/33f3x2u.jpg
Resource...

xGal November 20th, 2013 9:24 AM

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?

destinedjagold November 20th, 2013 5:18 PM

Quote:

Originally Posted by galooloo (Post 7945780)
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...

Quote:

Originally Posted by Coolboyman
Fire Red: 24F050

Hm...
Maybe I should include the addresses on the Reference section.

superluke November 20th, 2013 7:23 PM

In your tutorial did you get rid of cool and beauty?

LCCoolJ95 November 22nd, 2013 11:51 AM

Here's the number for Emerald for the type pictures: 2110

TheShinyMew November 27th, 2013 6:05 PM

Quote:

Originally Posted by destinedjagold (Post 7942104)
<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.


Copy the selected area.


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


Paste the copied data to the new selected area.


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.

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:
http://i40.*.com/13z0abb.jpg
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:
http://i44.*.com/2b33tz.jpg
The first value, which is the one who will attack, is 12, because that is where we inserted our new [Fairy] type.

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?

destinedjagold November 27th, 2013 6:32 PM

Quote:

Originally Posted by TheShinyMew (Post 7958020)
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 November 27th, 2013 6:59 PM

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 November 27th, 2013 7:01 PM

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.

Jdb100 November 27th, 2013 8:34 PM

Quote:

Originally Posted by karatekid552 (Post 7958108)
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.

destinedjagold November 27th, 2013 10:26 PM

Quote:

Originally Posted by Jdb100 (Post 7958272)
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 November 28th, 2013 1:15 AM

Quote:

Originally Posted by destinedjagold (Post 7958067)
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".

karatekid552 November 28th, 2013 3:50 AM

Quote:

Originally Posted by TheShinyMew (Post 7958581)
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

Shiny Lizard January 4th, 2014 7:28 AM

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

destinedjagold January 4th, 2014 3:56 PM

Quote:

Originally Posted by Shiny Lizard (Post 8022037)
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

shaheer07 January 4th, 2014 7:58 PM

I cannot seem to find "1F96B0" using HxD in Win8.1.

You think I'm doing something wrong?

https://drive.google.com/file/d/0B4JA1Kc3xlxiYjRoZWlDTVlTVEk/edit?usp=sharing

What do I do in step 7?

karatekid552 January 4th, 2014 9:19 PM

Quote:

Originally Posted by destinedjagold (Post 8022834)
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.

destinedjagold January 4th, 2014 9:26 PM

Quote:

Originally Posted by shaheer07 (Post 8023143)
I cannot seem to find "1F96B0" using HxD in Win8.1.

You think I'm doing something wrong?

https://drive.google.com/file/d/0B4JA1Kc3xlxiYjRoZWlDTVlTVEk/edit?usp=sharing

What do I do in step 7?

Go to (CTRL + G) the 1F96B0 (hex) address, and then proceed of doing Step 7.

shaheer07 January 5th, 2014 7:54 AM

Oh and I dont see "001F96B0" I see a 001F950 and 001F96B8

Sapphire ROM

destinedjagold January 5th, 2014 1:33 PM

Quote:

Originally Posted by shaheer07 (Post 8024047)
Oh and I dont see "001F96B0" I see a 001F950 and 001F96B8

Sapphire ROM

=/
What about this one here?


shaheer07 January 5th, 2014 2:57 PM

1 Attachment(s)
Quote:

Originally Posted by destinedjagold (Post 8024623)
=/
What about this one here?


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

Attachment 70580

destinedjagold January 5th, 2014 7:22 PM

Quote:

Originally Posted by shaheer07 (Post 8024755)
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


Quote:

Originally Posted by shaheer07 (Post 8024755)
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


Quote:

Originally Posted by shaheer07 (Post 8024755)
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. =/

shaheer07 January 5th, 2014 7:53 PM

Quote:

Originally Posted by destinedjagold (Post 8025145)
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! :)

destinedjagold January 5th, 2014 9:07 PM

Quote:

Originally Posted by shaheer07 (Post 8025188)
What do I do now? Trying to figure out step 9.

Which part of step 9 are you confused about?

Randomlords January 20th, 2014 1:38 PM

How do I change an attack's type to be that of the new type I inserted? Also, can I search for the new type inserted on the Pokedex?


All times are GMT -8. The time now is 2:54 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.