FF7/Field/Script/Opcodes/D0 LINE

From Final Fantasy Inside
< FF7‎ | Field‎ | Script‎ | Opcodes
Revision as of 22:12, 9 September 2020 by Dangarfield (talk | contribs) (Update LINE script trigger behaviour)
Jump to navigation Jump to search
  • Opcode: 0xD0
  • Short name: LINE
  • Long name: Line Definition

Memory layout

0xD0 XA YA ZA XB YB ZB

Arguments

  • const Short XA: X-coordinate of the first point of the line.
  • const Short YA: Y-coordinate of the first point of the line.
  • const Short ZA: Z-coordinate of the first point of the line.
  • const Short XB: X-coordinate of the second point of the line.
  • const Short YB: Y-coordinate of the second point of the line.
  • const Short ZB: Z-coordinate of the second point of the line.

Description

Defines a line on the walkmesh that, when crossed by a playable character, causes one of the entity's scripts to be executed. These are similar to the triggers in Section 8. All the lines in the current field can be turned on or off by using the LINON opcode.

Additional Detail

There are generally 6 scripts (other than the init and main) if the entity is a LINE (taken from Makou Reactor):

  • script index 2 -> S1 - [OK]
  • script index 3 -> S2 - Move
  • script index 4 -> S3 - Move
  • script index 5 -> S4 - Go
  • script index 6 -> S5 - Go 1x
  • script index 7 -> S6 - Go away

[OK]

Occurrences - This is often present, but mostly contains a single RET op code.

Behaviour - I'm sure this is triggered when the player is close to the line and presses the [OK] button, eg blin59

Move

- Occurrences

The script index 2 Move is often present, but again mostly contains a single RET op code.

The script index 3 Move is not often present but when it is, the script index 2 typically isn't, again, always ends with a RET.

There are 11 occurrences when both index 2 & 3 Move are present and both have more than one single RET op code.

10 of these contain exactly the same ops in both (fields - hyou4, hyou5_4) - A REQEW and a RET with exactly the same params. Every one of these leads to a MAPJUMP.

1 of these (field - del12) contains 2 ops in the index 2 Move script (UC,MENU, and no RET). The index 3 Move script contains 11 ops including a final RET op

As a result of the above, I believe that it is relatively safe to assume the following logic:

- Behaviour

This is triggered every time the player is close to the line.

If the index 2 Move is present, it executes until it receives a RET or finishes all of the ops, then

If the index 3 Move is present, it executes until it receives a RET or finishes all of the ops.

Go

Occurrences - This is often present, and always contains a final RET op code.

Behaviour - I'm sure this is triggered every time the player leaves the line


Go 1x

Occurrences - This is occasionally present, and always contains a final RET op code.

Behaviour - I'm sure this is triggered when the player leaves the line, but only once for the duration of the time in the field. Come examples are doors remaining open after they are programmatically triggered. bugin2.


Go away

Occurrences - Can be present alongside Go and Go 1x. Always contains a final RET op code.

Behaviour - Very similar to Go, but the distance that the player has to be away from the point is large (maybe 4x). Examples are the jumps on las0_6


It's worth noting that any combination of Go, Go 1x and Go away can be present an executable on any script.

Here is a JSON file containing a little more details on the occurrences, frequencies and combinations of the LINE op code usage: https://github.com/dangarfield/ff7-fenrir/blob/master/workings-out/output/line-occurences.json