Jump to content

How can I access the contents of a Workshop settlement's junk container?


Recommended Posts

I've tried various permutations of

ObjectReference property localContainer auto

then in a function,

localContainer = GetLinkedRef(WorkshopParent.WorkshopLinkContainer) as ObjectReference
debug.notification( "We look into " + localContainer)

The function is in a terminal script. The properties of the script do seem to see localContainer as an ObjectReference. I think I might be doing several things wrong - all other parts of the function work, but the debug notification above never appears. It doesn't show NONE or 0 or anything - it just never appears at all! Code before and after those 2 lines are running, and the script complies. I'm not sure what to look at next.

 

Edit: I've also seen in WorkshopParentScript, a number of calls like:

ObjectReference containerRef = workshopRef.GetContainer()

where workshopRef is being passed in at a function call; so maybe I'm just not getting the local workshop reference correctly? What's the most reliable way of referring to "the workshop I'm standing in?" It will be called from a workshop-CO placed in the world, so it will always be true that we're standing in one.

Link to comment
Share on other sites

You have to tell getLinkedRef() where to search for linked references. In case of a terminal try:

localContainer = akTerminalRef.GetLinkedRef(WorkshopParent.WorkshopLinkContainer)

If this is in a terminal script there should be a fragment too: (something like)

Function Fragment_Terminal_03(ObjectReference akTerminalRef)
;BEGIN CODE
calcPowerGrid(akTerminalRef)
;END CODE
EndFunction

The function (here: calcPowerGrid()) is called with an ObjectReference as parameter of the attached terminal. This is your anchor to access the terminal.

 

NB. it's okay to delclare localContainer as

ObjectReference localContainer

No need for a property

Link to comment
Share on other sites

  • Recently Browsing   0 members

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