Page tree
Skip to end of metadata
Go to start of metadata




Introduced in

Version:1.20

Description

Description:Returns a random position that lies between the specified minimum and maximum distance from the given position or object.

Syntax

Syntax:[center, mindist, maxdist, special] call fn_vbs_randomPos
Parameters:
  • center: Object or Position-2 - Origin around which the random position is created.
  • mindist: Number - Minimum distance from center (can be zero).
  • maxdist: Number - Maximum distance from center.
  • special: Number - Return only special types of locations (optional, V1.30+):
    • 0: Any land position (default).
    • 1: Position on road.
    • 2: Ground-floor building position.
    • 3: Random building position.
Return Value:Position3D

Warning

When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Category VBS Scripting Functions.

Examples

Examples:
_pos = [player, 50, 100] call fn_vbs_randomPos

Additional Information

See also: fn vbs findEmptyLocation, findEmptyPosition, selectBestPlaces
Multiplayer: 
Problems: 

Notes