Hey all.
So I’m in the process of trying to make an NPC branching dialogue system. Currently I have it working if there is only one NPC message and response, but am having trouble getting it to work with a sequence of messages and responses. The way I currently have it set up is there is an actor called “BP_NPC_Speech_Interactable” that is attached to my free roaming NPC located in the level. The Speech Interactable will hold all the logic and hopefully make for an easy, visually intuitive way to represent the branching dialogue using standard blueprint flow control. The idea is that the Speech Interactable can be added to NPCs as necessary without having to worry about managing data tables and array indices.
When the Speech Interactable is activated it handles camera positioning and all that jazz then calls a function named “Conversation Manager” which looks like the following:
Basically, the dialogue is created with an array of possible responses and then added to the screen. Next the Wait For Player function is called that should theoretically wait for a player response before continuing down the dialogue tree. The Wait For Player function looks like this:
It uses a while loop to check if its waiting for player. When the player clicks on one of the buttons in the dialogue widget, the “IsWaitingForPlayerInput” boolean will be set to false which should cause it to exit the while loop and proceed to the next create dialogue node.
The problem I’m having is that when the blueprint calls the wait for input function, the editor stops and gives me an infinite loop error. But if there is no “Wait For Player” function between the “Create Dialogue” nodes then the blueprint just goes one node after another and skips right to the last dialogue option.
I’m kind of running out of ideas at this point. Delays don’t seem to work because they can’t be called from within a function. I tried setting up a “Wait Event” in the Event Graph to hopefully use a looping timeline or gate with delays but I couldn’t figure it out. I’ve heard that you can bypass the Loop Limit in the project settings window, but that seems like a bad idea. But maybe it’s not so bad if I make careful use of my while loops?
Any ideas?


