I’m using UMG to create a questing dialog menu system. The NPC has a default dialog asset a blueprint called questDialog.This asset contains an action asset which includes a list of alternate questDialog assets.
I’ve been able to display my UMG menu system with information from the first asset and its choices. I’ve been able to make these choices change the information displayed. The problem I’m having is that I can’t store the current questDialog asset back to the NPC. If I attempt to do this directly, the engine crashes on launch because I can’t compile both assets. I’m now trying an alternative method where rather that doing it directly, I do it from an interface. The problem is the NPC’s set dialog event is not called ever even though I can clearly see the UMG interface make an attempt to call this event. I will include some pictures of my graphs.
In the first image, I’ve confirmed through the debugger that the Set Dialog Option is correctly being called with the right information. The variable “Owning Character” is set as type Actor because if I make it of type “characterPlaceholder” the engine will not let me compile both blueprints and it will crash on launch.
In the second image I have the event from the interface setting the variable I wish to change. This is NOT being reached. I’ve confirmed this.
I still haven’t fixed this issue, but I was looking at my function that initializes the menu system. It’s target pin is white and expects a variable of type dialogInterface, but its being fed a reference of dialogMenu (but it does implement dialogInterface). The engine permits this. I also notice there is no envelope in the corner of the node.
When I look at the Set Dialog Option node, it has an envelope and the target pin is blue. I can create a node with a white pin and without the envelope, but I can’t connect owningCharacter to it. I suppose its possible that its because actor doesn’t implement dialogInterface, but I can’t cast it to characterPlaceholder without it causing the issue that prevents me from having both compiled. However if I do the cast, it actually will let me connect it to this alternate node. I haven’t actually attempted to run it this way because I don’t want it to crash again.
So I finally figured out the problem. The owning character variable was actually being set to myCharacter and not the NPC. I was attempting to set the new dialog option in myCharacter instead of the NPC as a result. I had to expand my initialize function to add the myCharacter reference as well as the owningCharacter.
I looked at this, but I’ve never liked the idea of hard coding the choices into the blueprint. The system I designed is much more flexible. Fortunately I figured out what the problem was. I’m not sure it was possible to see the problem based on the screenshots I provided.