Difference between revisions of "FindClosestActorFromRef - Game"

Added note about this object being able to return the player, and fixed the example to not pass the player (or another actor) as the center
imported>Imp of the Perverse
imported>Cipscis
(Added note about this object being able to return the player, and fixed the example to not pass the player (or another actor) as the center)
Line 20: Line 20:
<source lang="papyrus">
<source lang="papyrus">
; Find the closest actor to the player, limiting the search to 5 units
; Find the closest actor to the player, limiting the search to 5 units
Actor closest = Game.FindClosestActorFromRef(Game.GetPlayer(), 5.0)
Actor closest = Game.FindClosestActorFromRef(RefProperty, 5.0)
</source>
</source>
== 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.


== See Also ==
== See Also ==
Anonymous user