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

# npc.motionloop

```lua
npc.motionloop(state)
```

|                         |                                   |
| ----------------------- | --------------------------------- |
| id                      | `0x003B`                          |
| arguments               | 1: Int                            |
| in NPC Kit              | yes                               |
| measured from a kit NPC | returns                           |
| vanilla scripts         | 7146 calls in 478 of 1114 scripts |

## What it does

Makes the next motion the NPC plays loop (`1`) or play once (`0`).

## Arguments

### `state` (Int)

`1` loops, `0` plays once. Vanilla: `1` 4,667 times, `0` 2,479.

## Timing

Returns at once; it applies to the motion played after it.

## In NPC Kit

`motionloop(1)` is in the vanilla setup every kit example copies, after the collision calls.

## Used with

* [motionstartframe](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/motionstartframe.md), [motionloopframe](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/motionloopframe.md): where the motion starts and which part loops.
* [stdmotionplay\_2c2](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/stdmotionplay_2c2.md): what plays.
* [motionsync\_282](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/motionsync_282.md): waits for a motion that plays once.

## Example

```lua
npc.motionloop(1);
```
