Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 [Unsupported] Force Save Before Something
#1
Author Note: *sigh* Don't ask why I did this. It was requested by someone.

Create a new script, call it Scene_ForceSave2 and paste this script in there.
When saving, you cannot cancel out. You must save.

Code:
#==============================================================================
# ** Scene_ForceSave2
#------------------------------------------------------------------------------
#  This class performs save screen processing and there's no cancelling out.
#==============================================================================
class Scene_ForceSave2 < Scene_File
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super("Which file would you like to save to?")
  end
  #--------------------------------------------------------------------------
  # * Decision Processing
  #--------------------------------------------------------------------------
  def on_decision(filename)
    # Play save SE
    $game_system.se_play($data_system.save_se)
    # Write save data
    file = File.open(filename, "wb")
    write_save_data(file)
    file.close
    # If called from event
    if $game_temp.save_calling
      # Clear save call flag
      $game_temp.save_calling = false
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # Switch to map screen
    $scene = Scene_Map.new
  end
  #--------------------------------------------------------------------------
  # * Cancel Processing
  #--------------------------------------------------------------------------
  def on_cancel
    # Play cancel SE
    $game_system.se_play($data_system.cancel_se)
    # If called from event
    if $game_temp.save_calling
      # Clear save call flag
      $game_temp.save_calling = false
      # Will not go to menu. It will redirect to this scene until the player has saved.
      $scene = Scene_ForceSave2.new
      return
    end
    # Will not go to menu.
    $scene = Scene_ForceSave2.new
  end
  #--------------------------------------------------------------------------
  # * Write Save Data
  #     file : write file object (opened)
  #--------------------------------------------------------------------------
  def write_save_data(file)
    # Make character data for drawing save file
    characters = []
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      characters.push([actor.character_name, actor.character_hue])
    end
    # Write character data for drawing save file
    Marshal.dump(characters, file)
    # Wrire frame count for measuring play time
    Marshal.dump(Graphics.frame_count, file)
    # Increase save count by 1
    $game_system.save_count += 1
    # Save magic number
    # (A random value will be written each time saving with editor)
    $game_system.magic_number = $data_system.magic_number
    # Write each type of game object
    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)
  end
end
Now when doing an event, use the call script event command and call this.
$scene = Scene_ForceSave2

Then after that command, PLEASE use the wait frames command before anything else after using the call script command to call this script.

I do not support this script.
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Drago Save Layout LiTTleDRAgo 2 5,946 10-09-2017, 07:08 AM
Last Post: LiTTleDRAgo
   DoubleX RMMV Popularized ATB Force DoubleX 1 5,486 07-03-2016, 10:01 AM
Last Post: DoubleX
   [Unsupported] PK8's Self Variables XP PK8 4 9,355 03-08-2012, 01:54 PM
Last Post: LilyKnight
   1 Save Slot / AutoLoad Saved Game kyonides 1 5,963 07-09-2010, 08:38 AM
Last Post: Kread-EX
   [Unsupported] Title Skip 2 XP PK8 3 8,384 02-17-2010, 12:01 PM
Last Post: Villain
   [Unsupported] Actor & Party's Self Switches XP PK8 3 7,807 09-17-2009, 01:46 AM
Last Post: Yin
   [Unsupported] Actor & Party's Self Switches VX PK8 0 4,593 09-16-2009, 10:57 PM
Last Post: PK8
   [Unsupported] PK8's Self Variables VX PK8 1 5,530 09-16-2009, 10:20 AM
Last Post: Kain Nobel
   [Unsupported] Game Strings (Streamline dialogue!) PK8 3 8,295 09-15-2009, 11:28 PM
Last Post: Wyatt
   [Unsupported] Title Skip 1 PK8 2 6,304 09-15-2009, 10:44 PM
Last Post: DerVVulfman



Users browsing this thread: