Background for Skyrim SE
Member of the Game script
ActorfunctionFindClosestActorFromRef(ObjectReferencearCenter, floatafRadius)Global

Description

Wiki Description

Finds the closest Actor within a given radius of a ObjectReference.

Documentation Comment

Finds the closest actor within a given radius of a reference


Caveats

CK Wiki - Notes

  • The player is an actor, so this function can return the player if they are the closest actor to arCenter.
  • If an actor is used as the center of this search, that actor's reference will always be the one returned by this function, so it cannot be used to find the closest actor to another actor, including the player.

Parameters

ObjectReferencearCenter

CK Wiki Description

The ObjectReference to search around

floatafRadius

CK Wiki Description

Maximum distance from center to look for an Actor


Examples

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

Auto-Generated Example

ObjectReference myObjectReference__arCenter
float myFloat__afRadius

Actor returnedValue = Game.FindClosestActorFromRef(myObjectReference__arCenter, myFloat__afRadius)

Related Pages


Additional References

View this function’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.