Announcement

Collapse
No announcement yet.

Blueprint Dialogue System

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Thanks, I forgot that you had done something very similar in the demo.
    Creating the child classes for UI_Dialogue and UI_Dialogue_TextItem was not a problem (with a little help from google). In the designer tab, I copy-pasted all the widgets from the parent classes and renamed them to avoid conflicts. Next I overrode the getter functions and referenced all the new widgets. So far, so good.
    However, during game play I noticed two issues.
    1)
    My UI_Dialogue child does not accept gamepad input. I am unable to advance or skip dialogue. The class is set to "Gamepad" under Class Defaults > Input. Mouse input works fine.
    Are there any more functions that need to be overridden for this to work?
    2)
    When I use my own UI_Dialogue_TextItem child class no text is displayed at all during gameplay. The dialogue window doesn't react to anything, not even the mouse.
    What could be the problem? Do I need to override any other functions inside the class beside the obvious GetTextControl?

    PS: Before I forget, some of the objects (most likely some of the materials) in your demo seem to be using the Substance plugin for Unreal Engine. It's giving me warning messages all the time. Maybe they can be replaced with something more common in the future.
    Last edited by fookur; 04-08-2016, 06:06 PM.

    Comment


      Originally posted by fookur View Post
      Thanks, I forgot that you had done something very similar in the demo.
      Creating the child classes for UI_Dialogue and UI_Dialogue_TextItem was not a problem (with a little help from google). In the designer tab, I copy-pasted all the widgets from the parent classes and renamed them to avoid conflicts. Next I overrode the getter functions and referenced all the new widgets. So far, so good.
      However, during game play I noticed two issues.
      1)
      My UI_Dialogue child does not accept gamepad input. I am unable to advance or skip dialogue. The class is set to "Gamepad" under Class Defaults > Input. Mouse input works fine.
      Are there any more functions that need to be overridden for this to work?
      2)
      When I use my own UI_Dialogue_TextItem child class no text is displayed at all during gameplay. The dialogue window doesn't react to anything, not even the mouse.
      What could be the problem? Do I need to override any other functions inside the class beside the obvious GetTextControl?

      PS: Before I forget, some of the objects (most likely some of the materials) in your demo seem to be using the Substance plugin for Unreal Engine. It's giving me warning messages all the time. Maybe they can be replaced with something more common in the future.
      Just guessing here but the Gamepad controls are handled in the tick event of the UI_Dialogue base class, so if you inherited from it, you might need to either copy that functionality or add a call to the parent tick function? Otherwise, the only setup needed is to set the input mode to gamepad, which you've done. The gamepad implementation is really basic though, there wasn't much I could do from UMG to deal with action and axis mapping so it's all hardcoded. In my own project, I place the input handling of my dialogues in 'unmanaged' and control it from the player controller instead for that reason.

      No, the only getter that needs to be dealt with in UI_Dialogue_TextItem is GetTextControl. The text is displayed through EventTick of that class, and the rest is fed in from UI_Dialogue. Try setting some breakpoints on the base text item class' tick and initialize event/functions to see if those are ever hit and what they're populated with. If you've overridden UI_Dialogue, make sure the tick is happening on the base class again and that all the proper getters are handled (like in the demo).

      Oh the substance plugin message is nonsense, I created the project with a version that had the plugin installed but I never used it, and now I can't get rid of the message.

      Comment


        Wonderful! I was able to solve both problems just by adding a call for the parent tick function to my derived classes of UI_Dialogue and UI_Dialogue_TextItem.
        I actually expected the events to be inherited by default, so I'm kind of surprised this was necessary. Be that as it may, at least now I can continue to work on the line-breaking fix.

        Just adding a SizeBox to my TextItem like this doesn't have the desired effect. The dialogue box starts scrolling almost immediately and all you see is empty lines. That can't be what you meant.
        Click image for larger version

Name:	textitem_custom.jpg
Views:	1
Size:	95.4 KB
ID:	1104117

        "The general idea is to create a new widget inheriting from the UI_Dialogue_TextItem widget and force the control to be it's full expected width when the initialization happens so that it can wrap around properly before starting to print out the text."
        Can you maybe put this in more idiot-proof terms for me?
        Last edited by fookur; 04-09-2016, 10:21 AM.

        Comment


          Originally posted by fookur View Post
          Wonderful! I was able to solve both problems just by adding a call for the parent EventTick on my derived classes of UI_Dialogue and UI_Dialogue_TextItem.
          I actually expected the events to be inherited by default, so I'm kind of surprised this was necessary. Be that as it may, at least now I can continue to work on the line-breaking fix.
          Great!

          Originally posted by fookur View Post
          Just adding a SizeBox to my TextItem like this doesn't have the desired effect. The dialogue box starts scrolling almost immediately and all you see is empty lines. Did I not understand you correctly?
          Yep, I fully expected that. You'll need to update the width from the graph just before the first letter is typed in (the initialize function), and you'll need to detect the expected size of the text field before hand. I've tried to solve this one myself, but had to drop it because I ran out of time. The problem is that the desired size isn't being reported accurately and it leaves ugly spaces:

          Click image for larger version

Name:	ForceSizeAttempt.JPG
Views:	1
Size:	144.5 KB
ID:	1104129

          That will get you to the ugly spaces (at least in 4.9), but using the WidgetReflector (Window->Developer Tools->Widget Reflector) I can see that the desired size reported is not the same as the desired size in the reflector

          Comment


            Aw dang, that's too bad. Sounds like a problem with the Unreal Engine itself.
            I hope you can solve this issue eventually. I mean if you can't do it nobody can... And until then, I don't see much sense in continuing work on my little project.

            (I was in the middle of rewriting parts of my last post just when you posted yours, but I guess that doesn't matter anymore. You answered all the questions I had.)

            Comment


              Massively impressed with this so far! Looking forward to playing about with it more and for future updates.

              Comment


                This works for me on Actors with a Static Mesh, but never on Actors with a Skeletal Mesh. Is there anything extra I need to do to get it working on Actors with Skeletal Meshes?

                Comment


                  Originally posted by FallenVagrant View Post
                  Massively impressed with this so far! Looking forward to playing about with it more and for future updates.
                  Thanks

                  Originally posted by FallenVagrant View Post
                  This works for me on Actors with a Static Mesh, but never on Actors with a Skeletal Mesh. Is there anything extra I need to do to get it working on Actors with Skeletal Meshes?
                  This has to do with the scanner's collision channel iirc (the visibility channel). The Character collision setup disables the visibility collision channel, it should work if you set the visibility to block on the character or mesh.

                  Comment


                    Originally posted by Grogger View Post
                    Thanks



                    This has to do with the scanner's collision channel iirc (the visibility channel). The Character collision setup disables the visibility collision channel, it should work if you set the visibility to block on the character or mesh.
                    Great, thanks mate! I managed to get it working in the end, but thanks for the quick reply.

                    I am seriously impressed with this; There's just something about creating and seeing a conversation progress, including various insults and Mum references... Ahh, nostalgia...

                    Comment


                      Hi Grogger

                      I was hoping you'd be able to point me in the right direction on something I'm trying to achieve using your awesome dialogue system...

                      So far, I've got a widget that takes the user input from a text box, and stores that text as a variable "PlayerName" in the FirstPersonCharacter Blueprint. This works, and I can see the output on-screen using Print Text or a text block in the widget.

                      What I'm trying to achieve is using that variable to populate a Script Interpreter variable within the Variables array, so it can be used in dialogue.

                      Here's what I've added to the Variables array:
                      Click image for larger version

Name:	ScriptInterpreter.PNG
Views:	1
Size:	18.7 KB
ID:	1104258

                      That works, and displays the placeholder "CHANGE NAME" in dialogue:

                      Click image for larger version

Name:	CHANGENAME.PNG
Views:	1
Size:	345.7 KB
ID:	1104262

                      Here's my custom event in the FirstPersonCharacter Blueprint, which I would've thought should set that variable, but I always get the "CHANGE NAME" value showing in the dialogue:

                      Click image for larger version

Name:	UpdatePlayerName.PNG
Views:	1
Size:	84.6 KB
ID:	1104259

                      Any ideas? Am I using the Set Variable function incorrectly? Do I need to run array actions on the array itself?


                      EDIT: Don't worry about it; I worked it out myself


                      Cheers

                      Fallen.
                      Last edited by AnarkiUK; 04-10-2016, 08:23 PM. Reason: Fixed it myself

                      Comment


                        Originally posted by FallenVagrant View Post
                        EDIT: Don't worry about it; I worked it out myself
                        Glad to hear it, because I only had guesses for that one; the setup seemed right to me.

                        Comment


                          Originally posted by Grogger View Post
                          Glad to hear it, because I only had guesses for that one; the setup seemed right to me.
                          For the sake of anybody else that might have the same confusion as I did when trying to achieve this, here's what I did:
                          • Instead of spawning the BP Script Interpreter Actor in the Game Mode's BeginPlay event, I created a custom event on the FirstPersonCharacter BP (which is triggered by the submit button being clicked on the widget - see video below if you want to see what I mean), which sets the "PlayerName" variable, then spawns the BP Script Interpreter Actor, and creates a variable referencing it:
                            Click image for larger version

Name:	CharacterBP.PNG
Views:	1
Size:	152.8 KB
ID:	1104308
                          • On the child of BPC Dialogue, override the GetScriptInterpreter function so it uses the new BP Script Interpreter reference variable
                          • In BP_ScriptInterpreter, on the BeginPlay event (after it's spawned by the FirstPersonCharacter BP), set the variable created on the Variables array to be the value of the PlayerName variable:
                            Click image for larger version

Name:	BP_ScriptInterpreter.PNG
Views:	1
Size:	75.2 KB
ID:	1104309


                          Here's a very simple demonstration of what it looks like (not very pretty, but just testing features at the moment):
                          https://youtu.be/H4Z2gbtcJxE

                          Hope this helps!

                          Cheers

                          Fallen.

                          Comment


                            Hello again! Excuse me, I have a question.

                            Let's say I put a dialogue component on an NPC and the player talks to that NPC, starting the dialogue. Is there a way to check for that in the NPC's blueprint? Suppose my NPC is walking around and I want him to stop and turn to the player when engaged in conversation -- how would I go about doing that?

                            I could probably manage it through the dialogue's scripting using blueprint interfaces, but it would be simpler if I could do it from inside the NPC instead.

                            For the tenth/hundredth time, thank you for this. Buying it was a lifesaving move for my project, and things have been going very smoothly.
                            I'm an artist! Check out my work at https://cinebst.wixsite.com/cinebeastart and hit me up!

                            You can e-mail me at cinebst@gmail.com.

                            Comment


                              Originally posted by Cinebeast View Post
                              Hello again! Excuse me, I have a question.

                              Let's say I put a dialogue component on an NPC and the player talks to that NPC, starting the dialogue. Is there a way to check for that in the NPC's blueprint? Suppose my NPC is walking around and I want him to stop and turn to the player when engaged in conversation -- how would I go about doing that?

                              I could probably manage it through the dialogue's scripting using blueprint interfaces, but it would be simpler if I could do it from inside the NPC instead.

                              For the tenth/hundredth time, thank you for this. Buying it was a lifesaving move for my project, and things have been going very smoothly.

                              Hi Cinebeast, I'm glad to hear things are working smoothly!


                              To answer your question, there are a few ways I can think of to do this.
                              1. One way to do this is by checking if the ActiveUI variable on the BPC_Dialogue is valid. If it is valid, then that specific dialogue component is active.
                              or
                              2. For a global solution that can tell if any dialogue is opened, you can add the BPI_DialogueAware interface on your PlayerController.
                              This interface adds two functions: DialogueOpened and DialogueClosed (These functions will automatically be called by the dialogue component, so there's no need to call yourself)
                              When the dialogue is opened, the DialogueOpened event is called, and you can keep a reference however you want to keep track of it. DialogueClosed is, of course, called when the dialogue is finally exited.

                              Hope this helps

                              Comment


                                Originally posted by Grogger View Post
                                Hope this helps
                                Sorry for not responding sooner. Yes, this helped! I've set up a system that works reliably well now.
                                I'm an artist! Check out my work at https://cinebst.wixsite.com/cinebeastart and hit me up!

                                You can e-mail me at cinebst@gmail.com.

                                Comment

                                Working...
                                X