Guys, this is probably something easy, but I can’t figure it out: how to save and load the array of booleans?
I’m building the first quest and the part of this quest is step by step enabling new abilities for the player, i.e. booleans “Is Walking Enable?” and “Is Jumping Enable?” etc. I’m setting it this way during quest:
What could I do wrong here? What’s the proper way to save & load booleans to implement player abilities like these ones?
I’ll be very grateful if someone will take their time to reply & help me solve this issue. (I can upload a project archive in a cloud storage if you’ll want to look at it by yourself)
I see you have all those bools + the array. You are populating the bool array and saving / loading it. But how are you connecting the array to those bool variables after loading? Assuming that the individual vars are the ones controlling the branches in the controller, not the array.
Something to note: I’m setting player state changes in quest BP, loading/saving it in boolean array in savegame component and having the second boolean array in player controller as a main one. (Haven’t found any tutorials about it, so not sure if I’m doing it right).
Try printing the length of the array after loading, also compare it to the values of each variables.
IMO a Map container will really help you organize all those bool. It’s something I recommend you explore after you’ve fixed your issue. Something like:
Did a quick test tryng to understand better your issue: https://www.youtube.com/watch?v=jMoQVd1Q9UQ IMO your problem could be a broken reference or the order of save / load / set the variables.
PrintString of the boolean arrays during save, load and the way it should actually work. (First part of the image is a start condition (player can’t move/jump/etc), second is what it looks like when I load it after saving and the final part is what it should have looked like if it would save/load correctly)
Can you share this through here? You just have to copy / paste and its free : https://blueprintue.com/
If the loaded array != saved array, then you could be saving and loading both on a different slot. The engine doesnt create arrays on its own, its pulling it from somewhere.
If the loaded array != saved array, then you could be saving and loading both on a different slot. The engine doesnt create arrays on its own, its pulling it from somewhere.
I thought the same, it loads as it was empty… when I was adapting it to my needs (quests & save/load are extensions, first person controller is made by following YouTube tutorials), I wasn’t sure if I did this part right:
Yes, I’m afraid I won’t find the solution alone. I’d be very grateful if you could look and tell me how could I change my additions to this code to make it finally work. Sending you the link to the project archive in PM.
NOTE: Having so many bool variable having to populate an array will be a problem later on because when the variables change during gameplay, the array will not update. Right now the array is populated by QuestTutorial actor at Begin Play. After that I did not see anything that updated the array in the MainHeroController. This means that when you progress through the game and the variables change, save game will have no way to know.