• Topic Archived
You're browsing the GameFAQs Message Boards as a guest. Sign Up for free (or Log In if you already have an account) to be able to post messages, change how messages are displayed, and view media in posts.

User Info: Ethan_Silver

9 years ago#1
Meh, figured I'd share this for any ROM hackers interested in making their own SoM hack. I started work on this one last night and already have enough stuff to get most of the game's event scripts / text dumped and editted.

Event Script Pointers A: C9:0000 - C9:07FF
Event Script Pointers B: CA:0000 - CA:0C01

Event IDs 0x0000-0x03FF can be found using event script pointers A (for instance, the first one is 00 08, meaning C9:8000...) Events with an ID above 0x03FF can be found using event script pointers B (the first being ID 0x0400, then 0x0401, so forth...)

Scripts are like in any other ROM... they're read byte by byte until the "end" instruction. Instructions under 0x50 are commands, instructions from 0x50-0x5F are dialog-related commands, and anything above that is output to the screen as text.

0x00 "End". Stops the current script.

0x02 "Return". Returns from commands 0x20-0x27.

0x0F Shows the "blacksmith" menu.
0x10-0x17 Jump to event. Reads 1 byte and uses the low nybble of the command to calculate the event ID. For instance, "14 2F" would jump to event 0x042F. "11 50" would jump to event 0x0150. So forth.

0x1F Displays a special screen/event (0: name the boy, 1: name the girl, 2: name the sprite, 3/4 mana palace event, 6 save game, 7 reset)

0x20-0x27 Like 0x10-0x17 but once a "return" (0x02) instruction is hit, execution returns to where the instruction was used. Kinda like a "gosub" in BASIC.

0x28 Wait. Reads 1 byte and waits for that long. Ex: "28 10" would wait 0x10 units. The exception is 0: waiting for "0" time means waiting until the player hits "confirm".

0x2B Adds a character to the party. "2B 00" adds the boy. "2B 01" adds the girl, "2B 02" adds the sprite.

0x2D Triggers an effect. "2D 00" and "2D 01" flash/stop the screen. "2D 02", "2D 03", "2D 04" shake the screen vertically, horizontally, and stop it. "2D 08" centers the camera.

0x32 Makes an onscreen sprite move. Reads 2 bytes: the first is the sprite ID (0: player, 1: character 2, 2: character 3, 3+: depends on what else is there) and the second is the direction/distance: the first two bits determine the direction and the rest, how far to move. A distance of 0 means the character just faces that direction. So for instance, to make the Girl face down, you'd use "32 01 40" (01: girl, 40: face up).

0x40 Plays a sound. The first is the mode (1: music, 2: sound), the second the ID, and there are two other parameters I haven't worked out yet. Ex: "40 01 01 0A FF"

User Info: Ethan_Silver

9 years ago#2

0x50 Opens a text window.
0x51 Closes a text window.
0x52 Clears the text window.
0x54 Followed by 1 byte that indicates an enemy's ID. Outputs its name as text. "54 01" outputs "Rabite".
0x55 Followed by 1 byte that indicates an item's ID. Outputs its name as text.
0x56 Followed by 1 byte that indicates a spell's ID. Outputs its name as text.
0x57 00: Outputs character 1's name.
0x57 01: Outputs character 2's name.
0x57 02: Outputs character 3's name.
0x58 Begins defining selection options (see below)
0x59 Reads 1 bytes and outputs that many spaces. "59 04" outputs 4 " " characters.
0x5A Creates a selection option (see below) Takes 1 parameter: the X position of the cursor for this option.
0x5B Ends the selection option definition (see below)

To use text, a window must be opened with 0x50. You can then output text anywhere in the script by writing down its value (just find some .tbl file for the game). The window automatically scrolls and such, so typically the game uses "28 00" (wait for button) and 0x52 to clear the contents. The window must be closed with 0x51 once it is no longer needed. Looks bad otherwise. :)

Selection options (commands 0x58, 0x5A, 0x5B) works as follows: first the 0x58 command defines the start of a new list. Each option is then defined with the 0x5A command. Once the 0x5B command is hit, the game will then allow the player to pick between all defined options in the select list.

Cancelling moves the script to the next instruction, otherwise the script skips 2 bytes per option (for instance, picking the 2nd option would skip ahead by 4 bytes). Typically, a select list is followed by a series of jump commands that go to some script that handles the result of each option.

58.........Begin Select
5A 04.....Create Option(4) "Yes" ; Option 1, X = 4, followed by the text "Yes"
5A 08.....Create Option(8) "No" ; Option 2, X = 8, followed by the text "No"
5B..........End Select
10 50.....Goto Event 0050 ; Handles cancel
10 80.....Goto Event 0080 ; Handles option 1
11 0C....Goto 010C ; Handles option 2

User Info: Ethan_Silver

9 years ago#3
One last command: 0x42. I'm not quite sure how it works, but it takes 2 parameters. The first is used to calculate an offset: 0xCF00 + parameter 1. The second is a value compared to the value at the offset somehow. If some as-of-yet unknown test passes, the next 2 bytes in the script are skipped (they're usually 0x10-0x17 or 0x20-0x27 instructions). It's used to add conditions basically ("If... then...")

Finally, a few example scripts taken from the game...

Event ID 0x000B
Pointer C9:0016 9A 08
Offset C9:089A

089A: 50
089B: AC 85 96 89 96 85 84 80 A7 81 8E 81 80 AD 97 8F 92 84 C8
08AE: 40 02 16 0F 88
08B3: 28 10
08B5: 51
08B6: 02
08B7: 00

089A Open Window
089B "Revived Mana Sword!"
08AE Play Sound 0x16 ?0x0F ?0x88
08B3 Wait 16 Units
08B5 Close Window
08B6 Return
08B7 End Script

The "Revived Mana Sword!" event. It opens a text window, displays the "Revived Mana Sword!" message, plays the sound effect, and closes the window after 16 units of time. A simple script. Note the return instruction: this must be called with a "gosub" instruction (20 0B).

Event ID 0x0050
Pointer C9:00A0 A4 10
Offset C9:10A4

10A4: 50
10A5: 80 AD 81 96 85 80 99 8F 95 92 80 87 81 8D 85 CA 7F
10B6: 59 02
10B8: CB
10B9: 58
10BA: 5A 05 B3 85 93
10BF: 5A 0B A8 8F
10C3: 80 80 CC
10C6: 5B
10C7: 10 00
10C9: 1F 06
10CB: 10 00
10CD: 00

10A4 Open Window
10A5 "Save your game?"
10B6 " "
10B8 "("
10B9 Begin Select
10BA Create Option(5) "Yes"
10BF Create Option(11) "No"
10C3 " )"
10C6 End Select
10C7 Goto Event 0x0000
10C9 Screen 0x06
10CB Goto Event 0x0000
10CD End Script

The "save game" dialog. Notice how the text is output during the creation of the selection list. If the player cancels, we go straight to the next instruction: goto event 0x0000 (this just ends the script). If option 1 is picked, "Yes", we skip 2 bytes and display screen 6 (the "save game" screen). If option 2 is picked, "No", we skip 4 bytes and hit the second goto event 0x0000 instruction (which, again, ends the script).

So there you go. Let's see some storyline-rewrite hacks, people!

User Info: NeoSyrex

9 years ago#4
This is pretty interesting. Do these scripts also handle enemy AI? That could be useful for some, particularly those doing low level games. Any chance you could do more and post it in a FAQ or something?
Rei, Breath of Fire III

User Info: Ethan_Silver

9 years ago#5
Actually, I've pretty much stopped working on SoM a little while back now. Turns out someone else is working on an SoM editor so I've turned my attention to another game for the time being. Got quite a lot of progress done on that one too, now. :)

These are just event scripts. Enemy behaviors are defined elsewhere, as enemy AI scripts do somewhat different things than event scripts and thus would require a different set of instructions. I don't have info on this, but for some reason I keep remembering something about part of the behavior being flags set by the enemy ("Approach player", "keep away", "uses magic") and the rest being behavior scripts that define the conditions/sequence of commands to use. Dunno if that helps.

User Info: Gi_Nattak

9 years ago#6
Yes, I have been waiting for that editor for quite some time. But thanks for that info anyway.
Check out my FF6 Hack - http://ff6lasthope.yolasite.com/
  • Topic Archived