Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

saving game_party

I've been heavily editing Game_Actor class, and now when I load the game, my party members are gone. what's the syntax to include party members in the save file?
*I did save them is $game_actors
*I'm using the SDK.
 

khmp

Sponsor

Your current party is stored inside of Game_Party. An Array object called "actors". You would access them as such:
Code:
$game_party.actors
To save your current party as well as other things:
Code:
Marshal.dump($game_party, file)
And then to load them safely use these lines:
Code:
begin
  $game_party = Marshal.load(file)
rescue
  $game_party = Game_Party.new
end

One last thing make sure the load position matches the save position. For example:
Code:
save a
save b
save c
...
load a
load b
load c
Don't do something like this:
Code:
save a
save b
save c
...
load b
load a
load c

As always good luck with your script silver wind! :thumb:
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top