I am DevilKnight new member in this great community.
I want to thanks Mr.db3 for tutorial video that really helped me to learn the basic of scripting.
I made this script of battle song.
Also, I will be more than happy for any feedback.
So, Let's move to the script:
Name: Condition Battle Song
Version: 1.0
Author: DevilKnight
Introduction
This Script allow you to change battle song depend on enemy health remain.
Features
- Easy to use
- Make Boss battle more enthusiastic
How to Use
Copy and paste the script at script editor under Materials and above main Process and other modification
that Explained in detail as comment in the script
Demo
https://www.dropbox.com/s/9yauzszalywunpz/DemoCondition%20Battle%20Song.rar
Script
Spoiler
Code:
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# Condition Battle Song# Version: 1.0# Author: DevilKnight# Date: 31th July, 2014#-------------------------------------------------------------------------------# Description:## This Script allow you to change battle song depend on enemy health # remain.##-------------------------------------------------------------------------------# Instruction:## - Go to First Editable Region To Determine Enemy Hp Percentage that song# change after, troop id of enemy that song change for, and songs.## - Go to Secound Editable Region To add enemy troop id with song # that assign to him##=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=module DevilKnight module Condition_Battle_Song #--------------------------------------------------------------------- # # # FIRST EDITABLE REGION /////////////////// # # # #--------------------------------------------------------------------- Enemy_Hp_Percentage = 50.0 #The percentage of enemy need to reach before song change #---------------------------------------------------------------------- #Wright all bosses that you want to change song #---------------------------------------------------------------------- #Boss Name_Id = Troop_ID (Take it from database) Spider_Id = 1 #---------------------------------------------------------------------- #---------------------------------------------------------------------- #Wright all songs names of bosses that you want change to #---------------------------------------------------------------------- Songs = { # Boss Name_Id (From Above) Spider_Id => { # Don't Change => "Song Name" :song_name => "Battle8", # Don't Change => Volume :volume => 100, # Don't Change => Pitch :pitch => 80, }, } #---------------------------------------------------------------------- #---------------------------------------------------------------------- # # # FIRST EDITABLE REGION /////////////////// # # # #---------------------------------------------------------------------- endend module BattleManager class << self attr_reader :troop_num #save Troop ID #-------------------------------------------------------------------------- # * Setup #-------------------------------------------------------------------------- alias dk_battle_Manager_setup setup def setup(troop_id, can_escape = true, can_lose = false) @troop_num = troop_id #Assign troop_id to @troop_num dk_battle_Manager_setup(troop_id, can_escape = true, can_lose = false) #call orginal method end endend#==============================================================================# ** Scene_Battle#------------------------------------------------------------------------------# This class performs battle screen processing.#============================================================================== class Scene_Battle < Scene_Base include DevilKnight::Condition_Battle_Song #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- alias dk_Scene_Battle_update_kujbhn update def update dk_Scene_Battle_update_kujbhn() # Call Orginal Method if $game_troop.all_dead? # To check all enemy Dead BattleManager.replay_bgm_and_bgs # To replay map song else $game_troop.members.each do |enemy| if (enemy.hp_rate * 100) <= Enemy_Hp_Percentage case BattleManager.troop_num #get troop id #--------------------------------------------------------------------- # # # SECOUND EDITABLE REGION /////////////////// # # # #--------------------------------------------------------------------- #------------------------------------------------------ #Here you wright all bosses names that you wrote above and the song that will change to #------------------------------------------------------ #when Boss Name when Spider_Id #RPG::BGM.new (Songs[Boss Name_Id][:song_name], Songs[Boss Name_Id][:volume], Songs[Boss Name_Id][:pitch]).play RPG::BGM.new(Songs[Spider_Id][:song_name], Songs[Spider_Id][:volume], Songs[Spider_Id][:pitch]).play #------------------------------------------------------ #--------------------------------------------------------------------- # # # SECOUND EDITABLE REGION /////////////////// # # # #--------------------------------------------------------------------- end end end end endend