Jump to content

Another papyrus question


Recommended Posts

Posted

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!

 

 

Posted
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 :(

Posted

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()

 

Posted

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 :)

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...