PeregrineFig
Starting Pokémon Obsidian
- 202
- Posts
- 15
- Years
- Michigan, USA
- Seen Feb 22, 2011
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:
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:
#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:
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=
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=
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.
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.
![[PokeCommunity.com] Making a script behavior byte [PokeCommunity.com] Making a script behavior byte](https://i48.photobucket.com/albums/f201/PeregrinFig/image1.png?t=1269179578)
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.
![[PokeCommunity.com] Making a script behavior byte [PokeCommunity.com] Making a script behavior byte](https://i48.photobucket.com/albums/f201/PeregrinFig/image2.png?t=1269179608)
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=
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=
F8=[d]
F9=[l]
FA=\l
FB=\p
FC=\c
FD=\v
FE=\n
FF=\x
![[PokeCommunity.com] Making a script behavior byte [PokeCommunity.com] Making a script behavior byte](https://i48.photobucket.com/albums/f201/PeregrinFig/image3.png?t=1269179681)
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.
![[PokeCommunity.com] Making a script behavior byte [PokeCommunity.com] Making a script behavior byte](https://i48.photobucket.com/albums/f201/PeregrinFig/image4.png?t=1269179722)
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.
![[PokeCommunity.com] Making a script behavior byte [PokeCommunity.com] Making a script behavior byte](https://i48.photobucket.com/albums/f201/PeregrinFig/image5.png?t=1269179745)
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)
![[PokeCommunity.com] Making a script behavior byte [PokeCommunity.com] Making a script behavior byte](https://i48.photobucket.com/albums/f201/PeregrinFig/image6.png?t=1269179775)
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!
![[PokeCommunity.com] Making a script behavior byte [PokeCommunity.com] Making a script behavior byte](https://i48.photobucket.com/albums/f201/PeregrinFig/image7.png?t=1269179833)
![[PokeCommunity.com] Making a script behavior byte [PokeCommunity.com] Making a script behavior byte](https://i48.photobucket.com/albums/f201/PeregrinFig/image8.png?t=1269179870)
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.
Last edited by a moderator: