Research:Stats and Levelling

HP
Initial HP

At every level-up

Magicka multiplier
The non-visible stat used to stack magicka modifiers. Affected by NPC type and the Fortify Magicka Multiplier effect.

On actor creation

When a Fortify Magicka Multiplier effect is applied

Magicka points
Every time intelligence or magicka multiplier is modified

Fatigue
Recovery every frame

Every time a base stat is modified

Encumbrance
Every time strength is modified

Comments
Resting allows all actors in the game to recover, not just the player. There are multiple problems with interrupted rest.

If the value of interruptAtHoursRemaining is 0, which occurs when hoursRested <= 3 with default GMSTs, then the game fails to execute the interruption encounter as the rest ends, in effect making short rests completely safe.

The code only spawns the first creature it finds in the leveled list, as well as calculating the number of creatures incorrectly. interruptingCreatures should be 1 + roll iNumberCreatures, and that number of creatures should be spawned.

Finally, the design of the interruption test has hoursRested on both sides of the test. This makes the probability of being interrupted independent of the number of hours slept, except for quantization effects.

Skill progress
Skills have a progression metric that is increased by player actions. Each action has an associated skill gain factor present in the skill record from the ESM. The progression is usually, but not always increased by that gain factor each time an action is performed. Players in werewolf form do not gain progress at all.

On successful barter

All other actions

Testing for skill increase

Comments
The progress is preserved, but not the progressRequirement, when the skill is modified by a script function. The skill tooltip always shows the skill progression as a bar labelled with x/100.

Player level progress
On new game

On skill level-up

Levelling up
On level up, the player can select up to 3 attributes to improve. Less than 3 may be offered if there are less than 3 attributes that can be improved (attribute < 100). Attributes already >= 100 cannot be selected.

Comments
The correct rounding mode is critical for accurate skills, which affect important gameplay like spell auto-selection and training.

Note that there are level 0 NPCs in the game, so the (level - 1) term will become -1; use a signed representation of level in calculations.

Comments
Auto-calculated spells are selected at initial loading time. baseActor refers to the actor with attributes as loaded or auto-calculated, without any kind of spell effects (i.e. abilities) applied.

Due to poor design, iteration order is critical to the algorithm's behaviour. The list of all spells in the game must be in the same order as loaded from the files. NPC spells are held in a vector, which the findMinCostSpell function scans linearly; during the scan, if there is another spell that matches the lowest cost, it keeps the first one found.

Note that when a spell school is past its limit, the weakest spell is removed, and a new weakest spell is selected. This may not be a spell from the same school as the limit. While this is undesired behaviour, fixing it is likely to cause a major difference from vanilla spell selection, which will not have been play tested. It's not recommend to fix this part at the moment.

Comments
This is first executed once the stat review menu appear, and then executed every time the player modifies their character. The spell list must therefore be cleared before selecting new spells.

See NPC auto-calculated spells for additional comments.