NPC's fail to equip items via Papyrus script

Post » Mon May 26, 2014 7:13 pm

G'day all,

I'm having a little scripting issue. I have an NPC, it intentionally has no default outfit set. My intention is to dynamically adjust it's inventory and it's starting equipment based on which other mods (if any) are installed. My reason for not making this a default outfit is that players, including myself, like to change up what the NPC's wear, and by having it as a default outfit, I would force players to use mods they might not want to use.

Unfortunately, everytime the NPC is loaded, the NPC is in their birthday suit. The good news is that the items are in the NPC's inventory.

I have attached a very cut down script that illustrates how I am trying to equip this NPC, and I would really appreciate some help in making a version that works.

Spoiler
Scriptname My_NPC_is_a_nudist extends Actor  { Paired down script to demonstrate the issue.}Armor Skyrim_Necklace_of_Dwindling_MagicEvent OnInit()	Detect_Clothes()	Get_Dressed()EndEventFunction Detect_Clothes(){The full version of this function detects various mods at load time and selects armour accordingly.It then adds the chosen armours to the NPC's inventory.}	Skyrim_Necklace_of_Dwindling_Magic = Game.GetFormFromFile(0x000FC063, "Skyrim.esm") as Armor	Self.AddItem(Skyrim_Necklace_of_Dwindling_Magic, 1, true)EndFunctionFunction Get_Dressed(){Put some clothes on the NPC}	Self.EquipItem(Skyrim_Necklace_of_Dwindling_Magic, false, true)EndFunction

Thanks in advance for any insights you can share.

User avatar
Ronald
 
Posts: 3319
Joined: Sun Aug 05, 2007 12:16 am

Return to V - Skyrim