Hello,
So I’ve created a small setup using the BP_PuzzleControlPower. I made it so that when the puzzle is completed, the lights in my manor turn on and a distant zombie scream plays to prepare what comes next. Everything works fine so far.
However, when I save the game and load it again, the puzzle state doesn’t seem to be saved properly. As a result, my manor ends up being plunged back into darkness.
I also created a variable in the Puzzle Master called Puzzle ID (a Name type) to define each puzzle individually, but I have to admit I’m a bit lost about where exactly I should go or how I’m supposed to use it properly in the save/load system.
If you have any idea why the puzzle state isn’t being saved correctly or how I should correctly use the Puzzle ID system, I’d really appreciate your help.
@auron Hey Auron,
This is actually pretty straightforward. For anything you want to persist in the save system, you need to assign it a unique identifier (ID or Name) and store it in your save data. For this case, I recommend creating a unique variable with the type of GUID in the BP_PuzzleMaster class.
Here’s the general approach:
1- Go to BP_ClassicSaveGame and create an array variable of type GUID, for example: SolvedPuzzles
2- Create the same variable inside AC_SaveGame as well.
3- Update your SaveData and LoadData functions:
-In SaveData, make sure this array is properly saved.
-In LoadData, make sure you retrieve it correctly.
4- In BP_PuzzleMaster, when the puzzle is solved (PuzzleSolved event), add the puzzle’s unique ID to the SolvedPuzzles array.
5- Then, in the same class, after a small delay (2 seconds in BeginPlay, just to ensure everything is loaded), check:
- If this puzzle’s ID already exists in the saved array, it means the puzzle was already solved.
- In that case, call PuzzleSolved again to restore its state.
6- Also make sure to set CanInteract to false so the player can’t interact with the puzzle again.
7- Finally, don’t forget to assign a valid, unique ID to each puzzle instance in the level.
I’ll also share some screenshots to help guide you through the process 👍
Hope this helps!
Hello, I’m getting back to you because I carefully followed your instructions, but the same issue still happens: when I save my game and reload it, everything resets again.
I tried to figure out where the problem could come from, and I even redid the whole process, but unfortunately it still doesn’t work.
@auron, please double-check and see if anything might have been missed or if something went wrong. According to image 5, try adding a Print String after the True branch and check if you reach to PuzzleSolved function. If not, refer to image 4 and verify whether the ID is being added correctly. Then let me know the result.
I just added a Print String after the branch, and no, it doesn’t go through. I do get “PuzzleSolved”, but my Print String message is not appearing (Image Test 01).
Then I checked the Is Valid from image 4 that you sent me. I do get the “PuzzleSolved” message in green, and my Print String works there as well (image ok and ok 2)
I just checked my ID, and it works correctly and matches (see images “ID PuzzleMaster” and “ID PuzzleMaster 2”).
I’m also attaching images of the SolvedPuzzles variables.
I’m also adding images of the LoadData and SaveData.
So in conclusion, my issue is coming from the branch, right?
Also, for my lights I created a BP_LightManager—could that possibly be the cause? Because that’s how I finish the puzzle (see “End Puzzle” image).
@auron That’s strange. You should see that Print String result right after the branch, and this will show that the problem is coming from there. That part is where it checks whether this puzzle has already been solved, and if it has, it calls PuzzleSolved again so the puzzle is considered solved.
Check the contents of the SolvedPuzzle array before the branch, loop through it and see what it gives you. Is there anything in that array at all?
If it’s empty, it probably wasn’t loaded correctly. Also, try increasing the 2-second delay to 4 seconds just for testing. I don’t know if you made any changes to the loading system or not. When you increase the delay, make sure to wait for the full duration before seeing the result.
OK, I’ll do that. But I also tested a Print String after the delay and nothing appears.
Also, no, I made some changes with version 1.7 of the Classic Survival Horror, but with 1.8 I didn’t touch anything yet—except just to make it load my map for now.
I’ll test what you told me and come back with the images =)
So I ran several Print tests, and I did the loop like you asked. In the loop I do get the correct ID and my Print String is displayed, but the lights are still off and I can still redo the puzzle.
However, I then connected the end of the loop to the rest of the system, and it worked: when I load the game I get “PuzzleSolved”, but my lights are still off. So I think the issue is coming from my BP.
Thank you for your help 😊 now I'm going to tackle my light BP so that it too is saved after solving the puzzle.
@auron Glad to hear the main issue is fixed! Yes, it sounds like the remaining problem is coming from your custom Light class. Make sure the light state is also being restored properly after loading. If you need any additional help, feel free to ask.
OK, sounds good, thank you very much! I’ve just fixed my BP Light. I haven’t tested it yet to see if it works, but I think I’m on the right track 😊
Have a great day!
Update: I managed to fix it by also using an ID for my lights synced with the puzzle. Now when I save and load, everything works perfectly 😊
Hi, I need a little help. I’ll explain the situation: I created a puzzle (if you can call it that) where wooden planks are blocking a path. If you don’t have the crowbar, a message appears saying that you need a tool. But if the player has it in their inventory, it triggers the next step.
I managed to get it working the way I wanted by reusing some of the logic from the computer puzzle. However, I’m running into an issue: if I select “No” when the question “Do you want to use the crowbar?” appears, it still executes the logic anyway.
Also, once the puzzle is completed, I can do it again, so I must have missed something. I’ve attached some screenshots. Thanks in advance!