Blizz-ABS Battle Music
Authors: Nathmatt
Version: 1.09
Type: Music changer
Key Term: Blizz-ABS Plugin
IntroductionChanges the music when you are targeted by an enemy
Features
- easy config just put the battle music you want in the config
- configurable fade out time
Screenshotsno screen shot needed
Demono demo
Script#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# BlizzABS Battle Music by Nathmatt
# Version: 1.09
# Type: Music changer
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is protected by the following license:
# #----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module Music_Change
def self.fade_out
return 1 # secounds of music fade
end
def self.Music
#RPG::AudioFile.new(name = "", volume = 100, pitch = 100)
return [RPG::AudioFile.new('001-Battle01')] # Array of musics
end
end
class Game_Map
def active?
return (battlers.find_all {|battler|battler.update? &&
battler.ai.target != nil})
end
end
class Scene_Map
alias music_change_update update
def update
if @map_id != $game_map.map_id
@battle_music = @normal_music = nil
@map_id = $game_map.map_id
end
@wait = 0 if @wait == nil
@wait -=1 if @wait > 0
if $game_map.active?.size > 0 && $game_map.battlers.size > 0
@wait = 40
if !@battle_music
@battle_music = true
@normal_music = false
@bgm = $game_system.playing_bgm
#"Audio/BGM/"
$game_system.bgm_play(Music_Change.Music[$game_player.music_type])
end
elsif @wait == 0 && @normal_music == false
@battle_music = false
@normal_music = true
if @bgm != nil
$game_system.bgm_play(@bgm)
else
$game_system.bgm_fade(1)
end
end
music_change_update
end
end
class Map_Actor
attr_accessor :music_type
alias battle_music_initialize initialize
def initialize(i)
battle_music_initialize(i)
@music_type = 0
end
end
class Game_System
attr_reader :playing_bgm
end
Instructionsadd the musics you want to the array of musics in the config
to change the music use $game_player.music_type = index
index goes 0 for the first 1 1 for the secound ect...
place this script Below Blizz-ABS
Compatibilityrequires Blizz-ABS
Credits and Thanks
- Nathmatt
- Magus for requesting it
Author's Notesif you have any issues or suggestions post here
LMAO great response to that question Nathmatt!!
Deserves *level up* for response time.
*fixes header* *levels up* *moves*
I love you XD
Amazing how such simple things can impact the feel of a game. :]
Even worthy of a levelup by me!
--J
I've been wanting this sort of a thing for as long as iƤve used BABS (or at leasst oafter i played FF12 and used BABS after it) Level up! I'm so gonna use this in my game.
Would it be possible to change that music via a script call, so that you could change it for boss battles etc.
update 1.01 added ability to change the battle music in game
(http://images.memegenerator.net/Patrick-Star-i-love-you/ImageMacro/2197656/MediumThumbnail.jpg?instanceText=i-love-you)
This deserves a lvl up. :3
I updated to the new version and now have an error:
"...uninitilizated constant Music_Change::Music..."
update fixed to fix yourself just change
to
Done, ty nathmatt. A very usefull script, lvl up
Great script, lvl up! I've actually wanted something like this for a while.
Btw, you're now level 69. Congratulations. :naughty:
I think you have a few of my souls by now. I never knew I had so many of them in the first place :wacko:
The script is showing error in line
Audio.bgm_play("Audio/BGM/" + Music_Change.Music[$game_player.music_type])
it says "no implicit conversion from nil to integer"
I place the script right below blizz abs and above main
what did I do wrong?
maybe there is a compatibility issue with 1 of the other scripts you are using give me a demo with all the scripts you are using it it and i will test it
Any way to adjust the volume in the battle music?
i believe you should be able to by changing this line
Audio.bgm_play("Audio/BGM/" + Music_Change.Music[$game_player.music_type])
to this
Audio.bgm_play("Audio/BGM/" + Music_Change.Music[$game_player.music_type],add music percentage here)
so if you want 100% just put 100
I think I found a bug. For me, each time I get hit by an enemy, the battle music restarts over from the start.
Quote from: nathmatt on October 24, 2010, 08:38:00 am
maybe there is a compatibility issue with 1 of the other scripts you are using give me a demo with all the scripts you are using it it and i will test it
I think that is not necessary
when I add "auto change bgm" in "map properties" that error didn't appear again
but...
Quote from: Taiine on October 26, 2010, 08:21:26 am
I think I found a bug. For me, each time I get hit by an enemy, the battle music restarts over from the start.
same problem,
when I change the bgm by using event then battle, after the enemies died the music changed back to beginning (the one I set as auto change bgm)
Quote from: Taiine on October 26, 2010, 08:21:26 am
I think I found a bug. For me, each time I get hit by an enemy, the battle music restarts over from the start.
I noticed the same bug, but in my case the music restarts sometimes when you get hit by an enemy and others works fine.
yea i noticed that too im trying to find what i need to check from the battlers to see if there in battle rather than just walking around
You can check if there are enemies within the processing range of the ABSEAL (or whatever it is called). I made an addon that did this on an old version of blizzABS, so not sure how to do that anymore, but the manual probably mentions it somewhere
the problem with that is the music changes even when your not being attacked
oh, I didn't notice that it only changed after being attacked. In your current method, check to see if the currently playing BGM is the/one of the battle musics. If you can't do that with RMXP, set a variable to true whenever you're attacked. I'm guessing the music changes back after a fixed amount of time, so just set the switch to false after that and re-play the map's previous BGM (if there isn't a way to resume that, set a variable with the old BGM). Hope that helps x.x
I didn't notice any real issue with the music popping on only when attacked. it started as soon as I got agro from any aggressive mobs. But as soon as they hit you with anything, the battle music restarts over.
update 1.03 fixed battle music resetting
Quote from: nathmatt on October 27, 2010, 12:40:36 pm
update 1.03 fixed battle music resetting
still restarting....
maybe you should change the method for changing the music
ex : when the battle starts
memorized bgm at the map and play battle bgm
then after battle is over restore that bgm
restarting during battle or not restoring the bgm ?
Quoterestarting during battle or not restoring the bgm
Sometimes not restoring the bgm but the restarting bug disappeared.
Quote from: nathmatt on October 27, 2010, 10:09:15 pm
restarting during battle or not restoring the bgm ?
I mean the bgm changed back to beginning
Something like this :
I set the autochange bgm in map properties to
athen in the game I change the bgm using event to
bwhen I battle bgm change to
battle musicafter battle is over the bgm back to
a
update 1.04 there that should fix it
Bug report :
If enemy exist in the map the bgm changed to battle bgm (sometimes disappeared) even though I didn't attacked them (the bgm changed immidiately after I teleported to that map)
If the map doesn't have enemy it would be normal, but when I changed the bgm with event then open my CMS the bgm changed back to beginning
did my english horrible?
Yes, you done your english horrible :P. I laughed when I saw that last line.
Quote from: LiTTleDRAgo on October 29, 2010, 08:59:23 am
Bug report :
If enemy exist in the map the bgm changed to battle bgm (sometimes disappeared) even though I didn't attacked them (the bgm changed immidiately after I teleported to that map)
If the map doesn't have enemy it would be normal, but when I changed the bgm with event then open my CMS the bgm changed back to beginning
did my english horrible?
the music only changes when an enemy targets you so as soon as you enter the map an enemy must target you
my script can't be causing enemies to disappear because it doesn't edit anything to cause that
the menu shouldn't be caused by this either try removing this script to see if the bugs are still there if therer not give me a demo so i can look into it
Quote from: nathmatt on October 29, 2010, 10:44:42 am
the music only changes when an enemy targets you so as soon as you enter the map an enemy must target you
my script can't be causing enemies to disappear because it doesn't edit anything to cause that
the menu shouldn't be caused by this either try removing this script to see if the bugs are still there if therer not give me a demo so i can look into it
It's not what I mean
probably it's easier to make a demo for explaining since my english is bad
http://www.megaupload.com/?d=H9M9FLN1
update: 1.05 fixed bug where music would stop playing when menu was called
@LiTTleDRAgo the music continuing to play after killing all the enemies is more of a Blizz-ABS bug at has to do with having enemies increase a variable it messes up the enemy counter in Blizz-ABS
@^ That's alright, I figure a way out from that
btw, when I trying to add another alignment in battle this error sometimes appeared
(http://img835.imageshack.us/img835/7127/90798544.jpg)
I don't know what's wrong with the script since it didn't appear often
http://www.megaupload.com/?d=S2C7P56T
update: 1.06 fixed music bug where if the battle music was on and you left the map the battle music would not play again and i think i fixed undefined music type for Map_Actor
One more little bug.
If you're fighting an enemy and you have to flee from them, or you just run past one and it agro's onto you and you keep going. The enemy can be reset back, no longer going after you, but the battle music will keep playing and not turn off until you move and get the enemy back on the screen, even if just at the edge and not in range of you, but just on screen will the battle music stop.
Yeah. That error is a must-fix. I encountered it as well :/
update: 1.07 see if its fixed now
The battle music keeps resetting when fighting enemies using ranged skills :(
send me the project so i can look at it
could you make the music is fading everytime it's switched?
update: added music fade out
@Kagutsuchi
now that i think about it you should probably increase the enemies sight to match the his attacks range
Instead of using arrays, why not just use
$game_system.bgm_play($game_system.battle_bgm)
It works for me if I use that.
Is there a way not to stop map BGM and play the battle music louder?
no because RPG maker XP does not support duel BGM's i believe ARC will allow it tho in its full release
I got a problem. Ok so I set the script to be like this(there wasn't much in the instructions so I had to figure it out myself).
def self.Music
case id
when 1 then return ['002-Battle02']
end
return ['001-Battle01'] # Array of musics
Now I set up a map and I use "$game_player.music_type = 1" which should be Battle02. When I do, I get this error.
"Script 'Blizz ABS Music' line 83: TypeError occurred
cannot convert nil into string"
def self.Music
return ['001-Battle01','002-Battle02'] # Array of musics
end
like this then 1 would play 002-Battle02
The array thing works though, thanks man!
However, I look at this code
Audio.bgm_play("Audio/BGM/" + Music_Change.Music[$game_player.music_type],add music percentage here)
By doing that, it applys to all the battle BGMs but is there a way to do it to have each specific battle BGM to have a different volume?
ok just made it use RPG::AudioFile.new so now you make an array of those for you it would be
def self.Music
return [RPG::AudioFile.new('001-Battle01'),RPG::AudioFile.new('002-Battle02')] # Array of musics
end
Really Nice Script, but after a battle the battle music keeps playing for me. Is there any Solution to change that?