Jump to content

Problem with OnItem Added


Recommended Posts

I want to craft bloodpacks that draw health.

 

I'm using a dummy bloodpack, that will then use a script to switch itself out for a real bloodpack and also reduce health.

But the script I'm using on the dummy bloodpack won't work. Any ideas?

 


 

Quote

 

Scriptname CBPBloodPackCraftScr extends ObjectReference

Spell Property CBPBloodpackspell Auto
Potion Property Bloodpack Auto
MiscObject Property CBPBloodPackDummy Auto
Keyword Property CBPBloodpackKWD Auto


Event OnInit()
    AddInventoryEventFilter(CBPBloodpackKWD)
EndEvent

 

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
    If (akBaseItem.HasKeyword(CBPBloodpackKWD))
Game.Getplayer().Additem (Bloodpack,1,True)
Game.Getplayer().removeitem (CBPBloodPackDummy,99,False)
CBPBloodpackspell.cast (Game.Getplayer())
    EndIf
EndEvent

 

 

Link to comment
Share on other sites

You cant add an inventory event filter to an OBJECT script, it needs to be on the CONTAINER (actor) e.g. PlayerRef 

If you want an Object attached script to trigger on any container/actor then use OnContainerChanged() something like this:

OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)

If(akNewContainer is Actor)

   ; do stuff

EndIf

EvenEvent 

 

 

 

 

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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