Difference between revisions of "GetLinkedRefChain - ObjectReference"

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
imported>Valie
 
imported>Docclox
 
(One intermediate revision by the same user not shown)
Line 34: Line 34:
; Enable the refs in a linked ref chain
; Enable the refs in a linked ref chain
ObjectReference[] LinkedRefs = GetLinkedRefChain()
ObjectReference[] LinkedRefs = GetLinkedRefChain()
int i = 0
int i = LinkedRefs.length
while (i < LinkedRefs.length)
while (i > 0)
LinkedRefs[i].enable()
i -= 1
i += 1
LinkedRefs[i].EnableNoWait()
endwhile
endwhile



Latest revision as of 22:38, 28 June 2016

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]