The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: tSwitch on September 21, 2008, 09:37:54 PM

Title: [RGSS2.0]Battlecry VX v1.00
Post by: tSwitch on September 21, 2008, 09:37:54 PM
Battlecry VX
Version: 1.01
Author: NAMKCOR
Date: 09/21/2008

Version History



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


Screenshots

n/a

Instructions

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

Script


Code: [Select]
#=======================================================================
# 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


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) (http://www.sendspace.com/file/irnape)

Author's Notes


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

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

Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: modern algebra on September 21, 2008, 10:26:24 PM
Good stuff NAM, I hope to see more of your stuff for VX :)

EDIT::

I've tried it out. It's pretty cool the amount of customization you've given the script. I always get tired when I'm making the customization stuff and so a lot of my stuff that should be customizable ends up hard coded. Anyway, good work.
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: PMG on April 04, 2010, 01:25:25 PM
just played the demo and it seems to play the "lowWin" even when the only damage taken was 4HP
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: acuarion on December 08, 2011, 01:10:38 AM
hi i dont know about scripting but this is cool, have to say it does crash due the lack of sounds, i dont know if im doing something wrong
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: modern algebra on December 08, 2011, 02:05:41 AM
Change the sounds to ones you do have. There is a configuration section starting around line 135. It looks like:

Code: [Select]
  #=======================================================================
  # 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
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: acuarion on December 08, 2011, 02:29:08 AM
i did it and is not working, i have the sounds in Audio/Battlecry named by actor's ID as suggested and this is my config so far...sorry i dont know how to it in a box, and thanks for the fast reply
#=======================================================================
  # 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 9
      return ["Actor009-easyBattle", "Actor009-normalBattle",
              "Actor009-desperateBattle", "Actor009-bossBattle"]
    when 10
       return ["Actor010-easyBattle", "Actor010-normalBattle",
              "Actor010-desperateBattle", "Actor010-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 9
      return ["Actor009-bestWin","Actor009-normWin","Actor009-lowWin"]
    when 10
      return ["Actor010-bestWin","Actor010-normWin","Actor010-lowWin"]
    else
      return nil
    end
  end
 
end
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: modern algebra on December 08, 2011, 03:05:20 AM
well, upload your project and I will take a look. It's a file missing error, so it might be something to do with format or naming, but I can't tell just by looking at the script.
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: acuarion on December 08, 2011, 03:15:09 AM
ok ill do it in few min, this is my first week using this type of program so i will appreciate any constructive feedback :) i think it may be some confilcts with the scripts im using, i dont know a thing about scripts :D
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: acuarion on December 08, 2011, 05:24:31 AM
well, it seem im a new in this of posting too ^_^ i tried 2 times to upload my project and when the load was completed my page turned out as a new post page...nothing attached :S....

in other hand i find out what my problem is, it seem you need to have battlecries set for all party members or the game will crash, i did a couple of test an all of them were the same, when i have a full party game crashes if the voices are not set for each member, wich is kind of a pain for me cuz im planning to use a 6 members party and eventually some temp party members...... seems im gonna have to set voices for everyone T_T
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: Baz Wolftail on December 18, 2011, 10:26:27 AM
Hello.  From the looks of this, this script is almost exactly what I'm looking for.  I was curious though, and wanted to ask, if there are any plans on adding features such as attacking, being attacked, using skills/items, when HP gets critical in battle, sound effects for each character?  I have found a similar script that does what I am looking for, however it isn't compatible with the Tankentai atb side view battle script.

I just thought I would ask.  Not sure if the script creator still checks on this thread or has any plans on doing any additions or not.  Can't hurt to ask.  Thanks  :zwink:
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: acuarion on December 19, 2011, 04:11:24 AM
well i dont know if they are going to add damage/hit configurations or something like that, but for skills what im doing is, editing the skills animations and adding the voice i want, is kind of a lot of work because if for example you have 3 char using fire you gonna have to copy/paste 3 fires animation and add the voices you want for each char,  but at least is something :) im only doing with the signature skills of  my characters though, i dont wanna crazy with that
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: Tetosan on February 05, 2012, 02:56:41 PM
omg them necro

Well i always run into the same problem over and over again, at some point the script starts error either at the start of the battle or at the end

the error i get is as follows:

Script 'Battlecry VX' line 205: NoMethodError occured.

undefined method `[]' for nil:NilClass
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: D&P3 on February 05, 2012, 03:15:48 PM
Quote
the error i get is as follows:

Script 'Battlecry VX' line 205: NoMethodError occured.

undefined method `[]' for nil:NilClass

Alright so after just testing, it does the same for me when I am loading from a previously saved game.

It runs fine after starting a completely new game.


Have you done this and are you still getting this error?
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: Tetosan on February 05, 2012, 03:28:48 PM
Yes i'm in the middle of Testing the Scripts, i didn't really start with the Game itself yet XD i first want the scripts to work.
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: D&P3 on February 05, 2012, 03:40:36 PM
Are you using custom audio?

Or did you use the ones included with the demo like I did?
(cause I'm too lazy to make my own right now)
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: Tetosan on February 05, 2012, 03:46:53 PM
i use custom ones but they're named exactly like the one the script calls for (Copy&Paste).
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: D&P3 on February 05, 2012, 03:53:08 PM
Well if they've got the exact same name as the demo, then there shouldn't be a problem.

And it looks like something that I will actually need to look at before I can solve it.

Any chance you could put your script and audio files in a new project and upload it somewhere, so I can take a look?
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: Tetosan on February 05, 2012, 04:01:50 PM
urrr so all scripts and Audio files into a new project?

i just had made a little bit of effort in getting the Start to work, but it Errored at the end of the battle again...

These Nil errors are annoying me
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: D&P3 on February 05, 2012, 04:06:04 PM
No, just Battlecry VX and the custom audio files you're using for it.

Before sending it to me, test it out in your new project and see if it works.

If it does, then another script could be the problem.

If it still gets an error, then upload it somewhere for me.
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: Tetosan on February 05, 2012, 04:26:22 PM
AH STUPID ME

since i have two actors with the same name (powered up scene planned) i typed the Wrong ID so the Actor in the party wasn't in the script ><

i should've doublechecked that ._.
i figured that out when the Error in the new project changed from that Nil Error to ''Sound: Actor002_normalbattle not found'' ><

i thought the script doesn't check the other teammates and only plays sounds assigned to the partylead xD
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: acuarion on February 08, 2012, 06:04:19 PM
well yes, the scrip checks every members of the team, and if you dont have sounds assigned to each of them the game will give you an error, just make sure to have all the sounds for all your team members in the script and it should be fine :)

:-\ thats a pain though if you have a lot of team members like i do.....i have 8 members and imagine my pain assigning diferent sounds for all of them :)
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: tSwitch on February 08, 2012, 06:55:32 PM
I thought I had that taken into account, weird.
I programmed if the hpState was nil, but not if the actor id sounds were nil.

It should be fixed now.

Hello.  From the looks of this, this script is almost exactly what I'm looking for.  I was curious though, and wanted to ask, if there are any plans on adding features such as attacking, being attacked, using skills/items, when HP gets critical in battle, sound effects for each character?  I have found a similar script that does what I am looking for, however it isn't compatible with the Tankentai atb side view battle script.

I just thought I would ask.  Not sure if the script creator still checks on this thread or has any plans on doing any additions or not.  Can't hurt to ask.  Thanks  :zwink:

I don't know if you're still around but I don't really intend to update the script with more features, I don't use RPG Maker anymore really.
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: Adon on February 11, 2012, 02:24:42 PM
Very useful indeed! I imagine it isn't that hard to edit.
EDIT: What's up with the signature type thing?
Title: Re: [RGSS2.0]Battlecry VX v1.00
Post by: Tetosan on February 17, 2012, 05:42:36 AM
well yes, the scrip checks every members of the team, and if you dont have sounds assigned to each of them the game will give you an error, just make sure to have all the sounds for all your team members in the script and it should be fine :)

:-\ thats a pain though if you have a lot of team members like i do.....i have 8 members and imagine my pain assigning diferent sounds for all of them :)

42 Actors, and about 22 i had to assign voices to...
this Game will take more time to get all them scripts and Actors to work than actually working on the storyline..... XD