GetLinkedRefChain - ObjectReference

From the Fallout4 CreationKit Wiki
Revision as of 17:43, 27 February 2014 by imported>Valie (→‎Examples)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

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

Parameters

  • 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.

Examples

; 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 = 0
while (i < LinkedRefs.length)
	LinkedRefs[i].enable()
	i += 1
endwhile

See Also