angryglock Posted January 16, 2020 Posted January 16, 2020 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() endifEndEvent
IsharaMeradin Posted January 17, 2020 Posted January 17, 2020 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?
steve40 Posted January 20, 2020 Posted January 20, 2020 Also, try removing the "Const" flag from the property definition and from the script header.
SKKmods Posted January 20, 2020 Posted January 20, 2020 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
Recommended Posts