Jump to navigation Jump to search

.L## (NPC locations)

This lump has a 7 byte header which contains garbage (but previously held a BSAVE Header).

The usable content of the .L## file is always 3000 bytes (1500 INTs) in length.

There are up to 300 NPC instances on a map, and

Current format[edit]

About Formal Specs

Data Meaning
INT * 300 x co-ordinate in tiles
INT * 300 y co-ordinate in tiles + 1
INT * 300 id number + 1 or 0 if not used
INT * 300 direction

0 = up
1 = right
2 = down
3 = left

INT * 300 walking frame
(This is used by Game, but always written as 0 by Custom.
However, garbage in this field would probably crash Game.)
INT * 300 npc pool
0=local to this map, 1=global

Future format[edit]

A RELOAD document. The filename would probably be something like npcloc-#.reld where # is the map id, or maybe it would just be a node in a larger reload document. This format is already used for temporary storage of saved NPC locations using the name map#_l.reld.tmp when you leave a map and then return to it in the same play session.

  • npcs - stores NPC locations
    • npc int - for each npc instance. value is instance slot id number 0-max. Nodes exist for any slot that has ever been used.
      • id int - npc id number 0-max (only saved if NPC exists)
      • pool int - npc pool number 0=local to this map, 1=global (only saved if NPC exists)
      • x int - x position in pixels (only saved if NPC exists)
      • y int - y position in pixels (only saved if NPC exists)
      • d int - direction 0-3 (only saved if NPC exists)
      • fr int - walking frame number 0-1
      • xgo int - queued horizontal walking distance in pixels. Only present if the npc is actually moving
      • ygo int - queued vertical waking distance in pixels. Only present if the npc is actually moving
      • extra int - one for each extra data 0-2. The value is the extra slot number. (only exists for non-zero values)
        • int int - integer value stored in the extra slot
      • ignore_walls - if present, npc can pass through walls
      • not_obstruction - if present, npc can pass through heroes and npcs and vice-versa
      • suspend_use - if present, npc can only be activated with usenpc
      • suspend_ai - if present, npc move-type is ignored
      • save - node exists if NPC can be saved/loaded in the RSAV file (only saved if NPC exists)
      • edit int - counts edits of this NPC instance slot. Can exist even if the slot is empty (but does not exist if the NPC slot has never been used)

The code to read in the old format would not be removed, so old games could be played without the upgrade slowdown of converting all the .L files at play-time.

This same format will be used when NPC state is saveable in the RSAV file

References to other lumps[edit]

Field Indicating record in lump:
id NPCDef #