Jump to content

Recommended Posts

Posted

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
Posted

The script looks fine (at least it would work in Skyrim).

 

Check the following:

  • Does the property have the correct object assigned to it?
  • Are you testing on a save that does not have the object with the script already loaded?
Posted

Also, try removing the "Const" flag from the property definition and from the script header.

Posted

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
  • Recently Browsing   0 members

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