Thanks, yeah the trouble is functions don’t allow Latent nodes or Events. Which an RPG conversation/dialogue kind of needs.
So I had to go with a macro library.
What I have now is a bit ugly, and involves a poll every frame in a macro. Would appreciate anyone’s ideas for improvement.
That said, it looks like it will be fairly easy to jump around in the conversation, by allowing the macros to finish without activating their Output execs if the conversation has jumped elsewhere.
If anyone’s interested:
This is a class blueprint for an actor that keeps track of the current node and displays it to the user. For each type of node it will have 3 functions:
SimpleLine_Begin(string speaker, string text)
Sets the current node to be a simple line. Displays it to the user.
SimpleLine_PollEnd(out bool isReadyToFinish)
Outputs a boolean indicating whether the current node has been finished (i.e. the user has pressed space).
Clears the current node, ready for the next node.
This is a macro library with a macro for each type of conversation node.
SimpleLine(BP_ConversationEngine engine, string speaker, string text)
This macro calls SimpleLine_Begin on the engine, then loops forever (with a tiny delay each time) until SimpleLine_PollEnd indicates that the node is ready to finish. It then calls SimpleLine_End and activates it’s output exec.
The actual conversation can now use the SimpleLine macro and a BP_ConversationEngine variable to edit the conversation in a slightly clumsy but acceptable format.