Battlecry VX
Version: 1.01
Author: NAMKCOR
Date: 09/21/2008
Version History
- v1.01: fixed a bug where if an actor had no sounds the game would crash
- v1.00: original system release
Planned Future Versions
possible revisions to take exotic-CBS into consideration.
Description
Plays user configured battle cries for characters at the start of battle and at the end of battle.
Pre-battle cries are selected by the difficulty of the enemy troop, and post-battle cries are selected by the remaining hp percentage of the actor that scored the final blow.
Features
- easy to configure
- volume control
- doesn't crash due to lack of sound to play
Screenshots
n/a
Instructions
Instructions are in the comments of the script, in their respective locations.
All that is needed is simple configuration.
Script
#=======================================================================
# Battle Cry VX version 1.01
#-----------------------------------------------------------------------
# Function:
# Plays user configured battle cries for characters at the start
# of battle and at the end of battle.
# Pre-battle cries are selected by the difficulty of the enemy
# troop, and post-battle cries are selected by the remaining
# hp percentage of the actor that scored the final blow.
#
# Compatibility:
# This script -should- be compatible with other custom battle scripts
# but compatibility has not as of yet been tested.
#
# Instructions:
# Simply configure the arrays of actor sounds in the case statements
# More detailed instructions will be given in the respective areas.
# Only skills truly needed are typing, copy, and paste.
#-----------------------------------------------------------------------
# Contact:
# Should you encounter a bug or incompatibility with this script,
# e-mail NAMKCOR at Rockman922@hotmail.com, or message at
# http://www.rmrk.net or http://forum.chaos-project.com
#
# This script was designed for use and distribution only on
# The RPG Maker Resource Kit (RMRK) and Chaos Project.
# If this script is found posted on any other website, it is STOLEN
# and it is advised to contact NAMKCOR at the above methods.
#
# This script is -strictly- for NON-commercial purposes. Please
# credit NAMKCOR for the creation of this script if you use it.
#=======================================================================
module NAMKCOR
#=======================================================================
# volume: simply set the return value to be equal to the volume
# you want the battlecries to be played at
#=======================================================================
def self.volume
return 80
end
#=======================================================================
# battle_range: set the return value to be how many levels above or
# below the enemy for easy/difficult battles.
#=======================================================================
def self.battle_range
return 5
end
#=======================================================================
# mid_hp: set the return value to be the percentage of hitpoints that
# is the -minimum- value for being in 'middle' hp range.
#=======================================================================
def self.mid_hp
return 40
end
#=======================================================================
# high_hp: set the return value to be the percentage of hitpoints that
# is the -minimum- value for being in 'high' hp range.
#=======================================================================
def self.high_hp
return 75
end
#=======================================================================
# bosses: to add a boss, simply create a "when" clause for the
# troop id, and set the 'return' value to 'true'
# do not touch the 'else' clause
# example:
# when 5
# return true
#=======================================================================
def self.bosses(id)
case id
when 3
return true
else
return false
end
end
#=======================================================================
# troop_level: to set a troop level, create a "when" clause for the
# troop id, and set the 'return' value to be the level
# desired. do not touch the 'else' clause.
# THERE MUST BE AN ENTRY FOR EVERY TROOP IN THE DATABASE
# example:
# when 5
# return 3
#=======================================================================
def self.troop_level(id)
case id
when 1
return 1
when 2
return 5
when 3
return 10
else
return 0
end
end
#=======================================================================
# start_battlecry: to add a new actor's set of battlecries to the
# listing, create a "when" clause for the actor's id
# and the return value to an array, configured as follows.
# array config: ["easy_battle_se", "normal_battle_se", "hard_battle_se",
# "boss_battle_se"]
# the values in "" are the names of the sound files.
# ALL SOUND FILES MUST BE PLACED IN 'AUDIO/Battlecry'
#
# Suggestion: for organization's sake, try naming the files by actor id
#
# example:
# when 3
# return ["easy","normal","hard","boss"]
#=======================================================================
def self.start_battlecry(id)
case id
when 1
return ["Actor001-easyBattle", "Actor001-normalBattle",
"Actor001-desperateBattle", "Actor001-bossBattle"]
when 2
return ["Actor002-easyBattle", "Actor002-normalBattle",
"Actor002-desperateBattle", "Actor002-bossBattle"]
else
return nil
end
end
#=======================================================================
# victory_battlecry: to add a new actor's set of battlecries to the
# listing, create a "when" clause for the actor's id
# and the return value to an array, configured as follows.
# array config: ["highHP_win", "normalHP_win", "lowHP_win"]
# the values in "" are the names of the sound files.
# ALL SOUND FILES MUST BE PLACED IN 'AUDIO/Battlecry'
#
# Suggestion: for organization's sake, try naming the files by actor id
#
# example:
# when 3
# return ["high","normal","hurting"]
#=======================================================================
def self.victory_battlecry(id)
case id
when 1
return ["Actor001-bestWin","Actor001-normWin","Actor001-lowWin"]
when 2
return ["Actor002-bestWin","Actor002-normWin","Actor002-lowWin"]
else
return nil
end
end
end
#=======================================================================
# DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
#=======================================================================
class Game_Troop < Game_Unit
def id
return @troop_id
end
end
class Scene_Battle < Scene_Base
alias :old_start :start
def start
old_start
@id = $game_party.members[rand($game_party.members.size)]
if NAMKCOR.bosses($game_troop.id) == true
@type = 3
else
if (@id.level + NAMKCOR.battle_range) <= NAMKCOR.troop_level($game_troop.id)
@type = 2
elsif (@id.level - NAMKCOR.battle_range) >= NAMKCOR.troop_level($game_troop.id)
@type = 0
else
@type = 1
end
end
@bcArray = NAMKCOR.start_battlecry(@id.id)
if @bcArray != nil
if @bcArray[@type] != nil
Audio.se_play("Audio/Battlecry/" + @bcArray[@type], NAMKCOR.volume, 0)
end
end
end
alias :old_victory :process_victory
def process_victory
@hp_percent = (@active_battler.hp / @active_battler.maxhp) * 100
if @hp_percent < NAMKCOR.mid_hp
@hp_state = 2
elsif @hp_percent > NAMKCOR.high_hp
@hp_state = 1
else
@hp_state = 0
end
@bcArray = NAMKCOR.victory_battlecry(@active_battler.id)
if @bcArray != nil
if @bcArray[@hp_state] != nil
Audio.se_play("Audio/Battlecry/" + @bcArray[@hp_state], NAMKCOR.volume, 0)
end
end
old_victory
end
end
Credit
Thanks
- Ghero for requesting the script
Support
for support, contact me at Rockman922@hotmail.com, or PM me here on RMRK.
Known Compatibility Issues
no known compatibility issues.
Demo
Sendspace (Outdated, please use the script from this thread)Author's Notes
heh, this was my first script for XP and now it's my first for VX.
Irony
Restrictions
This script is not to be posted on any website aside from RMRK and Chaos Project.
This script is ONLY to be used in non-commercial projects.
and please, credit me for writing it.
I'd love links to games that use it as well