Mundo Maker
¡Bienvenid@ a Mundo Maker!

¿Quieres aprender todo sobre el RPG Maker?



Regístrate y forma parte de Mundo Maker.

[Script] Menú Simple

Ver el tema anterior Ver el tema siguiente Ir abajo

RPG Maker VX [Script] Menú Simple

Mensaje por Unax Chikamatsu el 2014-06-13, 14:07

¡Muy buenas LOLeantes del futuro! (Típico de mi) Hace tiempo que no publico un tema, y que no me conecto a Mundo Makere, y, decidí que podría hacer un tema de un script que suelo utilizar en mis juegos (solamente Shadows, por ahora), el script trata de un menú bastante simple, con 3 opciones que se pueden personalizar (solo el texto), las opciones son las siguientes: "Continuar", "Inventario" y "Salir"...

Bueno, aquí dejo el script (siento no tener una captura para demostrar el script)

Código:
#------------------------------------------------------------------------------
# * Munkis' Simple Menu V 1.0
# * Made by munkis by request for Deadbox
#  ╔══════════╗
#  ║ FEATURES ║
#  ╚══════════╝
# * Basically this reduces the main menu to a very basic command window.
# * OVERWRITES Scene_Menu!
# * V 1.0: Initial release
#------------------------------------------------------------------------------

#[module]
module MNK_SimpleMenu

  MENU_TEXT = ["Continuar","Inventario","Salir"]
 
  #Change where the player goes when they select "Exit".
  #0 = To Title.
  #1 = To the Scene_End Menu.
  #2 = Exit completely.
 
  EXIT_TYPE = 1
 
  #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,0,0]
 
  #X,Y co-ordinates and opacity of the gold window
 
  GOLD_WINDOW = [191,260,0]

end
#[/module]

class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    create_command_window
    @gold_window = Window_Gold.new(MNK_SimpleMenu::GOLD_WINDOW[0], MNK_SimpleMenu::GOLD_WINDOW[1])
    @gold_window.opacity = MNK_SimpleMenu::GOLD_WINDOW[2]
  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
    @gold_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Return to Original Screen
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Map.new
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @command_window.update
    @gold_window.refresh
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      case @command_window.index
      when 0  # to title
        command_resume
      when 1  # shutdown
        command_inventory
      when 2  # quit
        command_quit
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update Background for Menu Screen
  #--------------------------------------------------------------------------
  def update_menu_background
    super
    @menuback_sprite.tone.set(0, 0, 0, 128)
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = MNK_SimpleMenu::MENU_TEXT[0]
    s2 = MNK_SimpleMenu::MENU_TEXT[1]
    s3 = MNK_SimpleMenu::MENU_TEXT[2]
    @command_window = Window_Command.new(MNK_SimpleMenu::CHOICE_WINDOW_DIM[0], [s1, s2, s3], MNK_SimpleMenu::CHOICE_WINDOW_DIM[1])
    @command_window.x = (544 - @command_window.width + MNK_SimpleMenu::CHOICE_WINDOW_DIM[2]) / 2
    @command_window.y = (416 - @command_window.height + MNK_SimpleMenu::CHOICE_WINDOW_DIM[3]) / 2
    @command_window.openness = 0
    @command_window.opacity = MNK_SimpleMenu::CHOICE_WINDOW_DIM[4]
  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
  #--------------------------------------------------------------------------
  # * Process When Choosing [Resume] Command
  #--------------------------------------------------------------------------
  def command_resume
    Sound.play_decision
    return_scene
  end
  #--------------------------------------------------------------------------
  # * Process When Choosing [Inventory] Command
  #--------------------------------------------------------------------------
  def command_inventory
    Sound.play_decision
    $scene = Scene_Item.new
  end
  #--------------------------------------------------------------------------
  # *  Process When Choosing [Exit] Command
  #--------------------------------------------------------------------------
  def command_quit
    if MNK_SimpleMenu::EXIT_TYPE == 0
      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)
    elsif MNK_SimpleMenu::EXIT_TYPE == 1
      Sound.play_decision
      $scene = Scene_End.new
    elsif MNK_SimpleMenu::EXIT_TYPE == 2
      Sound.play_decision
      RPG::BGM.fade(800)
      RPG::BGS.fade(800)
      RPG::ME.fade(800)
      $scene = nil
    end
  end
end


Lo tenéis que pegar encima del script "Main"...

Ahh, una cosa más... Espero que disfrutéis del script ;)
avatar
Unax Chikamatsu
Iniciado
Iniciado

0/3

Créditos 42

Gracias : 4

Volver arriba Ir abajo

Ver el tema anterior Ver el tema siguiente Volver arriba


Permisos de este foro:
No puedes responder a temas en este foro.