Difference between revisions of "GetEquipmentBipedMask"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>Odessa
(created)
 
imported>Odessa
(Expanded usage example)
 
Line 12: Line 12:
  }}
  }}
==Bit Fields==
==Bit Fields==
*4 = HasBackpack
*2 (4= HasBackpack
*8 = Medium Armor
*3 (8= Medium Armor
*32 = Power Armor
*5 (32= Power Armor
*64 = Non playable
*6 (64= Non playable
*128 = HeavyArmor
*7 (128) = HeavyArmor


Other bits are either unused or unknown.
Other bits are either unused or unknown.
Line 23: Line 23:
int BitMask
int BitMask
let BitMask := GetEquipmentBipedMask ArmorTeslaPower ; * 160 (Heavy + Power)
let BitMask := GetEquipmentBipedMask ArmorTeslaPower ; * 160 (Heavy + Power)
</pre>
To check if some item has the "HeavyArmor" flag, you could use:
<pre>
if BitMask == (SetBit BitMask, 7)
  ; It is "Heavy armor".
  ; (Bitmask compares equal to self with bit7 set, so bit7 is already set)
endif
</pre>
You can alternatively use [[NVSE Expressions|'C' style bit operators]] in NVSE aware contexts, such as [[let]] or [[eval]]:
<pre>
if eval BitMask & (1 << 7)
    ; Bit7 is set, so the item is flagged as "Heavy armor"
endif
</pre>
</pre>
==See Also==
==See Also==

Latest revision as of 05:04, 15 February 2015

< [[::Category:Functions|Category:Functions]]

A function added by the New Vegas Script Extender.

Description

Returns the equipment flags used by the specified armor as a bitmask int. Bitmasks may be built by using ClearBit/SetBit. Added by NVSE 4.5.

Syntax

[help]
(BitMask:int) GetEquipmentBipedMask ToGetMaskOf:armor

Bit Fields

  • 2 (4) = HasBackpack
  • 3 (8) = Medium Armor
  • 5 (32) = Power Armor
  • 6 (64) = Non playable
  • 7 (128) = HeavyArmor

Other bits are either unused or unknown.

Example

int BitMask
let BitMask := GetEquipmentBipedMask ArmorTeslaPower ; * 160 (Heavy + Power)

To check if some item has the "HeavyArmor" flag, you could use:

if BitMask == (SetBit BitMask, 7)
   ; It is "Heavy armor". 
   ; (Bitmask compares equal to self with bit7 set, so bit7 is already set)
endif

You can alternatively use 'C' style bit operators in NVSE aware contexts, such as let or eval:

if eval BitMask & (1 << 7)
    ; Bit7 is set, so the item is flagged as "Heavy armor"
endif

See Also