Background for Skyrim SE
Member of the ObjectReference 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 will be applied only to the specific Reference, Alias, or Active Magic Effect it is added to, so each will need to have filters applied to them independently.

Documentation Comment

Add an inventory event filter to this reference. Item added/removed events matching the
specified form (or in the specified form list) will now be let through.


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.
  • New filters that are added stack with any previous filters. If you intend to override previous filters you will need to remove them first.
  • In case anyone is wondering, Skyrim does not support passing None to this function; that was added in Fallout 4. You can get identical behavior by adding an empty FormList, though.

Parameters

  1. FormakFilter

    CK Wiki Description

    The item to filter with. If a base object or reference, this object will only be notified of references or base objects matching exactly. 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

myObjectReference__toCallFunctionOn.AddInventoryEventFilter(myForm__akFilter)

Related Pages


Additional References

View this function’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.