Jump to content

Any way to spawn a container at player?


Nexusmodsaccountno2

Recommended Posts

Ok new problem...

 

The place at me function to get a container spawned at the player is tested and working but I am having trouble compiling the next part of the script

 

PlayerRef.PlaceAtMe ContainerRef01 ;works great, spawns the specified container at the player but....

PlayerRef.RemoveAllItems ContainerRef01 1 1 ; up to "PlayerRef.RemoveAllItems" compiles but when I add the containerref01 it stops the script from compiling

 

I want all player inventory transferred to the "placeatme" created container but the script is not compiling. Any ideas as to why?

 

Doing some research I see that it might be an issue defining a persistant reference? But as I am using placeatme I am at a loss as to how to get the player's items into a newly spawned container...

Link to comment
Share on other sites

As I understand it, you need to initially place a "persistent reference" container somewhere hidden in the world first. (Without "persistence" you don't have an "non-dynamic" "RefID".) Then you use that "RefID" (i.e. ContainerRef01") with your "PlaceAtMe" function and in the "RemoveAllItems" function. When you are done with it, you can "MoveTo" it back to the hidden location (an XMarker) in order to "rinse-and-repeat" as needed.

 

-Dubious-

Link to comment
Share on other sites

If you specifically need a non persistent ref, stick something like this on the container:

 

Short CurrentAction

Ref ContainerRef

 

Begin GameMode

 

If CurrentAction == 0

Set ContainerRef to getself

Set CurrentAction to 1

 

Elseif CurrentAction == 1

Player.removeallitems ContainerRef

Set CurrentAction to 2

 

Endif

 

 

Otherwise if it doesn't really need to be a non persistent ref, name it, hide it somewhere and use moveto instead like Dubious said.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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