Version 3.2

Fixed the unequipping bug which happened when equipping a weapon after using the torch and then equipping the torch again.

Version 3.1.1

Improved debug menu.

Minor fixes.

Script is now ONLY applied to NPC's if necessary.

Fixed bug with quest not stopping on uninstallation.

Version 3.1

All modules are toggleable for increased compatibility with other mods.

Magelight logic changes.

More MCM descriptions.

NPC functionality works without issues in exteriors. Workaround possible by using the location settings.

Minor fixes.

Version 3.0b

MCM menu, all options are customizable.

Beta NPC functionality (engine doesn't seem to like it though).

Improved script performance.

ELFX compatibility (all through script, no additional esp-file)

Wearable lanterns compatibility

Improved Candlelight compatibility.

Mod now requires skse64.

Version 2.2

- NEW SCAN FEATURE. Scans the area for shadow casting light sources and enables/disables shadows accordingly.

- Cleaned up some things (no more endless pit in qasmoke)

- Now semi compatible with torch mesh replacers; they will work for NPC's.

- Optional torch mesh now included in main file.

- Removed the unstable version; there are other mods which provide such a simple edit.

Version 2.1

Magelight no longer cast shadows on impact onto any surface. Reason: Way too glitchy and mostly won't even cast light at all.

Version 2.0

Major update. Shadows, brightness/range are managed/customized in-game with a book added the player's inventory, all done through scripting. The player can now disable or enable shadows at specific locations that induce CTD's.

Version 1.2

Magelight now only cast shadows during travel but not on impact.

Brightness settings in FOMOD-installer.

Version number updated

Option to only enable torch shadows and candlelight shadows respectively

How it works and what to expectAs most of us already know, there is an apparent reason why Bethesda didn't include this functionality: PERFORMANCE. Therefore, dynamic lights held by actors are bound to have some issues. This is exactly the reason why this mod exists - to circumvent the limitation of the game engine.The script scans every new cell on cellchange and returns all shadow casting lights. Each time you, or a npc if enabled, is equipping a light (torch/candlelight) the script checks how far the shadow casting lights are. If 4 of them are too close to the player, you won't cast any shadows. This means that shadow casting won't work all the time, only when it is safe. This will avoid light flicker and CTD.

Currently, there are three main issues with dynamic lights in Skyrim (and most of Bethesdas other games).

There is a hardcoded limit of 4 dynamic lights being rendered at the same time. If this limit is exceeded the last added light will simply "turn off". This creates a "flickering" effect when moving the camera around in circles as the lights go on and off.

Replacing dynamic lights with static lights will cause them to "get stuck" in the world. This is particularly bad since it the dynamic light limit will rapidly get exceeded if not handled correctly.

PERFORMANCE! The main reason behind issue 1, and inherently also the reason why issue 2 exists. Dynamic lights is a performance killer for consoles and other low-end machines.

This mod aims to fix issue 1 and 2. Issue 1 is fixed by always checking the area before equipping a torch: IF there are too many dynamic lights within a customizable radius, don't equip a shadow casting torch/candlelight/etc - just equip a regular torch. Each actor wearing a dynamic light also has a script which checks if it still is safe to use it, otherwise the dynamic light is replaced by a regular light.Issue 2 is fixed by always removing the old dynamic light BEFORE equipping the new one.Still, there are some minor issues that might occur.

There is a slight delay and a light "pre-pop" effect before the torch is equipped. There is nothing I can do about that if I wish to maintain compatibility with other popular torch-related mods.

Occasionally, the left hand holding a torch will still be in the holding animation even after unequipping.

If you have another mod which edits the TorchEvents IdleAnimation record, you will get a wierd "picking up" animation each time equipping a torch. If you use any other mods that add left-handed held lights you WILL need a patch. Currently only Wearable Lanterns by Chesko is supported.

Light may flicker if you use other mods than ELFX or ELE that add lights to the vanilla world. A patch is needed, let me know and I will fix it. Just let me know what light mod you are using. Custom homes might also have these issues. Either add that location to the Blacklist in the MCM or request for a patch in the comments. Patching i REALLY easy since it can be done through script.

Todo- Duration option for candlelight (see SetNthEffectDuration and GetNthEffectDuration) - Torches should burn out and be removed from the inventory. Options for how they burn out. Keep track on how long a torch has been used on OnObjectEquipped and OnObjectUnequipped. Remove a torch when a certain customizable limit is exceeded - reset when OnItemRemoved -> GetItemCount(Torch02) == 0.- Experiment with GetLight() and SetLight() and SetProjectile() and GetProjectile().