• 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?".
  • 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.

How to [Probably] Find Any Script Even Outside A-Map

Bladecraft

It's written "Bladecraft" on my forehead.
83
Posts
7
Years
  • Age 24
  • Seen Jun 18, 2020
Introduction
Eyryyybody! I'm Blade, and I'm a decent rom hacker with a nice knowledge of scripting.
This tutorial is made especially for NoMoreStars, and I thought considering I had this problem too, I'd make a tutorial for everyone, using NoMoreStars's problem as an example.

Let's begin
So, we'll be attempting to remove the script where Mom asks the player to come over to the TV to see Dad in his gym. First of all, we need to find this script. Since this script happens after leaving the room into the living room in your house in Littleroot, we can assume that setting the clock sets some sort of variable, then there's a level script in the player's house, but that's incorrect.

A brief checking can tell that non of the tile scripts nor the level scripts in the living room in the player's house indicate of this script.​


So, what do we do to find the script?
We will need the following tools:
Any Hex Editor (most people including myself use HexD)
G3T (Gen 3 Tools for the Anti-Exploud feature)
XSE to easily change the script and find how does the game write commands in hex​


Step One
First, we ask ourselves the following question: What do we know about this script?
We need to find unique features about this script in order to find it.
The easiest to use are texts, so that's what we're going to do.

wUj2lw7.png


We're going to use this piece of text from the game.
Note that the text you use must be from the beginning of the msgbox, or you will be stuck later on.​


Translating Into Hex
Now let's say we were to write this text string in a script, we would do it like so:
= MOM: Oh! [player], [player]!/nQuick! Come quickly!​
Hex Vocabulary
Spoiler:
Now to the Translating Part
Now, we open up G3T (with any Emerald rom) and open the Anti-Exploud Feature.
Into the "Old Text" box, we write the text as it appears in the game.
MOM: Oh! [player], [player]! Quick! Come quickly!

Since G3T can't translate [player] into anything, we will just leave those as spaces for now.

BiMgRqe.png


Anyways, we copy the hex values from the box under "Old Text", make sure it's from Old and not New text, so it's not accidentally decapitalized, since we're looking for the text that's already in the game.​
Here's our result:
C7 C9 C7 F0 00 C9 DC AB 00 B8 00 AB 00 CB E9 DD D7 DF AB 00 BD E3 E1 D9 00 E5 E9 DD D7 DF E0 ED AB​
Fine Tuning
Anyhow, we got this pile of un-understandable garbage, what do we do with it?
First, we need to insert the [player] part.

You can start reading and translating from hex, but I just like matching up the letters like so:

M`O`M``:````O`h``!`````,````!`````Q`u``i``c``k``!````C``o`m`e````q`u``i``c``k``l``y``!
C7 C9 C7 F0 00 C9 DC AB 00 B8 00 AB 00 CB E9 DD D7 DF AB 00 BD E3 E1 D9 00 E5 E9 DD D7 DF E0 ED AB

So we simply put the hex value for [player] in the correct places, which is right before the first B8 and the second AB

And now we got this:

C7 C9 C7 F0 00 C9 DC AB 00 FD 01 B8 00 FD 01 AB 00 CB E9 DD D7 DF AB 00 BD E3 E1 D9 00 E5 E9 DD D7 DF E0 ED AB

Next is to put text commands (\p, \l, \n) in the correct places. We know that \n is FE, could you figure this out by yourself?

Answer:
Spoiler:


Now that we know what should we be searching, we only now open our rom in HxD.​


Last Step
Once you opened your rom in HxD, press Ctrl+F to start the find function and make sure the Datatype is set to Hex Value.
Copy and paste the hex values we edited from G3T, and start by searching forward.
I found the text in 1F7B96. How do I know this? HxD is nice enough to tell us this information in various places.

fC1pLgd.png


Now, we would like to make sure we're on the correct string of text, and that this text does not accidentally appear twice. For that, we will simply search forward again.
In this instance we don't have this text appearing anywhere else in the game. This is because we've searched for enough text to make it unique to this cutscene. If we were to search for "MOM" or "[player]" and only that, there would be a risk that we're editing the wrong script, which we don't want.​
Anyways, we found that, now what do we do?
Simple. As we all should know, when we write a script and put a msgbox command somewhere, we always add a pointer to the text. Which means, this msgbox we just found is a part of a script, now we need to find that script.
What we do is find the pointer to the text. How do we do that? Great question.

We take the beginning offset of the text (1F7B96 in our example) and separate it into three bytes.
1F7B96
1F 7B 96

Now, we reverse the order of these three bytes (or simply replace the first and last one).
1F7B96
1F 7B 96
96 7B 1F

And put a 08 in the end of all that.

Here's the entire process:
Spoiler:
Important Sidenote:
Spoiler:

Anyways, back on track, now we search HxD for 96 7B 1F 08, which is the line "msgbox 0x001F7B96" in the script we're looking for. Making progress!
I found 96 7B 1F 08 in the offset 292964.
Now, we open 292964 in XSE, while our rom is open in it and we find this mumbo jumbo.​
aF0Ce07.png
In case you don't know what I just did, simply open XSE, go to File -> Open and open your rom. Then in the Offset box in the top right, write down your offset, 292964 in my case.
Back on track, I don't really know why that is, I only assume it's because XSE is reading the script wrong because it doesn't know the entire script.​
Final Step:
What we do now, is simply walk back byte by byte until we find the entire script, which lies in the offset 29294B. I know this is especially true because in the previous byte (29294A) there's simply the line "end".

Sometimes, you may see after putting in the offset for the first time comprehensible parts from the script you're looking for.

Anyways, here's the complete script:
Spoiler:


Final Words & Removing The Script
That concludes the tutorial, so those who read it for this purpose may now thank me and accept me as their Lord and Savior. To be honest, this may seems like a long and complicated process, but with some experience you can do this in only five minutes and with extreme ease. However, my job is not done.

To be honest... I completely lied to you guys.
All of this tutorial might be helpful, but it is definitely NOT the way to remove that event from the game. The solution is actually a lot simpler than this.


What A Twist!

As a lot of us know, vars, somewhat like flags are often used to trigger and block events from happening. We need to understand this in order to achieve our goal.
The var 0x4092 is in charge of the tutorial stuff.
For example, if it's set to 0x1 it means you left the truck. If it's set to 0x3 it means there are Vigoroth's doing stuff to your house.

Here's what we need to do:

We open the clock script from A-Map.
It's a pretty long script, so we'll be looking only at this specific part:

Spoiler:

Notice the "setvar 0x4092 0x6" line.
If we will delete this line, or change the setvar from 0xE to something else, a different event will occur.

I am not sure what the var is set to right now, but I do know that if we delete the line entirely, the game will think that we haven't set the clock, and therefore will send us back to our room.

It's all about experimenting, I first deleted the line and then understood the above, and then I changed the line to "setvar 0x4092 0x8"
When var 0x4092 is set to 0x8, this means you left your house after setting the clock and you now should go to your Rival's house.
Here's a gif proving that this is working.

kZCopOS.gif


Actual Final Words:

Now of course, I believe that I have done a good job constructing this tutorial, and explaining everything and what to do. However, the greatest lesson this tutorial presents is that sometimes, you're trying to do the right thing in the wrong way.
We've learned how to find any script, but it turns out we didn't need that information at all to do what we were trying to do for the longest time.

Life lessons from a rom hacking tutorial. Bet you didn't expect that.

Honestly? Neither did I.​
 
Last edited:

NoMoreStars

Trying
45
Posts
9
Years
  • Age 25
  • Seen Apr 3, 2024
Thanks so much for this tutorial! I had no idea that the script was hidden so well into the rom! Also duh, I should've just tired experimenting with variables but for some reason I just totally didn't even think of that lol. Anyways, I know how to find any almost any line of dialogue in the Hex Editor now, which may come in handy? Well, who knows. But anyways, this was a very good tutorial and a good reminder that sometimes there's a simple fix to a seemingly difficult problem.
 
Back
Top