Does AddInventoryEventFilter not work with keywords?

Post » Fri Nov 18, 2016 8:28 pm

http://www.creationkit.com/fallout4/index.php?title=AddInventoryEventFilter_-_ObjectReference says it does but https://www.creationkit.com/index.php?title=AddInventoryEventFilter_-_ObjectReference doesn't mention them. It took me a while to figure out that the former is for Fallout, so I'm worried I'm not just doing it wrong, and in fact keywords are not a supported filter property in Skyrim. Here's a relevant bit of script:



Actor property PlayerRef auto
Keyword property VendorItemArrow auto
Form property borArrowWeightToken auto

event OnInit()
AddInventoryEventFilter(VendorItemArrow) ; Doesn't seem to work?
endevent

event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
if akBaseItem.HasKeyword(VendorItemArrow)
; This condition should be taken care of by the filter, but apparently not.
PlayerRef.AddItem(borArrowWeightToken, aiItemCount, true)
endif
endevent

It works correctly with the if block, but presumably it's better not to have the event hit the stack. Unfortunately, without that my token fires OnItemAdded again, and the crushing weight of infinite arrows falls upon the hapless test subject. I've tried with PlayerRef.AddInventoryEvent, and even Game.GetPlayer() throughout. Did I mess anything up, or is this just the state of things?

User avatar
Joanne Crump
 
Posts: 3457
Joined: Sat Jul 22, 2006 9:44 am

Return to V - Skyrim