Talk:Event Instructions

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search


The coordinates used are the map's absolute coordinates, not relative ones to where the camera currently is.

All entry fields can range from -32768 to 32767. Tiles are 28x28, and Camera motion is 4x more precise, so 112 = 1 Tile. 1h is 12 pixels high, so 48 = 1h, and regular units are 3h tall.

Battle-friendly.

  • 1B Edit Name Edit Example Edit Description MapLight ― MapLight(+00000,+00000,+?????,+RRRED,+GREEN,+BBLUE,+TIMER) ― Controls the map's lighting, and has the ability to change the color of the light.

Battle-friendly.

If the unit cannot reach destination, it will only enter walking state and not move at all.

Units in events have 3 Jump regardless of equipped or innate abilities using this instruction, but {70} Jump ignores this limit.

WARNING: A unit cannot WalkTo into/over water! However, you can use {70} Jump to counter this problem, and it will work just as well.

When the game finds a block, it will start executing it and will also resume the event whatever there is after the block at the same time.

When the game finds a block, it will start executing it and will also resume the event whatever there is after the block at the same time.

  • 2C Edit Name Edit Example Edit Description FaceUnit2 ― FaceUnit2(xFU,x00,xAU,xMT,xCL,xRS,xDL) ― A copy of {53} FaceUnit with one a certain value set to 0 instead of 1. Visually, there doesn't seem to be any difference with the other.

Makes unit(s) rotate to face a specified unit. The rotation direction is the shortest one (Clockwise as default).

(0,0,0) is black and (255,255,255) is white.

  • 2F Edit Name Edit Example Edit Description BlockLoop ― BlockLoop(LPA,xVR,xDEST) ― This instruction allows looping a block until the defined variable reaches, or is set to 0. It has to be placed inside a block in order to work.

A block left running will prevent the event from ending!

(+127,-128,-128) is red and (+127,+127,+127) is white while (+000,+000,+000) returns the unit to its original color.

(-128,-128,-128) is black and (+127,+127,+127) is white while (+000,+000,+000) returns the map to its original color.

This differs from BlueRemoveUnit in that it works immediately, allowing you to Add another unit/sprite right away, and that a Removed unit doesn't award its War Trophy.

  • 3E Edit Name Edit Example Edit Description ColorScreen ― ColorScreen(xBM,IRD,IGR,IBL,TRD,TGR,TBL,+TIMER) ― Colors the whole screen, in different possible ways. The Initial Color is applied immediately, while the Target Color gradually changes with a given amount of time assigned.

(255,255,255) is white while (000,000,000) is no coloration.

Not battle-friendly.

Not battle-friendly.

  • 42 Edit Name Edit Example Edit Description EarthquakeEnd ― EarthquakeEnd() ― Stops an ongoing earthquake.
  • 43 Edit Name Edit Example Edit Description CallFunction ― CallFunction(xFC) ― Can call various different functions to alter many different things in the game.
  • 44 Edit Name Edit Example Edit Description Draw ― Draw(xID,x00) ― Draws a loaded unit that is currently not being displayed.
  • 45 Edit Name Edit Example Edit Description AddUnit ― AddUnit(xID,x00,xDR) ― Adds a unit to the event that is not currently loaded.
  • 46 Edit Name Edit Example Edit Description Erase ― Erase(xID,x00) ― Erase a unit whose sprite is currently being displayed. Unit can be re-drawn later.
  • 47 Edit Name Edit Example Edit Description AddGhostUnit ― AddGhostUnit(xSP,x00,xID,XXX,YYY,xEL,xFD,xDR) ― Adds a fake unit on the map which can be mostly controlled like a regular unit, with some exceptions. In battle, the unit cannot take action or be targeted, and units will be able to walk through it. You can use any spritesheet you want, but be warned: Adding a new spritesheet will leave you with the impossibility of removing the spritesheet even if you remove the Ghost Unit.
  • 48 Edit Name Edit Example Edit Description WaitAddUnit ― WaitAddUnit() ― Waits until a normal or ghost unit is loaded into the event before resuming.
  • 49 Edit Name Edit Example Edit Description AddUnitStart ― AddUnitStart() ― Creates an independently running block inside the event to load one or many units in the game. Does not slow down the event in any way, but make sure to use {4B} WaitAddUnitEnd before using instructions on the new units.

There is no need to use {48} WaitAddUnit after each unit inside this block.

  • 4A Edit Name Edit Example Edit Description AddUnitEnd ― AddUnitEnd() ― Creates an independently running block inside the event to load one or many units in the game. Does not slow down the event in any way, but make sure to use {4B} WaitAddUnitEnd before using instructions on the new units.

There is no need to use {48} WaitAddUnit after each unit inside this block.

Battle-friendly.

Moves Target Unit to specified coordinates relative to its starting position, ignoring the field and the units statistics such as Jump.

  • 6F Edit Name Edit Example Edit Description WaitSpriteMove ― WaitSpriteMove(xID,x00) ― Wait for a unit to complete its custom movement before resuming.
  • 70 Edit Name Edit Example Edit Description Jump ― Jump(xID,x00,DST,xDR) ― The given unit will jump up or down 1-4 tiles distance. It works perfectly for jumping down, but might look weird when trying to jump to tiles too height. Does not have an elevation parameter. If the height difference is very minimal, the unit will just walk instead.

If the target tile is off the map, the unit will freeze in its frame and slide off the screen.

This differs from RemoveUnit in that it takes longer, so you can't Add another unit/sprite in immediately afterwards, and that a BlueRemoved unit will still award their War Trophies at the end.

Use this instruction for general multiplication.

Use this instruction for general multiplication.

Use this instruction for general division.

Use this instruction for general division.

This command compares the individual bits of the value within a Variable and a specific ImmediateValue, and produces a single binary output. This makes this a good way to disable a specific bit within a byte without changing the rest of the bits.

With AND, the resulting bit outputs are set to 1 (TRUE) only if both values' bit inputs are 1.

The bits available within a single byte are:

  • 0x80
  • 0x40
  • 0x20
  • 0x10
  • 0x08
  • 0x04
  • 0x02
  • 0x01

So, for example, if you want to edit a unit's Battle Stats to remove the Dead status (which is bit 0x20), but leave their other statii unchanged, you would UnitAddress their Unit ID, LoadAddress their stats at 0x0058 & 0x01BB into temporary variables (let's say 0x0070 & 0x0071), and then run AND(x0070,x00DF) and AND(x0071,x00DF), before using SaveAddress to put the corrected values back. Because the Dead status is in bit 0x20, a value of DF means that every bit except 0x20 is set to 1. As a result, the other statii in that byte will remain unchanged, but by forcing 0x20 to be set to 1 in the ImmediateValue, it will zero out the Dead bit in the final result.

This command compares the individual bits of the value between two Variables, and produces a single binary output.

With AND, the resulting bit outputs are set to 1 (TRUE) only if both values' bit inputs are 1. This makes this a good way to disable a specific bit within a byte without changing the rest of the bits.

The bits available within a single byte are:

  • 0x80
  • 0x40
  • 0x20
  • 0x10
  • 0x08
  • 0x04
  • 0x02
  • 0x01

So, for example, if you want to edit a unit's Battle Stats to remove the Dead status (which is bit 0x20), but leave their other statii unchanged, you would UnitAddress their Unit ID, LoadAddress their stats at 0x0058 & 0x01BB into temporary variables (let's say 0x0070 & 0x0071), SET(x0072,x00DF), and then run ANDVar(x0070,x0072) and ANDVar(x0071,x0072), before using SaveAddress to put the corrected values back. Because the Dead status is in bit 0x20, a value of DF means that every bit except 0x20 is set to 1. As a result, the other statii in that byte will remain unchanged, but by forcing 0x20 to be set to 1 in the ImmediateValue, it will zero out the Dead bit in the final result.

This command compares the individual bits of the value between a Variable and a specific ImmediateValue, and produces a single binary output.

With OR, the resulting bit outputs are set to 1 (TRUE) if either value's bit input is 1. This makes this a good way to enable a specific bit within a byte without changing the rest of the bits.

The bits available within a single byte are:

  • 0x80
  • 0x40
  • 0x20
  • 0x10
  • 0x08
  • 0x04
  • 0x02
  • 0x01

So, for example, if you want to edit a unit's Battle Stats to add the Control flag (which is bit 0x08), but leave the other flags such as their Team untouched, you would LoadAddress the byte into an editable variable, then OR that variable against a value of 0008: OR(xVARI,x0008). This uses a zero value on every bit except 08, which uses a one value, forcing the output to always have Control flagged, while leaving the rest of the bits from the variable unaltered.

This command compares the individual bits of the value between a Variable and a specific ImmediateValue, and produces a single binary output.

With OR, the resulting bit outputs are set to 1 (TRUE) if either value's bit input is 1. This makes this a good way to enable a specific bit within a byte without changing the rest of the bits.

The bits available within a single byte are:

  • 0x80
  • 0x40
  • 0x20
  • 0x10
  • 0x08
  • 0x04
  • 0x02
  • 0x01

So, for example, if you want to edit a unit's Battle Stats to add the Control flag (which is bit 0x08), but leave the other flags such as their Team untouched, you would LoadAddress the byte into an editable variable, then OR that variable against a value of 0008: OR(xVARI,x0008). This uses a zero value on every bit except 08, which uses a one value, forcing the output to always have Control flagged, while leaving the rest of the bits from the variable unaltered.

Must be placed before {D2} ForwardTarget!

Must be placed before {D2} ForwardTarget!

Must be placed after {D0} JumpForwardIfZero/{D1} JumpForward!

Must be placed after {D5} BackTarget!

Must be placed before {D3} JumpBack!