Excel import/DIalogue Entry customization

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
BlooOwlBaba
Posts: 9
Joined: Fri May 20, 2022 10:15 pm

Excel import/DIalogue Entry customization

Post by BlooOwlBaba »

Hi, I'm running into an issue where it's becoming very tedious/time consuming to add sequencers to dialogue snippets.

As things are I have speech bubbles that can be changed/rotated depending on who is speaking (with a custom sequencer) and their emotions/state. I currently write the dialogue in excel and import that using the package that supports it.

Image

Is there a way to translate this extra field for the character's emotion into something that can be picked up automatically? Or at the least be available as a dropdown here that can trigger a sequencer?

Image
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: Excel import/DIalogue Entry customization

Post by Tony Li »

Hi,

Have you modified the importer code to import that third column as a custom field in your dialogue entries? If so, then you can add an OnConversationLine(Subtitle) method to a script on your Dialogue Manager. Let's say you've modified the Excel importer to add a custom field named "Emotion". Your method might look something like:

Code: Select all

void OnConversationLine(Subtitle subtitle)
{
    string emotion = Field.LookupValue(subtitle.dialogueEntry.fields, "Emotion);
    string emotionSequence = GetEmotionSequence(emotion);
    if (!string.IsNullOrEmpty(emotionSequence))
    {
        subtitle.sequence = $"{emotionSequence}; {subtitle.sequence}";
    }  
}

string GetEmotionSequence(string emotion)
{
    switch (emotion)
    {
        case "Neutral": return "SetTextBubbleImage(0, 1);"
        case "Happy": return "SetTextBubbleImage(0, 2);"
        case "Sad": return "SetTextBubbleImage(0, 3);"
        default: return string.Empty;
    }
}
BlooOwlBaba
Posts: 9
Joined: Fri May 20, 2022 10:15 pm

Re: Excel import/DIalogue Entry customization

Post by BlooOwlBaba »

Yup, this worked like a charm. Thank you!
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: Excel import/DIalogue Entry customization

Post by Tony Li »

Glad to help!
Post Reply