XSE (Xtreme Script Editor)
Hey all, for today's post, I'm going to be looking at the XSE application for the Generation III Pokemon games on the Game Boy Advance. XSE is short for Xtreme Script Editor and was developed by a Pokemon hacker by the name of HackMew. The user has since retired from ROMhacking. The link to download XSE is included in my initial blog post, but, for the sake of convenience, you can download it from here as well.
As today's tutorial will involve editing scripts in the game, I recommend downloading a hex editing program to use alongside XSE. I will be using HxD since I have used the application before on another game (Devil May Cry 4: Special Edition on the PC).
In this post, we are going to create a very simple script. This script will allow us to interact with an NPC and give us some dialogue. First, open up XSE using the Pokemon Game Editor program we used in the first few posts. Be sure to load your ROM alongside it.
The calculator in the top right can be used as a hexadecimal/decimal convertor and as a standard calculator. This can be very useful in more complicated scripts. The yellow block underneath is a notepad used for, you guessed it, taking notes during the process. The bulk of the window is used for writing the actual script. To the left of the screen we can see the line numbers for each line of the script.
Now with the program explained, let's begin:
"#dynamic" tells the compiler that we are looking for free space inside the ROM to insert this script into. We need free space in order to actually insert anything, after all.
"0x800000" is the memory address, or offset, where we want to begin searching for free space in our ROM. Whenever we use"0x" and then a number, we're telling the compiler that the value is written in hexadecimal format. "0x800000" specifically is a conventional point to search for free space.
Now, let's open up the ROM in the hex editing program to see how the stored information looks.
Note: Do NOT edit any of the hexadecimals here! Doing so could severely impact and possibly damage the game if you don't know what you're doing! With the hex editor opened, use the search function (Ctrl+f) and type in the keyword "FF". "FF" indicates free space inside the file.
As we're not going to be doing anything too crazy here, leave the hex editor be for now and return to XSE to punch in some lines of script.
The release command unlocks the player character from his/her position after the dialogue with the NPC ends. The end command does exactly what it appears; it ends the script.
With the script set up, now we just have to save and compile it and implement it into the ROM.
First, click File -> Save as... to save your script somewhere. It will save as a Rubikon Code File (.rbc). After you've saved it, click Tools -> Batch Compiler.
Load the Pokemon FireRed ROM, and use the Browse button to find the folder where you saved your script. Check the checkbox to the left of your script file and click Compile.
On this screen, be sure to highlight the @start and 800000 dynamic offset and click Copy. We'll need this soon. Open up Advance Map from PGE (make sure the ROM is still loaded). We're going to be paying another visit to Pallet Town.
In the Events tab, scroll to the bottom. Go to where it says "Number of person events" and increase the 3 to a 4 and then click Change events. This section loads the total amount of certain scripted events for the current map.
After doing so, a new event will appear in the top left corner of the map. Move this to any desired spot. In the "script offset" box on the right hand side, paste the value we saved earlier. We can also assign a new Movement type so the NPC isn't completely static, but this is entirely optional. Be sure to save your changes, and voila! We have created a new NPC with a dialogue box and added it to the map!
With that, the basic scripting tutorial is now complete. My next post for this blog will be my final post. I will go over all the changes we have made and run the game to check out what we've added. Thank you all for tuning in!
As today's tutorial will involve editing scripts in the game, I recommend downloading a hex editing program to use alongside XSE. I will be using HxD since I have used the application before on another game (Devil May Cry 4: Special Edition on the PC).
In this post, we are going to create a very simple script. This script will allow us to interact with an NPC and give us some dialogue. First, open up XSE using the Pokemon Game Editor program we used in the first few posts. Be sure to load your ROM alongside it.
If you click on "Format" in the top left, you can edit the appearance of the program |
The calculator in the top right can be used as a hexadecimal/decimal convertor and as a standard calculator. This can be very useful in more complicated scripts. The yellow block underneath is a notepad used for, you guessed it, taking notes during the process. The bulk of the window is used for writing the actual script. To the left of the screen we can see the line numbers for each line of the script.
Now with the program explained, let's begin:
"#dynamic" tells the compiler that we are looking for free space inside the ROM to insert this script into. We need free space in order to actually insert anything, after all.
"0x800000" is the memory address, or offset, where we want to begin searching for free space in our ROM. Whenever we use"0x" and then a number, we're telling the compiler that the value is written in hexadecimal format. "0x800000" specifically is a conventional point to search for free space.
Now, let's open up the ROM in the hex editing program to see how the stored information looks.
Note: Do NOT edit any of the hexadecimals here! Doing so could severely impact and possibly damage the game if you don't know what you're doing! With the hex editor opened, use the search function (Ctrl+f) and type in the keyword "FF". "FF" indicates free space inside the file.
As we're not going to be doing anything too crazy here, leave the hex editor be for now and return to XSE to punch in some lines of script.
This is quite a bit, so lets break it down |
- #org @start: This line simply indicates the start of where the actual script will begin.
- lock: The "lock" command locks the player in place, meaning the player character will be unable to move from his spot for the time being.
- faceplayer: This forces the NPC we're interacting with to face the direction of wherever the player is.
- msgbox @talk 0x6:
- The "msgbox" command displays a dialouge box with the NPC's text.
- The "@talk" pointer tells the compiler where this particular NPC dialogue is stored. Since there is no "@talk" space yet, we'll create one down below soon.
- "0x6" tells the compiler that this is a regular message box. There are other values we can use here to give our dialogue box special properties, but let's keep it simple and clean for now.
Lines 0007-0008 indicate what we want our NPC to say and to store the @talk we used earlier. |
The release command unlocks the player character from his/her position after the dialogue with the NPC ends. The end command does exactly what it appears; it ends the script.
With the script set up, now we just have to save and compile it and implement it into the ROM.
First, click File -> Save as... to save your script somewhere. It will save as a Rubikon Code File (.rbc). After you've saved it, click Tools -> Batch Compiler.
Load the Pokemon FireRed ROM, and use the Browse button to find the folder where you saved your script. Check the checkbox to the left of your script file and click Compile.
This tells us where our script is going to be stored |
On this screen, be sure to highlight the @start and 800000 dynamic offset and click Copy. We'll need this soon. Open up Advance Map from PGE (make sure the ROM is still loaded). We're going to be paying another visit to Pallet Town.
In the Events tab, scroll to the bottom. Go to where it says "Number of person events" and increase the 3 to a 4 and then click Change events. This section loads the total amount of certain scripted events for the current map.
After doing so, a new event will appear in the top left corner of the map. Move this to any desired spot. In the "script offset" box on the right hand side, paste the value we saved earlier. We can also assign a new Movement type so the NPC isn't completely static, but this is entirely optional. Be sure to save your changes, and voila! We have created a new NPC with a dialogue box and added it to the map!
The NPC is highlighted with the red box on the map. Behold him in all his Game Boy glory. |
With that, the basic scripting tutorial is now complete. My next post for this blog will be my final post. I will go over all the changes we have made and run the game to check out what we've added. Thank you all for tuning in!
Comments
Post a Comment