[VX] Battlecry VX v1.00

Started by tSwitch, September 21, 2008, 05:39:19 pm

Previous topic - Next topic

tSwitch

September 21, 2008, 05:39:19 pm Last Edit: February 21, 2009, 05:41:18 am by shdwlink1993
Battlecry VX
Authors: NAMKCOR
Version: 1.00
Type: Battle Add-on
Key Term: Battle Add-on



Introduction

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.

Version History




  • v1.00: original system release



Planned Future Versions


possible revisions to take exotic-CBS into consideration.




Features



  • easy to configure

  • volume control

  • doesn't crash due to lack of sound to play




Screenshots

N/A


Demo

Sendspace


Script

Spoiler: ShowHide

#=======================================================================
# Battle Cry VX         version 1.00
#-----------------------------------------------------------------------
# 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[@type] != nil
      Audio.se_play("Audio/Battlecry/" + @bcArray[@type], NAMKCOR.volume, 0)
    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[@hp_state] != nil
      Audio.se_play("Audio/Battlecry/" + @bcArray[@hp_state], NAMKCOR.volume, 0)
    end
    old_victory
  end
end



Instructions

Instructions are in the comments of the script, in their respective locations.
All that is needed is simple configuration.


Compatibility

No known compatibility issues.


Credits and Thanks


  • NAMKCOR
  • Ghero for requesting the script



Author's Notes
heh, this was my first script for XP and now it's my first for VX.
Irony ;8

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

For support, contact me at Rockman922@hotmail.com, or PM me here on RMRK.


FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: tSwitch.us | Twitter | Tumblr

Holyrapid

I wouldn´t call it irony. I´d say that a circle closes, kinda... Sounds somewhat intresting, but i´m not sure if i dully got the idea.

tSwitch

play the demo, you'll see what it does.


FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: tSwitch.us | Twitter | Tumblr

Calintz

The player yells at the beginning, and yells at the end.
If you had a microphone, you could record anything you wanted the character to say, and they would say it.

Holyrapid

Hmm. I like it. Now, i used the search but didn´t find the XP version, so could you give the link to it? (doesn´t matter wheter it´s a demo or just the script...)
Thanks.

Starrodkirby86

Quote from: Pyhankoski on March 24, 2009, 10:17:43 am
Hmm. I like it. Now, i used the search but didn´t find the XP version, so could you give the link to it? (doesn´t matter wheter it´s a demo or just the script...)
Thanks.
I figured it would be in RMRK, NAMK's original forum, and whoop-de-doo, it is indeed in there.

http://rmrk.net/index.php/topic,17132.0.html

That is the link to the topic. It has a different name, but it should be the same, as it's his first script in XP, as the description in that topic says (Here too which just proves it even more).

What's osu!? It's a rhythm game. Thought I should have a signature with a working rank. ;P It's now clickable!
Still Aqua's biggest fan (Or am I?).




tSwitch

it was on the original CP as well, too bad the posts didn't go over.

maybe I should re-script it to have the config of the VX version.


FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: tSwitch.us | Twitter | Tumblr

Rose Guardian

Sorry if this is a necro post, but could you upload the demo some where else like medafire? Sendspace is not giving me the download spot for some reason.