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

# npc.motionloopframe

```lua
npc.motionloopframe(start, end)
```

|                         |                                   |
| ----------------------- | --------------------------------- |
| id                      | `0x00F4`                          |
| arguments               | 2: Float, Float                   |
| in NPC Kit              | yes                               |
| measured from a kit NPC | returns                           |
| vanilla scripts         | 3129 calls in 289 of 1114 scripts |

## What it does

Sets which part of the NPC's motion loops: from `start` to `end`.

## Arguments

### `start` (Float)

The first frame of the loop.

### `end` (Float)

The last frame; `-1` (the usual value) is the motion's end, and a value from 0 below `start` becomes `start`. Vanilla: `(0, -1)` 2,020 times, then `(0, 60)`, `(0, 1)`, `(60, 120)`, `(80, 140)`.

## Timing

Returns at once.

## In NPC Kit

Vanilla uses it in scene scripts with `motionplay`, which a kit NPC can't play (no map motions). With the standard motions it is not confirmed to apply.

## Used with

* [motionloop](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/motionloop.md)`(1)` and [motionstartframe](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/motionstartframe.md), then [motionplay](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/motionplay.md) in vanilla.

## Example

The vanilla shape, on a standard motion: loop frames 0 to 60 of the motion played next. Not confirmed to apply to standard motions; check it in the game.

```lua
init = function()
    -- ... bind and stdmotionread ...
    npc.motionloop(1);
    npc.motionloopframe(0, 60);
    npc.stdmotionplay_2c2(0x01000013, 0);   -- laugh, looped on its first 60 frames
end,
```
