How to create conversations without choices?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
The_Dhel
Posts: 2
Joined: Fri May 19, 2017 3:30 pm

How to create conversations without choices?

Post by The_Dhel »

Hello there!

I'm just starting out with Dialogue System and so far i really like it! However i have encountered a problem.
I want the PC and NPC to have a back-and-forth conversation, but WITHOUT having the PC to choose their lines.
I got the conversation working, but every line said by the PC has to be choosen by the player, which is what i don't want.

Can anyone point me in the right direction? :)

Thanks in advance!
The Dhel
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to create conversations without choices?

Post by Tony Li »

Hi!

Inspect the Dialogue Manager GameObject, and untick Display Settings > Input Settings > Always Force Response Menu. Then tick Display Settings > Subtitle Settings > Show PC Subtitle During Line.

If the player only has one response, it will play automatically. Show PC Subtitle During Line shows the player's response as a subtitle.

If you only want this behavior for a specific conversation, instead of applying it globally, inspect your conversation in the Dialogue Editor. If you click on blank canvas space, it will show the conversation's properties in the inspector. There's an override checkbox where you can set the same kind of settings but just for that conversation.
The_Dhel
Posts: 2
Joined: Fri May 19, 2017 3:30 pm

Re: How to create conversations without choices?

Post by The_Dhel »

Hey!

Awesome, that worked perfectly! Thanks so much for the quick reply!
One more thing i was wondering, since i'm building a custom speech UI. Can each player have a different color for the subtitle text?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to create conversations without choices?

Post by Tony Li »

It's not built in, unless you want to wrap each Dialogue Text in rich text codes or [em#] tags. For example:
  • Dialogue Text: "<color=red>Muahaha! I'm eeeevil!</color>"
But there are other ways to implement it very simply. You can add a script to the GameObject of each actor that uses OnConversationLine like this one:

ActorSubtitleColor.cs

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;

public class ActorSubtitleColor : MonoBehaviour {
    public Color subtitleColor;
    
    void OnConversationLine(Subtitle subtitle) {
        if (subtitle.speakerInfo.transform == this.transform) {
            subtitle.formattedText.text = "<color=" + Tools.ToWebColor(subtitleColor) + ">" + 
                subtitle.formattedText.text + "</color>";
        }
    }
}
Or, if you want to define the actor's color in the Actors tab of the Dialogue Editor by adding a custom field for each actor (e.g., "Color"), you can just add one script to the Dialogue Manager instead:

SubtitleColors.cs

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;

public class ActorSubtitleColor : MonoBehaviour {
    void OnConversationLine(Subtitle subtitle) {
        var color = DialogueLua.GetActorField(subtitle.speakerInfo.nameInDatabase, "Color").AsString;
        subtitle.formattedText.text = "<color=" + color + ">" + subtitle.formattedText.text + "</color>";
    }
}
LostTrainDude
Posts: 74
Joined: Wed Mar 21, 2018 2:14 pm

Re: How to create conversations without choices?

Post by LostTrainDude »

Hi!

Apologies if this is necroposting, but I wanted to point out that I'm having an issue, as I can't seem to Override Subtitles and\or Input settings properly.

I'm specifically referring to this:
Tony Li wrote: Fri May 19, 2017 3:58 pm If you only want this behavior for a specific conversation, instead of applying it globally, inspect your conversation in the Dialogue Editor. If you click on blank canvas space, it will show the conversation's properties in the inspector. There's an override checkbox where you can set the same kind of settings but just for that conversation.
Basically, most of my conversations are supposed to be forcing a Response Menu, but some of them are just one-liners told by the player (e.g. examining an item, the character would say something).

I am able to globally set this on and off in the Dialogue Manager prefab, but the specific conversation Override functions just don't seem to work (or at least the Input Settings one doesn't), apparently.
I'm not sure if there is something I'm doing wrong or not.

If it's of any use: I'm integrating Adventure Creator with Dialogue Manager.
Do you have any advice?

Thanks a lot in advance!
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to create conversations without choices?

Post by Tony Li »

Sorry, that's a bug. The conversation override for the Always Force Response Menu checkbox wasn't being observed. A patch is available on the Pixel Crushers customer download site. If you need access, please PM me your Unity Asset Store invoice number. The fix will also be in the next full release.
Post Reply