Announcement

Collapse
No announcement yet.

Blueprint Dialogue System

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

    Hey Grogger, I just want to let you know, the awesome support you've been providing in this thread is one of the big reasons that I'm making your dialogue system my first marketplace purchase (despite the - for me, as a hobbyist - pretty hefty cost). Keep rocking.

    Comment


      Originally posted by jholden42 View Post
      Hey Grogger, I just want to let you know, the awesome support you've been providing in this thread is one of the big reasons that I'm making your dialogue system my first marketplace purchase (despite the - for me, as a hobbyist - pretty hefty cost). Keep rocking.
      Hi JHolden, thanks for letting me know! It's nice to hear

      Comment


        So I'm really enjoying working with this so far, it hasn't been too painful to mod and it's way cleaner than what I could've come up with.

        I do have one quick question, if you don't mind; I'm trying to implement keyboard control for dialogue screens, specifically E to advance text, and arrow keys to select responses when the dialogue branches. For the former I've gotten partway there by using UMG's OnKeyEnabled function:

        Click image for larger version

Name:	MouseBlueprint.png
Views:	1
Size:	47.1 KB
ID:	1092243

        However, I was wondering if you'd be able to give me some suggestions on how to directly tie action mappings from the project's Input settings to the appropriate events in your system? Since UI_Dialogue is a UMG widget it doesn't appear to be possible to directly run Input Action events on its graph, and I'm rather lost on how else I could be going about this.

        Comment


          Originally posted by HInoue View Post
          So I'm really enjoying working with this so far, it hasn't been too painful to mod and it's way cleaner than what I could've come up with.

          I do have one quick question, if you don't mind; I'm trying to implement keyboard control for dialogue screens, specifically E to advance text, and arrow keys to select responses when the dialogue branches. For the former I've gotten partway there by using UMG's OnKeyEnabled function:

          [ATTACH=CONFIG]63685[/ATTACH]

          However, I was wondering if you'd be able to give me some suggestions on how to directly tie action mappings from the project's Input settings to the appropriate events in your system? Since UI_Dialogue is a UMG widget it doesn't appear to be possible to directly run Input Action events on its graph, and I'm rather lost on how else I could be going about this.
          I've been doing this in the player controller. In the sample file BP_DialogueSample_PlayerController I use the DialogueClosed/Opened interface functions to track when a dialogue is being viewed, and in your case you'll want to capture the action input event and call the current dialogue's OnClickZoneClicked function...that function name could have been better :P

          Comment


            Hmm okay- not to be dense, but assuming I'm doing this from the character blueprint, how would I actually go about getting a reference to the current dialogue?

            Comment


              Originally posted by HInoue View Post
              Hmm okay- not to be dense, but assuming I'm doing this from the character blueprint, how would I actually go about getting a reference to the current dialogue?
              No worries!

              The file I mentioned (BP_DIalogueSample_PlayerController) implements the DialogueAware interface which has the DialogueOpened/Closed events. Those events pass along a reference to the dialogue UI, so you can keep it in a variable on your player controller. In the sample, I only use those events to set a flag of viewing an interface or not, but in your case, you'll want to store a reference to the interface so that you can interact with it.

              Comment


                Ooh I see what you're getting at, sorry for being dense.

                My project's in C++, so I'm trying to minimize the number of objects that need blueprint, and I had a slight idea about how to do it without an external event: I use the same key to start a conversation, and to advance the dialogue to the next line, so I tried modifying the event which my system uses to start dialogues. This is in my override of BPC_Dialogue, so it should already have a reference to the active UI. My addition is highlighted in yellow:

                Click image for larger version

Name:	Idea.png
Views:	1
Size:	128.0 KB
ID:	1092245

                This starts conversations fine, but it won't advance them; is my reasoning correct that if OwnerHasActiveDialogues is true, Active UI should contain a reference to the current UI? The only reason I could think this wouldn't work is if for some reason OwnerHasActiveDialogues doesn't return true when I think it does.

                Comment


                  Originally posted by HInoue View Post
                  Ooh I see what you're getting at, sorry for being dense.

                  My project's in C++, so I'm trying to minimize the number of objects that need blueprint, and I had a slight idea about how to do it without an external event: I use the same key to start a conversation, and to advance the dialogue to the next line, so I tried modifying the event which my system uses to start dialogues. This is in my override of BPC_Dialogue, so it should already have a reference to the active UI. My addition is highlighted in yellow:


                  This starts conversations fine, but it won't advance them; is my reasoning correct that if OwnerHasActiveDialogues is true, Active UI should contain a reference to the current UI? The only reason I could think this wouldn't work is if for some reason OwnerHasActiveDialogues doesn't return true when I think it does.
                  I can see this maybe working, but I can imagine problems when a conversation works its way through several ui's or Dialogue components, or if the event interaction calls someone else.

                  Have you put some breakpoints down to see how far it gets in the blueprint code? The events might not be triggered at all: By default in Keyboard & Mouse mode, the dialogue component puts the game in UI Only input mode. You'd need to place it in Input mode 'Unmanaged', but then you'll need handle managing the mouse and keyboard events yourself.

                  Comment


                    This is unrelated, but the entire system spontaneously broke overnight; it worked last time I loaded unreal, and now for some reason it won't load dialogue windows at all. Do you know if the error "Player controller invalid while in BPC_Dialogue_Base: DisplayUI" is used anywhere besides DisplayUI? I've verified that DisplayUI is wired correctly, and deleted the link to that error message, and it still plays every time I try to open a dialogue, so I assume it's used somewhere else in the code.

                    Comment


                      Originally posted by HInoue View Post
                      This is unrelated, but the entire system spontaneously broke overnight; it worked last time I loaded unreal, and now for some reason it won't load dialogue windows at all. Do you know if the error "Player controller invalid while in BPC_Dialogue_Base: DisplayUI" is used anywhere besides DisplayUI? I've verified that DisplayUI is wired correctly, and deleted the link to that error message, and it still plays every time I try to open a dialogue, so I assume it's used somewhere else in the code.
                      That's the only place the message exists

                      Comment


                        I don't know what happened there, rolling back to an earlier backup fixed it fine. Anyway, I hate to keep beleaguering the same point, but if I'm not doing this through OwnerHasActiveDialogues, is there an obvious way to check whether a dialogue is in progress inside of BPC_Dialogue? All I need to do is execute a check somewhere, and effectively say "If the dialogue window is open, the interact key calls OnClickZoneClicked. If it's not open yet, open a new dialogue and set the initial branch".

                        Comment


                          Originally posted by HInoue View Post
                          I don't know what happened there, rolling back to an earlier backup fixed it fine. Anyway, I hate to keep beleaguering the same point, but if I'm not doing this through OwnerHasActiveDialogues, is there an obvious way to check whether a dialogue is in progress inside of BPC_Dialogue? All I need to do is execute a check somewhere, and effectively say "If the dialogue window is open, the interact key calls OnClickZoneClicked. If it's not open yet, open a new dialogue and set the initial branch".
                          The Dialogue Component should know if it is managing a visible dialogue UI (OwnerHasActiveDialogues checks to see if the owning actor has any other dialogue components too), so yes, the logic should work if the code you took a screenshot of is executed.
                          I wouldn't be surprised if the code is not executed though, because the dialogue places the input mode into UI Only.

                          Comment


                            It would work if it was in Unmanaged mode, right? I've been using that anyway, since I manage locking/unlocking movement and camera elsewhere, and wanted to keep keyboard inputs during conversations.

                            Comment


                              Originally posted by HInoue View Post
                              It would work if it was in Unmanaged mode, right? I've been using that anyway, since I manage locking/unlocking movement and camera elsewhere, and wanted to keep keyboard inputs during conversations.
                              It should, as far as I can tell from here. You might need to step through it to make sure though, if it's not working.

                              Comment


                                Stepping through the macro, it looks like it doesn't behave as expected: regardless of whether there are other dialogues active, it always follows the same flow:

                                Click image for larger version

Name:	Flow.png
Views:	1
Size:	160.9 KB
ID:	1092291

                                Comment

                                Working...
                                X