FF6 Hacking
Questions about Event Scripts - 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: Questions about Event Scripts (/thread-4105.html)



Questions about Event Scripts - Rycona - 04-28-2021

According to ZoneDoctor's event script dump, some command bytes' functions are labeled differently than on the FF6 Wiki. My examples, from some script I've been parsing:

CAE381: {FA-02}               Pseudo-randomly choose to branch backwards 2 bytes ($CAE37F) with 50 % chance

CAE383: {FC-0D}               Branch backwards 13 bytes ($CAE376)

The FF6 Wiki states:

FA                      $C0B8C7     Stop temporarily played song
C0/9A52: 1A B9                    (act. FC: ** NOT USED **)

Wondering which are correct. My concern, outside of accuracy for the wiki, is that I'm parsing events for calls to other subroutines, so I can map given events connected to those directly called. So if these commands don't make these calls, I should ignore them... and I'd also wonder if the program is getting off track with subsequent calls.


RE: Questions about Event Scripts - Gi Nattak - 04-28-2021

Both are correct, they are indeed used for those purposes, it's just that the branching commands are meant to/need to be placed within an action queue, while the stop temporarily played song and unused act. $FC is meant to be a "general action" (first byte command), so the code would know to differentiate them. I'm fairly sure that's how it works anyway!


RE: Questions about Event Scripts - Rycona - 04-28-2021

Oh, I see. I forgot about the list on the  Movement Codes page and didn't check the context on the commands. My bad, thanks for clearing that up. Shine


RE: Questions about Event Scripts - C-Dude - 04-28-2021

Yeah, within an action queue the commands take on different functions.

So you'll see something like
"Begin action queue for character $04 (8 bytes)"
and then there will be 8 bytes of commands that follow, which do different things than the same hex values when they're NOT in an action queue.

That's why all action queues have a form of parenthesis: they tell the game how long they are going to be in bytes and then they always end with an $FF to resume normal function.

If you're looking to branch outside of an action queue, you will need to check an always-unchanging event bit and do a jump. I use event bit $127 for this, but I know there are at least two more that do so.

EX:
Code:
CA0039: {C0-27-01-08-01-00}   If ($1E80($127) [$1EA4, bit 7] is clear), branch to $ CA0108
This is a typical 'always branch' in the event code.