FindClosestActorFromRef - Game

From the Fallout4 CreationKit Wiki
Revision as of 02:52, 2 September 2021 by imported>Scrivener07
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Member of: Game Script

Finds the closest actor within a given radius of a reference.

Syntax[edit | edit source]

Actor Function FindClosestActorFromRef(ObjectReference arCenter, float afRadius) global

Parameters[edit | edit source]

  • arCenter: The reference to search around
  • afRadius: Maximum distance from center to look for an actor

Return Value[edit | edit source]

The closest actor found, none if none.

Examples[edit | edit source]

; Find the closest actor to the player, limiting the search to 5 units
Actor closest = Game.FindClosestActorFromRef(Game.GetPlayer(), 5.0)

Notes[edit | edit source]

  • As with the Skyrim counterpart, if an actor is used for arCenter, the return value will be that of arCenter. The example above was not tested by whoever put that there.

See Also[edit | edit source]