SAC020 Posted September 23, 2017 Share Posted September 23, 2017 (edited) I managed to get a script to add an item from a leveled list to an NPC. However, I am unable to make the NPC equip the said item - the item gets added to their inventory, however it is not equipped. Not sure how to solve this LeveledItem Property NooseOutfit Auto ; it exists, it is populated <..> target.additem(NooseOutfit) ; this works fine, an item is added target.equipitem(NooseOutfit) ; this does nothing I suppose additem should return a reference that I can use for equipitem. Sadly, it does not return any reference, by design. Thanks! Edited September 23, 2017 by ss_kk Link to comment Share on other sites More sharing options...
kitcat81 Posted September 24, 2017 Share Posted September 24, 2017 Usually there is no need to use "additem" when you want to equip it. EquipItem does both - adding and equipping. But it won`t work with leveled items. You can`t equip leveled items. And you can`t get or manipulate any reference while it`s inside a container/inventory.I think you can create an outfit record with your leveled lists added to it. Then use SetOutfit function for the actor. Another way is to create a formlist instead of leveled list and use utility.RandomInt function to get a random item from the formlist. Example:ActorRef.EquipItem(NooseFormlist.GetAt(Utility.RandomInt(0, NooseFormlist.GetSize() - 1)), true, true) Link to comment Share on other sites More sharing options...
SAC020 Posted September 25, 2017 Author Share Posted September 25, 2017 Another way is to create a formlist instead of leveled list and use utility.RandomInt function to get a random item from the formlist. Example:ActorRef.EquipItem(NooseFormlist.GetAt(Utility.RandomInt(0, NooseFormlist.GetSize() - 1)), true, true) Thank you very much, this is a real eye opener for me. I didn't know form lists existed, so I was (mis)using leveled lists instead. I don't need a leveled list, and I certainly don't want to alter default outfits, because I don't want NPCs to spawn with my outfits (on the contrary, I want the opposite, to never spawn with mine, just to switch them "on event"). Can't wait to get home to test this, thank you!! Link to comment Share on other sites More sharing options...
SAC020 Posted September 25, 2017 Author Share Posted September 25, 2017 (edited) Another way is to create a formlist instead of leveled list and use utility.RandomInt function to get a random item from the formlist. Example:ActorRef.EquipItem(NooseFormlist.GetAt(Utility.RandomInt(0, NooseFormlist.GetSize() - 1)), true, true) Yuhooo, works flawlessly!! Thank you very much!! Edited September 25, 2017 by ss_kk Link to comment Share on other sites More sharing options...
kitcat81 Posted September 25, 2017 Share Posted September 25, 2017 You are welcome! :) Link to comment Share on other sites More sharing options...
Recommended Posts