How do I make a function await user input/activity?

I want to make the equivalent of something like that:
int talk()
{
int option;
cin>>option;
return option;
}
Where option is my custom clickable widget (There are 4 for 4 possible replies to an NPC’s dialogue).
I have created a function that takes in 5 parameter’s (What the NPC says and 4 replies) and is supposed to return the choice which the character made. I wasn’t able to come up with a suitable algorithm (that would be efficient). Or maybe I’m just missing a function. Any help?

Have you take a look at this dialogue system tutorial? A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums

It answer a lot of your question.