Difference between revisions of "Slot Masks - Armor"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Fg109
(Created page for list of slot masks)
 
imported>Bug64
m (Added link to a list of slot numbers)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
List of the properties for [[Armor Script]] (added by SKSE):
List of the properties for [[Armor Script]] (added by SKSE):
<source lang="papyrus">
<source lang="papyrus">
int Property kSlotMask30 = 0x00000001 AutoReadOnly
int Property kSlotMask30 = 0x00000001 AutoReadOnly ; HEAD
int Property kSlotMask31 = 0x00000002 AutoReadOnly
int Property kSlotMask31 = 0x00000002 AutoReadOnly ; Hair
int Property kSlotMask32 = 0x00000004 AutoReadOnly
int Property kSlotMask32 = 0x00000004 AutoReadOnly ; BODY
int Property kSlotMask33 = 0x00000008 AutoReadOnly
int Property kSlotMask33 = 0x00000008 AutoReadOnly ; Hands
int Property kSlotMask34 = 0x00000010 AutoReadOnly
int Property kSlotMask34 = 0x00000010 AutoReadOnly ; Forearms
int Property kSlotMask35 = 0x00000020 AutoReadOnly
int Property kSlotMask35 = 0x00000020 AutoReadOnly ; Amulet
int Property kSlotMask36 = 0x00000040 AutoReadOnly
int Property kSlotMask36 = 0x00000040 AutoReadOnly ; Ring
int Property kSlotMask37 = 0x00000080 AutoReadOnly
int Property kSlotMask37 = 0x00000080 AutoReadOnly ; Feet
int Property kSlotMask38 = 0x00000100 AutoReadOnly
int Property kSlotMask38 = 0x00000100 AutoReadOnly ; Calves
int Property kSlotMask39 = 0x00000200 AutoReadOnly
int Property kSlotMask39 = 0x00000200 AutoReadOnly ; SHIELD
int Property kSlotMask40 = 0x00000400 AutoReadOnly
int Property kSlotMask40 = 0x00000400 AutoReadOnly ; TAIL
int Property kSlotMask41 = 0x00000800 AutoReadOnly
int Property kSlotMask41 = 0x00000800 AutoReadOnly ; LongHair
int Property kSlotMask42 = 0x00001000 AutoReadOnly
int Property kSlotMask42 = 0x00001000 AutoReadOnly ; Circlet
int Property kSlotMask43 = 0x00002000 AutoReadOnly
int Property kSlotMask43 = 0x00002000 AutoReadOnly ; Ears
int Property kSlotMask44 = 0x00004000 AutoReadOnly
int Property kSlotMask44 = 0x00004000 AutoReadOnly ; Unnamed
int Property kSlotMask45 = 0x00008000 AutoReadOnly
int Property kSlotMask45 = 0x00008000 AutoReadOnly ; Unnamed
int Property kSlotMask46 = 0x00010000 AutoReadOnly
int Property kSlotMask46 = 0x00010000 AutoReadOnly ; Unnamed
int Property kSlotMask47 = 0x00020000 AutoReadOnly
int Property kSlotMask47 = 0x00020000 AutoReadOnly ; Unnamed
int Property kSlotMask48 = 0x00040000 AutoReadOnly
int Property kSlotMask48 = 0x00040000 AutoReadOnly ; Unnamed
int Property kSlotMask49 = 0x00080000 AutoReadOnly
int Property kSlotMask49 = 0x00080000 AutoReadOnly ; Unnamed
int Property kSlotMask50 = 0x00100000 AutoReadOnly
int Property kSlotMask50 = 0x00100000 AutoReadOnly ; DecapitateHead
int Property kSlotMask51 = 0x00200000 AutoReadOnly
int Property kSlotMask51 = 0x00200000 AutoReadOnly ; Decapitate
int Property kSlotMask52 = 0x00400000 AutoReadOnly
int Property kSlotMask52 = 0x00400000 AutoReadOnly ; Unnamed
int Property kSlotMask53 = 0x00800000 AutoReadOnly
int Property kSlotMask53 = 0x00800000 AutoReadOnly ; Unnamed
int Property kSlotMask54 = 0x01000000 AutoReadOnly
int Property kSlotMask54 = 0x01000000 AutoReadOnly ; Unnamed
int Property kSlotMask55 = 0x02000000 AutoReadOnly
int Property kSlotMask55 = 0x02000000 AutoReadOnly ; Unnamed
int Property kSlotMask56 = 0x04000000 AutoReadOnly
int Property kSlotMask56 = 0x04000000 AutoReadOnly ; Unnamed
int Property kSlotMask57 = 0x08000000 AutoReadOnly
int Property kSlotMask57 = 0x08000000 AutoReadOnly ; Unnamed
int Property kSlotMask58 = 0x10000000 AutoReadOnly
int Property kSlotMask58 = 0x10000000 AutoReadOnly ; Unnamed
int Property kSlotMask59 = 0x20000000 AutoReadOnly
int Property kSlotMask59 = 0x20000000 AutoReadOnly ; Unnamed
int Property kSlotMask60 = 0x40000000 AutoReadOnly
int Property kSlotMask60 = 0x40000000 AutoReadOnly ; Unnamed
int Property kSlotMask61 = 0x80000000 AutoReadOnly
int Property kSlotMask61 = 0x80000000 AutoReadOnly ; FX01
</source>
</source>
<br>
<br>
Line 40: Line 40:


For example, if an item takes up the slots for body (kSlotMask32), hands (kSlotMask33), and forearms (kSlotMask34), then you add its values together (0x00000004 + 0x00000008 + 0x00000010 = 4 + 8 + 16) to get the value of its slot mask (28).
For example, if an item takes up the slots for body (kSlotMask32), hands (kSlotMask33), and forearms (kSlotMask34), then you add its values together (0x00000004 + 0x00000008 + 0x00000010 = 4 + 8 + 16) to get the value of its slot mask (28).
==Example==
Iterate through all of an actor's currently equipped armor and identify the name of any enchanted items (the WornObject functions used in this example require SKSE 1.7.0 or higher):
<source lang=papyrus>
String[] Function GetWornEnchantedFormNames(Actor target)
    String[] wornEnchantedForms = new String[30]
    int index
    int slotsChecked
    slotsChecked += 0x00100000
    slotsChecked += 0x00200000 ;ignore reserved slots
    slotsChecked += 0x80000000
    int thisSlot = 0x01
    while (thisSlot < 0x80000000)
        if (Math.LogicalAnd(slotsChecked, thisSlot) != thisSlot) ;only check slots we haven't found anything equipped on already
            Armor thisArmor = target.GetWornForm(thisSlot) as Armor
            if (thisArmor)
                if (thisArmor.GetEnchantment()) ;check for basic enchantments
                    wornEnchantedForms[index] = thisArmor.getName()
                    index += 1
                elseif (WornObject.GetEnchantment(target, 0, thisSlot)) ;check for player-added enchantments
                    wornEnchantedForms[index] = WornObject.GetDisplayName(target, 0, thisSlot)
                    if (!wornEnchantedForms[index]) ;if it wasn't given a custom name, take the item's original name:
                        wornEnchantedForms[index] = thisArmor.getName()
                    endif
                    index += 1
                endif
                slotsChecked += thisArmor.GetSlotMask() ;add all slots this item covers to our slotsChecked variable
            else ;no armor was found on this slot
                slotsChecked += thisSlot
            endif
        endif
        thisSlot *= 2 ;double the number to move on to the next slot
    endWhile
    return wornEnchantedForms
EndFunction
</source>
==See Also==
[[Biped_Object|Suggested Slot Mask Usage]]
[http://wiki.tesnexus.com/index.php/Skyrim_bodyparts_number Skyrim Bodyparts]

Latest revision as of 16:41, 26 June 2015

List of the properties for Armor Script (added by SKSE):

int Property kSlotMask30 = 0x00000001 AutoReadOnly ; HEAD
int Property kSlotMask31 = 0x00000002 AutoReadOnly ; Hair
int Property kSlotMask32 = 0x00000004 AutoReadOnly ; BODY
int Property kSlotMask33 = 0x00000008 AutoReadOnly ; Hands
int Property kSlotMask34 = 0x00000010 AutoReadOnly ; Forearms
int Property kSlotMask35 = 0x00000020 AutoReadOnly ; Amulet
int Property kSlotMask36 = 0x00000040 AutoReadOnly ; Ring
int Property kSlotMask37 = 0x00000080 AutoReadOnly ; Feet
int Property kSlotMask38 = 0x00000100 AutoReadOnly ; Calves
int Property kSlotMask39 = 0x00000200 AutoReadOnly ; SHIELD
int Property kSlotMask40 = 0x00000400 AutoReadOnly ; TAIL
int Property kSlotMask41 = 0x00000800 AutoReadOnly ; LongHair
int Property kSlotMask42 = 0x00001000 AutoReadOnly ; Circlet
int Property kSlotMask43 = 0x00002000 AutoReadOnly ; Ears
int Property kSlotMask44 = 0x00004000 AutoReadOnly ; Unnamed
int Property kSlotMask45 = 0x00008000 AutoReadOnly ; Unnamed
int Property kSlotMask46 = 0x00010000 AutoReadOnly ; Unnamed
int Property kSlotMask47 = 0x00020000 AutoReadOnly ; Unnamed
int Property kSlotMask48 = 0x00040000 AutoReadOnly ; Unnamed
int Property kSlotMask49 = 0x00080000 AutoReadOnly ; Unnamed
int Property kSlotMask50 = 0x00100000 AutoReadOnly ; DecapitateHead
int Property kSlotMask51 = 0x00200000 AutoReadOnly ; Decapitate
int Property kSlotMask52 = 0x00400000 AutoReadOnly ; Unnamed
int Property kSlotMask53 = 0x00800000 AutoReadOnly ; Unnamed
int Property kSlotMask54 = 0x01000000 AutoReadOnly ; Unnamed
int Property kSlotMask55 = 0x02000000 AutoReadOnly ; Unnamed
int Property kSlotMask56 = 0x04000000 AutoReadOnly ; Unnamed
int Property kSlotMask57 = 0x08000000 AutoReadOnly ; Unnamed
int Property kSlotMask58 = 0x10000000 AutoReadOnly ; Unnamed
int Property kSlotMask59 = 0x20000000 AutoReadOnly ; Unnamed
int Property kSlotMask60 = 0x40000000 AutoReadOnly ; Unnamed
int Property kSlotMask61 = 0x80000000 AutoReadOnly ; FX01


The 'kSlotMaskXX' refers to the biped objects (eg kSlotMask30 is Head). You can find the names of the biped objects in the 'Body Data' tab of the Race window. You can also find the names when you assign a piece of equipment to an equip slot.

The numbers shown here are in hexadecimal (eg 0x00000100 equals 256). If an item has multiple equip slots, then you add the values together to figure out its slot mask.

For example, if an item takes up the slots for body (kSlotMask32), hands (kSlotMask33), and forearms (kSlotMask34), then you add its values together (0x00000004 + 0x00000008 + 0x00000010 = 4 + 8 + 16) to get the value of its slot mask (28).


Example[edit | edit source]

Iterate through all of an actor's currently equipped armor and identify the name of any enchanted items (the WornObject functions used in this example require SKSE 1.7.0 or higher):

String[] Function GetWornEnchantedFormNames(Actor target)
    String[] wornEnchantedForms = new String[30]
    int index
    int slotsChecked
    slotsChecked += 0x00100000
    slotsChecked += 0x00200000 ;ignore reserved slots
    slotsChecked += 0x80000000

    int thisSlot = 0x01
    while (thisSlot < 0x80000000)
        if (Math.LogicalAnd(slotsChecked, thisSlot) != thisSlot) ;only check slots we haven't found anything equipped on already
            Armor thisArmor = target.GetWornForm(thisSlot) as Armor
            if (thisArmor)
                if (thisArmor.GetEnchantment()) ;check for basic enchantments
                    wornEnchantedForms[index] = thisArmor.getName()
                    index += 1
                elseif (WornObject.GetEnchantment(target, 0, thisSlot)) ;check for player-added enchantments
                    wornEnchantedForms[index] = WornObject.GetDisplayName(target, 0, thisSlot)
                    if (!wornEnchantedForms[index]) ;if it wasn't given a custom name, take the item's original name:
                        wornEnchantedForms[index] = thisArmor.getName()
                    endif
                    index += 1
                endif
                slotsChecked += thisArmor.GetSlotMask() ;add all slots this item covers to our slotsChecked variable
            else ;no armor was found on this slot
                slotsChecked += thisSlot
            endif
        endif
        thisSlot *= 2 ;double the number to move on to the next slot
    endWhile
    return wornEnchantedForms
EndFunction


See Also[edit | edit source]

Suggested Slot Mask Usage

Skyrim Bodyparts