Page 1 of 1

How To: Reset SimStatus for Single Conversation

Posted: Fri Jan 04, 2019 10:54 am
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);
    }
}