[HOWTO] How To: Apply Old/Invalid Response Formatting To Menus & Subtitle Text

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

[HOWTO] How To: Apply Old/Invalid Response Formatting To Menus & Subtitle Text

Post by Tony Li »

To show previously-selected responses in a different color or style than unselected responses:

1. Tick the Dialogue Manager's Other Settings > Include SimStatus.

2. Set the Dialogue Manager's Input Settings > [em#] Tag For Old Responses.

emForOldResponses.png
emForOldResponses.png (78.13 KiB) Viewed 210 times

3. Set the [em#] tag appearance.

em1.png
em1.png (27.16 KiB) Viewed 210 times

You can do the same for invalid responses, too. These are responses whose Conditions are currently false. In this case, you must also tick Input Settings > Include Invalid Entries.

If you only want to conditionally show some invalid entries, see this post as cited in How To: Do Skill Checks in Conversations.

---

The Dialogue Manager's Input Setting section provides options to format old or invalid responses with [em#] tags. This formatting is only applied to the menu buttons' text, not to the subtitle text if the player chooses the response.

If you want to also apply the same formatting to the response subtitle text for old responses, you can add a script to the Dialogue Manager that has OnPrepareConversationLine and OnConversationLine special methods.

OnPrepareConversationLine is called before the response is marked "WasDisplayed". You can use this method to determine whether the response is old or not.

OnConversationLine is called before showing the subtitle. If OnPrepareConversationLine determined that the response is old, OnConversationLine can add the [em#] formatting.

Example:

Code: Select all

private bool isOld;

public void OnPrepareConversationLine(DialogueEntry entry)
{
    var actor = DialogueManager.masterDatabase.GetActor(entry.ActorID);
    isOld = actor.IsPlayer  && DialogueLua.GetSimStatus(entry) == DialogueLua.WasDisplayed;
}

public void OnConversationLine(Subtitle subtitle)
{
    if (isOld)
    {
        int emTagNum = (int)DialogueManager.displaySettings.inputSettings.emTagForOldResponses;
        string newText = $"[em{emTagNum}]{subtitle.formattedText.text}[/em{emTagNum}]";
        string newText = FormattedText.Parse(newText);
        subtitle.formattedText.text = newText;
    }
}
Post Reply