Jump to content

[LE] How to really and safely delete npcs via script


tonycubed2

Recommended Posts

Hello fellow modders,

 

 

The creation kit wiki says not to use in a script the command Delete unless it is used on uniques because it can delete spawn points, needed game references, etc. It says to use instead victim.SetCriticalStage(victim.CritStage_DisintegrateStart).
Fair enough .
But here is the weirdness. If use a mod like minimap that shows both dead and live bodies around you, I different results with both commands. With Delete, the markers for the npcs disappear instant. Also if I,use console command mark for delete. The form of the npc disappears from mini map. But is I use srtcriticalstage and set it at 4, the final stage, the npc visually disappears but still shows a a dead npc in the mini map.
The whole purpose of my mod dead body remover is to quickly delete dead looted bodies and thus avoid save bloat when using spawning mods. If the npcs are going to remain in the world then what is the point?
To add to confusion there is a cell in the game where dead deleted bodies are sent to. Do all deleted and setcriticalstage toons end up here regardless? If so then again what is the point of,the mod If the dead bodies are not forever and hard deleted?
Any info,really appreciated.

 

Link to comment
Share on other sites

Exactly pointing out what has worked flawlessly for me making encounter mods for personal use over the years, so take with a grain of Frost Salt

 

Leaving stuff hanging around is like walking in someones home with muddy boots. Sure you left, but now also left a mess that now has to be addressed. IDK random analogy

 

Spawn live in-game only, with the persist flag. I fully sanitize only things I created, and when I am no longer near them. I avoid aliasing and other things that make refs linger in other elements of the game which could lead to mud on the floor. Dynamic AI packs at the NPC level are best. Scripts are cleanest on magic effects since they have a very efficient built in way of cleaning themselves up OnEffectFinish, with Is3DLoaded() and other relevant checks to ensure they conclude. Utilize GotoState of FormID chaining via StringUtil (FormID as String + "zz" + AnotherFormID as String + "zz" + AnotherFormID + etc etc) which you can then perform a String Split on GetState() to read. This lets you store variables vs needing to declare properties. GotoState("") to wipe that slate. I give the game as little as possible to have to worry about behind the scenes

 

My Sanitize routine

RemoveAnyFXOrMagic()

RemoveFromAllFactions()
RemoveAllItems()

GotoState("")
BriefPause()
Disable()
BriefPause()
Delete()

 

Like they never existed. Again. This has always worked great for me. YMMV. I tend to keep load orders light tho

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...