Map String and Boolean can't change Boolean value

UE 5.0.2

Hi,
I’m using a map with strings and booleans, strings are the keys and the booleans the values.

When I try to change the value of a key by using Add, it does not change the boolean value of the key.

Is there another way to change the value of a given key in a map ?

Thanks.

Can you share your blueprint?

Here it is :

Tried to create a intermediate string variable called KeyToChange to see if that could solve but no success. Tried to remove the foreach loop to just change a key in a hard way with a given index but it does not change, the key submited is correct in all cases but its value refuses to change from false to true

ForLoop + Delay do not work well together. Remove these nodes first and try again.

Alright I’ll try it, I’m away from keyboard but I just realised by thinking about it that the problem might come from the fact that I never set the struct members, the map is a variable from the struct, hence why maybe it’s not working.

1 Like

Figured since you have a print, you should have a good idea of what is happening, but first we need to make the loop work as intended to then move on to the next.

The delay thing above for sure. But most importantly:

image

When you started looping through the Player Current Quest struct, the For Loop created a copy of the struct. From now on you’re operating on the copy the loop holds. The changes do not propagate back to the Player Current Quest struct array, it remains unchanged.

Look into how the Set Members in Struct node works. It will allow you to operate on the struct data directly.

Or set array element after making changes to the struct. Ideally, both.

1 Like

Yes, set array element was the key on top of the set members of struct, otherwise it would not work. It is solved now, thank you very much.

1 Like