MTichenor Posted September 18, 2012 Share Posted September 18, 2012 (edited) BACKGROUND: Here's what I want to do: Use SKSE to detect the enchantment on any weapon or armor enchanted by the player. I figured the best way to do this would be to 1) Create a script attached to the player using Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)2) Cast the OjbectReference akItemReference into either a Weapon or Armor script, e.g. Weapon akItemWeapon = akItemReference as Weapon3) Use Enchantment akItemEnchantment = akItemWeapon.GetEnchantment() to retrieve the enchantment. There's only one tiny problem: akItemReference is ALWAYS "None" and the akBaseItem doesn't have any enchantments listed if it's a player-created enchanted item (it's just the base item that the enchantment was applied to). So, I tried an alternative: 1) Get the Player Reference, and retrieve his inventory via the SKSE function GetNumItems(). e.g int ItemCount = Game.GetPlayer().GetNumItems()2) Use the SKSE function GetNthForm(int index) to retrieve the forms for every item in his inventory. This didn't work either: GetNumItems only detects the number of items by base FormID, and forms retrieved via GetNthForm are the base FormIDs for the objects (not the enchanted items). Thus, I turn to you with these... QUESTIONS 1) Why are akItemReferences passed into OnItemAdded always "None", even when the item is a player-created item?2) How can I obtain or create ObjectReferences that point to the player's inventory items dynamically within a script?3) How can I obtain the Enchantment (the SKSE Script) on a player-enchanted items? Edited September 18, 2012 by IndigoNeko Link to comment Share on other sites More sharing options...
Recommended Posts