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

# npc.motionplay\_bb

```lua
npc.motionplay_bb(motion, blend)
```

|                         |                                   |
| ----------------------- | --------------------------------- |
| id                      | `0x00BB`                          |
| arguments               | 2: Int, Int                       |
| in NPC Kit              | yes                               |
| measured from a kit NPC | returns                           |
| vanilla scripts         | 7881 calls in 323 of 1114 scripts |

## What it does

Plays a motion from the script's **map motions**: motion packages a map script loads into its own slots with `motionread`, for gestures its NPCs share (a vendor gripping a sword, a dancer's loop). The id picks the slot and the motion in it.

## Arguments

### `motion` (Int)

`0x10000000 + slot << 24 + n`: the top byte less `0x10` is the slot (0 to 15), the low 24 bits the motion in it. `0x1000000a` is motion 10 of slot 0, `0x11000003` motion 3 of slot 1. An id whose top byte is outside `0x10`–`0x1F` does nothing. Vanilla's most common: `0x1000000a`, `0x10000003`, `0x10000001`, `0x11000000`.

### `blend` (Int)

The blend into the motion; vanilla passes `0` almost always, `20` in some idle loops.

## Timing

Returns at once. [motionsync\_282](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/motionsync_282.md)`(1)` waits for the motion to end.

## In NPC Kit

**It plays nothing on a kit NPC.** A kit NPC is in script set 4, and the game never loads map motions for set 4 or above, so the slots it would read are empty. Use the model's standard motions instead: [stdmotionread](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/stdmotionread.md) + [stdmotionplay\_2c2](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/stdmotionplay_2c2.md).

## Used with

In vanilla: `motionread(slot)` in the map script, then `motionplay_bb`, `wait(1)`, `motionsync_282(1)` in a loop in an NPC's `main` (33% of vanilla NPCs' `main`).

## Example

Vanilla's looping `main` and the kit form that does the same with standard motions.

```lua
-- vanilla:  motionplay_bb(0x1000000a, 0); wait(1); motionsync_282(1);   (plays nothing in the kit)
main = function()
    npc.stdmotionplay_2c2(0x01000013, 20);   -- laugh
    npc.wait(1);
    npc.motionsync_282(1);
    npc.stdmotionplay_2c2(0x01000000, 20);   -- idle
    npc.wait(120);
end,
```

## Pitfalls

* Copying a vanilla `main` that loops `motionplay_bb` into a kit NPC gives an NPC that stands still.
