Restore the scene after a load
The goal
Section titled “The goal”After a saved game loads, a scheme that was running puts your scene right again: a door opens, a banner flies, a line welcomes the player back.
Do it, step by step
Section titled “Do it, step by step”- In the scheme, add an On Game Loaded node. It has no input and one output, Loaded.
- Link Loaded to what must happen after the load.
- To put scene objects right, link a Send Signal node and choose the same Signal asset the scheme sent when the change first happened. A Signal Receiver reacts to it again.
- To tell the player, link a Show Announcement.
The demo’s Tutorial scheme uses an announcement. Its On Game Loaded node leads to a Show Announcement titled Welcome back, shown only if a player plays the Conspirator.
Why you need it
Section titled “Why you need it”A save keeps the story: running schemes, their flows and variables. It does not keep what a Signal Receiver did to the scene.
Reactions are not saved, so the objects are as the scene made them.
What you will see
Section titled “What you will see”After the load, every On Game Loaded node of a scheme that was running starts a flow once the scheme’s restored flows are going again, and a scheme that has more than one such node starts all of them.
What can go wrong
Section titled “What can go wrong”- The node never runs. It runs only for schemes that were running when the game was saved. It never runs when a scheme starts.
- A scheme ends after the load. A scheme with no flow to restore and no On Game Loaded node ends after the load instead of staying alive.
- The flow cannot see other actors’ schemes. With Restore Order on Per Actor, an On Game Loaded flow of one actor can see other actors whose schemes are not back yet. After All Actors restores every run first, then runs every On Game Loaded node. The setting is on the Save System. A plain load from a file restores per actor whatever this setting says.
- Chances differ after a load. What the dice do after a load is the Dice After Load setting, New rolls at first.
- From code. Listen to
IntrigueSaveSystem.onLoadfor a load that is not tied to one scheme.
How it connects
Section titled “How it connects”- The node is On Game Loaded, and the signal is Send Signal. The idea is on Signals, and Change the scene without code shows the receiver.
- A load is explained on Saves, and the order of restoring on Loading after the database changed.
- The settings are on Save System.