Blueprint Dialogue System

Hi, thanks for this quick reply, Grogger.

I’m trying to figure both way to do it, like that I’m sure I could do it in anyway possible… And to understand how it works.

So, I created a simple Triggerbox, then like any other blueprint, and I added a dialogue component… But the regular “Press ‘E’ to interact” dosen’t show up. I was thinking about creating an invisible mesh with no collision but I don’t think it’ll work either and… Probabnly it’s not a good way to do it.

And for the other method, I’m still trying to figure how I could make it works on a level blueprint. I’ve managed to find how to have the "Set State’ (Target is BPC dialogue) buuut… I don’t know if it’s good or not.

I have a lot of things to learn about this dialogue system I guess. And the documentation is pretty complicated for me… My apologies for my lack of knowledge, I’m just trying to make simple things and I can’t really figure how that’s work.
I have no more problems with the system itself otherwise. And, like I remembered, it’s great. :smiley:

If you go the route of using a built-in trigger box, you’ll need to use the Level Blueprint to call SetState on it (and you’ll need to use the Get components Function to find the BPC_Dialogue component you’ve placed on your trigger box, since the level blueprint doesn’t know that this specific trigger box has that component).

The other method would be a new Blueprint class with your BPC_Dialogue component and a collision volume with the overlap event triggering the SetState function.

The “Press E” message only shows up when the BPC_UseScanner detects an actor on the Visibility trace channel (assuming it’s been configured correctly), but trigger boxes are ignored on this trace channel, so it wouldn’t be detected.

Hopefully this helps :slight_smile:

Hello everybody.

Thanks again for your help^Mr.Grogger and for this awesome dialogue system.

For these who have isseus with the character who keep going to the last direction pressed, I have found a solution.

What you have to do is to simply set your charecter walkspeed to 0 on your Overlap event.

In your character blueprint, use your input key movement (Z, Right or whatever you press to move) and set your walkspeed to the original amount. It does the trick, you character won’t move by himself.

I think it’s pretty simple, but if you don’t understand this solution (Because my english is THAT bad), I can show you how I did. It’s not the best, I guess and it’s pretty messy and dumb, I suppose, but it works.

Hello,

So on the topic of mixing 2D Mesh/Skeletal Animation runtimes with UMG, I have recently added UMG rendering support for Creature runtimes:

Link to the video demo:
https://twitter.com/KestrelmMoon/status/934687561229877249

You might be interested to check it out.

Cheers

Hi, does your plugin come with the C++ source? It’s not clear from the Marketplace.

Hi Ben, no there is no C++ code for this system, it’s entirely written in blueprints.
Cheers! :slight_smile:

Hi,

I’m making an isometric game. How would I trigger dialogue by mouse (clicking on the character/object) rather than pressing E to initiate dialogue?

Hi dewdle,

Dialogues are triggered through the ‘Use’ interface function in BPC_Dialogue. If you already have an interaction system, you can simply call that function from your interaction system.
If you don’t already have an interaction setup, there are 2 options provided with the Dialogue System. BPC_UseScanner is the one used in the demo, but another called BPC_MouseUseScanner could be used for your scenario instead.

Both scanners follow the same setup as the demo and tutorials, so you can check those out to see how to implement it.

Cheers!

I seem to be having the same issue as a couple other posters here with the movement state being saved on Use. An easy solution for me would just be to have a PostAction that handles that side of things. Unfortunately, the documentation isn’t very clear on how exactly you should implement PostActions. I tried two things, neither of which worked. They include: setting a variable on the player $PlayerCharacter@boolean=true$], and calling a function [DialogueEnded]. In reality, I think this is just an implementation issue on my end. However, as I’ve spent a good 5 hours trying to solve this today, my brain is shot and thought I’d just reach out and see how we’re intended to implement PostActions. :slight_smile:

Edit: Am I understanding hubs right? So you would set a trait of hub to a text where like you were saying…

Dude_A: Hey, player, will you do thing for me? [HUB]
Player: Yes/No

and then return to Dude_A based on that response? Or is every single question “baked,” resulting in a whole slew of PlayerYes and PlayerNo checks across however many questions?

Hi ZServ,

This is what it should look like for your examples (assuming you’ve made a custom function in Blueprints called DialogueEnded):

PlayerCharacter@boolean = true; DialogueEnded();

This will create or update a variable called “boolean” to true in a namespace called PlayerCharacter (this doesn’t create a variable in the actual player character, but instead creates a variable in the dialogue’s scripting subsystem).

Functions must be called with the parentheses and the appropriate number of arguments. In this case, I’d expect DialogueEnded to be a function requiring no arguments.

Marking a branch with a hub trait will show all potential follow up branches as options for the player to choose.
In your case, you’d have 3 branches:

The branch “Hey, player…” would have 2 follow up branches “PlayerYes”, and “PlayerNo”. These will be the responses that display for the player to choose from, and when the player makes the choice, that branch will execute.

If you haven’t seen it yet, take a look at the sample content to see an example of hubs, post actions, and variables. There is a demo map to show an example of the features, and the excel sheets are available in the content folders (the in-engine data-tables might be easier to read at first though).

Hope that helps :slight_smile:

Unfortunately, PostActions don’t resolve my issue. If the player was moving before Use was called, they’ll be moving again when the dialogue is over. I figured a PostAction might help, if I were to reset their movement during that PostAction. I’ve tried a frenzy of things, including even calling a Function in the PlayerCharacter after the Exit function in BPC_Dialogue to re-enable input after disabling it right before Use. No matter what I’ve tried, the player will continue to move. I’ve tried disabling and re-enabling input, consuming the movement vector, Set Ignore Move Input, Set Control Rotation, none of these have worked.

Thankfully, after doing another search through this thread, I found this post:
https://forums.unrealengine.com/unreal-engine/marketplace/40306-blueprint-dialogue-system?p=1000906#post1000906
Due to the fact that it’s been asked several times in this thread, is there any chance that you could add that to the FAQ?

Feature request for future versions (if they happen? :D): support for hex codes for colors would be nice.

For vibrating text, is there a better way to apply this per character (for I guess “angry” text) rather than just copy-pasting it a bunch?

And finally, to go back to the branching thing; so there’s no way to have a generalized Yes/No response that would return to the parent branch with the results? I couldn’t find one in the demo.

Still love the system, but because it’s so flexible it can be a bit overwhelming at points! Sorry to pester you with questions :slight_smile:

Edit: I might not be understanding branches accurately, actually. I had assumed that branches would automatically be run, so if you needed multiple lines of text it would go into its own branch. So, if I’m not understanding branches, and responses do return to the parent, just feel free to give me a smack upside the head and let me know. :slight_smile:

Sorry no there isn’t a more convenient way to add per-character vibration settings. It has been quite a few years since I’ve last visited that feature, but I imagine it could be edited or a new one added, if you’re feeling adventurous. I don’t have the code in front of me, but I believe text formatting is handled in the UI_Dialogue file.

For the Generalized yes/no, you could have two generic branches who’s branch flow is dynamic if you use the SetBranch(next_branch_here) function as a post action. You could set a temporary variable for the next branch somewhere in the dialogue you’re coming from (eg. as a pre or post action, set a variable genericYesNo@nextBranch = “MyNextBranch”).

A branch by default is one ‘page’ of dialogue (click to continue to the next branch). When the branch is done (player clicks or immediately if Silent trait is present), it will choose from one of the branches in the “Branch” column. How it chooses depends on conditionals (is it a valid branch) and current branch traits (eg. RandBranch).
To have multiple ‘pages’ per branch, you can use the New Page operator ( >> )

This project currently throws 53 warnings when compiling all blueprints in 4.22.3. A log file is attached.
It appears to be default values that have changed and you are using deprecated functions:

Set Text (String)
Set Input Mode UI Only
Set Input Mode Game And UI
Get bSupportsKeyboardFocus

Hey guys, hoping someone can be a bit more detailed on how to call post actions after a dialogue is finished. I’ve written a custom function, and attempted to add it to the handle script section, but apparently am missing a step somewhere and the documentation, even with the example, is super brief. Thanks!

Hi silversand224,

Calling the function in the PostAction column follows the same syntax as other places where script can be executed: functionName(argument1, argument2, argument3,…);

So for example if you want a function to print out some text called PrintMyText, you would:

  1. override the **HandleScriptFunction **in your BPC_Dialogue component as in the example
  2. add a switch-case on the function name
  3. add a pin for *PrintMyText *to the switch-case
  4. Implement the behaviour for that pin (eg. PrintString on Argument[0] - we expect 1 argument for this function, the text to print)
  5. In your PostAction script use it by calling the function: PrintMyText(“Hello World”);

Hey!

I´m having some trouble to use your BDS.
I´ve tried hard to use it, but no glue where’s the fix.
Like I mentioned on th review, I tried following the documentation and video. But on my 3D sidescroller project, I’m getting some errors.

Firstly, the “Press E to interact” wasn’t showing. I fixed it turning the pure cast to impure on the BPC Dialogue component.

After that, I got some errors due to the collision. Fixed that adding a box collision for this purpose, and worked well.

Now, the dialog starts, but without any text. I tried to look at your documentation, but can’t figure out how to solve. I know that’s something with Script Interpreter, it’s spawning in the game mode (like your video teached). The only difference is that on your video, the SpawActor node have a bool to spawn even ifthe actor collides with something. In 4.22, besides, there’s a combo box, where I’m choosing the option to spawn the object and ignore the collision (always spawn).

Any tips on how can I proceed? Also, why I get errors when my BPC Dialogue component have a pure cast?

Hey, I’ve got the system working pretty well for the mobile visual novel my team is working on. I can keep track of choices made by utilizing PostAction calls.

However, Is there a way, using the current system, to change the “branches” based on a past choice?
(as a random example, if I chose to open the door, the next dialogue is, “Thank you.” But if not, the next dialogue would be, “How rude.”)

So would this need to be put in the condition section for the dialogue table row? How do I make a function that returns a boolean value?

For instance if I put Chose(“ChoiceName”,2); in the conditions, how would I make the Chose function?

Edit: It worked! I just used Handle Script Function to make the function and returned the boolean as a string. It now only chooses a branch if the condition is met!

Nice! Glad to hear it worked out :smiley:

Hey there!

For the script interpreter error, is the error “Accessed None ‘ScriptInterpreter’” or something along those lines? If it is, then that means the UI can’t find the ScriptInterpreter you’ve spawned.
In your BPC_Dialogue, be sure to override the GetScriptInterpreter function to return the one you’ve spawned in the game state.

If it still doesn’t work we’ll need more info (you could use a breakpoint on that function using F9 to see if it is properly being called and to see if the script interpreter is valid when it is called)

For the Pure Cast you’re talking about, I’m not aware of this issue. What is the error you’re getting and in which file?

Yep! The error is “Accessed None ‘ScriptInterpreter’” (see print 1).

In my BPC-DialogueChild (I made a child from yours), it’s like you teached on the video: I’ve overrided the GetScriptInterpreter function, using the Script Interpreter variable (print 2) that I’ve made on the game mode.

But on my project, the system only works when the cast node is inpure. When it’s a pure cast, i get some “Acess none trying ro read property K2Node_DynamicCast…” errors (print 3).

Also, I’ve put my character and game mode BPs here. Fun fact: in a new 3D sidescroller project, everything works fine.

For HQ images, here’s a download link: WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free

COOL EDIT!

Hey, Grogger, big update!
I’ve made it, now it’s working.
When I spawn the Script Interpreter from my character blueprint, it works fine!
For some reason, spawning from game mode isn’t working, and this is weird, since I haven’t did anything there.

Question: it’s safe to spawn the script interpreter from my character BP?

Nice! Super glad it’s working!

You can put it on the character, but only if you don’t store variables there or if your player class is never destroyed (eg. when the player dies or something). You’ll want the script interpreter to live on for the entirety of the game so that your script variables aren’t lost when you’re player dies. The game instance is good if you want it to live on beyond level transitions, and otherwise the game state or game mode are good.

Are you sure your game mode is the one being spawned? Under Maps & Modes in the project settings, it should say your game mode class in there. If you haven’t yet, look into blueprint breakpoints and debugging blueprints scripts to find out what’s going on there.