# Dialogues Properties

## Text lines

This is the message to be sent to the player in each dialogue. Some considerations:

* You can add multiple lines.&#x20;
* You can use PlaceholderAPI variables.&#x20;
* You can use the `%player%` variable to get the player name.
* You can add the `{centered}` variable before the name to make the text centered.
* If you want the player to be able to SKIP the dialogue, just add the `%next%` variable at the end of it. This variable will be replaced with a button players need to click.
* You can use JSON format by writing `"json: <json-message>"`.
* If you want to show the options within the dialogue, use the `%option_X%` variable. More information about this [**HERE**](https://ajneb97.gitbook.io/interactions/conversation-properties#options-in-dialogue).

{% tabs %}
{% tab title="Example 1" %}

```yaml
text:
- "&7Hello &6%player%, &7welcome to the city of"
- "&f&lArgond&7. A magnificent place isn't it?"
```

{% endtab %}

{% tab title="Example 2" %}

```yaml
text:
- "{centered}&7FINALLY you arrived! I was expecting you..."
- "{centered}&7Are you the one everyone is talking about?"
```

{% endtab %}

{% tab title="Example 3" %}

```yaml
text:
- "&7Welcome to the server, would you like to go"
- "&7somewhere? %next%"
```

{% endtab %}

{% tab title="Example 4" %}

```yaml
text:
- 'json: ["",{"text":"Remember to check the ","color":"#AFD6E9"},{"text":"SPAWN","bold":true,"color":"#FF80C0","hoverEvent":{"action":"show_text","contents":[{"text":"Use /spawn to teleport","bold":true,"underlined":true}]}}]'
```

{% endtab %}

{% tab title="Example 5" %}

```yaml
text:
        - '{centered}&8&m000                                                           &8&m000'
        - '{centered}#fffa9c&lHegror'
        - '{centered}#dbdbdbIf I am not wrong, you are &b%player% #dbdbdbright?'
        - ' '
        - '                    %option_1%'
        - '                    %option_2%'
        - '{centered}&8&m000                                                           &8&m000'
```

{% endtab %}
{% endtabs %}

## Time

The time (in seconds) the player has to read the message and continue with the next dialogue.&#x20;

* Set it to 0 if you want the next dialogue to be sent instantly along this dialogue. This is useful for showing a dialogue and options at the same time.
* Set it to -1 if you want the player to click on a button on chat to continue with the dialogue. For this, remember to use the `%next%` option explained above.

```yaml
time: 4
```

## Start Options

When finishing this dialogue, the player options from the conversation defined here, will be displayed.

```yaml
start_options: conversation1
```

## Start Conversation

When finishing this dialogue, the first dialogue from the conversation defined here, will start.

```yaml
start_conversation: conversation4
```

## Actions and Last Actions

At the beginning (or end) of the dialogue you can execute some actions, like giving the player a potion effect or executing a command. You can learn about all actions [CLICKING HERE](https://ajneb97.gitbook.io/interactions/actions).

```yaml
actions:
- "give_potion_effect: BLINDNESS;180;1"
- "give_potion_effect: CONFUSION;180;1"

last_actions:
- "remove_potion_effect: BLINDNESS"
- "remove_potion_effect: CONFUSION"
```

## Show Name

Whether the name of this entity should be displayed on this dialogue.

```yaml
show_name: false
```

## Save Dialogue Option

A very important option for dialogues is the "Save Dialogue" one. In some cases you will want the user to previously have reach to a certain dialogue in a conversation. For example, the first time a player greets a NPC the following dialogue will show: `"Hello citizen, what can I do for you"`.&#x20;

But the next time, another different dialogue will be sent, meaning the player already talked to this NPC. If you want something like this to happen, enable this option. This will save this dialogue for the player and will allow the use of the following PlaceholderAPI variable:&#x20;

`%interactions_has_dialogue_<conversation entity>.<conversation>.<dialogue>%`

This variable will return `true` if the player has reached to that dialogue, and `false` if not.

```yaml
save_dialogue_to_player: true
```

## Conditional Dialogues

A conditional dialogue is a REPLACEMENT for the dialogue and will be sent to the player ONLY if some requirements are met. For example, we have this dialogue: `"Hello adventurer, I hope you are having a great day"`

We can add a conditional dialogue that will replace this dialogue ONLY if the player is lower than level 10. This can be done by adding the next requirement: `"%player_level% < 10"`

![](https://1449104054-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQiBU9Cb692JapWmSwp%2F-MQiNDjJMKtDUpzCNFKz%2F-MQigpEuhCjHgdtY0s2Y%2Fimagen.png?alt=media\&token=ea93eebf-d81d-4588-8cba-a2548ff0d432)

We now need to create a conversation with another dialogue, that will replace the original one, and redirect the conditional dialogue to that conversation. In this case I will create a convesation with the dialogue: `"I don't speak to novices"`

In the config it should look something like this:

```yaml
conversation1:
    dialogue:
      dialogue1:
        text:
        - '&7Hello adventurer, I hope you are having a great day'
        time: 2
        conditional_dialogue:
          conditional_dialogue1:
            requires:
            - '%player_level% < 10'
            start_conversation: conversation2
conversation2:
    dialogue:
      dialogue1:
        text:
        - '&7I don't speak to novices'
        time: 2
```

So, as you can see, the conversation will start with the dialogue1 of conversation1, but if the player is lower than level 10, the conversation2 will start instead.

{% hint style="info" %}
You can find more information about Requirements [CLICKING HERE](https://ajneb97.gitbook.io/interactions/requirements).
{% endhint %}

Remember you can use the variable from the Save Dialogue option too! (requires PlaceholderAPI)

```yaml
conversation1:
    dialogue:
      dialogue1:
        text:
        - '&7Hello adventurer, is the first time we met right?'
        time: 2
        save_dialogue_to_player: true
        conditional_dialogue:
          conditional_dialogue1:
            requires:
            - '%interactions_has_dialogue_guard1.conversation1.dialogue1% == true'
            start_conversation: conversation2
conversation2:
    dialogue:
      dialogue1:
        text:
        - '&7Hello again &a%player%'
        time: 2
```

In this case, the first time the player speaks to the NPC, the dialogue1 for the conversation1 will be sent. The next time instead, the conversation2 will start, since the player has already reached the `dialogue1` of `conversation1` from the `guard1.yml` file.

{% hint style="info" %}
Remember, you can add multiple conditional dialogues. If the conditions for one dialogue are not met, then it will check for the next one. If the requirements are not met for ANY of the conditional dialogues, then the original dialogue will be sent.
{% endhint %}
