Hi,
I assumed you would define specific variables in the Dialogue Editor's Variable section. And then in the conversation's dialogue entries' Script fields you would set the variables true. (See the
Conversation Conditions tutorial for more info about setting variables.)
If, instead, you want to automatically track every single line of dialogue without manually managing variables, you could turn on
SimStatus and change the script to check the SimStatus values of all of the dialogue entries in a conversation. I don't think it would work to automatically apply it to every NPC in the scene because each NPC will presumably be assigned a different conversation.
Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class NewDialogueIndicator : MonoBehaviour
{
[ConversationPopup] public string conversationTitle;
public SpriteRenderer indicator;
void Start() { CheckSimStatus(); }
void OnConversationStart(Transform actor) { indicator.enabled = false; }
void OnConversationEnd() { CheckSimStatus(); }
void CheckSimStatus()
{
indicator.enabled = false;
var conversation = DialogueManager.masterDatabase.GetConversation(conversationTitle);
if (conversation == null) return;
foreach (DialogueEntry entry in conversation.dialogueEntries)
{
if (DialogueLua.GetSimStatus(entry) == DialogueLua.Untouched)
{
indicator.enabled = true;
break;
}
}
}
}
Then add a child GameObject to one NPC. Add a SpriteRenderer component and the script above. Drag this child GameObject into the Project view to turn it into a prefab. Then you can add the prefab to all of your other NPCs.
Then inspect each NPC's instance of the prefab, and select the NPC's conversation from the dropdown menu.