New NPC Storage

Traditionally, all scripts are loaded when the NPC-Server is started. However, this is not appropriate when there are many putnpc2 or level NPCs on the server. Instead, we can use the new NPC storage to only load the scripts as and when they are required.

This has several effects:

1. The NPCs are no longer stored in a flat directory on the server, but instead, in a folder hierarchy so that NPCs are organised by the level they are in.
2. The NPC is only loaded initialised when a player enters the level.
3. No memory is being used unnecessarily because the scripts are unloaded from memory when there are no players left.

Use of the new NPC storage is recommended whenever possible so that scripts are not taking up unnecessary processing power when they are not being used.


To use the new NPC storage, you must first make sure that newnpcstorage=true is in the server options. The new NPC storage will not be effective if this is not set.

Then, you can set this.savelocally = true; serverside in any NPC that you want the new storage to apply to (preferably in onCreated for new NPCs, or onInitialized for existing NPCs).


The new NPC storage is not effective for NPCs on GMAPs. It only works in single levels.

Don't use the new NPC storage for any NPC which needs to be constantly accessible from elsewhere, for instance, some database NPCs that are referred to by other scripts. If the level is empty, they will be unloaded from memory and will no longer be available to other scripts.

You may need to restart the NPC-Server before the new NPC storage takes effect.


There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki