2.1 ‐ Wait Flag Writer and forcing Wait Mode - jmcx532/FFX-2-TurnBased GitHub Wiki
To make FFX-2 turn-based, Wait Mode needs to be forced at all times, except when ATB gauges need to progress. I implemented this in two ways:
- Enabling the
com_shareflag for all commands. This forces Wait Mode while their 'magic' animation is happening [see note 0] - Code in
WaitFlagWriter.cs
WaitFlagWriter.cs
This module hooks MsSetATBwait() and expands it to force Wait Mode when the mod needs to. The original function only checked the in-game config ATB Mode setting, checked if a sub-menu was open and then forced Wait Mode if that was the case.
h_MsSetATBwait() - set Wait Mode as necessary
My replacement function implements the following:
-
Wait while main battle window is open: Monitor the 'number of allies ready' flag and sets Wait mode if an ally is ready. [see note 1]
-
Regular Attack Handling: Monitor the 'number of characters acting' flag and sets Wait Mode if a character is acting. [see note 2]
-
Counterattack handling: Counterattacks do not set the 'number of characters acting' flag I described above. Instead I monitor a character's 'number of target's hit' flag - if this is 0 then their command hasn't connected yet. [see note 3]
Notes
0. Only applies to commands that load a magic.dll.
1. I believe this relates to the battle menu: number of characters who have a menu open.
2. One caveat with this is that if a character is waiting to perform an action (purple gauge mechanic), they are counted as acting. To get around this, every command, item and enemy ability has their chant_cost set to 0;
3. Some tinkering had to be done to have this work properly - This Chr flag needs to be set at the start of battle (in BtlATBInitHandler.cs). Additionally, some commands like Spherechanges and Scan do not increment this flag, so I ignore certain commands via exceptionCommands.