Jump to content

Papyrus AddItem issue


Recommended Posts

So I am having a weird papyrus issue with a mod I am developing. In my proof of concept, which made a swear jar that gained a cap every in-game hour, running self.AddItem(caps, 1) worked great. Now I am trying the same thing with a compost bin generating fertilizer running self.AddItem(Fertilizer, 1) and it's not adding it in. Here are the two scripts:

 

Scriptname SwearJar:_dd_fillswearjar extends ObjectReference

MiscObject Property Caps Auto

Event OnInit()
StartTimerGameTime(1,1)
EndEvent

Event OnTimerGameTime(int aiTimerID)
if aiTimerID == 1
self.AddItem(Caps, 1)
Debug.Notification("That's a cap for the swear jar!")
StartTimerGameTime(1,1)
endif
EndEvent Scriptname BSAG:CompostBinScript extends ObjectReference

-------------------------------------------------------------

MiscObject Property Fertilizer Auto

Event OnInit()
StartTimerGameTime(1,1)
EndEvent

Event OnTimerGameTime(int aiTimerID)
int FertilizerInContainer = self.GetItemCount(Fertilizer)
if aiTimerID == 1
self.AddItem(Fertilizer, 1)
Debug.Notification("bin contents: " + FertilizerInContainer)
StartTimerGameTime(1,1)
endif
EndEvent

Any thoughts as to why the swear jar works perfectly but the compost bin doesn
't? Note that the FertilizerInContainer int was so I could check to make sure I was interacting with the correct container, so I put a bag of fertilizer into the bin from my characters inventory, and the Notification does change from "bin contents: 0" to "bin contents: 1"

Link to comment
Share on other sites

  • Recently Browsing   0 members

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