Skyrim Special Edition
0 of 0

File information

Last updated

Original upload

Created by

Meridiano

Uploaded by

MeridianoRus

Virus scan

Safe to use

About this mod

Frequent call fix of OnMagicEffectApply event in different scripts.

Requirements
Permissions and credits
Changelogs
When I entered High Hrothgar during The Way of the Voice quest I suddenly got "VM Overstressed" message from SSE Display Tweaks. It indicates that game script engine is under some heavy load. The message didn't want to disappear so there was a problem here. I created a temp save and exit the game.

When I loaded the save in ReSaver I saw a lot of active calls of MQ105ShoutTargetScript and I decided to investigate it. It has only one OnMagicEffectApply event so I attached some Debug.Trace functions to it and moved back to the game.

What's the problem?
- Many mods use "cloak" spells to distribute various effects to NPCs. SPID can also do this work but there's no SKSE for consoles and Vokrii is an example of "cloaking" mod because it's multiplatform.
- With the No Hit Event magic effect flag its effects don't trigger the OnHit event but the OnMagicEffectApply triggers on every, well, magic effect apply.
- So 5 "cloak" effects that trigger the OnMagicEffectApply for every second for 4 Greybeards lead to 400 calls in 20 seconds.

What's the solution?
- "Basic" version is no longer supported and was dropped at 1.8.
- For "Effective" version I've replaced OnMagicEffectApply with more effective PO3 Papyrus Extender code, so it's required for this version. Note that in this version my scripts use OnLoad event to register magic effects and you need to load your save before any related quest to process everything right.

Not only MQ105
The OnMagicEffectApply event is used not only in this case but also in some more scripts when the game waits for some magic cast. However, not every script causing the problem but only attached to damageable actors. For example there are wisps in Soul Cairn that have this event but they don't receive it because of invulnerability. Being attached to activators this event doesn't cause frequent calls as well. So here's the list of scripts affected by this mod with some brief notes.

MQ105PhantomFormScript > phantom waits for Unrelenting Force 2nd level.
MQ105ShoutTargetScript > 4 Greybeards wait for Unrelenting Force 1st level.
MQ106DragonScript > Sahloknir waits for any Shout to say "your Voice is strong" during the fight.
MQ204PaarthurnaxScript > Paarthurnax waits for any Fire Breath.
MQ206AlduinScript > Alduin waits for the full Dragonrend.
MQ304AlduinScript > Alduin reacts to hits while player wanders through Sovngarde.
MS08SaadiaScript > Saadia waits for Kematu to paralyze her.
MG01NiryaScript > Faralda waits for the healing spell during the exam.
DLC2MQ06FakeDragonKillEffectScript > After Zii-Los-Dii-Du dragons end their kill scenes.
Survival_HungerEatingDetection > Werewolf feeding or cannibalism affect hunger.
Survival_PlayerMagicHitInfo > Player reacts to fire and frost effects.
Survival_ResistDiseaseWatchScript > Some values change when player receives disease resistance.
USKPDunMossMotherValdrAliasScript > Valdr waits for healing during the Moss Mother Cavern quest.

Additions
These optional files are some similar fixes but related to mods, not the base game or USSEP. If you find any VM load caused by OnMagicEffectApply during your playthrough, you can request a new fix for it in comments. However I don't promise it will be made, depends on the particular script.
Currently available additions for various mods:
- Immersive College of Winterhold 6.2.
Ordinator - Perks of Skyrim 9.31.

Compatibility
- These scripts are compatible with Vanilla Script Micro-Optimizations and USSEP because I used their edited versions as a base, but they are not required.
- Many of the scripts are the same as in Vanilla Scripting Enhancements but they are very close so it's safe to overwrite this mod with that one and vice-versa.
- Note that this mod is loose-only so it will overwrite any BSA even if being placed before it in your mod manager.