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

# npc.getduplicateid

```lua
npc.getduplicateid()
```

|                         |                                                                            |
| ----------------------- | -------------------------------------------------------------------------- |
| id                      | `0x0238`                                                                   |
| arguments               | 0                                                                          |
| result                  | int: goes to the very next call, or to `npc.lua(npc.getduplicateid(), fn)` |
| in NPC Kit              | yes                                                                        |
| measured from a kit NPC | returns                                                                    |
| vanilla scripts         | 191 calls in 108 of 1114 scripts                                           |

## What it does

Gives the NPC's copy number: `0` for the original actor of a shared script, `1`, `2`... for its copies. A result.

## Result

The copy number.

## Timing

Returns at once.

## In NPC Kit

Each kit NPC is its own declaration, so it reads `0`; not useful in the kit.

## Example

None needed: in the kit every NPC is its own `npc.add` and reads `0`. Copies of one NPC are a Lua loop over the declarations:

```lua
for i, x in ipairs({ 28.0, 30.0, 32.0 }) do
    npc.add {
        id = "npckit_005" .. i,
        map = 290,
        name = "NPCKit 005" .. i,
        init = function() placeNpc(0x006E0019, x, -9.0, 68.65, 1.676); end,
        main = function() npc.wait(90); end,
    }
end
```
