GetNumBrokenEquippedItems

From GECK
Jump to: navigation, search


A function added by the ShowOff NVSE Plugin.

Description

Returns the number of broken items the calling actor has equipped.

By default, the "isBroken" check is performed by checking if the health for the item's condition is at or below 0%. This minimum health percentage can be modified by changing healthPercThreshold.

  • BUG: Does not currently account for weapons which have the "Increase Max Condition" Weapon Mod.

flagsMask is a bitmask containing filters for what kinds of items to get. If flags is omitted / set to 0, the function will check for every playable equipped item. Otherwise, it can be used to specify which equip slots to check for, and further filters.

Syntax

[help]
(numBrokenItems:int) ActorRefr.GetNumBrokenEquippedItems healthPercThreshold:int flagsMask:int 

Or:

(numBrokenItems:int) ActorRefr.GetNumBrokenEq healthPercThreshold:int flagsMask:int

Example

Player.GetNumBrokenEquippedItems

Returns the player's total amount of broken, playable equipped items. Equivalent to `player.GetNumBrokenEquippedItems 0`.

Playerref.GetNumBrokenEquippedItems 30 32

Returns if the player's weapon is at or below 30% health. Since 32 seems a bit like a random number, this is more clearly written as the following, using bit shifting:

Playerref.GetNumBrokenEquippedItems 30 (1 << 5)

This is clearer since the 5th bit is the Weapon equip slot flag.

Notes

  • The flags used to determine the equip slots to check are:
Equip Slot Flag Flag Value Bit
Head 1 0
Hair 2 1
Upper Body 4 2
Left Hand 8 3
Right Hand 16 4
Weapon 32 5
PipBoy 64 6
Backpack 128 7
Necklace 256 8
Headband 512 9
Hat 1024 10
Eyeglasses 2048 11
Nosering 4096 12
Earrings 8192 13
Mask 16384 14
Choker 32768 15
MouthObject 65536 16
BodyAddon1 131072 17
BodyAddon2 262144 18
BodyAddon3 524288 19
  • The misc. flags that come after that are:
Misc. Flags Value Bit
NoUnplayableItems 1048576 20
NoQuestItems 2097152 21
NoSlotlessItems 4194304 22
  • The GetNumBrokenEq alias was only added in version 1.25.

See Also