Function "Get Character Array from String" messes up the characters and their order.

Hi everyone,

I’m working on a joke teller in Unreal Engine that displays a random joke letter by letter when you click a button in the UI. It works similarly to the text effects in Undertale, where each letter appears with a sound and a delay.

Here’s the issue:
When I pass a string through the “Get Character Array from String” function, the resulting array has some letters missing or out of order. I’ve double-checked my input string, and it seems fine before the conversion.

I tested and manually fed the function some special characters, and that worked perfectly. The issue only occurs when I connect the function to the convert from text node

Here’s the logic and the output:


image

Has anyone encountered this issue before? Is there something specific about the string or conversion that could be causing this?

Using variables is not a bad idea.

At this point

you’re calling the GET twice. Once to print the random joke, and once to make the array. The array almost certainly does not contain the same sentence. It will be another random item.

Hey @OffbeatRaptor44

Try to save the current joke after you get it with a random integer as @ClockworkOcean mentioned.
Here is an example with a timer where you can adjust the delay:

UE426JokeHandler.zip (78.2 KB)
UE50JokeHandler.zip (89.5 KB)

3 Likes

Thanks for the example you provided! It has some new things for me to learn.

The solution to this issue was to create a variable that stores the random joke, so it doesn’t get a new random joke twice (as @ClockworkOcean said).

Here’s the updated logic and result:


image

Thanks again for the help and suggestions!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.