PW Scripters Guidelines


 * 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.
 * 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.
 * 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 in some cases by senayla.)