Skip to content

KFUS: Entity Structure

IvanDSM edited this page Dec 4, 2020 · 1 revision

This page describes the data structure that represents an entity's state.

Structure table

This is a table of the structure elements with their respective offsets.

Bool bytes are true when set to 0x01 and false when set to anything else. However, 0xFF is most commonly used by the game as false.

The parent index is used for when an entity instance is a part of a bigger entity (for example, the kraken's head). When the part is dead, the parent entity (in the kraken's case, the body) is accessed through KingsFieldEntityArray[ParentIndex] and affected by damage, etc.

Offset Type Name Description
0x0 byte Disabled False only when 0xFF
0x1 KingsFieldEntityMeshID MeshID
0x2 byte EntityClass
0x3 undefined
0x4 undefined
0x5 bool NonRandomRotation Whether rotation should be exactly as in the instance declaration.
0x6 byte Layer
0x7 byte NSYTilePos
0x8 byte WEXTilePos
0x9 bool Alive
0xa byte RespawnChance
0xb KingsFieldItemID DroppedItem Item dropped by the entity
0xc byte CurAnim
0xd undefined
0xe KingsFieldEntityState CurrentState
0xf byte CurrentStateDone The state of the current state (there's a better name for this)
0x10 KingsFieldEntityState LastState
0x11 undefined
0x12 undefined
0x13 byte Unknown_x13
0x14 undefined
0x15 byte Unknown_x15
0x16 undefined
0x17 undefined
0x18 u_short Unknown_x18
0x1a u_short HP
0x1c u_short Unknown_x1c
0x1e u_short Unknown_x1e
0x20 u_short InstanceZRot?
0x22 u_short ParentIndex
0x24 short FineNSYPos
0x26 short FineZPos
0x28 u_int SomeWeirdFlags
0x2c VECTOR Position
0x3c undefined4 Unknown_x3c
0x40 SVECTOR Rotation Loops at 4096
0x48 SVECTOR Scale
0x50 SVECTOR SomeShortVector
0x58 short CurrentTurnSpeed
0x5a undefined
0x5b undefined
0x5c pointer SomePointer
0x60 pointer StatePointer
0x64 short PlayerDirection Player to Entity Angle?
0x66 short Unknown_x66
0x68 undefined
0x69 undefined
0x6a undefined
0x6b undefined
0x6c undefined
0x6d undefined
0x6e undefined
0x6f undefined
0x70 byte Unknown_x70
0x71 undefined
0x72 undefined
0x73 undefined
0x74 undefined
0x75 undefined
0x76 undefined
0x77 undefined
0x78 undefined
0x79 undefined
0x7a undefined
0x7b undefined

Credit where it's due

Some of the findings about the monster structure were based off TheStolenBattenberg's Cheat Engine table and/or were found with the help of Mendzen and TheStolenBattenberg.