11-19-2009, 06:13 AM
Damage Text Revamp
Version: 2.1
Version: 2.1
Introduction
Tired of looking at that rather dull Arial Black font in battle? Are you looking to fancy the look and animation of your damage text? Look no further, this is the Damage Text Revamp! It's customisable and it's heavily packed with options. Have a look for yourself!
Features
- Set X, Y, Blend Type, Angle, Zoom_X, Zoom_Y, Color, Tone of Damage Text.
- Set format, color, and outlines for Damage/Heal/Miss/Critical Val+Text
- Set keyframe animations for damage text.
- Set specific keyframe animations for Damage/Heal/Miss/Critical text.
- Enable or disable damage counting (known as Iteration).
- Create keyframe animations for damage counting.
- Create specific damage counting keyframe animations for Damage / Heal / Miss / Critical
Changelog
- v1 (11/18/2009) - Initial release.
- v2 (4/6/2012) - Remade, added a plethora of new settings.
- v2.0.1 (4/6/2012) - New dmg_v variable to help ease script calling needs.
- v2.1 (4/8/2012) - New switch setting added.
Screenshots
Video coming soon. This screenshot does not do this script justice.
Demo
No demo.
Script
Content Hidden
Code:
=begin
Damage Text Revamp 2.1
by PK8
Created: 11/18/2009
Modified: 4/8/2012
──────────────────────────────────────────────────────────────────────────────
■ Table of Contents
○ Author's Notes - Line 27-37
○ Introduction & Description - Line 39-43
○ Features - Line 45-52
○ Methods Aliased - Line 54-57
○ Thanks - Line 59-70
○ Changelog - Line 72-76
○ What is this? - Line 78-288
○ General & Initial Settings - Line 80-106
○ Settings for Critical/Damage/Heal/Miss - Line 107-119
○ Iteration Settings - Line 120-127
○ All Keyframe Settings - Line 128-187
○ Settings for Damage and Iteration - Line 130-140
○ All Keyframe_Iteration Settings - Line 141-164
○ All Normal Keyframe Settings - Line 165-187
○ Getting into Keyframes - Line 188-288
○ Keyframe_Advanced: Simple vs. Advanced - Line 190-215
○ Modifying properties through keyframes - Line 216-288
──────────────────────────────────────────────────────────────────────────────
■ Author's Notes
When I first made this script, I remember making it because I was bored and I
was watching people play Eternal Sonata. I couldn't help but love how fancy
the damage text looked, so I wanted to make something kind of like it here.
Now when I was working on this version, I went in there thinking
"okay, I'll just edit a few settings and call it a day." It sounds mean, I
know, but that was because I didn't think I'd be able to improve the script
much further. That was, until I saw Victor Sant's collapse script thread for
RPG Maker VX Ace. Seeing that thread gave me some new ideas for what I wanted
to do for this script.
──────────────────────────────────────────────────────────────────────────────
■ Introduction & Description
Tired of looking at that rather dull Arial Black font in battle? Are you
looking to fancy the look and animation of your damage text? Look no further,
this is the Damage Text Revamp! It's customisable and it's heavily packed
with options. Have a look for youself!
──────────────────────────────────────────────────────────────────────────────
■ Features
o Set X, Y, Blend Type, Angle, Zoom_X, Zoom_Y, Color, Tone of Damage Text.
o Set format, color, and outlines for Damage/Heal/Miss/Critical Val+Text
o Set keyframe animations for damage text.
o Set specific keyframe animations for Damage/Heal/Miss/Critical text.
o Enable or disable damage counting (known as Iteration).
o Create keyframe animations for damage counting.
o Create specific damage counting keyfreame animations for Dmg/Heal/Miss/Crit
──────────────────────────────────────────────────────────────────────────────
■ Methods Aliased
o damage of Sprite < ::Sprite class in the RPG module.
Note that it kind of... rewrites the whole damage method.
o update of Sprite < ::Sprite class in the RPG module.
──────────────────────────────────────────────────────────────────────────────
■ Thanks
Yeyinde's help with fixing stacking error issues.
Rhyme helped me out a few years ago on drawing outlines better.
Kain Nobel asking for the Miss text to have a custom string to it, and
suggesting a scrolling text option. My Iteration feature probably looks
nothing like what he requested but it should be just as epic.
MetalRenard pretty much telling me to "make this as epic as possible" made
want to go all out on this script. Again for asking about it being
possible to make the sprite flash every time the value reaches +100 more,
which made me add the dmg_v variable.
Victor Sant's Collapse script for RPG Maker VX Ace inspired me to attempt
a custom animation feature for Damage Text.
──────────────────────────────────────────────────────────────────────────────
■ Changelog (MM/DD/YYYY)
v1 (11/18/2009) - Initial release.
v2 (4/6/2012) - Remade, added a plethora of new settings.
v2.0.1 (4/6/2012) - New dmg_v variable to help ease script calling needs.
v2.1 (4/8/2012) - New switch setting added.
──────────────────────────────────────────────────────────────────────────────
■ What is this?
┌──────────────────────────────────────────────────────────────────────────┐
│ ■ General and initial settings. │
└──────────────────────────────────────────────────────────────────────────┘
o Switch: TRUE turns it on, FALSE turns it off. Can be turned on or off at
any time by calling: PK8::DamageText::Switch = bool*
* Replace bool with either true or false
o X: Adjust X offset of the damage text sprite.
o Y: Adjust Y offset of the damage text sprite.
o Angle: Set angle of damage text sprite.
o Blend: Set blend type of damage text sprite. (0: Normal, 1: Add, 2: Sub)
o Color: Set color for damage text sprite. [red, green, blue, alpha]
red : Set amount of red. (Values: 0 - 255)
green: Set amount of green. (Values: 0 - 255)
blue : Set amount of blue. (Values: 0 - 255)
alpha: Set amount of alpha. (Values: 0 - 255, optional)
o Mirror: Flip sprite horizontally? (true or false)
o Tone: Set tone for damage text sprite. [red, green, blue, grey]
red : Set amount of red. (Values: -255 - 255)
green: Set amount of green. (Values: -255 - 255)
blue : Set amount of blue. (Values: -255 - 255)
grey : Set amount of grey. (Values: 0 - 255, optional)
o Zoom_X: Adjust the damage text sprite's X-Axis zoom level.
* 1.0 denotes actual pixel size.
o Zoom_Y: Adjust the damage text sprite's Y-Axis zoom level.
* 1.0 denotes actual pixel size.
o Debug: You can set which keyframe animations you'd like to preview by
changing the string of this setting. Only works during DEBUG.
┌──────────────────────────────────────────────────────────────────────────┐
│ ■ Setting format and colors for Damage, Heal, Miss, and Critical. │
└──────────────────────────────────────────────────────────────────────────┘
o *_String: Set text. (For CriticalText and Miss)
o *_Font: Set font(s).
o *_Size: Set font size. (CriticalText: 20, Others: 48)
o *_Bold: Boldface text? (true or false)
o *_Italic: Italicize text? (true or false)
o *_Color: Set the color of the text. (r, g, b[, a]) (0 - 255)
o *_Outline: Set the outline of the text. (r, g, b[, a]) (0 - 255)
*: Heal, Miss, Damage, CriticalText, CriticalVal
┌──────────────────────────────────────────────────────────────────────────┐
│ ■ Iteration settings. │
└──────────────────────────────────────────────────────────────────────────┘
o Iteration: How many times should the damage sprite be rendered with a
reduced value before it reaches the damage's real value?
* Do not use a large integer. To disable, set this to 1.
o Iteration_Countdown: If TRUE, counts down. If FALSE, counts up from 0.
┌──────────────────────────────────────────────────────────────────────────┐
│ ■ All Keyframe settings │
└┬────────────────────────────────────────────────────────┬────────────────┘
│ Keyframe settings that applies to Damage and Iteration │
└────────────────────────────────────────────────────────┘
o Keyframe_Advanced: Allow for more advanced keyframe customization?
* false: Simple version. | true: Advanced version.
* "" : Don't override
"critical": Override with Critical
"damage" : Override with Damage
"miss" : Override with Miss
"heal" : Override with Heal
└┬─────────────────────────────────┬───────────────────────────────────────┘
│ All Keyframe_Iteration settings │
└─────────────────────────────────┘
o Keyframe_Iteration_Flag: Enable custom damage text animations for damage
counting? (true or false)
o Keyframe_Iteration[id]: Set keyframe animations when counting for all
damage text. Acts as a fallback should any of
the Keyframe_Iteration_*_Flag settings get set
to FALSE.
o Keyframe_Iteration_Heal[id]: Set keyframe animations when counting for
healing text.
o Keyframe_Iteration_Damage[id]: Set keyframe animations when counting for
damage text.
o Keyframe_Iteration_Critical[id]: Set keyframe animations when counting
for critical damage text.
* Only customize these when Keyframe_Iteration_*_Flag is set to TRUE.
o Keyframe_Iteration_Heal_Flag: Enable counting animations for healing?
o Keyframe_Iteration_Damage_Flag: Enable counting animations for normal dmg
o Keyframe_Iteration_Critical_Flag: Enable counting animations for crit dmg
* It animates from the duration of the animation to 0
└┬──────────────────────────────┬──────────────────────────────────────────┘
│ All Normal Keyframe settings │
└──────────────────────────────┘
o Keyframe_Flag: Enable custom damage text animations? (true or false)
o Keyframe_Duration: How many frames would the animation last for?
more information about Keyframes_Advanced starting at 164.
o Keyframe[id]: Set keyframe animations for all damage text. Acts as a
fallback should any of the Keyframe_*_Flag settings get
set to FALSE
o Keyframe_Heal[id] = Set keyframe animations for Heal text.
o Keyframe_Miss[id] = Set keyframe animations for Miss text.
o Keyframe_Damage[id] = Set keyframe animations for Damage text.
o Keyframe_Critical[id] = Set keyframe animations for Critical Damage text.
* Only customize these when Keyframe_*_Flag is set to TRUE.
o Keyframe_Heal_Flag: Enable damage text animations for healing?
o Keyframe_Miss_Flag: Enable damage text animations for missing?
o Keyframe_Damage_Flag: Enable damage text animations for normal attacks?
o Keyframe_Critical_Flag: Enable damage text animations for critical hits?
* It animates from the duration of the animation to 0
┌──────────────────────────────────────────────────────────────────────────┐
│ ■ Getting into keyframes │
└┬───────────────────────────────────────┬─────────────────────────────────┘
│ Keyframe_Advanced: Simple vs Advanced │
└───────────────────────────────────────┘
o true: allows for some serious scripting freedom for the damage text
[ advanced] animation. You get to script in script calls, big conditionals,
and other things without having to start off with a call to alter
the damage text sprite.
Example: Keyframe[40] = ["dmg.opacity = 0", "dmg.y -= 2"]
Keyframe[39] = ["dmg.opacity += 25", "dmg.y -= 2"]
Keyframe[34] = ["dmg.opacity += 25", "dmg.y -= 1"]
Keyframe[29] = ["dmg.y -= 0"]
Keyframe[11] = ["dmg.opacity -= 25", "dmg.y -= 1"]
Keyframe[6] = ["dmg.opacity -= 25", "dmg.y -= 2"]
o false: Offers the same customisation as advanced mode but with the
[ simple] requirement that creators start off with modifying the property
of a sprite.
Example: Keyframe[40] = ["opacity = 0", "y -= 2"]
Keyframe[39] = ["opacity += 25", "y -= 2"]
Keyframe[34] = ["opacity += 25", "y -= 1"]
Keyframe[29] = ["y -= 0"]
Keyframe[11] = ["opacity -= 25", "y -= 1"]
Keyframe[6] = ["opacity -= 25", "y -= 2"]
└┬────────────────────────────────────────┬────────────────────────────────┘
│ Modifying properties through keyframes │
└────────────────────────────────────────┘
You can use certain variables I created to aid creating your script calls.
Variable Variable Description
────────────────┬──────────────────────────────────────────────────────────
dmg: │ It stores the damage text sprite and with it, all of its
│ properties that can be altered.
dmg_i: │ This stores the frame the animation is currently up to.
[n..1] │ Useful for tweening formulas involving iteration count.
dmg_d: │ This stores the duration of the animation. Useful for
[n] │ tweening formulas involving iteration count.
dmg_v: │ Gets damage value.
dmg_iv: │ Gets iterated damage value.
i: │ This stores the frame the animation is currently up to in
[1..n] │ ascending order. Useful for tweening formulas involving
│ iteration count.
────────────────┴──────────────────────────────────────────────────────────
──────────────────────────────────
For future reference, you can always look up the Help File for RPG Maker on
Sprite and read up on all of their properties. (That's where this is taken
from.)
Property/Method Property/Method Description
────────────────┬──────────────────────────────────────────────────────────
o angle: │ Angle of rotation. Specifies up to 360 degrees of
│ counterclockwise rotation. However, drawing a rotated
│ sprite is time-consuming, so avoid overuse.
o animation: │ Give the damage text sprite an animation.
│ * Syntax : animation(animation, hit)
│ * Example: animation($data_animations[20], true)
o blend_type: │ Blending mode.
│ * 0: normal, 1: addition, 2: subtraction
o color: │ The color to be blended with the sprite. Alpha values are
│ used in the blending ratio.
│ * Example: color = Color.new(red, green, blue[, alpha])
o color.red: │ Accesses the amount of red coloring.
o color.green: │ Accesses the amount of green coloring.
o color.blue: │ Accesses the amount of blue coloring.
o color.alpha: │ Accesses the amount of alpha in the color.
o flash: │ Begins flashing the sprite. Duration specifies the number
│ of frames the flash will last. If color is set to nil,
│ the sprite will disappear while flashing.
│ * Syntax: flash(Color.new(r, g, b[, a]), duration)
│ * Example: flash(Color.new(255, 255, 255), 10)
o loop_animation│ Plays the animation specified in animation in a loop on
│ the indicated sprite. Can be displayed at the same time
│ as a normal animation.
│ * Syntax : loop_animation(animation)
│ * Example: loop_animation($data_animations[20])
o mirror: │ Flag denoting the sprite has been flipped horizontally.
│ If TRUE, the sprite will be drawn flipped.
o opacity: │ Opacity. 0 - 255. Out of range values are auto-corrected
o tone: │ Color tone.
│ * Example: tone = Tone.new(red, green, blue[, gray])
o tone.red: │ Accesses the amount of red in the tone.
o tone.green: │ Accesses the amount of green in the tone.
o tone.blue: │ Accesses the amount of blue in the tone.
o tone.gray: │ Accesses the amount of gray in the tone.
o visible: │ Visibility. If TRUE, the sprite is visible.
o x: │ X coordinate.
o y: │ Y coordinate.
o zoom_x: │ X-axis zoom level. 1.0 denotes actual pixel size.
o zoom_y: │ Y-axis zoom level. 1.0 denotes actual pixel size.
────────────────┴──────────────────────────────────────────────────────────
──────────────────────────────────
Operator Expressions that could be useful for tweening
┌─────────┬──────────┬──────────┬────────┬──────────┬──────────┬───────────┐
│ = │ += │ -= │ *= │ /= │ %= │ **= │
└─────────┴──────────┴──────────┴────────┴──────────┴──────────┴───────────┘
=end
#===============================================================================
# * Configuration
#===============================================================================
module PK8
class DamageText
#---------------------------------------------------------------------------
# * Do not modify.
#---------------------------------------------------------------------------
Keyframes = []
Keyframes_Heal = []
Keyframes_Damage = []
Keyframes_Critical = []
Keyframes_Miss = []
Keyframes_Iteration = []
Keyframes_Iteration_Heal = []
Keyframes_Iteration_Damage = []
Keyframes_Iteration_Critical = []
#---------------------------------------------------------------------------
# * General and initial settings.
#---------------------------------------------------------------------------
Switch = true # Turn the system on or off.
X = 80 # Sprite X-offset
Y = 20 # Sprite Y-offset
Angle = 0 # Sprite Angle
Blend = 0 # Sprite Blend Type (0: Normal, 1: Add, 2: Sub)
Color = [0,0,0,0] # Color: Red, Green, Blue[, Alpha]
Mirror = false # Flip sprite horizontally?
Tone = [0,0,0,0] # Tone: Red, Green, Blue[, Gray]
Zoom_X = 1.0 # X-Axis Zoom Level (1.0 = Actual size)
Zoom_Y = 1.0 # Y-Axis Zoom Level (1.0 = Actual size)
Debug = "" # "", "critical", "damage", "heal", or "miss"
#---------------------------------------------------------------------------
# * Set format and colors for Damage, Heal, Miss, and Critical
#---------------------------------------------------------------------------
# Settings for the Damage value text
Damage_Font = ["Constantia", "Palatino Linotype", "Arial Black"]
Damage_Size = 32
Damage_Bold = true
Damage_Italic = true
Damage_Color = [239, 207, 59, 255]
Damage_Outline = [143, 121, 17, 255]
# Settings for the Heal value text
Heal_Font = ["Constantia", "Palatino Linotype", "Arial Black"]
Heal_Size = 32
Heal_Bold = true
Heal_Italic = true
Heal_Color = [83, 239, 74, 255]
Heal_Outline = [29, 127, 23, 255]
# Settings for the Miss text
Miss_Font = ["Constantia", "Palatino Linotype", "Arial Black"]
Miss_String = "Evaded!"
Miss_Size = 32
Miss_Bold = false
Miss_Italic = true
Miss_Color = [224, 224, 224, 255]
Miss_Outline = [32, 32, 32, 255]
# Settings for the "Critical" text.
CriticalText_Font = ["Constantia", "Palatino Linotype", "Arial Black"]
CriticalText_String = "Critical Hit!"
CriticalText_Size = 20
CriticalText_Bold = true
CriticalText_Italic = false
CriticalText_Color = [255, 255, 255, 255]
CriticalText_Outline = [32, 32, 32, 255]
# Settings for the critical damage value text
CriticalVal_Font = ["Constantia", "Palatino Linotype", "Arial Black"]
CriticalVal_Size = 32
CriticalVal_Bold = true
CriticalVal_Italic = true
CriticalVal_Color = [239, 29, 29, 255]
CriticalVal_Outline = [143, 8, 8, 255]
#---------------------------------------------------------------------------
# * Iteration settings
#---------------------------------------------------------------------------
Iteration = 8
Iteration_Countdown = false # (true: counts down | false: counts up)
#---------------------------------------------------------------------------
# * Keyframe settings that applies to everything
#---------------------------------------------------------------------------
Keyframes_Advanced = false # false: simple | true: advanced
#---------------------------------------------------------------------------
# * Keyframe Iteration settings
#---------------------------------------------------------------------------
# Iteration Keyframes for everything. Used as a fallback whenever iteration
# keyframe flags for specific damage types are set to FALSE.
Keyframes_Iteration_Flag = true # If TRUE, set everything below up.
Keyframes_Iteration[8] = ["opacity = 0", "opacity += 50"]
Keyframes_Iteration[7] = ["opacity += 50", "y -= 0.1"]
# Miss Iteration Keyframes
Keyframes_Iteration_Heal_Flag = true
Keyframes_Iteration_Heal[8] = ["opacity = 0", "opacity += 50"]
Keyframes_Iteration_Heal[7] = ["opacity += 50", "y -= 0.5"]
# Damage Iteration Keyframes
Keyframes_Iteration_Damage_Flag = true
Keyframes_Iteration_Damage[8] = ["opacity = 0", "opacity += 50"]
Keyframes_Iteration_Damage[7] = ["opacity += 50", "y -= 0.1"]
# Critical Iteration Keyframes
Keyframes_Iteration_Critical_Flag = true
Keyframes_Iteration_Critical[8] = ["opacity = 0", "opacity += 32"]
Keyframes_Iteration_Critical[7] = ["opacity += 32", "y -= 0.01",
"zoom_x += 0.01", "zoom_y += 0.01"]
#---------------------------------------------------------------------------
# * General Keyframe Settings
#---------------------------------------------------------------------------
Keyframes_Flag = true # If TRUE, set everything below up.
Keyframes_Duration = 40
#---------------------------------------------------------------------------
# * Set Keyframe animations for Heal, Miss, Damage, Critical!
#---------------------------------------------------------------------------
# Keyframes for everything. Used as a fallback whenever keyframe flags for
# specific damage types are set to FALSE.
Keyframes[40] = ["y -= 2", "opacity = 0"]
Keyframes[39] = ["y -= 2", "opacity += 50"]
Keyframes[35] = ["opacity += 50"]
Keyframes[10] = ["opacity -= 25"]
# Heal Keyframes
Keyframes_Heal_Flag = true # if TRUE, this animation gets used.
Keyframes_Heal[40] = ["y -= 1", "flash(Color.new(255,255,200),10)"]
Keyframes_Heal[39] = ["y -= 1"]
Keyframes_Heal[25] = ["y -= 0.5"]
Keyframes_Heal[10] = ["y -= 0.5", "opacity -= 25"]
# Miss Keyframes
Keyframes_Miss_Flag = true # if TRUE, this animation gets used.
Keyframes_Miss[40] = ["y -= 2", "opacity = 0",
"x = x; Audio.se_play('Audio/SE/016-Jump02')"]
Keyframes_Miss[39] = ["y -= 2", "opacity += 75"]
Keyframes_Miss[36] = ["y -= 1"]
Keyframes_Miss[32] = ["y -= 0.5"]
Keyframes_Miss[28] = ["y -= 0.25"]
Keyframes_Miss[24] = ["y -= 0.125"]
Keyframes_Miss[20] = ["y -= 0.0625"]
Keyframes_Miss[10] = ["opacity -= 25", "y -= 0.0625"]
# Damage Keyframes
Keyframes_Damage_Flag = true # if TRUE, this animation gets used.
Keyframes_Damage[40] = ["y -= 2", "flash(Color.new(255,255,255),10)"]
Keyframes_Damage[39] = ["y -= 2"]
Keyframes_Damage[35] = ["opacity += 50"]
Keyframes_Damage[10] = ["opacity -= 25"]
# Critical Keyframes
Keyframes_Critical_Flag = true # if TRUE, this animation gets used.
Keyframes_Critical[40] = ["y -= 4", "flash(Color.new(255,255,255),40)",
"x = x; Audio.se_play('Audio/SE/158-Skill02')"]
Keyframes_Critical[39] = ["y -= 4", "opacity += 75",
"opacity = 255 if dmg.opacity > 255"]
Keyframes_Critical[35] = ["y -= 1"]
Keyframes_Critical[10] = ["y -= 1", "opacity -= 25"]
#---------------------------------------------------------------------------
# * Do not modify.
#---------------------------------------------------------------------------
for i in 0..Keyframes_Duration
Keyframes[i] = [] if Keyframes[i] == nil
Keyframes_Heal[i] = [] if Keyframes_Heal[i] == nil
Keyframes_Miss[i] = [] if Keyframes_Miss[i] == nil
Keyframes_Damage[i] = [] if Keyframes_Damage[i] == nil
Keyframes_Critical[i] = [] if Keyframes_Critical[i] == nil
end
Iteration = 1 if Iteration <= 0
for i in 0..Iteration
Keyframes_Iteration[i] = [] if Keyframes_Iteration[i] == nil
Keyframes_Iteration_Heal[i] = [] if Keyframes_Iteration_Heal[i] == nil
Keyframes_Iteration_Damage[i] = [] if Keyframes_Iteration_Damage[i] == nil
Keyframes_Iteration_Critical[i]=[] if Keyframes_Iteration_Critical[i]==nil
end
end
end
#===============================================================================
# * RPG Module, Sprite Class.
#===============================================================================
module RPG
class Sprite < ::Sprite
#---------------------------------------------------------------------------
# * Alias Listings
#---------------------------------------------------------------------------
unless method_defined?(:pk8_newdamage_damage)
alias_method(:pk8_newdamage_damage, :damage)
end
unless method_defined?(:pk8_newdamage_update)
alias_method(:pk8_newdamage_update, :update)
end
#---------------------------------------------------------------------------
# * Damage
#---------------------------------------------------------------------------
def damage(value, critical)
pk8_newdamage_damage(value, critical)
if PK8::DamageText::Switch == true
dispose_damage
# Always plays a certain animation. Debug only
if $DEBUG and (!PK8::DamageText::Debug.empty? or
PK8::DamageText::Debug != false)
case PK8::DamageText::Debug.downcase
when "critical", "crit"
critical = true
value = value * 1 if value.is_a?(Numeric)
value = 0 if !value.is_a?(Numeric)
when "damage", "dmg"
critical = false
value = value * 1 if value.is_a?(Numeric)
value = 0 if !value.is_a?(Numeric)
when "miss", "missing", "ms"
critical = false
value = "Miss!"
when "heal", "healing"
critical = false
value = value * -1 if value.is_a?(Numeric)
value = -1 if !value.is_a?(Numeric)
end
end
# Sprite Creation
@_damage_sprite = RPG::Sprite.new(self.viewport)
@_damage_sprite.angle = PK8::DamageText::Angle
@_damage_sprite.blend_type = PK8::DamageText::Blend
@_damage_sprite.color = Color.new(*PK8::DamageText::Color)
@_damage_sprite.mirror = PK8::DamageText::Mirror
@_damage_sprite.tone = Tone.new(*PK8::DamageText::Tone)
@_damage_sprite.zoom_x = PK8::DamageText::Zoom_X
@_damage_sprite.zoom_y = PK8::DamageText::Zoom_Y
@_damage_sprite.ox = PK8::DamageText::X
@_damage_sprite.oy = PK8::DamageText::Y
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.z = 3000
@_damage_value = value
dmg = @_damage_sprite
# Bitmap Creation
bitmap = Bitmap.new(160, 48)
if value.is_a?(Numeric) # If it's not a miss
# Starts Iteration Animation (if flag is TRUE)
if PK8::DamageText::Keyframes_Iteration_Flag == true
if value < 0 # If healing
if PK8::DamageText::Keyframes_Iteration_Heal_Flag == true
keyframes = PK8::DamageText::Keyframes_Iteration_Heal
else
keyframes = PK8::DamageText::Keyframes_Iteration
end
else
if critical == true # If critical
if PK8::DamageText::Keyframes_Iteration_Critical_Flag == true
keyframes = PK8::DamageText::Keyframes_Iteration_Critical
else
keyframes = PK8::DamageText::Keyframes_Iteration
end
else # If normal
if PK8::DamageText::Keyframes_Iteration_Damage_Flag == true
keyframes = PK8::DamageText::Keyframes_Iteration_Damage
else
keyframes = PK8::DamageText::Keyframes_Iteration
end
end
end
dmg_d = PK8::DamageText::Iteration
end
# Damage Counting
for i in 1..PK8::DamageText::Iteration
# New Iterated Value
if PK8::DamageText::Iteration_Countdown == true
damage_string = ((value.abs*2) - (value.abs / ((
PK8::DamageText::Iteration+1)-i))).to_s
else
damage_string = (value.abs / ((
PK8::DamageText::Iteration+1)-i)).to_s
end
# Stores variables for script calling in keyframes.
dmg_v = value.to_i
dmg_iv = damage_string.to_i
# Plays damage counting animations
if PK8::DamageText::Keyframes_Iteration_Flag == true
# Animating sprite during iteration count
dmg_i = (dmg_d + 1 - i)
if keyframes[dmg_i].size > 0 # Detects keyframe
@_damage_property = []
for n in 0..keyframes[dmg_i].size-1
if PK8::DamageText::Keyframes_Advanced == true
@_damage_property[n] = eval("#{keyframes[dmg_i][n]}")
else
@_damage_property[n] = eval("dmg.#{keyframes[dmg_i][n]}")
end
end
@_damage_keyframe = dmg_i
else # Uses previous keyframe. Possibly for tweening purposes.
@_damage_property = []
if @_damage_keyframe != nil
for n in 0..keyframes[@_damage_keyframe].size-1
if PK8::DamageText::Keyframes_Advanced == true
@_damage_property[n] = eval("#{keyframes[
@_damage_keyframe][n]}")
else
@_damage_property[n] = eval("dmg.#{keyframes[
@_damage_keyframe][n]}")
end
end
end
end
dmg.update
for n in 0..@_damage_property.size-1
@_damage_property[n]
end
end
if value < 0 # If healing
@_damage_type = "heal"
bitmap.font.name = PK8::DamageText::Heal_Font
bitmap.font.size = PK8::DamageText::Heal_Size
bitmap.font.bold = PK8::DamageText::Heal_Bold
bitmap.font.italic = PK8::DamageText::Heal_Italic
bitmap.font.color.set(*PK8::DamageText::Heal_Outline)
bitmap.draw_text(-1, 12, 160, 36, damage_string, 1)
bitmap.draw_text(1, 12, 160, 36, damage_string, 1)
bitmap.draw_text(0, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(0, 12+1, 160, 36, damage_string, 1)
bitmap.font.color.set(*PK8::DamageText::Heal_Color)
else
if critical == true # If critical
@_damage_type = "critical"
# Drawing Critical Text
bitmap.font.name = PK8::DamageText::CriticalText_Font
bitmap.font.size = PK8::DamageText::CriticalText_Size
bitmap.font.bold = PK8::DamageText::CriticalText_Bold
bitmap.font.italic = PK8::DamageText::CriticalText_Italic
# -- Draw Critical String Outline
bitmap.font.color.set(*PK8::DamageText::CriticalText_Outline)
bitmap.draw_text(-1, 0, 160, 20,
PK8::DamageText::CriticalText_String,1)
bitmap.draw_text(1, 0, 160, 20,
PK8::DamageText::CriticalText_String,1)
bitmap.draw_text(0, -1, 160, 20,
PK8::DamageText::CriticalText_String,1)
bitmap.draw_text(0, 1, 160, 20,
PK8::DamageText::CriticalText_String,1)
# -- Draw Critical String Text
bitmap.font.color.set(*PK8::DamageText::CriticalText_Color)
bitmap.draw_text(0, 0, 160, 20,
PK8::DamageText::CriticalText_String, 1)
# Drawing Critical Value
bitmap.font.name = PK8::DamageText::CriticalVal_Font
bitmap.font.size = PK8::DamageText::CriticalVal_Size
bitmap.font.bold = PK8::DamageText::CriticalVal_Bold
bitmap.font.italic = PK8::DamageText::CriticalVal_Italic
# -- Draw Critical Value Outline
bitmap.font.color.set(*PK8::DamageText::CriticalVal_Outline)
bitmap.draw_text(-1, 12, 160, 36, damage_string, 1)
bitmap.draw_text(1, 12, 160, 36, damage_string, 1)
bitmap.draw_text(0, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(0, 12+1, 160, 36, damage_string, 1)
# -- Set color for Critical Value
bitmap.font.color.set(*PK8::DamageText::CriticalVal_Color)
else # If not critical
@_damage_type = "damage"
bitmap.font.name = PK8::DamageText::Damage_Font
bitmap.font.size = PK8::DamageText::Damage_Size
bitmap.font.bold = PK8::DamageText::Damage_Bold
bitmap.font.italic = PK8::DamageText::Damage_Italic
# Draw Damage Value Outline
bitmap.font.color.set(*PK8::DamageText::Damage_Outline)
bitmap.draw_text(-1, 12, 160, 36, damage_string, 1)
bitmap.draw_text(1, 12, 160, 36, damage_string, 1)
bitmap.draw_text(0, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(0, 12+1, 160, 36, damage_string, 1)
# Set color for Damage Value
bitmap.font.color.set(*PK8::DamageText::Damage_Color)
end
end
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
@_damage_sprite.bitmap = bitmap
damage_count = Graphics.frame_count
if i < PK8::DamageText::Iteration
loop do
Graphics.update
if Graphics.frame_count >= damage_count
bitmap.clear
break
end
end
end
end
else # If it's a miss.
@_damage_type = "miss"
damage_string = value.to_s
bitmap.font.name = PK8::DamageText::Miss_Font
bitmap.font.size = PK8::DamageText::Miss_Size
bitmap.font.bold = PK8::DamageText::Miss_Bold
bitmap.font.italic = PK8::DamageText::Miss_Italic
# Draw Miss Outline
bitmap.font.color.set(*PK8::DamageText::Miss_Outline)
bitmap.draw_text(-1, 12, 160, 36, PK8::DamageText::Miss_String, 1)
bitmap.draw_text(1, 12, 160, 36, PK8::DamageText::Miss_String, 1)
bitmap.draw_text(0, 12-1, 160, 36, PK8::DamageText::Miss_String, 1)
bitmap.draw_text(0, 12+1, 160, 36, PK8::DamageText::Miss_String, 1)
# Draw Miss Text
bitmap.font.color.set(*PK8::DamageText::Miss_Color)
bitmap.draw_text(0, 12, 160, 36, PK8::DamageText::Miss_String, 1)
@_damage_sprite.bitmap = bitmap
end
if PK8::DamageText::Keyframes_Flag == true
@_damage_duration = 0
@_damage_duration2 = PK8::DamageText::Keyframes_Duration
else
@_damage_duration = PK8::DamageText::Keyframes_Duration
end
end
end
#---------------------------------------------------------------------------
# * Update
#---------------------------------------------------------------------------
def update
pk8_newdamage_update
if PK8::DamageText::Switch == true
@_damage_duration2 = 0 if @_damage_duration2 == nil
if PK8::DamageText::Keyframes_Flag == true
if @_damage_duration2 > 0
# Stores variables for use in script calls.
dmg = @_damage_sprite
dmg_d = PK8::DamageText::Keyframes_Duration
dmg_v = @_damage_value
# Check for Damage Type
case @_damage_type
when "heal"
if PK8::DamageText::Keyframes_Heal_Flag == true
keyframes = PK8::DamageText::Keyframes_Heal
else
keyframes = PK8::DamageText::Keyframes
end
when "miss"
if PK8::DamageText::Keyframes_Miss_Flag == true
keyframes = PK8::DamageText::Keyframes_Miss
else
keyframes = PK8::DamageText::Keyframes
end
when "critical"
if PK8::DamageText::Keyframes_Critical_Flag == true
keyframes = PK8::DamageText::Keyframes_Critical
else
keyframes = PK8::DamageText::Keyframes
end
else
if PK8::DamageText::Keyframes_Damage_Flag == true
keyframes = PK8::DamageText::Keyframes_Damage
else
keyframes = PK8::DamageText::Keyframes
end
end
# Animate
case @_damage_duration2
when 0..PK8::DamageText::Keyframes_Duration
dmg_i = @_damage_duration2
i = PK8::DamageText::Keyframes_Duration - dmg_i
if keyframes[@_damage_duration2].size > 0 # Detects keyframe
@_damage_property = []
for n in 0..keyframes[@_damage_duration2].size-1
if PK8::DamageText::Keyframes_Advanced == true
@_damage_property[n] = eval("dmg; #{keyframes[dmg_i][n]}")
else
@_damage_property[n] = eval("dmg.#{keyframes[dmg_i][n]}")
end
end
@_damage_keyframe = @_damage_duration2
else # Uses previous keyframe. Possibly for tweening purposes.
@_damage_property = []
if @_damage_keyframe != nil
for n in 0..keyframes[@_damage_keyframe].size-1
if PK8::DamageText::Keyframes_Advanced == true
@_damage_property[n] = eval("dmg; #{keyframes[
@_damage_keyframe][n]}")
else
@_damage_property[n] = eval("dmg.#{keyframes[
@_damage_keyframe][n]}")
end
end
end
end
dmg.update
for n in 0..@_damage_property.size-1
@_damage_property[n]
end
end
@_damage_duration2 -= 1
dispose_damage if @_damage_duration2 == 0
end
end
end
end
end
end
Instructions
You may learn a little more about each setting by looking at the "What is this?" section in my script header.
FAQ
Awaiting question.
Compatibility
RMXP only. It pretty much rewrites the heck out of the damage and update methods in the Sprite > ::Sprite class of the RPG module.
Credits and Thanks
Yeyinde's help with fixing stacking error issues.
Rhyme helped me out a few years ago on drawing outlines better.
Kain Nobel asking for the Miss text to have a custom string to it, and suggesting a scrolling text option. My Iteration feature probably looks nothing like what he requested but it should be just as epic.
MetalRenard pretty much telling me to "make this as epic as possible" made me want to go all out on this script. Again for asking about it being possible to make the sprite flash every time the value reaches +100 more, which made me add the dmg_v variable.
Victor Sant's Collapse script for RPG Maker VX Ace inspired me to attempt a custom animation feature for Damage Text.
Author's Notes
When I first made this script, I remember making it because I was bored and I was watching people play Eternal Sonata. I couldn't help but love how fancy the damage text looked, so I wanted to make something kind of like it here.
Now when I was working on this version, I went in there thinking "okay, I'll just edit a few settings and call it a day." It sounds mean, I know, but that was because I didn't think I'd be able to improve the script much further. That was, until I saw Victor Sant's collapse script thread for RPG Maker VX Ace. Seeing that thread gave me some new ideas for what I wanted to do for this script.
Terms and Conditions
Feel free to include it in your game, just credit me.
RPG Maker Scripts
Change Character Opacity in Frames
Change Picture Properties in Frames
Change Window Properties in Frames
Change Windowskin
Composite Windowskins
Custom Movement
Damage Text Revamp
Data Backup System 2
Dash VX for XP
Dash-Enabling Equipment
Disable Dash
Initial Switches and Variables
Memorize Tones
Mirror Events
Modify Battler Collapse Effect
Move During Messages
More Move Routes
New Character Properties
New Picture Properties
Arevulopapo's Particle Engine for VX & Ace
Picture Below Characters for XP & Ace
Pictures Can Scroll Too
Rataime's Passability Indicator Tool
The Self Data Suite
Speed Up Frame Rate for Test Play
Tileset Hues
Switchless Common Events
Unlimited Graphically Layered Maps
Windowskin Converter
Change Picture Properties in Frames
Change Window Properties in Frames
Change Windowskin
Composite Windowskins
Custom Movement
Damage Text Revamp
Data Backup System 2
Dash VX for XP
Dash-Enabling Equipment
Disable Dash
Initial Switches and Variables
Memorize Tones
Mirror Events
Modify Battler Collapse Effect
Move During Messages
More Move Routes
New Character Properties
New Picture Properties
Arevulopapo's Particle Engine for VX & Ace
Picture Below Characters for XP & Ace
Pictures Can Scroll Too
Rataime's Passability Indicator Tool
The Self Data Suite
Speed Up Frame Rate for Test Play
Tileset Hues
Switchless Common Events
Unlimited Graphically Layered Maps
Windowskin Converter