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.

XP: Interactive Saves

I want this Script to be XP since that's that only Version I own.
The thing is that I'm making a Game and wondered if "My First Game can benefit the second?".
Now what I'm looking for (which I don't hope is too much) is that if a player played <Game Title> Arc I,
and is now starting to play <Game Title> Arc II, the Second Game well recognize the first game by specific
Switches put ON in the First Game. Then certain things well happen if a switch is on
(ex.[1265: Player has beaten Game]=ON).
An Example is in Metal Gear Solid 3, is when he/she has a MGS2 Save in the Memory Card, it well unlock the "Raiden" Mask.
I know this is difficult but I would like it if this script is able to be made.
 
Ok, done.


Add this in Scene_Load after the similar lines:

Code:
$game_isaves = Marshal.load(file)

Then this in Scene_Save after the similar lines:

Code:
Marshal.dump($game_isaves, file)

Then add this in Scene_Title:

Code:
$game_isaves = Game_Isaves.new


Then in a new script above Main:

Code:
class Game_Isaves
  def initialize
    @data = []
  end
  def read_switches
    file_data("Save1.rxdata")
    @data[0] = file_data("Save1.rxdata") if FileTest.exist?("Save1.rxdata")
    @data[1] = file_data("Save2.rxdata") if FileTest.exist?("Save2.rxdata")
    @data[2] = file_data("Save3.rxdata") if FileTest.exist?("Save3.rxdata")
    @data[3] = file_data("Save4.rxdata") if FileTest.exist?("Save4.rxdata")
  end
  def [](x)
    return @data[x]
  end
  def file_data(file)
    file = File.open(file, "rb")
    @_a                  = Marshal.load(file) # characters # 0
    @_0                  = Marshal.load(file) # framecount # 1
    @_1                  = Marshal.load(file) # system # 2
    @_2                  = Marshal.load(file) # switches # 3
    @_3                  = Marshal.load(file) # variables # 4
    @_4                  = Marshal.load(file) # self_switches # 5
    @_5                  = Marshal.load(file) # screen # 6
    @_6                  = Marshal.load(file) # actors # 7
    @_7                  = Marshal.load(file) # party # 8
    @_8                  = Marshal.load(file) # troop # 9
    @_9                  = Marshal.load(file) # map # 10
    @_10                 = Marshal.load(file) # player # 11
    file.close
    return [@_a,@_0,@_1,@_2,@_3,@_4,@_5,@_6,@_7,@_8,@_9,@_10]
  end
end




How to use: IMPORTANT


$game_isaves[x ][y ][z ]

x = number of the save file
y = variable you are testing (see below)
z = number of the variable you are testing (see below)

X:

0 = Save1.rxdata
1 = Save2.rxdata
2 = Save3.rxdata
3 = Save4.rxdata

Y:

0 = characters, probably no use to you
1 = framecount, again no use
2 = game_system, again probably no use to you
3 = game_switches
4 = game_variables
5 = game_selfswitches
6 = game_screen
7 = game_actors
8 = game_party
9 = game_troop
10 = game_map
11 = game_player


How you'd use this then...


Let's say you wanted to see if switch 17, in save file "Save1", was true:

Code:
if $game_isaves[0][2][17] == true
  do this
else
  do that
end

Or to test if variable 20 in Save4.rxdata is equal to 217:

Code:
if $game_isaves[3][0][20] == 217
  do this
else
  do that
end



Understand?

Does it work? :) It works for me, but you never know.
 
Thanks!, I'm going to save it in my Game Folder so when I'm done with the first, I'll start the second game and see if it works  :thumb:

EDIT: Okay the problem is that, I'm guessing that there is possibly no script that scans the Computer for a "Rebirth", then "Save1" then the stuff in there with a certain variable/switch in it.  :down: So, if I were to tell the player in the Beginning of the Second Game to put his/her First Game Save Profile in the Second Game, the script would scan it?, and then it would restart the game unlocking some goods?.

I'm not a skilled scripter, but I know this can be difficult.
 

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