# Adding NPC to NPC Conversation

## **Step 1: Setting up Convai NPC**

1. **Go to your Convai NPCs**:
   * Select the NPCs you want to include in the conversation.
2. **Enable Group NPC Controller**:
   * Click on the `Group NPC Controller` checkbox in the inspector panel.
   * Click `Apply Changes` to add the group NPC controller script.<br>

     <figure><img src="https://lh7-us.googleusercontent.com/JUlMGlkifNW_8JQ1FJO-55h_c754kh1kgepM0gJFaZ0Ek6FNUyCLvrn2EqtfDORjY8k6-2fsSTzry9LLEWihFhnv0ZGFBSMFIkQ6xGFd0qk9z87p4pz91O6Bvc1vzMqBi_hpxaTvPwvjTMg70iaAm9U" alt=""><figcaption></figcaption></figure>
3. **Create or Find the Speech Bubble Prefab**:
   * Create a new speech bubble prefab or use the one provided in the `Prefabs` folder.<br>

     <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2F85FdsljcxKWyfcl7u65P%2Fimage.png?alt=media&#x26;token=10451f8c-8241-4487-a577-3cc6fd589f8d" alt=""><figcaption></figcaption></figure>
4. **Attach Required Components**:
   * Add the speech bubble prefab and the player transform (optional, defaults to the main camera if not provided).
   * Set the conversation distance threshold variable (set it to zero to disable this feature, meaning NPC to NPC conversations will always happen regardless of the player’s distance).<br>

     <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FrC2ma9XNCl25wYo0pmjn%2Fimage.png?alt=media&#x26;token=a1bdd4a6-d22c-4863-b3b0-21573c16a0c6" alt=""><figcaption></figcaption></figure>
5. **Add Relevant Components**:
   * Add components like lip sync, eye and head tracking, character blinking, etc., to the Convai NPC.

## **Step 2: Setting up NPC Manager**

1. **Create an NPC To NPC Manager GameObject**:
   * Add an empty GameObject and rename it to `NPC to NPC Manager` (optional).
2. **Add the NPC2NPC Conversation Manager Script**:
   * Attach the `NPC2NPCConversationManager` script to the GameObject.<br>

     <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FFbqYqsIhI1VKF09dWCM4%2FScreenshot%202024-05-27%20184719.png?alt=media&#x26;token=b4c5964e-f533-4d34-b1f3-131f99c53187" alt=""><figcaption></figcaption></figure>
3. **Configure the NPC Group List**:
   * In the `NPC Group List`, click on the `+` icon to add a new list element.
   * Add the NPCs you want to include in the group conversation.
   * Set the group discussion topic.<br>

     <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FhMWJQNOZ7KoXDgQExVKo%2Fimage.png?alt=media&#x26;token=15d46dae-de11-4603-937c-ba70c487d9bf" alt=""><figcaption></figcaption></figure>
4. Post configuration of NPCs
   * Bring the NPCs close together
   * Play the to make sure everything is working as intended.<br>

     <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FaWy0W6akVoAgWdDwtXbi%2FScreenshot%202024-05-27%20185141.png?alt=media&#x26;token=b565643d-25ed-4252-a468-8811773929e7" alt=""><figcaption></figcaption></figure>

By following these steps you can set up and manage NPC to NPC conversations in your Convai-powered application. For further customization and integration, refer to the complete implementation code and adjust it as needed for your specific use case.
