Page 1 of 1

Individual update-ranges on a per-NPC-basis

Posted: Sat Nov 26, 2005 8:13 pm
by Xuri
EDIT 08/01/2022: A way to achieve this has been implemented for Items via the onMoveDetect() JS event. No support for NPCs yet though.

It would be very nice if I could define individual update-ranges for NPCs (for when they "notice" items and characters") - that would make it possible to make NPCs that triggered their scripts only if someone came within X tiles of them, or they came within X tiles of an item, for instance.

Examples of possible NPC-types one could create if this was possible:
-> Garbage-cleaners who remove any item (not locked down, not a corpse, not a decorative item, etc) once it got within three tiles of it.[/list]
-> QuestNPCs that would (on their own) initate conversations with players when they came close enough.[/list]
-> Monsters with varying ranges of "visibility"

I tried using the VISRANGE tag in races.dfn to define a race with visiblerange of 3, but the inRange JS event still got executed when the NPCs were 18 tiles (or whatever the default updaterange is) away from items. :|