Allowing two save states to trade resources between them.

Having two players both playing the game in their own way on their own time share a resource externally in a "bank".

Each player could use all or parts of the banked resource.

So player 1 in save slot one places 300gp into the "bank"

and player 2 can use the bank to get all or part of the "banked" gp and could add to the "banked" gp as well.

So I guess what I am asking is, is there a way to save a variable outside of a save state and access it in any game?
I've moved this thread to RGSSx Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.
Sorry my mistake, thank you for moving it instead of just deleting it and reminding me where to post.
How it work : $global_variable = [1,2,3,4,5] is the variables saved outside of the actual gamefile you can change it of course, remove or add it use variable 1 to 5 now, if you have a banker npc and your money in bank is stored in variable 1 when you talk to the banker (before everything) do execute_script
 

load_variableswhen you change the variable like deposit execute script after
 

save_variablesthen anyone who is talking to the banker no matter what save/game will have the same money
always do a load before a save else you will erase the current value of the file

the script : (before main)

Code:
$global_variable = [1,2,3,4,5]class Game_Interpreter    def load_variables    if (!FileTest.exist?("globalsave.rvdata2"))      v = []      for i in 0..$global_variable.size-1        v.push(0)      end      f = File.open("globalsave.rvdata2","wb")        Marshal.dump(v,f)      f.close    end    f = File.open("globalsave.rvdata2","rb")    @var = Marshal.load(f)    puts(@var)    f.close()    for i in 0..$global_variable.size-1      $game_variables[$global_variable[i]] = @var[i]    end  end    def save_variables    @var = []    for i in 0..$global_variable.size-1      @var.push($game_variables[$global_variable[i]])    end    puts(@var)    f = File.open("globalsave.rvdata2","wb")    Marshal.dump(@var,f)    f.close  end  end
Adiktuzmiko made a Shared Storage script, which let's you exchange literally any item/weapon/armor/gold between any save files. You can use that.
Thank you both so much. I really didn't think it would be possible.

I also thought I'd have to rewrite the game I am making if it was.

Joe

Original thread: https://forums.rpgmakerweb.com/threads/allowing-two-save-states-to-trade-resources-between-them.44366/