> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nmentities.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Dialog Conditions

> Gate nodes and choices: time, weather, items, permissions, and combining with variables.

Conditions gate a [dialog](dialogs) node or a single choice: a reply that only appears if you're carrying the right item, a greeting that only happens at night. The same conditions work in [`if` and `while`](flow-control) effect lines.

```yaml theme={null}
  choices:
  - text: "Want this diamond?"
    conditions:
    - hasitem{item=diamond}
    goto: trade
```

## Built-in conditions

| Condition                        | True when                                            |
| -------------------------------- | ---------------------------------------------------- |
| `isday`                          | it's daytime in the world                            |
| `isnight`                        | it's nighttime                                       |
| `raining`                        | it's raining                                         |
| `thundering`                     | there's a thunderstorm                               |
| `sneaking`                       | the subject is sneaking                              |
| `hasitem{item=diamond;amount=3}` | the subject's inventory holds that item (and amount) |
| `holding[DIAMOND_SWORD]`         | the subject is holding that item                     |
| `haspermission[some.node]`       | the subject has that permission                      |

## Who the subject is

* **In a dialog:** the player having the conversation.
* **In an effect line** (`if` / `while`): the line's first target.

## Combining conditions

They use the same [condition language](flow-control) as everything else, so they combine with `&&` and `||` and mix with variables and comparisons:

```yaml theme={null}
conditions:
- isnight && var.quest_stage >= 2
```

Multiple entries in a `conditions:` list must all pass.

## Quest state

Pair conditions with [variables](variables) for conversations that remember. Set a variable in a node's `effects`, check it in a later node's `conditions`, and your NPC knows where the player is in a questline:

```yaml theme={null}
  start: [quest_done, quest_active, first_meeting]
  quest_done:
    conditions: [target.var.quest_stage >= 2]
    say: "&fThanks again, friend."
  quest_active:
    conditions: [target.var.quest_stage >= 1]
    say: "&fGot those emeralds yet?"
  first_meeting:
    say: "&fYou must be new around here."
```

The `start:` list is checked top to bottom, so put the most specific state first.

> Remember the [YAML brace rule](dialog-files): conditions with `{...}` need a block list, not an inline one.
