Download

Do class blueprints inherit macros?

I’ve created a class blueprint (say BP_Base) and one that inherits from it (BP_Derived). In BP_Base I created MyMacro, which I can place in BP_Base’s EventGraph. MyMacro doesn’t show up in BP_Derived.

Am I doing something wrong or is this not supported?

For context, I’m trying to make a conversation blueprint for an RPG. So you might have a macro called “SimpleLine” in the base class which displays a line of text to the user and waits for them to press a key. Because it has to wait for input, it can’t be a function so I made it a macro.

Do I need to use a Macro Library for this?

I think Macro Library or do it as Function.

I use macro libs for some utility stuff.

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:

BP_ConversationEngine

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).

SimpleLine_End

Clears the current node, ready for the next node.

BPML_Conversations

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.

https://dl.dropboxusercontent.com/u/478864/convo_macro.jpg

BP_Conversation_Blah

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.

https://dl.dropboxusercontent.com/u/478864/convo_blah.jpg

I am not sure which would be better, but I am not sure why you couldn’t use functions for a conversation tree. Use one or more string array variable to store the conversation and update it as the conversation progresses. There may be more ways, but that is just one off the top of my head.

I think this could work, but a bit cumbersome than you actual code your own component and assign a text file to parse on your own.
NOTE: this is just some tinkering around in blueprint for 10 mins, not guarantee to work or have best performance. Feel free to post your solution.
1.Like create a ChatDataActor that is a blueprint with string array and a public function to search chat string base on keywords.( ie String array can have head keyword like this, “START:Hello there.”)
2.when define function, try to search a substring and length of keyword, ie ChatDataActor->findDialog( “START:”, 6) //default engine doesn’t have stringContains() function, only subString with start index and length.
3.In your NPC Pawn, create a publicly exposed vairable called ChatData and type is ChatDataActor_C object.
4. In editor, create a NPC Pawn and a ChatDataActor, edit ChatDataActor’s string array by adding more element. And use the picker icon to pick your ChatDataActor that are placed near the NPC.
5. In your NPC Pawn event graph, give it a trigger sphere large enough to create event to initialized chat function.
And in the NPC event graph, you can control what response from Player Pawn to do other things. ( like say good bye on overlap end)

So in multiple starting, choices, and branching dialogs you need a more complicated ChatDataActor.
Where the actor itself handles all the possible event flow, and your Player Pawn must also have a public function that takes string array so you can update your hud for dialog choices.
( and maybe a private state variable that saves at which point of your dialog branch you are in, so you can just use a switch on that state when player choice returns.)