This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
This is my first RGSS 2 script. Yes, it is incredibly simple; yes, it's probably been done before, and; yes, a retarded monkey shoving a banana in his eye could script this.*
Musical Menu Script
One day, I was making a game with RMVX when suddenly I remembered the music that played when you opened up the menu in Legend of Dragoon. I decided that I wanted that simple, meaningless feature to be in my game. So I pulled up the RMVX help file and searched through existing scripts for reference, and voila!
Description
When you open the menu, the audio file specified plays. When you close the menu, the map music plays.
Customization
Not only can you change the audio file, but you can change the volume and pitch of it too! Observe:
Code:
# Customize the menu here.
$mm_name = "Town1" #File must be found in the directory Audio/BGM/.
$mm_volume = 100 #Default 100
$mm_pitch = 100 #Default 100
$mm_name is the name of the file, which (as noted) must be in the BGM directory. $mm_volume is the volume of the music. The highest volume is 100, and the lowest is 0. $mm_pitch is the pitch of the music. The highest pitch is 150, and the lowest is 50.
Also, you can change the features IN GAME. Simply create an event, press "Script..." and type in the part of the script provided in the code box above.
Script
Open up the Script Editor and insert a new script under "Materials." Name it whatever you want. Then copy and paste the script provided below.
"The Amazingly Awesome (NOT) Script Itself!"
#===============================================================================
# ** Musical Menu
# By Meg
# Purpose: Plays music when the menu is opened.
#===============================================================================
#-------------------------------------------------------------------------------
# * This script may be modified, copied, butchered, or otherwise used with or
# without permission and/or credit to its original creator.
#-------------------------------------------------------------------------------
# Customize the menu here.
$mm_name = "Town1" #File must be found in the directory Audio/BGM/.
$mm_volume = 100 #Default 100
$mm_pitch = 100 #Default 100
#Start script.
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
#Begin menu music
Audio.bgm_play("Audio/BGM/" + $mm_name,$mm_volume,$mm_pitch)
#Default processing stuff.
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 = Vocab::game_end
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@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
Audio.bgm_stop #Stops menu music.
$game_map.autoplay #Plays map music, if any.
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 # 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
Compatibility
This script is designed to work with the standard-issue menu graciously provided by Enterbrain. Minor modification is needed to make it work with any custom menu system. If necessary, PM me and I can apply this to your CMS. But I doubt it'll be necessary.
* No insult is meant to people who are not retarded monkeys shoving bananas in their eyes who believe they cannot script. This statement was purely meant for lame, self-deprecating humor. Have a nice day.