nullwyrm Posted September 9 Share Posted September 9 I'm currently working on a mod that awards extra XP when enchanting items. As a part of this, I need some way to identify what item a player has enchanted, but so far I've had no luck: powerofthree's Papyrus Extender is able to detect when an item is enchanted with its onItemCrafted event, but it contains the *enchantment*, rather than the item. I only need the base item, not an ObjectReference. Any help would be appreciated. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 9 Share Posted September 9 From Papyrus Extender Event OnItemCrafted(ObjectReference akBench, Location akLocation, Form akCreatedItem) EndEvent What is the returned result found within akCreatedItem? Is it the object with the enchantment attached? If it is, try running GetBaseObject to see if you can obtain the non-enchanted base. Link to comment Share on other sites More sharing options...
nullwyrm Posted September 9 Author Share Posted September 9 7 hours ago, IsharaMeradin said: From Papyrus Extender Event OnItemCrafted(ObjectReference akBench, Location akLocation, Form akCreatedItem) EndEvent What is the returned result found within akCreatedItem? Is it the object with the enchantment attached? If it is, try running GetBaseObject to see if you can obtain the non-enchanted base. The Enchantment applied. It's a Form anyways, not an ObjectReference, so GetBaseObject wouldn't work. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 9 Share Posted September 9 Did you try casting to ObjectReference and then use GetBaseObject? i.e. (akCreatedItem as ObjectReference).GetBaseObject() It may or may not work as the item is in the player's inventory but one would never know without trying. And if that doesn't work, the following may be something to try out: https://forums.nexusmods.com/topic/2789614-creating-an-object-reference-for-an-item-in-a-container/ Link to comment Share on other sites More sharing options...
nullwyrm Posted September 10 Author Share Posted September 10 Neither worked - the cast to ObjectReference just produced a null object, and trying to drop an enchantment doesn't appear to do anything either. Link to comment Share on other sites More sharing options...
dylbill Posted September 11 Share Posted September 11 You can use my mod Dylbills Papyrus Functions which includes DbSkseEvents. https://www.nexusmods.com/skyrimspecialedition/mods/65410 Example, assuming your script is attached to a form. Event OnInit() DbSkseEvents.RegisterFormForGlobalEvent("OnItemCraftedGlobal", self) EndEvent ;must re register on load game Event OnLoadGameGlobal() DbSkseEvents.RegisterFormForGlobalEvent("OnItemCraftedGlobal", self) EndEvent Event OnItemCraftedGlobal(Form itemCrafted, ObjectReference benchRef, int count, int workBenchType, string benchSkill) if benchSkill == "enchanting" Debug.MessageBox(itemCrafted.GetName() + " enchanted") Endif EndEvent 1 Link to comment Share on other sites More sharing options...
nullwyrm Posted September 11 Author Share Posted September 11 Thank you so much, that seems to have worked. Link to comment Share on other sites More sharing options...
dylbill Posted September 11 Share Posted September 11 No problem, glad it’s working Link to comment Share on other sites More sharing options...
Recommended Posts