# Cannot modify member values of scruct contained in a map

**URL:** <https://forums.unrealengine.com/t/cannot-modify-member-values-of-scruct-contained-in-a-map/1384078>\
**Category:** International\
**Tags:** data, Struct, unreal-engine, Blueprint, question\
**Created:** [November 12, 2023, 9:03am UTC](https://forums.unrealengine.com/t/cannot-modify-member-values-of-scruct-contained-in-a-map/1384078 "2023-11-12T09:03:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manusoka](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/manusoka/32/757572_2.png) [@Manusoka](https://forums.unrealengine.com/u/Manusoka)\
**Post date:** [November 12, 2023, 9:03am UTC](https://forums.unrealengine.com/t/cannot-modify-member-values-of-scruct-contained-in-a-map/1384078/1 "2023-11-12T09:03:18Z")

</div>

Hi there:  
I am making a simple quest system in which I am storing in a map some structs which contains quest information, even the COMPLETED (bool) state.

If I attempt to set one specific quest to true, it won’t be modified, and the MISSION COMPLETE event will trigger again if I try to trigger it.

 ![A function attempting to set a specific quest (by ID) to true.](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/8/c/58c51102805417294a1bc7f0d76348310f5d6641.png)

If anyone knows how to modify it, I’ll be glad to hear how.  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Manusoka](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/manusoka/32/757572_2.png) [@Manusoka](https://forums.unrealengine.com/u/Manusoka)\
**Post date:** [November 12, 2023, 9:12am UTC](https://forums.unrealengine.com/t/cannot-modify-member-values-of-scruct-contained-in-a-map/1384078/2 "2023-11-12T09:12:31Z")

</div>

I found the solution while writting this post, and I wanted to leave the answer for future noobies like me to find it:

If you want to **overwrite** the key/value pair of a MAP, you have to add an element to the map using the key corresponding to the value you want to be overwritten. Just like this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/e/c/4ecbd764149c24d7110887093eaa1633e17b1fdd.png)  
More specific:  
 ![Zoomed solution](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/7/f/e7fa1199aaeab9c1d187c6af8d6ddb5a338499f9.png)

Please, go give a like to this post, where I found the solution:

> [@Modifying "Value" in Maps](https://forums.unrealengine.com/t/modifying-value-in-maps/460940):
>
> You cannot do that this way as arrays indexis just order number in array (latterly memory position offset) it not a fixed key and can be changed result of some operations (like sorting, adding and removing elements), map needs value to be assicated with key. Map inside is work as array of TPair with extra code, C++ type which is not supported by blueprint, so map data can not really be interacted directly in blueprints. Get Values and Get Keys nodes just dumps data from TPairs in to separate arr…

Good luck, everyone!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [December 12, 2023, 9:13am UTC](https://forums.unrealengine.com/t/cannot-modify-member-values-of-scruct-contained-in-a-map/1384078/3 "2023-12-12T09:13:03Z")

</div>

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