global save script not working

i dont like to make many forum posts and my apologies for making another one so soon after a different one, im just reaching my deadline for my game and im having some last minute troubles u-u

im trying to get this script to work [link] but no matter what i do it wont work so im assuming im doing something wrong. im more of a visual learner and theres no demo to play around with for this so im at a loss with it.

im using Mog's picture gallery and the game has multiple endings but only one ending that leads to the gallery.

essentially i need to have events that unlock each picture for the cutscene gallery but have it so you only have to see the image once to unlock it across all saves and including new game. a system switch essentially.

so if you were to get like... a bad ending, it would unlock the cutscene in the gallery if you replayed it on a new game and got the true ending with the image gallery.

i thought this script would be perfect and i set the event numbers in the script, but when i test it by turning it on, it doesnt carry over to a new game file or other save files like its supposed to.

i hope this all makes sense, im awful at describing things and i can try to be more specific if needed! the script is just basically not doing anything at all (its in the right place and everything) and theres not really any instructions on how to actually use it aside from "throw it in"
theres not really any instructions on how to actually use it aside from "throw it in"
So you didn't read the script instructions.

I'll give you one point - it save global save system, but it not really and rightly so.

What that save script does is save the contents of the switches and variables that you specified in the array in the script. If you never changed anything in the script, then all it is doing is saving the contents of switch 1 and variable 1.

The Picture Gallery would have it's data saved in $game_system.
so it's not a variable.

An addon could be made to have the data from the picture gallery saved to a variable and then it would be in the global save (if you marked the variable number as one that is to be saved.
So you didn't read the script instructions.

I'll give you one point - it save global save system, but it not really and rightly so.

What that save script does is save the contents of the switches and variables that you specified in the array in the script. If you never changed anything in the script, then all it is doing is saving the contents of switch 1 and variable 1.

The Picture Gallery would have it's data saved in $game_system.
so it's not a variable.

An addon could be made to have the data from the picture gallery saved to a variable and then it would be in the global save (if you marked the variable number as one that is to be saved.
except that i did actually change the specified switches ^^; i made a specific switch to test it and it didnt work, i just said there wasnt really any instructions ON the script page, i never said i didnt read them.

1712329602555.png


as you can see i changed the "switches to save" specifically switch 921 in order to test the script and then i set up an event that would trigger it, saved on an empty save file and then started up a new game and it didnt keep that switch to on.

i only mentioned the gallery simply because thats all i need this script for, it has nothing to do with any of the script, sorry for the confusion, i just wanted to specify what im doing.

id love to find an addon that would make the gallery save the unlocked cutscenes in the global save though, but im not sure how to go about doing that
as you can see i changed the "switches to save" specifically switch 921 in order to test the script and then i set up an event that would trigger it, saved on an empty save file and then started up a new game and it didnt keep that switch to on.
I'm not sure what you're doing wrong then because it should work. If you have a script that overwrites the methods the global save uses then it won't work.

You need to verify that the script works before you can move forward.

*removed
I'm not sure what you're doing wrong then because it should work. If you have a script that overwrites the methods the global save uses then it won't work.

You need to verify that the script works before you can move forward.

Spoiler: Global save for MOG Gallery
Ruby:
# ╔═══════════════════════════════════════════════╦════════════════════╗
# ║ Title: Global Save for MOG Gallery            ║  Version: 1.00     ║
# ║ Author: Roninator2                            ║                    ║
# ╠═══════════════════════════════════════════════╬════════════════════╣
# ║ Function:                                     ║   Date Created     ║
# ║                                               ╠════════════════════╣
# ║   Add save for Gallery                        ║    05 Apr 2024     ║
# ╚═══════════════════════════════════════════════╩════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Requires: TheLeech Global Save                                     ║
# ║           MOG Picture Gallery                                      ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Brief Description:                                                 ║
# ║          Add Global Save to MOG Gallery                            ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Instructions:                                                      ║
# ║   Set the Variable to be used below and make sure it is            ║
# ║   included in the Global Save script for variables.                ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Updates:                                                           ║
# ║ 1.00 - 05 Apr 2024 - Script finished                               ║
# ║                                                                    ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Credits and Thanks:                                                ║
# ║   Roninator2                                                       ║
# ║                                                                    ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Terms of use:                                                      ║
# ║  Follow the original Authors terms of use where applicable         ║
# ║    - When not made by me (Roninator2)                              ║
# ║  Free for all uses in RPG Maker except nudity                      ║
# ║  Anyone using this script in their project before these terms      ║
# ║  were changed are allowed to use this script even if it conflicts  ║
# ║  with these new terms. New terms effective 03 Apr 2024             ║
# ║  No part of this code can be used with AI programs or tools        ║
# ║  Credit must be given                                              ║
# ╚════════════════════════════════════════════════════════════════════╝

module R2_Global_Save_MOG_Gallery
  VARIABLE = 5
end

# ╔════════════════════════════════════════════════════════════════════╗
# ║                      End of editable region                        ║
# ╚════════════════════════════════════════════════════════════════════╝

#==============================================================================
# ** DataManager
#==============================================================================
module DataManager

  #--------------------------------------------------------------------------
  # overwrite method: self.setup_new_game
  #--------------------------------------------------------------------------
  alias :r2_new_game_gs_mog_gal   :setup_new_game
  def self.setup_new_game
    r2_new_game_gs_mog_gal
    $game_system.gallery = $game_variables[R2_Global_Save_MOG_Gallery::VARIABLE]
  end

  #--------------------------------------------------------------------------
  # overwrite method: self.save_game(index)
  #--------------------------------------------------------------------------
  alias :r2_save_game_gs_mog_gal   :save_game
  def self.save_game(index)
    $game_variables[R2_Global_Save_MOG_Gallery::VARIABLE] = $game_system.gallery
    r2_save_game_gs_mog_gal
  end

  #--------------------------------------------------------------------------
  # overwrite method: self.load_game(index)
  #--------------------------------------------------------------------------
  alias :r2_load_game_gs_mog_gal   :load_game
  def self.load_game(index)
    r2_load_game_gs_mog_gal
    $game_system.gallery = $game_variables[R2_Global_Save_MOG_Gallery::VARIABLE]
  end
end # end of module DataManager
yeah OTL ive been trying to test it on a test map just to see if the switch carries over into a new game file or another save file to no avail

i have no idea what im doing wrong for it to not work because im pretty sure i did everything the script said to do and to my knowledge i dont have any other scripts that would also effect the global save, ive even tried removing scripts and testing but its the same issue


i super appreciate the help btw x_x am i supposed to add this to the mog gallery or standalone in the scripts cause its currently on its own

i did change variable from 5 to 57 instead since 5 was already designated for a variable in the game

edit/ i made a totally new vx ace game file and the global save script and mogs gallery script are the only two scripts in it and the global save is still not working >~<

edit2/ its mogs script itself, i removed it and tested it with ONLY the global script and its working now so i guess thats the problem, im not sure how to fix it though


edit 3/ alright im stupid, my deepest apologies for how dumb i am, its been a long night, the global save script is working just fine, its just not saving the cutscenes for the gallery specifically, but i think i can totally find an (annoying) work around using conditional branches now that i know the global script is working so ill just make it turn them on upon clicking the gallery depending on if the switch has been turned on in other saves (i just have to do it 99 times)
the global save script is working just fine, its just not saving the cutscenes for the gallery specifically,
I just tested the scripts together and yes I see that they don't work together.
Let me see if that can be corrected.

*figured it out.

The Global save needs to be above MOG scripts. Including my addon.
Spoiler: MOG Gallery Global Save
Ruby:
# ╔═══════════════════════════════════════════════╦════════════════════╗
# ║ Title: Global Save for MOG Gallery            ║  Version: 1.01     ║
# ║ Author: Roninator2                            ║                    ║
# ╠═══════════════════════════════════════════════╬════════════════════╣
# ║ Function:                                     ║   Date Created     ║
# ║                                               ╠════════════════════╣
# ║   Add save for Gallery                        ║    05 Apr 2024     ║
# ╚═══════════════════════════════════════════════╩════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Requires: nil                                                      ║
# ║                                                                    ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Brief Description:                                                 ║
# ║          Add Global Save to MOG Gallery                            ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Instructions:                                                      ║
# ║   Set the Variable to be used below and make sure it is            ║
# ║   included in the Global Save script for variables.                ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Updates:                                                           ║
# ║ 1.00 - 05 Apr 2024 - Script finished                               ║
# ║ 1.01 - 05 Apr 2024 - Fixed alias and tested                        ║
# ║                                                                    ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Credits and Thanks:                                                ║
# ║   Roninator2                                                       ║
# ║                                                                    ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Terms of use:                                                      ║
# ║  Follow the original Authors terms of use where applicable         ║
# ║    - When not made by me (Roninator2)                              ║
# ║  Free for all uses in RPG Maker except nudity                      ║
# ║  Anyone using this script in their project before these terms      ║
# ║  were changed are allowed to use this script even if it conflicts  ║
# ║  with these new terms. New terms effective 03 Apr 2024             ║
# ║  No part of this code can be used with AI programs or tools        ║
# ║  Credit must be given                                              ║
# ╚════════════════════════════════════════════════════════════════════╝

module R2_Global_Save_MOG_Gallery
  VARIABLE = 5
end

# ╔════════════════════════════════════════════════════════════════════╗
# ║                      End of editable region                        ║
# ╚════════════════════════════════════════════════════════════════════╝

#==============================================================================
# ** DataManager
#==============================================================================
module DataManager

  #--------------------------------------------------------------------------
  # overwrite method: self.setup_new_game
  #--------------------------------------------------------------------------
  class << self
  alias r2_new_game_gs_mog_gal   setup_new_game
  alias r2_save_game_gs_mog_gal   save_game
  alias r2_load_game_gs_mog_gal   load_game
  end
  def self.setup_new_game
    r2_new_game_gs_mog_gal
    $game_system.gallery = $game_variables[R2_Global_Save_MOG_Gallery::VARIABLE] if
    $game_variables[R2_Global_Save_MOG_Gallery::VARIABLE] != 0
  end

  #--------------------------------------------------------------------------
  # overwrite method: self.save_game(index)
  #--------------------------------------------------------------------------
  def self.save_game(index)
    $game_variables[R2_Global_Save_MOG_Gallery::VARIABLE] = $game_system.gallery
    r2_save_game_gs_mog_gal(index)
  end

  #--------------------------------------------------------------------------
  # overwrite method: self.load_game(index)
  #--------------------------------------------------------------------------
  def self.load_game(index)
    r2_load_game_gs_mog_gal(index)
    $game_system.gallery = $game_variables[R2_Global_Save_MOG_Gallery::VARIABLE] if
    $game_variables[R2_Global_Save_MOG_Gallery::VARIABLE] != 0
  end
end # end of module DataManager

Original thread: https://forums.rpgmakerweb.com/threads/global-save-script-not-working.167507/