RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
GameOver Menu

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 79
I am using the Game Over Menu script by Moon, but have run into some problems with it.

1.) It does not play a sound effect when you choose "Back to Title" like it does for the other options.
2.) When you load a file from Continue, it will not play the map bgm or bgs.

Besides those small fixes, I was wondering if I could get a Confirm/Cancel choice box to show up on each of the selections:

Something centered and preferably this size. Thank you for looking over my request. ^^

Code: [Select]
#~ -----------------------------------------------------------------------------
#~ |                        $Game Over Menu by Moon$                           |
#~ -----------------------------------------------------------------------------
#~ |      What this script do?                                                 |
#~ |  It adds menu in the Gameover scene                                       |
#~ |  You will be able to choose between                                       |
#~ |       "Back to the title"                                                 |
#~ |       "Continue"                                                          |
#~ |       "Shutdown"                                                          |
#~ |  Ufcourse, these menus are all vocab and can be changed                   |
#~ -----------------------------------------------------------------------------


module Vocab
  #~ Change the vocab here if you want something different
  Back_to_title = "Back To Title"
end


class Scene_Gameover < Scene_Base 
  def start
    super
    RPG::BGM.stop
    RPG::BGS.stop
    $data_system.gameover_me.play
    create_gameover_graphic
    check_continue
    create_game_over_window
  end
 
  def update
    super
    @command_window.update
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0    # Back to title
      $scene = Scene_Title.new
      Graphics.fadeout(120)
      when 1    # Continue
        command_continue
      when 2    # Shutdown
        command_shutdown
      end
    end
  end
 
  def terminate
    super
    dispose_command_window
    snapshot_for_background
    dispose_title_graphic
  end
 
  def create_game_over_window
    s1 = Vocab::Back_to_title
    s2 = Vocab::continue
    s3 = Vocab::shutdown
    @command_window = Window_Command.new(172, [s1, s2, s3])
    @command_window.x = (544 - @command_window.width) / 2
    @command_window.y = 288
    if @continue_enabled
      @command_window.index = 1
    else
      @command_window.draw_item(1, false)
    end
    @command_window.openness = 0
    @command_window.open
  end
 
  def dispose_command_window
    @command_window.dispose
  end
 
  def dispose_title_graphic
    @sprite.bitmap.dispose
    @sprite.dispose
  end
 
  def check_continue
    @continue_enabled = (Dir.glob('Save*.rvdata').size > 0)
  end
 
  def command_continue
    if @continue_enabled
      Sound.play_decision
      $scene = Scene_File.new(false, true, false)
    else
      Sound.play_buzzer
    end
  end
 
  def command_shutdown
    Sound.play_decision
    RPG::BGM.fade(800)
    RPG::BGS.fade(800)
    RPG::ME.fade(800)
    $scene = nil
  end
end
« Last Edit: October 13, 2011, 12:18:42 AM by Kyriaki »
.: Current Project :.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
(1) Go to line 36. You should see this:

Code: [Select]
      when 0    # Back to title
      $scene = Scene_Title.new
      Graphics.fadeout(120)

Change it to:

Code: [Select]
      when 0    # Back to title
        Sound.play_decision
        $scene = Scene_Title.new
        Graphics.fadeout(120)


(2) I don't think that's an issue with this script as all this script does is call the default Scene_File for loading saves. By default, the way that works is that when a file is saved, it will take the bgm that is currently playing (or the last one) and save it to the file. Then, continuing will load that old BGM and play it.

So it might be a problem with a save script or even with how you access the save scene if it changes the music before going into it, etc.. I don't see how this script would effect that error though.



For the last part, again, where this script simply calls Scene_File to do its work, any script that would generally create a confirmation dialog will work.

I recommend Zeriab's Dialog System. The example dialog he provides is exactly a confirmation dialog, though the sample implementation is only for saving over files, not when loading them.

But basically, you could copy the Dialog System script and add it into its own slot above Main and below Materials.

Then copy the Dialog_YesNo script he has there and put it in its own slot above Main but below the Dialog System script.

Then, instead of the sample implementation he has, paste the following code into its own slot, again above Main and below Materials:

Code: [Select]
class Scene_File < Scene_Base
  alias scene_file_dialog_determine_savefile determine_savefile
  #--------------------------------------------------------------------------
  # * Determine savefile
  #--------------------------------------------------------------------------
  def determine_savefile
    if @savefile_windows[@index].file_exist
      txt = @saving ? "Do you want to overwrite the old savegame?" :
            "Are you sure you want to load that file?"
      var = Dialog_YesNo.show(false, txt)
      unless var
        Sound.play_cancel
        return
      end
    end
    scene_file_dialog_determine_savefile
  end
end


Basically, it is the same as Zeriab's code. The only change I made was so that it would also ask for confirmation when loading a file, not just when overwriting a file.

Mind you, it will only give the Dialog when saving if you are overwriting a file that already exists. Otherwise, no.

**
Rep:
Level 79
I got this resolved, thanks. ^^
.: Current Project :.