Titanhex
Sep 14 2011, 05:11 AM
I would benefit from making some variables I create stored on save. Unfortunately the only way I know how to do that is add them to game_system. It makes the line rather large though when I'm calling $game_system.somevariable Is there another way to make variables permanent?
Night5h4d3
Sep 14 2011, 05:16 AM
If you're just storing numbers, you should use $game_variables. Other than that and game_system, the only way to create a variable that will last through gameplay and into reload would be to create a new game class and to write the marshall functions in Scene_File.
Moving to RGSS2 script support
~ Night5h4d3
Continuing on with Nightshades response:
Scene_Save, find this:
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
Add
Marshal.dump($yourglobalvariable, file)
and do the same for Scene_Load:
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
Add
$yourglobalvariable = Marshal.load(file)