Bem-vindo, visitante!
 Login:  Senha:
Para refletir: "Deus só conseguiu acabar o mundo em sete dias porque não se deu ao trabalho de corrigir os bugs." - RdJpB

Autor Tópico: Advanced Options Menu  (Lido 3845 vezes)

0 Membros e 1 Visitante estão vendo este tópico.

FaeL

  • Visitante
Advanced Options Menu
« em: 02 de Novembro de 2008, 14:11:22 »
Pontuação: 1
Advanced Options Menu
Criado por psiclone

Introdução
O Script é muito util, adiciona opções ao jogo, aonde pode mudar várias coisas, como volume do audio, resolução da tela entre outras coisas.

Screenshot
Spoiler(Clique para mostrar/esconder)


Script
Código: [Selecionar]
####################################################
# Custom Options Menu                              #
####################################################
#                                                  #
#    Audio Options by:                             #
#     by Akin                                      #
#       credit to 'L' who's custom menu helped     #
#       me figure out what to do                   #
####################################################

####################################################
#    Psiclone:                                     #
#    All I did was add in the resolution and       #
#    windowskin options.                           #
####################################################
#----------------- Version 1.1 ---------------------
####################################################
#   This script calls an options menu.             #
#                                                  #
#  Call using "$scene = Scene_Options.new"         #
#                                                  #
####################################################

#------------------------------------------------------------------------------
# Set this to the number of windowskin options that you want.
# You will then need to add the windows to the array at code line 59
# -----------------------------------------------------------------------------
NO_WINDOWSKINS = 3

#------------------------------------------------------------------------------
# Set this to true if you are using Modern Algebra's Advanced Text System
#-----------------------------------------------------------------------------
MA_AMS = false

module OptionCommand
#Main Option Commands
Audio     = 'Audio'
Controls   = 'Controls'
  Resolution    = 'Screen'
  Windows       = 'Windowskins'
Exit_Options = 'Back'
#Audio Option commands
  Audiobgm      = 'Music Volume'
  Audiobgs      = 'Background Effects Volume'
  Audiome       = 'Musical Effects Volume'
  Audiose       = 'Sound Effects volume'
#BGM Options
  AudiobgmV = ["Down", "Up"]
#BGS Options
  AudiobgsV = ['Down', 'Up']
#SE Options
  AudioseV  = ['Down', 'Up']
#ME Options
  AudiomeV  = ['Down', 'Up']
#Resolution Options
  ResolutionS = ['Default', '800x600', '1024x768', '1280x1024', '1600x1200']
###############Windowskin Options -- Add more window choices here.##############
#######These can be named anything you want as long as they're in quotes.#######
  WindowsS = ['Window 1', 'Window 2', 'Window 3']
end

#==============================================================================
# ** Scene_Options
#------------------------------------------------------------------------------
#  This class performs the Options screen processing.
#==============================================================================

class Scene_Options < Scene_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(options_index = 0)
    @options_index = options_index
    options_init
  end
  #--------------------------------------------------------------------------
  # * Set Commands
  #--------------------------------------------------------------------------
  def options_init
    @options = []
    op1 = OptionCommand::Audio
    op2 = OptionCommand::Controls
    op3 = OptionCommand::Resolution
    op4 = OptionCommand::Windows
    op5 = OptionCommand::Exit_Options
    @options.push(op1, op2, op3, op4, op5).flatten!
   
    @audio_options = []
  aud1 = OptionCommand::Audiobgm
  aud2 = OptionCommand::Audiobgs
  aud3 = OptionCommand::Audiome
  aud4 = OptionCommand::Audiose
    @audio_options.push(aud1, aud2, aud3, aud4).flatten!
   
      @bgm_options = OptionCommand::AudiobgmV
     
      @bgs_options = OptionCommand::AudiobgsV
     
      @se_options = OptionCommand::AudioseV
     
      @me_options = OptionCommand::AudiomeV
     
    @resolution_options = OptionCommand::ResolutionS

    @windows_options = OptionCommand::WindowsS
  end
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    create_options_window
    create_audio_window
    create_bgm_window
    create_bgs_window
    create_se_window
    create_me_window
    create_resolution_window
    create_windows_window
    create_controls_window
    @help_window = Window_Help.new
    @help_window.viewport = @viewport
  @help_window.set_text("Options")
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @options_window.dispose
    @audio_options_window.dispose
      @bgm_options_window.dispose
      @bgs_options_window.dispose
      @se_options_window.dispose
      @me_options_window.dispose
    @resolution_options_window.dispose
    @windows_options_window.dispose
    @controls_window.dispose
  @help_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @options_window.update
    @audio_options_window.update
      @bgm_options_window.update
      @bgs_options_window.update
      @se_options_window.update
      @me_options_window.update
    @resolution_options_window.update
    @windows_options_window.update
    @controls_window.update
  @help_window.update
    if @options_window.active
      update_options_selection
    elsif @audio_options_window.active
      update_audio_options_selection
    elsif @bgm_options_window.active
      update_bgm_options_selection
    elsif @bgs_options_window.active
      update_bgs_options_selection
    elsif @se_options_window.active
      update_se_options_selection
    elsif @me_options_window.active
      update_me_options_selection
    elsif @resolution_options_window.active
      update_resolution_options_selection
    elsif @windows_options_window.active
      update_windows_options_selection
    elsif @controls_window.active
      update_controls_selection
    end
  end
  #--------------------------------------------------------------------------
  # * Create Main Option Selection
  #--------------------------------------------------------------------------
  def create_options_window
    @options_window = Window_Command.new(160, @options)
    @options_window.index = @options_index
  @options_window.y = 64
  end
  #--------------------------------------------------------------------------
  # * Create Audio Options Window
  #--------------------------------------------------------------------------
  def create_audio_window
    @audio_options_window = Window_Command.new(277, @audio_options)
    @audio_options_window.visible = false
    @audio_options_window.active = false
    @audio_options_window.x = 160
    @audio_options_window.y = 56
  end
  #--------------------------------------------------------------------------
  # * Create Audio-BGM Options Window
  #--------------------------------------------------------------------------
  def create_bgm_window
    @bgm_options_window = Window_Command.new(70, @bgm_options)
    @bgm_options_window.visible = false
    @bgm_options_window.active = false
    @bgm_options_window.x = 437
    @bgm_options_window.y = 56
  end
  #--------------------------------------------------------------------------
  # * Create Audio-BGS Options Window
  #--------------------------------------------------------------------------
  def create_bgs_window
    @bgs_options_window = Window_Command.new(70, @bgs_options)
    @bgs_options_window.visible = false
    @bgs_options_window.active = false
    @bgs_options_window.x = 437
    @bgs_options_window.y = 56
  end
  #--------------------------------------------------------------------------
  # * Create Audio-SE Options Window
  #--------------------------------------------------------------------------
  def create_se_window
    @se_options_window = Window_Command.new(70, @se_options)
    @se_options_window.visible = false
    @se_options_window.active = false
    @se_options_window.x = 437
    @se_options_window.y = 56
  end
  #--------------------------------------------------------------------------
  # * Create Audio-ME Options Window
  #--------------------------------------------------------------------------
  def create_me_window
    @me_options_window = Window_Command.new(70, @me_options)
    @me_options_window.visible = false
    @me_options_window.active = false
    @me_options_window.x = 437
    @me_options_window.y = 56
  end
  #--------------------------------------------------------------------------
  # * Create Resolution Options Window
  #--------------------------------------------------------------------------
  def create_resolution_window
    @resolution_options_window = Window_Command.new(120, @resolution_options)
    @resolution_options_window.visible = false
    @resolution_options_window.active = false
    @resolution_options_window.x = 160
    @resolution_options_window.y = 56
  end
  #--------------------------------------------------------------------------
  # * Create Windows Options Window
  #--------------------------------------------------------------------------
  def create_windows_window
    @windows_options_window = Window_Command.new(120, @windows_options)
    @windows_options_window.visible = false
    @windows_options_window.active = false
    @windows_options_window.x = 160
    @windows_options_window.y = 56
  end
  #--------------------------------------------------------------------------
  # * Create Controls Options Window
  #--------------------------------------------------------------------------
  def create_controls_window
    @controls_window = Window_Base.new(161, 57, 292, 300)
    @controls_window.contents.draw_text(0, -2, 100, 24, "Controls")
    @controls_window.contents.draw_text(0, 24, 300, 24, "To Access the system controls")
    @controls_window.contents.draw_text(0, 48, 300, 24, "Press F1 at any time")
    @controls_window.contents.draw_text(40, 96, 300, 24, "A")
    @controls_window.contents.draw_text(40, 120, 300, 24, "B")
    @controls_window.contents.draw_text(40, 144, 300, 24, "C")
    @controls_window.contents.draw_text(40, 168, 300, 24, "L")
    @controls_window.contents.draw_text(40, 192, 300, 24, "R")
    @controls_window.contents.draw_text(40, 216, 300, 24, "X")
    @controls_window.contents.draw_text(40, 240, 300, 24, "Y")
    @controls_window.contents.draw_text(60, 96, 300, 24, "::  Dash")
    @controls_window.contents.draw_text(60, 120, 300, 24, "::  Cancel/Menu")
    @controls_window.contents.draw_text(60, 144, 300, 24, "::  Confirm/Talk")
    @controls_window.contents.draw_text(60, 168, 300, 24, "::  Menu Previous")
    @controls_window.contents.draw_text(60, 192, 300, 24, "::  Menu Next")
    @controls_window.contents.draw_text(60, 216, 300, 24, "::  Not Used")
    @controls_window.contents.draw_text(60, 240, 300, 24, "::  Not Used")
    @controls_window.visible = false
    @controls_window.active = false
  end
  #--------------------------------------------------------------------------
  # * Return to Original Screen
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_End.new#(0) #-----------Change this number to the options spot -1 on main menu-----------------
  end
  #--------------------------------------------------------------------------
  # * Update Options Selection
  #--------------------------------------------------------------------------
  def update_options_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_End.new
      #return_scene
    elsif Input.trigger?(Input::C)
      main_options_input
    end
  end
  #--------------------------------------------------------------------------
  # * Update Audio Options Selection
  #--------------------------------------------------------------------------
  def update_audio_options_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @options_window.active = true
      @audio_options_window.active = false
      @audio_options_window.visible = false
      @audio_options_window.index = 0
      return
    elsif Input.trigger?(Input::C)
      audio_options_input
    end
  end
  #--------------------------------------------------------------------------
  # * Update Audio-BGM Options Selection
  #--------------------------------------------------------------------------
  def update_bgm_options_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @audio_options_window.active = true
      @bgm_options_window.active = false
      @bgm_options_window.visible = false
      @bgm_options_window.index = 0
      return
    elsif Input.trigger?(Input::C)
      bgm_options_input
    end
  end
  #--------------------------------------------------------------------------
  # * Update Audio-BGS Options Selection
  #--------------------------------------------------------------------------
  def update_bgs_options_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @audio_options_window.active = true
      @bgs_options_window.active = false
      @bgs_options_window.visible = false
      @bgs_options_window.index = 0
      return
    elsif Input.trigger?(Input::C)
      bgs_options_input
    end
  end
  #--------------------------------------------------------------------------
  # * Update Audio-SE Options Selection
  #--------------------------------------------------------------------------
  def update_se_options_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @audio_options_window.active = true
      @se_options_window.active = false
      @se_options_window.visible = false
      @se_options_window.index = 0
      return
    elsif Input.trigger?(Input::C)
      se_options_input
    end
  end
  #--------------------------------------------------------------------------
  # * Update Audio-ME Options Selection
  #--------------------------------------------------------------------------
  def update_me_options_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @audio_options_window.active = true
      @me_options_window.active = false
      @me_options_window.visible = false
      @me_options_window.index = 0
      return
    elsif Input.trigger?(Input::C)
      me_options_input
    end
  end
  #--------------------------------------------------------------------------
  # * Update Resolution Options Selection
  #--------------------------------------------------------------------------
  def update_resolution_options_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @options_window.active = true
      @resolution_options_window.active = false
      @resolution_options_window.visible = false
      @resolution_options_window.index = 0
      return
    elsif Input.trigger?(Input::C)
      resolution_options_input
    end
  end
  #--------------------------------------------------------------------------
  # * Update Windows Options Selection
  #--------------------------------------------------------------------------
  def update_windows_options_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @options_window.active = true
      @windows_options_window.active = false
      @windows_options_window.visible = false
      @windows_options_window.index = 0
      return
    elsif Input.trigger?(Input::C)
      windows_options_input
    end
  end
  #--------------------------------------------------------------------------
  # * Update Controls Selection
  #--------------------------------------------------------------------------
  def update_controls_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @options_window.active = true
      @controls_window.active = false
      @controls_window.visible = false
    end
  end
  #--------------------------------------------------------------------------
  # * Update Main Options InputCheck
  #--------------------------------------------------------------------------
  def main_options_input
    option = @options[@options_window.index]
    Sound.play_decision
    # Checks Options Commands
    case option
    when OptionCommand::Audio  #calls Audio options subwindow
      @audio_options_window.active = true
      @audio_options_window.visible = true
      @options_window.active = false
    when OptionCommand::Controls #Controls
      @controls_window.active = true
      @controls_window.visible = true
      @options_window.active = false
    when OptionCommand::Resolution #Resolution
      @resolution_options_window.active = true
      @resolution_options_window.visible = true
      @options_window.active = false
    when OptionCommand::Windows #Windows
      @windows_options_window.active = true
      @windows_options_window.visible = true
      @options_window.active = false
  when OptionCommand::Exit_Options #Return to Main Menu
      return_scene
    end
  end
  #--------------------------------------------------------------------------
  # * Update Audio Options InputCheck
  #--------------------------------------------------------------------------
  def audio_options_input
    audio_option = @audio_options[@audio_options_window.index]
    Sound.play_decision
    # Checks Graphics Options Commands
    case audio_option
    when OptionCommand::Audiobgm  #Adjust BGM
      @bgm_options_window.index = 0
      @bgm_options_window.active = true
      @bgm_options_window.visible = true
      @audio_options_window.active = false
    when OptionCommand::Audiobgs  #Adjust BGS
      @bgs_options_window.index = 0
      @bgs_options_window.active = true
      @bgs_options_window.visible = true
      @audio_options_window.active = false
  when OptionCommand::Audiome  #Adjust ME
      @me_options_window.index = 0
      @me_options_window.active = true
      @me_options_window.visible = true
      @audio_options_window.active = false
  when OptionCommand::Audiose  #Adjust SE
      @se_options_window.index = 0
      @se_options_window.active = true
      @se_options_window.visible = true
      @audio_options_window.active = false
    end
  end
  #--------------------------------------------------------------------------
  # * Update Audio-BGM Options InputCheck
  #--------------------------------------------------------------------------
  def bgm_options_input
    bgm_option = @bgm_options[@bgm_options_window.index]
    Sound.play_decision
    # Checks BGM Options Commands
    case bgm_option
    when OptionCommand::AudiobgmV[0]  #BGM Volume Down
      if $game_system.bgm_volume >= 10
        $game_system.bgm_volume = $game_system.bgm_volume - 10
        Audio.play_adjust(RPG::BGM.last, $game_system.bgm_volume)
      end
    when OptionCommand::AudiobgmV[1]  #BGM Volume Up
      if $game_system.bgm_volume <= 90
        $game_system.bgm_volume = $game_system.bgm_volume + 10
        Audio.play_adjust(RPG::BGM.last, $game_system.bgm_volume)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update Audio-BGS Options InputCheck
  #--------------------------------------------------------------------------
  def bgs_options_input
    bgs_option = @bgs_options[@bgs_options_window.index]
    Sound.play_decision
    # Checks BGM Options Commands
    case bgs_option
    when OptionCommand::AudiobgsV[0]  #BGS Volume Down
      if $game_system.bgs_volume >= 10
        $game_system.bgs_volume = $game_system.bgs_volume - 10
        Audio.play_adjust(RPG::BGS.last, $game_system.bgs_volume)
      end
    when OptionCommand::AudiobgsV[1]  #BGS Volume Up
      if $game_system.bgs_volume <= 90
        $game_system.bgs_volume = $game_system.bgs_volume + 10
        Audio.play_adjust(RPG::BGS.last, $game_system.bgs_volume)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update Audio-SE Options InputCheck
  #--------------------------------------------------------------------------
  def se_options_input
    se_option = @se_options[@se_options_window.index]
    Sound.play_decision
    # Checks BGM Options Commands
    case se_option
    when OptionCommand::AudioseV[0]  #SE Volume Down
      if $game_system.se_volume >= 10
        $game_system.se_volume = $game_system.se_volume - 10
      end
    when OptionCommand::AudioseV[1]  #SE Volume Up
      if $game_system.se_volume <= 90
        $game_system.se_volume = $game_system.se_volume + 10
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update Audio-ME Options InputCheck
  #--------------------------------------------------------------------------
  def me_options_input
    me_option = @me_options[@me_options_window.index]
    Sound.play_decision
    # Checks BGM Options Commands
    case me_option
    when OptionCommand::AudiomeV[0]  #ME Volume Down
      if $game_system.me_volume >= 10
        $game_system.me_volume = $game_system.me_volume - 10
      end
    when OptionCommand::AudiomeV[1]  #ME Volume Up
      if $game_system.me_volume <= 90
        $game_system.me_volume = $game_system.me_volume + 10
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update Resolution Options InputCheck
  #-------------------------------------------------------------------------- 
  def resolution_options_input
    resolution_option = @resolution_options[@resolution_options_window.index]
    Sound.play_decision
    # Checks Resolution Options Commands
    case resolution_option
    when OptionCommand::ResolutionS[0]
      getSystemMetrics = Win32API.new('user32', 'GetSystemMetrics', 'i', 'i')
      moveWindow = Win32API.new('user32', 'MoveWindow', 'liiiil', 'l')
      findWindowEx = Win32API.new('user32', 'FindWindowEx', 'llpp', 'i')
      win = findWindowEx.call(0, 0 , 'RGSS Player', 0)
      sw, sh = getSystemMetrics.call(0), getSystemMetrics.call(1)
      moveWindow.call(win, (sw - 544) / 2, (sh - 416) / 2, 544, 416, 1)
    when OptionCommand::ResolutionS[1]
      getSystemMetrics = Win32API.new('user32', 'GetSystemMetrics', 'i', 'i')
      moveWindow = Win32API.new('user32', 'MoveWindow', 'liiiil', 'l')
      findWindowEx = Win32API.new('user32', 'FindWindowEx', 'llpp', 'i')
      win = findWindowEx.call(0, 0 , 'RGSS Player', 0)
      sw, sh = getSystemMetrics.call(0), getSystemMetrics.call(1)
      moveWindow.call(win, (sw - 800) / 2, (sh - 600) / 2, 800, 600, 1)
    when OptionCommand::ResolutionS[2]
      getSystemMetrics = Win32API.new('user32', 'GetSystemMetrics', 'i', 'i')
      moveWindow = Win32API.new('user32', 'MoveWindow', 'liiiil', 'l')
      findWindowEx = Win32API.new('user32', 'FindWindowEx', 'llpp', 'i')
      win = findWindowEx.call(0, 0 , 'RGSS Player', 0)
      sw, sh = getSystemMetrics.call(0), getSystemMetrics.call(1)
      moveWindow.call(win, (sw - 1024) / 2, (sh - 768) / 2, 1024, 768, 1)
    when OptionCommand::ResolutionS[3]
      getSystemMetrics = Win32API.new('user32', 'GetSystemMetrics', 'i', 'i')
      moveWindow = Win32API.new('user32', 'MoveWindow', 'liiiil', 'l')
      findWindowEx = Win32API.new('user32', 'FindWindowEx', 'llpp', 'i')
      win = findWindowEx.call(0, 0 , 'RGSS Player', 0)
      sw, sh = getSystemMetrics.call(0), getSystemMetrics.call(1)
      moveWindow.call(win, (sw - 1280) / 2, (sh - 1024) / 2, 1280, 1024, 1)
    when OptionCommand::ResolutionS[4]
      getSystemMetrics = Win32API.new('user32', 'GetSystemMetrics', 'i', 'i')
      moveWindow = Win32API.new('user32', 'MoveWindow', 'liiiil', 'l')
      findWindowEx = Win32API.new('user32', 'FindWindowEx', 'llpp', 'i')
      win = findWindowEx.call(0, 0 , 'RGSS Player', 0)
      sw, sh = getSystemMetrics.call(0), getSystemMetrics.call(1)
      moveWindow.call(win, (sw - 1600) / 2, (sh - 1200) / 2, 1600, 1200, 1)
    end
  end
  #--------------------------------------------------------------------------
  # * Update Windows Options InputCheck
  #-------------------------------------------------------------------------- 
  def windows_options_input
    windows_option = @windows_options[@windows_options_window.index]
    Sound.play_decision
    # Changes Windowskin Options
    case windows_option
    when OptionCommand::WindowsS[0] # Default Windowskin
      $game_system.skin = 'Window'
      unless MA_AMS == false
        $game_message.windowskin = "Window"
        $game_message.namebox_windowskin = "Window"
        $game_message.choicebox_windowskin = "Window"
        $game_dlgoptions.windowskin = "Window"
        $game_dlgoptions.choicebox_windowskin = "Window"
        $game_dlgoptions.namebox_windowskin = "Window"
      end
    when OptionCommand::WindowsS[1] # Custom Windowskin 1
      $game_system.skin = 'Window1'
      unless MA_AMS == false
        $game_message.windowskin = "Window1"
        $game_message.namebox_windowskin = "Window1"
        $game_message.choicebox_windowskin = "Window1"
        $game_dlgoptions.windowskin = "Window1"
        $game_dlgoptions.choicebox_windowskin = "Window1"
        $game_dlgoptions.namebox_windowskin = "Window1"
      end
    when OptionCommand::WindowsS[2] # Custom Windowskin 2
      $game_system.skin = 'Window2'
      unless MA_AMS == false
        $game_message.windowskin = "Window2"
        $game_message.namebox_windowskin = "Window2"
        $game_message.choicebox_windowskin = "Window2"
        $game_dlgoptions.windowskin = "Window2"
        $game_dlgoptions.choicebox_windowskin = "Window2"
        $game_dlgoptions.namebox_windowskin = "Window2"
      end
  #--------------------------------------------------------------------------
  # * Add any other windowskin options here if you want more windowskin choices
  # * Be sure to add the options at the top of the script in order for these
  # * to additions here to get used. For starters, I added a fourth option,
  # * (which starts at 3) all you need to do for this one is remove the comment
  # * tag "#" from the front of the lines
  #--------------------------------------------------------------------------
    #when OptionCommand::WindowsS[3] # Custom Windowskin 3
      #$game_system.skin = 'Window3'
      #unless MA_AMS == false
        #$game_message.windowskin = "Window3"
        #$game_message.namebox_windowskin = "Window3"
        #$game_message.choicebox_windowskin = "Window3"
        #$game_dlgoptions.windowskin = "Window3"
        #$game_dlgoptions.choicebox_windowskin = "Window3"
        #$game_dlgoptions.namebox_windowskin = "Window3"
      #end
    end
  end
  #--------------------------------------------------------------------------
  # * Update Help Text
  #--------------------------------------------------------------------------
  def update_help
@help_window.set_text("Options")
end
end

Código: [Selecionar]
#################################################################
# Audio Adjustment Script version 1.1                           #
#################################################################
#   by Akin                                                     #
#    Credit to The Sleeping Leonhart who's XP Options script    #
#    helped me learn and to DerVVulfman who helped me find      #
#    an easy location to change battle sounds                   #
#################################################################
#   This script allows the the volumes of Background Music,     #
#   Background Sound, Sound Effects, and Music Effects          #
#   Though the use of the following variables from 0-100        #
#   $game_system.bgm_volume                                     #
#   $game_system.bgs_volume                                     #
#   $game_system.se_volume                                      #
#   $game_system.me_volume                                      #
#################################################################
#   Simpley use my GUI or someone else's to set the volumes     #
#   with lines like this                                        #
#   "$game_system.se_volume = 90"                               #
#   "$game_system.bgs_volume = 23"                              #
#   Just keep the value between 0 and 100                       #
#                                                               #
#   To reset the volumes of currently playing BGM and           #
#   BGS use the following lines.                                #
#   Audio.play_adjust(RPG::BGM.last, $game_system.bgm_volume)   #
#   Audio.play_adjust(RPG::BGS.last, $game_system.bgs_volume)   #
#                                                               #
#   To continue playing the currently playing BGM and BGS upon  #
#   entering combat. Use the following command.                 #
#   "$game_system.battle_music_mode = 1"                        #
#                                                               #
#   Use "$game_system.battle_music_mode = 0" to return to the   #
#   traditional method of changing BGM's and BGS upon battle    #
#################################################################
#  Release Notes                                                #
#  1.0 - Initial Release                                        #
#  1.1 - Added ability to continue music playing though combat  #
#################################################################

# This adds on to the Audio module and adjusts playback volumes by the adjustment value
module Audio
  def self.play_adjust(sound_file, adjustment)  # accepts a sound file and an adjustment value from 0-100
    original_volume = sound_file.volume   # stores the original volume of the sound file
    sound_file.volume = Integer(original_volume * adjustment / 100)   # resets the sound volume to the adjustment %
    sound_file.play   # plays the sound file
    sound_file.volume = original_volume  # resets the volume of the orginal file
  end
end

# Replaces the current sound module so that all sound effects that are called for in
# the game and in scripts that use "Sound.play_X" play at the correct volume
module Sound

  # Cursor
  def self.play_cursor
    Audio.play_adjust($data_system.sounds[0], $game_system.se_volume)
  end

  # Decision
  def self.play_decision
    Audio.play_adjust($data_system.sounds[1], $game_system.se_volume)
  end

  # Cancel
  def self.play_cancel
    Audio.play_adjust($data_system.sounds[2], $game_system.se_volume)
  end

  # Buzzer
  def self.play_buzzer
    Audio.play_adjust($data_system.sounds[3], $game_system.se_volume)
  end

  # Equip
  def self.play_equip
    Audio.play_adjust($data_system.sounds[4], $game_system.se_volume)
  end

  # Save
  def self.play_save
    Audio.play_adjust($data_system.sounds[5], $game_system.se_volume)
  end

  # Load
  def self.play_load
    Audio.play_adjust($data_system.sounds[6], $game_system.se_volume)
  end

  # Battle Start
  def self.play_battle_start
    Audio.play_adjust($data_system.sounds[7], $game_system.se_volume)
  end

  # Escape
  def self.play_escape
    Audio.play_adjust($data_system.sounds[8], $game_system.se_volume)
  end

  # Enemy Attack
  def self.play_enemy_attack
    Audio.play_adjust($data_system.sounds[9], $game_system.se_volume)
  end

  # Enemy Damage
  def self.play_enemy_damage
    Audio.play_adjust($data_system.sounds[10], $game_system.se_volume)
  end

  # Enemy Collapse
  def self.play_enemy_collapse
    Audio.play_adjust($data_system.sounds[11], $game_system.se_volume)
  end

  # Actor Damage
  def self.play_actor_damage
    Audio.play_adjust($data_system.sounds[12], $game_system.se_volume)
  end

  # Actor Collapse
  def self.play_actor_collapse
    Audio.play_adjust($data_system.sounds[13], $game_system.se_volume)
  end

  # Recovery
  def self.play_recovery
    Audio.play_adjust($data_system.sounds[14], $game_system.se_volume)
  end

  # Miss
  def self.play_miss
    Audio.play_adjust($data_system.sounds[15], $game_system.se_volume)
  end

  # Evasion
  def self.play_evasion
    Audio.play_adjust($data_system.sounds[16], $game_system.se_volume)
  end

  # Shop
  def self.play_shop
    Audio.play_adjust($data_system.sounds[17], $game_system.se_volume)
  end

  # Use Item
  def self.play_use_item
    Audio.play_adjust($data_system.sounds[18], $game_system.se_volume)
  end

  # Use Skill
  def self.play_use_skill
    Audio.play_adjust($data_system.sounds[19], $game_system.se_volume)
  end
end

# Modifies the game system to add in the optional volume adjustments
class Game_System
  attr_accessor :bgm_volume
  attr_accessor :se_volume
  attr_accessor :bgs_volume
  attr_accessor :me_volume
  attr_accessor :battle_music_mode
  alias akin_sound_ini_game_system initialize
 
  def initialize
    akin_sound_ini_game_system
    # BGM, BGS, SE and ME Volume Values for storage
    @bgm_volume = 100; @se_volume = 100; @bgs_volume = 100; @me_volume = 100; @battle_music_mode = 0;
  end
end

# Edits the game_interpreter so that all event sounds are played at the correct volume
class Game_Interpreter
  def command_241
    Audio.play_adjust(@params[0], $game_system.bgm_volume) #BGM
    return true
  end
  def command_245
    Audio.play_adjust(@params[0], $game_system.bgs_volume) #BGS
    return true
  end
  def command_249
    Audio.play_adjust(@params[0], $game_system.me_volume) #ME
    return true
  end
  def command_250
    Audio.play_adjust(@params[0], $game_system.se_volume) #SE
    return true
  end
end

# Edits the game_map to play autoplayed BGS and BGM's at the correct volume
class Game_Map
  def autoplay
    Audio.play_adjust(@map.bgm, $game_system.bgm_volume) if @map.autoplay_bgm
    Audio.play_adjust(@map.bgs, $game_system.bgs_volume) if @map.autoplay_bgs
  end
end

# Edits game_vehicle to play the correct volume sound when mounting a vehicle
class Game_Vehicle < Game_Character
  def get_on
    @driving = true
    @walk_anime = true
    @step_anime = true
    if @type == 2                                    # If airship
      @priority_type = 2                             # Change priority to "Above Characters"
    end
    Audio.play_adjust(@bgm, $game_system.bgm_volume) # Start BGM
  end
end

# Edits game_player to play the correct volume sound after dismounting a vehicle
class Game_Player < Game_Character
  def get_off_vehicle
    if in_airship?                                # Airship
      return unless airship_land_ok?(@x, @y)      # Can't land?
    else                                          # Boat/ship
      front_x = $game_map.x_with_direction(@x, @direction)
      front_y = $game_map.y_with_direction(@y, @direction)
      return unless can_walk?(front_x, front_y)   # Can't touch land?
    end
    $game_map.vehicles[@vehicle_type].get_off     # Get off processing
    if in_airship?                                # Airship
      @direction = 2                              # Face down
    else                                          # Boat/ship
      force_move_forward                          # Move one step forward
      @transparent = false                        # Remove transparency
    end
    @vehicle_getting_off = true                   # Start getting off operation
    @move_speed = 4                               # Return move speed
    @through = false                              # Passage OFF
    Audio.play_adjust(@walking_bgm, $game_system.bgm_volume) # Restore walking BGM
    make_encounter_count                          # Initialize encounter
  end
end

# Edits sprite_base to play sound effects from battle animations at the correct volume
class Sprite_Base < Sprite
  def animation_process_timing(timing)
    Audio.play_adjust(timing.se, $game_system.se_volume)
    case timing.flash_scope
    when 1
      self.flash(timing.flash_color, timing.flash_duration * 4)
    when 2
      if viewport != nil
        viewport.flash(timing.flash_color, timing.flash_duration * 4)
      end
    when 3
      self.flash(nil, timing.flash_duration * 4)
    end
  end
end

# Edits scene_map to play the battle BGM at the correct volume
class Scene_Map < Scene_Base
  def call_battle
    @spriteset.update
    Graphics.update
    $game_player.make_encounter_count
    $game_player.straighten
    $game_temp.map_bgm = RPG::BGM.last
    $game_temp.map_bgs = RPG::BGS.last
    unless $game_system.battle_music_mode == 1 # Does not stop current must if battle_music mode is 1
      RPG::BGM.stop
      RPG::BGS.stop
    end
      Sound.play_battle_start
    unless $game_system.battle_music_mode == 1
      Audio.play_adjust($game_system.battle_bgm, $game_system.bgm_volume) # Does not play battle music if battle mode is 1
    end
    $game_temp.next_scene = nil
    $scene = Scene_Battle.new
  end
end

# Edits the scene_battle class to play the BGM and BGS of the returning map and
# the victory ME at the correct volumes
class Scene_Battle < Scene_Base
  def battle_end(result)
    if result == 2 and not $game_troop.can_lose
      call_gameover
    else
      $game_party.clear_actions
      $game_party.remove_states_battle
      $game_troop.clear
      if $game_temp.battle_proc != nil
        $game_temp.battle_proc.call(result)
        $game_temp.battle_proc = nil
      end
      unless $BTEST or $game_system.battle_music_mode == 1 #does not restore BGM if battle music mode 1 is enabled
        Audio.play_adjust($game_temp.map_bgm, $game_system.bgm_volume)
        Audio.play_adjust($game_temp.map_bgs, $game_system.bgs_volume)
      end
      $scene = Scene_Map.new
      @message_window.clear
      Graphics.fadeout(30)
    end
    $game_temp.in_battle = false
  end

  def process_victory
    @info_viewport.visible = false
    @message_window.visible = true
    unless $game_system.battle_music_mode == 1 #does not play victory ME if battle music mode 1 is enabled
    RPG::BGM.stop
    Audio.play_adjust($game_system.battle_end_me, $game_system.me_volume)
    end
    unless $BTEST or $game_system.battle_music_mode == 1 #does not restore BGM if battle music mode 1 is enabled
      Audio.play_adjust($game_temp.map_bgm, $game_system.bgm_volume)
      Audio.play_adjust($game_temp.map_bgs, $game_system.bgs_volume)
    end
    display_exp_and_gold
    display_drop_items
    display_level_up
    battle_end(0)
  end
end

# Edits the scene_gameover to play the gameover ME at the correct volume
class Scene_Gameover < Scene_Base
  def start
    super
    RPG::BGM.stop
    RPG::BGS.stop
    Audio.play_adjust($data_system.gameover_me, $game_system.me_volume)
    Graphics.transition(120)
    Graphics.freeze
    create_gameover_graphic
  end
end

# Edits the scene_file so that music plays at the correct volume upon loading
class Scene_File < Scene_Base
  def do_load
    file = File.open(@savefile_windows[@index].filename, "rb")
    read_save_data(file)
    file.close
    $scene = Scene_Map.new
    RPG::BGM.fade(1500)
    Graphics.fadeout(60)
    Graphics.wait(40)
    Audio.play_adjust(@last_bgm, $game_system.bgm_volume)
    Audio.play_adjust(@last_bgs, $game_system.bgs_volume)
  end
end

Código: [Selecionar]
#===============================================================
# ? [VX Snippet] ? Change Windowskin ? ?
#--------------------------------------------------------------
# ? by Woratana [woratana@hotmail.com]
# ? Released on: 10/03/2008
#--------------------------------------------------------------
# Note: Missing features from RM2K and RMXP
=begin
?----?----?----?----? +[How to use]+ ?----?----?----?----?
Call script:
$game_system.skin = 'Windowskin File Name'
(Window Skin file must be in folder 'Graphics/System')

For Example >> $game_system.skin = 'Window'
?=====?=====?=====?=====?=====?=====?=====?=====?=====?

=end
#===============================================================

class Window_Base < Window
  alias wor_changeskin_winbase_ini initialize
  alias wor_changeskin_winbase_upd update
 
  # Change Window Skin when first call Window
  def initialize(x, y, width, height)
    wor_changeskin_winbase_ini(x, y, width, height)
    self.windowskin = Cache.system($game_system.skin)
    @winskin = $game_system.skin
  end
 
  # Change Window Skin if $game_system.skin is not same as its skin
  def update
    wor_changeskin_winbase_upd
    if @winskin != $game_system.skin
      self.windowskin = Cache.system($game_system.skin)
      @winskin = $game_system.skin
    end
  end
end
class Game_System
  attr_accessor :skin
  alias wor_changeskin_gamesys_ini initialize
 
  # Add variable $game_system.skin to store/change windowskin file name
  def initialize
    wor_changeskin_gamesys_ini
    @skin = 'Window'
  end
end


Como Usar

Para chamar o menu das opções use
Código: [Selecionar]
$scene = Scene_Options.new
« Última modificação: 11 de Junho de 2009, 17:53:35 por Yuki Master »

ferndon

  • Membro
  • *
  • Mensagens: 3
  • Reputação: 0
  • Offline
Re: Advanced Options Menu
« Resposta #1 em: 17 de Novembro de 2009, 20:36:08 »
Pontuação: 0
cara.... to meio perdido.... coloquei esses 3 scripts no meu jogo.... e nao entendi essa ultima frase:

Como Usar

Para chamar o menu das opções use

Código: [Select]
$scene = Scene_Options.new

Highm@x

  • Membro
  • *
  • Mensagens: 577
  • Reputação: 5
  • Offline
  • De longe pareço feio, de perto pareço bem longe...
Re: Advanced Options Menu
« Resposta #2 em: 24 de Novembro de 2009, 23:07:58 »
Pontuação: 0
cara.... to meio perdido.... coloquei esses 3 scripts no meu jogo.... e nao entendi essa ultima frase:

Como Usar

Para chamar o menu das opções use

Código: [Select]
$scene = Scene_Options.new

Você pode criar um evento comum assim:
<Condição: Tecla X pressionada>
 <Chamar script: $scene = Scene_Options.new>
- Como ainda não testei, não garanto que seja assim... Mas, tente, ve se dá! -

BrunnoMS

  • Membro
  • *
  • Mensagens: 93
  • Reputação: 4
  • Offline
  • um profissional em sistemas por eventos!
Re: Advanced Options Menu
« Resposta #3 em: 25 de Dezembro de 2009, 04:17:52 »
Pontuação: 0
cara, mto fácil de usar ^^ vc cria um evento qualqer e a função chamar script e digita $scene = Scene_Options.new nao tem como errar!
Game over pra você...

 

Tópicos Relacionados

  Assunto / Iniciado por Respostas Última mensagem
2 Respostas
1535 Visualizações
Última mensagem 20 de Março de 2010, 13:23:40
por Fearok
4 Respostas
1328 Visualizações
Última mensagem 06 de Março de 2010, 14:30:47
por Nuno
1 Respostas
1080 Visualizações
Última mensagem 02 de Maio de 2010, 12:32:37
por ismacayo
7 Respostas
337 Visualizações
Última mensagem 07 de Fevereiro de 2013, 14:31:24
por Gab!