Download

Array Variable Switch 

Is there a better way to do this?

Hi,

I am spanish, sorry for my bad english

I cant understand the problem, but you can simplify your code with this example:

What exactly are you trying to do here? Swapping party positions? Some context would help. Though my goto when dealing with multiple objects of a type is to use a loop and update what’s needed during that event call.

Is this correct? Based on INT value, you want to effect only the array index corresponding to that INT value to whatever the new Bool is without effecting other existing values… try this,
int 0 sets array element 0 to new bool,
​​​​​​​int 1 sets array element 1 to new bool, etc.

SetArrayElement.jpg

Capture.PNG
Use this node instead of the switch. Looks like you want to set KeyID in the array at a specific index - this will replace the value with the value of bKeyID, provided you have write access to the array.

Edit: ninja’d? High five Basement Bob!

I want to change any value of an external blueprint array without changing all the array values

Basic programming principles would say… Another class should not directly access data from another class. Your array should be private and you have class functions to modify the contents of the array and get elements from the array… It may take a little more work, but it helps keep bugs at bay. It’s basic defensive programming… In your function you can double check what some other function wants to change it to. If it’s bad data, you don’t allow the change.