> For the complete documentation index, see [llms.txt](https://fehdead.gitbook.io/npc-kit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/checkdistance3d_531.md).

# npc.checkdistance3d\_531

```lua
npc.checkdistance3d_531(x, y, z, radius)
```

|                         |                                                                                    |
| ----------------------- | ---------------------------------------------------------------------------------- |
| id                      | `0x0531`                                                                           |
| arguments               | 4: Float, Float, Float, Float                                                      |
| result                  | int: goes to the very next call, or to `npc.lua(npc.checkdistance3d_531(...), fn)` |
| in NPC Kit              | yes                                                                                |
| measured from a kit NPC | returns                                                                            |
| vanilla scripts         | 471 calls in 31 of 1114 scripts                                                    |

## What it does

Gives `1` while the character the player controls is within `radius` of a point, height counted, else `0` (also `0` with no such character). A result.

## Arguments

### `x` (Float)

### `y` (Float)

### `z` (Float)

The point; `y` is the height.

### `radius` (Float)

## Result

`1` or `0`.

## Timing

Returns at once.

## In NPC Kit

Vanilla passes the NPC's own `getx()`, `gety()`, `getz()`: "is the player near me". A result only reaches the next call as its first argument, so in the kit write the NPC's coordinates as numbers. It always measures the player, never the calling NPC.

## Used with

* [distance3d\_291](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/distance3d_291.md): the distance itself.

## Example

A guard who only whispers when the player stands close.

```lua
talk = function()
    talkOpen();
    npc.lua(npc.checkdistance3d_531(33.0, 2.0, 68.6, 3.0), function(handle, near)
        say(handle, near == 1 and "Psst. The east gate is unguarded." or "Come closer.")
    end);
    talkClose();
end,
```
