GetLinkedRefChain - ObjectReference

From Creation Kit
Jump to: navigation, 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.


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


  • 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

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.


; 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

See Also