Yinkle Posted March 31, 2019 Posted March 31, 2019 I'm trying to retreive an item name as it's shown in the inventory after it's been renamed during enchanting. For example getting the name of a worn armor, If I do this: Form ItemRef = akActor.GetWornForm(0x00000004) String ItemRefName = ItemRef .GetName() The String ItemRefName is the base name of the item before it was enchanted. Any suggestions much appreciated!
Yinkle Posted March 31, 2019 Author Posted March 31, 2019 49 minutes ago, CPU said: name = ItemRef.getDisplayName() Hey CPU, I tried this earlier: Form ItemRef = akActor.GetWornForm(0x00000004) Objectreference ObjRef = ItemRef as ObjectReference String ItemRefName = ObjRef.GetDisplayName() ObjRef returns a none object
Guest Posted March 31, 2019 Posted March 31, 2019 The problem is that you are gettin a Form (so a base object) and not an Object Reference to an instance of the form. if you really need to grab an ObjRef to it, you can try to use these lines of code: Form ItemRef = akActor.GetWornForm(0x00000004) Objectreference ObjRef = akActor.DropObject(ItemRef, 1) akActor.addItem(ItemRef, 1) String ItemRefName = ObjRef.GetDisplayName()
Yinkle Posted March 31, 2019 Author Posted March 31, 2019 Yup that's not ideal! It's not a biggy but it just seems daft that there is no easy way to do it.
Yinkle Posted March 31, 2019 Author Posted March 31, 2019 I just realised I was going about the whole thing in the wrong way! What I was trying to do was add a spell via script when a custom item from another mod was detected on the player character without adding a mod dependancy. Instead of using the name of the item I should have been using GetFormFromFile to reference a magic effect that the item applies to the player. This way it doesn't matter what the item is called. Doh! Oh well you live and learn
Recommended Posts
Archived
This topic is now archived and is closed to further replies.