What is the formula that the game uses to determine a character's maximum health based on other stats?

I'm trying to retrieve a dead NPC's maximum health and transfer it to another NPC. The problem is that since the first NPC is dead, its health is 0, which kills the other NPC. And using GetHealthGetRatio to determine the maximum health doesn't work either; you can't divide by 0. So I think I need to just determine it based on whatever formula the game uses.
QUOTE(Fliggerty @ Jan 12 2007, 05:29 PM) *

What is the formula that the game uses to determine a character's maximum health based on other stats?

I'm trying to retrieve a dead NPC's maximum health and transfer it to another NPC. The problem is that since the first NPC is dead, its health is 0, which kills the other NPC. And using GetHealthGetRatio to determine the maximum health doesn't work either; you can't divide by 0. So I think I need to just determine it based on whatever formula the game uses.

Did you try to ModCurrentHealth 10000 and then GetHealth? It should work in theory, and it won't resurrect unless you use Resurrect. And ModCurrentHealth won't raise it above the maximum health, so it should work.
Yup, tried that. Still returns 0. Thanks though.
I don't know, thats a pretty tall order there. ( *swish* it went over my head )

Race and gender affects attribute stats, and changing level adjusts those when you select auto-calculate, but I also notice that class affects max-health and other attributes. perhaps has something to do with skills specializing in stealth, magick, or combat?

It's quite different then the way player stats are figured because of multipliers and players choice, endurance affects health gain per level, etc.

I guess someone ( anyone but me tongue.gif ) could go through each race, gender, class, and level, click auto-calculate and input it all into a database/spreadsheet thingy where the formula might be found. shrug.gif

But that doesn't take into account manually edited NPC's, as you already know,

what about placeatme a new instance of the dead npc, getting the maxhealth, and disable/delete it?

just thinking aloud on the keyboard...
QUOTE(Fliggerty @ Jan 12 2007, 10:44 PM) *

Yup, tried that. Still returns 0. Thanks though.

I don't know why it didn't work for you, but I just tried this script and it returned the correct health.
CODE

Begin HPTest

short HP

if ( GetHealth <= 0 )
    ModCurrentHealth 10000
    Set HP to GetHealth
    MessageBox "HP = %g" HP
endif

End
I dunno. That script works for me too. I suspect it might be that I am using an MWSE variable wrapper.
QUOTE(Fliggerty @ Jan 12 2007, 11:15 PM) *

I dunno. That script works for me too. I suspect it might be that I am using an MWSE variable wrapper.

I never managed to get the exact health, but this gets it close. Well. It should "technically" be exact, but hey.
CODE
( ( Strength + Endurance ) / 2 ) + Endurance * ( Level - 1 ) / 10
Digging into my archives...


Derived attribute calculations for PCs and NPCs:

(From a post (by me) in the "[REL]: Laura Craft Romance and Adventure ver 2.1, with (almost) unlimited teleport options" thread in Bethesda's Morrowind Mods forum, Sep 17 2004, 10:45.)


The following is based on how they're calculated for player characters; checking in the Construction Set, NPC derived attributes appear to use basically the same system (if auto-calculate is enabled).

----------------------------------------------------------------------------

Maximum Fatigue: equals the total of current Strength, current Endurance, current Willpower, and current Agility.

Maximum Magicka: current Intelligence times the character's magicka multiplier (varies with race and birthsign). For NPCs, the multiplier apparently is fixed at two; race doesn't seem to affect it.

NOTE: this is based on the Maximum Magicka shown in the editor. Racial abilities that fortify Maximum Magicka are listed in the 'spells' section of the NPC's properties page, so that may be figured into the maximum value used during game play; haven't tested this.

Maximum Encumbrance: five times the character's current Strength.

----------------------------------------------------------------------------

Maximum Health: this is calculated slightly differently for player characters and NPCs.

For player characters:

When you create your character, their starting maximum Health (at first level) is one half the total of their Strength and Endurance.

After that, each time your character goes up a level their maximum Health is increased by 10% of their Endurance. This is based on the character's base natural Endurance; magical modifications to Endurance are ignored.

Strength is only used to calculate the player character's starting value for maximum Health; it has no further affect on Health once the character has been created. Also, Endurance affects the amount added to the character's maximum Health each level; there's no recalculation of the amount added in previous levels.

For NPCs:

At first level, maximum Health is calculated the same as for a player character: one half the total of Strength and Endurance.

For higher level NPCs, maximum Health appears to be calculated as follows (in the Construction Set; not tested in the game):

Maximum Health = ((Current Strength + Current Endurance)/2) + ((Current Endurance/10) * (Current Level-1))

So for an NPC, their maximum Health is calculated from scratch for each level, rather than simply incrementing based on values calculated for their lower levels.

----------------------------------------------------------------------------

As I said, the NPC information is based strictly on looking at how their stats are auto-calculated in the Construction Set; I haven't tested in the game to see how their derived attributes respond to magical or scripted changes in their level or base attributes.
Submit a Thread