Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 KMapAudio
#1
KMapAudio

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. Confused 
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! Sad 
Well, not anymore! With my scriptlet you can change it once in a single place that will be executed just once! Shocked
The best part is it lets you save and load this change automatically! Grinning

Script for XP

Code:
# * KMapAudio XP
#   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.setup_audio_file(name, args)
   volume = args[0] || 80
   pitch = args[1] || 100
   RPG::AudioFile.new(name, volume, pitch)
 end

 def self.new_bgm(map_id, name, *args)
   file = setup_audio_file(name, args)
   $game_system.set_alt_bgm(map_id, file)
 end

 def self.new_bgs(map_id, name, *args)
   file = setup_audio_file(name, args)
   $game_system.set_alt_bgs(map_id, file)
 end
end

class Game_System
 alias :kyon_md_gm_sys_init :initialize
 def initialize
   kyon_md_gm_sys_init
   @alternate_bgm = {}
   @alternate_bgs = {}
 end

 def set_alt_bgm(map_id, file)
   @alternate_bgm[map_id] = file
   bgm_play(file)
 end

 def set_alt_bgs(map_id, file)
   @alternate_bgs[map_id] = file
   bgs_play(file)
 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
end


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
end




Terms & Conditions

Happy with a sweat I guess it's free for non commercial games.
By the way, I only support the latest version of my scripts. Laughing
Give me a free copy of your completed game if you include at least 2 of my scripts! Laughing + Tongue sticking out
"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]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: 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! Laughing + Tongue sticking out

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
Reply }




Users browsing this thread: