NPC references

From OHRRPGCE-Wiki
Jump to navigation Jump to search
Revise.png
This article does not meet the standard of quality we would like to have. Feel free to revise it and make it better by using the edit link at the top of the page. This tag should be removed when an editor feels it is of high quality.

An NPC reference is a unique identifier for a specific NPC on a map. NPC references allow you to control any NPC on the map, whereas NPC ID numbers only allow you to control the first copy of an NPC. NPC references are also more efficient than NPC ID numbers for scripts that manipulate the same NPC more than once. An NPC reference can be used in (almost) any command that accepts an NPC ID number.

Commands that return references[edit]

Usage Example[edit]

To make efficient usage of an NPC reference, you should store it in a variable.

  # NPC 5 walks down, hesitates, turns around, and says something

  variable (ref)
  ref := NPC reference (5)
  walk NPC (ref, south, 3)
  wait for NPC (ref)
  wait (20)
  set NPC direction (ref, east)
  wait (4)
  set NPC direction (ref, north)
  wait (4)
  show text box (18)
  wait for text box

Commands that accept references[edit]

Exceptions[edit]

Some commands do not fully support NPC references. You can still use a reference, but all copies of the NPC with the same ID number as the referenced NPC will be affected also. This is because they alter global NPC data, which is not stored for each individual NPC.

See Also[edit]