Difference between revisions of "GetWornItem - Actor"

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
imported>Qazaaq
(Added F4SE member)
 
imported>Qazaaq
(Added a for each worn item example.)
Line 20: Line 20:
== Examples ==
== Examples ==
<source lang="papyrus">
<source lang="papyrus">
Actor:WornItem wornValue = Game.GetPlayer().GetWornItem(34)
Actor:WornItem wornItem= Game.GetPlayer().GetWornItem(34)
Debug.Trace(wornValue.Item)
Debug.Trace("Item: " + wornItem.Item)
Debug.Trace(wornValue.Model)
Debug.Trace("Model: " + wornItem.Model)
Debug.Trace(wornValue.ModelName)
Debug.Trace("ModelName: " + wornItem.ModelName)
Debug.Trace(wornValue.MaterialSwap)
Debug.Trace("MaterialSwap: " + wornItem.MaterialSwap)
Debug.Trace(wornValue.Texture)
Debug.Trace("Texture: " + wornItem.Texture)
</source>
 
 
<source lang="papyrus">
{For each biped slot}
Actor Player = Game.GetPlayer()
int index = 30
int endSlot = 61 const
 
while (index < endSlot)
    Actor:WornItem wornItem = Player.GetWornItem(index)
    Debug.Trace("Slot: " + index + ", " + wornItem)
    index += 1
EndWhile
</source>
</source>



Revision as of 17:02, 19 April 2017

F4SE Member of: Actor Script

Obtains WornItem information about an actors Biped Slot.

Syntax

WornItem Function GetWornItem(int slotIndex, bool firstPerson = false) Native

Parameters

  • slotIndex: The Biped Slot to check.
  • firstPerson: Specifies whether first or third person information for the Biped Slot should be returned.

Return Value

The WornItem for the given Biped Slot.

Examples

Actor:WornItem wornItem= Game.GetPlayer().GetWornItem(34)
Debug.Trace("Item: " + wornItem.Item)
Debug.Trace("Model: " + wornItem.Model)
Debug.Trace("ModelName: " + wornItem.ModelName)
Debug.Trace("MaterialSwap: " + wornItem.MaterialSwap)
Debug.Trace("Texture: " + wornItem.Texture)


{For each biped slot}
Actor Player = Game.GetPlayer()
int index = 30
int endSlot = 61 const

while (index < endSlot)
    Actor:WornItem wornItem = Player.GetWornItem(index)
    Debug.Trace("Slot: " + index + ", " + wornItem)
    index += 1
EndWhile

Notes

  • Item can be none and still contain other information at a particular slot.

See Also