» Sat Nov 17, 2012 8:46 pm
you should unregister as the first line in the update block
regarding persistence, if the actor is referenced as an Actor Property ANYWHERE (including conditions in dialogue topics, magic effect conditions, etc), or is currently filling an alias, it will likely be permanently persistent and deleting will either not even execute, or will have absolutely no effect and pointless.
if the actor was ForceRef'd into an optional alias, clearing that alias will release its persistence, and can be safely deleted. same goes for any script that uses an empty Actor or ObjectReference Property/variable and is filled dynamically by assigning it to the NPC at runtime. If this variable/property is cleared (set to a none value or filled with a different value) and the function in the script that uses it has COMPLETELY finished running (this includes all registered events), the actor's persistence is cleared. if you explicitly declare an Actor property and fill it with a specific actor in the CK, there is nothing in the world that will ever release its persistence (except for uninstalling the mod)
another faux pas to watch out for is "dirty editing" your own mod. this can happen even if your mod has no vanilla edits whatsoever, and your actor was entirely created in your own esp.
if you declare an actor as a Actor property or specifically referenced in a condition/alias etc, that actor's reference object is permanently flagged as persistent in the esp itself. even if you delete the condition function, and unfill and delete the script property etc. nothing short of reloading a previously saved version of your plugin or deleting the reference entirely will release the persistence flag on the reference object (reaaaaaaaaaallllllllly effing annoying).