The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX Ace => VXA Scripts Database => Topic started by: SoulPour777 on March 06, 2014, 06:40:17 AM

Title: Soul Engine Ace - Soul Liquid Music Player
Post by: SoulPour777 on March 06, 2014, 06:40:17 AM
Soul Engine Ace - Soul Liquid Music Player
Version: 1.0
Author: Soulpour777
Date: 3 / 6, 2014

Description


Creates a customizable music player for your games. The music player allows a simple play and stop as well as free space to add graphics.

Features


Screenshots

(https://rmrk.net/proxy.php?request=http%3A%2F%2Finfinitytears.files.wordpress.com%2F2014%2F03%2Fmusic_player.jpg%3Fw%3D620&hash=81d320957b5e72e9d84e19551f4b0613e6663601)

Instructions


Needed Files:
Place the Music_BG, Music_Wave and Music_Layout on the Graphics\Systems folder. For your custom music, place them under Audio\BGM folder.

Script Calls:
To call up the Music Player, do this on a script call:
SceneManager.call(Scene_MusicMenu)
The script is currently installed on the Menu Command.

Script


Code: [Select]
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Soul Engine Ace - Soul Liquid Music Player
# Author: Soulpour777
# Version 1.0
# Script Category: Custom Scenes
# Included in Soul Engine Ace
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Description: Creates a customizable music player for your games. The music
# player allows a simple play and stop as well as free space to add graphics.
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Needed Files:
# Place the Music_BG, Music_Wave and Music_Layout on the Graphics\Systems
# folder. For your custom music, place them under Audio\BGM folder.
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Script Calls:
# To call up the Music Player, do this on a script call:
# SceneManager.call(Scene_MusicMenu)
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# The script is currently installed on the Menu Command.
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Terms of Use:
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# For Non-Commercial Use:
# You are free to use the script on any non-commercial projects.
# You are free to adapt the script. Any modifications are allowed as long
# as it is provided as a note on the script.
# Credits to SoulPour777 for the script.
# Preserve the Script Header.
# Claiming the script as your own is prohibited.
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

#==============================================================================
# ** Soulpour
#------------------------------------------------------------------------------
#  This module holds all Soulpour configurations.
#==============================================================================
module Soulpour
  # What is the name of the music player in your menu?
  Menu_Name = "Soul Music"
  #--------------------------------------------------------------------------
  # * Music Configuration Variable Module
  #-------------------------------------------------------------------------- 
  module MusicConfig
    # Width of the Window Displayer
    Displayer_Hieght = 200
    # New Width of the Displayer
    Display_Width = 400
    # X Location of the Displayer
    Display_X = 78
    # Y Location of the Displauer
    Display_Y = 45
    # Opacity of the Displayer
    DisplayOpacity = 100
    # Height of the Displayer
    DisplayHeight = 100
    # Opacity of the Window
    Window_Opacity = 35
    # Y Location of the Window
    Window_Y = 272
    # Height of the Window
    Window_Height = 160
  end
 
  #--------------------------------------------------------------------------
  # * Music Player Module
  #--------------------------------------------------------------------------
  module MusicPlayer
   
  #--------------------------------------------------------------------------
  # * Music Names
  # Here, indicate which music is to be played. Custom music is to be placed
  # under the BGM folder.
  #--------------------------------------------------------------------------   
    Music_Info = {
      "Stop" => { :song_command => RPG::BGM, },
      "Praise the King" => { :song_command => RPG::BGM.new("Theme2", 100, 100), },
      "Holy Land" => { :song_command => RPG::BGM.new("Theme3", 100, 100), },
      "Dragonsing" => { :song_command => RPG::BGM.new("Theme4", 100, 100), },
      "Dragonsong" => { :song_command => RPG::BGM.new("Dungeon1", 100, 100), },
      "Creepy Cave" => { :song_command => RPG::BGM.new("Dungeon2", 100, 100), },
      "Caverns of No Return" => { :song_command => RPG::BGM.new("Dungeon3", 100, 100), },
      "Dark Raid" => { :song_command => RPG::BGM.new("Dungeon4", 100, 100), },
      "Crawl" => { :song_command => RPG::BGM.new("Dungeon5", 100, 100), },
      "Queen Shall Be Saved" => { :song_command => RPG::BGM.new("Scene2", 100, 100), },
      "King's Claim" => { :song_command => RPG::BGM.new("Scene3", 100, 100), },
      "Dragon Return" => { :song_command => RPG::BGM.new("Scene4", 100, 100), },
    }
   
  end
 
end
#==============================================================================
# ** Window_MusicDisplayer
#------------------------------------------------------------------------------
#  This class performs the window that displays the displayer.
#==============================================================================
class Window_MusicDisplayer < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, window_width, fitting_height(1))
    refresh
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_width
    return Soulpour::MusicConfig::Display_Width
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
  end
  #--------------------------------------------------------------------------
  # * Open Window
  #--------------------------------------------------------------------------
  def open
    refresh
    super
  end
 
end


#==============================================================================
# ** Window_MusicCommand
#------------------------------------------------------------------------------
#  This command window appears on the menu screen for the Music Player.
#==============================================================================

class Window_MusicCommand < Window_Command
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_width
    return Graphics.width
  end
 
  #--------------------------------------------------------------------------
  # * Get Window Height
  #--------------------------------------------------------------------------
  def window_height
    return Graphics.height - 50
  end
 
  #--------------------------------------------------------------------------
  # * Get Number of Lines to Show
  #--------------------------------------------------------------------------
  def visible_line_number
    item_max
  end
  #--------------------------------------------------------------------------
  # * Create Command List
  #--------------------------------------------------------------------------
  def make_command_list
    add_main_commands
  end
  #--------------------------------------------------------------------------
  # * Add Main Commands to List
  #--------------------------------------------------------------------------
  def add_main_commands
    Soulpour::MusicPlayer::Music_Info.each_key { |i|
      add_command(i,   :song_command)
    }
  end 
 
end

#==============================================================================
# ** Scene_MusicMenu
#------------------------------------------------------------------------------
#  This class performs the Music Menu.
#==============================================================================

class Scene_MusicMenu < Scene_MenuBase
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    super
    create_command_window
    create_background
    create_window_display
  end
 
  #--------------------------------------------------------------------------
  # * Create Window Display
  #--------------------------------------------------------------------------
  def create_window_display
    @window_display = Window_MusicDisplayer.new
    @window_display.width = Soulpour::MusicConfig::Display_Width
    @window_display.x = Soulpour::MusicConfig::Display_X
    @window_display.y = Soulpour::MusicConfig::Display_Y
    @window_display.height = Soulpour::MusicConfig::Displayer_Hieght
    @window_display.opacity = Soulpour::MusicConfig::DisplayOpacity
  end
 
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    @music_window = Window_MusicCommand.new
    @music_window.opacity = Soulpour::MusicConfig::Window_Opacity
    @music_window.y = Soulpour::MusicConfig::Window_Y
    @music_window.height = Soulpour::MusicConfig::Window_Height
    @music_window.set_handler(:song_command, method(:command_song))
  end
 
  #--------------------------------------------------------------------------
  # * Create Background
  #-------------------------------------------------------------------------- 
  def create_background
    @music_background = Plane.new
    @music_background.bitmap = Cache.system("Music_BG")
    @music_background.z = 20
    @music_layout = Plane.new
    @music_layout.bitmap = Cache.system ("Music_Layout")
    @music_layout.z = 80
    @music_wave = Plane.new
    @music_wave.bitmap = Cache.system("Music_Wave")
    @music_wave.opacity = 45
    @music_wave.z = 120
  end
 
  #--------------------------------------------------------------------------
  # * Dispose Background
  #-------------------------------------------------------------------------- 
  def dispose_background
    @music_layout.dispose
    @music_background.dispose
    @music_wave.dispose   
  end

  #--------------------------------------------------------------------------
  # * Update Frame (Basic)
  #--------------------------------------------------------------------------
  def update_basic
    @music_wave.ox += 1
    command_return if Input.trigger?(:B)
    super
  end 
 
  #--------------------------------------------------------------------------
  # * Command Return
  #--------------------------------------------------------------------------
  def command_return
    RPG::BGM.stop
    Sound.play_cancel
    return_scene
  end 
 
  # ------------------------------------------------------------------
  # Command Song
  # ------------------------------------------------------------------
  def command_song
    case
    when @music_window.index == 0
      Soulpour::MusicPlayer::Music_Info[Soulpour::MusicPlayer::Music_Info.keys[@music_window.index]][:song_command].stop
    when @music_window.index != 0
      Soulpour::MusicPlayer::Music_Info[Soulpour::MusicPlayer::Music_Info.keys[@music_window.index]][:song_command].play
    end
    @music_window.activate
  end
 
end

#==============================================================================
# ** Window_MenuCommand
#------------------------------------------------------------------------------
#  This command window appears on the menu screen.
#==============================================================================

class Window_MenuCommand < Window_Command
  #--------------------------------------------------------------------------
  # * Original Commands
  #-------------------------------------------------------------------------- 
  alias soul_command_add_original_commands_music add_original_commands
  def add_original_commands
    soul_command_add_original_commands_music
    add_command(Soulpour::Menu_Name,   :soul_music, main_commands_enabled)
  end
end

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

class Scene_Menu < Scene_MenuBase
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  alias soul_command_create_command_window_music create_command_window
  def create_command_window
   soul_command_create_command_window_music
    @command_window.set_handler(:soul_music,    method(:command_soul_music))
  end
 
  #--------------------------------------------------------------------------
  # * Create Sutom Command
  #-------------------------------------------------------------------------- 
  def command_soul_music
    SceneManager.call(Scene_MusicMenu)
  end
 
end

You will also need these system graphics:

https://dl.dropboxusercontent.com/u/36246420/Soul%20Engine%20Ace/System.rar

Credit



Support


For any comments, suggestions or critique about the script, please do comment or give me a message.

Known Compatibility Issues

 - None


Terms of Use


All Soul Engine Ace scripts are bound under my terms of use. if any terms of use in RMRK is not located on my terms of use, do remember to add those terms.
Title: Re: Soul Engine Ace - Soul Liquid Music Player
Post by: EvilM00s on March 06, 2014, 07:52:42 AM
So basically, this script calls a new scene where the string (or is that an array, I always get that backwards) are BGMs?

Nifty. I dig it. Any chance you'd code it for VX?
Title: Re: Soul Engine Ace - Soul Liquid Music Player
Post by: vindaca on March 06, 2014, 11:12:04 AM
Nice Work! Glad to see your getting the hang of command windows. I like the animated BG too.   :)
Title: Re: Soul Engine Ace - Soul Liquid Music Player
Post by: SoulPour777 on March 06, 2014, 02:26:47 PM
So basically, this script calls a new scene where the string (or is that an array, I always get that backwards) are BGMs?

Nifty. I dig it. Any chance you'd code it for VX?

Thanks :) I'll try to look at VX and code it there.

Nice Work! Glad to see your getting the hang of command windows. I like the animated BG too.   :)

Thanks V :) Been thinking of making this for a while and glad I came up with a possible solution of doing so :D
Title: Re: Soul Engine Ace - Soul Liquid Music Player
Post by: Axer on July 07, 2014, 11:06:33 PM
Uhm...sorry to bother you but i cant see my custom music :|
and its in the right folder since i can use it when i'm edditting my game, do I have to wright something in the script?
Sorry, and thanks in avance
---------------------------------------------------------
Its nothing, I figured out how to do it, and thank for your awesome scripts :)
Title: Re: Soul Engine Ace - Soul Liquid Music Player
Post by: SoulPour777 on July 09, 2014, 02:35:24 AM
Uhm...sorry to bother you but i cant see my custom music :|
and its in the right folder since i can use it when i'm edditting my game, do I have to wright something in the script?
Sorry, and thanks in avance
---------------------------------------------------------
Its nothing, I figured out how to do it, and thank for your awesome scripts :)

Glad you were able to figure it out. Have a nice day and happy game making :D