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

# npc.getlength3

```lua
npc.getlength3(x, y, z)
```

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

## What it does

Gives the straight-line distance from the NPC to a point, height counted. A result.

## Arguments

### `x` (Float)

### `y` (Float)

### `z` (Float)

The point; `y` is the height.

## Result

The distance, a float.

## Timing

Returns at once.

## In NPC Kit

Vanilla divides it by a speed to time a walk (`getlength3(x, y, z) / getdefaultwalkspeed()`); a recorded script can't compute with a result, so do that in Lua from the result. `npc.lua` hands it over cut to an integer.

## Used with

* [distance3d\_291](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/distance3d_291.md): from another actor.
* [getdefaultwalkspeed](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/getdefaultwalkspeed.md).

## Example

A courier who says how far the post box is from them.

```lua
local postBox = [[
The post box? It's about %d paces from here,
right past the old fountain, you can't miss it.
]]

talk = function()
    talkOpen();
    npc.lua(npc.getlength3(55.7, 0.0, 51.2), function(handle, d)
        say(handle, postBox:format(d))
    end);
    talkClose();
end,
```
