Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

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

Lucky7777Damage.png

Script

Code:
#===============================================================================

# ** Battle : Lucky 7777 Damage

#===============================================================================

 

#-------------------------------------------------------------------------------

# * SDK Log

#-------------------------------------------------------------------------------

SDK.log('Battle.Lucky7777Damage', 'Kain Nobel ©', 3.5, '2009.06.17')

#-------------------------------------------------------------------------------

# * SDK Enabled Test : BEGIN

#-------------------------------------------------------------------------------

if SDK.enabled?('Battle.Lucky7777Damage')

 

#===============================================================================

# ** Lucky7777s

#===============================================================================

 

module Lucky7777

  #-----------------------------------------------------------------------------

  # * Is an Actor allowed to execute 7777 damage?

  #-----------------------------------------------------------------------------

  Actor_Execute = Hash.new

  Actor_Execute.default = true

  #-----------------------------------------------------------------------------

  # * Is an Enemy allowed to execute 7777 damage?

  #-----------------------------------------------------------------------------

  Enemy_Execute = Hash.new

  Enemy_Execute.default = true

  #-----------------------------------------------------------------------------

  # * Font Type used to display Lucky 7777 damage

  #-----------------------------------------------------------------------------

  DamageFontName = "Arial Black"

  #-----------------------------------------------------------------------------

  # * Font Size used to display Lucky 7777 damage

  #-----------------------------------------------------------------------------

  DamageFontSize = 32

  #-----------------------------------------------------------------------------

  # * Damage String (word) used to represent Lucky 7777 damage

  #-----------------------------------------------------------------------------

  DamageString = "Lucky!"

  #-----------------------------------------------------------------------------

  # * Background Color for Lucky 7777 damage display

  #-----------------------------------------------------------------------------

  DamageColorA = Color.new(0, 160, 0)

  #-----------------------------------------------------------------------------

  # * Foreground Color for Lucky 7777 damage display

  #-----------------------------------------------------------------------------

  DamageColorB = Color.new(255, 255, 0)

end

 

#===============================================================================

# ** Game_Battler

#===============================================================================

 

class Game_Battler

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :lucky7s_gmbtlr_atkeff,        :attack_effect

  alias_method :lucky7s_gmbtlr_atkeffdamage,  :attack_effect_damage

  #-----------------------------------------------------------------------------

  # * Attack Effect

  #-----------------------------------------------------------------------------

  def attack_effect(attacker)

    @offense = attacker

    lucky7s_gmbtlr_atkeff(attacker)

  end

  #-----------------------------------------------------------------------------

  # * Attack Effect Critical Correction

  #-----------------------------------------------------------------------------

  def attack_effect_damage

    if @offense.execute_7777?

      self.critical = 7777

      self.damage = 7777

    end

    lucky7s_gmbtlr_atkeffdamage

  end

end

 

#===============================================================================

# ** Game_Actor

#===============================================================================

 

class Game_Actor < Game_Battler

  #-----------------------------------------------------------------------------

  # * Execute 7777 ?

  #-----------------------------------------------------------------------------

  def execute_7777?

    Lucky7777::Actor_Execute[id] && self.hp == 7777

  end

end

 

#===============================================================================

# ** Game_Enemy

#===============================================================================

 

class Game_Enemy < Game_Battler

  #-----------------------------------------------------------------------------

  # * Execute 7777 ?

  #-----------------------------------------------------------------------------

  def execute_7777?

    Lucky7777::Enemy_Execute[id] && self.hp == 7777

  end

end

 

#===============================================================================

# ** RPG::Sprite

#===============================================================================

 

class RPG::Sprite < ::Sprite

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :lucky7s_rpgsprite_damage, :damage

  #-----------------------------------------------------------------------------

  # * Damage

  #-----------------------------------------------------------------------------

  def damage(value, critical)

    if critical != 7777

      lucky7s_rpgsprite_damage(value, critical)

      return

    end

    dispose_damage

    bitmap = Bitmap.new(160, 96)

    if value.is_a?(Numeric)

      damage_value = value.abs.to_s + 's'

    else

      damage_value = value.to_s + 's'

    end

    bitmap.font.name = Lucky7777::DamageFontName

    bitmap.font.size = Lucky7777::DamageFontSize

    bitmap.font.color = Lucky7777::DamageColorA

    bitmap.draw_text(-1, 12-1, 160, 36, Lucky7777::DamageString, 1)

    bitmap.draw_text(+1, 12-1, 160, 36, Lucky7777::DamageString, 1)

    bitmap.draw_text(-1, 12+1, 160, 36, Lucky7777::DamageString, 1)

    bitmap.draw_text(+1, 12+1, 160, 36, Lucky7777::DamageString, 1)

    bitmap.draw_text(-1, 32-1, 160, 36, damage_value, 1)

    bitmap.draw_text(+1, 32-1, 160, 36, damage_value, 1)

    bitmap.draw_text(-1, 32+1, 160, 36, damage_value, 1)

    bitmap.draw_text(+1, 32+1, 160, 36, damage_value, 1)

    bitmap.font.color = Lucky7777::DamageColorB

    bitmap.draw_text(0, 12, 160, 36, Lucky7777::DamageString, 1)

    bitmap.draw_text(0, 32, 160, 36, damage_value, 1)

    @_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 = 10000

    @_damage_duration = 40 

  end

end

 

#-------------------------------------------------------------------------------

# * SDK Enabled Test : END

#-------------------------------------------------------------------------------

end
If you don't use SDK, replace the entire Game_Battler class in the script above, and replace it with this...

Code:
#===============================================================================

# ** Game_Battler

#===============================================================================

 

class Game_Battler

  #-----------------------------------------------------------------------------

  # * Attack Effect

  #-----------------------------------------------------------------------------

  def attack_effect(attacker)

    self.critical = false

    hit_result = (rand(100) < attacker.hit)

    if hit_result == true

      atk = [attacker.atk - self.pdef / 2, 0].max

      self.damage = atk * (20 + attacker.str) / 20

      self.damage *= elements_correct(attacker.element_set)

      self.damage /= 100

      if self.damage > 0

        if rand(100) < 4 * attacker.dex / self.agi

          self.damage *= 2

          self.critical = true

        end

        if self.guarding?

          self.damage /= 2

        end

      end

      if self.damage.abs > 0

        amp = [self.damage.abs * 15 / 100, 1].max

        self.damage += rand(amp+1) + rand(amp+1) - amp

      end

      eva = 8 * self.agi / attacker.dex + self.eva

      hit = self.damage < 0 ? 100 : 100 - eva

      hit = self.cant_evade? ? 100 : hit

      hit_result = (rand(100) < hit)

    end

    if hit_result == true

      #### 7777 Damage Addition : BEGIN ###

      if @offense.execute_7777?

        self.critical = 7777

        self.damage = 7777

      end

      #### 7777 Damage Addition : END ####

      remove_states_shock

      self.hp -= self.damage

      @state_changed = false

      states_plus(attacker.plus_state_set)

      states_minus(attacker.minus_state_set)

    else

      self.damage = "Miss"

      self.critical = false

    end

    return true

  end

end

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.
 
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?
 

SP27

Sponsor

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. :wink:

Back to the subject:

You know, I've never seen the lucky 7's in FF7.
Maybe I'm not that lucky! :haha:
 
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:
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top