Difference between revisions of "FindClosestReferenceOfAnyTypeInListFromRef - Game"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Templar-von-Midgard
(FindClosestReferenceOfAnyTypeInList(arBaseObjects -> FindClosestReferenceOfAnyTypeInList(arBaseObjectsA)
imported>Thingy Person
Line 7: Line 7:
== Syntax ==
== Syntax ==
<source lang="papyrus">
<source lang="papyrus">
ObjectReference Function FindClosestReferenceOfAnyTypeInListFromRef(FormList arBaseObjectsA, ObjectReference arCenter, \
ObjectReference Function FindClosestReferenceOfAnyTypeInListFromRef(FormList arBaseObjects, ObjectReference arCenter, \
   float afRadius) global
   float afRadius) global
return FindClosestReferenceOfAnyTypeInList(arBaseObjectsA, arCenter.X, arCenter.Y, arCenter.Z, afRadius)
return FindClosestReferenceOfAnyTypeInList(arBaseObjects, arCenter.X, arCenter.Y, arCenter.Z, afRadius)
endFunction
endFunction
</source>
</source>

Revision as of 20:23, 29 June 2013

Member of: Game Script

Finds the closest reference of any of the types in the list around the target reference and within the given radius.

Syntax

ObjectReference Function FindClosestReferenceOfAnyTypeInListFromRef(FormList arBaseObjects, ObjectReference arCenter, \
  float afRadius) global
	return FindClosestReferenceOfAnyTypeInList(arBaseObjects, arCenter.X, arCenter.Y, arCenter.Z, afRadius)
endFunction

Parameters

  • arBaseObjectsA: The list of valid base objects to look for
  • arCenter: The reference to use as the center point of the search
  • afRadius: Maximum distance from center to look for a reference

Return Value

The closest reference of any of the types within the radius around the center reference, none if none was found.

Examples

; Find the closest gem reference to the player, limiting the search to 5 units
ObjectReference closestGem = Game.FindClosestReferenceOfAnyTypeInListFromRef(GemList, Game.GetPlayer(), 5.0)

See Also