Announcement

Collapse
No announcement yet.

Blueprint Dialogue System

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

    That is indeed very likely, because in my GetScriptInterpreter I get this note:
    Click image for larger version

Name:	ue4_castproblem.jpg
Views:	1
Size:	123.1 KB
ID:	1103784
    The note didn't make any sense to me and when I converted this into a pure cast it just went away, so I ignored it.
    I have no idea why the cast would fail. The return node that it seems to be asking for is right there, isn't it?

    Edit: I took another look at a completely unaltered version of your Demo Project. When I click "Compile" inside your BPC_Demo_Topic the same blue note appears under the "Cast to BP_SampleDialogueGameMode" node in the GetScriptInterpreter function. However, the demo level appears to be working just fine after that, even though the note says "cast failed".
    Last edited by fookur; 04-03-2016, 04:12 PM.

    Comment


      Originally posted by fookur View Post
      That is indeed very likely, because in my GetScriptInterpreter I get this note:
      [ATTACH=CONFIG]86777[/ATTACH]
      The note didn't make any sense to me and when I converted this into a pure cast it just went away, so I ignored it.
      I have no idea why the cast would fail. The return node that it seems to be asking for is right there, isn't it?

      Edit: I took another look at a completely unaltered version of your Demo Project. When I click "Compile" inside your BPC_Demo_Topic the same blue note appears under the "Cast to BP_SampleDialogueGameMode" node in the GetScriptInterpreter function. However, the demo level appears to be working just fine after that, even though the note says "cast failed".
      Aye, the cast will never fail in the demo, it's always going to be that game mode type (it should maybe be converted to a pure get or handle the failed return case just to alleviate confusion).
      If you are still having problems, make sure to walk through your code with some breakpoints and see what's happening to your script interpreter instance (eg. is it spawned at the right time, is your game mode cast failing, is the variable null at the time of get).

      Comment


        Yes, I've tried using break points already, but they were of no help. Everything seems to work fine, only the variables are not getting through.
        I decided to upload you a little demonstration video, because I couldn't think of anything else to do. Maybe you'll notice something off.
        https://youtu.be/tkbmOzQ19tg
        It's your own demo level, but the error is the same as in my game.

        Comment


          Originally posted by fookur View Post
          Yes, I've tried using break points already, but they were of no help. Everything seems to work fine, only the variables are not getting through.
          I decided to upload you a little demonstration video, because I couldn't think of anything else to do. Maybe you'll notice something off.
          https://youtu.be/tkbmOzQ19tg
          It's your own demo level, but the error is the same as in my game.
          Thanks for the vid fookur. I believe what's going on is the way the bpc demo topic was created is as a reference to a component (which is reference to none by default). To create a component, you'd either need to construct one manually (construct object node), or by adding it as a component (using the "Add Component").

          Comment


            Okay, I added my BPC Dialogue child via "Add Component" to both my ItemBP and my PlayerBP and it works perfectly now. I can breathe again. Thank you very much for your support.
            Also, I should probably mention that you were right earlier about variables not working on row 0 of the data table. You HAVE to create an empty first line and silence it. Otherwise the first line of dialogue will always be shown, regardless of the condition. Definitely sounds like something that should be fixed, or at least mentioned somewhere.

            Now I can get back to figuring out how to fix that nasty mid-word line breaking. (Yes, I am that guy from Youtube.)
            Last edited by fookur; 04-04-2016, 02:33 AM.

            Comment


              Originally posted by fookur View Post
              Okay, I added my BPC Dialogue child via "Add Component" to both my ItemBP and my PlayerBP and it works perfectly now. I can breathe again. Thank you very much for your support.
              Also, I should probably mention that you were right earlier about variables not working on row 0 of the data table. You HAVE to create an empty first line and silence it. Otherwise the first line of dialogue will always be shown, regardless of the condition. Definitely sounds like something that should be fixed, or at least mentioned somewhere.
              I'm glad it's resolved and thank you for the confirmation on that bug - I've made a note/ticket about it

              Originally posted by fookur View Post
              Now I can get back to figuring out how to fix that nasty mid-word line breaking. (Yes, I am that guy from Youtube.)
              Haha, I wish you success! The new update isn't out yet (waiting on Marketplace team), but I've exposed some functionality that should make it easier to inherit the UI_TextItems (along with many other fixes/features) if you cared to wait for it.

              Comment


                Originally posted by Grogger View Post
                Yep, that's how conditions are supposed to work. One gotcha though is that if the variable isn't set before the condition runs, the script will assume it is a string (and a string is not 0 or "false", making it evaluate to true), this might be what you're encountering.

                In the new version I've submitted to epic (I'll have update notes soon), there's a new intrinsic function called "IsValid" to test if a variable exists, so you could put in your condition: IsValid(my@variable) && my@variable == false
                Keep me posted if this worked or not

                PS: Sorry for the delay in responding btw, this thread doesn't update me anymore for some reason!
                Hey!

                Thanks I figured it out. Great job on updating this by the way!

                Comment


                  Is there a way to ask if an NPC is currently inside the player's UseScanner range of view?
                  I would like to do this from inside the NPC, and then fire off some nodes to spawn an indicator arrow above the NPC's head. Just to indicate that they can be talked to. And when the player walks away the arrow disappears.
                  There is no "OnEnterScannerRange" or "OnLeaveScannerRange" trigger for the NPC to use, right? Then what's the ideal way to do this?

                  The way this is done in the demo doesn't work too well in this case. Because A) I have to also tell the indicator to vanish as soon as the Usable gets out of range, and B) I want to spawn the indicator at the location of a certain dummy anchor component inside the NPC, so it always appears exactly where I want it.

                  Comment


                    Originally posted by fookur View Post
                    Is there a way to ask if an NPC is currently inside the player's UseScanner range of view?
                    I would like to do this from inside the NPC, and then fire off some nodes to spawn an indicator arrow above the NPC's head. Just to indicate that they can be talked to. And when the player walks away the arrow disappears.
                    There is no "OnEnterScannerRange" or "OnLeaveScannerRange" trigger for the NPC to use, right? Then what's the ideal way to do this?

                    The way this is done in the demo doesn't work too well in this case. Because A) I have to also tell the indicator to vanish as soon as the Usable gets out of range, and B) I want to spawn the indicator at the location of a certain dummy anchor component inside the NPC, so it always appears exactly where I want it.
                    There are two event dispatches you could register to on the UseScanner: NewUsableDetected and UsableLost. I handle this in the player controller or the hud class and then I deal with the 'usable' actor in a game specific way from there.

                    Comment


                      The New Update is now available on the marketplace
                      NOTE: There is a breaking change in this release. It is minor and quick enough to fix (have a look at the sample dialogue UI and notice the vertical box replaces the previous wrap box)

                      Comment


                        Originally posted by NKGriever View Post
                        Hey!

                        Thanks I figured it out. Great job on updating this by the way!
                        Glad to hear it, and thanks! (The update is available now btw)

                        Comment


                          Originally posted by Grogger View Post
                          There are two event dispatches you could register to on the UseScanner: NewUsableDetected and UsableLost. I handle this in the player controller or the hud class and then I deal with the 'usable' actor in a game specific way from there.
                          I'm really sorry to say that even though I greatly appreciate your continuous support, I didn't understand most of that. So after spending two evenings learning about Event Dispatchers (because I had no idea what they were, and I'm still confused about them) I tried to get this to work by myself.
                          And now this is happening inside my NPC's blueprint for some reason when I'm trying to bind the indicator spawn event to the dispatcher. I'm sure I'm again just missing something really obvious here due to my lack of experience.
                          Click image for larger version

Name:	dispatcher.jpg
Views:	1
Size:	263.7 KB
ID:	1103980

                          Also, you mentioned that with 1.3 it would become much easier to fix the jumping words issue. Could you maybe elaborate on that?
                          If I remember correctly I should be able to set the maximum width of the text box somewhere, so the line can foresee where it's going to end before it happens.
                          Last edited by fookur; 04-06-2016, 07:48 PM.

                          Comment


                            Originally posted by fookur View Post
                            I'm really sorry to say that even though I greatly appreciate your continuous support, I didn't understand most of that. So after spending two evenings learning about Event Dispatchers (because I had no idea what they were, and I'm still confused about them) I tried to get this to work by myself.
                            And now this is happening inside my NPC's blueprint for some reason when I'm trying to bind the indicator spawn event to the dispatcher. I'm sure I'm again just missing something really obvious here due to my lack of experience.
                            Hi Fookur,

                            The reason you're getting that issue is because the signature of the EventDispatcher expects an actor parameter. What you can do to have the engine figure out the signature for you is drag out from the square "Event" node from the dispatcher and find the "Add Custom Event". This should automatically create the new event for you (which you can rename).

                            On that topic, the event dispatch only needs to be registered once, so you wouldn't want to "Bind" on every tick/frame, binding in the begin play might work for you instead.


                            Originally posted by fookur View Post
                            Also, you mentioned that with 1.3 it would become much easier to fix the jumping words issue. Could you maybe elaborate on that?
                            If I remember correctly I should be able to set the maximum width of the text box somewhere, so the line can foresee where it's going to end before it happens.
                            In v1.3, I've exposed the class types in the UI_Dialogue for the text, response, and inline image items. This is helpful because you can create your UI_TextItem derived class and easily tell your UI to use it (in previous version, you would have had to override all of the functions to do the same).

                            Click image for larger version

Name:	blueprint_dialogue_1_3_exposed.JPG
Views:	1
Size:	60.7 KB
ID:	1103985

                            The maximum width deal is more of a UMG issue/decision, you'll want to create your custom UI_TextItem with the functionality you're looking for. In your case, you'll want to make the UI_TextItem aware of it's final size and force it's width (probably with a SizeBox) once the item has been initialized.
                            Last edited by Grogger; 04-07-2016, 03:06 PM. Reason: not construction script, begin play

                            Comment


                              Ah yes, BeginPlay. That does indeed work. Thank god. Only now when the dialogue ends and the box closes, the indicator does not reappear above the NPC's head. (Not until he reenters the UseScanner range.) There doesn't seem to be a dispatcher for that, so is there any other way I can tell the arrow to reappear once the dialogue window has closed? Preferably from inside the NPC's blueprint so it's all in one place.

                              I was happy to see how just clicking the plus button next to the dropdown menu (as seen on your screen shot) creates a child of the original UI_TextItem. That was easy enough. However, from that point on, I was completely lost once again. I tried talking to my NPC and received this error message:
                              Error Blueprint Runtime Error: Accessed None trying to read property CallFunc_GetTextControl_Control from function: 'ExecuteUbergraph_UI_Dialogue_TextItem' from node: SetText (Text) in graph: EventGraph in object: UI_Dialogue_TextItem
                              Then I realized the UI_TextItem child didn't even have a text widget, but only an empty canvas. So I added one, but it did nothing for me. I tried a couple more things today, but no, nothing worked. This isn't as easy as I thought it would be. I hoped that creating a child of UI_TextItem, and throwing its text widget into a SizeBox, and assigning a width to that would do the trick, but there seems to be a lot more to it.

                              Originally posted by Grogger View Post
                              you'll want to make the UI_TextItem aware of it's final size and force it's width (probably with a SizeBox) once the item has been initialized.
                              That almost sounds like I also have to change some things in the graph tab...

                              Comment


                                Originally posted by fookur View Post
                                Ah yes, BeginPlay. That does indeed work. Thank god. Only now when the dialogue ends and the box closes, the indicator does not reappear above the NPC's head. (Not until he reenters the UseScanner range.) There doesn't seem to be a dispatcher for that, so is there any other way I can tell the arrow to reappear once the dialogue window has closed? Preferably from inside the NPC's blueprint so it's all in one place.

                                I was happy to see how just clicking the plus button next to the dropdown menu (as seen on your screen shot) creates a child of the original UI_TextItem. That was easy enough. However, from that point on, I was completely lost once again. I tried talking to my NPC and received this error message:
                                Error Blueprint Runtime Error: Accessed None trying to read property CallFunc_GetTextControl_Control from function: 'ExecuteUbergraph_UI_Dialogue_TextItem' from node: SetText (Text) in graph: EventGraph in object: UI_Dialogue_TextItem
                                Then I realized the UI_TextItem child didn't even have a text widget, but only an empty canvas. So I added one, but it did nothing for me. I tried a couple more things today, but no, nothing worked. This isn't as easy as I thought it would be. I hoped that creating a child of UI_TextItem, and throwing its text widget into a SizeBox, and assigning a width to that would do the trick, but there seems to be a lot more to it.


                                That almost sounds like I also have to change some things in the graph tab...
                                Yep, you need to go into the graph and override the Getters when inheriting from UI_Dialogue (check out the functions in the demo sample UI on how to do this). Inheriting UMG is sadly not a trivial thing, you need to create the new UI and tell the getters who the widgets are so the rest of the UI functions can know what to affect.

                                Comment

                                Working...
                                X