10. Save System - dylogaming/Dialogue-Component GitHub Wiki

Overview

image

The DC Save Ref object is where various properties are saved, such as actor location and the branches each actor was left on

Description Image
The properties are saved in the struct and can be extracted like this image
If you are going to use this asset's save file, ensure you set these bools to true on the Player's Dialogue Component's Save Struct

If you don't, the struct will still be updated throughout your play session (and can be used for your own save system if you're using one)
image

Explanation

💾 Saving

Saving is a tricky thing to grasp at first, so this may be difficult to understand until you get it down.

Description Image
Let's start with the custom events that come with the default BP_DC_TPC image
Here we have several functions that utilize the save logic when these keys are pressed image
Description Image
The way "Save Game" works is if a save slot doesn't exist, one is created, and when created, it saves the data from all actor transforms, their current START branches, and conditions into the DC Save REF's struct image

The image below shows in the first comment box, that the system loops through every actor and checks if they have the Dialogue Component

For all the actors that do, the next comment box gets their transforms added to the DC Save Ref's struct, as well as their current START (branch), and the player's conditions

image

💿 Loading

Description Image
When the "Load" event is called, the system extracts the data from the DC Save Ref's struct and sets the properties for each actor image

image

For example, within the "Set Transforms" collapsed node, we can see that DC Save REF's structs "Actor Transform" map is used to load up each actor & their transform data that was previously saved, and sets their transform using it, restoring it to exactly how it was when the player saved the game.

image

The same occurs when the system loads up each actor's START branch

image

🧩 Using With Other Assets

When using save systems from other assets, you basically want to call upon either the entire, or partial parts of the save and load logic from the Dialogue Component

So if another asset has a save button, you'd add the Dialogue Componeont's save logic, and same for loading

⚠️ **GitHub.com Fallback** ⚠️