Skyrim Mod:Mod File Format/CLAS

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search

CLAS records contain information about NPC and creature classes.

C Field Name Type/Size Info
+ EDID editorID zstring Corresponds with Class EditorID
+ FULL Name lstring Corresponds with Class Name (All resolved to ilstrings)
+ DESC Description lstring Description (always 0 in base files but can be present in mods)
- ICON Description zstring Menu image
+ DATA Data struct[36]
00:Unknown
uint32 Possibly flags, but not displayed in CK
04:Training Skill
uint8 Trainer classes store a skill here. Skill is provided using an actor value index - 6
05:Training Level
uint8 The skill level to which the NPC will provide training. 0 if class is not used for trainers
06-17:Skill Weights
uint8[18] Each byte provides the weight assigned to one skill. The skills are provided in actor value index order (skill at byte 06 is One-handed; at byte 17, Enchanting)

The weight is a value that normally ranges from 0 to 3, although values as high as 9 occur in some cases. The weights are used to distribute the fixed 8 skill points per level among the various skills. Skills with a weight of zero never increase. See Skills for further information.

18-1b:Bleedout Default
float
1c-1f:Voice Points
uint32
20:Health Weight
uint8 Each byte provides the weight assigned to that attribute. The weights are used to distribute the fixed 10 attribute points per level among the three attributes. Note that health always receives an additional 5 point/level increase, independent of its weight. See Attributes for details.
21:Magicka Weight
uint8
22:Stamina Weight
uint8
23:Flags?
uint8 0x1 seems to indicate guard

Weight Calculations[edit]

Skills[edit]

The approximate formula for an NPC's skill at a given level is:

Skill = 15 + [Racial bonus] + 8*(Level-1)/(Sum of class' skill weights)*[Skill weight]

This formula will generally only be accurate to within a couple points, however, because of the details of how the weighting system assigns values. Furthermore, once any skill reaches 100, this formula is no longer applicable.

The exact method used to assign values is to first assign all complete sets of points, namely:

Sets = floor(8*(Level-1)/(Sum of class' skill weights))*[Skill weight]

Then the left-over skill points (the number necessary so that (Sum of skill bonuses)=8*(Level-1)) are assigned one at a time by looping over all the skills in order. Skills are ordered first by their weight (higher skills ordered first) and second by their actor value index (lower indices are ordered first). Skills are only incremented if their maximum delta (i.e., their weight value) has not yet been reached.

To provide an example of how this works, take the TrainerRestorationMaster Priest class. The (Sum of class' skill weights) is 15. The skills are incremented in the following order:

Skill AVIF Weight Round 1 Round 2 Round 3 Round 4
Restoration 22 4 1 1 1 1
Speech 17 3 1 1 1
Enchanting 23 2 1 1
Illusion 21 2 1 1
Alchemy 16 2 1 1
Smithing 10 2 1 1

However, once any one skill reaches 100, the skill assignment system changes. Presumably the weighting system is attempting to adjust by re-assigning the skill points from the skill(s) that have reached 100. The total number of skill points is no longer a fixed 8 points per level. The equation used is actually simplified in some ways, because the skill points are a fixed function of Sets -- meaning that either all of the skills are increased when an NPC levels up, or else none of them are. However, the full details of the equations used at this point have not yet been worked out.

Attributes[edit]

The approximate formula for an NPC's magicka or stamina at a given level is:

Attribute = [Racial bonus] + [NPC offset] + 10*(Level-1)/(Sum of class' attribute weights)*[Attribute weight]

The only difference for health is that health always receives an additional 5 points per level, regardless of the class weights:

Health = [Racial bonus] + [NPC offset] + 5*(Level-1) + 10*(Level-1)/(Sum of class' attribute weights)*[Health weight]

As with the skills, this formula will generally only be accurate to within a couple points because of the weighting system details. However, there is no upper limit beyond which the equation ceases to be valid.

If the auto-calc flag for an NPC isn't set, all attributes are calculated just as:

Attribute = [Racial bonus] + [NPC offset]

The exact method used to assign values is the same as that used with skills. So left-over points are assigned one at a time by looping over the attributes. The attributes are ordered first in decreasing order of weight. If any attributes have the same weight, they are ordered in reverse actor value index order (stamina, magicka, then health).