12-12-2009, 10:20 AM
Introduction
Displays a short random quip from the battler whenever they act in battle to Attack, Defend, use Skills, or Items, from a set databank of phrases depending on either his or her class, OR the skill or item they are using.
Features
There are two versions of the script: BASIC and FULL.
The BASIC script has these to offer:
- Extremely easy to configure
- Nearly plug-and-play
- Option of using a picture instead of a message window.
- Customize typesetting of the comment box.
Screenshots
Basic:
Full:
Full:
Demo
Script
BASIC
Code:
#==============================================================================
# ** Battle Comment (Basic) ver.1.21
#------------------------------------------------------------------------------
# By Sue
# Translated, edited, and annotated by Helel
# URL: (http://www.k2.dion.ne.jp/~diversas/index.html)
#------------------------------------------------------------------------------
# Displays a short random quip from the battler whenever they act
# in battle to Attack, Defend, use Skills, or Items, from a
# set databank of phrases depending on their class.
#==============================================================================
#==============================================================================
# ** module COMMENT_I
#==============================================================================
module COMMENT_I
# Comment Y-Coordinate
COM_Y = 240
# Comment Z-Coordinate
COM_Z = 1000
# Comment Opacity
COM_OPACITY = 180
# Hide Help Window (Yes:true, No:false)
BACK_WIN = false
#--------------------------------------------------------------------------
# * Attack Comment
#--------------------------------------------------------------------------
# Syntax: Class ID => ["Comment!", "Comment",...]
#--------------------------------------------------------------------------
COM = {
1=>["Away!", "Kura!", "Hah!"],
2=>["Tsuya!", "Boom!", "Pow!", "Beautiful!", "I'm awesome!", "Yeah!"],
3=>["Ah!", "Not again!", "Save me!", "Take this!", "Fwa!"]
}
#--------------------------------------------------------------------------
# * Attack Skill Comments
#--------------------------------------------------------------------------
# Syntax: Class ID => ["Comment!", "Comment",...]
#--------------------------------------------------------------------------
COM2 = {
1=>["Get ready for this!", "You won't see this!", "Doom!"],
2=>["Look at my awesomeness!", "It's perfect!"],
3=>["Don't hurt me!", "Please die!"]
}
#--------------------------------------------------------------------------
# * Healing Skill Comments (Negative Attack Power)
#--------------------------------------------------------------------------
# Syntax: Class ID => ["Comment!", "Comment",...]
#--------------------------------------------------------------------------
COM2_b = {
1=>["Be grateful!", "Stand still!"],
2=>["Say cheese!"],
3=>["I bless thee...", "Don't die!"]
}
#--------------------------------------------------------------------------
# * Supportive Skill Comments (0 Attack Power, eg. Sharp)
#--------------------------------------------------------------------------
# Syntax: Class ID => ["Comment!", "Comment",...]
#--------------------------------------------------------------------------
COM2_c = {
1=>["Go!"],
2=>["Here's some help!"],
3=>["Stronger yet?"]
}
#--------------------------------------------------------------------------
# * Skill ID Specification (Overrides the above)
#--------------------------------------------------------------------------
# Syntax: Skill ID => ["Comment!", "Comment",...]
#--------------------------------------------------------------------------
COM2_id = {
61=>["Fall!", "Faint!"], #Leg Sweep
25=>["Go towards the light!","It's BLINDING!"] #Light
}
#--------------------------------------------------------------------------
# * Defense Comment
#--------------------------------------------------------------------------
# Syntax: Class ID => ["Comment!", "Comment",...]
#--------------------------------------------------------------------------
COM3 = {
1=>["Guard!", "Just try and attack!"],
2=>["Not going to hurt!"],
3=>["Don't hurt me!"]
}
#--------------------------------------------------------------------------
# * Item Comment
#--------------------------------------------------------------------------
# Syntax: Class ID => ["Comment!", "Comment",...]
#--------------------------------------------------------------------------
COM4 = {
1=>["Here!", "Take that!"],
2=>["Stand still!"],
3=>["SPOON!"]
}
#--------------------------------------------------------------------------
# * Item ID Specification (Overrides the above)
#--------------------------------------------------------------------------
# Syntax: Item ID => ["Comment!", "Comment",...]
#--------------------------------------------------------------------------
COM4_id = {
1=>["Here's a potion!"], # Potion
2=>["Here's a high potion!"], # High Potion
}
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# ?This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#-----------------------------------------------------------------------
# * Main Processing
#-----------------------------------------------------------------------
alias comments_main main
def main
@comments_window = Window_Comments.new
@comments_window.visible = false
comments_main
@comments_window.dispose
end
#-----------------------------------------------------------------------
# * Make Basic Action Results
#-----------------------------------------------------------------------
alias comments_basic_action_result make_basic_action_result
def make_basic_action_result
# If active battler is an actor
if @active_battler.is_a?(Game_Actor)
# If Attack
if @active_battler.current_action.basic == 0
@comments_j = COMMENT_I::COM[@active_battler.class_id]
# If Defense
elsif @active_battler.current_action.basic == 1
@comments_j = COMMENT_I::COM3[@active_battler.class_id]
end
comments_set
end
comments_basic_action_result
end
#-----------------------------------------------------------------------
# * Make Skill Action Results
#-----------------------------------------------------------------------
alias comments_skill_action_result make_skill_action_result
def make_skill_action_result
comments_skill_action_result
# If active battler is an actor
if @active_battler.is_a?(Game_Actor)
# Apply Skill Specification
if COMMENT_I::COM2_id.include?(@skill.id)
@comments_j = COMMENT_I::COM2_id[@skill.id]
else
@skill.power > 0 ? @comments_j =
COMMENT_I::COM2[@active_battler.class_id] :
(@skill.power < 0 ? @comments_j =
COMMENT_I::COM2_b[@active_battler.class_id] :
@comments_j = COMMENT_I::COM2_c[@active_battler.class_id])
end
comments_set
@help_window.visible = false if COMMENT_I::BACK_WIN
end
end
#-----------------------------------------------------------------------
# * Make Item Action Results
#-----------------------------------------------------------------------
alias comments_item_action_result make_item_action_result
def make_item_action_result
comments_item_action_result
# Only when battler is an actor
if @active_battler.is_a?(Game_Actor)
if COMMENT_I::COM4_id.include?(@item.id)
@comments_j = COMMENT_I::COM4_id[@item.id]
else
@comments_j = COMMENT_I::COM4[@active_battler.class_id]
end
comments_set
@help_window.visible = false if COMMENT_I::BACK_WIN
end
end
#-----------------------------------------------------------------------
# * View Comments
#-----------------------------------------------------------------------
def comments_set
unless @active_battler.current_action.kind == 0 &&
@active_battler.current_action.basic == 3
@comments_window.set_text(@comments_j[rand(@comments_j.size)],
@active_battler, 1) if @comments_j != nil
end
end
#-----------------------------------------------------------------------
# * Frame Update (main phase step 5 : damage display)
#-----------------------------------------------------------------------
alias comments_phase4_step5 update_phase4_step5
def update_phase4_step5
@comments_window.visible = false
comments_phase4_step5
end
end
#==============================================================================
# ** Window_Comments
#------------------------------------------------------------------------------
# Displays comment window during battle.
#==============================================================================
class Window_Comments < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, COMMENT_I::COM_Y, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.z = COMMENT_I::COM_Z
self.opacity = COMMENT_I::COM_OPACITY
end
#--------------------------------------------------------------------------
# * Setting the Text
#--------------------------------------------------------------------------
def set_text(text, a_battler, align = 0)
# When one line of text is different from the other
if text != @text or align != @align
# Redraw text
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
@text = text
# Find Battler-X position
@number = 0
for i in $game_party.actors
@number += 1
if i == a_battler
break
end
end
@number -= 1
self.x = @number * 160
@number = nil
end
self.visible = true
end
end
FULL
Code:
#==============================================================================
# ** Battle Comment (Full) ver.1.42
#------------------------------------------------------------------------------
# By Sue
# Translated, edited, and annotated by Helel
# URL: (http://www.k2.dion.ne.jp/~diversas/index.html)
#------------------------------------------------------------------------------
# Displays a short random quip from the battler whenever they act
# in battle to Attack, Defend, use Skills, or Items, from a
# set databank of phrases depending on their class.
#==============================================================================
#==============================================================================
# ** module COMMENT_I
#==============================================================================
module COMMENT_I
#--------------------------------------------------------------------------
# * Comment Typesetting
#--------------------------------------------------------------------------
# Comment Font
NAME = "Arial"
# Comment Font Size
SIZE = 20
# Comment Text Color (Red, Green, Blue, Opacity)
COLORS = [48, 48, 48, 255]
#--------------------------------------------------------------------------
# * Comment Position
#--------------------------------------------------------------------------
# Coordinates (In order: X-coordinate, Y-coordinate, Z-coordinate)
COM_X, COM_Y, COM_Z = 80, 210, 1000
# Comment Back Opacity
COM_B_OPACITY = 0
# Comment Total Opacity (Set to 0 when Picture is used)
COM_OPACITY = 0
# Hide Help Window (Yes:true, No:false)
BACK_WIN = false
# Wait before comment display (Adjusted to faster battle speed)
WAIT = 0
#--------------------------------------------------------------------------
# * Comment Picture Display
#--------------------------------------------------------------------------
# Use picture? (Yes?true,?No?false)
COM_SPRITE = true
# Picture Name
COM_PICT = "talk_f2"
# Picture Opacity
SPRITE_OPACITY = 200
#--------------------------------------------------------------------------
# * Attack Comment
#--------------------------------------------------------------------------
# Syntax: Class ID => ["Comment!", "Comment",...]
#--------------------------------------------------------------------------
COM = {
1=>["Away!", "Kura!", "Hah!"],
2=>["Tsuya!", "Boom!", "Pow!", "Beautiful!", "I'm awesome!", "Yeah!"],
3=>["Ah!", "Not again!", "Save me!", "Take this!", "Fwa!"]
}
#--------------------------------------------------------------------------
# * Attack Skill Comments
#--------------------------------------------------------------------------
# Syntax: Class ID => ["Comment!", "Comment",...]
#--------------------------------------------------------------------------
COM2 = {
1=>["Get ready for this!", "You won't see this!", "Doom!"],
2=>["Look at my awesomeness!", "It's perfect!"],
3=>["Don't hurt me!", "Please die!"]
}
#--------------------------------------------------------------------------
# * Healing Skill Comments (Negative Attack Power)
#--------------------------------------------------------------------------
# Syntax: Class ID => ["Comment!", "Comment",...]
#--------------------------------------------------------------------------
COM2_b = {
1=>["Be grateful!", "Stand still!"],
2=>["Say cheese!"],
3=>["I bless thee...", "Don't die!"]
}
#--------------------------------------------------------------------------
# * Supportive Skill Comments (0 Attack Power, eg. Sharp)
#--------------------------------------------------------------------------
# Syntax: Class ID => ["Comment!", "Comment",...]
#--------------------------------------------------------------------------
COM2_c = {
1=>["Go!"],
2=>["Here's some help!"],
3=>["Stronger yet?"]
}
#--------------------------------------------------------------------------
# * Skill ID Specification (Overrides the above)
#--------------------------------------------------------------------------
# Syntax: Skill ID => ["Comment!", "Comment",...]
#--------------------------------------------------------------------------
COM2_id = {
61=>["Fall!", "Faint!"], #Leg Sweep
25=>["Go towards the light!","It's BLINDING!"] #Light
}
#--------------------------------------------------------------------------
# * Defense Comment
#--------------------------------------------------------------------------
# Syntax: Class ID => ["Comment!", "Comment",...]
#--------------------------------------------------------------------------
COM3 = {
1=>["Guard!", "Just try and attack!"],
2=>["Not going to hurt!"],
3=>["Don't hurt me!"]
}
#--------------------------------------------------------------------------
# * Item Comment
#--------------------------------------------------------------------------
# Syntax: Class ID => ["Comment!", "Comment",...]
#--------------------------------------------------------------------------
COM4 = {
1=>["Here!", "Take that!"],
2=>["Stand still!"],
3=>["SPOON!"]
}
#--------------------------------------------------------------------------
# * Item ID Specification (Overrides the above)
#--------------------------------------------------------------------------
# Syntax: Item ID => ["Comment!", "Comment",...]
#--------------------------------------------------------------------------
COM4_id = {
1=>["Here's a potion!"], # Potion
2=>["Here's a high potion!"], # High Potion
}
end
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
alias comments_main main
def main
@comments_window = Window_Comments.new
@comments_window.visible = false
comments_main
@comments_window.dispose_sprite if COMMENT_I::COM_SPRITE != false
@comments_window.dispose
end
#--------------------------------------------------------------------------
# * Make Basic Action Results
#--------------------------------------------------------------------------
alias comments_basic_action_result make_basic_action_result
def make_basic_action_result
# If active battler is an actor
if @active_battler.is_a?(Game_Actor)
# If Attack[0] or Defense [1], define comment set
@active_battler.current_action.basic == 0 ?
@comments_j = COMMENT_I::COM[@active_battler.class_id] :
(@active_battler.current_action.basic == 1 ?
@comments_j = COMMENT_I::COM3[@active_battler.class_id] : @comments_j == nil)
comments_set if @comments_j != nil
end
comments_basic_action_result
end
#--------------------------------------------------------------------------
# * Make Skill Results
#--------------------------------------------------------------------------
alias comments_skill_action_result make_skill_action_result
def make_skill_action_result
# Set skill
@skill = $data_skills[@active_battler.current_action.skill_id]
# If active battler is an actor and can use skill
if @active_battler.is_a?(Game_Actor) && @active_battler.skill_can_use?(@skill.id)
# Apply Skill Specification
if COMMENT_I::COM2_id.include?(@skill.id)
@comments_j = COMMENT_I::COM2_id[@skill.id]
else
@skill.power > 0 ? @comments_j = COMMENT_I::COM2[@active_battler.class_id] :
(@skill.power < 0 ? @comments_j = COMMENT_I::COM2_b[@active_battler.class_id] :
@comments_j = COMMENT_I::COM2_c[@active_battler.class_id])
end
comments_set
@help_window.visible = false if COMMENT_I::BACK_WIN
end
comments_skill_action_result
end
#--------------------------------------------------------------------------
# * Make Item Results
#--------------------------------------------------------------------------
alias comments_item_action_result make_item_action_result
def make_item_action_result
comments_item_action_result
# If active battler is an actor
if @active_battler.is_a?(Game_Actor)
if COMMENT_I::COM4_id.include?(@item.id)
@comments_j = COMMENT_I::COM4_id[@item.id]
else
@comments_j = COMMENT_I::COM4[@active_battler.class_id]
end
comments_set
@help_window.visible = false if COMMENT_I::BACK_WIN
end
end
#--------------------------------------------------------------------------
# * View Comments
#--------------------------------------------------------------------------
def comments_set
unless @active_battler.current_action.kind == 0 &&
@active_battler.current_action.basic == 3
@comments_window.set_text(@comments_j[rand(@comments_j.size)],
@active_battler, 1) if @comments_j != nil
@wait_count = COMMENT_I::WAIT
end
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 5 : damage display)
#--------------------------------------------------------------------------
alias comments_phase4_step5 update_phase4_step5
def update_phase4_step5
@comments_window.false_sprite
comments_phase4_step5
end
end
#==============================================================================
# ** Window_Comments
#==============================================================================
class Window_Comments < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = COMMENT_I::NAME
self.contents.font.size = COMMENT_I::SIZE
self.z, self.opacity = COMMENT_I::COM_Z, COMMENT_I::COM_OPACITY
self.back_opacity = COMMENT_I::COM_B_OPACITY
if COMMENT_I::COM_SPRITE == true
bitmap = RPG::Cache.picture(COMMENT_I::COM_PICT)
@co_srt = Sprite.new
@co_srt.z, @co_srt.bitmap = COMMENT_I::COM_Z - 1, bitmap
@co_srt.opacity, @co_srt.visible = COMMENT_I::SPRITE_OPACITY, false
end
end
#--------------------------------------------------------------------------
# * If using picture (COM_SPRITE = true)
#--------------------------------------------------------------------------
def false_sprite
@co_srt.visible = false if @co_srt != nil
self.visible = false
end
#--------------------------------------------------------------------------
# * Picture dispose
#--------------------------------------------------------------------------
def dispose_sprite
@co_srt.dispose
end
#--------------------------------------------------------------------------
# * Setting the Text
#--------------------------------------------------------------------------
def set_text(text, a_battler, align = 0)
# When one line of text is different from the other
if text != @text or align != @align
# Redraw text
self.contents.clear
self.contents.font.color = comments_color
self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
@text = text
# Find Battler-X position and take into account the picture setting
if COMMENT_I::COM_SPRITE == true
@co_srt.x = self.x = a_battler.screen_x - COMMENT_I::COM_X
@co_srt.y = self.y = a_battler.screen_y - COMMENT_I::COM_Y
else
self.x = a_battler.screen_x - COMMENT_I::COM_X
self.y = a_battler.screen_y - COMMENT_I::COM_Y
end
end
@co_srt.visible = true if @co_srt != nil
self.visible = true
end
end
#==============================================================================
# ** Window_Base (Get color of comments)
#==============================================================================
class Window_Base < Window
def comments_color
return Color.new(COMMENT_I::COLORS[0],COMMENT_I::COLORS[1],
COMMENT_I::COLORS[2], COMMENT_I::COLORS[3])
end
end
Instructions
- Place below Scene_Debug and Main.
- Configuration help included within the script.
Image files (for FULL version)
You may use any one of them as long as you set the name in the script.
Compatibility
- Compatible with SDK 2.4.
- Might not work with exotic battle systems.
- Works with Minkoff's Animated Battlers and creates quite a cool effect. :) Just make sure to configure the positioning of the comment windows.
Author's Notes
If anyone is interested in a version that uses actor IDs instead of their classes, I'd be more than happy to edit it.
Terms and Conditions
Sue Wrote:The RGSS material is created by the webpage's* author. There is only one rule to follow in its usage: as long as the material is being utilized with good intentions, you may use it freely.
* = (http://www.k2.dion.ne.jp/~diversas/index.html)