Why does adding a variable to my output break my code?

Hello all, I am very new to unreal and coding in general. I am struggling to understand this issue and I was hoping to get some opinions from kind strangers.

I have a function that types out one letter at a time to a textbox in the game. The basics is this: there is a integer called Letter Index that adds one to it’s value and types out one letter in-game until the the value of Letter Index (and thus of the total numbers of letters typed out) matches the total length of the string to be typed. When the letters to be typed matches the actual numbers of letters typed, Letter Index stops counting successfully.

Normally, this code runs as expected and the letters type out one-by-one. Letter Index counts up when letters still need to be typed, and stops when all the letters in my string have been printed. Here is my problem: when I add an any variable to the output of the function, my function breaks and the Letter Index no longer counts up. It looks like it is only executing once and then it stops.

In the two pictures, the only difference is that the output node has a dummy spot for a boolean variable. For some reason, having that variable causes letter index not to count upwards and causes only the first letter of my string to be typed.

Thanks in advance! I am really struggling with this one.


1 Like

code looks fine, are you sure its not something outside the function breaking it?

1 Like

What confuses me is that all I need to do to break the code just ask for a variable in the return node. I don’t even need to use it, and it doesn’t have to be related to any other variables I am using.

I will attach the only place where I call the Dialogue Logic function. That is the function that will break if it has any output.

I also replied to the /r/unrealengine subreddit question however I’ll answer here too:

Set Timer by Function Name does not have the ability to return an output node because it doesn’t know how the function operates ahead of time or whether it has an output node - you’ve provided it with a function name to execute at runtime but it has no knowledge of it before then. You should instead use Set Timer by Event like below.

2 Likes

THANK YOU SO MUCH! I would have never figured out that set timer by function name was the problem. I was combing through my code like a mad man trying to figure out what the heck could be wrong.

For anyone stumbling across this in the future, set timer by function name was absolutely the issue and I was able to have an output variable by using set timer by event instead. I changed my code exactly how Vigilant suggested and it worked.

1 Like

1 Like