FANDOM


  • Keep the module scripts lean, especially the OnAcquire (it fires for every single item in the inventory, when a player joins or a creature is spawned) and any heartbeat script.
  • Cleanup empty areas (no players) by despawning monsters and destroying lootbags and dropped items.
  • Avoid the overly use of the built-in campaign datatbase and Get2DAString.
  • Avoid looping throug inventories too often.
  • Keep the number of local variables on a single object (especially the module itself) low.
  • don't use time consuming logic in heavy loops. ( e.g. store the DB values as local variables for a faster access)
  • Minimize work on heartbeats
  • clean-up/despawn areas when empty of PCs
  • leverage existing UI whenever possible
  • aim to avoid heavy caster loading to cut down on special effects that load engine.
  • Despawn all NPC in an empty area
  • Keep a very close eye on all HB scripts.
  • This includes also Areas and placeables.
not sure what the following means ->
(You think you need one? Place it on a placeable and destroy the placeable in an empty area again. )
  • Use custom Factions ( Factions = Party for NPC's)
  • use the script profiler.(--> NWNx4 plugin)
  • scripted almost everything to be unbumpable
SetBumpState & GetBumpState
A bumpable character is someone you can push by walking on it. If unbumpable the character is not moving and blocking you if you trying to walk on him (usefull for door guard). Some are saying this state increases the reliance on the processor - but would like more information.
  • Sanity loops - (solution for 100% cpu issue)
If you experience 100% CPU lockups, add sanity counters to your GetFirst/GetNext loops, that break the loop, when a certain amount of cycles is done. For example 70 for GetFirst/GetNextPC().
Following Notes by Senayla
To avoid that, I have added 'sanity' counters to all these loops in our module. 

int nSane = 0; 
object oObject = GetFirst(); 

while (GetIsObjectValid(oObject) && (nSane < XXX)) 
{ 
... 
nSane++; 
oObject = GetNext(); 
} 

A reasonable value for XXX depends on the list you browse, I usually use: 

100 for players 
50 for effects and itemproperties 
250 for inventories and objects in an area/shape

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.