Jump to content

Moving Tempered Items Between Containers


Pickysaurus

Recommended Posts

Hi all,

 

Seems like a while since I`ve been here...

So I am trying to fix an issue with tempered items losing there 'temper' when being moved to and from a container... without using SKSE.

 

Basically it's an Outfit swapping system, items put into the drawers (containers) add to a formlist as either their ObjectReference or BaseForm, then this script function handles the items swapping around

Function EquipAttire(ObjectReference akContainer, FormList akOutfitlist)
	[....unrelated code removed....]	
	int i = akOutfitlist.GetSize()
	
	while i
		i -= 1
		Form Item = akOutfitlist.GetAt(i)
		if Item as Weapon || Item as Armor
			;Playerref.Additem(Item, 1, true)
			;Playerref.EquipItem(Item,False,True)
			akContainer.RemoveItem(Item,1,PlayerRef)
			Playerref.EquipItem(Item,False,True)
		else
			akContainer.RemoveItem(Item,1,MiscChest)
			akOutfitlist.RemoveAddedForm(Item)
			debug.notification("A non-armor or weapon item has been transferred to your Safehouse Misc Chest")
		endif
	endwhile
	
	[...unrelated code removed...]
EndFunction

If anyone can see my mistake or knows of a way to do this, I'd be very grateful.

Link to comment
Share on other sites

Have you broken down the script to see where its loosing the temper? Does it loose it when it goes from Player -> Container or from Container -> Player, or does it loose it when you try to equip it (not sure why it would, but anything is possible)?

 

I've made scripts with a direct removeitem() from player to container and back which works fine, but maybe its something to do with using a formlist instead? I'd try doing it with one specific item to see how it works that way.

 

I know none of this is a solution, but maybe it can help you diagnose the issue.

Link to comment
Share on other sites

It is the EquipItem function doing it. The game sees the base ID from the formlist and equips an instance of that rather than the tempered version.

If you were to remove the EquipItem function, you should be able to see that the item does indeed transfer between container/inventory while retaining its tempering.

 

As for a non-SKSE workaround, no idea.

Link to comment
Share on other sites

That could have an affect too. If papyrus cannot make sense of the input values for the function, it will fail to run the function. Then the following function EquipItem would add a new instance of the base form and equip that.

 

Should have seen that missing parameter myself. Oh, well. At least it is sorted. It is sorted right?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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