CountLinkedRefChain - ObjectReference

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search

Member of: ObjectReference Script

This function counts the number of linked refs that are in a linked Ref chain (example: A is linked to B is linked to C - this function will return 3)

Syntax[edit | edit source]

int Function CountLinkedRefChain(keyword apKeyword = None, int maxExpectedLinkedRefs = 100) native

Parameters[edit | edit source]

  • apKeyword: Keyword to check ref link against (see GetLinkedRef.)
    • Default: None
  • maxExpectedLinkedRefs: 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]

The total number of linked refs chained together or maxExpectedLinkedRefs, whichever is less. It will also stop and return the current count if it detects a loop.

Examples[edit | edit source]

; Count the number of refs in a linked ref chain to us
int numLinkedRefs = countLinkedRefChain()


; Count the number of refs in a linked ref chain, following the specified keyword for each one
int numLinkedRefs = countLinkedRefChain(LightKeyword)

See Also[edit | edit source]