How To: Reset SimStatus for Single Conversation

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

How To: Reset SimStatus for Single Conversation

Post by Tony Li »

Someone asked how to reset SimStatus for a single conversation. You can use this script. Call ConversationUtility.ResetConversationSimStatus("title").

ConversationUtility.cs

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;
using System.Text;

public static class ConversationUtility
{

    public static void ResetConversationSimStatus(string conversationTitle)
    {
        var conversation = DialogueManager.masterDatabase.GetConversation(conversationTitle);
        if (conversation == null)
        {
            Debug.LogError("Conversation not found: " + conversationTitle);
            return;
        }
        var sb = new StringBuilder();
        sb.AppendFormat("Conversation[{0}].Dialog = {{ ", conversation.id);
        for (int i = 0; i < conversation.dialogueEntries.Count; i++)
        {
            var dialogueEntry = conversation.dialogueEntries[i];
            sb.AppendFormat("[{0}]={{SimStatus=\"Untouched\"}},", dialogueEntry.id);
        }
        sb.Append('}');
        Lua.Run(sb.ToString(), DialogueDebug.logInfo, true);
    }
}
Post Reply