Hey, I’m busy designing a game where a players choices will be essential to the storyline and I’m not sure how to create an autosave system or even a simple save/load system.
Would appreciate any help or tips, thank you very much.
You can create a couple structs and a data table to help you do this.
ChoiceOption Struct
- Name
- Description
CharacterChoices Struct
- Title
- Description
- Array of
ChoiceOption Struct
- Index of selected choice. (default
-1
)
Make a DataTable
to hold the CharacterChoices Struct
. Fill this table with the choices you want available in your game.
In your GameMode
create a new Map of CharacterChoices
variable. On BeginPlay
load the variable with default values of your choices DataTable
.
Then you can lookup the choices in your gamemode’s table, and when someone makes a choice you can set the Index of selected choice
.
If you include the variable in your save data, then this will become persistent.
Follow this on creating the save object. Saving Your Game with Blueprints.