Community

The PokéCommunity

We are still working on a better slogan!

Visit Index



Go Back   The PokéCommunity Forums > ROM Hacking > Tools, Tutorials & Resources
Notices

Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.
New threads in this forum are to be approved by a moderator before they are displayed.

Post Reply
 
Thread Tools
  #1    
Old March 20th, 2010, 04:56 PM
PeregrineFig's Avatar
PeregrineFig
Starting Pokémon Obsidian
 
Join Date: Feb 2010
Location: Michigan, USA
Age: 20
Gender: Male
Nature: Hardy
Unfortunately I'm not 1337 enough to completely create a new behavior byte, so this will show you how to modify the behavior byte that displays the questionnaire in order to make it run a script.

This is for FireRed US version.

Remember, ALWAYS back up your ROM before doing these types of edits, because if a mistake is made, bad problems could pop up.

Tools needed:
  • Hex editor(I use Hex Workshop, google it)
  • AdvanceMap(To set the behavior byte to tiles)
  • VBA(or any other emulator. If you don't have an emulator you probably shouldn't be hacking)
  • XSE (Optional, but will make text insertion much simpler)

First, you need to go to the offset of behavior byte 8F (the byte we'll be changing) in a hex editor. Because I'm not sure what the function of some of the bytes are I can't determine the exact starting position of the data, but the beginning portions don't matter with this method. Go to offset 1A7707. This is a pointer for text to display before the script runs.



Now, either write down 1A7707 somewhere, or just refer back here later. You're going to want to modify this text. Find a free offset with Free Space Finder, you don't need many bytes. 100 will probably be more than enough. Now come up with some text that can be displayed before your script executes. (I couldn't find a way to just get rid of this text box, so be creative) Go to the free offset you just got.



Ignore this next portion if you want to do things the easy way. Open your ROM in XSE and create a dynamic script in this format:

Spoiler:

#dynamic 0x(start offset, I use 740000)
#org @start
= (Just insert your text straight-up here)

Now compile that script, and use the offset it was compiled to for your text pointer.

Now you're going to need to translate your text into hex, if you didn't use the easy XSE method. Here's a table of translations:

Spoiler:

00=
01=À
02=Á
03=Â
04=Ç
05=È
06=É
07=Ê
08=Ë
09=Ì
0B=Î
0C=Ï
0D=Ò
0E=Ó
0F=Ô
10=Œ
11=Ù
12=Ú
13=Û
14=Ñ
15=ß
16=à
17=á
19=ç
1A=è
1B=é
1C=ê
1D=ë
1E=ì
20=î
21=ï
22=ò
23=ó
24=ô
25=œ
26=ù
27=ú
28=û
29=ñ
2A=º
2B=ª
2D=&
2E=+
34=[Lv]
35==
36=;
51=¿
52=¡
53=[pk]
54=[mn]
55=[po]
56=[ké]
57=[bl]
58=[oc]
59=[k]
5A=Í
5B=%
5C=(
5D=)
68=â
6F=í
79=[U]
7A=[D]
7B=[L]
7C=[R]
85=<
86=>
A1=0
A2=1
A3=2
A4=3
A5=4
A6=5
A7=6
A8=7
A9=8
AA=9
AB=!
AC=?
AD=.
AE=-
AF=·
B0=[.]
B1=[""]
B2=""
B3=[']
B4='
B5=[m]
B6=[f]
B7=[$]
B8=,
B9=[x]
BA=/
BB=A
BC=B
BD=C
BE=D
BF=E
C0=F
C1=G
C2=H
C3=I
C4=J
C5=K
C6=L
C7=M
C8=N
C9=O
CA=P
CB=Q
CC=R
CD=S
CE=T
CF=U
D0=V
D1=W
D2=X
D3=Y
D4=Z
D5=a
D6=b
D7=c
D8=d
D9=e
DA=f
DB=g
DC=h
DD=i
DE=j
DF=k
E0=l
E1=m
E2=n
E3=o
E4=p
E5=q
E6=r
E7=s
E8=t
E9=u
EA=v
EB=w
EC=x
ED=y
EE=z
EF=[>]
F0=:
F1=Ä
F2=Ö
F3=Ü
F4=ä
F5=ö
F6=ü
F7=[u]
F8=[d]
F9=[l]
FA=\l
FB=\p
FC=\c
FD=\v
FE=\n
FF=\x




Make sure your text code ends in an FF byte. Now, find the offset of where your text starts. You're going to need to flip the order around. For example, if the offset was 123456, you'd use 563412. Now return to offset 1A7707. There are 3 bytes here, followed by a 08 byte. This is the pointer to the text. Replace the 3 bytes before the 08 with the offset you just wrote your text to, in flipped order as I mentioned earlier. If you were to save and test now, your inserted text would be displayed, then you'd see a yes/no box and the questionnaire.



Now, you're not going to want that yes/no box there. Look after the pointer, there's a 09 byte and a 05 byte. Don't touch the 09. The 05 is the type of message, which is indicating it as a yes/no message. Replace the 05 with either 04 or 06, it doesn't matter which. I use 04 because it looks just a tiny bit nicer, since the box won't close between that text and your script, but if your script doesn't immediately have another text box, use 06.



Now, there are 2 more pointers to edit. One is for if you said yes, one is for no, but without a yes/no choice we want the script to run no matter what, and strangely without the yes/no it alternates every other time. They look the same as the other, 3 bytes followed by a 08. The first is at 1A7714, the second is at 1A771E. Now take the offset of whatever script you're writing to the behavior byte and flip it like you did with the offset of your text earlier. Insert those 3 bytes over the old 3, and leave the 08. (as well as everything else around) Do this for both pointers.

(The image isn't cut off at the right, that's the end of the line, that pointer has 2 bytes on one line and one on the next)


Now, save your ROM and open it up in VBA, and go interact with a tile with the behavior byte 8F (set in AdvanceMap's tile editor; by default the questionnaire pad in the pokemart has this byte) If you did everything properly, your script will run on this tile without any script placed on it. Congratulations, you just made a behavior byte of your script!


Note that the yes/no box above is part of my script, the one stored in the behavior byte is eliminated. Before this box, it displays the text "A POKéMON could be in this tree.", which is what I wrote to the byte's text display, then it compares the move headbutt and if no Pokemon knows it, the script just ends there without showing more text. You need to be a bit creative to make the script byte run seamlessly.
Current Projects:
POKéMON AQUA SAPPHIRE
POKéMON OBSIDIAN


Last edited by hashtag; April 15th, 2010 at 07:47 AM.
  #2    
Old March 21st, 2010, 07:34 AM
metapod23's Avatar
metapod23
Hardened Trainer
 
Join Date: Mar 2009
Gender: Male
Nature: Timid
This should be helpful, but a couple of things.

First, how do I find the general area for the particular behavior byte? I want to change the Surfing behavior byte.

Second, I suppose you could just use XSE to write the script you want spoken rather than doing hex editing, right? Like:

#org @start
= Would you like to use headbutt?

Wouldn't that work, and then write down the offset for the behavior byte to point to?

Third, I didn't write the hex translations table, so I don't deserve the credit.

This will be really helpful for me if I can ever figure out where the behavior bytes I want to edit are located.
  #3    
Old March 21st, 2010, 08:28 AM
ShinyBill
Beginning Trainer
 
Join Date: Feb 2010
Gender: Male
Nature: Hardy
Quote:
Originally Posted by metapod23 View Post
This should be helpful, but a couple of things.

First, how do I find the general area for the particular behavior byte? I want to change the Surfing behavior byte.

Second, I suppose you could just use XSE to write the script you want spoken rather than doing hex editing, right? Like:

#org @start

= Would you like to use headbutt?

Wouldn't that work, and then write down the offset for the behavior byte to point to?


Third, I didn't write the hex translations table, so I don't deserve the credit.

This will be really helpful for me if I can ever figure out where the behavior bytes I want to edit are located.
Yes, but if someone has lots of HEADBUTT trees, making all those scripts in A-Map can really be boring.

Now I have a question, if we use JPAN's hacked FR engine, couldn't we just add more behaviour bytes than editing them?

Last edited by ShinyBill; March 21st, 2010 at 09:01 AM.
  #4    
Old March 21st, 2010, 08:47 AM
Full Metal's Avatar
Full Metal
C(++) Developer.
Community Supporter
 
Join Date: Jan 2008
Location: In my mind.
Age: 19
Gender: Male
Nature: Timid
Send a message via Windows Live Messenger to Full Metal
@shiny bill-um wow...fail. did you even read the tutorial, or metapods question?What he(she) was asking was if you could use xse to compile the text for you, and then just point to that, rather than use a hex editor to do the text editing. And to answer your question metapod, yes you may as well just use a dynamic in XSE and compile some text...

★ full metal.

I like to push it,
and push it,
until my luck is over.
  #5    
Old March 21st, 2010, 09:00 AM
ShinyBill
Beginning Trainer
 
Join Date: Feb 2010
Gender: Male
Nature: Hardy
Quote:
Originally Posted by Full Metal View Post
@shiny bill-um wow...fail. did you even read the tutorial, or metapods question?What he(she) was asking was if you could use xse to compile the text for you, and then just point to that, rather than use a hex editor to do the text editing. And to answer your question metapod, yes you may as well just use a dynamic in XSE and compile some text...

Really wow, my bad. Thought he was trying to say compile one script and assign it to every tree he wanted. Sorry 'bout that.
  #6    
Old March 21st, 2010, 11:13 AM
PeregrineFig's Avatar
PeregrineFig
Starting Pokémon Obsidian
 
Join Date: Feb 2010
Location: Michigan, USA
Age: 20
Gender: Male
Nature: Hardy
I don't know if you could use JPAN's engine or not, my ROM doesn't use it and I'm not about to try patching it to an already-hacked ROM.

To find the location of the byte, what I did was I took the text from the questionnaire (There is a questionnaire. Fill it out?) And translated part of that to hex, then searched for it, then got the offset of that text and searched for a pointer to it. Finding out how the script pointers worked was trial and error, I noticed they used standard scripts when I decompiled one of the offsets that's pointed to for the hex viewer and noticed it was a fully functional script.

And yes, you certainly could use XSE to compile the text. I just prefer writing it out in hex for some reason. I'll go add that to my tutorial, as it'd be a lot easier.

I'm going to go look around the hex code later and see if I can find the beginning of the table of behavior bytes and its pointer. Then if I can figure out the normal behavior byte format, it shouldn't be hard to repoint the table and add new behavior bytes.

@metapod23: I went searching through the hex code for the text "The water is" and found the phrase "The water is dyed", which I expected to be the beginning of the text used for the Surf byte. However, there were no pointers to this offset. So it looks like the Surf byte is stored a bit differently.
Current Projects:
POKéMON AQUA SAPPHIRE
POKéMON OBSIDIAN


Last edited by PeregrineFig; March 21st, 2010 at 12:26 PM.
  #7    
Old March 21st, 2010, 04:39 PM
diegoisawesome's Avatar
diegoisawesome
Not the Script Help Thread
Community Supporter
 
Join Date: Dec 2007
Location: Goldenrod City, Johto
Age: 17
Gender: Male
Nature: Quirky
@PeregrineFig, the text you found is a remnant of the R/S text. If you look alongside it, you'll find DIVE text as well. The actual text is farther into the ROM.


My other resources:
My Website
diegoisawesome's MEGA-HUGE XSE Scripting Tutorial
diegoisawesome's Miscellaneous Finds
The Ruins of Alph Puzzles
  #8    
Old March 21st, 2010, 05:20 PM
PeregrineFig's Avatar
PeregrineFig
Starting Pokémon Obsidian
 
Join Date: Feb 2010
Location: Michigan, USA
Age: 20
Gender: Male
Nature: Hardy
Quote:
Originally Posted by diegoisawesome View Post
@PeregrineFig, the text you found is a remnant of the R/S text. If you look alongside it, you'll find DIVE text as well. The actual text is farther into the ROM.
Ahh, I totally forgot what the text for surfing in FR was. I actually had to play my cartridge to figure it out

metapod, the pointer for the Surf byte's text is at 001A6AEF. It appears to be largely stored the same way as the 8F behavior byte, however, as you might expect, Surf isn't done with a regular script. None of the surf pointers lead to standard XSE scripts, so you'll have to decipher the hex/ASM yourself to edit that.
Current Projects:
POKéMON AQUA SAPPHIRE
POKéMON OBSIDIAN

  #9    
Old March 21st, 2010, 07:18 PM
metapod23's Avatar
metapod23
Hardened Trainer
 
Join Date: Mar 2009
Gender: Male
Nature: Timid
Thanks for the help everyone. I did some testing and it looks like it's the second byte that causes the surf animation, not the first one. So it would be the 04. So I presume since I can't alter the behavior for 04 in XSE, that i could alter another bite that I can find and put that in instead of 04? I'm just not sure which bite to alter or how to locate it. I guess I could use 8F, since that's what the tutorial suggests. I just wish I knew what they all did ...

EDIT: No, that doesn't seem to work after all.

Oh, and I found the offset for the questionnaire script - it's 0x1A6AC0. If you open it in XSE you'll see the whole thing. It would probably be easier to edit it in XSE than in Hex Workshop. Just don't remove the loadpointer part of the script.

And for the record, 8F won't work in the second behavior byte slot as a basic script, but it will work in the first slot - but then you can't surf because you've changed the behavior byte that lets you surf.

Last edited by metapod23; March 21st, 2010 at 07:51 PM.
  #10    
Old March 25th, 2010, 01:40 PM
haefele
Beginning Trainer
 
Join Date: Jun 2008
This tutorial is really... crap.

I've done a research in one hour, and now i'm able to understand what happens for each behaviour byte.
And it wasnt very hard to find out how.

Also the behaviour byte 0x22 stands for the surfer script.
At first its a asm script which loads the offset of the gamescript into r0 and then it branches to a subroutine which starts the gamescript... by asm, you understand?

Its quite easy to find out how it works, give your best, research it and this tutorial will be one of the best i've ever seen ;D

Every door is open with the information you can get by researching the behaviour bytes.
This signature has been disabled.
140 pixels too wide.
Please review and fix the issues by reading the signature rules.

You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
  #11    
Old March 29th, 2010, 10:21 AM
ShinyBill
Beginning Trainer
 
Join Date: Feb 2010
Gender: Male
Nature: Hardy
I can't find another behavior byte for a question, so it could run another script. Can someone please tell me another one?
  #12    
Old March 30th, 2010, 04:13 PM
haefele
Beginning Trainer
 
Join Date: Jun 2008
Take one with another text script. In the indoor tileset you can find many of these behaviour bytes.
Then search for the text in the rom, repoint it, find the scriptoffset, and repoint the script offset.
And now you've to change the pointer to the script offset, to a pointer to your offset.
This signature has been disabled.
140 pixels too wide.
Please review and fix the issues by reading the signature rules.

You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
  #13    
Old March 31st, 2010, 02:15 AM
ShinyBill
Beginning Trainer
 
Join Date: Feb 2010
Gender: Male
Nature: Hardy
Quote:
Originally Posted by haefele View Post
Take one with another text script. In the indoor tileset you can find many of these behaviour bytes.
Then search for the text in the rom, repoint it, find the scriptoffset, and repoint the script offset.
And now you've to change the pointer to the script offset, to a pointer to your offset.
I thought that but since its just text it doesn't have any script to run.
  #14    
Old March 31st, 2010, 09:22 AM
haefele
Beginning Trainer
 
Join Date: Jun 2008
The text is a gamescript which is started by asm.
So if you find the offset of the gamescript, you can also find the pointer.
And so you can change the pointer to another script you want.

I've tested it, you can script like in other events.
This signature has been disabled.
140 pixels too wide.
Please review and fix the issues by reading the signature rules.

You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
  #15    
Old March 31st, 2010, 09:28 AM
ShinyBill
Beginning Trainer
 
Join Date: Feb 2010
Gender: Male
Nature: Hardy
Thanks for the tip. I'm going to try that.
Post Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 02:08 AM.

About Us
© 2002 - 2014 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.

Copyright
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 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. Header artwork by Jordanice of deviantART.

Social Media
If you would like to stay up-to-date with us on the go, when we're down, or other such things, follow us on social media sites--most notibly Twitter, Facebook, and Google Plus--by clicking on the links provided.

Design presented by Peitharchia. Special thanks to Hiroshi Sotomura and Ausaudriel.