About this mod
Sustained Magic by nicholasdwebb is amazing, but it could be a bit better. This showcases your current magicka debuffs using the vanilla meter!
- Requirements
- Permissions and credits
- Changelogs
Description
Sustained Magic is a very smart mod designed to make your magic experience less cumbersome whilst also making it more strategic, but its lack of information available to the player was a thorn in the side for me; you basically had to memorize how each and every perk, armor, debuff, etc. affected the cost and magnitude of the sustain spells, and memorize how much magicka you generally had left at any given time. I wanted to know how much my max magicka had been affected, so I made this.
This simply edits the original script to incorporate UI calls to assets already included in the game, specifically the assets patched in for the Creation Club Survival Mode. With some very gracious help from dunc001, author of iEquip, I figured out how to utilize the debuff meters patched into the vanilla game. That means it's as fast as can be!
That aside, this basically means this mod is incompatible with the Creation Club Survival Mode; the formula I use to calculate the percentages and whatnot incorporates any present debuffs, and sets the debuff meter accordingly, but the Survival Mode does not take into account the Sustain Spells debuff. So, this mod is compatible with Survival Mode; Survival Mode is just not compatible with this mod. I don't use Survival Mode, so patching it isn't a top priority, but it shouldn't be too hard.
Requirements
- Sustained Magic The original mod.
- Any mod that utililzes vanilla Survival Mode debuff UI elements. They would have to be made aware of the debuffs from Sustained Magic, or of currently applied debuffs in general. Otherwise, they will clash with this mod.
I haven't tested much, but it seems fine.
Nitty Gritty
This is the section of code I added to the Sustained Magic script, that's it. The formula I use to calculate the debuff percentage inherently takes into account all present debuffs already. More modders should implement base Skyrim debuff meters to showcase their debuffs, I think.
float fMagicMax = Math.Ceiling(Game.GetPlayer().GetActorValue("magicka") / Game.GetPlayer().GetActorValuePercentage("magicka"))
float fMagickaDebuffedMax = Game.GetPlayer().GetAVMax("magicka")
float fMagickaPercent = fMagickaDebuffedMax / fMagicMax
float fMagickaRemainingDebuffedPercent = 100 - (fMagickaPercent * 100)
iHandle = UICallback.Create("HUD Menu", "_root.HUDMovieBaseInstance.SetExhaustionPenaltyMeter")
If(iHandle) ; Check you've got the callback to the UI function otherwise there's no point in proceeding
UICallback.PushFloat(iHandle, fMagickaRemainingDebuffedPercent) ; Your debuff value as float
UICallback.PushBool(iHandle, false) ; abForce - set to false and it should animate the meter, true will force it to the value. You may need to set this to true to get it to work
UICallback.Send(iHandle) ; Make the call and cross your fingers
endIf
Credits
dunc001, for obliging some random dude on his Discord asking for UI modding help.
nicholasdwebb, for making a mod I include in everything now.