Jump to content

Script not receiving OnItemAdded event


thegeekofalltrades

Recommended Posts

I'm making a mod in which a script attached to a player quest alias needs to receive the OnItemAdded event.

 

It doesn't.

 

Like, at all:

 

Scriptname MyQuestPlayerScript Extends ReferenceAlias

MyQuestScript Property MyQuest Auto

Event OnInit()
    Debug.Notification("The player script is initialized.")
EndEvent

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
    Debug.Notification("OnItemAdded received.")
EndEvent

This script is attached to a quest alias force-filled with the player (Specific Reference: 'PlayerRef'). The MyQuestScript property is properly filled. When I start the game, I see the debug message from OnInit, suggesting that the script is there and it's properly initialized, but then I run around the room picking up items or I add items to the player with the console, and I never see the message from OnItemAdded. Previously, I had some actually useful logic in there, and it wasn't happening, either. The event just isn't being received, and I can't figure out why. Any thoughts?

Link to comment
Share on other sites

Maybe try it without the MCM script attached?

 

The other thing is that there is also an NPC called PlayerInventory. Maybe you need to point your alias to that NPC to get OnItemAdded events from the player?

 

Just some things to try. I don't have the solution.

Link to comment
Share on other sites

Neither options worked. Thanks for the thoughts, though.

 

I made a completely new plugin and my script is receiving OnItemAdded again. Just a Beth Bug, I guess. It'll be kind of a pain to have to rebuild the plugin from scratch, but fortunately it's not a big mod.

 

UPDATE:

 

A-ha, problem diagnosed. My quest has several empty aliases on it, and I hadn't checked them as "Optional," which was apparently just ruining everything.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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