Custom event freezing - Printable Version +- FF6 Hacking (https://www.ff6hacking.com/forums) +-- Forum: Discussion Forums (https://www.ff6hacking.com/forums/forum-5.html) +--- Forum: Magitek Research Facility (https://www.ff6hacking.com/forums/forum-9.html) +--- Thread: Custom event freezing (/thread-4015.html) |
Custom event freezing - Gestahl - 06-21-2020 Hello guys, I've tried making my own custom event for when the party visits the town of Maranda for the first time (before the Vector/Magitek research facility chapter, when you need to have both Locke and Celes in your party). It is supposed to work as follows: on an event tile near the stairs, the party splits up, some dialogue happens, some characters strike certain poses, then the party regroups again. Should be simple enough, but for some reason I get a freeze after the party splits, before the first dialogue box is supposed to appear, and I can't quite figure out why. Here's my event code: C0 02 80 B3 5E 00 47 B2 AC C6 00 B2 34 2E 01 3C 01 06 FF FF 31 04 C2 80 CD FF 32 04 C2 A0 CF FF 33 03 C2 81 CC FF 34 02 CC FF 92 4B 8E 05 91 06 82 22 FF 91 4B 24 04 C0 A2 01 B6 E1 35 02 82 18 FF 94 4B D4 04 91 06 85 CE E0 02 63 FF 4B 29 05 95 4B 84 05 01 85 83 E0 02 81 FF 06 82 CF FF 4B FC 05 06 02 83 FF 33 02 A3 FF 34 82 80 FF 42 32 42 33 42 34 45 47 3A 78 31 78 32 78 33 78 34 D0 02 FE And here the breakdown of what it's supposed to do: C0 02 80 = check if event bit 002 is set, if yes: B3 5E 00 = branch to return function 47 = make character in slot 0 the leader B2 AC C6 00 = subroutine that loads caseword with characters in active party (checks who is currently there) B2 34 2E 01 = subroutine that enables party members to pass through other objects 3C 01 06 FF FF = sets up a party with characters 01 (Locke), 06 (Celes), two irrelevant (FFs) 31 04 C2 80 CD FF = action queue for character 1, 4 bytes long, move 1 up & turn right 32 04 C2 A0 CF FF= action queue for character 2, 4 bytes long, move 1 right-up & turn left 33 03 C2 81 CC FF= action queue for character 3, 4 bytes long, move 1 right & turn up 34 02 CC FF= action queue for character 4, 2 bytes long, turn up FREEZE HERE?? 92 = pause for 30 units 4B 8E 05 = text box 91 = pause for 15 units 06 82 22 FF =action queue for Celes, 2 bytes long, head down sad left 91 = pause for 15 units 4B 24 04 = text box C0 A2 01 B6 E1 35 = check if Cyan is in party, if not branch to 3FE1B6 (9 bytes further down) 02 82 18 FF = action queue for Cyan, 2 bytes long, armfolded pose 94 = pause for 60 units 4B D4 04 = text box 91 = pause for 15 units 06 85 CE E0 02 63 FF = action queue for Celes, 4 bytes long, look down, delay, turn head to right 4B 29 05 = text box 95 = pause for 120 units 4B 84 05 = text box 01 85 83 E0 02 81 FF = action queue for Locke, 4 bytes long, move 1 left, delay, move 1 right 06 82 CF FF = action queue for Celes, 2 bytes long, turn left 4B FC 05 = text box 06 02 83 FF = action queue for Celes, 2 bytes long, move 1 left 33 02 A3 FF = action queue for character 3, 2 bytes long, move left-up 34 82 80 FF = action queue for character 4, 2 bytes long, move up 42 32 = hide character 2 sprite 42 33 = hide character 3 sprite 42 34 = hide character 4 sprite 45 = refresh objects 47 = make character in slot 0 the leader 3A = enable movement while event is executing 78 31 = enable passing through sprite 1 78 32 = enable passing through sprite 2 78 33 = enable passing through sprite 3 78 34 = enable passing through sprite 4 D0 02 = set event bit 002 FE = return The bold part is where the game freezes. Maybe someone of you can see where I made a mistake. Any help is appreciated. EDIT: Oh yeah, another thing: the fourth character is facing in the wrong direction after the party splits (down instead of up). It's just a small issue, but could this be related to the main problem? RE: Custom event freezing - Gi Nattak - 06-21-2020 I'm not seeing a bold part in the code. this part here though: 33 03 C2 81 CC FF= action queue for character 3, 4 bytes long, move 1 right & turn up should be a 04 byte command. I'm not sure if this is a typo or what but if it isn't, I'd imagine that would F things up! I'm great with event editing but I suck at diagnosing a freeze with simply staring at code - feel free to send me the ROM via PM and I'd be happy to take a look. What I do to know for sure where the code is freezing, is put an FE to end the event at various spots until you know for sure which command is the culprit, then go from there. RE: Custom event freezing - Gestahl - 06-21-2020 (06-21-2020, 01:01 PM)Gi Nattak Wrote: I'm not seeing a bold part in the code. this part here though: Wow, I can't believe I screwed up an action queue like that... I just tested it, and that was really it! After changing it to 4, everything worked as intended! Thanks a ton, man! And now I feel stupid, lol... RE: Custom event freezing - Gi Nattak - 06-21-2020 Glad that was all it was, all good man, I've certainly done my share of simple blunders causing entire events to crash and spend lots of time trying to figure it out, only to realize it was a byte short on an action queue. Event coding is fun stuff! RE: Custom event freezing - Gestahl - 06-21-2020 Quote:Glad that was all it was, all good man, I've certainly done my share of simple blunders causing entire events to crash and spend lots of time trying to figure it out, only to realize it was a byte short on an action queue. Event coding is fun stuff! It sure is, yeah! After some more testing, it seems I've created an additional problem: after the event, I cannot leave the map anymore, or talk to NPCs, or access the menu. Before the event that was still possible. I've changed the last portion of my code from this: Code: 42 32 = hide character 2 sprite to this: Code: B2 2B 2E 01 = subroutine for hiding characters 2, 3, and 4 as it seems to do the same, but is several bytes shorter. At first I thought it might be because my original code used enable passing through objects instead of disabling it, but that didn't solve the problem. It's as if the map's exits, NPCs and menu stopped working after the event execution. Have you ever encountered something like this? RE: Custom event freezing - Gi Nattak - 06-21-2020 I've definitely encountered that same issue, but I can't say for certain what is causing it here or even how I went about fixing it (terrible memory). It's like the game thinks it is still in active event mode even though it has ended. I probably just FD out commands until it hopefully unbreaks, and then figure out why it is causing it to break. Or FE to end it early and see when exactly the map freeze is happening. I'm sure you'll figure it out but if not my offer always stands to go hands on with it. RE: Custom event freezing - Gestahl - 06-22-2020 I figured it out! It turned out that my problem was not the code I posted here, but rather a wrong byte after the jump to this code! Since the event banks in the vanilla game are pretty full, the only way to create more room for new/longer events is to use B2 jumps to some empty space of an expanded rom, and that's what I did. But I completely forgot that in this case, the FE command doesn't automatically end the entire event, but rather returns to the previous location in the rom right after the B2 jump. And the byte following that turned out to be an FF instead of an FE. After fixing this, everything worked smoothly. Turns out it was a simple 1-byte fix again. Just thought I'd post this here in case someone else encounters the same issue again. Anyway thanks for your help Gi Nattak! RE: Custom event freezing - Morendo - 07-01-2020 I read somewhere that coding is a bit like writing a novel except that if you forget a comma on page 127, the entire book doesn’t make sense. I agree with that. RE: Custom event freezing - Gestahl - 07-01-2020 (07-01-2020, 01:46 AM)Morendo Wrote: I read somewhere that coding is a bit like writing a novel except that if you forget a comma on page 127, the entire book doesn’t make sense. I agree with that. Lol, completely agree with that! I'll keep improving my "grammar" then, haha. RE: Custom event freezing - madsiur - 07-01-2020 (07-01-2020, 01:46 AM)Morendo Wrote: I read somewhere that coding is a bit like writing a novel except that if you forget a comma on page 127, the entire book doesn’t make sense. Except when you code the IDE tells you when there's a mistake such as a missing comma.. That makes me think that an event editor would be really nice, especially if it tells you if you have an invalid event command (e.g. missing parameters) or if you character queue command is invalid (e.g. like the above mistake). |