Background for Skyrim SE
Member of the Game script
ObjectReferencefunctionFindClosestReferenceOfAnyTypeInList(FormListarBaseObjects, floatafX, floatafY, floatafZ, floatafRadius)NativeGlobal

Description

Wiki Description

Finds the closest ObjectReference of any of the types in the list from the given location and within the given radius.

Documentation Comment

Finds the closest reference of any base object in the list within a given radius of a location


Caveats

CK Wiki - Notes

  • This function appears to pull from a reference's editor positions, not the actual forms in the world. More testing is needed.
  • Following, it appears to return the FormID of the placement, not the actual forms in the world (if their FormIDs differ). Once more, additional testing is needed.

Parameters

  1. FormListarBaseObjects

    CK Wiki Description

    The list of valid base objects to look for

  2. floatafX

    CK Wiki Description

    center of the search, X component

  3. floatafY

    CK Wiki Description

    center of the search, Y component

  4. floatafZ

    CK Wiki Description

    center of the search, Z component

  5. floatafRadius

    CK Wiki Description

    Maximum distance from center to look for a ObjectReference


Examples

; Find the closest gem reference to 0,0,0, limiting the search to 5 units
ObjectReference closestGem = Game.FindClosestReferenceOfAnyTypeInList(GemList, 0.0, 0.0, 0.0, 5.0)

Auto-Generated Example

FormList myFormList__arBaseObjects
float myFloat__afX
float myFloat__afY
float myFloat__afZ
float myFloat__afRadius

ObjectReference returnedValue = Game.FindClosestReferenceOfAnyTypeInList(myFormList__arBaseObjects, myFloat__afX, myFloat__afY, myFloat__afZ, 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.