Download

Storing multiple structs.

Hi

I am creating a “Shop-simulating” game.
I keep all the variables regarding the specific shop level in structs in a my game instance.

Since structs in an array which contains other arrays (like a storestruct contains each article created), can’t be properly modified with an “Set array element” node, how can i solve following problem.

Lets say i want to create an unspecified number of stores througout the city, and want each store opens the level designed for the store and uses the variables in the game instance. How do i keep the variables for the other stores intact, now that i only can have a single non-arrayed struct with this info.

I an currently considering creating a savegame file for each store, and just keeping a string array with each filename in it, which then will be loaded upon the opening af the level. This would then require a savegame file for each store, along with a main save game file, which would mean a lot of files, along with the possibility of the user deleting a store save game file, and then corrupting a part of their game.

Another possibility is duplicationg the single struct a lot of times, and use an integer to reference which struct to load, however this removes the possibility of an “infinite” amount of stores to create.

Am i constrained to these to options, or is there a magical solution i haven’t thought of :slight_smile:

You can add structs into an array with no problem and later get them by their index. Then you have an option to Set member in struct. I think you can break the stuct and plug in all the members that will remain the same and set the one that will be modified manually.
9787de7a0c02aa700307c7fc3b481ad05ea0d982.png

or use the set members

86ec38f1d45671c81fdf28204f11f69e81c0b443.png

Wow. That looks great :slight_smile:
I havent been using the “Set members” node.
Ty very much for the shown setup :slight_smile: