Site Tools


atb_system

The ATB System

Concepts

Battle Timers: A set of timers for each battle participant that determine when events occur in a battle.

Speed Modifier: A value that is raised or lowered by speed-modifying spells, and used as a modifier for most timers.

Menu Queue: The list of characters whose menu is ready to pop up.

Pointer: Keeps track of which slot is currently being checked for expired timers.

Queuing a command: Every command must be queued before it can be executed. For characters, this generally involves choosing a menu command; the period between queuing and execution of the command includes spell incantation animations, preparing to swing, etc. For monsters, there is no visible indication when a command is queued. (Note that “queue” may be a misnomer here, and this is not to be confused with the Menu Queue)

Executing a command: When the command actually takes place. For most commands, this means the character moves forward and acts (or the monster flashes and acts).

How it works

All battle participants (characters and monsters) have an Action Timer that determines the number of ATB ticks must pass before they are eligible to queue or execute a command. At the start of battle1) and after each command is finished executing, the Action Timer is set to the Relative Agility of that participant, modified by the Speed Modifier.2).

What happens in each tick

  1. A delay occurs based on the Battle Speed setting.
    • If the ATB is paused because the player is in a submenu or the game is paused, wait until the ATB is unpaused. This does not count towards the delay timer.
  2. All of the enabled timers of each participant are decremented by one, and those that reach zero are flagged as expired.
  3. HP Sap and Regen are applied, if applicable.
  4. The battle victory/defeat conditions are checked.
  5. Any auto-action (Berserk, Charm, Auto-Hide or Auto-Show) commands are enqueued for characters who meet those conditions and do not already have an auto-action command queued.
  6. The menu queue is handled:
    • If the menu is currently open, the game checks for any conditions that would automatically close it (auto-hide or equipping the Avenger)
    • If the player has just entered a menu command, it is queued at this point, setting that character's Action Timer accordingly.
    • Otherwise, if the menu was not open and any characters are in the Menu Queue, and if L+R are not currently being held, the first is pulled off that queue. If they are eligible to act, their menu will start to open on the next frame.
      • If the character has fired their last arrow, it will be removed here.
      • If the character was Parrying, that status is removed here.
      • If the Avenger is equipped, Berserk status is set and the menu will not be opened.
  7. The next expired timer is handled:
    • The slot the Pointer is currently pointing at is checked for any expired timers. If none are expired, it will continue moving through slots until an expired timer is found or all 13 slots have been checked. If an expired timer *is* found, it is handled, and the Pointer moves to the next slot.
      • Note: There are 7 different types of timers. In order, they are: Stop, Action, Sap, Poison, Stone, Wall, Count. Only one expired timer for one participant can be handled in a given tick, and they are checked in order.3)
      • In the case of characters, an expired Action Timer means that when the Pointer reaches that character, they will either execute their command (if one is queued), or enter the Menu Queue.
      • In the case of monsters, an expired Action Timer means that they will either execute their command (if one is queued), or the next turn of their battle script will be processed, queuing a command4) and handling any immediate actions such as changes to condition flags, resistances, stats like Magic Power, etc.
        • Note that if a monster starts a chain, all other participants' timers will be frozen until the chain is completed, and auto actions and the menu queue will not be processed.
      • Queuing a command sets the Action Timer based on the command entered. In the case of monsters, this is always? a fixed timer with a duration equal to 1, adjusted by the Speed Modifier. See the Battle Timers article for more details.
  8. Any monster counters are processed.

Start of battle

Strike First

All characters' Action Timers are set to 1; all monsters' Action Timers are set to twice their RA.

Surprise / Back Attack

All monsters' Action Timers are set to 1; all characters' Action Timers are set to twice their RA.

Regular start

All characters' and monsters' Action Timers are set to their RA.

The game then finds the lowest Action Timer value, and subtracts one less than that value from all Action Timers. (This effectively skips ahead until the lowest Action Timer is 1)

Running

Immediately after the battle victory/defeat conditions are checked, the game checks if the L and R buttons are both held down during that frame. If so, it first checks whether the party is ready to run.

For fights where the enemy in the first slot is less than level 97:

  • If a character has entered the menu queue, the party is ready to run.

For fights where the enemy in the first slot is level 97 or higher:

  • At the start of battle, a run delay timer is set to a value depending on this monster's level.
    • This value is 3, 7, or 10 for levels 97, 98, and 99, respectively.
  • If the timer has reached zero, the party is ready to run. Otherwise, the run delay timer is decremented, and will be checked again on the next tick.
  • Note that if the enemy in the first slot is level 99, then if at any point the player is not holding L+R, the delay timer is set to 15.

When the party is ready to run:

  • If running is enabled in this fight, the party runs away.
  • If running is disabled in this fight, display the “Can't run” message immediately, effectively freezing the ATB for the duration that it's displayed.5)

Note that character menus will not appear while L and R are being held.

1)
barring Strike First, Surprise, and Back Attacks
2)
[RA * Speed Modifier) / 16], rounded down
3)
All timers are checked for one slot before the Pointer moves on to the next
4)
This command could be “Do Nothing”
5)
The duration is dependent on the Battle Message Speed setting, though some fights automatically use the slowest speed
atb_system.txt · Last modified: 2023/12/26 20:45 by A User Not Logged in