Difference between revisions of "FindClosestActorFromRef - Game"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Rhavlovick
m (1 revision: Clobber re-import by Henning)
 
imported>Imp of the Perverse
Line 15: Line 15:


== Return Value ==
== Return Value ==
The closest [[Actor Script|actor]] found, none if none.
The closest [[Actor Script|actor]] found, none if none. The reference provided for arCenter is not excluded from the search, limiting this function's usefulness somewhat. The example code, for example, would always return "player".


== Examples ==
== Examples ==

Revision as of 03:55, 19 February 2012

Member of: Game Script

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

Syntax

Actor Function FindClosestActorFromRef(ObjectReference arCenter, float afRadius) global

Parameters

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

Return Value

The closest actor found, none if none. The reference provided for arCenter is not excluded from the search, limiting this function's usefulness somewhat. The example code, for example, would always return "player".

Examples

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

See Also