How to open all save files one by one and read one variable from each

V4.3.stable.official

Hello all!

I’m VERY new at using Godot and programming in general, and as have many, I’ve dived into a very ambitious first project.

First, a little background on what I’m working toward and what I’m trying to do. I’m working on a retro style RPG battle game where all the characters in your party are customizable. It’s a rogue-like, and at the beginning of each run, the player will be able to pick which of their characters to put in their party. I’ve made the character creator and a way to store a character after it is created as a dictionary of important values. I’m saving that dictionary as a .save file with the character’s name in the file name.

→ What I need help with is loading the characters in so the player can select them. I want to load each character and read each ones’ name. I should be able to save all these names to an array at that point and I’m pretty sure I can make it work from there. Thanks for the help!

1 Like

You need to instanciate them. If u dont know in what function to write the variable, just do(for example) @onready var x = $CharacterBody2D.
Use preload() or load() instead.
If its a scene(if you want to instanciate a whole character, with CollisionShape, script and Sprite etc., you should make him in a seperate scene)
var scene = load(“res://path_to_scene”)
var instance = scene.instance()
$Node2D2.add_child(instance)
Do it in the process function cuz the ready function is run only once at the beginning

btwIf u want to learn Godot I’d advise you to make many small projects to play around with keywords and learn what you can do with them and repeating is good for learning

1 Like