Skip to content

A3D_GetRandomWalkPoint

imshooter edited this page Oct 23, 2026 · 1 revision

Find a random point of the navigation mesh within a radius, which can be walked to from the centre, such as where an actor wanders next.

native bool:A3D_GetRandomWalkPoint(
    Float:x,
    Float:y,
    Float:z,
    Float:radius,
    &Float:walkX,
    &Float:walkY,
    &Float:walkZ
);

Parameters

Parameter Description
Float:x Centre on the X axis.
Float:y Centre on the Y axis.
Float:z Centre on the Z axis.
Float:radius Distance from the centre, in metres.
&Float:walkX Point found on the X axis.
&Float:walkY Point found on the Y axis.
&Float:walkZ Point found on the Z axis.

Returns

  • true when a point was found.
  • false when the centre is off the mesh, or there is no navigation mesh.

Remarks

The point can be walked to from the centre, so it is never behind a wall with no way around, on a roof or in a closed yard. The points spread over the walkable area within the radius.

Example

Drops a pickup on a random spot a player can walk to.

stock DropLoot(modelid, Float:x, Float:y, Float:z, Float:radius) {
    new
        Float:lootX,
        Float:lootY,
        Float:lootZ
    ;

    if (!A3D_GetRandomWalkPoint(x, y, z, radius, lootX, lootY, lootZ)) {
        return -1;
    }

    return CreatePickup(modelid, 1, lootX, lootY, lootZ + 0.5);
}

Related

  • A3D_GetNearestWalkPoint: Find the nearest point of the navigation mesh, where a pedestrian can stand.
  • A3D_FindRoute: Find the best route between two points along the paths of the game.

Home

Guides

Reference

Functions

Creating objects
Motion
Placement
Behaviour
Display and data
Rays
Shapes
Players, vehicles and actors
Map probes
Screen
Map objects
Water
Models and surfaces
Rotations and offsets
Vehicles
Routes
Route display
Walking
Callbacks

Clone this wiki locally