Background for Starfield
Member of the ScriptObject script
voidfunctionAddInventoryEventFilter(FormakFilter)Native

Description

Wiki Description

Adds a form as a "filter" for ObjectReference.OnItemAdded(...) and ObjectReference.OnItemRemoved(...) events sent to this object. The filter is applied separately to each script on an object, so each script on an object needs to separately manage its own filters and will not interfere with any filters on any other scripts attached to the same object.

Documentation Comment

Add an inventory event filter to this effect. Item added/removed events matching the specified form (or in the specified form list) will now
be let through. A "None" filter will let everything through.
Objects without filters CANNOT receive inventory add/remove events!


Caveats

CK Wiki - Notes

  • The filter will only check inventory objects directly against the objects in the form list, and will not dig inside nested lists to find them.
  • OnItemAdded/Removed will not be sent to any container scripts not having filters.

Parameters

  1. FormakFilter

    CK Wiki Description

    The item to filter with.

    • If none, all items will be allowed through - but you MUST be able to handle several hundred at once!
    • If a base object, this object will only be notified of base objects matching exactly.
    • If a keyword, it will check the object for said keyword
    • If a component, it will check the object for said component
    • If a form list, it will filter using all of the forms in the form list (only items in the form list will be allowed through).

Examples

; Make sure we only get events for gold and soul gems
AddInventoryEventFilter(Gold)
AddInventoryEventFilter(SoulGemList)

Auto-Generated Example

Form myForm__akFilter

myScriptObject__toCallFunctionOn.AddInventoryEventFilter(myForm__akFilter)

Related Pages


Additional References

View this function’s page on the Fallout 4 Creation Kit Wiki

Some data provided by the Fallout 4 Creation Kit Wiki. Licensed under the Creative Commons Attribution-Share Alike 4.0 license.