Single array in save structure not setting values... D:

Hey, thanks so much for taking the time to look my problem over.

I’ve been having issues saving the parameters of farm style garden tiles.

so there are 400 tiles in the center of the map.
currently the variables im trying to mark are : Dirt?, Watered? ,Has Child?
I also have a plant class reference but i haven’t gotten to testing that yet because of the hitch im currently in.

So When I load none of the tiles are updated but im not pulling any invalid index errors, when i check the array during play it displays

Array: ( )
( )
( )
( )

Here’s what Im currently doing.

“Save event” called on Grid Manager.
Grid Manager - for each in grid array. Call “save In”(manager ref, index)
Grid Actor - Has child? T: Call Plant Save in, Set Array elem(Index) F: Set Array Elem(Index)
Grid Manager - Loop Complete: Call " Save out"

I’ve been getting kind of odd results when trying to figure out where the break is.

Grid actor side following setArrayElem I can print the values correctly
Grid manager in loop: after gridActor(save) call print(index-1), returns correctly

But when I inspect the array during game actor and instance side its full of empties.

Thank so much!
Any help is beyond appreciated

I didn’t look at this in great detail, but you start off clearing the save array before populating it and writing it to the save game.

In fact, you need to read the old version from the save game and update it, then write it back…

Clearing the Array came later on in troubleshooting.

I brought it on after seeing a forum post telling resizing the array before regenerating it might alleviate my issue. + just trying if addtoArray would work for whatever bunk reason.

I’m a little confused about what your saying.

Can you explain to me why i need the outdated array?
So like i mentioned this gridArray is the only one that isn’t working properly.
Why does inventorystruct.Array work in the same context without reading its former?

Call(playerSave) → Call(playerSaveCallback(inv.struct, lvl))
Game Instance: Add to master - > refresh savegame variables


*Solved = I’m an idiot - duplicate structure on game instance only being used to load grid -_-

1 Like