Jump to content

Fallout 4 Container Script


angryglock

Recommended Posts

Can someone help me with this simple script. I want to press a button on my activator and delete all items from a container. I've tried several approaches and used the CK Wiki (nearly worthless). I've done this many time in Skyrim and SSE but can't get anywhere in FO4. FO4 has some new voodoo for moving stuff between containers and removing stuff from containers that I don't get.

 

ObjectReference Property myTrashCan Auto Const

Event OnActivate(ObjectReference akActionRef)
if akActionRef == Game.GetPlayer()
myTrashCan.RemoveAllItems()
endif
EndEvent
Link to comment
Share on other sites

Looks OK, compiles and runs fine here.

 

Enable the Papyrus debug log add some debug output to see if the function is actually firing:

Scriptname myActivatorScript extends ObjectReference Const

ObjectReference Property myTrashCan Auto Const
 
Event OnActivate(ObjectReference akActionRef)

Debug.Trace("myActivatorScript.OnActivate " + Self + " " + myTrashcan + " " + akActionRef)

If akActionRef == Game.GetPlayer()
   myTrashCan.RemoveAllItems(akTransferTo = None, abKeepOwnership = False)
Endif

EndEvent
Link to comment
Share on other sites

  • Recently Browsing   0 members

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