RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[RESERVED] Map BGM Continuation

0 Members and 1 Guest are viewing this topic.

*
Shooting for the "MEMBER MODERATOR OF THE YEAR 2007" Award
Rep:
Level 89
Hi, there.
Map BGM Continuation
12/10/07



Summary
What I basically want it to do is when you enter a map with a BGM it will play (as normal), but when you encounter an enemy, the BGM mutes but keeps playing while you fight, and when the encounter is over, the BGM is unmuted and it continues playing from where ever it left off.
Features Desired
  • Editable for BGMs and possibly BGSs
  • Doesn't require setup for every map. (would take for ever with what Im doing)



Did you search?
Of course! What am I, a newb... don't answer that.

Where did you search?
  • Google.com
  • RMRK.net
  • hbgames.org
  • Just about every other fansite with scripts

What did you search for?
  • BGM... believe me, long lists.

Thanks in advance!
« Last Edit: December 22, 2007, 01:48:03 PM by Zeriab »
Sig by MacGravel

*
Rep:
Level 97
Definitely better than Hitler.
2014 Best IRC Chatterbox2014 Best Musician2013 Funniest Member2013 Best Use of Avatar and Signature Space2013 Best Musician2013 King of RMRKFor the great victory in the Breakfast War.2012 Best Username2012 Best MusicianFor frequent good quality Wiki writing [citation needed]Most entertaining member on the IRC2011 Best Musician2011 Funniest Member2010 Most Missed Member
Back when I still used RPG Maker, this was something I had requested, and Blizzard told me it wasn't possible. =o
:tinysmile:

*
Shooting for the "MEMBER MODERATOR OF THE YEAR 2007" Award
Rep:
Level 89
Hi, there.
LIES!!! Oh come on. It's not like his word is law... though he nows alot more than I do about scripting.

Maybe if someone could attempt it. Please!
Sig by MacGravel

*
Shooting for the "MEMBER MODERATOR OF THE YEAR 2007" Award
Rep:
Level 89
Hi, there.
Well, I actually have this script that allows the BGM to continue as the battle BGM

Spoiler for "Proves Blizzard is Wrong... Sorta":
Code: [Select]
#==========================================================================
# This funtion playes the map's music during the battle#
# Caution: for some reason, the next line in an event is executed
# when the battle begins. This essentially "eats" the next line.
# As such, be sure to put in a dummy, non-comment command to get
# eaten right after the battle call, such as wait 1.
#==========================================================================
def My_Battle(troopID)   
    # Set battle abort flag   
    $game_temp.battle_abort = true   
    # Set battle calling flag   
    $game_temp.battle_calling = true   
    $game_temp.battle_troop_id = troopID   
    $game_temp.battle_can_escape = false   
    $game_temp.battle_can_lose = false   
    # Set callback   
    current_indent = @list[@index].indent   
    $game_temp.battle_proc = Proc.new { |n| @branch[current_indent] = n }   
    # Clear battle calling flag   
    $game_temp.battle_calling = false   
    # Clear menu calling flag   
    $game_temp.menu_calling = false   
    $game_temp.menu_beep = false   
    # Make encounter count   
    $game_player.make_encounter_count   
    # Memorize map BGM   
    $game_temp.map_bgm = $game_system.playing_bgm   
    # Play battle start SE   
    $game_system.se_play($data_system.battle_start_se)   
    # Straighten player position   
    $game_player.straighten   
    # Switch to battle screen   
    $scene = Scene_Battle.new
end

Spoiler for "Its call script":
Code: [Select]
My_Battle(TROOPID)


So if someone could some how mix that with this script

Spoiler for "Multiple BGMs":
Code: [Select]
#==============================================================================
# ** Multiple BGMS
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1
# 2007-04-09
# SDK : Version 2.0+, Parts I & II
#------------------------------------------------------------------------------
# * Version History :
#
#   Version 1 ---------------------------------------------------- (2007-04-09)
#------------------------------------------------------------------------------
# * Description :
#
#   This script was designed to allow you more than 1 bgm for your map and
#   battles. You can define multiple bgms for each map ; defined multiple
#   bgms for battle depending on : current map and current troop. You may
#   control which of these bgms you include in the final list, including the
#   original bgm list you can set in rmxp.
#------------------------------------------------------------------------------
# * Instructions :
#
#   Place The Script Below the SDK and Above Main.
#------------------------------------------------------------------------------
# * Customization :
#
#   Default Settings
#
#   Map BGM - Map Defined (By Map ID)
#    - @map_bgm_by_map = { map_id => [ RPG::AudioFile, ... ], ... }
#
#   Battle BGM - Map Defined (By Map ID)
#    - @battle_bgm_by_map = { map_id => [ RPG::AudioFile, ... ], ... }
#
#   Battle BGM - Troop Defined (By Troop ID)
#    - @battle_bgm_by_troop = { troop_id => [ RPG::AudioFile, ... ], ... }
#------------------------------------------------------------------------------
# * Syntax :
#
#   Battle BGM Include List
#    - $game_system.include_multi_bbgms = true or false
#      (Includes additional bgms for all)
#    - $game_system.include_multi_bbgms_map = true or false
#      (Includes additional bgms defined by the map)
#    - $game_system.include_multi_bbgms_troop = true or false
#      (Includes additional bgms defined by the troop)
#    - $game_system.include_datasys_bbgm
#      (Includes battle bgm set in database)
#    - $game_system.include_gmsys_bbgm
#      (Includes battle bgm set with events)
#
#   Add multiple BGMS to map list when using event command to change BGM
#    - $game_system.add_multi_bbgms = true or false
#   Remove multiple BGMS to map list when using event command to change BGM
#    - $game_system.remove_multi_bbgms = true or false
#==============================================================================

#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Multiple BGMS', 'SephirothSpawn', 1, '2007-04-09')
SDK.check_requirements(2.0, [3])

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.enabled?('Multiple BGMS')

SDK.log_overwrite(:Game_System, :battle_bgm)

#==============================================================================
# ** Multiple_BGMS
#==============================================================================
 
module Multiple_BGMS
  #--------------------------------------------------------------------------
  # * Defaults
  #
  #   Map BGM - Map Defined (By Map ID)
  #    - @map_bgm_by_map = { map_id => [ RPG::AudioFile, ... ], ... }
  #
  #   Battle BGM - Map Defined (By Map ID)
  #    - @battle_bgm_by_map = { map_id => [ RPG::AudioFile, ... ], ... }
  #
  #   Battle BGM - Troop Defined (By Troop ID)
  #    - @battle_bgm_by_troop = { troop_id => [ RPG::AudioFile, ... ], ... }
  #--------------------------------------------------------------------------
  @map_bgm_by_map      = {}
  @battle_bgm_by_map   = {}
  @battle_bgm_by_troop = {}
  # Defaults Default (Must leave as arrays)
  @map_bgm_by_map.default      = []
  @battle_bgm_by_map.default   = []
  @battle_bgm_by_troop.default = []
  #--------------------------------------------------------------------------
  # * Read Map BGMs For Maps
  #--------------------------------------------------------------------------
  def self.map_bgm_by_map
    return @map_bgm_by_map
  end
  #--------------------------------------------------------------------------
  # * Read Battle BGMs For Maps
  #--------------------------------------------------------------------------
  def self.battle_bgm_by_map
    return @battle_bgm_by_map
  end
  #--------------------------------------------------------------------------
  # * Read Battle BGMs From Troops
  #--------------------------------------------------------------------------
  def self.battle_bgm_by_troop
    return @battle_bgm_by_troop
  end
  #--------------------------------------------------------------------------
  # * Write Map BGMs For Maps
  #--------------------------------------------------------------------------
  def self.map_bgm_by_map=(map_bgm_by_map)
    @map_bgm_by_map = map_bgm_by_map
  end
  #--------------------------------------------------------------------------
  # * Write Battle BGMs For Maps
  #--------------------------------------------------------------------------
  def self.battle_bgm_by_map=(battle_bgm_by_map)
    @battle_bgm_by_map = battle_bgm_by_map
  end
  #--------------------------------------------------------------------------
  # * Write Battle BGMs From Troops
  #--------------------------------------------------------------------------
  def self.battle_bgm_by_troop=(battle_bgm_by_troop)
    @battle_bgm_by_troop = battle_bgm_by_troop
  end
end

#==============================================================================
# ** RPG::Map
#==============================================================================

class RPG::Map
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias_method :seph_multibgms_gmsys_apbgm, :autoplay_bgm
  alias_method :seph_multibgms_gmsys_bgm,   :bgm
  #--------------------------------------------------------------------------
  # * Autoplay BGM Flag
  #--------------------------------------------------------------------------
  def autoplay_bgm
    return seph_multibgms_gmsys_apbgm ||
           Multiple_BGMS.map_bgm_by_map[@id].empty? == false
  end
  #--------------------------------------------------------------------------
  # * Get Map Background Music
  #--------------------------------------------------------------------------
  def bgm
    # Get Original Map Background Music
    bgms = [seph_multibgms_gmsys_bgm]
    # Add Map Defined Map BGMS
    bgms << Multiple_BGMS.map_bgm_by_map[@id]
    # Return Random BGM
    return bgms.flatten.compact.random
  end
end

#==============================================================================
# ** Game_System
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :include_multi_bbgms
  attr_accessor :include_multi_bbgms_map
  attr_accessor :include_multi_bbgms_troop
  attr_accessor :include_datasys_bbgm
  attr_accessor :include_gmsys_bbgm
  attr_accessor :add_multi_bbgms
  attr_accessor :remove_multi_bbgms
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias_method :seph_multibgms_gmsys_init,  :initialize
  alias_method :seph_multibgms_gmsys_bbgm=, :battle_bgm=
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Original Initialization
    seph_multibgms_gmsys_init
    # Multi BGM Initialize
    init_multibgm
  end
  #--------------------------------------------------------------------------
  # * Object Initialization : Multi BGM
  #--------------------------------------------------------------------------
  def init_multibgm
    @include_multi_bbgms        = true
    @include_multi_bbgms_map    = true
    @include_multi_bbgms_troop  = true
    @include_datasys_bbgm       = true
    @include_gmsys_bbgm         = true
    @add_multi_bbgms            = false
    @remove_multi_bbgms         = false
  end
  #--------------------------------------------------------------------------
  # * Get Battle Background Music
  #--------------------------------------------------------------------------
  def battle_bgm
    # Start BGM List
    bgms = []
    # If Include Multi BGM
    if @include_multi_bbgms
      # Add Map BGMS if Included
      if @include_multi_bbgms_map
        bgms << Multiple_BGMS.battle_bgm_by_map[$game_map.map_id]
      end
      # Add Troop BGMS if Included
      if @include_multi_bbgms_troop
        bgms << Multiple_BGMS.battle_bgm_by_troop[$game_temp.battle_troop_id]
      end
    end
    # Add System Battle BGM if Included
    if @include_datasys_bbgm
      bgms << $data_system.battle_bgm
    end
    # Adds Game System Battle BGM if Included
    if @include_gmsys_bbgm && @battle_bgm != nil
      bgms << @battle_bgm
    end
    # Return Random BGM
    return bgms.flatten.random
  end
  #--------------------------------------------------------------------------
  # * Set Battle Background Music
  #--------------------------------------------------------------------------
  def battle_bgm=(battle_bgm)
    # If Add Map BGM
    if @add_multi_bbgms
      Multiple_BGMS.battle_bgm_by_map[$game_map.map_id] = battle_bgm
    # If Remove Map BGM
    elsif @add_multi_bbgms_troop
      Multiple_BGMS.battle_bgm_by_map[$game_map.map_id].delete(battle_bgm)
    else
      # Original Set Battle Background Music
      self.seph_multibgms_gmsys_bb = battle_bgm
    end
  end
end

#==============================================================================
# ** Scene_Save
#==============================================================================

class Scene_Save < Scene_File
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias_method :seph_multibgms_scnsv_wd, :write_data
  #--------------------------------------------------------------------------
  # * Write Data
  #--------------------------------------------------------------------------
  def write_data(file)
    # Original Write Save Data
    seph_multibgms_scnsv_wd(file)
    # Dump Multiple BGM Settings
    Marshal.dump(Multiple_BGMS.map_bgm_by_map, file)
    Marshal.dump(Multiple_BGMS.battle_bgm_by_map, file)
    Marshal.dump(Multiple_BGMS.battle_bgm_by_troop, file)
  end
end

#==============================================================================
# ** Scene_Load
#==============================================================================

class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias_method :seph_multibgms_scnld_rd, :read_data
  #--------------------------------------------------------------------------
  # * Read Data
  #--------------------------------------------------------------------------
  def read_data(file)
    # Original Read Save Data
    seph_multibgms_scnld_rd(file)
    # Read Multi BGMs
    Multiple_BGMS.map_bgm_by_map      = Marshal.load(file)
    Multiple_BGMS.battle_bgm_by_map   = Marshal.load(file)
    Multiple_BGMS.battle_bgm_by_troop = Marshal.load(file)
  end
end

#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end

which allows multiple BGMs for maps and battles, maybe it could work.

Thanks!
Sig by MacGravel

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Lol, someone wrote a script for Map BGM going into battle instead of just setting Battle BGM to none :P

Anyway, it is possible with BEHEMOTH's SAudio module probably. I will take a look at this later.

*
Shooting for the "MEMBER MODERATOR OF THE YEAR 2007" Award
Rep:
Level 89
Hi, there.
thanx, I'll be waiting. Update me if you find out anything
Sig by MacGravel

*
Shooting for the "MEMBER MODERATOR OF THE YEAR 2007" Award
Rep:
Level 89
Hi, there.
Hey Algebra, just wondering if you found out anything about that module.
Sig by MacGravel