Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: Jragyn on August 24, 2009, 11:01:13 pm

Title: [XP] Damage Font Manipulation
Post by: Jragyn on August 24, 2009, 11:01:13 pm
Custom Damage Font
Authors: Unknown
Version: 1.0
Type: Battle Add-on
Key Term: Battle Add-on



Introduction

This script gives the ability to edit the fonts in battle!



Features




Screenshots

Ahh, the power of Paint.

Spoiler: ShowHide
(http://i46.photobucket.com/albums/f150/Jragyn/DamageFont.png)



Demo

There isn't much a need for a demo, is there?
Its easy to image what #'s looks like when its anything but 'Arial Black'.
If anything, just admire my spectacular screenshot.



Script

Spoiler: ShowHide

#=======================#
# 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



Instructions

As long as its between the DEFAULT scripts and MAIN, I imagine it should do its job.



Compatibility

I haven't found any issues directly.
Though, it probably won't work with those one Damage modifier scripts...
The ones that replace 'em with pictures 'n stuff though.
Ideally, it should probably go below a CBS just incase the system
feels like tinkering with how damage looks.



Credits and Thanks




Author's Notes

None of any note or interest. Just use and enjoy.

Title: Re: [XP] Damage Font Manipulation
Post by: Calintz on October 09, 2009, 09:16:25 am
So pointless, yet neat. Lol.