Closed xanderdunn closed 6 years ago
It looks like the location where workbenches get their items is hardcoded to the player.
Idea: Move all items in a container to the player's inventory and then back to the container when done.
Form
to a FormList
:ScriptName aaCustomContainerScript extends ObjectReference
FormList Property aaItemList auto
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
While aiItemCount > 0
aaItemList.AddForm(akBaseItem) ; tracking list of items in container
aiItemCount -= 1
EndWhile
EndEvent
RemoveAllItems(akTransferTo = Player, abKeepOwnership = true)
.
AddInventoryEventFilter
to ignore any items the player might put in that aren't ingredientsFormList
to move it to the container if it still exists. (This will work only if the used items have a checkable state change from the unused ones)FormList
, remove it. Then simply move all items in the FormList
to the container on workbench completion. The above isn't going to work because Papyrus is too slow, it doesn't tell me how much of each item is being removed from a container or allow me to get a list of what is in a container, and it doesn't allow arrays larger than 128 items.
property Container item list (cil)
To Do
Situations to worry about:
Tests I need to do
Improvements
ExtraContainerInfo
from SkaarSpecialInventoryCrafting.cppGlobalVariable
This is complete save for #34
Pulling items from the user's inventory is a pain in the ass. Instead, pull everything from a nearby designated chest.