Jump to content

OnItemAdded Attached to Player Doesn't Fire


Phoenixia1177

Recommended Posts

I was testing why something wouldn't work and determined that OnItemAdded wasn't firing. So, I made a very simple script and attached it to the player usin a reference alias with a quest to attach:

Scriptname playerTestSCRIPT extends ReferenceAlias  
 
Message Property GateLocked auto
 
Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
	GateLocked.Show()
endEvent

The message never shows, no matter what I pick up or how long I wait.

 

So, assuming maybe I screwed something up with the alias part, I attached:

Scriptname playerBadIdeaTestSCRIPT extends Actor 
 
Message Property GateLocked Auto
 
Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
	GateLocked.Show()
endEvent

Directly to the player in a fresh esp with nothing else. It still never does anything.

 

I'm assuming that I'm doing something dumb (I'm not new to coding, just to Papyrus). Ultimately, I need the game to check whenever an item is added to the player's inventory, then do something if it is an item with a certain keyword - everything in that larger script seemed perfectly fine, it just never seemed to run. At any rate, thank you for any help, this has been frustrating me all night.

Link to comment
Share on other sites

OnItemAdded - ObjectReference

http://www.creationkit.com/fallout4/index.php?title=OnItemAdded_-_ObjectReference

 

You must use AddInventoryEventFilter to receive this event, letting it know what items you care about.

 

AddInventoryEventFilter - ScriptObject

http://www.creationkit.com/fallout4/index.php?title=AddInventoryEventFilter_-_ScriptObject

 

OnItemAdded/Removed will not be sent to any container scripts not having filters.

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...