Mod:Creation Kit/FindRandomReferenceOfType - Game

Member of: Mod:Creation Kit/Game Script

Finds a random reference of the given type from the given location and within the given radius.

Syntax
ObjectReference Function FindRandomReferenceOfType(Form arBaseObject, float afX, float afY, float afZ, \ float afRadius) native global

Parameters

 * arBaseObject: The type of base object to look for
 * afX: center of the search, X component
 * afY: center of the search, Y component
 * afZ: center of the search, Z component
 * afRadius: Maximum distance from center to look for a reference

Return Value
A random reference of that type within the radius, none if none was found.

Examples
ObjectReference randomDiamond = Game.FindRandomReferenceOfType(Diamond, 0.0, 0.0, 0.0, 5.0)
 * Find a random diamond reference to 0,0,0, limiting the search to 5 units