[XP] Blizz-ABS Battle Music

Started by nathmatt, September 13, 2010, 01:46:35 pm

Previous topic - Next topic

nathmatt

September 13, 2010, 01:46:35 pm Last Edit: September 25, 2011, 04:10:44 pm by nathmatt
Blizz-ABS Battle Music
Authors: Nathmatt
Version: 1.09
Type: Music changer
Key Term: Blizz-ABS Plugin



Introduction

Changes 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



Screenshots

no screen shot needed



Demo

no demo


Script

Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# 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



Instructions
add 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


Compatibility

requires Blizz-ABS


Credits and Thanks


  • Nathmatt
  • Magus for requesting it



Author's Notes

if you have any issues or suggestions post here
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Calintz

LMAO great response to that question Nathmatt!!
Deserves *level up* for response time.

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Magus

LEVEL ME DOWN. THE ANTI-BLIZZ GROUP IS AMONG YOU... Do it for the chick below...She watches..<br />

Jragyn

Amazing how such simple things can impact the feel of a game. :]
Even worthy of a levelup by me!


--J
A bright light can either illuminate or blind, but how will you know which until you open your eyes?

Holyrapid

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.

nathmatt

update 1.01 added ability to change the battle music in game
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Kett Shee

You're all daft cunts. I love you. <3

Dweller

I updated to the new version and now have an error:

"...uninitilizated constant Music_Change::Music..."

Dwellercoc
Spoiler: ShowHide

nathmatt

update fixed to fix yourself just change
Music_Change::Music

to
Music_Change.Music
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Dweller

Done, ty nathmatt. A very usefull script, lvl up
Dwellercoc
Spoiler: ShowHide

lonely_cubone

Great script, lvl up! I've actually wanted something like this for a while.

Btw, you're now level 69. Congratulations. :naughty:

The Niche

Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

lonely_cubone

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:

LiTTleDRAgo

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?

nathmatt

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 
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


sirsniffy

Any way to adjust the volume in the battle music?
These precious things...let them bleed, let them wash away - Tori Amos

nathmatt

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
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Taiine

I think I found a bug. For me, each time I get hit by an enemy, the battle music restarts over from the start. 

LiTTleDRAgo

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)

Dweller

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.
Dwellercoc
Spoiler: ShowHide

nathmatt

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
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


legacyblade

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

nathmatt

the problem with that is the music changes even when your not being attacked
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


legacyblade

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

Taiine

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.

nathmatt

update 1.03 fixed battle music resetting
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


LiTTleDRAgo

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

nathmatt

restarting during battle or not restoring the bgm ?
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Dweller

October 28, 2010, 01:10:51 am #29 Last Edit: October 28, 2010, 09:48:41 am by Dweller
Quoterestarting during battle or not restoring the bgm

Sometimes not restoring the bgm but the restarting bug disappeared.
Dwellercoc
Spoiler: ShowHide

LiTTleDRAgo

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 a
then in the game I change the bgm using event to b
when I battle bgm change to battle music
after battle is over the bgm back to a

nathmatt

update 1.04 there that should fix it
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


LiTTleDRAgo

October 29, 2010, 08:59:23 am #32 Last Edit: October 29, 2010, 09:02:51 am by LiTTleDRAgo
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 Niche

Yes, you done your english horrible :P. I laughed when I saw that last line.
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

nathmatt

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
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


LiTTleDRAgo

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

nathmatt

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
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


LiTTleDRAgo

@^ That's alright, I figure a way out from that

btw, when I trying to add another alignment in battle this error sometimes appeared



I don't know what's wrong with the script since it didn't appear often

http://www.megaupload.com/?d=S2C7P56T

nathmatt

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
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Taiine

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.

Magus

Yeah. That error is a must-fix. I encountered it as well :/
LEVEL ME DOWN. THE ANTI-BLIZZ GROUP IS AMONG YOU... Do it for the chick below...She watches..<br />

nathmatt

update: 1.07  see if its fixed now
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Kagutsuchi

The battle music keeps resetting when fighting enemies using ranged skills :(

nathmatt

send me the project so i can look at it
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


LiTTleDRAgo

could you make the music is fading everytime it's switched?

nathmatt

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

Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


JellalFerd

Instead of using arrays, why not just use
$game_system.bgm_play($game_system.battle_bgm)

It works for me if I use that.
QuoteFrank says:
But obviously they put on that shirt on in the morning.
Hmmm..
Booty shirts are nice.
Depends on the girl.
Jellal says:
booty shirts
lolwut

Moshan

Is there a way not to stop map BGM and play the battle music louder?

nathmatt

no because RPG maker XP does not support duel BGM's i believe ARC will allow it tho in its full release
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Sin86

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"

nathmatt

def self.Music
  return ['001-Battle01','002-Battle02']             # Array of musics
end


like this then 1 would play 002-Battle02
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Sin86

September 25, 2011, 12:03:40 pm #51 Last Edit: September 25, 2011, 12:05:59 pm by Sin86
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?

nathmatt

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


Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Zare

Really Nice Script, but after a battle the battle music keeps playing for me. Is there any Solution to change that?