NPC references
From OHRRPGCE-Wiki
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.
Contents
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]
- walk NPC (who,direction,distance)
- walk NPC to X (who,X)
- walk NPC to Y (who,Y)
- NPC is walking (who)
- wait for NPC (who)
- set NPC direction (who,direction)
- set NPC frame (who,frame)
- set NPC position (who,X,Y)
- put npc (who,x,y)
- camera follows NPC (who)
- NPC X (who)
- NPC Y (who)
- NPC pixel X (who)
- NPC pixel Y (who)
- NPC direction (who)
- use NPC (who)
- get NPC ID (reference)
- change NPC ID (reference,new ID)
- destroy NPC (reference)
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.