Editing Status Effects In Events

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

Adjusting units' status effects in events can be tricky. Typically, starting status effects aren't applied until the battle begins; however, the use of InflictStatus, or manually setting a unit's Current Statuses in their Battle Stats and then Removing/Adding them, will cause the visual effects of the status effect(s) to appear instantly. Units will start Floating, or animate with Hasted speed, or change color to indicate that they're Poisoned, well before the battle may start. And if you try using UpdateUnit, the visual effects won't appear at all.

It also seems that innate/initial status effects function very oddly when it comes to non-party units that were Always Present, then Removed, but then later Added back in during a mid-battle event. The game seems to handle status initialization differently during mid-battle events - Adding a unit will cause most of their status-related Battle Stats to be wiped, as well as almost all of the Status Effect Data. The Current Statuses will not be wiped (but will instantly show up visually), nor will the Inflicted Statuses (whose values get saved to the off-unit status storage from 0x8019FA85-0x8019FAEE, but this doesn't seem to do anything in a mid-battle event).

So, in the interest of figuring out all the little intricacies here, this shall be a guide on every way we can find to edit status effects in events.



1) Using InflictStatus


The simplest method. With the Event Instruction Upgrade, we can inflict any single status upon a unit. However, this will cause the unit to instantly show the appropriate animation rather than waiting until battle starts/resumes, and it also cannot be used to remove statuses.

Simply use the event command for each individual status you wish to inflict. If you want multiple statuses, use it multiple times, in order.



2) Editing Current Statuses in Battle Stats.


This is the next simplest method. It takes more lines than a single InflictStatus, but can be used to add several statuses at once, or to remove them. However, it requires Removing/Adding a unit (resetting their field animation), and can also be subject to interference from the Status Effect Data, in ways that are not yet fully documented.

  • UnitAddress(x??,x70) - use the Unit ID of the desired unit
  • SET(x0071,x????) - use the total value of the statuses you want to have set
  • SaveAddress(x71,x????,x70,001) - choose x0058, x0059, x005A, x005B, or x005C, depending on the Current Statuses those bytes are responsible for. (Optionally, also x004E-x0052 for Innate Statuses.)
  • RemoveUnit(x??,x00)
  • AddUnit(x??,x00,x00)
  • WaitAddUnit()



3) Editing the Status Effect Data


The process here is similar to editing the Battle Stats directly, though more complicated. However, it doesn't require Removing/Adding units, and will properly update status animations when battle resumes rather than as soon as the commands run.

If editing a deployable unit, you'll need to figure out what Battle Stats/ENTD slot they're in, first.

  • UnitAddress(x??,x70)
  • LoadAddress(x71,x0001,x70,001) - load their ENTD slot number. Note that the unit must have been Added to the field by now.
  • SETVar(x0072,x0071) - Make a copy of this value.
  • MULT(x0072,x0005) - Multiply it by 5, since there are five bytes per set of status effects.

Now we have the unit's ENTD slot information (if needed), and can start editing status effects.

  • AddUnit(x??,x00,x00) - Add the unit. It doesn't matter if the unit has already been added. This will ensure their Unit Present byte is flagged.
  • WaitAddUnit()
  • LUI(x0073,x8019)
  • ADD(x0073,xF9B4)
  • ADDVar(x0073,x0072) - bump up the address to your specific unit's stats, if needed
  • LoadAddress(x74,x00??,x70,001) - load the desired Innate status byte from Battle Stat x4E-x52.
  • LoadAddress(x75,x005?,x70,001) - load the desired Current status byte from Battle Stat x58-x5C.
  • SETVar(x0076,x0075) - copy the Current Statuses value to Var x76.
  • SUBVar(x0076,x0074) - subtract the Innate Statuses value so you only have the Inflicted statuses left.
  • OR(x0074,x????) - add the unit's new Innate statuses only.
  • OR(x0075,x????) - add the unit's new Innate and Inflicted statuses.
  • OR(x0076,x????) - add the unit's new Inflicted statuses only.
  • SaveAddress(x74,x000?,x73,001) - Set the Innate Status Data using 0-4 depending on which status byte the value goes in.
  • SaveAddress(x75,x006?,x73,001) - Set the Current Status Data using 69-6D depending on which status byte the value goes in.
  • SaveAddress(x76,x00D?,x73,001) - Set the Inflicted Status Data using D2-D6 depending on which status byte the value goes in.
  • SaveAddress(x75,x013?,x73,001) - Set the Status Animation Data using 13B-13F depending on which status byte the value goes in.

Note that instead of using OR to add status effects, you could use AND with the opposite values to remove them. For example, the value of Float is x0040, so to add it, you would use OR(x00??,x0040). Removing it would require AND(x00??,x00BF) - xBF, because that's xFF minus x40. xFF would save every existing status bit, but xBF saves every status bit except x40.



4) Using UpdateUnit


UpdateUnit is not the best choice, as it doesn't function quite as intended. However, one known function is that it will take the Status Infliction data and inflict those statuses, though without the animation that goes with the effect. That said, it will also seem to remove any status effects that weren't in those bytes.

  • UnitAddress(x??,x70) - use the Unit ID of the desired unit
  • SET(x0071,x????) - use the total value of the statuses you want to have set
  • SaveAddress(x71,x????,x70,001) - choose x01A7, x01A8, x01A9, x01AA, or x01AB, depending on the Status Inflictions those bytes are responsible for.
  • UpdateUnit(x??,x02)