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

# npc.setquestscenarioflag

```lua
npc.setquestscenarioflag(quest, value)
```

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

## What it does

Sets the progress value of one of the game's quests.

## Arguments

### `quest` (Int)

The quest, 0 to 255.

### `value` (Int)

Its progress value, 0 to 255. Both numbers are clamped to 0..255.

## Timing

Returns at once.

## In NPC Kit

**Don't use it for a mod's own state.** It writes the player's saved quest progress: a wrong value can break a vanilla quest. What each quest number is has no bundled table.

## Used with

* [getquestscenarioflag](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/getquestscenarioflag.md).

## Example

None for a mod's own quest. Track it in Lua:

```lua
local findKey = [[
Find my key for me, will you? I lost it today,
somewhere in the bazaar, between all the stalls.
]]

local gotKey = [[
My key! Thank you, thank you so much, traveler.
I don't know what I would have done without it.
]]

local step = 0   -- 0 not started, 1 taken, 2 done; lives while the game runs

talk = function()
    talkOpen();
    npc.lua(npc.haveitem(0x8079), function(handle, count)
        if step == 0 then
            step = 1
            say(handle, findKey)
        elseif step == 1 and count > 0 then
            step = 2
            say(handle, gotKey)
        else
            say(handle, step == 2 and "Thanks again." or "Still looking?")
        end
    end);
    talkClose();
end,
```

## Pitfalls

* It writes the player's saved quest progress: a wrong value can break a vanilla quest, and it is kept in the save.
