09-02-2024, 08:48 PM 
	
	
	KMapAudio
VX + ACE
by Kyonides Arkanthes
Introduction
Did you ever wanted not to keep the current map's BGM or BGS because the in game atmosphere had changed?
Let's say you wanted to let the player know that a previously visited town has changed. Perhaps it's now decadent or somber.
 OK, you could just change the playing BGM but let's be honest, that's a tremendous job to keep track of all of the changes that implies!
 Well, not anymore! With my scriptlet you can change it once in a single place that will be executed just once!
 The best part is it lets you save and load this change automatically!
 Script for VX or ACE
Code:
# * KMapAudio ACE
#   Scripter : Kyonides Arkanthes
#   v0.1.0
# * Script Calls * #
# To set a new Map BGM or BGS
# # You can also add Volume and Pitch as optional parameters!
#   KMap.new_bgm(MapID, BGMname)
#   KMap.new_bgs(MapID, BGSname)
module KMap
  def self.new_bgm(map_id, name, *args)
    volume = args[0] || 80
    pitch = args[1] || 100
    file = RPG::BGM.new(name, volume, pitch)
    $game_system.alternate_bgm[map_id] = file
    file.play
  end
  def self.new_bgs(map_id, name, *args)
    volume = args[0] || 80
    pitch = args[1] || 100
    file = RPG::BGS.new(name, volume, pitch)
    $game_system.alternate_bgs[map_id] = file
    file.play
  end
end
class Game_System
  alias :kyon_md_gm_sys_init :initialize
  def initialize
    kyon_md_gm_sys_init
    @alternate_bgm = {}
    @alternate_bgs = {}
  end
  attr_reader :alternate_bgm, :alternate_bgs
end
class Game_Map
  alias :kyon_md_gm_map_setup :setup
  def setup(map_id)
    kyon_md_gm_map_setup(map_id)
    alt_bgm = $game_system.alternate_bgm[map_id]
    alt_bgs = $game_system.alternate_bgs[map_id]
    @map.bgm = alt_bgm if alt_bgm
    @map.bgs = alt_bgs if alt_bgs
  end
endTerms & Conditions
 I guess it's free for non commercial games.By the way, I only support the latest version of my scripts.

Give me a free copy of your completed game if you include at least 2 of my scripts!
	
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
![[Image: SP1-Scripter.png]](https://www.save-point.org/images/userbars/SP1-Scripter.png)
![[Image: SP1-Writer.png]](https://www.save-point.org/images/userbars/SP1-Writer.png)
![[Image: SP1-Poet.png]](https://www.save-point.org/images/userbars/SP1-Poet.png)
![[Image: SP1-PixelArtist.png]](https://www.save-point.org/images/userbars/SP1-PixelArtist.png)
![[Image: SP1-Reporter.png]](https://i.postimg.cc/GmxWbHyL/SP1-Reporter.png)
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
	
	
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
![[Image: SP1-Scripter.png]](https://www.save-point.org/images/userbars/SP1-Scripter.png)
![[Image: SP1-Writer.png]](https://www.save-point.org/images/userbars/SP1-Writer.png)
![[Image: SP1-Poet.png]](https://www.save-point.org/images/userbars/SP1-Poet.png)
![[Image: SP1-Reporter.png]](https://i.postimg.cc/GmxWbHyL/SP1-Reporter.png)
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE

