Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Broken Messiah

Add Menu Item to Main Menu

Recommended Posts

I want to add this :

 

Scene_PictureGallery.new

 

to be activated from a option in the Main Menu under "Save" and before "Exit"

 

If it matters I'm using this script:

 

 

#==============================================================================

# ** Picture Gallery

#------------------------------------------------------------------------------

# Â © Dargor, 2008

# 16/10/08

# Version 1.0

# Requested by iceblue

#------------------------------------------------------------------------------

# VERSION HISTORY:

# - 1.0 (16/10/08), Initial release

#------------------------------------------------------------------------------

# INSTRUCTIONS:

# - Paste this above main

# - Edit the constants in the Picture Gallery module

# - To lock/unlock a picture, use the following lines of code:

# $game_system.lock_picture(picture_id)

# $game_system.unlock_picture(picture_id)

#==============================================================================

 

# Vocabulary

Vocab::CommandPictureGallery = 'Gallery'

 

#==============================================================================

# ** Picture Gallery Configuration Module

#==============================================================================

 

module Picture_Gallery

# Galleries

# SYNTAX: {'Gallery Name' => [picture_id, picture_id]}

Galleries = {'Name 1' => [1,2], 'Name 2' => [3,4]}

# Picture Names

# SYNTAX: {picture_id => 'name'}

Pictures = {1 => 'Choice1', 2 => 'Mountain', 3 => 'Sky', 4 => 'Ocean'}

# Name of locked pictures

Pictures.default = '- Empty -'

# Files

# SYNTAX: {picture_id => 'filename'}

Files = {1 =>'Choice1', 2 =>'Mountain', 3 =>'Sea of clouds', 4 =>'Ocean'}

# Filename of locked pictures

Files.default = 'Empty'

# Window XY cpprdinates

Window_X = 16

Window_Y = 16

# Add Picture Gallery to the main menu? (Requires the Custom Commands script)

Main_Menu = true

end

 

#==============================================================================

# ** Game_System

#------------------------------------------------------------------------------

# This class handles system-related data. Also manages vehicles and BGM, etc.

# The instance of this class is referenced by $game_system.

#==============================================================================

 

class Game_System

#--------------------------------------------------------------------------

# * Public Instance Variables

#--------------------------------------------------------------------------

attr_accessor :unlocked_pictures

#--------------------------------------------------------------------------

# * Alias Listing

#--------------------------------------------------------------------------

alias game_system_picture_gallery_system_initialize initialize

#--------------------------------------------------------------------------

# * Object Initialization

#--------------------------------------------------------------------------

def initialize

game_system_picture_gallery_system_initialize

@unlocked_pictures = []

end

#--------------------------------------------------------------------------

# * Unlock Picture

#--------------------------------------------------------------------------

def unlock_picture(id)

@unlocked_pictures << id

end

#--------------------------------------------------------------------------

# * Lock Picture

#--------------------------------------------------------------------------

def lock_picture(id)

@unlocked_pictures.delete!(id)

end

end

 

#==============================================================================

# ** Window_Base

#------------------------------------------------------------------------------

# This is a superclass of all windows in the game.

#==============================================================================

 

class Window_Base < Window

#--------------------------------------------------------------------------

# * Remake Window Contents

#--------------------------------------------------------------------------

def remake_contents(width, height)

self.width = width

self.height = height

create_contents

end

end

 

#==============================================================================

# ** Window_Command

#------------------------------------------------------------------------------

# This window deals with general command choices.

#==============================================================================

 

class Window_Command < Window_Selectable

#--------------------------------------------------------------------------

# * Set Commands

#--------------------------------------------------------------------------

def commands=(commands)

row_max = (commands.size + column_max - 1) / column_max

remake_contents(width, row_max * WLH + 32)

@commands = commands

@item_max = commands.size

refresh

end

end

 

#==============================================================================

# ** Scene_PictureGallery

#------------------------------------------------------------------------------

# This class performs the picture gallery screen processing.

#==============================================================================

 

class Scene_PictureGallery < Scene_Base

#--------------------------------------------------------------------------

# * Object Initialization

#--------------------------------------------------------------------------

def initialize(from_menu = false)

@from_menu = from_menu

end

#--------------------------------------------------------------------------

# * Start Processing

#--------------------------------------------------------------------------

def start

@picture_sprite = Sprite.new

@gallery_window = Window_Command.new(160,Picture_Gallery::Galleries.keys)

@gallery_window.x = Picture_Gallery::Window_X

@gallery_window.y = Picture_Gallery::Window_Y

@gallery_window.height = 56

@gallery_window.active = false

@picture_window = Window_Command.new(160, ['','','',''])

@picture_window.x = Picture_Gallery::Window_X

@picture_window.y = Picture_Gallery::Window_Y + 56

@picture_window.height = (4 * 24) + 32

update_picture_window_contents

update_picture_window

end

#--------------------------------------------------------------------------

# * Terminate Processing

#--------------------------------------------------------------------------

def terminate

@picture_sprite.dispose

@gallery_window.dispose

@picture_window.dispose

end

#--------------------------------------------------------------------------

# * Frame Update

#--------------------------------------------------------------------------

def update

@gallery_window.update

@picture_window.update

if @gallery_window.active

update_gallery_window

return

end

if @picture_window.active

update_picture_window

return

end

end

#--------------------------------------------------------------------------

# * Update Gallery Window

#--------------------------------------------------------------------------

def update_gallery_window

if Input.trigger?(Input::B)

Sound.play_cancel

if @from_menu

index = $game_system.menu_commands.index(Vocab::CommandPictureGallery)

$scene = Scene_Menu.new(index)

else

$scene = Scene_Map.new

end

return

return

end

update_picture_window_contents

if Input.trigger?(Input::C)

@gallery_window.active = false

@picture_window.active = true

end

end

#--------------------------------------------------------------------------

# * Update Picture Window

#--------------------------------------------------------------------------

def update_picture_window

if Input.trigger?(Input::B)

@gallery_window.active = true

@picture_window.active = false

return

end

gallery = Picture_Gallery::Galleries[@gallery_window.selection]

picture_id = gallery[@picture_window.index]

if $game_system.unlocked_pictures.include?(picture_id)

file = Picture_Gallery::Files[picture_id]

else

file = Picture_Gallery::Files.default

end

@picture_sprite.bitmap = Cache.picture(file)

end

#--------------------------------------------------------------------------

# * Update Picture Window Contents

#--------------------------------------------------------------------------

def update_picture_window_contents

pictures = []

picture_ids = []

for picture_id in Picture_Gallery::Galleries[@gallery_window.selection]

picture_ids << picture_id

if $game_system.unlocked_pictures.include?(picture_id)

pictures << Picture_Gallery::Pictures[picture_id]

else

pictures << Picture_Gallery::Pictures.default

end

end

return if @picture_window.commands == pictures

@picture_window.commands = pictures

@picture_window.height = (4 * 24) + 32

for i in 0...picture_ids.size

unless $game_system.unlocked_pictures.include?(picture_ids)

@picture_window.draw_item(i, false)

end

end

end

end

 

#==============================================================================

# ** Scene_Menu

#------------------------------------------------------------------------------

# This class performs the menu screen processing.

#==============================================================================

 

class Scene_Menu < Scene_Base

#--------------------------------------------------------------------------

# * Alias Listing

#--------------------------------------------------------------------------

alias dargor_vx_cmcpicgal_menu_create_command_window create_command_window

alias dargor_vx_cmcpicgal_menu_update_command_selection update_command_selection

#--------------------------------------------------------------------------

# * Create Command Window

#--------------------------------------------------------------------------

def create_command_window

if Picture_Gallery::Main_Menu

commands = $game_system.menu_commands

index = commands.index(Vocab::save)

$game_system.add_menu_command(index, Vocab::CommandPictureGallery)

end

dargor_vx_cmcpicgal_menu_create_command_window

end

#--------------------------------------------------------------------------

# * Update Command Selection

#--------------------------------------------------------------------------

def update_command_selection

dargor_vx_cmcpicgal_menu_update_command_selection

if Picture_Gallery::Main_Menu

command = @command_window.selection

if Input.trigger?(Input::C)

case @command_window.selection

when Vocab::CommandPictureGallery

$scene = Scene_PictureGallery.new(true)

end

end

end

end

end

 

 

Thanks:)

 

 

 

 

 

Share this post


Link to post
Share on other sites

Make sure you put that script in a [ code ] [ /code ] tag as well.

 

(I'm sure someone will show you how to do this quite soon, its very easy... I just haven't touched RMXP in so long.)

Share this post


Link to post
Share on other sites

Edit: Oh, its VX -facepalm- Ok, hold up a sec.

 

Edit 2: Ok, done, and its even simpler in VX. Here ya go:

 

 

#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs the menu screen processing.
#==============================================================================

class Scene_Menu < Scene_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     menu_index : command cursor's initial position
 #--------------------------------------------------------------------------
 def initialize(menu_index = 0)
   @menu_index = menu_index
 end
 #--------------------------------------------------------------------------
 # * Start processing
 #--------------------------------------------------------------------------
 def start
   super
   create_menu_background
   create_command_window
   @gold_window = Window_Gold.new(0, 360)
   @status_window = Window_MenuStatus.new(160, 0)
 end
 #--------------------------------------------------------------------------
 # * Termination Processing
 #--------------------------------------------------------------------------
 def terminate
   super
   dispose_menu_background
   @command_window.dispose
   @gold_window.dispose
   @status_window.dispose
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   super
   update_menu_background
   @command_window.update
   @gold_window.update
   @status_window.update
   if @command_window.active
     update_command_selection
   elsif @status_window.active
     update_actor_selection
   end
 end
 #--------------------------------------------------------------------------
 # * Create Command Window
 #--------------------------------------------------------------------------
 def create_command_window
   s1 = Vocab::item
   s2 = Vocab::skill
   s3 = Vocab::equip
   s4 = Vocab::status
   s5 = Vocab::save
   s6 = "Gallery"
   s7 = Vocab::game_end
   @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
   @command_window.index = @menu_index
   if $game_party.members.size == 0          # If number of party members is 0
     @command_window.draw_item(0, false)     # Disable item
     @command_window.draw_item(1, false)     # Disable skill
     @command_window.draw_item(2, false)     # Disable equipment
     @command_window.draw_item(3, false)     # Disable status
   end
   if $game_system.save_disabled             # If save is forbidden
     @command_window.draw_item(4, false)     # Disable save
   end
 end
 #--------------------------------------------------------------------------
 # * Update Command Selection
 #--------------------------------------------------------------------------
 def update_command_selection
   if Input.trigger?(Input::B)
     Sound.play_cancel
     $scene = Scene_Map.new
   elsif Input.trigger?(Input::C)
     if $game_party.members.size == 0 and @command_window.index < 4
       Sound.play_buzzer
       return
     elsif $game_system.save_disabled and @command_window.index == 4
       Sound.play_buzzer
       return
     end
     Sound.play_decision
     case @command_window.index
     when 0      # Item
       $scene = Scene_Item.new
     when 1,2,3  # Skill, equipment, status
       start_actor_selection
     when 4      # Save
       $scene = Scene_File.new(true, false, false)
     when 5
       Scene_PictureGallery.new
     when 6      # End Game
       $scene = Scene_End.new
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Start Actor Selection
 #--------------------------------------------------------------------------
 def start_actor_selection
   @command_window.active = false
   @status_window.active = true
   if $game_party.last_actor_index < @status_window.item_max
     @status_window.index = $game_party.last_actor_index
   else
     @status_window.index = 0
   end
 end
 #--------------------------------------------------------------------------
 # * End Actor Selection
 #--------------------------------------------------------------------------
 def end_actor_selection
   @command_window.active = true
   @status_window.active = false
   @status_window.index = -1
 end
 #--------------------------------------------------------------------------
 # * Update Actor Selection
 #--------------------------------------------------------------------------
 def update_actor_selection
   if Input.trigger?(Input::B)
     Sound.play_cancel
     end_actor_selection
   elsif Input.trigger?(Input::C)
     $game_party.last_actor_index = @status_window.index
     Sound.play_decision
     case @command_window.index
     when 1  # skill
       $scene = Scene_Skill.new(@status_window.index)
     when 2  # equipment
       $scene = Scene_Equip.new(@status_window.index)
     when 3  # status
       $scene = Scene_Status.new(@status_window.index)
     end
   end
 end
end

 

 

Glad I could help ya :D And 1 more post towards my 1000th post :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...