Open main menu

UESPWiki β

Morrowind Mod:XGetClass

< Mod / Morrowind: Morrowind Mod: MWSE

A function from the MWSE update by Merzasphor.

Returns info about the class of the target NPC/PC, 0 if the target is not an NPC or the PC.

SyntaxEdit

classId (string ref) name (string ref) playable (long) specialization (long) attributes (long) majorSkills (long) minorSkills (long): ref->xGetClass attributesMask (long) majorMask (long) minorMask (long)

classId: the unique string identifier of the class. "NEWCLASSID_CHARGEN" is the id of a custom class created by the PC during character generation.
name: the name of the class.
playable: 1 if the class can be chosen by the PC, 0 otherwise. This is 0 if the class is a custom class created by the PC during character generation.
specialization: 0 = Combat, 1 = Magic, 2 = Stealth
attributes: a bitmap of the two primary attributes. The result is obtained by adding the values found in the attributes table.
majorSkills: a bitmap of the 5 major skills. The result is obtained by adding the values found in the skills table.
minorSkills: a bitmap of the 5 minor skills. The result is obtained by adding the values found in the skills table.
attributeMask: a bit mask to apply to the attributes value.
majorMask: a bit mask to apply to the majorSkills value.
minorMask: a bit mask to apply to the minorSkills value.

If a mask is 0, the corresponding value is unaltered.

Attribute Value
Strength 1
Intelligence 2
Willpower 4
Agility 8
Speed 16
Endurance 32
Personality 64
Luck 128


Skill Value
Block 1
Armorer 2
Medium Armor 4
Heavy Armor 8
Blunt Weapon 16
Long Blade 32
Axe 64
Spear 128
Athletics 256
Enchant 512
Destruction 1024
Alteration 2048
Illusion 4096
Conjuration 8192
Mysticism 16384
Restoration 32768
Alchemy 65536
Unarmored 131072
Security 262144
Sneak 524288
Acrobatics 1048576
Light Armor 2097152
Short Blade 4194304
Marksman 8388608
Mercantile 16777216
Speechcraft 33554432
Hand-to-Hand 67108864

ExampleEdit

; This script displays messages if the player's target has Hand-To-Hand and 
; Unarmored as major skills or Hand-To-Hand or Unarmored as minor skills.

long pcTarget
long classId
long name
long play
long spec
long attrib
long major
long minor
long mask
short continue

; Hand-to-hand + Unarmored
set mask to ( 67108864 + 131072 )

setx pcTarget to xGetPCTarget
setx classId name play spec attrib major minor to pcTarget->xGetClass 0 mask mask

; Hand-to-Hand AND Unarmored
; If the result from xGetClass is equal to the mask, then all components of the
; mask are present.
if ( major == mask )
        set continue to 1
else
        set continue to 0
endif

ifx (continue)
        xMessageFix "%s has hand-to-hand and unarmored as major skills." name
        MessageBox "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"
endif

; Hand-to-Hand OR Unarmored
; If the result from xGetClass is not 0, then at least one of the components of
; the mask is present.
ifx (minor)
        xMessageFix "%s has hand-to-hand or unarmored as a minor skill." name
        MessageBox "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"
endif