Positioning UI on each DialogueEntry

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
shinzironine
Posts: 3
Joined: Thu Jul 05, 2018 1:46 am

Positioning UI on each DialogueEntry

Post by shinzironine »

Hi, first of all thank you for such a great dialogue system, I really enjoy using it.
Sorry if this topic was already discussed - couldn't find an answer.
So, I explore the possibility of positioning the dialogue UI above the speaker's head during each dialogue entry.
I see that you can do that with DialogueSystemEvents OnCovnersationLine event, but is it possible with Response menu (OnCoversationResponseMenu)? The parameters in that method are Response[], where I can not find the transform of the speaker. The static calls to DialogueManager.CurrentConversant do not seem to change during conversation line changes.
BTW, my goal is to make something resembling the comic-book stile bubbles.
Thanks!
shinzironine
Posts: 3
Joined: Thu Jul 05, 2018 1:46 am

Re: Positioning UI on each DialogueEntry

Post by shinzironine »

Also, is it possible to link unique events to a conversation? E.g. I want to start a battle when conversation "Dialogue1" ends or is cancelled. So I want something like a possibility to mark a conversation as triggering a battle. One idea that i currently have is by convention, so that battle conversation is called like "Battle", and then in Dialoge events check the string name on contains.
User avatar
Tony Li
Posts: 22059
Joined: Thu Jul 18, 2013 1:27 pm

Re: Positioning UI on each DialogueEntry

Post by Tony Li »

Hi,

Thanks for using the Dialogue System!
shinzironine wrote: Thu Jul 05, 2018 1:51 amI explore the possibility of positioning the dialogue UI above the speaker's head during each dialogue entry.
There are two ways to approach this.

1. Assign custom overhead panels to each character. On each character:
  • Add a Dialogue Actor component.
  • Set Dialogue UI Settings > Subtitle Panel Number to Custom.
  • Assign an overhead style subtitle panel prefab to the Custom Subtitle Panel field. You can start with Dialogue System / Prefabs / Standard UI Prefabs / Templates / Bubble / Bubble Template Standard Subtitle Panel.
  • On the player, set Menu Panel Number to Custom and assign an overhead style menu panel prefab such as Bubble Template Standard Menu Panel.
  • Adjust the Dialogue Actor component's Y offset values if the bubbles are too high or too low.
  • Once you've confirmed that this is working, you can make custom prefabs to replace the bubble templates.
2. Use one panel and move it to each actor. Use OnConversationLine like you described. In OnConversationResponseMenu, the Subtitle parameter is the subtitle of the last character who spoke. So if The Joker just spoke, and now Batman must choose a response, the subtitle's speakerInfo.transform will point to The Joker.

If you only have one player, the player actor is usually assigned to DialogueManager.currentActor. So if you want to position the menu above the player instead of The Joker, use DialogueManager.currentActor.

shinzironine wrote: Thu Jul 05, 2018 2:00 amAlso, is it possible to link unique events to a conversation? E.g. I want to start a battle when conversation "Dialogue1" ends or is cancelled. So I want something like a possibility to mark a conversation as triggering a battle. One idea that i currently have is by convention, so that battle conversation is called like "Battle", and then in Dialoge events check the string name on contains.
Here are some other ideas:
  • Define a Dialogue System variable named StartBattle. In a dialogue entry node in the conversation, use the Script field's "..." dropdown to set StartBattle true. At the end of the conversation, check if StartBattle is true (for example, using DialogueLua.GetVariable("StartBattle").AsBool and then set it false. If you want to do this without scripting:
    • Add a Dialogue System Trigger component to the Dialogue Manager.
    • Set the Trigger to OnConversationEnd.
    • In the Condition section, check if StartBattle is true.
    • In the Action section, set StartBattle back to false, and start the battle -- for example, use the UnityEvent action to connect it to your own script.
  • You could add a custom field to the Conversation template. Call it Battle, and set the Type to Boolean. When writing a Battle conversation, set this field true. When the conversation is done, check DialogueLua.GetConversationField(DialogueManager.lastConversationStarted, "Battle").AsBool.
  • Or register a Lua function or use the SendMessage() sequencer command to call a method in one of your scripts.
shinzironine
Posts: 3
Joined: Thu Jul 05, 2018 1:46 am

Re: Positioning UI on each DialogueEntry

Post by shinzironine »

Hi Tony,
Thank you for such a detailed answer.
I will implement with some of the ways that you've provided. I am pretty confident that the approaches that you've described will work.
Thanks!
Post Reply