• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Item Creation in FireRed: Step by Step, From Start to Finish

275
Posts
13
Years
  • Seen Oct 9, 2019
Item Creation in FireRed

Pokemon FireRed contains numerous "????????" items. These are unused items that serve no purpose in the game. Using hex editing and some programs, we can turn these into real items, with their own names, descriptions, and images. Certain hacks that have been released even allow us to make our items run scripts.

This tutorial will tell you how to do all of that -- that is, how to create an item with a custom name, description, image, and (if using JPAN's hacked engine) function.

Requirements
To follow this tutorial, you will need:

Basic changes
Start up Item Manager, and choose any of the "????????" items. In this tutorial, we will be editing the "????????" that comes right after "GREEN SHARD".

m8EFbat.png

Use Item Manager to change the item's name and attributes as desired. Do not touch the "Description" or "Index" fields; we will deal with the description later.

I68qReb.png

Correcting the index
Every item has an "index" value, which the game seems to use to verify that the item is real. The index values correspond to the order the items' data is stored in. The "????????" items, however, don't have valid indices; they all have index values of 0. To turn our "????????" into a real item, we must give it a valid index.

If you look at the indices of valid items, you'll find that they're all numbered in sequence. BLUE SHARD has an index of 31, YELLOW SHARD is 32, GREEN SHARD is 33... and the "????????" after it is 0. We need to give it an index that follows the pattern -- in this case, 34.

Remember that we're dealing with hex, not decimal.

Change the index and save your changes. Close the Item Manager.

EyHH3xt.png

Changing the description
XSE is a script editor. People use it to make NPCs talk and perform other actions. One of XSE's features is the ability to add new strings (chunks of text) to the ROM, for scripts to use. We're going to do something a little different, though: we're going to write a "script" that consists of a string... and nothing else. And then we are going to tell the game to use that string as the description for our new item.

Open XSE and load your ROM.

U91UrK4.png

In the main textbox, type the following:
Code:
#dynamic 0x0800000
#org @string
= This is a description for our new\nitem.
The first line (#dynamic 0x0800000) tells XSE to automatically look for unused space in the ROM, and to store our string in any free space it finds. The number (0x0800000) just tells XSE where to start looking.

The second line (#org @string) tells XSE that we are creating a new section for our "script". In this case, the section is a string.

The third line is the actual value of our string. (The equal sign and first space won't be stored.) The "\n" represents a line break. Feel free to use any value of your choosing; XSE has a "Text Adjuster" that you can use to place line breaks in the proper spots. Remember that you only have three lines of text to work with.

n1hyif5.png

Click the button with an image of two gears ("Compile"), and pay very careful attention to the window that pops up when you do.

fcGxEmN.png

At the bottom of the "Compiler Output" window, there will be two list-boxes. Above them is the text "Dynamic Offsets". These boxes tell us the specific offset that XSE saved the string to. Click the "Copy" button to copy the offset. Do not lose this number.

(The number probably will not be the same as the one in my screenshots. For this tutorial, I am using a FireRed ROM that has had no other changes applied to it, so the offset for my description is 800000. If you've made changes to your ROM, your offset will probably be different. This is perfectly normal.)

Close XSE. You don't have to save, if it asks you.

Using the item description
Reopen the Item Manager.

Go back to the "Description" box, and replace its contents with the offset that the description was saved to. Hit the "Save" button, and you should see your new description.

5Nnnql1.png

Adding a new item image to the game
Before we can give the item a new image, we must insert that image into the ROM. And before we can insert the image into the ROM, we have to create it.

Open the image editor of your choice, and create a 24x24-pixel image. Do not use more than 16 colors (including the background color, which should become transparent). When you are finished, use the image editor to decrease the color depth of the image, and save it as a 16-color bitmap (*.BMP) or PNG. (Microsoft Paint won't be able to reduce the color depth, but the freely-available editor IrfanView can.)

For the tutorial, we will be using this image:

kzlxHnO.png


Now that we have created the image, open NSE, and use it to load your ROM. When you do, NSE will automatically open the Hero overworld sprite for viewing.

K2GVGH1.png

Open the "View" menu, and choose "Offset". You should see this dialog box:

q9mIvpJ.png

In order to create a new sprite, we have to find unused space in the ROM. Open the Free Space Finder, and load your ROM.

n6xqQ7Q.png

Use FSF to find 256 bytes of free space starting at 800000. Copy the offset that it gives you. Note that it may not give you the same offset that it gives me in these images; it depends on how much content you have added to your ROM.

The offset must end in "0", "4", "8", or "C". If it doesn't, then the game will crash when it attempts to load the sprite!
If the offset doesn't end in one of those characters, then simply increase it until it does. If you so desire, you can use FSF to make sure that the revised offset still has enough room.

ADavEL8.png

Paste the offset into the NSE dialog ("Offset Browsing") that you opened before. Write it down somewhere else as well, as you will need it later.

cxZWIzC.png

Add 0x100 to the offset. If you don't know how to do math in hex, then you can use Windows Calculator (in "Programmer" mode). Insert the new offset into FSF's "Search from offset" textbox. Search for 128 bytes of free space.

jpwTPiM.png

Copy the result, and paste it into the "Palette" field in the NSE dialog. Write it down somewhere else as well, as you will need it later.

The offset must end in "0", "4", "8", or "C". If it doesn't, then the game will crash when it attempts to load the sprite!
If the offset doesn't end in one of those characters, then simply increase it until it does. If you so desire, you can use FSF to make sure that the revised offset still has enough room.

0mWd5RS.png

In the NSE dialog, change the "Size" fields to both read "24", and then click "Open". Then close the dialog. Close FSF.

pJKLgrQ.png

You should see this:

tnTLdWE.png

Now, we need to import the image file into NSE. Go to File -> Import -> Import Image. This dialog box will appear:

[Image 18 -- Missing due to link rot. Sorry!]

Use the "Load" button to select your image file. Then, change the "Image" dropdown to "All" and click "Save". You'll see a confirmation dialog; click "Yes". On the Import dialog, click "Close".

The main NSE window should now look like this:

o1qrXYo.png

Go to File -> Insert. Insert your image and your palette, using the offsets that you entered earlier. For both dialog boxes, check "Compress Data [Lz77]".

Go to File -> Save. Close NSE.

Using the new item image
Open Item Image Editor and load your ROM.

[Image 20 -- Missing due to link rot. Sorry!]

Find your item in the list and select it. This may be a bit difficult, as Item Image Editor does not use the item names that are stored in the ROM.

AYLznHh.png

Change the image and palette offsets to the ones that you copied out of FSF. Go to File -> Save ROM, and then exit the Item Image Editor.

Making the item do something
NOTE: This part of the tutorial only works if you are using JPAN's Hacked FireRed Engine. If your ROM does not use that hack, then attempting to follow these instructions will only cause problems.

JPAN's FireRed Hacked Engine contains an interesting little feature. It is possible to make an item that, when used, backs the player out of their Bag and runs an XSE script. We are going to explore how to do that, but first, a warning: it does not work if you activate an item by pressing Select.

First, we have to create a script for our item to use. Open XSE. You can create any kind of script you want; I'll be making a script that teleports a player to Map 4.1 -- the player's bedroom, in an unmodified FireRed ROM. The code:

Spoiler:

Compile the script and write its offset down somewhere. For my FireRed ROM, the offset is 800154.

Open the Item Manager. Click the ">>" button to go to the second "page" of the form. Change the "Field Usage" value to 161521; this is where some of JPAN's code is stored. Click the "Save" button.

YMC5EcG.png

Unfortunately, we'll need to break out the hex editor now. And we'll also need to do some math. Open your ROM using the hex editor of your choice, and go to offset 03DB028.

XFBD4PF.png

Here is where we need to use some math. Take the hex index of the new item -- 34, in this case -- and multiply it by 2C. (You can use Windows Calculator's "Programmer" mode for this.) The result, for index 34, is 8F0. Add the result to the hex number 03DB028. When you're done with all the math, you'll have the offset of the first letter in your item's name -- 3DB918, for this tutorial. Go to that offset in your hex editor. Write it down somewhere, too.

AxDTmb7.png

Add hex E to that offset (result 3DB926, for this tutorial) and verify that the value of the byte at that new offset is the same as the item's index. For this tutorial, we check if the byte at offset 3DB926 has the hex value "34". If it does, then proceed.

Take the offset of your script. Split it into bytes and put them in reverse order. My script offset, 800154, should become 54 01 80. Put an 08 at the end of your rearranged offset: for me, the result is 54 01 80 08. This data is called a "pointer"; it tells the game where to look for something. We need to insert that pointer into a part of the item data that most programs don't allow you to modify.

Remember the offset that I said to write down? The offset of the first letter in your item's name? Take that offset and add hex 28 to it. For this tutorial, that's 3DB918 + 28 = 3DB940. Go to that offset in your hex editor. Select the four bytes located there.

GDst08I.png

Replace them with your pointer.

smoLalZ.png

Take the offset of the first letter again, and add 1C to it. (For this tutorial, that'll be 3DB934.) Go to that new offset. The first three bytes at that offset should be 21 15 16. If the byte after those three is not 08, change it to 08. (Apparently, Item Manager is a bit forgetful sometimes...)

vQJbwsW.png


SnJk5Y7.png

Save the changes and exit your hex editor.

Done!
All that remains is for you to test the item. Since it's an unused item, there's no normal way to obtain it in-game. You'll have to use XSE to create or modify a script to give it to you.

Here are some images of me testing the new item out; if you used the text and images provided in this tutorial, your finished item should look pretty much the same. To test, I created a separate copy of the ROM and in that copy, I replaced the bedroom PC script with one that just hands out the item.

5iP8H6w.png
cYkqiP1.png
UGkWcfS.png

FCHsbJx.png
w9kqkeR.png

I took the item from the PC. Checked the icon and description. Went outside, used it. And it worked.

Acknowledgments
My instructions on how to use the item functionality in JPAN's hacked engines were based on the instructions that he posted in his thread. Info on the Select-button bug in that functionality also posted by JPAN.
 
Last edited:

Quickster

Dream or Drop?
351
Posts
16
Years
  • Seen Apr 4, 2016
This is a great tutorial! Everything seems to be covered here, and the screen shots make it so much easier to follow. If I ever get back into hacking Ill deffinately use this!
 
5,256
Posts
16
Years
Just like your debugging tutorial, this is great. There's only one problem I have--there is no Field Usage section in the version of the Item Manager you linked to (or, for that matter, the version I had beforehand). Is this an older version of the Item Manager? If so, what version is it? Thanks in advance, and, again, this is an awesome tutorial. ^^
 
275
Posts
13
Years
  • Seen Oct 9, 2019
There's only one problem I have--there is no Field Usage section in the version of the Item Manager you linked to (or, for that matter, the version I had beforehand). Is this an older version of the Item Manager? If so, what version is it? Thanks in advance, and, again, this is an awesome tutorial. ^^
It's a version from way back in 2010, actually, but...

Wait, did you hit the ">>" button when editing your item's details? It's easy to miss; it takes you to the next "page" of the form, which is where the Field Usage section is.

If the field isn't there in the newest version of the program, then I can modify the tutorial and show how to do it in hex.
 
275
Posts
13
Years
  • Seen Oct 9, 2019
So, would following this tutorial allow the creation of functioning new evolution stones?
No, unfortunately. That would involve some extensive changes to, among other things, the parts of the game engine that handle evolution.

Anything that can be done in an XSE script can be done when using a custom item, if you're using JPAN's FireRed Hacked Engine. Anything beyond that will require knowledge that I don't have.
 
5,256
Posts
16
Years
What you could do with JPAN's engine, you could technically replace the Pokémon with a new species through a new special, so you could potentially have an evolutionary stone that just wouldn't show the evolution animation.
 
275
Posts
13
Years
  • Seen Oct 9, 2019
What you could do with JPAN's engine, you could technically replace the Pokémon with a new species through a new special, so you could potentially have an evolutionary stone that just wouldn't show the evolution animation.
True... But you'll be hard-pressed to preserve some of the Pokemon's unique data, i.e. gender. I haven't found a way to manipulate (read or write) Poke gender, even with JPAN's hack; I don't think there is a way. Earned EXP could also be a problem.

(Of course, if I'm wrong and those data, too, can be preserved, then that's totally awesome and "pseudo-evolution" with scripting then becomes practical.)
 

sky_queen3

Mimikyu is cute :3
271
Posts
15
Years
No, unfortunately. That would involve some extensive changes to, among other things, the parts of the game engine that handle evolution.

Anything that can be done in an XSE script can be done when using a custom item, if you're using JPAN's FireRed Hacked Engine. Anything beyond that will require knowledge that I don't have.

Ok, thank you. *goes back to the drawing board for new evo stones* This is still useful to me, once I learn how to use JPAN's FireRed Hacked Engine anyway. :)
 

EdensElite

No0b, but getting there.
190
Posts
12
Years
  • Age 28
  • UK
  • Seen Jul 4, 2014
Does anyone know the script to make items act as HMs. I want to make a Item that cut trees and lets me surf etc.
 
275
Posts
13
Years
  • Seen Oct 9, 2019
Does anyone know the script to make items act as HMs. I want to make a Item that cut trees and lets me surf etc.
I think that would depend on the scripts for trees.

There's only one real difference, I think, between how the press-A-at-tree script is initiated and how an item-based Cut script would work:

When using a Pokemon, you press A on the tree -- it's a Person event. Therefore, when the Cut HM script runs, the game already knows that you are next to and facing the tree. However, your item script can be used from anywhere, so you will have to manually check if the player is next to and facing a tree.

With that sole exception, things would proceed more-or-less as they do when using the normal Cut script. So you'd want to go into a clean FireRed ROM with AdvanceMap, find a Cut tree, and open its script in XSE to see what it does. You'd then copy (or rewrite from scratch, if desired) the relevant parts of the script.

I may provide more info on this (a kind of sub-tutorial) if I feel like it. :\

EDIT1: You'd need two scripts: one for if you press A on the object in the overworld, and one for if you use the item from the Bag. The first is the easiest -- you could take the default scripts from an unaltered FireRed ROM, and change them so that they check for an item instead of an attack.

The second is the hardest because, as I said above, you don't know if the player is next to a tree/rock/etc. OW, and there are no specific commands to find that out. Out of sheer boredom I am doing a search to see if I can, for example, loop through all OWs and check their positions manually.

EDIT2: I can't find a way to check the necessary OW data. Using a Cut item from the Bag requires that one loop through all OWs, checking their positions relative to the player and the sprites they are currently using. (You need to know if the player is next to an OW, and if that OW is a tree.) I can't find any info on this data in RAM.
 
Last edited:
275
Posts
13
Years
  • Seen Oct 9, 2019
The Hacked Engine has some (couple) of boot errors.

Trojan.DHSAF
4WLF
Any help? Ohhhhh just viruses.
Did you use the patch or the tool? I used the patch and my computer's just fine. 0_o

How must i do if i want create a TM/HM on the ????? item?
I have no clue.

For the image, you could just copy the image and palette offsets for any TM with the same move type (i.e. if your TM teaches a Dark move, copy the image data for another Dark TM). But I don't know how you'd go about actually making the new item work as a TM.
 

ManInTheMask

Pro Hacker
31
Posts
12
Years
  • Seen Oct 27, 2016
ManInTheMask here, it is possible to do this on Leaf Green, and Emerald, right? Because if it is, you should mention rom names that we can do this on too, other than Fire Red. It's just a suggestion.

Also, can I do this on Ruby and Sapphire, minus the pictures? Ruby and Sapphire doesn't use item pictures, except berries.
 
275
Posts
13
Years
  • Seen Oct 9, 2019
ManInTheMask here, it is possible to do this on Leaf Green, and Emerald, right? Because if it is, you should mention rom names that we can do this on too, other than Fire Red. It's just a suggestion.

Also, can I do this on Ruby and Sapphire, minus the pictures? Ruby and Sapphire doesn't use item pictures, except berries.
The process itself should be possible in all of the Advance-gen games, but the offsets will differ and I haven't done it myself.

Since Ruby and Sapphire don't have item images, the data structure for items will probably be different in those games, so that would affect things, too.
 
Back
Top