> 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/distance_290.md).

# npc.distance\_290

```lua
npc.distance_290(actor, x, z)
```

|                         |                                                                               |
| ----------------------- | ----------------------------------------------------------------------------- |
| id                      | `0x0290`                                                                      |
| arguments               | 3: Int, Float, Float                                                          |
| result                  | float: goes to the very next call, or to `npc.lua(npc.distance_290(...), fn)` |
| in NPC Kit              | yes                                                                           |
| measured from a kit NPC | returns                                                                       |
| vanilla scripts         | 1720 calls in 158 of 1114 scripts                                             |

## What it does

Gives the ground distance from an actor to a point (height left out). A result.

## Arguments

### `actor` (Int)

`-1` the character the player controls, or another actor.

### `x` (Float)

### `z` (Float)

The point.

## Result

The distance, a float.

## Timing

Returns at once.

## In NPC Kit

`npc.lua(npc.distance_290(-1, 33.0, 68.6), fn)` hands Lua how far the player is from a spot, cut to an integer.

## Used with

* [distance](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/distance.md): between two actors.

## Example

A gate guard who tells how far the player stands from the gate.

```lua
talk = function()
    talkOpen();
    npc.lua(npc.distance_290(-1, 33.0, 68.6), function(handle, d)
        say(handle, d <= 5 and "The gate's right there." or "The gate is " .. d .. " paces east.")
    end);
    talkClose();
end,
```

## Pitfalls

* An index with no actor behind it measures from the map origin `(0, 0)`; there is no error.
* Cut to an integer in Lua: `2.9` is `2`.
