Dialogue Plugin

Hi there,

First off I love the plugin!

I have followed your updated video tutorial on how to create conditions and events but I am running into the following issue:

In my game the dialogue is activated via a trigger box. Once you reach a certain point in the conversation I want that trigger box to be destroyed as I do not want the player to be able to interact with that NPC any longer. I’ve added the ‘Do Once’ node so that not all my trigger boxes are destroyed by one interaction.

This all works fine for one NPC, the problem is when I introduce multiple NPC’s. Only the first NPC’s trigger box is destroyed and not the others.

My best guess is because I am referencing the trigger box class as an array, my custom event is always selecting the trigger box at the beginning of the array and destroying it. I am unsure of how to access specific items in an array when referencing a class.

Here are two screen shots. One of my player controller bp and the other of the dialogue event bp.

Any help is greatly appreciated!

EDIT: My bad, I just realized that this is not the right forum for the plugin I’m using. Sorry for the inconvenience.

Hi there!

I’m reading the dialogue manual to add states to the characters like sad, happy, etc. However, I don’t really understand how to achieve it, and some step by step explanation or example would be appreciated. Thanks for your awesome work!

Hey!

I finally got back to the thing. And thanks for motivation, I finally got deeper into the dialgoue widget and got to know it better so I can achieve what I want :slight_smile:

But I ran into another problem. Long time ago I moved the plugin to the project folder and recompiled it like in your tutorial. All worked fine. Then I moved the whole project to the repo on P4. Then I wanted to add another text field and it didn’t work for my co-workers - they got the info they need to get the plugin themselves. I probably should build the project and only then send it to repo, because it’s building with the game and I’m sending just the folder. Can you advise what’s the best course of actions should be? :slight_smile:

Also, I did manage to make the second text field, but only once… Another attempts I always encountered the same error: after editing one of the field, the second field always gets the entry from another one. I’m pretty sure I follow your steps but still I can’t get it right… I changed “SecondText” to “ShortText” but I doubt it’s the case… Can you point me to the right piece of code that could be the problem?

Thank you!

In my Dialogue Event I’m not getting anything valid coming out of the NPCActor. I have a very simple setup, and have tested it in different ways but I’m just not getting anything. I need to test if the NPC has a child actor. I can do that other ways, but it’d be simpler if I could just pull out from here. The Considering Player does return the Player Controller.

Simply means you’re not connecting anything valid when you’re creating the widget:

https://i.gyazo./eda39d6ad6fa754395e9f3c41cab71b6.png

1 Like

I’ve added a clarification in the documentation, paragraph " 4.1 How to reference actors that exist in the level".
It explains how to reference things using not just a class, but also a gameplay tag, which is what you need in this case I think.

I’m not sure I was able to follow your explanations, but the correct way to do it is to move the plugin to the project, upload it to the repository, let your colleagues pull everything, and then explain to them how they can build the project (right click on uproject file, generate visual studio files, open it up in Visual Studio, right click on project, build).

Send me your altered version of the plugin by email, it’d be easier to have a look that way.

EDIT: Please disregard, I had called the mesh incorrectly in the widget BP so the montage was not displaying

Hello. I wanted to add an animation trigger to the dialogue system, so i tried to add an animation sequence option and an animation montage option.
In Dialogue.h I i added:
class UAnimSequence* AnimationSequence = nullptr;
class UAnimMontage* AnimationMontage = nullptr;

In DialoguePluginEditorSettingsDetails.cpp I added:
const TSharedPtr<IPropertyHandle> AnimationSequence = Child->GetChildHandle("AnimationSequence");

const TSharedPtr<IPropertyHandle> AnimationMontage = Child->GetChildHandle("AnimationMontage");

CurrentNodeCategory.AddProperty(AnimationSequence);
CurrentNodeCategory.AddProperty(AnimationMontage);

In DialogueViewportWidget.cpp I added:

#include "Animation/AnimSequence.h"
#include "Animation/AnimMontage.h

Possibly one or two more lines of code, but that is not the point. This all works fine and gives me the ability to select either a montage or a sequence.ScreenShot39

The problem i am having is that it does not seem to trigger. No error messages, it just does nothing. I know little about programming, and less about c++. I just hacked my way to this point. Any insight is appreciated. Thank you.

In my previous post, both fields have data, but usually i test with just one field filled in.

Hey this is exactly what I’m trying to implement, can you share in more detail what you did, and if it works?

Love the plugin, would love it even more if animation handling could be implemented as a base feature. Seems like a pretty common usecase for NPCs to animate when they speak?

Well, the C++ code is there. After that, you just have to tell the Widget BP that you want to play the animations. So, while looking at the widget BP, you will see where the nodes run into places that correspond to the ‘talk’ actions. At these points, you would reference your character BP, or the other actor, and put a play montage node at these conversation points. I was amazed at how well and easily the whole thing worked. made a very useable/extendable system. I have no idea of your experience level, or where you are at, at this point. If you have any specific questions, I will try to help. The short of it is, yes it works. Yes it is awesome :slight_smile: You just have to get that C++ in place, then everything is back to BP. In the code above, the const lines that got word wrapped are actually only two lines, not four. When you go into the files i pointed at, you will see code that looks almost identical to what i have posted. just add the code i posted to the lines where you see the similar code. I know i said ‘and maybe a couple more lines’ but i think that is actually all of the code. Good luck!

I also wanted to add that this way i did it is just how i wanted to set it up. There is already an event call built in. You do not need to do it this way to get your animations or lip syncs. I just prefered it set up this way. But, you can use the already in place system to fire off basically any event you want.

Dialogues are variables.
you can pass the required dialog variable to npc with a function

so when the dialog starts you launch the variable dialog

you can call that function from anywhere you need.

1 Like

Yeah literally just found MammothInteractive’s youtube video where he covered the Dialogue variable I can actually add in an NPC’s blueprint. I had to rack my brain and use ctrl+f on the doc, that variable wasn’t mentioned as far as I’ve seen other than in C++ sections.

I like your set up, but still confused on yours. I imagine in the context you’re speaking to a soldier NPC and this is from his BP. So you’ve used Dialogue Plug In, you have that data, and then reference it in your function specifically for that NPC, which makes sense. Just still tough to wrap my brain around.

Gonna work on Mammoth’s setup tomorrow. But will definitely be monitoring this thread. Thanks for your input, man.

NpcSoldier is a class where I keep everything related to combat, this is from NpcInteractive that inherits from NpcSoldier where I keep everything related to interactivity with the player.
Non-interactive npc (enemies and creatures normally) inherit from soldier, and interactive npc (such as companies for example) inherit from NpcInteractive.

Another option depending on whether you don’t want to be tied to a hierarchy system, would be to put the dialog system in a component and add it to the npc you want.

1 Like

Almost getting it or almost giving up. Not quite sure yet haha

I know it’s in the docs. I know they didn’t expressly write the docs with this in mind(i do wish they had), but it’s in there. I can feel it. It’s the friggin tags.

With this set up referenced in 4.1 of the docs, how do I set this up to not only just look for that 1 tag he’s referencing, but an array and then decide which tag it’s interacting with to then play that tag’s dialogue?

Because it’s this way, I could make 1k dialogues, add the tags, add them in the array, the player character interacts with anyone, it runs through the array, finds that NPCs tag-- and then bingo bango, dialogue plays specific to that NPC’s tag, right?

No, tags aren’t needed here. Let me walk you through the process.

Let’s say you have an NPC. Add to the NPC class a variable of type “dialogue”. Like so: link.

Place this NPC into your level, select the NPC and set its dialogue: link.

Then you access this variable in your “interaction system”, whatever it may be. You can see a primitive interaction system in the demo that is linked on the product page. It just detects a mouse click, raycasts from the cursor position into the world and picks up whatever it hits first. Then it tries to convert it to an NPC, and if it’s an NPC, then it retrieves the value of its “dialogue”, and then launches this particular dialogue.
Here’s how it looks (we’re in the Player Controller blueprint): link.

This is an example for a top-down game. You may have a different type of game, with a first person perspective, for example. In that case, sending a raycast is a bit more difficult and you have to set-up collisions properly so that the raycast would hit the NPC and not go through. If you have a visual novel, the set up would be very different, too. Each type of game requires its own set-up, which is why I’m letting the creator do their own interaction system.

Let me know if the example I provided helped or not. I’ve seen your review, I understand you’re frustrated. It takes time to learn UE4, usually by watching tutorials first. It’s not very productive (or even good for your sanity) to jump into development and then get stuck on the first problem you encounter and remain stuck there for days or weeks. You would’ve benefited more from watching lessons on Udemy much more. They would’ve given you the foundation, upon which you can build by tackling small problems on your own. Writing an interaction system involves only a couple of nodes, but you can’t bruteforce your way through the problem. Anything more complicated than raycasting from your mouse cursor requires solid knowledge and understanding of UE4’s collision system, and the basics of UE4. I don’t want to critique your approach, but I would recommend to learn the engine before trying to solve problems in it. After having a certain amount of basic knowledge, you can continue learning by doing. But at first, you only need to learn by watching structured video lessons. Trying to learn UE4 by just launching it, poking around and looking for nodes that sound vaguely relevant is like grabbing a yoke on a plane mid-flight and learning how to fly that way.

Hello, thank you for the plugin, so far working with it has been great.

I would like to ask if it’s possible to not have the NPC dialogue line be visible at the same time as the player answer options? I would like to have the dialogue and the answers be in the same box but currently they overlap because both are visible simultaneously.

Can you give a schematic example of what you’d like to have? I’m not sure I understood right. Do you want the NPC line and the responses to be in the same scrollbox?

Are you developing for a phone with a vertical layout, by any chance? What’s your target resolution?

No, I’m developing for PC.

Perhaps it’s clearer if you see it. You can see basically what I’m going for at 4:25 in the video below. So there’s one area for dialogue and replies (e.g. black box in the video), and as the player is presented the dialogue choices, the line the NPC said previously disappears. Currently in the plugin they are both visible at the same time so I can’t have both the line and the responses appear e.g. at the center of the black box because they would be on top of each other.

Knights of the Old Republic: (Difficult) 100% Walkthrough Part 1 - The Endar Spire (No Commentary) - YouTube