NBDA v1.3b

0 Members and 1 Guest are viewing this topic.

********
Hungry
Rep:
Level 95
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
NBDA v1.3b
(NAMKCOR's Battle Difficulty Announcer)

Info
This script can be used to have actors talk before and after battle, to describe both the battle and their own conditions
Kinda Valkyrie Profile-ish

Features
-- uses easily customizable arrays to determine sounds
-- uses an array to create enemy group levels
-- have different sounds for Boss Battles!
-- actors' statements at end battle are determined by their hp levels
-- user friendly instructions
-- exotic CBS compatable!

Screenies
N/A - Audio Script

Version History
(note: versions 1.0-1.1 were NOT released)
- 1.0 - completed basic system for pre-battle talk
- 1.0b - fixed bug where dead people spoke ;D
- 1.1 - added end of battle speech
- 1.1b - fixed bug where any hp loss resulted in low hp sounds
- 1.2 - Fixed mute characters bug; removed useless variable; sounds now must
        go in their own folder under SE for easier organization
        The folder is - "Audio\SE\NBDA\"
        Discovered complete incompatability with Cogwheel's RTAB
        as well as a compatabilizing technique
- 1.3 - Made the script compatible (mostly) with exotic-CBS'es
              removed useless lines of code
- 1.3b - Fixed echo problem by changing location of the end-battlecry =D

Script
Spoiler for:
Code: [Select]
#=================================================================
#   NAMKCOR's Battle Difficulty Announcer v1.3b                                                             
#---------------------------------------------------------------------------------------------------------------------             
#   Created By: NAMKCOR                                                                                                     
#   Created for the Websites: Chaos Project & RPG Maker Resource Kit                     
#                                                  (www.chaosproject.co.nr & www.rmrk.net)                       
#   If this script is hosted on any other website, then it is stolen, please contact           
#   me at the address given below                                                                                         
#--------------------------------------------------------------------------------------------------------------------
#   If you find any Bugs/Incompatability issues with this script, please contact me at   
#   the following e-mail address: Rockman922@aol.com, and please be descriptive   
#   with your e-mail subject, as I delete spam on sight.  I might be able to fix it, but       
#   as of right now I'm kinda a mediocre scripter so some Incompatability issues may
#   be unsolvable.                                                                                                                     
#--------------------------------------------------------------------------------------------------------------------
#   Function:                                                                                                                             
#    This script will play a "battle cry" that is randomized and chosen due to a set       
#    number of parameters.  This system was designed to be customizable without   
#
#     much special scripting know-how                                                                                 
#    Compatability:                                                                                                                   
#     100% compatability with SDK (some things may conflict I dunno SDK well)
#     90% compatability with exotic-CBS
#                                                                                                                                                 
#     Instructions:                                                                                                                     
#      Comments and instructions for the individual customizations will be given           
#       right where they are located.  Only real skills needed are reading, typing,             
#       and copy&paste
#       All sounds used must go under "Audio\SE\NBDA\" or the script will bug
#--------------------------------------------------------------------------------------------------------------------
#     Version History:
#     1.0 - completed system, different phrases at start of battle only
#     1.0b - Fixed a bug where dead people could still talk at beginning of battle
#     1.1 - Added talking at end of battle
#     1.1b - Fixed a bug where any hitpoint loss at all would result
#                Low HP sounds being played
#     1.2 - Fixed mute characters bug; removed useless variable; sounds now must
#                go in their own folder under SE for easier organization
#                The folder is - "Audio\SE\NBDA\"
#                Discovered incompatability with Cogwheel's RTAB
#                 as well as a compatabilizing technique (temporary)
#     1.3 - Made the script compatible (mostly) with exotic-CBS'es
#              removed useless lines of code
#     1.3b - Fixed echo problem by changing location of the end-battlecry =D
#=================================================================

#don't touch
class Game_Party
  def partyActors
    return @actors
  end
end
#end don't touch

#=================================================================
#  This array will be used to detect if an enemy troop is a boss battle
#  Simply add the index of the boss troops to the array
#=================================================================
$bosses = [3]

#=================================================================
#  This array is used to detect the level of the enemy in the database
#  All enemy MUST have a level value put in this array, and  the levels MUST be
#  In order of the enemy in the database or the system will bug and/or crash
#  ENEMY LEVELS CANNOT BE NIL
#  To include a boss,  make the level value equal to zero
#
#  example - say you have 5 enemies, and the first two are level 1 battles, 2
#                    level 5, $enemy_level would look like this:
#                    $enemy_level[1,1,5,5]
#=================================================================
$enemy_level = [1,5,10,10]

#=================================================================
#  These arrays are used to store the sounds played by the actors
#   All you need to do is write the name of the sound you want played by the actor
#   Based on the conditions
#   Like the enemy levels, this one is organized by the actor's number in
#   the database, and all must have a value for the correct sound to be played
#   (or nil if no sound)

#    $in_boss_battle: If the character is in a boss battle
#    $in_desperate_battle: if the character's level is DESPERATE or more levels below the
#                                            enemy party's level
#                                            (change DESPERATE to whatever value you feel would be
#                                              appropriate to determine whether or not the character
#                                              will have a tough time with the battle)
#    $in_normal_battle: if the battle isn't desperate or easy, basically in the right range
#                                      for the character's level
#    $in_desperate_battle: if the character's level is EASY or more levels above the
#                                            enemy party's level
#                                            (change EASY to whatever value you feel would be
#                                             appropriate to determine whether or not the character
#                                             will have an easy time with the battle)
#   $low_hp: if the character has low hp at the start of battle, they will say this
#   LOWPERCENT: what percent of hp would be considered low
#   MIDPERCENT: what percent of hp would be considered middleish
#    $end_low_hp: what sound is played at the end of battle if actor's hitpoints are
#                              below LOWPERCENT
#    $end_mid_hp: what sound is played at the end of battle if actor's hitpoints are
#                               above LOWPERCENT, but lower than MIDPERCENT
#    $end_high_hp: what sound is played at the end of battle if the actor's hitpoints are
#                                above MIDPERCENT
#
#   The character's sounds must be in order of the actors in the database
#    for mute characters, leave their values nil
#
#    example: if actor 1 plays sound "omg" at the beginning of boss battles, and
#                     actor 3 plays "ahhh" but actor 2 is mute, $in_boss_battle would look
#                      like this:
#                      $in_boss_battle = ["omg", nil, "ahhh"]
#                      where "omg" and "ahhh" are the names of the SE file in the folder
#
#   The syntax is the same for all the other arrays
#=================================================================
$in_boss_battle = ["Actor001-bossBattle", "Actor002-bossBattle",nil,nil]
$in_desperate_battle = ["Actor001-desperateBattle","Actor002-desperateBattle",nil,nil]
DESPERATE = 4
$in_normal_battle = ["Actor001-normalBattle","Actor002-normalBattle",nil,nil]
$in_easy_battle = ["Actor001-easyBattle","Actor002-easyBattle",nil,nil]
EASY = 4
$low_hp = ["Actor001-lowHP","Actor002-lowHP",nil,nil]
LOWPERCENT = 25
MIDPERCENT = 75
$end_low_hp = ["Actor001-lowWin","Actor002-lowWin",nil,nil]
$end_mid_hp = ["Actor001-normWin","Actor002-normWin",nil,nil]
$end_high_hp = ["Actor001-bestWin","Actor002-bestWin",nil,nil]

 #==================================================================
 #DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
 #==================================================================
@char_selection = 0
class Scene_Battle
#alias phase1 to make it compatible
alias new_phase1 start_phase1
#overloaded phase1 for battlecry before phase1 execution
def start_phase1
      #Battlecry Excecution
    @played = false
    @troop_id2 = ($game_temp.battle_troop_id)-1
    @actors = $game_party.partyActors
    @char_selection = rand(@actors.size)
   
    while @actors[@char_selection].level == nil or @actors[@char_selection].hp <= 0
      @char_selection = rand(@actors.size)
    end
    @level = @actors[@char_selection].level
    @hpRemain = (@actors[@char_selection].hp*100/@actors[@char_selection].maxhp)
    @enemylevel = $enemy_level[@troop_id2]
    if $bosses.include?(@troop_id2) and @played == false
      if $in_boss_battle[@char_selection] != nil
        Audio.se_play("Audio/SE/NBDA/" + $in_boss_battle[@char_selection], 100, 100)
        @played = true
      end
    end
    if @hpRemain < LOWPERCENT and @played == false
      if $low_hp[@char_selection] != nil
        Audio.se_play("Audio/SE/NBDA/" + $low_hp[@char_selection], 100, 100)
        @played = true
      end
    end
      if @level + DESPERATE  <= @enemylevel and $in_desperate_battle[@char_selection] != nil and @played == false
          Audio.se_play("Audio/SE/NBDA/" + $in_desperate_battle[@char_selection], 100, 100)
         @played = true
      elsif @level - EASY >= @enemylevel and $in_easy_battle[@char_selection] != nil and @played == false
          Audio.se_play("Audio/SE/NBDA/" + $in_easy_battle[@char_selection],100,100)
          @played = true
      elsif $in_normal_battle[@char_selection] != nil and @played == false
          Audio.se_play("Audio/SE/NBDA/" + $in_normal_battle[@char_selection],100,100)
        end
        @played = false
    #end battlecry execution
    new_phase1
  end
end
class Window_BattleResult < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     exp       : EXP
  #     gold      : amount of gold
  #     treasures : treasures
  #--------------------------------------------------------------------------
  alias new_initialize initialize
  def initialize(exp, gold, treasures)
    #play end of battle SE
    @played = false
    @actors = $game_party.partyActors
    @char_selection = rand(@actors.size)   
    while @actors[@char_selection].level == nil or @actors[@char_selection].hp <= 0
      @char_selection = rand(@actors.size)
    end   
    @hpRemain = (@actors[@char_selection].hp*100/@actors[@char_selection].maxhp)
    if @hpRemain <= LOWPERCENT and @played == false
      if $end_low_hp[@char_selection] != nil
        Audio.se_play("Audio/SE/NBDA/" + $end_low_hp[@char_selection], 100, 100)
        @played == true
      end
    end   
    if @hpRemain <= MIDPERCENT and @hpRemain > LOWPERCENT and @played == false
      if $end_mid_hp[@char_selection] != nil
        Audio.se_play("Audio/SE/NBDA/" + $end_mid_hp[@char_selection], 100, 100)
        @played == true
      end
    end   
    if @hpRemain > MIDPERCENT and @played == false
      if $end_high_hp[@char_selection] != nil
        Audio.se_play("Audio/SE/NBDA/" + $end_high_hp[@char_selection], 100, 100)
        @played == true
      end
    end
    new_initialize(exp,gold,treasures)
  end
end
Just paste that in it's own script above main.
Instructions are given in the script's comments above the arrays and values
that they concern

Demo
Attached to this Post
*requires .rar extractor, can be found HERE

Compatability
Most likely compatable with SDK
Most likely compatable with exotic CBSes
no known incompatability issues

Other Info
WOHOO! This is my first "real" script
If you find any bugs, please feel free to e-mail me at Rockman922@aol.com
Also contact me and let me know about any incompatability issues!
If this script is used in a game, please credit me, and let me know about the game so that I can see what you did with my script ok?

--enjoy!
« Last Edit: May 27, 2007, 10:59:58 PM by NAMKCOR »

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: Bandcamp | Twitter | Patreon

pokeball WcWOfflineMale
***
Rep:
Level 87
2 + 2 is a math problem, NOT 4.
Cool.  This is also similar to FF10, except not as context-sensitive.  Maybe you could add somesort of database or something for that, like where it changes depending on the battle and story, and were you are, that sort of thing.  But still, awesome.  I haven't tried it yet though...
If you are reading this, the government of the U.S.A. is currently planting a chip in your brain.
People like decreasing my Rep. In fact, people like decreasing most others people's rep.

********
Hungry
Rep:
Level 95
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
well, you can easily change the sounds with a call script event

for example
at one point in the game you could have

Code: [Select]
$end_low_hp = ["Actor001-LowHPChap1"]

and later on, call this event script

Code: [Select]
$end_low_hp = ["Actor001-lowHPChap2"]
return true

and by using simple call script events, you could use my script as a base system to make it more context sensitive.

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: Bandcamp | Twitter | Patreon

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Best RPG Maker User (Scripting)2010 Most Mature Member
Pretty neat script. I think I would have made the variables class variables rather than global, but I am not a very good scripter so I might be missing something obvious. Anyway, good job.

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
It's a pretty sweet little script ^_^

It is easier to change global variables than class variables with the Call Script event command.
The problem is that you pollute the name space. You also increase the likelihood of compatibility problems with other scripts using global variables.

I suggest creating a separate class to contain the information.
Just make it a Singleton and you can just as easily call it with the Call Script event command.
Creating class method will simplify the calls even further.
You can also catch potential errors this way as the Call Script does not directly effect the data.

Loads of advantages ^_^
The only disadvantage I can think of is that it is more difficult to script.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Best RPG Maker User (Scripting)2010 Most Mature Member
 :-[

I meant for the arrays as the user is not likely to have to change enemy level or boss troops.

But Zeriab is definitely better than me, so ignore me and do as he says.

********
Hungry
Rep:
Level 95
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
It's a pretty sweet little script ^_^

It is easier to change global variables than class variables with the Call Script event command.
The problem is that you pollute the name space. You also increase the likelihood of compatibility problems with other scripts using global variables.

I suggest creating a separate class to contain the information.
Just make it a Singleton and you can just as easily call it with the Call Script event command.
Creating class method will simplify the calls even further.
You can also catch potential errors this way as the Call Script does not directly effect the data.

Loads of advantages ^_^
The only disadvantage I can think of is that it is more difficult to script.

I just did it the way I did because I saw it done that way in the past ;D
I'll optimize it later, after I learn some more scripting

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: Bandcamp | Twitter | Patreon

********
Hungry
Rep:
Level 95
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
updated to 1.3b

it's now compatable with exotic CBS-es!
(think Side View or RTAB here)
« Last Edit: May 28, 2007, 12:35:15 AM by NAMKCOR »

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: Bandcamp | Twitter | Patreon

pokeball :)OfflineMale
********
Cheese
Rep:
Level 95
?
Nice work!! :D
+ rep
Watch out for: HaloOfTheSun