Battler : OverKill (w/ Exp & Gold Bonus)

Battler : OverKill (w/ Exp & Gold Bonus)
Version: 3.5
By: Kain Nobel

Introduction

What is "OverKill" ? Basically, if a battler kills its target with a critical strike, then it'll display an OverKill damage pop. Alongside this, I made an optional plugin which increases EXP and Gold gained with each battler killed with an overkill strike.

Features

  • Displayes "OverKill!!!" instead of Critical when target killed with critical strike
  • Easily customize the display, font and color options of the overkill damage
  • Plugin to give you an Exp and Gold bonus when striking an OverKill
  • Exp & Gold plugin can use variables, or constants values

Screenshots

Image

Script

Battler : OverKill Spoiler
  1. #===============================================================================
  2. # ** Battler : OverKill
  3. #===============================================================================
  4.  
  5. #-------------------------------------------------------------------------------
  6. # * SDK Log
  7. #-------------------------------------------------------------------------------
  8. if Object.const_defined?(:SDK)
  9.   SDK.log('Battler.OverKill', 'Kain Nobel ©', 3.5, '2009.09.09')
  10. end
  11.  
  12. #===============================================================================
  13. # ** OverKill
  14. #===============================================================================
  15.  
  16. module OverKill
  17.   #-----------------------------------------------------------------------------
  18.   # * String for Damage Pop when killing hit was a critical hit
  19.   #-----------------------------------------------------------------------------
  20.   Critical_String = "OverKill!!!"
  21.   #-----------------------------------------------------------------------------
  22.   # * Color for Overkill Damage Pop (Background)
  23.   #-----------------------------------------------------------------------------
  24.   Critical_ColorA  = Color.new(96, 64, 0)
  25.   #-----------------------------------------------------------------------------
  26.   # * Color for Overkill Damage Pop (Main)
  27.   #-----------------------------------------------------------------------------
  28.   Critical_ColorB  = Color.new(255, 64, 64)
  29.   #-----------------------------------------------------------------------------
  30.   # * Color for Overkill Damage Value (Background)
  31.   #-----------------------------------------------------------------------------
  32.   Damage_ColorA    = Color.new(128, 128, 128)
  33.   #-----------------------------------------------------------------------------
  34.   # * Color for Overkill Damage Value (Main)
  35.   #-----------------------------------------------------------------------------
  36.   Damage_ColorB    = Color.new(255, 32, 32)
  37.   #-----------------------------------------------------------------------------
  38.   # * Font Name for Overkill Damage
  39.   #-----------------------------------------------------------------------------
  40.   Font_Name        = "Arial Black"
  41.   #-----------------------------------------------------------------------------
  42.   # * Font Size for Overkill Damage
  43.   #-----------------------------------------------------------------------------
  44.   Font_Size        = 32
  45. end
  46.  
  47. #===============================================================================
  48. # ** Game_Battler
  49. #===============================================================================
  50.  
  51. class Game_Battler
  52.   #-----------------------------------------------------------------------------
  53.   # * Alias Listings
  54.   #-----------------------------------------------------------------------------
  55.   alias_method :overkill_gmbattler_attackeffect,:attack_effect
  56.   #-----------------------------------------------------------------------------
  57.   # * Attack Effect Critical Correction
  58.   #-----------------------------------------------------------------------------
  59.   def attack_effect(attacker)
  60.     # Get old attack effect result
  61.     result = overkill_gmbattler_attackeffect(attacker)
  62.     # If damage is critical and fatal
  63.     if self.critical && @hp < self.damage
  64.       # Double the damage just for kicks
  65.       self.damage *= 2
  66.       # Set critical flag for overkill damage pop
  67.       self.critical = OverKill::Critical_String
  68.     end
  69.     # Return attack effect's origional result
  70.     result
  71.   end
  72. end
  73.  
  74. #===============================================================================
  75. # ** RPG::Sprite
  76. #===============================================================================
  77.  
  78. class RPG::Sprite < ::Sprite
  79.   #-----------------------------------------------------------------------------
  80.   # * Alias Listings
  81.   #-----------------------------------------------------------------------------
  82.   alias_method :overkill_rpgsprite_damage, :damage
  83.   #-----------------------------------------------------------------------------
  84.   # * Damage
  85.   #-----------------------------------------------------------------------------
  86.   def damage(value, critical)
  87.     # If critical is not set to overkill flag
  88.     if critical != OverKill::Critical_String
  89.       # The usual
  90.       overkill_rpgsprite_damage(value, critical)
  91.       # End the method
  92.       return
  93.     end
  94.     # Dispose of current damage
  95.     dispose_damage
  96.     # Create bitmap to fit overkill damage display
  97.     bitmap = Bitmap.new(160, 96)
  98.     # Convert damage value to string
  99.     damage_string = (value.is_a?(Numeric) ? value.abs.to_s : value.to_s)
  100.     # Set custom overkill font name and size
  101.     bitmap.font.name = OverKill::Font_Name
  102.     bitmap.font.size = OverKill::Font_Size
  103.     # Set overkill critical back color
  104.     bitmap.font.color = OverKill::Critical_ColorA
  105.     # Draw overkill critical background
  106.     bitmap.draw_text(-1, 12-1, 160, 36, OverKill::Critical_String, 1)
  107.     bitmap.draw_text(-1, 12-1, 160, 36, OverKill::Critical_String, 1)
  108.     bitmap.draw_text(+1, 12+1, 160, 36, OverKill::Critical_String, 1)
  109.     bitmap.draw_text(+1, 12+1, 160, 36, OverKill::Critical_String, 1)
  110.     # Set overkill damage back color
  111.     bitmap.font.color = OverKill::Damage_ColorA
  112.     # Draw overkill damage background
  113.     bitmap.draw_text(-1, 32-1, 160, 36, damage_string, 1)
  114.     bitmap.draw_text(+1, 32-1, 160, 36, damage_string, 1)
  115.     bitmap.draw_text(-1, 32+1, 160, 36, damage_string, 1)
  116.     bitmap.draw_text(+1, 32+1, 160, 36, damage_string, 1)
  117.     # Set overkill damage front color
  118.     bitmap.font.color = OverKill::Critical_ColorB
  119.     # Draw overkill damage foreground
  120.     bitmap.draw_text(0, 12, 160, 36, OverKill::Critical_String, 1)
  121.     # Set overkill damage forground
  122.     bitmap.font.color = OverKill::Damage_ColorB
  123.     # Draw overkill damage
  124.     bitmap.draw_text(0, 32, 160, 36, damage_string, 1)
  125.     # Create damage sprites
  126.     @_damage_sprite = ::Sprite.new(self.viewport)
  127.     @_damage_sprite.bitmap = bitmap
  128.     @_damage_sprite.ox = 80
  129.     @_damage_sprite.oy = 20
  130.     @_damage_sprite.x = self.x
  131.     @_damage_sprite.y = self.y - self.oy / 2
  132.     @_damage_sprite.z = 10000
  133.     @_damage_duration = 40
  134.   end
  135. end
Expand to see the code.

Battler : OverKill Exp & Gold Spoiler
  1. #===============================================================================
  2. # ** Battler : OverKill Experience & Gold
  3. #===============================================================================
  4.  
  5. #-------------------------------------------------------------------------------
  6. # * SDK Log
  7. #-------------------------------------------------------------------------------
  8. if Object.const_defined?(:SDK)
  9.   SDK.log('Battler.OverKillExp&Gold', 'Kain Nobel ©', 3.5, '2009.09.09')
  10. end
  11. #-------------------------------------------------------------------------------
  12. # * OverKill Enabled Test : Begin
  13. #-------------------------------------------------------------------------------
  14. if Object.const_defined?(:OverKill)
  15.  
  16. #===============================================================================
  17. # ** OverKill
  18. #===============================================================================
  19.  
  20. module OverKill
  21.   #-----------------------------------------------------------------------------
  22.   # * Use Variables
  23.   #-----------------------------------------------------------------------------
  24.   Use_Variables = false
  25.   #-----------------------------------------------------------------------------
  26.   # * Modifier for Overkill Gold      (0.25 or 25 would both denote 25% bonus)
  27.   #-----------------------------------------------------------------------------
  28.   Gold_Modifier = 0.25
  29.   #-----------------------------------------------------------------------------
  30.   # * Modifier for Overkill Exp       (0.25 or 25 would both denote 25% bonus)
  31.   #-----------------------------------------------------------------------------
  32.   Exp_Modifier  = 0.25
  33. end
  34.  
  35. #===============================================================================
  36. # ** Game_Battler
  37. #===============================================================================
  38.  
  39. class Game_Battler
  40.   #-----------------------------------------------------------------------------
  41.   # * Alias Listings
  42.   #-----------------------------------------------------------------------------
  43.   alias_method :overkillexpgold_gmbattler_attackeffect, :attack_effect
  44.   #-----------------------------------------------------------------------------
  45.   # * Attack Effect Critical Correction
  46.   #-----------------------------------------------------------------------------
  47.   def attack_effect(attacker)
  48.     # Get origional attack effect result
  49.     result = overkillexpgold_gmbattler_attackeffect(attacker)
  50.     # If critical flag is set for overkill
  51.     if self.critical == OverKill::Critical_String
  52.       # If battler being attacked is an enemy
  53.       if self.is_a?(Game_Enemy)
  54.         # Save in overkilled array
  55.         $game_temp.overkilled << self
  56.       end
  57.     end
  58.     # Return origional attack effect result
  59.     result
  60.   end
  61. end
  62.  
  63. #===============================================================================
  64. # ** Game_Temp
  65. #===============================================================================
  66.  
  67. class Game_Temp
  68.   #-----------------------------------------------------------------------------
  69.   # * Public Instance Variables
  70.   #-----------------------------------------------------------------------------
  71.   attr_accessor :overkilled   # Array of enemies that were 'overkilled'
  72.   #-----------------------------------------------------------------------------
  73.   # * Alias Listings
  74.   #-----------------------------------------------------------------------------
  75.   alias_method :overkillexpgold_gmtemp_initialize, :initialize
  76.   #-----------------------------------------------------------------------------
  77.   # * Object Initialization
  78.   #-----------------------------------------------------------------------------
  79.   def initialize
  80.     # The usual
  81.     overkillexpgold_gmtemp_initialize
  82.     # Create array for 'overkilled' battlers
  83.     @overkilled = []
  84.   end
  85.   #-----------------------------------------------------------------------------
  86.   # * OverKill Gold
  87.   #-----------------------------------------------------------------------------
  88.   def overkill_gold
  89.     # Default gold to 0
  90.     gold = 0
  91.     # Iterate through all 'overkilled' battlers and get gold bonus
  92.     @overkilled.each {|enemy| gold += enemy.overkill_gold}
  93.     # Return gold bonus (as integer)
  94.     Integer(gold)
  95.   end
  96.   #-----------------------------------------------------------------------------
  97.   # * Overkill Exp
  98.   #-----------------------------------------------------------------------------
  99.   def overkill_exp
  100.     # Default exp to 0
  101.     exp = 0
  102.     # Iterate though all 'overkilled' battlers and get exp bonus
  103.     @overkilled.each {|enemy| exp += enemy.overkill_exp}
  104.     # Return exp bonus (as integer)
  105.     Integer(exp)
  106.   end
  107. end
  108.  
  109. #===============================================================================
  110. # ** Game_Enemy
  111. #===============================================================================
  112.  
  113. class Game_Enemy < Game_Battler
  114.   #-----------------------------------------------------------------------------
  115.   # * Overkill Gold
  116.   #-----------------------------------------------------------------------------
  117.   def overkill_gold
  118.     # Get modifier, check if using variables for modifer
  119.     mod = case OverKill::Use_Variables
  120.     # If using variables, get variable gold modifier
  121.     when true  then $game_variables[OverKill::Gold_Modifier]
  122.     # Not using variables, get constant gold modifier
  123.     when false then OverKill::Gold_Modifier
  124.     end
  125.     # Check if modifier is integer or float
  126.     case mod
  127.     # Get gold with percent modifier (25 denotes 25%)
  128.     when Integer then return (self.gold * (mod * 0.01))
  129.     # Get gold with percent modifier (0.25 denotes 25%)
  130.     when Float   then return (self.gold * mod)
  131.     end
  132.   end
  133.   #-----------------------------------------------------------------------------
  134.   # * Overkill Exp
  135.   #-----------------------------------------------------------------------------
  136.   def overkill_exp
  137.     # Get modifier, check if using variables for modifer
  138.     mod = case OverKill::Use_Variables
  139.     # If using variables, get variable exp modifier
  140.     when true  then $game_variables[OverKill::Exp_Modifier]
  141.     # Not using variables, get constant exp modifier
  142.     when false then OverKill::Exp_Modifier
  143.     end
  144.     # Check if modifier is integer or float
  145.     case mod
  146.     # Get exp with percent modifier (25 denotes 25%)
  147.     when Integer then return (self.exp * (mod * 0.01))
  148.     # Get exp with percent modifier (0.25 denotes 25%)
  149.     when Float   then return (self.exp * mod)
  150.     end
  151.   end
  152. end
  153.  
  154. #===============================================================================
  155. # ** Window_BattleResult
  156. #===============================================================================
  157.  
  158. class Window_BattleResult < Window_Base
  159.   #-----------------------------------------------------------------------------
  160.   # * Alias Methods
  161.   #-----------------------------------------------------------------------------
  162.   alias_method :overkill_win_battleresult_initialize,   :initialize
  163.   #-----------------------------------------------------------------------------
  164.   # * Intialize
  165.   #-----------------------------------------------------------------------------
  166.   def initialize(exp, gold, treasures)
  167.     # Add overkilled gold to origional gold
  168.     gold += $game_troop.overkill_gold
  169.     # Add overkilled exp to origional exp
  170.     exp  += $game_troop.overkill_exp
  171.     # The usual
  172.     overkill_win_battleresult_initialize(exp, gold, treasures)
  173.   end
  174. end
  175.  
  176. #===============================================================================
  177. # ** Scene_Battle
  178. #===============================================================================
  179.  
  180. class Scene_Battle
  181.   #-----------------------------------------------------------------------------
  182.   # * Alias Listings
  183.   #-----------------------------------------------------------------------------
  184.   alias_method :overkill_snbattle_main, :main
  185.   alias_method :overkill_snbattle_stp5, :start_phase5
  186.   #-----------------------------------------------------------------------------
  187.   # * Main
  188.   #-----------------------------------------------------------------------------
  189.   def main
  190.     # The usual
  191.     overkill_snbattle_main
  192.     # Clear 'overkilled' battlers
  193.     $game_temp.overkilled.clear
  194.   end
  195.   #-----------------------------------------------------------------------------
  196.   # * Start Phase 5
  197.   #-----------------------------------------------------------------------------
  198.   def start_phase5
  199.     # Get overkilled gold & exp
  200.     gold = $game_troop.overkill_gold
  201.     exp  = $game_troop.overkill_exp
  202.     # Distribute exp to actors
  203.     $game_party.actors.each {|a| a.exp += exp unless a.cant_get_exp?}
  204.     # Get extra gold from overkilled enemies
  205.     $game_party.gain_gold(gold)
  206.     # The usual
  207.     overkill_snbattle_stp5
  208.   end
  209. end
  210.  
  211. #-------------------------------------------------------------------------------
  212. # * OverKill Enabled Test : Missing Requirement Message
  213. #-------------------------------------------------------------------------------
  214. else
  215.   p 'Unable to find \'Battler.OverKill\' script, which is required for '+
  216.     '\'Battler.OverKillExp&Gold\'. This script has been disabled.'
  217. #-------------------------------------------------------------------------------
  218. # * OverKill Enabled Test : End
  219. #-------------------------------------------------------------------------------
  220. end
Expand to see the code.


Instructions

Place Above Main, Below SDK (Only if Using)

If using both scripts, they should be placed in this order (for obvious reasons)

Battler.OverKill
Battler.OverKillExp&Gold


If using my Weapons : Critical Bonus script, make sure that these two are above that one, or it won't work correctly.

The rest of the setup instructions are pretty obvious, just look at the constants in the script.

Compatibility

Place below anything that modifies Game_Battler.attack_effect, place above Weapons : Critical Bonus if you happen to be using it.

Credits and Thanks

Final Fantasy X, which I got the idea from.

Terms and Conditions

Another "Free to use in commercial and non-commercial games" script, please credit of course and thanks :thumb:
Woah, I've been wanting a script like this forever! Except...I use VX. Do you think you could make it work with VX too? Otherwise, great script! :D
Some of you probably got a NoMethodError from the second script, it was because I changed Game_Troop additions to Game_Temp right before I posted it (to prevent save file corruption). No worries now, script has been updated.

I really have to get acquainted with VX because I don't use it that much and don't know how it works, looking at it though there is alot different with the way battle system and damage pop and everything is handled so I'd have to write the script mostly/entirely from scratch. Shouldn't be too hard though, when I find some time I'll definately look into making a version for VX.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=67364