#=======================#
# Custom Damage Script? #
#=======================================================================#
# All colors are adjusted like they would be in the Animation Database. #
#=======================================================================#
module RPG
class Sprite < ::Sprite
def add_comma(value)
string = []
string = value.to_s.scan(/./).reverse!
for i in 0..string.size-1
if (i+1)%4 == 0
#=============================================================#
# This line makes it add commas automatically as appropriate! #
#=============================================================#
string.insert i, ","
end
end
return string.reverse!.to_s
end
def damage(value, critical)
dispose_damage
if value.is_a?(Numeric)
damage_string = add_comma(value.abs)
else
damage_string = value.to_s
end
bitmap = Bitmap.new(160, 64)
#=====================================================================#
# Edit here to change the font and such for damage numbers in battle. #
#=====================================================================#
bitmap.font.name = "Cherry Coke" #Font Name!
bitmap.font.size = 32 #Font Size!
bitmap.font.color.set(0, 0, 0) #Font Outline Color!
#==============================================================================#
# The commented out lines below of bitmap.draw blah blah add a bolder outline. #
# The shadow looks good on certain fonts, while distorted on others. #
# As you can guess, Cherry Coke looks lovely with it. Don't have it? Get it :) #
#==============================================================================#
bitmap.draw_text(-1, 12-1, 160, 64, damage_string, 1)
# bitmap.draw_text(-2, 12-2, 160, 64, damage_string, 1)
# bitmap.draw_text(-3, 12-3, 160, 64, damage_string, 1)
bitmap.draw_text(+1, 12-1, 160, 64, damage_string, 1)
# bitmap.draw_text(+2, 12-2, 160, 64, damage_string, 1)
# bitmap.draw_text(+3, 12-3, 160, 64, damage_string, 1)
bitmap.draw_text(-1, 12+1, 160, 64, damage_string, 1)
# bitmap.draw_text(-2, 12+2, 160, 64, damage_string, 1)
# bitmap.draw_text(-3, 12+3, 160, 64, damage_string, 1)
bitmap.draw_text(+1, 12+1, 160, 64, damage_string, 1)
# bitmap.draw_text(+2, 12+2, 160, 64, damage_string, 1)
# bitmap.draw_text(+3, 12+3, 160, 64, damage_string, 1)
if value.is_a?(Numeric) and value < 0
bitmap.font.color.set(176, 255, 144) # Color! Adjust if you like.
value = 0
else
bitmap.font.color.set(255, 255, 255) # Color! Adjust if you like.
end
bitmap.draw_text(0, 12, 160, 64, damage_string, 1)
if critical
#=================================================================#
# When you critical hit, this is the shadow/outline of the words. #
#=================================================================#
@critical_text = "Critical Hit!" # The shadow of critical hit text!
bitmap.font.size = 18
bitmap.font.color.set(0, 0, 0) # Color! Adjust if you like.
#================================================================#
# This again, is the shadow/outline of the critical hit wordage. #
#================================================================#
bitmap.draw_text(-1, -1, 160, 20, @critical_text, 1)
# bitmap.draw_text(-2, -2, 160, 20, @critical_text, 1)
bitmap.draw_text(+1, -1, 160, 20, @critical_text, 1)
# bitmap.draw_text(+2, -2, 160, 20, @critical_text, 1)
bitmap.draw_text(-1, +1, 160, 20, @critical_text, 1)
# bitmap.draw_text(-2, +2, 160, 20, @critical_text, 1)
bitmap.draw_text(+1, +1, 160, 20, @critical_text, 1)
# bitmap.draw_text(+2, +2, 160, 20, @critical_text, 1)
#=================================================================#
# If you want to adjust critical hit wordage & color, this is it! #
#=================================================================#
bitmap.font.color.set(255, 40, 0) # Color! Adjust if you like.
bitmap.draw_text(0, 0, 160, 20, "Critical Hit!", 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.z = 3000
@_damage_duration = 40
end
end
end