Difference between revisions of "AddInventoryEventFilter - ObjectReference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Rhavlovick
m (1 revision: Clobber re-import by Henning)
 
imported>DavidJCobb
(→‎Notes: no None support)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Scripting]]
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Papyrus]]
[[Category:Non-delayed Native Function]]
'''Member of:''' [[ActiveMagicEffect Script]], [[ReferenceAlias Script]], [[ObjectReference Script]]
'''Member of:''' [[ActiveMagicEffect Script]], [[ReferenceAlias Script]], [[ObjectReference Script]]


Adds a form as a "filter" for [[OnItemAdded - ObjectReference|OnItemAdded]] and [[OnItemRemoved - ObjectReference|OnItemRemoved]] events sent to this object. The filter is applied separately to the reference, any aliases, and any magic effects on the reference, so each will need to add filters to themselves independently.
Adds a form as a "filter" for [[OnItemAdded - ObjectReference|OnItemAdded]] and [[OnItemRemoved - 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.


== Syntax ==
== Syntax ==
Line 24: Line 25:


== Notes ==
== 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.
* 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.


== See Also ==
== See Also ==

Latest revision as of 17:27, 17 November 2016

Member of: ActiveMagicEffect Script, ReferenceAlias Script, ObjectReference Script

Adds a form as a "filter" for OnItemAdded and 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.

Syntax[edit | edit source]

Function AddInventoryEventFilter(Form akFilter) native

Parameters[edit | edit source]

  • akFilter: 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).

Return Value[edit | edit source]

None.

Examples[edit | edit source]

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

Notes[edit | edit source]

  • 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.

See Also[edit | edit source]