[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)