Save-Point
Importing previous data to a 'sequal' - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Code Support (https://www.save-point.org/forum-20.html)
+--- Thread: Importing previous data to a 'sequal' (/thread-260.html)



Importing previous data to a 'sequal' - fgsfds - 05-06-2010

Just want to know if it's possible to import certain data (switches and variables mostly) to a new game, preferably a sequel?
(Meaning like everything you do in the first game have heavy influence and impact on the second game as well as difficulty)


Importing previous data to a 'sequal' - deValdr - 05-06-2010

Easy.

Marshal.dump($game_variables, file)

You can exchange $game_variables with the following:
$game_switches - switches
$game_party - party gold and stuff.
+ all other data of your choice.

Exchange "file" with location of the file.

"Save_File.rxdata" saves it directly into the game folder
"Data/Save_File.rxdata" saves it into the data folder.

EDIT:
If you want to save more than one variable into the file (both switches and variables for instance), you should make an array:
@file = [$game_variables, $game_switches]
Marshal.dump(@file, "Save_File.rxdata"]