Setting up dialogue text which floats above the participant in Conversations?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
CarterG81
Posts: 4
Joined: Thu Jan 22, 2015 8:24 am

Setting up dialogue text which floats above the participant in Conversations?

Post by CarterG81 »

It's been awhile since I last used Dialogue System, and I've been trying to relearn it all.



I have normal conversations, where NPC's make statements and ask questions, then the player chooses a response. However, I dislike the typical way conversations are handled (Skyrim / Mass Effect style / RPG style).



Instead, my game is a lot simpler. It has a few lines of back/forth dialogue between NPC's and the Player, represented by floating text above their head. This works perfectly as Barks, except that I need the power of conversations and player responses.



Basically, I am wanting to use Conversations (not Barks?) but where the dialogue appears over the speaker's head just like barks, like this:



http://www.gameinformer.com/cfs-filesys ... _610x0.png



But then when the Player needs to make a response, the response buttons appear over their head, kindof like this:



http://oyster.ignimgs.com/mediawiki/api ... s4-115.jpg







I imagine the buttons and PC subtitle line are easy to do, since the player is always in the center of the screen. (Although I'm not sure exactly yet, I assume this would be easy).



However, is there an easy way (or an example in Dialogue System) for the NPC Subtitle Line to appear over the speaking NPC's head? The NPC's will be at any location (or even moving around) so it can't be a fixed location. I was trying to use the Unity UI (4.6) which doesn't allow me to parent the NPC Subtitle Line to the NPC itself because all UnityUI has to be a child of CANVAS. Plus that would be an issue with multiple NPC conversants.







If there is a quick and easy way to do this, I'd appreciate it. Otherwise, I imagine I'll have to make some scripts to move around the NPC Subtitle Line during runtime based on the NPC current transform.



Alternatively, is there an easy way to make all dialogue in a conversation, simply Barks? (Besides the player response buttons). Any approach to make this quick/easy is welcome.







When I set this up in Behavior Designer using Barks (and no player responses) it worked and looked perfectly, very easy to setup. However, the conversations are powerful so I'd prefer to use them (and not Behavior Designer) to handle the entire conversation this way.
User avatar
Tony Li
Posts: 20989
Joined: Thu Jul 18, 2013 1:27 pm

Setting up dialogue text which floats above the participant in Conversations?

Post by Tony Li »

Hi,



The BarkDialogueUI will get you halfway there. It displays subtitles using the actor's bark UI. But it automatically chooses the first player response instead of showing the response menu.



For your case, create a subclass of your regular dialogue UI (e.g., UnityDialogueUI for legacy, UnityUIDialogueUI for the new UI). Replace the ShowSubtitle() method with the lines from BarkDialogueUI.cs. (You can grab BarkDialogueUI.cs from the SourceCode.unitypackage located in the Scripts folder.)



Consider using the new Unity UI. You can set up a world space canvas for the player response menu and attach it to the player. The Response Panel doesn't have to be located in the same screen space canvas the main dialogue UI stuff. This way the response menu will follow the character around.



Also, as a side note, if you plan to add a typewriter effect to your bark UI, download patch 1.4.4a from the Pixel Crushers customer download site. This patch deactivates and reactivates the bark UI when showing bark text, which will trigger the typewriter effect. If you need access, email me at tony (at) pixelcrushers.com.



Another dev took a slightly different approach that also worked well. Instead of using bark UIs, he added a world space "NPC Response Panel" to each character. A short script implements OnConversationStart to point the dialogue UI to the right panel. The process is described in the last post of this thread.


CarterG81
Posts: 4
Joined: Thu Jan 22, 2015 8:24 am

Setting up dialogue text which floats above the participant in Conversations?

Post by CarterG81 »

Thanks for the help. I didn't know I could have multiple Canvases for UnityUI, that helped a lot.



edit: problem fixed, I forgot to override
CarterG81
Posts: 4
Joined: Thu Jan 22, 2015 8:24 am

Setting up dialogue text which floats above the participant in Conversations?

Post by CarterG81 »

Nevermind, it was a newbie mistake. Here, it works now:











using PixelCrushers.DialogueSystem;



public class UnityUIDialogueUI_MyUI : UnityUIDialogueUI

{

public override void ShowSubtitle(Subtitle subtitle)

{

StartCoroutine(BarkController.Bark(subtitle));

}



}











Thank you very much :)
User avatar
Tony Li
Posts: 20989
Joined: Thu Jul 18, 2013 1:27 pm

Setting up dialogue text which floats above the participant in Conversations?

Post by Tony Li »

Glad it's working now! BTW, Away Mission is looking good! When you get a website up for it (or did I miss it?), please feel free to post a link to this forum.
CarterG81
Posts: 4
Joined: Thu Jan 22, 2015 8:24 am

Setting up dialogue text which floats above the participant in Conversations?

Post by CarterG81 »

Thank you very much :)



Whenever I have enough to show (or a finished website) I will post it :)



I did run into one problem just now- After each bark (line of conversation) it immediately goes on to the next (Player's Response, Spams multiple lines of dialogue one after another, etc.). Is there a way to put in a delay after a conversation node, before it continues on to the next?



Also, is there an easy way for me to make the bark disappear once a new bark is spoken? (The player's barks don't disappear when he responds, so I have to wait for the bark to fade away before clicking a response button, or when two barks are stated they overlap).



I probably missed this stuff in the documentation, but it's taking me a bit to find it.
User avatar
Tony Li
Posts: 20989
Joined: Thu Jul 18, 2013 1:27 pm

Setting up dialogue text which floats above the participant in Conversations?

Post by Tony Li »

3676 wrote: After each bark (line of conversation) it immediately goes on to the next (Player’s Response, Spams multiple lines of dialogue one after another, etc.). Is there a way to put in a delay after a conversation node, before it continues on to the next?


Every node does two things: (1) calls ShowSubtitle(), and (2) runs the sequence defined in the node's Sequence field (or the Dialogue Manager's Default Sequence if the Sequence field is blank). It will then wait until the sequence is done before progressing to the next line. Try setting the Dialogue Manager's Default Sequence to:

Delay({{end}})

The special keyword "{{end}}" is based on the length of the subtitle and the Dialogue Manager's "Subtitle Chars Per Second". If the subtitle is 90 characters and "Subtitle Chars Per Second" is 30, {{end}} is 3 seconds (90 / 30 = 3).



There's a gotcha, though. In v1.4.3 and earlier, bark UIs also play the sequence, which will cause UnityUIDialogueUI_MyUI to play it twice. Import v1.4.4 if you're on a lower version, and call BarkController.Bark(subtitle, true) instead. The "true" tells the bark controller to skip the sequence.



3676 wrote: Also, is there an easy way for me to make the bark disappear once a new bark is spoken?


New barks should override old ones so only the most recent bark is shown. Is it not happening like this in your scene? Does the example scene in Scripts/Supplemental/UI/Example work? The NPC named "Sergeant Graves" barks when you interact with him. If you hit spacebar multiple times in a row, his old barks should disappear and get replaced with the latest bark.
Post Reply