So I have this clothing mod that has an outfit that is broken into multiple parts. One part of it is assinged to the tailslot, and the thing you may all know about the tailslot is NPCs tend to ignore such items. I can get an NPC to wear the entire outfit, inlcuding the tailslot item, while I have them directly under my command (using another mod), but as soon as I release them to go about their business, they unequip the tailslot item.
I like to poke around and tweak my mods, and I'd noticed a bit of code in another mod that auto-equipped tailslot items, and at first I just copied and pasted that code directly to this mod. But then I decided that I wanted to improve it's fuctionality by having the code test to see if the NPC was wearing the rest of the outfit and then and only then forcing them to equip the tailslot item.
The problem is, while I can use GetEquippedObject to find out what the owner (the container of the object, which i've already tested and proven to be an NPC) of the tailslot is wearing, I don't know how to tell if this reference is a specific base ojbect. I need to be able to do the base object/Form ID rather than do a reference comparison because I need it to work with any copy of that outfit. I don't want to have it work with just one outfit, I want to be able to have an unknown number of copies of said outfit and have it work on all of them.
Here is the code I've come up with so far:
scn TailSlotSctref Ownerref Meref Pantsbegin GameMode set Me to GetBaseObject set Owner to GetContainer if ( Me.IsEquipped ) ;if this item is already equipped, no need to do anything. return elseif ( Owner.IsActor != 1 ) ;if this item is not in an NPC's inventory, no need to do anything. return endif set Pants to Owner.GetEquippedObject 3 ;get what pants the NPC is wearing, so we can test if they are the pants that go with this item. if () Owner.EquipItemSilent Me ;Silently equip the item, don't display a message or play the equip soundeffect. endifend
Also, I want to know how to use the GetEquippedItems function from OBSE. The documentation says merely that it returns an array. It gives no information about said array, like the order of items in it, where what is stored, or basically anything that one would need to know to be able to actually use said fuction. I don't know if it will help me out here, but I want to know how to use it (and arrays in general) regardless.