Lucky 7777 Damage !

Lucky 7777 Damage
Version: 2.5
By: Kain Nobel

Introduction

If you remember, in Final Fantasy VII if one of your characters had 7777 current HP then they'd constantly do 7777 damage? Thats what this does...

Features
  • Deal 7777 damage if your current HP is 7777
  • Ability to determine which actors execute 7777 special (New)
  • Ability to determine which enemies execute 7777 special (New)
  • Ability to customize the damage display font
  • Ability to customize the damage display colors
  • Ability to customize the damage display message

Screenshots

Content Hidden Spoiler
Image


Script

Lucky 7777 Damage Spoiler
  1. #===============================================================================
  2. # ** Battle : Lucky 7777 Damage
  3. #===============================================================================
  4.  
  5. #-------------------------------------------------------------------------------
  6. # * SDK Log
  7. #-------------------------------------------------------------------------------
  8. SDK.log('Battle.Lucky7777Damage', 'Kain Nobel  ©', 3.5, '2009.06.17')
  9. #-------------------------------------------------------------------------------
  10. # * SDK Enabled Test : BEGIN
  11. #-------------------------------------------------------------------------------
  12. if SDK.enabled?('Battle.Lucky7777Damage')
  13.  
  14. #===============================================================================
  15. # ** Lucky7777s
  16. #===============================================================================
  17.  
  18. module Lucky7777
  19.   #-----------------------------------------------------------------------------
  20.   # * Is an Actor allowed to execute 7777 damage?
  21.   #-----------------------------------------------------------------------------
  22.   Actor_Execute = Hash.new
  23.   Actor_Execute.default = true
  24.   #-----------------------------------------------------------------------------
  25.   # * Is an Enemy allowed to execute 7777 damage?
  26.   #-----------------------------------------------------------------------------
  27.   Enemy_Execute = Hash.new
  28.   Enemy_Execute.default = true
  29.   #-----------------------------------------------------------------------------
  30.   # * Font Type used to display Lucky 7777 damage
  31.   #-----------------------------------------------------------------------------
  32.   DamageFontName = "Arial Black"
  33.   #-----------------------------------------------------------------------------
  34.   # * Font Size used to display Lucky 7777 damage
  35.   #-----------------------------------------------------------------------------
  36.   DamageFontSize = 32
  37.   #-----------------------------------------------------------------------------
  38.   # * Damage String (word) used to represent Lucky 7777 damage
  39.   #-----------------------------------------------------------------------------
  40.   DamageString = "Lucky!"
  41.   #-----------------------------------------------------------------------------
  42.   # * Background Color for Lucky 7777 damage display
  43.   #-----------------------------------------------------------------------------
  44.   DamageColorA = Color.new(0, 160, 0)
  45.   #-----------------------------------------------------------------------------
  46.   # * Foreground Color for Lucky 7777 damage display
  47.   #-----------------------------------------------------------------------------
  48.   DamageColorB = Color.new(255, 255, 0)
  49. end
  50.  
  51. #===============================================================================
  52. # ** Game_Battler
  53. #===============================================================================
  54.  
  55. class Game_Battler
  56.   #-----------------------------------------------------------------------------
  57.   # * Alias Listings
  58.   #-----------------------------------------------------------------------------
  59.   alias_method :lucky7s_gmbtlr_atkeff,            :attack_effect
  60.   alias_method :lucky7s_gmbtlr_atkeffdamage,   :attack_effect_damage
  61.   #-----------------------------------------------------------------------------
  62.   # * Attack Effect
  63.   #-----------------------------------------------------------------------------
  64.   def attack_effect(attacker)
  65.      @offense = attacker
  66.      lucky7s_gmbtlr_atkeff(attacker)
  67.   end
  68.   #-----------------------------------------------------------------------------
  69.   # * Attack Effect Critical Correction
  70.   #-----------------------------------------------------------------------------
  71.   def attack_effect_damage
  72.      if @offense.execute_7777?
  73.         self.critical = 7777
  74.         self.damage = 7777
  75.      end
  76.      lucky7s_gmbtlr_atkeffdamage
  77.   end
  78. end
  79.  
  80. #===============================================================================
  81. # ** Game_Actor
  82. #===============================================================================
  83.  
  84. class Game_Actor < Game_Battler
  85.   #-----------------------------------------------------------------------------
  86.   # * Execute 7777 ?
  87.   #-----------------------------------------------------------------------------
  88.   def execute_7777?
  89.      Lucky7777::Actor_Execute[id] && self.hp == 7777
  90.   end
  91. end
  92.  
  93. #===============================================================================
  94. # ** Game_Enemy
  95. #===============================================================================
  96.  
  97. class Game_Enemy < Game_Battler
  98.   #-----------------------------------------------------------------------------
  99.   # * Execute 7777 ?
  100.   #-----------------------------------------------------------------------------
  101.   def execute_7777?
  102.      Lucky7777::Enemy_Execute[id] && self.hp == 7777
  103.   end
  104. end
  105.  
  106. #===============================================================================
  107. # ** RPG::Sprite
  108. #===============================================================================
  109.  
  110. class RPG::Sprite < ::Sprite
  111.   #-----------------------------------------------------------------------------
  112.   # * Alias Listings
  113.   #-----------------------------------------------------------------------------
  114.   alias_method :lucky7s_rpgsprite_damage, :damage
  115.   #-----------------------------------------------------------------------------
  116.   # * Damage
  117.   #-----------------------------------------------------------------------------
  118.   def damage(value, critical)
  119.      if critical != 7777
  120.         lucky7s_rpgsprite_damage(value, critical)
  121.         return
  122.      end
  123.      dispose_damage
  124.      bitmap = Bitmap.new(160, 96)
  125.      if value.is_a?(Numeric)
  126.         damage_value = value.abs.to_s + 's'
  127.      else
  128.         damage_value = value.to_s + 's'
  129.      end
  130.      bitmap.font.name = Lucky7777::DamageFontName
  131.      bitmap.font.size = Lucky7777::DamageFontSize
  132.      bitmap.font.color = Lucky7777::DamageColorA
  133.      bitmap.draw_text(-1, 12-1, 160, 36, Lucky7777::DamageString, 1)
  134.      bitmap.draw_text(+1, 12-1, 160, 36, Lucky7777::DamageString, 1)
  135.      bitmap.draw_text(-1, 12+1, 160, 36, Lucky7777::DamageString, 1)
  136.      bitmap.draw_text(+1, 12+1, 160, 36, Lucky7777::DamageString, 1)
  137.      bitmap.draw_text(-1, 32-1, 160, 36, damage_value, 1)
  138.      bitmap.draw_text(+1, 32-1, 160, 36, damage_value, 1)
  139.      bitmap.draw_text(-1, 32+1, 160, 36, damage_value, 1)
  140.      bitmap.draw_text(+1, 32+1, 160, 36, damage_value, 1)
  141.      bitmap.font.color = Lucky7777::DamageColorB
  142.      bitmap.draw_text(0, 12, 160, 36, Lucky7777::DamageString, 1)
  143.      bitmap.draw_text(0, 32, 160, 36, damage_value, 1)
  144.      @_damage_sprite = ::Sprite.new(self.viewport)
  145.      @_damage_sprite.bitmap = bitmap
  146.      @_damage_sprite.ox = 80
  147.      @_damage_sprite.oy = 20
  148.      @_damage_sprite.x = self.x
  149.      @_damage_sprite.y = self.y - self.oy / 2
  150.      @_damage_sprite.z = 10000
  151.      @_damage_duration = 40
  152.   end
  153. end
  154.  
  155. #-------------------------------------------------------------------------------
  156. # * SDK Enabled Test : END
  157. #-------------------------------------------------------------------------------
  158. end
Expand to see the code.

Game_Battler (for non-SDK) Spoiler
If you don't use SDK, replace the entire Game_Battler class in the script above, and replace it with this...

  1. #===============================================================================
  2. # ** Game_Battler
  3. #===============================================================================
  4.  
  5. class Game_Battler
  6.   #-----------------------------------------------------------------------------
  7.   # * Attack Effect
  8.   #-----------------------------------------------------------------------------
  9.   def attack_effect(attacker)
  10.      self.critical = false
  11.      hit_result = (rand(100) < attacker.hit)
  12.      if hit_result == true
  13.         atk = [attacker.atk - self.pdef / 2, 0].max
  14.         self.damage = atk * (20 + attacker.str) / 20
  15.         self.damage *= elements_correct(attacker.element_set)
  16.         self.damage /= 100
  17.         if self.damage > 0
  18.            if rand(100) < 4 * attacker.dex / self.agi
  19.               self.damage *= 2
  20.               self.critical = true
  21.            end
  22.            if self.guarding?
  23.               self.damage /= 2
  24.            end
  25.         end
  26.         if self.damage.abs > 0
  27.            amp = [self.damage.abs * 15 / 100, 1].max
  28.            self.damage += rand(amp+1) + rand(amp+1) - amp
  29.         end
  30.         eva = 8 * self.agi / attacker.dex + self.eva
  31.         hit = self.damage < 0 ? 100 : 100 - eva
  32.         hit = self.cant_evade? ? 100 : hit
  33.         hit_result = (rand(100) < hit)
  34.      end
  35.      if hit_result == true
  36.         #### 7777 Damage Addition : BEGIN ###
  37.         if @offense.execute_7777?
  38.            self.critical = 7777
  39.            self.damage = 7777
  40.         end
  41.         #### 7777 Damage Addition : END ####
  42.         remove_states_shock
  43.         self.hp -= self.damage
  44.         @state_changed = false
  45.         states_plus(attacker.plus_state_set)
  46.         states_minus(attacker.minus_state_set)
  47.      else
  48.         self.damage = "Miss"
  49.         self.critical = false
  50.      end
  51.      return true
  52.   end
  53. end
Expand to see the code.


Also, you'll need to delete the SDK.log, SDK.enabled? test and the last end in the script.


Instructions

Paste this script below the SDK and above main and you should be good to go, it has an easy to customize module which is pretty self explanitory.

Terms and Conditions

Free to use in commercial and non-commercial projects so long as you don't forget to credit yours truely.
I think it was "777", not "7777". But that's excusable. Nice script!
accident, mods delete this post

We don't delete threads / posts on request. You must live forever with your shame. :scruff:
And please don't 'double-post', Modify your previous post.
good idea for script. always nice seeing more random features like this :D

assume we can change numbers easily just by changing numbers from 7777?
Nice... just like FF7 ... great idea.. this will work well in my game. :D cheers
Great idea~!

It's one good little thing to put in game. :D
We don't delete threads / posts on request. You must live forever with your shame.

Or become a sponsor. Then you can delete your posts.
But only if there is no post after yours. 😉

Back to the subject:

You know, I've never seen the lucky 7's in FF7.
Maybe I'm not that lucky! :haha:
Except FF7 didn't have the fancy golden/green damage pop like I do :P
I would have no idea how it looks like in FF7.
Nevertheless it's a nice lil script. 😉
I've made a small update; now you can enable/disable certain actors and enemies who you want to be able to use the 7777 bonus damage! So, for instance, you can have all actors but [actor X] to be able to use 7777 damage; alternatively, you can have only [actor X] to be able to execute the bonus, and the same applies to enemies.

Of course, you've gotta keep in mind its pretty rare that somebody might actually hit 7777 HP just by random chance, so I'd just set both .defaults to 'true' and leave the hash alone. Its up to you though, thats why I put that feature in there ;)

Enjoy! :thumb:
Is there any way to change it to deal 777 damage if you got 777 HP?
Line 74,75,89,102,119,

Replace the 7777 with 777
Cool! I remember getting lucky 7s for the first time with Barrett. I was like "Cool!"

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