Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Show off your mod creations or just a work in progress.
Narf the Mouse
Posts: 833
Joined: Mon Nov 30, 2015 6:32 pm

Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Narf the Mouse »

v0.5 is now out: 11/09/2019

So I made a little mod that does a few things:

1) Makes playing a low-level mage less painful.
2) Makes it viable to play a mage without taking 3X Int in Magicka. (really!)
3) Makes high-level mage PCs even more powerful. (sorry! not intentional - I don't even know if spell point cost reduction for magicka skills can be changed)
4) It doesn't affect magicka regeneration when resting. (I'll have to investigate this. :) ) - Fixed as of v0.4!
5) NPCs will also regenerate magicka. :twisted: But you can turn this off in the mod settings. - Mod settings took a large step backward in v0.4
6) New in v0.4 - Set the frequency of regeneration. Unfortunately, this is also the only current setting, although more settings are planned.

It does this by allowing you and NPCs to, as you may guess, regenerate magicka. ;)

Current (v0.5):
Magicka Regeneration.zip
(13.7 KiB) Downloaded 643 times

What does this do?

1a) You regenerate magicka a lot slower when your current magicka is low, relative to your maximum magicka. (Your regeneration will never be 0, although it can get very close...)
1b) NPCs regenerate magicka as if their current Magicka was 65% of their maximum magicka. (You can change the rate in the mod settings) This is because current NPC AI doesn't know about Magicka Regeneration or how it works, and would otherwise cripple itself. You can also toggle NPCs to use the same magicka regeneration as you do. (Toggle "Use Simplified NPC Regeneration off" in the mod settings)
2) You/NPCs regenerate magicka faster, the lower your maximum magicka.
3) You/NPCs regenerate magicka faster with more willpower.

What are the intended implications?

Magicka exhaustion encourages a "run-and-cast" style of gameplay.

Up to 50% of your maximum magicka is "fungible", and the remaining 40% is essentially emergency reserves, or for long-duration spells.
Willpower is more valuable, but not a lot more. At 100 Willpower, you regenerate Magicka twice as fast as at 50 Willpower. (I may increase this in the future)
A character with a maximum of 50 magicka regenerates magicka 6 times as fast as a character with 300 magicka. OTOH, it's a lot harder to exhaust 300 magicka...

The math: Magicka regeneration is based on the following formula:

Per second = max((CurrentMagicka / MaximumMagicka)^magickaPercentExponent, minimumMagickaPercent) * (dividendMaximumMagicka / MaximumMagicka) * (CurrentWillpower * willpowerMultiplierPercent )

Simplified NPC magicka regeneration is instead based on this formula:

Per second = max(((simplifiedMagickaPercent * MaximumMagicka) / MaximumMagicka)^magickaPercentExponent, minimumMagickaPercent) * (dividendMaximumMagicka / MaximumMagicka) * (CurrentWillpower * willpowerMultiplier)

lowerCase names are variables, and can be changed in settings.

Defaults:
dividentMaximumMagicka = 150
magickaPercentExponent = 200%
minimumMagickaPercent = 1%
willpowerMultiplierPercent = 15%
_NPCsRegenerateMagicka = True
useSimplifiedNPCRegeneration = True
simplifiedMagickaPercent = 65%

Currently, you can just set the Frequency with which you regeneration magicka:
Per Second: Very fast combat regeneration; suitable for if you want spells to be very powerful.
Per 6 Seconds: Combat regeneration.
Per 30 Seconds. Fast non-combat regeneration. The default.
Per Minute: Slow non-combat regeneration.
Per 10 Minutes: Basically only rest regeneration.
Per Hour: I don't even know why this exists.
Per Day: I definitely don't even know why this exists.

Warning! The code has received very minimal testing. I cannot be held responsible for anything it does to your character(s), your computer, or anything else, and I highly recommend making a test character. That being said, it should be well-behaved, but I cannot guarantee that.

Installation:

Copy the "Magicka Regeneration.dfmod" file for your platform into your "StreamingAssets/Mods" folder.

Uninstallation:

It should uninstall by removing the "Magicka Regeneration.dfmod" file from your "StreamingAssets/Mods" folder. However, see the warning above.

Changelog:

Changes in v0.5:
* The mod no longer auto-sets "NoRegenSpellPoints = true". If you've used v0.4, you'll need to go into your save file and set that to false, if you didn't select it in character creation.
* Added protection against accidentally adding more than one magicka regeneration script.
* Added protection against magicka regeneration rollover pile-up.
* New Frequency setting: Per 30 seconds. This is now the default, on advice from Ralzar.

Changes in v0.4:
* Re-wrote the entire mod off of the documentation in this post. Thanks, Past Me!
* Magicka regeneration now works off of in-game time, not Unity Engine's Time.time or whatever I was doing before.
* Can set the Frequency of Magicka Regeneration.
* All other settings are gone.
* Scans for mobs to attach a script to once per second. This should not cause a problem.

Changes in v0.3:

* NPCs can now regenerate magicka.
* Two new toggles. Both toggles default to True.
** "NPCs Regenerate Magicka" controls whether or not NPCs regenerate magicka at all.
** "Use Simplified NPC Regeneration" determines which formula NPCs use; the same as the player, or the simplified formula. The simplified formula is recommended for AI which does not take magicka regeneration into account.
* New slider: "Simplified Magicka Percent", which defaults to 65%.
* The simplified NPC magicka regeneration formula calculates magicka regeneration as if their current magicka was always equal to the "Simplified Magicka Percent" of maximum magicka. This should allow NPCs to regenerate magicka, without favouring them.

Changes in v0.2:

* Hardcoded constants are now variables.
* Added settings so you change the variables in the formula.
* Formula is now: Per second = max((CurrentMagicka / MaximumMagicka)^magickaPercentExponent, minimumMagickaPercent) * (dividendMaximumMagicka / MaximumMagicka) * (CurrentWillpower * willpowerMultiplierPercent )
* lowerCase names are variables.

New NPC magicka regeneration formula:

Per second = max(((simplifiedMagickaPercent * MaximumMagicka) / MaximumMagicka)^magickaPercentExponent, minimumMagickaPercent) * (dividendMaximumMagicka / MaximumMagicka) * (CurrentWillpower * willpowerMultiplier)

Old; kept for historical purposes.
Magicka Regeneration.zip
(11.55 KiB) Downloaded 554 times
Last edited by Narf the Mouse on Sun Nov 10, 2019 3:45 am, edited 11 times in total.
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Interkarma »

Thanks Narf! I hope you get some good testing results soon.

When you're happy, I can move into released mods.

Narf the Mouse
Posts: 833
Joined: Mon Nov 30, 2015 6:32 pm

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Narf the Mouse »

Interkarma wrote: Wed Dec 26, 2018 10:58 pm Thanks Narf! I hope you get some good testing results soon.

When you're happy, I can move into released mods.
Thanks. :) Not sure what to do about a picture, though.

And it does need settings, so people aren't stuck with my hardcoded values. Just no time today. :)
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

Narf the Mouse
Posts: 833
Joined: Mon Nov 30, 2015 6:32 pm

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Narf the Mouse »

...Does anyone else download their own mods? Because I just did. :D Seems more reliable than "Whatever state the mod is in development." Heh.
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

User avatar
Jay_H
Posts: 4062
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Jay_H »

That seems to suggest you're not holding the original copy on your computer for testing like I do with my quests :D

Narf the Mouse
Posts: 833
Joined: Mon Nov 30, 2015 6:32 pm

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Narf the Mouse »

Jay_H wrote: Sun Dec 30, 2018 12:40 am That seems to suggest you're not holding the original copy on your computer for testing like I do with my quests :D
I do have version control - But I don't generally go all-in with tagged releases... which I probably should.
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

Narf the Mouse
Posts: 833
Joined: Mon Nov 30, 2015 6:32 pm

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Narf the Mouse »

Version 0.2 is now out; the download link in the first post has been updated. Changes:

* Hardcoded constants are now variables.
* Added settings so you change the variables in the formula.
* Formula is now: Per second = max((CurrentMagicka / MaximumMagicka)^magickaPercentExponent, minimumMagickaPercent) * (dividendMaximumMagicka / MaximumMagicka) * (CurrentWillpower * willpowerMultiplierPercent )
* lowerCase names are variables.
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

Narf the Mouse
Posts: 833
Joined: Mon Nov 30, 2015 6:32 pm

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Narf the Mouse »

Request for comment - If you find you like a different set of settings better, what were they, and why?

Provided there are no major complaints by, say, January 8th, I'll submit this to Interkarma as a proper mod. :)
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

Narf the Mouse
Posts: 833
Joined: Mon Nov 30, 2015 6:32 pm

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Narf the Mouse »

Version 0.3 is now out; the download link in the first post has been updated. Changes:

* NPCs can now regenerate magicka.
* Two new toggles. Both toggles default to True.
** "NPCs Regenerate Magicka" controls whether or not NPCs regenerate magicka at all.
** "Use Simplified NPC Regeneration" determines which formula NPCs use; the same as the player, or the simplified formula. The simplified formula is recommended for AI which does not take magicka regeneration into account.
* New slider: "Simplified Magicka Percent", which defaults to 65%.
* The simplified NPC magicka regeneration formula calculates magicka regeneration as if their current magicka was always equal to the "Simplified Magicka Percent" of maximum magicka. This should allow NPCs to regenerate magicka, without favouring them.

New NPC magicka regeneration formula:

Per second = max(((simplifiedMagickaPercent * MaximumMagicka) / MaximumMagicka)^magickaPercentExponent, minimumMagickaPercent) * (dividendMaximumMagicka / MaximumMagicka) * (CurrentWillpower * willpowerMultiplier)
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

Narf the Mouse
Posts: 833
Joined: Mon Nov 30, 2015 6:32 pm

Re: Magicka Regeneration - Ready for testing; definitely not ready for prime-time

Post by Narf the Mouse »

...Um, I appear to be late with my mod submission.

...Yeah, my bad.
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

Post Reply