Bienvenido a comunidad rpg maker, es una comunidad bastante antigua, buena, bonita y barata xD.
Espero no te mueras y que te vuelvas alguien más o menos activo en la comu.
Con respecto a tu pedido, claro, sí que hay un script que realice eso, pero no te lo daré, nah, mentira...BulletXT hizo este script hace muchísimo tiempo, además de diferentes scripts bastantes útiles. Es cosa de googlear un poco para llegar a encontrar estos scripts que son bastante buscados y utilizados a lo largo de los juegos de rpg maker. Claro, normalmente los hallarás en páginas de habla inglesa más que hispana...Hasta ahora he visto como 3 o 4 scripters en la scene hispana; pero bue...Creo que debería ir al grano y entregarte el script.
=begin
Continue BGM After Battle
Author: BulletXt(bulletxt@gmail.com)
Version: 0.3 Beta1
Date: 16/10/2009
Description:
This script will make your map's bgm continue playing after battle ends
instead of restarting.
WARNING: You must have installed Microsoft Visual C++ 2008 Redistributable Package,
you can get it here:
http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en
WARNING2: you must not set a battle BGM that is MIDI format and/or part of RTP.
To install to a new project:
-copy this script and place it as FIRST script in the Material section
-copy all dlls found in root directory of the demo
-copy mplayer folder
-copy Start.exe and Rescue.exe
When starting the game, you can either normally start it from Game.exe
or from Start.exe (clicking on Start.exe avoids loading external gui).
=end
# CONFIGURATION
#this is the name of the exe to start the game. Do not add file extension.
STARTGAME = "Start"
#this is the name of the Recover Audio engine exe. Do not add file extension.
RESCUE = "Rescue"
#this is a switch ID. When ON, map's BGM will continue playing in battle.
CONTINUE_BGM = 1
#this is a switch ID. When ON, it enables Random Battle BGM.
ENABLE_RANDOM_BATTLE_BGM = 2
=begin
these are the Battle BGMs that you want to play randomly.
example:
BATTLE_BGMS_THAT_PLAY_RANDOMLY = ["Battle1", "Battle2","Battle3"]
You can change this array at any time in game through a script call inside
event. To do this type for example:
$audio_random_battle = ["r_Battle1", "r_Battle2","r_Battle3"]
=end
BATTLE_BGMS_THAT_PLAY_RANDOMLY = ["r_Battle1", "r_Battle2","r_Battle3"]
################################################################################
######################### END CONFIGURATION ####################################
################################################################################
#this holds the random battle array globally
$audio_random_battle = BATTLE_BGMS_THAT_PLAY_RANDOMLY
$audio_battle_bgm_random_tmp_id = "nil"
FORMAT_OF_SONGS = ["mp3","ogg","wav","wma"]
######################### CHECK IF ENGINE IS RUNNING ###########################
#if in test mode, start the recover audio engine
begin
#send a string to server. if it exists it means it must not open a new recover gui.
open("\\.\pipe\audio_engine_xt",'w') { |pipe| pipe.write("nil,nil,nil"); } rescue recover = 1
#this returns true if there is no recover gui engine running.
if recover == 1
Thread.new{system (RESCUE)}
recover = 0
end
end
############################ Handle F12 Reset key ##############################
unless $f12_cleaner_F3XXEFA1.nil?
#if in test mode, warn the user he is leaving testing mode
if $TEST
p sprintf("You are now leaving testing mode.")
end
#kill recover GUI and mplayer
system "start /MIN /B taskkill /F /IM #{RESCUE+".exe"} "
system "start /MIN /B taskkill /F /IM #{"mplayer.exe"} "
# Opens the game executable in a new thread
Thread.new{system (STARTGAME+".exe")}
# Exits this thread
exit
end
$f12_cleaner_F3XXEFA1 = true
module AudioSuffix
def suffix_check
for codec in 0...FORMAT_OF_SONGS.size
path = "Audio\BGM\"
path.gsub!('\', "/")
song_file_name = $game_system.battle_bgm.name + "." + FORMAT_OF_SONGS[codec]
if FileTest.exist?(path+song_file_name)
$audio_suffix = "." + FORMAT_OF_SONGS[codec]
break
end
end
end
def recover
# start recover audio engine
Thread.new{system (RESCUE)}
#warn the user that the engine has crashed
$game_message.texts.push("The Audio Engine server has crashed.")
$game_message.texts.push("A Rescue GUI mode of the engine should have started.")
$game_message.texts.push("If it didn't, please manually click on #{RESCUE}.exe .")
$game_message.texts.push("Remember to close it after closing game.")
#do a sleep of n seconds to give the time for the engine to start
sleep(4) #FIX: its not said 6 seconds are enough
end
end
class Game_Map
# initialize the Random Battle BGM array
# the original Random Battle BGM code was made from ERZENGEL
attr_accessor :rbmfiles
alias audio_rbm_initialize initialize
def initialize
#set @rbmfiles to the Battle BGM array set by user in CONFIGURATION
@rbmfiles = $audio_random_battle
audio_rbm_initialize
end
#this is a real time update. gets executed each frame.
#this makes the random battle array always be aware of any change
#set from Player.
alias bulletxt_random_battle_update update
def update
bulletxt_random_battle_update
@rbmfiles = $audio_random_battle
end
end
class Scene_Map < Scene_Base
include AudioSuffix
def call_battle
# This handles Random Battle BGM
rbmoff = $data_system.battle_bgm.name.clone
# if true, it means Random Battle BGM should happen
if $game_switches[ENABLE_RANDOM_BATTLE_BGM]
#debug battle bgm array
#p $game_map.rbmfiles
# this gets a random element from the array
audio = rand($game_map.rbmfiles.size)
#if < 1, it must not add anything to array
if $game_map.rbmfiles.size > 1
#this puts back the previously removed element into array. at first run
#this doesn't add anything because the variable is set to nil
$game_map.rbmfiles.push($audio_battle_bgm_random_tmp_id) if $audio_battle_bgm_random_tmp_id != "nil"
end
#this global variable holds the last random Battle BGM. it's needed so at
#next run we know the element to put back in array (since it gets deleted below)
$audio_battle_bgm_random_tmp_id = $game_map.rbmfiles[audio]
#debug the battle bgm that is about to play
#p $audio_battle_bgm_random_tmp_id
#this tells VX who is the random Battle BGM to play
$data_system.battle_bgm.name = $game_map.rbmfiles[audio]
#if < 1, it must not remove anything from array
if $game_map.rbmfiles.size > 1
=begin
remove current Battle BGM from array, so at next battle the random won't
play this again. This avoids that a battle BGM plays 2 times consecutively.
The element gets back in to array at next run after getting the new random
battle bgm to play.
=end
$game_map.rbmfiles.delete_at(audio)
end
else
#here the Random Battle BGM code finishes.
end
@spriteset.update
Graphics.update
$game_player.make_encounter_count
$game_player.straighten
$game_temp.map_bgm = RPG::BGM.last
$game_temp.map_bgs = RPG::BGS.last
if $game_switches[CONTINUE_BGM]
continue_bgm
return
end
#get values of current plaging bgm
$audio_name = $game_temp.map_bgm.name
$audio_volume = $game_temp.map_bgm.volume
$audio_pitch = $game_temp.map_bgm.pitch
#start playing the same bgm again but with volume at 0
Audio.bgm_play("Audio/BGM/" + $audio_name, 0, $audio_pitch) rescue nil
#make game temp bgm be equal to the new playing BGM, so after battle ends
#it knows who's the values of the bgm to restore (it actually just continues
#playing it but with volume restored)
$game_temp.map_bgm = RPG::BGM.new
$game_temp.map_bgm.name = $audio_name
$game_temp.map_bgm.volume = $audio_volume
$game_temp.map_bgm.pitch = $audio_pitch
RPG::BGS.stop
Sound.play_battle_start
#call suffix function, it returns the exact suffix of bgm
suffix_check
#prepeare bgm volume and name to send to server
volume = $game_system.battle_bgm.volume
id = $game_system.battle_bgm.name + $audio_suffix
battle_song = id + ",play," + volume.to_s()
open("\\.\pipe\audio_engine_xt",'w') { |pipe| pipe.write(battle_song); } rescue rec = 1
if rec == 1
recover
rec = 0
open("\\.\pipe\audio_engine_xt",'w') { |pipe| pipe.write(battle_song); } rescue nil
end
$game_temp.next_scene = nil
$scene = Scene_Battle.new
end
def continue_bgm
Sound.play_battle_start
$game_temp.next_scene = nil
$scene = Scene_Battle.new
end
end
# Forced Victory ME Stop - KGC_ForceStopVictoryME
# http://ytomy.sakura.ne.jp
module KGC
module ForceStopVictoryME
# Fade out time (milli-second)
# If set to 0, the ME stops instantly upon scene change to map.
FADE_TIME = 1000
end
end
$imported = {} if $imported == nil
$imported["ForceStopVictoryME"] = true
#end code of Forced Victory ME Stop - KGC_ForceStopVictoryME
class Scene_Battle < Scene_Base
include AudioSuffix
alias bulletxt_continue_bgm_process_victory process_victory
def process_victory
suffix_check
stop = $game_system.battle_bgm.name + $audio_suffix + ",stop," + "0"
open("\\.\pipe\audio_engine_xt",'w') { |pipe| pipe.write(stop); } rescue nil
@info_viewport.visible = false
@message_window.visible = true
$game_system.battle_end_me.play if $game_switches[CONTINUE_BGM] == false
unless $BTEST
$game_temp.map_bgm.play
$game_temp.map_bgs.play
end
display_exp_and_gold
display_drop_items
display_level_up
battle_end(0)
end
alias bulletxt_continue_bgm_battle_end battle_end
def battle_end(result)
suffix_check
stop = $game_system.battle_bgm.name + $audio_suffix + ",stop," + "0"
open("\\.\pipe\audio_engine_xt",'w') { |pipe| pipe.write(stop); } rescue nil
bulletxt_continue_bgm_battle_end(result)
# Forced Victory ME Stop - KGC_ForceStopVictoryME
# http://ytomy.sakura.ne.jp
return if result != 0
@@_victory_me_thread = Thread.new {
time = KGC::ForceStopVictoryME::FADE_TIME
RPG::ME.fade(time) # Start ME Fade
sleep(time / 1000.0) # Wait until the fade is done.
RPG::ME.stop # Stop ME
}
#end code of Forced Victory ME Stop - KGC_ForceStopVictoryME
end
end
Primero, debes bajar la demo y copiar todos los ".dll" que aparezcan ahí y llevarlos a la carpeta de tu proyecto, solo así funcionará el script(además de copiando el script del texto, no copies ningún script de la demo ya que están desactualizados, pero los dll no se han modificado, así que el script que te pasé funcionará bien y tendrá menor cantidad de errores)
Por favor, revisa muy bien la configuración del script, para instalarlo simplemente copia su contenido en el portapapeles(CTRL+C) y pégalo en el editor, en la sección de scripts(f11) abajo de cualquier script, pero arriba de main(Quizás en la sección reservada para los scripts personalizados nombrada como "custom"). Recuerda grabar.
El script además viene con un random battle bgm desactivable ¿Que hace esta extra feature? Bueno, permite tocar temas de batalla al azar cuando entras en la batalla(Cosa que personalmente no me gusta). Se puede desactivar desde la configuración.
También puedes usar este:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆ BGM Continuance - KGC_ContinueBGM ◆ VX ◆
#_/ ◇ Last Update: 2008/08/31 ◇
#_/ ◆ Translation by Mr. Anonymous ◆
#_/ ◆ KGC Site: ◆
#_/ ◆ http://f44.aaa.livedoor.jp/~ytomy/ ◆
#_/ ◆ Translator's Blog: ◆
#_/ ◆ http://mraprojects.wordpress.com ◆
#_/----------------------------------------------------------------------------
#_/ This script makes it possible to continue the currently playing BGM from
#_/ the map after battle without resetting the BGM position. Also note that
#_/ this effect DOES NOT work if a Victory ME(Music effect) is set to play after
#_/ the battle ends.
#_/============================================================================
#_/ Install: As close to the top of custom scripts as possible, as to gain
#_/ greater influence to other scripts.
#_/ This script completely overwrites Scene_Map's call_battle method as well as
#_/ Scene_Battle's process_victory method.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#=================================================#
# IMPORT #
#=================================================#
$imported = {} if $imported == nil
$imported["ContinueBGM"] = true
#=================================================#
#==============================================================================
# ■ RPG::AudioFile
#==============================================================================
class RPG::AudioFile
#--------------------------------------------------------------------------
# ○ 一致判定
#--------------------------------------------------------------------------
def equal?(obj)
return false unless obj.is_a?(RPG::AudioFile)
return false if self.name != obj.name
return false if self.volume != obj.volume
return false if self.pitch != obj.pitch
return true
end
#--------------------------------------------------------------------------
# ○ 等値演算子
#--------------------------------------------------------------------------
def ==(obj)
return self.equal?(obj)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● バトル画面への切り替え
#--------------------------------------------------------------------------
def call_battle
@spriteset.update
Graphics.update
$game_player.make_encounter_count
$game_player.straighten
$game_temp.map_bgm = RPG::BGM.last
$game_temp.map_bgs = RPG::BGS.last
if $game_temp.map_bgm != $game_system.battle_bgm
RPG::BGM.stop
RPG::BGS.stop
end
Sound.play_battle_start
$game_system.battle_bgm.play
$game_temp.next_scene = nil
$scene = Scene_Battle.new
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 勝利の処理
#--------------------------------------------------------------------------
def process_victory
@info_viewport.visible = false
@message_window.visible = true
unless $game_system.battle_end_me.name.empty?
RPG::BGM.stop
$game_system.battle_end_me.play
end
unless $BTEST
$game_temp.map_bgm.play
$game_temp.map_bgs.play
end
display_exp_and_gold
display_drop_items
display_level_up
battle_end(0)
end
end
Se intala sobre main, abajo de cualquier script principal.
¡Bueno, eso, espero te sirva y bienvenido seas, nuevamente a comunidad.rpgmaker.es!