Saving a Map Variable with a Structure - rows reset on save

Hello,

I am trying to setup a save system that can handle recording unique stats for each level in my Tower Defense game.

I have managed to create a Map Variable using a String+Structure. I can add unique lines, my level names, that then use the same structure of stats (enemies killed on this map, high score on this map, star rating, etc.).

At best, I can save the stats at the end of my round for the current map, but I then overwrite the data for all other keys in my map variable for some reason. In the image below I show how I get the current level name and Find to get the structure to update. I then set my stats and save. Currently the system is broken, I’m not actually saving and I’m trying to fix that as well, but I’ve succeeded to that point in the past.

As noted above, this is currently failing to save all my variables, I can see that on my level select screen, whose logic is shown in the image below. When I have succeeded in saving, this logic would produce the accurate stats for the last level played (and updated as in image 1), but ALL other levels are wiped to 0 for all stats…

If anyone can help me understand how to do what I set out at the start of the post, I’d truly appreciate it. I’ve been at this for 4 weekends now to no avail.

Thank you.

So I fixed the missing pieces in the save process

However, the original issue is unresolved. In the image below, the last level I played is showing all the stats perfectly well (except star rating). But saving this level’s variables resulted in all other levels zeroing out.

I’m happy to show any other code needed. But this is the crux of the issue.

Thanks for your time.

No takers, eh? Shoot i really can’t figure this out for some reason. I must be overwriting all keys at some point but I’ve double checked to ensure only this event accesses the map by level name.

If anyone can even point me to a thread with working map variables using string+structure I’d be grateful.

Solution I came up with. Not pretty, but it gets me moving again.

Cheers

https://www.reddit.com/r/unrealengine/comments/14c4ktj/map_variable_overwrites_other_keys_when_saving/

1 Like

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