Jump to content

Help moving an ObjectReference to PLayer with MoveTo


toneisland85

Recommended Posts

Hi All

I am very new to scripting but I am having a damn good go and Im trying to create a basic stash box that is linked to a workbench via workshopkeyword in a cell and I want to be able to summon that stash box from my inventory using OncontainerChanged. The object is placed in a cell under the world and has a linked Ref to a central workbench if that helps.

Here is the script I have so far. It compiles but nothing happenes when I drop my misc item and the Papyrus log says item cannot be moved.

Could someone please help me understand where I am going wrong? I have set the properties for the objectReference to point to the exact cell and object but still no luck.

 

Scriptname GlobalStash:GlobalStashBox extends ObjectReference Const

{This is my first script}


ObjectReference Property TMS_DeployableGlobalStash Auto Const

 

;-- Variables ---------------------------------------

;-- Functions ---------------------------------------

 

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
    Actor PlayerRef = Game.GetPlayer()
        
    If (akNewContainer == None && akOldContainer == Game.GetPlayer())
    ;Spawn Form
     TMS_DeployableGlobalStash.MoveTo(Game.GetPlayer())
    EndIf
    
EndEvent

Link to comment
Share on other sites

  • Recently Browsing   0 members

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