Table saving issue

Hi there,

I want to save data from a “ListView”. The problem is that the array only contains the indexes, but not the data.


Please help, I don’t understand where the error is.

You cannot save objects. You can only save structs.

Hello Everynone, all;

I also have a backup of the structure but as you can see it does not succeed. Am I wrong the “set Array item”?



In the tutorial that explains how the list works with a structure, it is accessed by a “BleuPrint Object”. Is this the correct solution?

The whole thing is that I can put it in instance to follow the growth of the pawns in the game and be able to be modified at the same time as the value contained in the Pawns.

Where is the bit of script that reads the struct array from the loaded save game and recreates the objects used by the list view?


Btw, does each of the ants you want save have a unique name? Like Robert, Patricia… or can there be half a dozen of Roberts ants a bunch of Patricias getting antsy.

Here is the loaded backup, which is, as I told you, empty, except for the indexes.
And that’s where I’m at in terms of loading into the list, I don’t have anything more conclusive, since I haven’t yet got the information I’m missing and I can’t find it elsewhere, despite my searches (may go as far as backing up in their demo).



As for those who are Ants (Pawns), they are born alive and die, just like us.
This is why it is important that they be represented in the form of a pawn, or even an actor. Because they carry their own life within them.

good evening :wink:

The preview is unreliable - find another way of checking what’s in that struct array - print it?

image

The above script does nothing.


Still not sure I can wrap my mind around the script you posted.

You did not answer my question :wink: - I asked about names for a reason beyond sheer curiosity. Working with structs and arrays can be slow, tedious and error prone. If your ants had unique, non-repeating names, you could use a Map container instead. Very fast access and no fiddling with indexes & setting array elements.

I’ll show you where I left off.
I couldn’t find an example to follow so I couldn’t understand how to use a list recording to load and view it. I can’t find what I’m looking for, if you can help me, please help me to see more clearly, I don’t speak your language and the programming but also unknown, I navigate on sight… .
Despite this I still manage to find it interesting, please don’t let me down.

As I told you they have a life, that is to say a duration, which can be shortened by accident, they (the ants) also react to their environment, so yes they have a unique name, but name I cannot I just define them by an Array or by a Map. It must be defined in a Pawn which can receive code which animates the life of the ant, individually from the others.

I tried to read the variables contained in the Blueprint of the Pawn and no problem the list is created, but as for the rest my problem is to save the data (pawn created during the game and name present on the "Level "original.
If we can instantiate a Pawn during the game, could you also tell me how, because for that name plus I can’t find a tutorial.

I wonder if we don’t find this kind of advanced tutorial, because training, other than beginners, is paid for?

Spawn Actor From Class

It is indeed the node that I use to create a pawn during games, but how to save the Pawn and put it back into play later, this is not said in the various tutorials that I have seen.

Would you be kind enough to share your knowledge on this subject with me?

As mentioned above - you cannot save actors, you can only save their data (structs). When you want to save the Pawns, you add their structs to the Save Game object and save it to disk. When you load the game, load the save game object, read the structs and use them to respawn the Pawns.


Here’s a minimalistic yet working pseudocode. Sadly, I have little time to comment it fully - compare the steps to your setup and see what is missing:

  • in the same game object:

The validations check above is for ensuring we’re saving only the ants that haven’t been destroyed. You may have a better method tracking who is dead or alive, ofc.


The list view script is a dummy event here; the above is just to ensure you have all the pieces allowing for load & save operations. It may not be the best implementation but it is, hopefully, transparent.

Thank you Everynone for the time you give me
I redid my plans and used your method, unfortunately I have not had a positive result for the moment.
I would need to know what your “Add Ant to Display” is made of because mine should not match yours.
The tutorial I used to make the list doesn’t allow me to use the pawn like you do to view the values of its structure, the construct doesn’t work and the get actor doesn’t seem to work. more, no list output…


As mentioned above - it’s a dummy, there’s nothing there. You had issue with loading and saving data - focus on getting this to work. The above demonstrates that.

  • once you can successfully save and load AntPawns, work on displaying them in a normal widget first
  • once you can do that, see if you can update that widget when ants are loaded
  • once you can do that, start getting the hang of how the List View works

Remember this from the other thread:

You’re still at the beginning.

Hello Everynone, All,

I want to thank you for the valuable help you have given me.

I eventually figured out that saving the data in the structure directly updates the data in the ListView.
For that I built a small timer making change the age of the ants, I could note that this age was to modify live in the list.

Thanks again for your time.
God bless you.

1 Like

Wicked progress!

Hello Everynone, all,

I’m in the unknown again!

To properly understand the construction method of the “ListView” I wanted to redo the same diagram by following the one you indicated to me. But problem, I do not achieve the desired result, yet it seems to me to have reproduced the same path.

Unreal tells me a problem in the add Item "but it’s the same procedure as in the previous exercise and it had not been refused.

Could you please enlighten me a bit.

Thanks in advance for your answer

to tell you the truth, I followed another method to see where the problem hides. I went straight through the List View Widget because I couldn’t find how to call the “Vents” of the “Level Blueprint”. Ants should be born without having to hit a key, it’s a “function” that takes care of that.

So I build the Blueprint by grouping everything except the update data I have into one function.



As you can see in both cases the method is the same, I add the data contained in the Bleuprint of the Pawn Actor in which is contained the variable which refers to the Structure, which contains the variables displayed in the ListView .

In one case there is display (code in the Wigdget), in the other not (code in the Level Bleuprint)

On the other hand, my problem with the case of the code in the Widget, I cannot save and load the data contained in the structure.

For example: have a look at what this script does:

To me it makes little sense. You load the game, enter a loop and then keep loading the same game again and again? Why? You’ve already loaded it… Sorry, I really do not follow the logic. Also, while you’re loading and iterating, you’re also saving it… Hard to imagine what kind of mess this creates. I might be misreading the whole thing, too, though.

to tell you the truth, I followed another method to see where the problem hides

Appreciate the honesty but please consider getting the basics to work first. Get the loading & saving to work with normal widgets. You’re insisting on getting the List View to work - are you already so far in development that you need the performance optimisation it provides? I’d start worrying about switching to the list view if I had thousands of ants. Are we there yet?

“You insist that list view works - are you already so far into development that you need the performance boost it provides?” »

It is precisely because I am not yet very far in the development that I need this List View to represent the ants on the screen without making them evolve in a 3D nest. My concepts is based on a simulation, not a game, but the visual is planned.

I think my main problem is that I don’t know how to order the events in the “Bleuprint”.

It also seems to me that I am only following your construction scheme, I just put the “Event SaveAnts” after the creation of the object in the list so that it is immediately saved