GetLinkedRefChain - ObjectReference

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search

Member of: ObjectReference Script

This function returns an array of objectreferences representing the "linked ref chain" hanging of the reference it is called on. For example. If myObject has linkedref to ObjectA which has a linkedref to ObjectB which has a linkedref to ObjectC, and you call myObject.GetLinkedRefChain() it will return an array holding ObjectA, ObjectB, and ObjectC.


Syntax[edit | edit source]

ObjectReference[] Function GetLinkedRefChain(keyword apKeyword = None, int iMaxExpectedLinkedRefs = 100) native

Parameters[edit | edit source]

  • apKeyword: Keyword to check ref link against (see GetLinkedRef.)
    • Default: None
  • iMaxExpectedLinkedRefs: Maximum number of expected links. The function stops checking after it finds this many or finishes finding all of them.
    • Default: 100

Return Value[edit | edit source]

An array of ObjectReferences representing the reference that this object is linkedRef'd to and whatever that object is linkedRef'd to, and so on. Will stop if it finds a loop.

Examples[edit | edit source]

; get the refs in a linked ref chain to us
ObjectReference[] LinkedRefs = GetLinkedRefChain()


; Get the refs in a linked ref chain, following the keyword
ObjectReference[] LinkedRefs = GetLinkedRefChain(LightKeyword)


; Enable the refs in a linked ref chain
ObjectReference[] LinkedRefs = GetLinkedRefChain()
int i = LinkedRefs.length
while (i > 0)
	i -= 1
	LinkedRefs[i].EnableNoWait()
endwhile

See Also[edit | edit source]