Correction: I coded the wipe function at the end incorrectly. Instead of what I did, what you want to do is set all of your NORMAL variables (so not those in your dictionary) to your "default" values, and THEN call the save function.
you can create a dictionary with multiple paths and leave them already established. as: var save_path = { "slot_01": "user://save_slot_01.dat", "slot_02": "user://save_slot_02.dat", "slot_03": "user://save_slot_03.dat", "slot_04": "user://save_slot_04.dat", "autosave_01" : "user://autosave_slot_01.dat", "autosave_02" : "user://autosave_slot_02.dat", "autosave_03" : "user://autosave_slot_03.dat", "autosave_04" : "user://autosave_slot_04.dat", } So, you make the save and load function need to receive a string argument func save(selected_slot): and when writing or reading the file, you will use this variable with the path var file = FileAccess.open(save_path[selected_slot], FileAccess.WRITE) so, in every script you want to call the function, you will call it with the slot you want to save, for exemple Global.save(slot_01) hope it helps
My wipe function is not working The game saves and when i load the game it continues from where i saved it but when i click on new game button where i called the wipe function and then get_tree change scene to ..... It takes me to the earlier saved position but when i restart the game again and this time before clicking on continue button in which i called load func if i click the new game button the player position resets to the position i assigned in the wipe function Please help brother 🥺❤️
@@randompirate774 if you don't mind can you please elaborate I didn't actually understand what to do as this is my first game project everything is done only the continue(load) and new game(wipe) is left the loading is working but please explain me what changes I have to do in the wipe function i really need your help because I got many videos but yours worked for me now only wipe is left to work and the game is good to go for launch Please help
@@magmaking5673 when the new game button is pressed, first you need to assign the "default" values to all the variables that are saved (these are the values that you want the player to have at the start of the game. then you want to call the save function, after which you'd want to call the load function, so the game can begin with the correct values assigned to the correct valuables.
@@randompirate774 Func on new pressed(): Global. Xpos = 250 Global. Ypos = 100 Global. Save_data() Global. Load_data() get tree change scene....... Is it correct?
@@randompirate774 I've since deleted the code that brought up the error, so I don't recall it exactly. So sorry. It was along the lines of "get_var function not within defined dictionary".
Correction: I coded the wipe function at the end incorrectly. Instead of what I did, what you want to do is set all of your NORMAL variables (so not those in your dictionary) to your "default" values, and THEN call the save function.
The method did not work Godot 4.2
love you brother i've been searching for this since 2 days almost tried 30-40 methods but you are the savior 😘😘❤❤❤❤❤❤❤❤❤
Thank you 4th tutorial that I watched first one that worked.
Helpful and easy to follow. Ty!
Thanks, my friend
THANK YOU SO MUCH!!!! you saved my game! (get it cause its a tutorial on designing a save system? [only good joke i can think of])
thanks i really tried to make a save system in godot 4 but failed until i found this video
3:35, so what if you want multiple save files?
you can create a dictionary with multiple paths and leave them already established. as:
var save_path = {
"slot_01": "user://save_slot_01.dat",
"slot_02": "user://save_slot_02.dat",
"slot_03": "user://save_slot_03.dat",
"slot_04": "user://save_slot_04.dat",
"autosave_01" : "user://autosave_slot_01.dat",
"autosave_02" : "user://autosave_slot_02.dat",
"autosave_03" : "user://autosave_slot_03.dat",
"autosave_04" : "user://autosave_slot_04.dat",
}
So, you make the save and load function need to receive a string argument
func save(selected_slot):
and when writing or reading the file, you will use this variable with the path
var file = FileAccess.open(save_path[selected_slot], FileAccess.WRITE)
so, in every script you want to call the function, you will call it with the slot you want to save, for exemple
Global.save(slot_01)
hope it helps
My wipe function is not working
The game saves and when i load the game it continues from where i saved it but when i click on new game button where i called the wipe function and then get_tree change scene to ..... It takes me to the earlier saved position but when i restart the game again and this time before clicking on continue button in which i called load func if i click the new game button the player position resets to the position i assigned in the wipe function
Please help brother 🥺❤️
yes i coded the wipe function incorrectly. you need to reset the variables, then save, then load and it should be correct
@@randompirate774 if you don't mind can you please elaborate
I didn't actually understand what to do as this is my first game project everything is done only the continue(load) and new game(wipe) is left the loading is working but please explain me what changes I have to do in the wipe function i really need your help because I got many videos but yours worked for me now only wipe is left to work and the game is good to go for launch
Please help
@@magmaking5673 when the new game button is pressed, first you need to assign the "default" values to all the variables that are saved (these are the values that you want the player to have at the start of the game. then you want to call the save function, after which you'd want to call the load function, so the game can begin with the correct values assigned to the correct valuables.
@@randompirate774
Func on new pressed():
Global. Xpos = 250
Global. Ypos = 100
Global. Save_data()
Global. Load_data()
get tree change scene.......
Is it correct?
@@randompirate774 thankyou very much brother it's working now 🥺🥺🥺
I don't know how good I am feeling now ❤️❤️❤️
Can you create a video for how to save in game with main menu and more than one scene♥💖
Sure! I have a different tutotoal planned next but I'll get on it as soon as I can!
It seems that the function "get_var" is not in the Godot 4.2 dictionary, so the code does not work with my project.
looking at the documentation, get_var should still be in godot 4.2. What exavtly is your error message?
@@randompirate774 I've since deleted the code that brought up the error, so I don't recall it exactly. So sorry. It was along the lines of "get_var function not within defined dictionary".
this doesn't work
but how do I get a girlfriend? Aaaaaaa
Wtf😂😂
你看我头像牛逼吗
The method did not work Godot 4.2
Got annoyed in 3 minutes watching this because of the "uuuh"s.
yeah, sorry. I'm trying to work on that.
How does it affect you?
same
very bad tutorial, too much "aaaaaaahhhhh" and you didn't explain properly at all.