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

# npc.setwalkspeed

```lua
npc.setwalkspeed(speed)
```

|                         |                                   |
| ----------------------- | --------------------------------- |
| id                      | `0x020E`                          |
| arguments               | 1: Float                          |
| in NPC Kit              | yes                               |
| measured from a kit NPC | returns                           |
| vanilla scripts         | 1604 calls in 140 of 1114 scripts |

## What it does

Sets the NPC's walk speed: the speed `move`, `rmove` and the other walks use.

## Arguments

### `speed` (Float)

The speed. Vanilla: `getdefaultwalkspeed()` (705 calls), `getdefaultrunspeed()` (329), multiples of them, a few literals such as `0.267`.

## Timing

Returns at once; the next walk uses it.

## In NPC Kit

The model's own speeds come from [getdefaultwalkspeed](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/getdefaultwalkspeed.md) and [getdefaultrunspeed](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/getdefaultrunspeed.md), and a result can feed this call directly:

```lua
npc.setwalkspeed(npc.getdefaultrunspeed());   -- run
npc.move(33.0, -9.0, 68.6);
npc.setwalkspeed(npc.getdefaultwalkspeed());  -- back to walking
```

A multiple (vanilla's `getdefaultrunspeed() * 2`) needs arithmetic on a result, which a recorded script can't do: give a literal instead, or use [rmove\_43](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/rmove_43.md) with its own speed.

## Used with

* [move](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/move.md), [rmove](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/rmove.md): the walks it sets.

## Example

An NPC that runs off when the talk ends, then walks again on its rounds.

```lua
runOff = function()
    npc.setwalkspeed(npc.getdefaultrunspeed());
    npc.aturn(40.0, -9.0, 70.0);
    npc.move(40.0, -9.0, 70.0);
    npc.setwalkspeed(npc.getdefaultwalkspeed());
end,
```

## Pitfalls

* The speed stays for every later walk: set the walk back.
