Hello, so I'm trying to make the items added with a script to a ships cargo hold show up in the top right corner as they normally would if adding directly to the player.
I've added a inventory filter to a container the items are moved to when looted. And then I add the items to the player, then immediately remove them and place in the ships cargo. But I'm having issues with the process showing items in the players inventory after the process is done, as well as it not running quite as fast as I would like, and sometimes items left in the temporary container.
So is there a better way to do this? I'm not too adept at scripting, so I may be doing it in a dumb way.
ScriptName Test_ItemDisplayScript Extends ObjectReference
ObjectReference Property TempContainer auto
Formlist Property TempFormlist Auto
SQ_PlayerShipScript Property SQ_PlayerShip auto const mandatory
Event OnInit()
AddInventoryEventFilter(None)
EndEvent
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer, int aiTransferReason)
TempFormlist.AddForm(akBaseItem)
Process()
EndEvent
Function Process()
debug.notification("processing")
Int iIndex = TempFormlist.GetSize()
While iIndex > 0
Form iForm = TempFormlist.GetAt(iIndex)
int iCount = TempContainer.GetItemCount(iForm)
game.getplayer().additem(iForm, iCount, False)
SQ_PlayerShip.PlayerShip.GetRef().AddItem(iForm, iCount, False)
game.getplayer().removeitem(iForm, iCount, True)
TempContainer.removeitem(iForm, iCount, True)
if TempContainer.GetItemCount(iForm) == 0
TempFormlist.RemoveAddedForm(iForm)
endif
iIndex -= 1
EndWhile
if TempFormlist.GetSize() > 0
Process()
endif
EndFunction