Jump to content

GetLinkedRef only working in one direction?


Recommended Posts

Could it be that getlinkedref is only working in one direction?

 

I've create an object (ZiplineStart) that spawns another object (ZiplineEnd)

 

From ZiplineStart to ZiplineEnd I can travel using SplineTranslateToRefNode but not vice versa. Any insights?

 

That's the script on the ZiplineEnd

Keyword Property Zipline Auto




Event OnActivate (ObjectReference AkActionRef)
ObjectReference TheOtherLine = GetLinkedRef(Zipline)
Game.Getplayer().SplineTranslateToRefNode(TheOtherLine, "SpawnPoint2", 50, 400)
EndEvent

And that's the script for ZiplineStart

Activator Property ZLConnector2 Auto
Keyword Property Zipline Auto
ObjectReference Property TheLIne Auto

Event OnWorkshopObjectPlaced(ObjectReference akReference)
TheLine = Self.PlaceAtNode("SpawnPoint", ZLConnector2 , 1, TRUE, FALSE, FALSE, False)
Self.Setlinkedref (TheLine, Zipline)
EndEvent

Event OnActivate (ObjectReference AkActionRef)
ObjectReference TheOtherLine = GetLinkedRef(Zipline)
Game.Getplayer().SplineTranslateToRefNode(TheOtherLine, "SpawnPoint2", 50, 400)
EndEvent

Event OnWorkshopObjectDestroyed(ObjectReference akReference)
ObjectReference TheOtherLine = GetLinkedRef(Zipline)
        TheOtherLine.DisableNoWait(false)
        TheOtherLine.Delete()
        TheOtherLine.SetLinkedRef(None)
EndEvent
Link to comment
Share on other sites

You can set linkref in both directions explicitly.

Self.Setlinkedref (TheLine, Zipline)
TheLine.Setlinkedref(Self, Zipline) ; <-- reverse link

Moreover, such calls will create you links chain. I.e. Self->TheLine-> Self. This chain can be retrieved by GetLinkedRefChain

And yes, you will need to clean up linkrefs later

Link to comment
Share on other sites

GetLinkedRefChildren( keyword apKeyword )

 

This function returns an array of the references linked to it with the given keyword. That makes the reverse function to GetLinkedRef, I would say that's what you're looking for.

Note that you can link to a reference with a keyword to only one reference, but a reference can be linked form multiple references with the same keyword, like for example workshop references, which are all linked to the workshop with WorshopItemKeyword, and you can get em all with this function: WorkshopRef.GetLinkedRefChildren(WorshopItemKeyword).

Link to comment
Share on other sites

  • Recently Browsing   0 members

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