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

# npc.lookatt

```lua
npc.lookatt(angle, duration)
```

|                         |                                                                         |
| ----------------------- | ----------------------------------------------------------------------- |
| id                      | `0x024E`                                                                |
| arguments               | 2: Float, Int                                                           |
| in NPC Kit              | yes                                                                     |
| measured from a kit NPC | returns                                                                 |
| waits                   | it has a wait handler: it can hold the script, and in `talk` the player |
| vanilla scripts         | 116 calls in 58 of 1114 scripts                                         |

## What it does

Turns the NPC's head to a heading of the map over a set number of frames, and holds the script until the head is there. Unlike [lookatrt](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/lookatrt.md), the angle is a map heading, not one from the body.

## Arguments

### `angle` (Float)

The heading, in radians, the same angles as [dir](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/dir.md); it is wrapped into one turn. Vanilla builds it from the NPC's own heading plus an offset: `getrotangzx() + 2`, `normalang(getrotangzx() + 0.785)`.

### `duration` (Int)

How long the turn takes, in frames. Vanilla: `45`, or a value of its own script.

## Timing

Waits until the head has turned.

## In NPC Kit

Keep the heading you placed the NPC with in Lua and add the offset there, as in the [getrotangzx](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/getrotangzx.md) example.

## Used with

* [dir](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/dir.md): the heading the offset starts from.
* [lookatoff](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/lookatoff.md): the head back to straight.

## Example

A sentry looks 45° to each side of where it faces.

```lua
local facing = 1.676
watch = function()
    npc.lookatt(facing + 0.785, 45);   -- waits
    npc.lookatt(facing - 0.785, 45);
    npc.lookatoff();
end,
```

## Pitfalls

* It is a map heading: passing a small angle as with `lookatrt` turns the head to a fixed direction of the map, whatever way the NPC faces. Vanilla's offsets stay within 2 radians.
