Jump to content

How to determine current Armor pieces on NPC


Anton0028

Recommended Posts

Help me please to determine current armor pieces on NPC (and current clothes too).



I found for weapon: "GetEquippedItemType()" and "GetEquippedWeapon()".

But found nothing similar for armor or cloth.



My goal is to get "ObjectReference" for every piece of armor and clothes,then take them away from NPC (to a container) and after that give new ones for him.

Link to comment
Share on other sites

I looked into it already, i haven't found a good solution for that. Its probably possible with F4SE.

 

One thing, that could maybe work, but i havent used it, as it was too cost intensive:

 

Create Formlists for equipment Headwear, Armor, Gloves etc...

You can also use arraylists, which are faster.

 

Then you use:

int Function GetItemCount(Form akItem)

Returns how many of the specified item is in this object's inventory.

 

Interate the array or formlist with this function, if it returns >0, the actor is wearing an item.

 

I don't know if that works, i haven't tested it, but it should work. (This also counts item in the inventory that the actor is not wearing.)

Edited by Zzyxzz
Link to comment
Share on other sites

Should be possible with F4SE.

 

Extension to the Actors script from F4SE:

; F4SE additions built 2016-08-06 00:10:48.819000 UTC
struct WornItem
	Form item ; Can be ARMO or WEAP
	Form model ; Can be ARMA or WEAP depending on item
	string modelName ; Model override name
	Form materialSwap ; Material swap form
	TextureSet texture ; TextureSet override 
EndStruct

; Slot index is valid from 0-43
; Item can be none and still contain other information at a particular slot
WornItem Function GetWornItem(int slotIndex, bool firstPerson = false) native

; Returns all the mods for the item at the particular index
; returns None if there is no item at this index
ObjectMod[] Function GetWornItemMods(int slotIndex) native

So I would imagine you can loop through the slots you want to check and call `GetWornItem(slotIndex).item` for each to find the Armor Form in that slot.

Link to comment
Share on other sites

  • 1 year later...

I know this is a necro, but I think I found a workaround for this when I ran into this issue:

 

- Add a custom keyword to any armor you want to check, check it against the QUEST ALIAS (not on the Subject, apparently but I'm not sure why of this is really the case) for the current NPC/Companion.

- Then use the condition (WornHasKeyword == 1) for the custom keyword you added to the armor.

- Or check for existing keywords that are unique to the armor/clothing.

 

 

 

In my case, my NPC Companion now asks: "Are you my mommy?" when she's wearing a gas mask... :smile:

 

(Just for laughs)

Edited by Reginald001
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...