Game Error Messages
This is a list of some errors that scripts can invoke at runtime.
These appear in yellow in the chat log and are written to the log file, and are prefixed "Script error:" if related to scripting or the title of the error in general if not.
Example: Script error: debug_script OID: 0000012a, Tag: TestNPC, ERROR: STACK UNDERFLOW
This is a rare error caused by mismatched game versions or nwscript.nss files where you are passing a parameter to a function the game doesn't recognise.
For instance new parameters were added to EffectVisualEffect. However if you use a ncs (compile script) on an older version of the game STACK UNDERFLOW will appear when the new parameters are passed in.
This can also occur if you edit nwscript.nss and compile your script, adding additional parameters the game doesn't recognise or changing the parameter types (eg from Integer to Float).
This is an error that occurs when the engine cannot pass back a valid return value to the script calling it.
This might occur if you are running a different nwscript.nss file and, for instance, alter the return type expected from a function. eg: having "int GetLocalInt()" works but "float GetLocalInt()" will not since it is trying to pass back an integer but the script is trying to assign it to a float.
TOO MANY INSTRUCTIONS
The TMI error is caused by the amount of instructions the script uses going over the engine limit. This limit in NWN:EE is set in the game options and in NWNX can be set to unlimited.
Generally this will be caused by a hung loop where it won't ever finish, commonly by not incrementing a variable or missing the GetNextXXX() function to continue the loop.
In cases you need a script to run for longer and it is a SP module, use GetScriptInstructionsRemaining() to check and restart the loop after a DelayCommand(0.0).
Note: "instructions" are not necessarily equivalent to speed, and a high amount of function calls may be still very efficient, while a smaller amount of function calls may still hang the game/server if badly used.
AI Update Time Overflow
Example: AI Update Time Overflow: (149383 > 75000) Scripts: (nw_c2_default1), Action: (-1) [Flags: 00], OID: 800000080, Tag: NW_VAMPIRE004
This occurs when the AI is attempting to do some actions but they're constantly queuing up. This usually is down to stuck pathfinding. Other causes may be too many NPCs doing too much at high AI rates (meaning not enough time to complete an action properly), or badly written scripts causing some excessive amount of work for the engine to complete.
The Action: (xxx) parameter if not -1 will show what action is at the top of the queue. If -1 it is generally pathfinding.
Action List Overflow
This occurs when more than 75 actions are added to a single object. This includes players.
At 500 actions it should clear all actions from the object.
Effect List Overflow
This occurs when more than 500 effects are added to a single object. This includes players.
At 1000 effects most temporary and permanent effects are wiped from the object.