Fallout 4
0 of 0

File information

Last updated

Original upload

Created by

EagleFour

Uploaded by

EagleFour

Virus scan

Safe to use

Tags for this mod

About this mod

Adding breathing shaders to NPCs through Nuclear Winter increases the system load more and more over time. This mod clears the breath shader Spells when the player is not in the NPC's cell, reducing the system load and making the system more stable.

Requirements
Permissions and credits
The problem:

When other mods spawn more NPCs, Nuclear Winter adds breath shaders to each NPC via Spell. Over time, a large number of NPCs with active spells accumulate, which are activated under certain circumstances, even if the player is not in the cell of the NPC. This leads over time to higher and higher system load, which can eventually lead to CTDs and other problems (e.g. suspended stacks). Especially mods like Mutant Menagerie, which spawn massive amounts of NPCs, put a lot of load on the system. (For me it was sometimes up to 5000 active scripts.) CTDs can accumulate. Script latency occurs more and more often.

This mod removes these spells when the player is not in the same cell as the NPCs. The system load is thereby significantly reduced.    

How it Works (Technically):

Every NPC gets the spell 'Winter_NPC_CloakEquip' at some point. This activates the magicEffect 'Winter_NPC_CloakEquipEffect', which in turn
starts the script 'cloakshader'.
Which in turn registers the event with 'RegisterForRemoteEvent(NPC,
"OnLocationChange")'.

In the course of time more and more NPCs accumulate, which listen to
this event. In my case there are thousands by now.
Since neither the Spell nor the Magic Effect is cleared, they all wait
for the event, which comes when certain conditions are met.
For example, if I travel to Homeplate and no other NPC is loaded and
then wait or sleep, the event is triggered.
This then causes hundreds or even thousands of simultaneous events,
other important scripts are then put on the stack. It comes then again
and again to CTDs, especially when I am e.g. in SS2 settlements. Script
super Gau.

Although the unregister is provided, in the event ' OnEffectFinish', but
this event is never triggered. Since the Spell on the NPC is not
deleted and the MagicEffect is therefore always active. Every NPC that
got the Spell, so every NPC that was already 3d loaded, has the active
MagicEffect with the registered remote event. At the beginning this
might not be a problem, but in the course of time countless NPCs
accumulate, which wait for the remote event to become active at once and
collapse the system. 

The Solution:

A small change to the CloakShader script will fix the problem:

Event Actor.OnLocationChange(Actor akNPC, Location akOldLoc,
Location akNewLoc)
;---------------------------------------------------
Utility.Wait(Utility.RandomFloat(0.0, 1.0))
If !NPC.Is3DLoaded()
NPC.RemoveSpell(Winter_NPC_CloakEquip)
UnRegisterForRemoteEvent(NPC, "OnLocationChange") ; probably
not necessary, since unregister comes with remove spell.
Endif
;---------------------------------------------------

i don't know if there are any disadvantages. So far I have not been able
to find anything.
In any case, I now have much less script overhead and no more CTDs in
this context.


Installation:

the original mod is needed: Fallout 2287 - Nuclear Winter

Install either with Mod Manager or manually overwrite the existing script in the data/Script folder.



My other Mods:

Companion Radio Patch
Cade and Kelan - A Tale Of Two Twins - Voice Patch
Cade and Kelan - A Tale Of Two Twins - German Translation
Outlaws Of The Commonwealth - German Translation
Outlaws Of The Commonwealth Voice Patch
James' Journey Voice Patch
James' Journey - German Translation
Sim Settlements 2 - German Translation
Sim Settlements 2 Kapitel 2 - Gunner Outbreak - German Translation
Outcasts and Remnants - Quest Mod Plus - German Translation
Depravity - A Harmless Bit of Fun - German Translation
Project Valkyrie - German Translation
Fusion City Rising - Quest Mod Plus - German Translation