How to select an array by name

So I’m working on a dialogue system that uses string arrays to give a bunch of info for each line of text such as which character is talking, what kind of speech bubble they are using and what text they are saying.

My original plan was to have an array full of these arrays to cycle through lines but I can’t find a way to do this in the Unreal Engine.

Assuming you can’t have arrays of arrays I decided to change my tactic to keeping the arrays separate and making the final value in each the name of the next array to use. The problem is I can’t seem to find a way to load an array based on name.

For example if the final string entry in ‘Array 1’ was text saying ‘Array 2’ is there a way to use this to get a reference to the second array? or is this also something that can’t be done?

The only way I can currently think of is to have a huge mess of branches saying "if the last entry in the current array = ‘Array 2’ then set the second array to be the current one. This isn’t really an option though as it would get very messy very quickly if I had to do this for every single line of dialogue in the game.

Right click the current chat in the Set node and select “Make Array”

Hope this helps :slight_smile:

Thanks for the reply, I had already tried this method and it simply set ‘Current Chat’ as a new array with 1 entry which said ‘line2’.

I may have worded it badly, but I meant if value 6 of ‘Current Chat’ says line2 I want to assign the already set up array ‘line2’ as the new ‘Current Chat’.

The only way I can currently think of, is by using a whole bunch of branches checking for every possible line but that will get messy real quickly

So you’re trying to set one of the array element? something like a Set At ?

Nope, I’m trying to replace the ‘Current Chat’ array with all of the entrees of another array (in this example ‘line 2’) the same way as the first picture set up pretty much makes ‘Current Chat’ a copy of ‘line1’

but as there will be many of them i was hopeing I could set it by name instead of hooking up nodes directly as in the first picture. Kind of like - if it currently says line2, it will then find the array named ‘line2’ and set that to replace the value of ‘Current Chat’. From there ‘line2’ will tell it to look for line3 next time it loops and so on

Sorry if I’m explaining this weirdly, it’s a bit of a tricky one to word