I get this message in DebugMode, anyone knows what is causing this and how to fix it?
AI Update Time Overflow: (149383 > 75000) Scripts: (nw_c2_default1), Action: (-1) [Flags: 00], OID: 800000080, Tag: NW_VAMPIRE004
I recently noticed it is happening iny my singleplayer testing module and it is happening on NPCs that should do nothing as there is no player in their area.
The NPC has default AI scripts and because the NPC is in area with no PC, this line
if (GetAILevel() == AI_LEVEL_VERY_LOW) return;
Should kill the AI in beginning and therefore I don't understand why there can be any error like this.
I may not be correct, however it's my belief on reading the error that the engine ran out of time to run the heartbeat of your critter. The debug message as I read it is just saying "Opps I ran out of time to run this script!".
I've seen similer errors in one of my own modules, nothing is breaking. It's just annoying to see those errors pop up, and fill the chat window while your searching for game breaking messages from the engine.
The only real fix that I've found is to limit the number of preplaced npcs in the module. Spawning and despawning npcs as they are needed. That in it's self seems to help keep the engine unloaded and happy.
If I'm utterly wrong about the error your seeing. I hope someone will comment in this thread, and correct me!
I just noticed this.
Did you ever get this figured out, Shadooow?
If I'm reading that correctly, the engine had a limit of 7.5 seconds to finish 1 rounds worth of heartbeats, but it timed out after 15 seconds.
I'd check to make sure that all of your NPC's are actually getting set to AI_LEVEL_VERY_LOW when no PC's are in the area, and getting reset to normal levels properly when PC's show up (in the Area_On_Enter/Exit scripts, I assume).
In order for it to time out that badly, I'd guess that you have an infinite loop in the heartbeat somewhere. Problem with that is you'd usually hit the Too Many Instructions before you timed out.
Look for things in loops that could take a long time (You probably know what would be slow better than I would), database calls, 2da lookups, etc.
Since Default triggers in the heartbeat, I'd check it also.
The problem may not be with the NPC's in empty areas. It may not get to them because the 'live' NPC's are taking too long.
A basic trick that I've always used, which may help (and you probably already use it too, but just in case...):
Instead of running all of the code directly from the hb scripts, use a delay to run the actual scripts.
IE: DelayCommand(0.01, ExecuteScript("hb_script", OBJECT_SELF));
That pops it back to the stack, and allows the next creatures hb to run.
I also tend to sprinkle the same trick throughout my combat AI any time it's about to enter a long loop or similar. It keeps everything running a lot smoother during large fights.
I'm not sure if any of that was helpful. You probably know more about the tech side of NWN than I do, but maybe I'll get lucky and help you for once.
Usually, you're the one helping all of us. :P
EDIT:
Just thought of something else...
Just because their AI is set to LOW doesn't mean they aren't doing anything.
You are exiting from the hb script, but they will still continue to do any assigned actions until they complete their stack.
Make sure that there's a ClearAllActions() for the AI_LEVEL_LOW NPC's somewhere to keep them from trying to finish some action that they are stuck on.
Nah never found it. It happened in testing module, freshly reloaded (startnewmodule) in singleplayer. Module consisted of around 200 npcs pre-placed in several areas.
This error appeared in DebugMode randomly, even for npc that was not doing anything (henchman tomi standing around) using vanillla unmodified scripts.
Seems like vanilla bug and doesn't seem to have impact on anything so I just ignored it...
If you want to share the mod that was causing it, I'd be happy to take a peak at it.
I'm curious what was causing it. If nothing else, it might be a fixable bug in the vanilla code that could be fixed.
I don't think the problem is in scripts because I get the error on creature that is not present in area I was curently in when the error showed up.
Which means that this line
should end such script yet it still prints this error.
Here is the module - to reproduce. Open the module with any character you want. Enable DebugMode, let the game run for a while and wait (I got two reports in 15 minutes).