MaddDreamer Posted November 17, 2017 Share Posted November 17, 2017 How can i script a container with an OnItemAdded event that will always fire when the item i want gets placed in, even after its been in the chest before? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 17, 2017 Share Posted November 17, 2017 Technically, the OnItemAdded event will always run no matter what item is added and irregardless of whether it has or has not been in the container before. Some example usages: Do something when an item is added to the container -- this version always runs when an item is added. Depending upon number of items added, processing could slow down as each item must be compared. Scriptname SomeContainerScript Extends ObjectReference MiscObject Property MyMiscObject Auto ;change property type as necessary - this is for the item you want to work with Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) If akBaseItem == MyMiscObject ; do stuff Else Return EndIf EndEvent Do something when an item and only that item is added to a container -- this version is processing friendly in that the OnItemAdded event will only be triggered when the specified object is added, all other items will be ignored. Scriptname SomeContainerScript Extends ObjectReference MiscObject Property MyMiscObject Auto ;change property type as necessary - this is for the item you want to work with Event OnInit() AddInventoryEventFilter(MyMiscObject) EndEvent Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) ; do stuff EndEvent Link to comment Share on other sites More sharing options...
MaddDreamer Posted November 17, 2017 Author Share Posted November 17, 2017 Thank you this helped alot and the scripts i have are all working together nicely! Th ck was a little confusing on how the event would fire so thank you for clearing that up as well. Link to comment Share on other sites More sharing options...
Recommended Posts