# Creating Dialogues

## Creating a Dialogue

Welcome to the "Creating a Dialogue" section! 🎉 This is where the magic happens, and you can create immersive, interactive experiences for your players. In this guide, we’ll walk you through the process of creating a new dialogue from scratch. By the end, you’ll have the knowledge to craft your own engaging dialogues using the Strikes-Dialogues plugin! 🧙‍♂️✨

### Table of Contents

* Creating Your First Dialogue
* Setting Up Dialogue Pages
* Using Placeholders
* Adding Actions
* Advanced Features

***

### Creating Your First Dialogue

To start creating a dialogue, you need to add an entry to the `dialogues` section of your `config.yml`. Here’s a simple template to begin:

```
dialogues:
  your_dialogue_id:
    settings:
      animation-delay-ticks: 2
      typing-sound: "ui.button.click"
      start-sound: "start_dialogue"
    pages:
      - - "<#FF6347>Hello %player_name%!"
        - "Welcome to this awesome world!"
        - "You have <#FFFF00>%vault_eco_balance_formatted% balance."
    end-actions:
      - "[MESSAGE] &aDialogue Complete!"
```

* **`your_dialogue_id`**: This is the unique ID for your dialogue. Make sure it’s descriptive and easy to remember.
* **`settings`**: This section allows you to customize how the dialogue behaves. You can set animation delays, sounds, and more.
* **`pages`**: The dialogue text is split into pages. Each page will have a list of lines that are shown sequentially.
* **`end-actions`**: This is where you define the actions that happen after the dialogue is finished, like sending messages or executing commands.

***

### Setting Up Dialogue Pages

Each dialogue consists of **pages** that contain multiple lines of text. The text will be shown one line at a time, with animations and sound effects. Here’s a breakdown of how to structure the pages:

```
pages:
  - - "Line 1: This is the first line of the dialogue."
    - "Line 2: The second line continues the conversation."
    - "Line 3: You can add as many lines as you want!"
```

#### Tips for Dialogue Pages:

* **Multiple Lines**: Each page can have multiple lines, allowing for rich content.
* **Line Breaks**: To create a visual break, use separate lines.
* **Customization**: You can apply formatting (like colors, gradients, etc.) to make the dialogue more visually appealing. Example: `<#FF6347>Welcome!</#FF6347>`.

For example, a basic page might look like this:

```
pages:
  - - "<#FF6347>Hello %player_name%!"
    - "Welcome to this awesome world!"
    - "You have <#FFFF00>%vault_eco_balance_formatted% balance."
```

#### Customizing Text Format:

* **Color**: Use hex color codes like `<#FF6347>` or predefined color names (`red`, `blue`, etc.).
* **Gradient**: Add color gradients to text, like this: `<gradient:#FF6347:#FFFF00>Gradient Text</gradient>`.

***

### Using Placeholders

Strikes-Dialogues supports **PlaceholderAPI**, which allows you to dynamically insert player-specific information into the dialogue text.

#### Common Placeholders:

* `%player_name%` – The name of the player.
* `%vault_eco_balance_formatted%` – The player’s balance (if using Vault).
* `%player_world%` – The world the player is currently in.
* `%server_tps%` – The current server TPS (ticks per second).
* `%player_x%`, `%player_y%`, `%player_z%` – The player's location coordinates.

#### Example with Placeholders:

```
pages:
  - - "Hello %player_name%!"
    - "You are currently in the world: %player_world%."
    - "Your balance is: %vault_eco_balance_formatted%."
```

Placeholders make your dialogues interactive and dynamic, ensuring that no two dialogues feel the same! 🔄

***

### Adding Actions

Once your dialogue is finished, you might want to add **end actions** that occur after the dialogue ends. These actions could be things like sending a message to the player, executing a command, or broadcasting a message to the server.

#### Example of End Actions:

```
end-actions:
  - "[CONSOLE] say Player %player_name% finished the dialogue."
  - "[MESSAGE] &aThanks for joining, %player_name%!"
  - "[PLAYER] me This player just completed a dialogue!"
  - "[SOUND] entity.player.levelup volume:0.8 pitch:1.2"
  - "[BROADCAST] &e%player_name% just completed a dialogue!"
```

#### Available End Actions:

* **`[CONSOLE]`**: Executes a command in the console.
* **`[PLAYER]`**: Executes a command as the player.
* **`[MESSAGE]`**: Sends a message to the player.
* **`[SOUND]`**: Plays a sound when the dialogue ends.
* **`[BROADCAST]`**: Sends a message to the entire server.

You can chain multiple actions together, allowing for complex interactions after the dialogue ends.

***

### Advanced Features

Strikes-Dialogues also supports some advanced features to make your dialogues even more immersive:

#### Persistent Background

If you want the background line to persist throughout the dialogue (rather than disappearing after each page), you can set the `persistent-background-line` in the settings:

```
settings:
  persistent-background-line: "<#FFFFFF>"
```

#### Locking the Player’s Perspective

Lock the player’s perspective while the dialogue is active, ensuring they can’t look away:

```
settings:
  lock-perspective: true
```

***

### Wrapping It Up!

Now that you’ve learned how to create a custom dialogue, you can mix and match different settings, pages, actions, and placeholders to create a truly dynamic experience for your players! 🎮

The possibilities are endless with Strikes-Dialogues, so go ahead and create immersive, engaging, and interactive dialogues for your Minecraft server! ✨

***

**Happy Configuring!** 🎉
