Help - Search - Members - Calendar
Full Version: Changing Damage Font?
RPG RPG Revolution Forums > Game Engines > RPG Maker XP Discussion
lemonairable
It's pretty simple, but I can't seem to find this info anywhere. How do you change the font of damage numbers in battles?
brewmeister
You need to modify the 'damage' method of RPG::Sprite

CODE
module RPG
  class Sprite < ::Sprite
    def damage(value, critical)
      dispose_damage
      if value.is_a?(Numeric)
        damage_string = value.abs.to_s
      else
        damage_string = value.to_s
      end
      bitmap = Bitmap.new(160, 48)
      bitmap.font.name = "Arial Black"
      bitmap.font.size = 32
      bitmap.font.color.set(0, 0, 0)
      bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
      if value.is_a?(Numeric) and value < 0
        bitmap.font.color.set(176, 255, 144)
      else
        bitmap.font.color.set(255, 255, 255)
      end
      bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
      if critical
        bitmap.font.size = 20
        bitmap.font.color.set(0, 0, 0)
        bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
        bitmap.font.color.set(255, 255, 255)
        bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 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


change the line: bitmap.font.name = "Arial Black" to the desired font
lemonairable
Thanks. It helps a lot.

Just one thing, though. Where do I find RPG::Sprite? It doesn't show up in the Script Editor.
Redd
RPG::Sprite is a hidden class. You can find out more info about it in the Help file, but I don't think you can change it
lemonairable
Maybe I could copy and paste it from Help and Paste it above Main? Would editing it there work?
Night5h4d3
Yes indeed, the RPG modules are built in, and provide the core to run the game like an RPG, but they can easily be changed, but adding them would be a bit different from regular scripts.

When you add an RPG module, put it AT THE TOP of your scripts list, then you can make the edits.
lemonairable
Aha! Thank you so much, everyone.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.