Jump to content

Inventories and enchantments


Recommended Posts

The following is what I was about to put in an article on my mod page, but I don't think it is quite right:

"Now a note about objects and enchantments. All objects in the game have a baseid (the id in the CK) and their refid (the instance of that baseid in the game). When an object is put into an NPCs inventory, it loses its refid and is stored just as the baseid. When the item is removed a new refid is made. This means that enchantments etc. that the player has put on a base object will be lost when placed in an NPCs inventory, the inventory only knows about the baseobject. If the baseobject already has enchantments then that will work fine.
So when an NPC is wearing or wielding an item (i.e. it is in their inventory) the only identifying information that can be stored about it, is its baseid."

 

Clearly the players inventory keeps enchantments even if the objects are stored as just their baseid which is why there is the SKSE equipitembyid function which enables a scripter to identify particular versions of a formid which can only happen if the game engine has saved info about the object in the inventory some form or other in the first place. So, will the equipitembyid function work on items in an NPCs inventory? If so, then even if the objectreference id for an item is lost in an NPCs inventory the game engine is still keeping track of different versions of baseobjects, so wouldn't the game engine still be abe to apply the enchantment when worn by the NPC?

Even if the enchantment doesn't apply, if the item is removed from the NPC inventory and a new objectreference is created by the game, will the object still have its enchantments such that the player could use it?

 

diziet

Link to comment
Share on other sites

  • Recently Browsing   0 members

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