Fallout 4

Article:  Fallout 4-76 protect NPC actors from removal
Mod Name: Fallout 4-76 Open World https://www.nexusmods.com/fallout4/mods/59082
Mod Name: Commonwealth of Decay   https://www.nexusmods.com/fallout4/mods/60305
Mod File: SKK476OpenWorld.ESP
Platform: Fallout 4 (PC, XBOX)
Author:   [email protected]
Date:     June 2018
Version:  008 onwards


This article is valid for all iterations of SKK476OpenWorld.ESP from 001 including series 050 onwards for Commonwealth of Decay.



The OpenWorld solution looks for actors with keywords ActorTypeNPC (Race: SynthGen2, Human, Ghoul, Child, Valentine) or ActorTypeSynth (Race: SynthGen1, SynthGen2, Valentine) to remove. That is fundamentally what it does. If you are surprised by an actor being removed, it has one of those race based keywords.



OpenWorld NPC protection mods


If you are a mod user wanting to protect some ActorTypeNPCs from being automatically disabled/removed/replaced there are mods to protect existing actors BEFORE the OpenWorld conversion is run:

(1) SKK Combat Settlers protects existing settlers from removal.
(2) SKK Unlock all companions enables and protects any/all base game companion(s) plus the current  companion if they are from a mod.



PC Console

For any PERSISTENT actor you know the 8 digit ObjectReference id (look ’em up in the Fallout wiki), use the PC Console to apply a keyword on them BEFORE the OpenWorld conversion is run:

(1) Open the PC console.
(2) Type or paste CTRL+V  [ 8DigitObjectReferenceID.AddKeyword SKK_476NoDisable ]

If the actor is not PERSISTENT (console reports invalid objectid) then you will need to find the actor in game so they are loaded in the player active area to apply the keyword.

For any other actor you can find on screen, use the PC Console to apply a keyword on them:

(1) Open the PC console.
(2) Click on the actor to protect so the 8 digit ObjectReference id is showing in the middle of the screen.
(3) Type or paste CTRL+V [ addkeyword SKK_476NoDisable ]

For non persistent actors that you cant find in the world (maybe in a holding cell) you will need a scripted mod to make them persistent as a script property or quest alias then add the keyword. How to create scripted mods is beyond the scope of this article.



xEdit Override file

(1) Open xEdit with Fallout4.esm, SKK476OpenWorld.esp

(2) In Fallout4.esm select the enc/lvl/unique* actors to protect, copy as override to a new file e.g. SKK476NoDisableActorList.esp.

(2.1) With a small load order you may want a unique file per actor type for switching flexibiltiy e.g. SKK476NoDisableRaiderList.esp, SKK476NoDisableGunnerList.esp

(3) Select SKK476NoDisableActorList.esp AddMasters SKK476OpenWorld.esp

(4) Save and close xEdit, Open xEdit with Fallout4.esm, SKK476OpenWorld.esp, SKK476NoDisableActorList.esp so the master relationships can load.

(5) In SKK476NoDisableActorList.esp select the enc/lvl human race actors to protect, select KWDA Keywords add SKK_476NoDisable

(6) Save, add SKK476NoDisableActorList.esp to your load order BELOW SKK476OpenWorld.esp (and any other mod masters)  then enable.

This can also protect actors from other mods if they are added as masters to your SKK476NoDisableActorList.esp file(s).


(*) Look up and understand the { Template > enc > LChar > lvl } actor form inheritance hierarchy so you pick the correct records to modify rather than smearing them all.

Non unique actor objects you see on screen are typically (not always) placed/spawned from a lvlActor form. The lvlActor form pulls templates from an LChar levelled actor list which pulls attributes from encActor forms. Most encActor forms stem from a common encActor Template form. To walk the hierarchy look at the [Referenced By] tab in xEdit or [Used By] object context menu in CK.




Spell Perk Item Distributor

If you use F4SE script extender, take a look at Spell Perk Item Distributor which allows you to apply keywords like SKK_476NoDisable (and other attributes) to base actor forms by editing an INI file. AWESOME !




Quick and dirty script (a lookup per spawn)

If you are a mod author wanting to make your human based actor NPCs persistent in the Fallout 4-76 world, to avoid them being automatically disabled (and replaced) apply a keyword that can be acquired dependency free;

If (Game.IsPluginInstalled("SKK476OpenWorld.esp") == TRUE)
ThisNPC.AddKeyword(Game.GetFormFromFile(0x00019bcb, "SKK476OpenWorld.esp") as Keyword)
EndIf



Long and elegant script (one lookup per game load)


ObjectReference Property pPlayerREF Auto Const MandatoryKeyword rSKK_476NoDisable

Event OnInit()
Self.RegisterForRemoteEvent((pPlayerREF as Actor), "OnPlayerLoadGame")
GetRemoteForms() ;If the DLC or mod is active now
EndEvent

Event Actor.OnPlayerLoadGame(Actor akSender)
GetRemoteForms() ;If the DLC or mod is added or removed between saves
EndEvent

Function GetRemoteForms()
rSKK_476NoDisable = None
If Game.IsPluginInstalled("SKK476OpenWorld.esp") == TRUE
rSKK_476NoDisable = Game.GetFormFromFile(0x00019bcb, "SKK476OpenWorld.esp") as Keyword
EndIf
EndFunction

;In your NPC management code add something like this:

If (rSKK_476NoDisable != None)
ThisNPC.AddKeyword(rSKK_476NoDisable)
EndIf

Article information

Added on

Edited on

Written by

SKKmods