I have level 0 rusted sword, ithen I upgrade it... and save my game.
I implemented my save system by following godotGodot tutorials on save data. But with this approach, after openingexiting and re-launching the game, all rusted swords in the game are now upgraded.
What do I have to do so that only that specific sword is upgraded? Please don't answer to "depends on your system"
myMy current system is shit I'll gladly rework it.
but as of now it's works like this:
detect item on floor:
press key to pick:
check what type of item it is:
check if item slot is viable:
delete item from floor, add into the item slot
andAnd I reverse the order for dropping items, which ofcourseof course means that item idID changes every time it is dropped and instanced again, so using itthat is problematic.
func savePlayerData():
var data = {
"strength": strength,}
var dir = Directory.new()
if !dir.dir_exists(SAVE_DIR):
dir.make_dir_recursive(SAVE_DIR)
var file = File.new()
var error = file.open_encrypted_with_pass(save_path, File.WRITE, "P@paB3ar6969")
if error == OK:
file.store_var(data)
file.close()
func loadPlayerData():
var file = File.new()
if file.file_exists(save_path):
var error = file.open_encrypted_with_pass(save_path, File.READ, "P@paB3ar6969")
if error == OK:
var player_data = file.get_var()
file.close()
if "strength" in player_data:
strength = player_data["strength"]