Strength and endurance in the formula should be not current value, but their base maximum value. This way health value will be independent of stats drain/fortify.
Correct - for OpenMW (and vanilla, without the need for MWSE, MGE, or any other prerequisite mod), it's much simpler to just use Talrivian's fully working mod instead.
I know this is a reply to a pretty old comment but I just have to ask this: Isn't the point that drain/fortify endurance SHOULD affect health, otherwise they do pretty much nothing like in vanilla game? Why would anyone suggest this?
could you please tell me how to make a mod similiar to yours, but with magicka? magicka should be based on skill level in the schools plus intelligence. I did something in my head but it doesn't work. I want it for npc the player and creatures.
Obviously i am totally new to this kind of scripting.
Spoiler:
Show
local configPath = "Magicka Increase" -- The name of the config json file of your mod
-- The config table local config = mwse.loadConfig(configPath, { enabled = true })
local function magickaincrease() local mobilePlayer = tes3.getMobilePlayer() local tes3.mobilePlayer.magicka.base = tes3.mobilePlayer.intelligence.current + tes3.mobilePlayer.conjuration.current + tes3.mobilePlayer.mysticism.current + tes3.mobilePlayer.destruction.current + tes3.mobilePlayer.restoration.current + tes3.mobilePlayer.alteration.current + tes3.mobilePlayer.illusion.current for ref in tes3.getPlayerCell():iterateReferences(tes3.objectType.actor, tes3.objectType.creature) do if ref.mobile then local ref.mobile.magicka.base = ref.mobile.intelligence.current + ref.mobile.conjuration.current + ref.mobile.mysticism.current + ref.mobile.destruction.current + ref.mobile.restoration.current + ref.mobile.alteration.current + ref.mobile.illusion.current end end
-- When the mod config menu is ready to start accepting registrations, -- register this mod. local function registerModConfig() -- Create the top level component Template -- The name will be displayed in the mod list on the lefthand pane local template = mwse.mcm.createTemplate({ name = "Magicka Increase" })
-- Save config options when the mod config menu is closed template:saveOnClose(configPath, config)
-- Create a simple container Page under Template local settings = template:createPage({ label = "Settings" })
-- Create a button under Page that toggles a variable between true and false settings:createYesNoButton({ label = "Enable Mod", variable = mwse.mcm:createTableVariable({ id = "enabled", table = config }), })
-- Finish up. template:register() end event.register(tes3.event.modConfigReady, registerModConfig)
It's technically safe, but not recommended. The game would start doing vanilla calculations for future health gains, but not for past gains, so it would be inconsistent.
That said you could probably replace it with a different mod that does it's own health calculations.
This seems to be very similar to State Based HP Mod by Talrivian v.2.2 (Rewrite of HotFusion's State-Based HP Mod) https://mw.modhistory.com/download-98-6521
Yes, the formula is almost the same as Talrivian's, except that Talrivian's doesn't respect the endurance mult GMST and specifies 0.1 instead. I've used Talrivian's for years, but I thought it was better implemented in MWSE.
As the modhistory site now appears to be dead, Talrivian's mod is now here on Nexus:
https://www.nexusmods.com/morrowind/mods/52183
It's also OpenMW-compatible, with no MWSE needed, so it remains the most useful and versatile mod of this type - I ditched Oldwind years ago for OpenMW myself. Sticky request seconded. ;)
Ran into what I think is a bug, any time I load a save it increases my current health beyond my max health. If I disable the mod things go back to normal though. Any ideas on what I can do to fix the issue?
Here's the data from the MWSE.log file.
[State-Based Health 1.3] Game loaded. Calculating health. [State-Based Health 1.3] Old max health: 67.000000 [State-Based Health 1.3] Old current health: 85.500000 [State-Based Health 1.3] Endurance: 32.000000 [State-Based Health 1.3] Strength: 75.000000 [State-Based Health 1.3] Level: 11 [State-Based Health 1.3] fLevelUpHealthEndMult GMST: 0.100000 [State-Based Health 1.3] New max health (per formula): 85.500000 [State-Based Health 1.3] Fortify Health magnitude: 0.000000 [State-Based Health 1.3] Fortify Health magnitude affecting max health: 0.000000 [State-Based Health 1.3] New max health (taking into account Fortify Health): 85.500000 [State-Based Health 1.3] New max health (after all modifiers from other mods): 85.500000 [State-Based Health 1.3] Minimum max health setting: 0.000000 [State-Based Health 1.3] New max health (taking into account minimum max health setting): 85.500000 [State-Based Health 1.3] Maintaining ratio. Ratio: 1.276119 [State-Based Health 1.3] New current health: 109.108205
Hmm, that's showing that your health in the savegame is 85/67.
If you load that savegame without this mod, what's your current/max health? Are you playing with another mod that does anything with health? Those "old current/max health" values are checked immediately upon game load, before this mod does anything.
I've done a bit of playing since then and leveled up, without the mod enabled my health lists as 87/87 (level 17 now). If I enable the mod it goes to 114/114 on the first run, however if I select Load again and reload that same save file while already playing my health suddenly shoots up to 148/114.
Here's an updated bit of data from the MWSE.log file
[State-Based Health 1.3] Game loaded. Calculating health. [State-Based Health 1.3] Old max health: 87.800003 [State-Based Health 1.3] Old current health: 114.300003 [State-Based Health 1.3] Endurance: 33.000000 [State-Based Health 1.3] Strength: 90.000000 [State-Based Health 1.3] Level: 17 [State-Based Health 1.3] fLevelUpHealthEndMult GMST: 0.100000 [State-Based Health 1.3] New max health (per formula): 114.300001 [State-Based Health 1.3] Fortify Health magnitude: 0.000000 [State-Based Health 1.3] Fortify Health magnitude affecting max health: 0.000000 [State-Based Health 1.3] New max health (taking into account Fortify Health): 114.300001 [State-Based Health 1.3] New max health (after all modifiers from other mods): 114.300001 [State-Based Health 1.3] Minimum max health setting: 0.000000 [State-Based Health 1.3] New max health (taking into account minimum max health setting): 114.300001 [State-Based Health 1.3] Maintaining ratio. Ratio: 1.301822 [State-Based Health 1.3] New current health: 148.798290
For Mods I currently have running, the only one I can think of that would impact health is Improved Vanilla Leveling. Which does give a notice in a different part of of the log file, see below.
[Improved Vanilla Leveling]Warning: max health decreased from 114.300003 to 87.800000.
Okay I think the conflict is with IVL, which includes its own health calculations. To confirm, if you turn off IVL's health system in the MCM, does that fix the problem? You should be able to do that instead of disabling IVL entirely (I don't use that mod though so I'm not sure).
Trying it a couple of different ways yea, if I go in and disable that part of Improved Vanilla Leveling I don't get any weirdness with the health, or at least haven't yet between trying to die, reload, or load between two different character saves. Guess confirmed it's a mod conflict that can be resolved by turning off the health calculations of IVL. For general reference if you're updating anything people would need to set the "Retroactive Health Calculation" setting to Off in the Improved Vanilla Leveling mod to get them to play nice with each other.
Thanks for the quick reply, and for adding so much to the Morrowind modding community. Your talent and detailed imagination has definitely improved my gaming experience.
Pumped to check out the Observing Station next time one of my characters is near Pelagiad.
How would this mod work with Improved Vanilla Leveling's retroactive health calculation? It has an mcm option to turn retroactive health off, so either way the two can be used together, but I'm wondering if both health calculations would work in tandem or if this mod would make IVL's redundant.
This mod just calculates what current/max health should be based on its formula and sets it, so it would either override or be overridden by IVL's calculation.
46 comments
Talrivian's State-Based HP Mod (OpenMW-vanilla) at Morrowind Nexus - mods and community (nexusmods.com)
could you please tell me how to make a mod similiar to yours, but with magicka?
magicka should be based on skill level in the schools plus intelligence.
I did something in my head but it doesn't work.
I want it for npc the player and creatures.
Obviously i am totally new to this kind of scripting.
local configPath = "Magicka Increase" -- The name of the config json file of your mod
-- The config table
local config = mwse.loadConfig(configPath, {
enabled = true
})
local function magickaincrease()
local mobilePlayer = tes3.getMobilePlayer()
local tes3.mobilePlayer.magicka.base = tes3.mobilePlayer.intelligence.current + tes3.mobilePlayer.conjuration.current + tes3.mobilePlayer.mysticism.current + tes3.mobilePlayer.destruction.current + tes3.mobilePlayer.restoration.current + tes3.mobilePlayer.alteration.current + tes3.mobilePlayer.illusion.current
for ref in tes3.getPlayerCell():iterateReferences(tes3.objectType.actor, tes3.objectType.creature) do
if ref.mobile then
local ref.mobile.magicka.base = ref.mobile.intelligence.current + ref.mobile.conjuration.current + ref.mobile.mysticism.current + ref.mobile.destruction.current + ref.mobile.restoration.current + ref.mobile.alteration.current + ref.mobile.illusion.current
end
end
event.register("mgaickaincrease", magickaincrease)
-- When the mod config menu is ready to start accepting registrations,
-- register this mod.
local function registerModConfig()
-- Create the top level component Template
-- The name will be displayed in the mod list on the lefthand pane
local template = mwse.mcm.createTemplate({ name = "Magicka Increase" })
-- Save config options when the mod config menu is closed
template:saveOnClose(configPath, config)
-- Create a simple container Page under Template
local settings = template:createPage({ label = "Settings" })
-- Create a button under Page that toggles a variable between true and false
settings:createYesNoButton({
label = "Enable Mod",
variable = mwse.mcm:createTableVariable({ id = "enabled", table = config }),
})
-- Finish up.
template:register()
end
event.register(tes3.event.modConfigReady, registerModConfig)
That said you could probably replace it with a different mod that does it's own health calculations.
State Based HP Mod by Talrivian v.2.2 (Rewrite of HotFusion's State-Based HP Mod)
https://mw.modhistory.com/download-98-6521
Thanks for this MWSE implementation.
https://www.nexusmods.com/morrowind/mods/52183
It's also OpenMW-compatible, with no MWSE needed, so it remains the most useful and versatile mod of this type - I ditched Oldwind years ago for OpenMW myself. Sticky request seconded. ;)
Here's the data from the MWSE.log file.
[State-Based Health 1.3] Game loaded. Calculating health.
[State-Based Health 1.3] Old max health: 67.000000
[State-Based Health 1.3] Old current health: 85.500000
[State-Based Health 1.3] Endurance: 32.000000
[State-Based Health 1.3] Strength: 75.000000
[State-Based Health 1.3] Level: 11
[State-Based Health 1.3] fLevelUpHealthEndMult GMST: 0.100000
[State-Based Health 1.3] New max health (per formula): 85.500000
[State-Based Health 1.3] Fortify Health magnitude: 0.000000
[State-Based Health 1.3] Fortify Health magnitude affecting max health: 0.000000
[State-Based Health 1.3] New max health (taking into account Fortify Health): 85.500000
[State-Based Health 1.3] New max health (after all modifiers from other mods): 85.500000
[State-Based Health 1.3] Minimum max health setting: 0.000000
[State-Based Health 1.3] New max health (taking into account minimum max health setting): 85.500000
[State-Based Health 1.3] Maintaining ratio. Ratio: 1.276119
[State-Based Health 1.3] New current health: 109.108205
If you load that savegame without this mod, what's your current/max health? Are you playing with another mod that does anything with health? Those "old current/max health" values are checked immediately upon game load, before this mod does anything.
Here's an updated bit of data from the MWSE.log file
[State-Based Health 1.3] Game loaded. Calculating health.
[State-Based Health 1.3] Old max health: 87.800003
[State-Based Health 1.3] Old current health: 114.300003
[State-Based Health 1.3] Endurance: 33.000000
[State-Based Health 1.3] Strength: 90.000000
[State-Based Health 1.3] Level: 17
[State-Based Health 1.3] fLevelUpHealthEndMult GMST: 0.100000
[State-Based Health 1.3] New max health (per formula): 114.300001
[State-Based Health 1.3] Fortify Health magnitude: 0.000000
[State-Based Health 1.3] Fortify Health magnitude affecting max health: 0.000000
[State-Based Health 1.3] New max health (taking into account Fortify Health): 114.300001
[State-Based Health 1.3] New max health (after all modifiers from other mods): 114.300001
[State-Based Health 1.3] Minimum max health setting: 0.000000
[State-Based Health 1.3] New max health (taking into account minimum max health setting): 114.300001
[State-Based Health 1.3] Maintaining ratio. Ratio: 1.301822
[State-Based Health 1.3] New current health: 148.798290
For Mods I currently have running, the only one I can think of that would impact health is Improved Vanilla Leveling. Which does give a notice in a different part of of the log file, see below.
[Improved Vanilla Leveling]Warning: max health decreased from 114.300003 to 87.800000.
Otherwise I have the following for mods, hyperlinked, I put the ones that I thought might be contenders to be culprits here >>> Fair Magicka Regen v2B, UI Expansion, >>> probably not culprits >>> Weapon Sheathing 1.6-MWSE, I Lava Good Mesh Replacer, Correct UV Rocks, Remiros Groundcover, Better Clothes, Cheaper Enchanting Service Mod, Book Worm, Pete's Journal 2018 4K, Vodunius Nuccius Gives You His House, Descriptive Shrines, Expansion Delay, Ownership Indicator, MWSE Clock Block, Official Mods Compilation, Krokantor's Enhanced Water Shader, Apel Rain Replacer v1, Westly Pluginless Head and Hair Replacer, Robert's Bodies, Title and Logo Video Intro Reworked, and Better Dialogue Font. In addition to the Code Patch, MGE, MGE XE, and MWSE mods.
Pumped to check out the Observing Station next time one of my characters is near Pelagiad.