About this mod
This is a very simple mod to improve Frostfall's spell monitor script to reduce script lag using po3's wonderful Papyrus Extender.
- Requirements
- Permissions and credits
- Changelogs
How it works
This mods simply converts the script's `OnMagicEffectApply` to po3's `OnMagicEffectApplyEx` so Frostfall's spell monitor will only fire if the player is hit with a frost or fire effect.
Old Script:
...
Event OnMagicEffectApply(ObjectReference akCaster, MagicEffect akEffect)
// stuff here
EndEvent
...
New Script:
...
import PO3_Events_Alias
Event OnInit()
RegisterForMagicEffectApplyEx(self as ReferenceAlias, MagicDamageFire as Form, True)
RegisterForMagicEffectApplyEx(self as ReferenceAlias, MagicDamageFrost as Form, True)
EndEvent
Event OnMagicEffectApplyEx(ObjectReference akCaster, MagicEffect akEffect, Form akSource, bool abApplied)
// Same stuff
EndEvent
...
How this improves performance
TLDR: Reduces Frostfall script lag that occurs when hit with many magic effects at once.
Long version: Skyrim vanilla `OnMagicEffectApply` event will fire for every magic effect that is applied.
In this script, that is every magic effect applied to the player. With a heavy load order like mine, this resulted in lots of magic effects hitting the player at once, causing script lag and eventually stack dumps. This mod replaces that event with po3's `OnMagicEffectApplyEx`, which only fires for magic effects/keywords you explicitly register it for. The original script only wants to handle fire and frost effects "MagicDamageFire" and "MagicDamageFrost", so this script registers for just those two keywords. All other magic effects that hit the player will no longer run this event, reducing script lag. The amount of script lag that is reduced will depend on how many magic effects are hitting the player at one time. The more effects the player is hit with, the more performance is saved with this mod.
Installation
New game:
Install with any mod manager of choice. Just make sure this overwrites Frostfall's script.
Mid-save (where Frostfall is already active):
To be sure this doesn't break anyone's game, do the following
1. Load up your game
2. Go to a low-activity cell using console commands. I use "coc QASmoke" personally. This is to ensure the old script isn't actively doing any work when it's swapped out just in case (It IS Skyrim after all)
3. Save game
4. Install this mod with any mod manager of choice. Just make sure this overwrites Frostfall's script.
5. Load up your game and play as usual.
To confirm it works:
1. Spawn a Frost Atronach
2. Let it damage and attack you
3. If your temperature drops, congrats! This mod works without issue.
Compatibility
Compatible with everything, so long as no other mod overwrites the same script as this mod. If any mod besides Frostfall happens to overwrite this mod, feel free to reach out and I can make a quick compatibility patch for it.
Credits
powerofthree's Papyrus Extender by powerofthree for the wonderful modding library
Frostfall by Chesko for a great survival mod
This is my first time making a mod. If this mod is requested to be taken down, I will do so without any questions.