Is there a way to call a function from a variable?

I’m making a dialogue system that is entirely customized from the editor, without entering blueprints. So, my designers can drag in an NPC object, set it’s mesh and configure the entire dialogue tree from the editor details.

I was just wondering if there was a way to say, make a String Variable the designer can set, that at some point, based on the string variable will call a specific function? I’m trying to make it so that certain dialogue points set off a function that effects another object’s dialogue elsewhere.

Well i cant find any, blueprint does not support funtion pointers which C++ does. But there is example of what you asking for, timers which require function pointer to work use string name in its blieprint bindings, you might play with those, ty setting time to 0 on Set timer and check of its called instantly.

Arternativly you can make main funtion with int argument and reroute funtion depending in int.

You probably just need a way to Switch depending on what the string is.

3 ways that you can try.

Equal (String). As the conversation progresses, this would set booleans which would then cause branches to route your execution flow to the desired outcomes.

Switch on String. I don’t know how to use this, but it could offer another option to change your execution flow based on string inputs.

Switch on Enum. This isn’t exactly what you asked for, but if you are making a complicated conversation tree I would definitely look into some Enums.

That is what I ended up getting to work. Made a function in the game mode that was passed in a string, and depending on the string, calls another string. Thanks for the help! :slight_smile: