The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: pacdiggity on April 13, 2011, 06:27:00 AM

Title: [VX]Music in Script
Post by: pacdiggity on April 13, 2011, 06:27:00 AM
This isn't a request for a script, more of a request for knowledge on how to script.
As a lot of you know, I'm new to scripting, but I'd like to think I'm getting the hang of it. But there are always those things that get you when your guard is down, and this is one of them. How do I script a command to play music?
I've studied Scene_Title for the command, and it runs as
class Scene_Title < Scene_Base
  def play_title_music
    $data_system.title_bgm.play
    RPG::BGS.stop
    RPG::ME.stop
  end

So, if I run my custom scene's music processing as
CUSTOM_BGM = "Theme4", 100, 100 #Music, Pitch and Volume
class Scene_Custom < Scene_Base #The scene's class
def play_custom_music #The music method
CUSTOM_BGM.play #Play BMG
RPG::BGS.stop #No BGS
RPG::ME.stop #No ME
it doesn't work.
How do you properly call music in RGSS2?
Title: Re: [VX]Music in Script
Post by: modern algebra on April 13, 2011, 11:41:24 AM
RPG::BGM.new (name, volume, pitch)

The Help file is your best friend.

You would then use the play method once to play it.
Title: Re: [VX]Music in Script
Post by: pacdiggity on April 13, 2011, 11:52:09 AM
Our friendship has been remade!
Thank you for pointing out something I clearly should've seen.
*Finishes script*