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.

Choices in Scene_Save

Here's the problem: I can't think of a way to show choices in Scene_Save. It should be like this:
Do you wish to save?
Yes/no
if Yes
save
else
$scene = Scene_Menu.new(2)

Here's the Scene_Save I'm using (only a few small edits done by me, but it's different from the regular Scene_Save so I figured it would be best to post it)

Code:
#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
#  This class performs save screen processing.
#==============================================================================

class Scene_Save < 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 menu screen
    $scene = Scene_Menu.new(0)
  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
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # Switch to menu screen
    $scene = Scene_Menu.new(2)
  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

Code:
#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  This is a superclass for the save screen and load screen.
#==============================================================================

class Scene_File
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     help_text : text string shown in the help window
  #--------------------------------------------------------------------------
  #def initialize(help_text)
  #  @help_text = help_text
  #end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    on_decision(make_filename(@file_index))
      $game_temp.last_file_index = @file_index
    @file_index = $game_temp.last_file_index
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @help_window.update
    for i in @savefile_windows
      i.update
    end
  end
  #--------------------------------------------------------------------------
  # * Make File Name
  #     file_index : save file index (0-3)
  #--------------------------------------------------------------------------
  def make_filename(file_index)
    return "Save"
  end
end

Thanks
 
It's not a script for use, it's just showing which script I'm using, so people know that. All that needs to be done is add a message which displays 2 choices, yes and no. As soon as that's finished, the script will be done, which means it'll get posted in the submitted scripts. The script works with Scene_File, so it will instantly save as soon as the save button is pressed.
 

Anonymous

Guest

Is ok I have the choices and window, just making it pop up in the file save window and adding what happens when clicked.

bare in mind I am doing this while eating my tea :)
 
It'll be just like in Pokemon and some other games, where you will only have 1 slot available for saves. Having multiple slots is unnecessary for my game, so that's why I figured having only 1 slot would be best.
 

Anonymous

Guest

Sorry it's taking longer than I thought it should have been a simple
s1 =
s2 =
window blah blah

it will be done I just hope you have a bit more patients.
 

Anonymous

Guest

Thanks, I get worried when doing stuff for people I feel it has to be done within the next 5 minutes :)

[EDIT]

I can't get the window to be selectable! I have asked Raziel if he can help, so hopefully he can.
 

Anonymous

Guest

Right it is like 90% done, I just have a slight bug if I press the C key after I choose No it errors (disposed window) however If I press the X key instead it all works fine, so it shouldn't be long now.

Sorry for double posting but I need Tassadar to know there is a new post.
 
It doesn't seem to work for me. It gives a few errors for wrong number of arguments, but I might have found a way to do this myself. Just testing though, so you can continue to work on it if you wish. Thanks.
 

Anonymous

Guest

Try it in a blank project, and don't forget to replace the current scene_save.

it works fine for me, although I haven't checked for compatibility with other scripts
 
Well in a blank project it does work, just not the way I wanted it to work :D

Anyway, I decided to make a whole new scene for this, using a picture of how Scene_Menu looks like. This is because having an entirely black screen with a choice looks silly, and this gives you the impression it's the same screen. The downside to this? It will only work in my own project. I'm currently looking at a way to make this work in a blank project.

*Edit* Ok, I fixed everything and posted the script at the Submitted RGSS Scripts. Thanks for your help anyway ;)
 

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