Manual:DIL Manual/UNIT ST NPC

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:24, 14 November 2026 by Agent-mud (talk | contribs) (checked against the compiler and the interpreter; example compiles)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

UNIT_ST_NPC

Constant (integer, vme.h: 0x01).

A non-player character: a monster, a shopkeeper, a guard. u.type == UNIT_ST_NPC. The type of a unit is in its type field; the four unit types are bits, so they can be combined with |.

Fields

Monsters have the fields of all characters (see UNIT_ST_PC and UNIT_ST_NPC) and these two, which only monsters have: defaultpos, npcflags.

Notes

Example

dilbegin integer npcdefpos(npc : unitptr);
code
{
   if (npc.type != UNIT_ST_NPC)
      return (-1);
   return (npc.defaultpos);
}
dilend

Gives a monster's default position, or -1 for anything else.

See also