Problem when try to save Map Variables

KaioPessoa
Sun, 27 Dec 2020 22:01:10 +0000
Cinematics & Media

Hy everyone!

My situation

I have an inventory that store Items and the “Quality” of that Item (Common, rare, etc).

I’m handling the save system by basic saving and loading a MAP type variable (Key:Item_Class reference | Value: integer).

The inventory gets the item class reference, spawn an actor from class and with the integer passed in the MAP, defines the item quality.

The problem with this system is that the player can only carry ONE item of the same class.

As the MAP keys needs to be the unique the existing value associated with the key will be overwritten with the new value.

One thing that I tried was to set the Key to a new Actor blueprint called Item Holder and this blueprint holds the Item class variable.

This way I can spawn multiple actors and call for the variable inside them when I need.

The problem with this approach is when I Save the MAP with the spawned actor and try to load it, of course, I get an Error because the actor was not spawned yet in that session.

Do you guys know any way that I can fake to the map or maybe just a way of saving the spawned actor without losing it’s inside information?

2 posts - 1 participant