Godot Version
4.7.stable
Question
I’m trying to code the “load” function but I get the following error:
“E 0:00:03:293 _load: Invalid type in function ‘get_var’ in base ‘FileAccess’. Cannot convert argument 1 from Array to bool.”
Code below:
func _load():
if FileAccess.file_exists(FILE_PATH):
var file: FileAccess = FileAccess.open_encrypted_with_pass(FILE_PATH, FileAccess.READ, "asdf9234gjkfgh90u")
num_rows = file.get_var(num_rows)
num_columns = file.get_var(num_columns)
balance = file.get_var(balance)
dice_bag = file.get_var(dice_bag) #Error happens on this line
upgrades_count = file.get_var(upgrades_count)
mob_wave_capacity = file.get_var(mob_wave_capacity)
wizard_tower_health = file.get_var(wizard_tower_health)
file.close()
get_tree().change_scene_to_file("res://Scenes/main.tscn")
print("Game loaded")
The “dice_bag” variable is an array that I’m trying to load from a save file.