Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Munkis' Game End..
munkis
post Jan 4 2011, 08:59 AM
Post #1


Woah, dude...
Group Icon

Group: Revolutionary
Posts: 197
Type: Writer
RM Skill: Intermediate




Munkis' Game End

Version: 1.53
Author: munkis
Release Date: 01/04/2011


Exclusive Script at RPG RPG Revolution


Introduction
One of the first scripts I ever made, this adds functionality to the otherwise useless Scene_End.

Features
Not much to say; adds commands to the Scene_End menu.

Script
Munkis' Game End
CODE
#------------------------------------------------------------------------------
#  * Munkis' Game End V 1.53
#  * Adds functionality to the otherwise useless Scene_End menu
#  * Overwrites Scene_End
#  * V 1.0: Initial Release
#  * V 1.1: Fixed some uninitialized constant errors.  Should work fine now.
#  * V 1.2: Fixed syntax error.
#  * V 1.3: "New Game" Command added.
#  * V 1.4: Automatically change the main menu text.
#  * V 1.5: Cleaned up code (now that I know how to use arrays); also added an
#           option to change the window opacity.
#  * V 1.51: Can disable save menu access from within the config module.
#  * V 1.52: The command window now scrolls when you add more commands than
#            can fit in the window.
#  * V 1.53: Script now removes the save command with the use of the "Disable
#            Save Access" event command.
#------------------------------------------------------------------------------


module MNK_Game_End

  #These change the menu text.

  MAIN_MENU_COMMAND = "Game Options"

  EGC_MENU_COMMANDS = ["New Game","Load","Save","Quit to Title","Quit Game","Return to Menu"]

  #The first two numbers in this array CANNOT be zero or negative.  The last
  #three can, however.  But setting the opacity to a negative number won't make
  #it any more transparent.
  #CHOICE_WINDOW_DIM = [width, columns, center_x, center_y, opacity]

  CHOICE_WINDOW_DIM = [175,1,-3,10,0]

end
  
  #--------------------------------------------------------------------------
  #  *Editing anything beyond this point may result in your game going
  #  *totally sick-house on your PC and turning it into a goddamn turd farm,
  #  *which is pretty gross.
  #--------------------------------------------------------------------------
  
class Scene_End < Scene_Base

def Vocab.game_end
  MNK_Game_End::MAIN_MENU_COMMAND
end

  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    create_command_window
  end
  #--------------------------------------------------------------------------
  # * Post-Start Processing
  #--------------------------------------------------------------------------
  def post_start
    super
    open_command_window
  end
  #--------------------------------------------------------------------------
  # * Pre-termination Processing
  #--------------------------------------------------------------------------
  def pre_terminate
    super
    close_command_window
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_command_window
    dispose_menu_background
  end
  #--------------------------------------------------------------------------
  # * Return to Original Screen
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Menu.new(0)
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @command_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      case @command_window.index
      when 0  # New Game
        Scene_Title.new.create_game_objects
        command_new_game
      when 1  # Load Game
        command_load
      when 2  # Save Game
        if $game_system.save_disabled
          command_quit_to_title
        else
          command_save
        end
      when 3  # Quit to Title
        if $game_system.save_disabled
          command_quit_game
        else
          command_quit_to_title
        end
      when 4  # Quit Game
        if $game_system.save_disabled
          command_return
        else
          command_quit_game
        end
      when 5  # Return to Title
        command_return
    end
  end
end
  #--------------------------------------------------------------------------
  # * Update Background for Menu Screen
  #--------------------------------------------------------------------------
  def update_menu_background
    super
    @menuback_sprite.tone.set(0, 0, 0, 0)
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = MNK_Game_End::EGC_MENU_COMMANDS[0]
    s2 = MNK_Game_End::EGC_MENU_COMMANDS[1]
    s3 = MNK_Game_End::EGC_MENU_COMMANDS[2]
    s4 = MNK_Game_End::EGC_MENU_COMMANDS[3]
    s5 = MNK_Game_End::EGC_MENU_COMMANDS[4]
    s6 = MNK_Game_End::EGC_MENU_COMMANDS[5]
    if $game_system.save_disabled             # If save is forbidden
      @command_window = Window_Command.new(MNK_Game_End::CHOICE_WINDOW_DIM[0], [s1, s2, s4, s5, s6], MNK_Game_End::CHOICE_WINDOW_DIM[1])
    else
      @command_window = Window_Command.new(MNK_Game_End::CHOICE_WINDOW_DIM[0], [s1, s2, s3, s4, s5, s6], MNK_Game_End::CHOICE_WINDOW_DIM[1])
    end
    @command_window.x = (544 - @command_window.width + MNK_Game_End::CHOICE_WINDOW_DIM[2]) / 2
    @command_window.y = (416 - @command_window.height + MNK_Game_End::CHOICE_WINDOW_DIM[3]) / 2
    @command_window.openness = 0
    @command_window.opacity = MNK_Game_End::CHOICE_WINDOW_DIM[4]
    @command_window.height = 180
  end
  #--------------------------------------------------------------------------
  # * Dispose of Command Window
  #--------------------------------------------------------------------------
  def dispose_command_window
    @command_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Open Command Window
  #--------------------------------------------------------------------------
  def open_command_window
    @command_window.open
    begin
      @command_window.update
      Graphics.update
    end until @command_window.openness == 255
  end
  #--------------------------------------------------------------------------
  # * Close Command Window
  #--------------------------------------------------------------------------
  def close_command_window
    @command_window.close
    begin
      @command_window.update
      Graphics.update
    end until @command_window.openness == 0
  end
  #--------------------------------------------------------------------------
  # * New Game
  #--------------------------------------------------------------------------
  def confirm_player_location
    if $data_system.start_map_id == 0
      print "Player start location not set."
      exit
    end
  end
  
  def command_new_game
    confirm_player_location
    Sound.play_decision
    $game_party.setup_starting_members            # Initial party
    $game_map.setup($data_system.start_map_id)    # Initial map position
    $game_player.moveto($data_system.start_x, $data_system.start_y)
    $game_player.refresh
    $scene = Scene_Map.new
    RPG::BGM.fade(1500)
    close_command_window
    Graphics.fadeout(60)
    Graphics.wait(40)
    Graphics.frame_count = 0
    RPG::BGM.stop
    $game_map.autoplay
  end
  #--------------------------------------------------------------------------
  # * Load Game
  #--------------------------------------------------------------------------
  def command_load
    Sound.play_decision
    $scene = Scene_File.new(false, false, false)
    close_command_window
    Graphics.fadeout(60)
  end
  #--------------------------------------------------------------------------
  # * Save Game
  #--------------------------------------------------------------------------
  def command_save
    Sound.play_decision
    $scene = Scene_File.new(true, false, false)
  end
  #--------------------------------------------------------------------------
  # * Quit to Title
  #--------------------------------------------------------------------------
  def command_quit_to_title
    Sound.play_decision
    RPG::BGM.fade(800)
    RPG::BGS.fade(800)
    RPG::ME.fade(800)
    $scene = Scene_Title.new
    close_command_window
    Graphics.fadeout(60)
  end
  #--------------------------------------------------------------------------
  # * Quit Game
  #--------------------------------------------------------------------------
  def command_quit_game
    Sound.play_decision
    RPG::BGM.fade(800)
    RPG::BGS.fade(800)
    RPG::ME.fade(800)
    $scene = nil
  end
  #--------------------------------------------------------------------------
  # * Return to Menu
  #--------------------------------------------------------------------------
  def command_return
  Sound.play_decision
  return_scene
  end
end


Customization
You can change the Scene_Menu commands, as well as the opacity and the vocab term for Scene_End.

Compatibility
OVERWRITES Scene_End.

Screenshot
It's an expanded version of the Scene_End command_window; nothing fancy-schmancy here.

DEMO
Not needed, this script is plug&play.

Installation
Place in MATERIALS, above MAIN.

FAQ
Q: ZOMG teh scripz doesn't werk!!!
A: First of all, be more specific, Second, all reports typed in chat-speak or 1337-speak will be ignored.

Terms and Conditions
I don't mind if this script is posted or linked on other RMVX sites AS LONG AS YOU GIVE CREDIT!!! Same goes for using this in your project. Contact me if you want to use this in a commercial project.

Credits
Credit me (munkis).


__________________________
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 18th June 2013 - 07:06 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker