# Conversation System
###### tags: `framework`
*latest update: v.77*
The conversation system is using the Ink engine. To assign a conversation to an NPC we have to add a **Conversation Behaviour** component and call the `StartConversation` method when we want to start the conversation.
You can check more about the **Ink Scripting Language** [here](#Ink-Scripting-Language)
## Conversation Behaviour

| Parameter | Description |
| ----------------- | ------------------------------------------------------------ |
| Story Asset | The json Ink story text asset. |
| Camera | Cinemachine Virtual Camera. Can be null if we manage camera through presets. |
| Avatar Location | Transform to relocate avatar on start conversation. |
| Preset Manager | Preset Manager |
| **debug** | |
| Gizmo Color | The color of the avatar gizmo in Unity Editor. |
| Show Avatar Gizmo | Visualize a simple avatar gizmo in Unity Editor only. |
## Properties
### exitBehaviour : ExitBehaviour
Sets the expected `ExitBehaviour` behaviour on conversation exit.
### onConversationCompleted : ListenerController
Listener which invokes on conversation completed
## Methods
### Start Conversation
Start conversation using the Story Asset assigned to this Conversation Behaviour in the inspector without variables.
```csharp
public void StartConversation()
public void Enter()
```
Start conversation using the Story Asset assigned to this Conversation Behaviour in the inspector with variables.
```csharp
public void StartConversation(params ConversationVariable[] variables)
```
Start conversation using the a story asset as parameter with variables.
```csharp
public void StartConversation(string storyText, params ConversationVariable[] variables)
```
### Exit Conversation
```csharp
public void Exit()
```
### Variables
Set a variable
```csharp
public void SetVariable(string variableName, object value)
```
Get a variable
```csharp
public T GetAvriable<T>(string variableName)
```
## Special Tags
Special tags have been defined. Using them the conversation system can interact with specific components of CNDG framework. **NOTE:** The tag name is not case sensitive (`#PRESET == #preset`).
| Tag | Example | Description |
|:------------------------------------------ |:------------------ |:------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `#BB:<blackboard var name>=<string value>` | `#BB:convSelect=a` | Sets a string blackboard variable with the specified name. This variable must exists prior use. Only string blackboard variables are supported at the moment. |
| `#PRESET:<preset name>` | `#PRESET:p1` | Sets the attached preset manager to the specified preset id. |
---
## Ink Scripting Language
Ink is a narrative scripting language for games. To write and test an ink script you can download the Inky editor from here:
[Latest Inky editor](https://www.github.com/inkle/inky/releases/latest)
For more information & tutorials check out the official site:
[Ink official site](https://www.inklestudios.com/ink/)
### Evaluate knots as boolean variables
Ink will use the name of a knot as a variable name which is **false** on initialization and became **true** when you visit this knot. In my example this knot is the `option_A` and using the brackets `{option_A}` you evaluate the knot, which is the same as asking if you have visited this knot.
```
->Intro
=== Intro ===
Some amazing intro.
+ [Option A] -> option_A
+ {option_A} [Option B] -> option_B
=== option_A ===
What?
->Intro
=== option_B ===
Who?
->END
```