FindClosestReferenceOfAnyTypeInList - Game

From the CreationKit Wiki
Jump to navigation Jump to search

Member of: Game Script

Finds the closest reference of any of the types in the list from the given location and within the given radius.

Syntax[edit | edit source]

ObjectReference Function FindClosestReferenceOfAnyTypeInList(FormList arBaseObjectsA, float afX, float afY, float afZ, \
  float afRadius) native global

Parameters[edit | edit source]

  • arBaseObjectsA: The list of valid base objects to look for
  • afX: center of the search, X component
  • afY: center of the search, Y component
  • afZ: center of the search, Z component
  • afRadius: Maximum distance from center to look for a reference

Return Value[edit | edit source]

The closest reference of any of the types within the radius, none if none was found.

Examples[edit | edit source]

; Find the closest gem reference to 0,0,0, limiting the search to 5 units
ObjectReference closestGem = Game.FindClosestReferenceOfAnyTypeInList(GemList, 0.0, 0.0, 0.0, 5.0)

Notes[edit | edit source]

  • This function appears to pull from a reference's editor positions, not the actual forms in the world. More testing is needed.
  • Following, it appears to return the FormID of the placement, not the actual forms in the world (if their FormIDs differ). Once more, additional testing is needed.

See Also[edit | edit source]