FindClosestReferenceOfTypeFromRef - Game

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search

Member of: Game Script

Finds the closest reference of the given type from the location of the target reference and within the given radius.

Syntax[edit | edit source]

ObjectReference Function FindClosestReferenceOfTypeFromRef(Form arBaseObject, ObjectReference arCenter, float afRadius) global

Parameters[edit | edit source]

  • arBaseObject: The type of base object to look for
  • arCenter: Reference to use as a center to search from
  • afRadius: Maximum distance from center to look for a reference

Return Value[edit | edit source]

The closest reference found, none if none.

Examples[edit | edit source]

; Find the closest diamond reference to the player, limiting the search to 5 units
ObjectReference closestDiamond = Game.FindClosestReferenceOfTypeFromRef(Diamond, Game.GetPlayer(), 5.0)

Notes[edit | edit source]

  • if arBaseObject is the same type as arCenter, this function will return arCenter instead. In other words arCenter is not excluded from the the search.

See Also[edit | edit source]