Setting multiple variables from an array

Just started to learn UE blueprint and I was doing some Api connection which works perfectly fine, what Im trying to find is how the variables that I stored inside an array can I set them up inside an individual variable ?

So if Array has 3 values and I have variable, A, B and C how do I make value 0 go to A, 1 to B and 2 to C ? I been trying and searched a few videos but they dont do what I want to achieve and I cant get to understand what Im doing wrong.

So the Data gets specific assigned from the API to these arrays I got 3 each array handles a different field, Pokemon Name, Type and Location.

Now I want 3 variables called Pokemon1, 2 and 3 to each of them have a different name and thats it.

I know this is wrong this was just my last attempt I have try like 7 different things but none worked I just do not understand how to, I can do it on Unity or Coding because the logic is simple but I dont get it on blueprints.

Thanks and sorry for typos.

1 Like

You canā€™t assign variables in a for loop, you would need to

You could use a loop, if you were moving the variable from one array to another, for example. But if you just have ā€˜someā€™ variables, you have to set them one at a timeā€¦

You might say, ā€˜I donā€™t know how many names I will haveā€™, then the answer is that the names just stay in the array :slight_smile:

1 Like

Yeah I understand the ā€œI dont know how many names I will haveā€ if that was the case I would leave them in the array correct but here I was just trying to understand what was going on and how it worked to do it ā€œmanuallyā€. Thank you this helped.

If you wanted to understand the why of why your latest method didnā€™t work Iā€™ve provided an example for edification sake.


However, if you did want to store the data from the array you received you can use an Integer Map data type. Map associates the data stored with a specific key, think like how you find a definition in a dictionary by searching for the word. In this case the Key is the Index location in the array and the data is the name value. You can then use the Find node to filter through this information. But I still agree with ClockworkOcean, you might as well just stick with the array provided.

2 Likes

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