[XP] Lucky 7777 Damage

Started by G_G, August 13, 2009, 12:04:07 pm

Previous topic - Next topic

G_G

August 13, 2009, 12:04:07 pm Last Edit: August 13, 2009, 12:21:06 pm by game_guy
Lucky 7777 Damage
Authors: game_guy
Version: 1.2
Type: Damage Add On
Key Term: Battle Add-on



Introduction

Remember in some of the rpg's (I cant remember which ones) but if yod had 7777 Hp then you would deal 7777 damage. This script does that.


Features


  • Deals 7777 damage if hp is 7777 (number is customizable)
  • Enemies can deal the 7777 (set on or off)
  • Specific enemies and actors cant do it (customizable)
  • Customizable font, font size, and font color
  • Change the lucky message to whatever you want



Screenshots

Spoiler: ShowHide



Demo

http://www.sendspace.com/file/z24z7k


Script

Spoiler: ShowHide

#===============================================================================
# Lucky 7777 Damage
# Version 1.2
# Author game_guy
#-------------------------------------------------------------------------------
# Intro:
# Remember in some of the rpg's (I cant remember which ones) but if yod had 7777
# Hp then you would deal 7777 damage. This script does that.
#
# Features:
# Deals custom damage if hp is defined number
# Enemies can deal the 7777 (set on or off)
# Specific enemies and actors cant do it (customizable)
# Customizable font, font size, and font color
# Change the lucky message to whatever you want
#
# Instructions:
# Go down to Begin Config and look at the options there.
#
# Credits:
# game_guy ~ for making it
# Blizzard ~ teaching me a few things I used in here.
#===============================================================================
module GameGuy
#=====================================================
# Begin Config
#=====================================================

  #--------------------------------------------------------------------
  # The background color of the font.
  #--------------------------------------------------------------------
  BackFontColor   = Color.new(0, 0, 0) # (red, green, blue)
  #--------------------------------------------------------------------
  # The foreground color of the font.
  #--------------------------------------------------------------------
  ForeFontColor   = Color.new(0, 255, 0) # (red, green, blue)
  #--------------------------------------------------------------------
  # The name of the font you want to use.
  #--------------------------------------------------------------------
  FontName        = "Arial"
  #--------------------------------------------------------------------
  # The size of the font you want to use.
  #--------------------------------------------------------------------
  FontSize        = 32
  #--------------------------------------------------------------------
  # The message you want to pop up when 7777 is dealt.
  #--------------------------------------------------------------------
  LuckyMessage    = "Lucky!"
  #--------------------------------------------------------------------
  # Number that deals that much damage when hp is equal to that number.
  #--------------------------------------------------------------------
  LuckyNumber     = 7777
  #--------------------------------------------------------------------
  # Actors that cant use the lucky 7777.
  #--------------------------------------------------------------------
  CantUseActors   = [8, 9, 10]
  #--------------------------------------------------------------------
  # If true the enemies can use the lucky 7777.
  #--------------------------------------------------------------------
  EnemiesUse      = false
  #--------------------------------------------------------------------
  # Enemies that cant use the lucky 7777.
  #--------------------------------------------------------------------
  CantUseEnemies  = [1, 2, 3, 4]

#=====================================================
# End Config
#=====================================================
end
module RPG
  class Sprite < ::Sprite
    alias use_7777_text damage
    def damage(value, critical)
      if critical != GameGuy::LuckyNumber
        return use_7777_text(value, critical)
      end
      dispose_damage
      if value.is_a?(Numeric)
        damage_string = value.abs.to_s
      else
        damage_string = value.to_s
      end
      bitmap = Bitmap.new(160, 64)
      bitmap.font.name = GameGuy::FontName
      bitmap.font.size = GameGuy::FontSize
      bitmap.font.color = GameGuy::BackFontColor
      bitmap.draw_text(-1, 22-1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 22-1, 160, 36, damage_string, 1)
      bitmap.draw_text(-1, 22+1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 22+1, 160, 36, damage_string, 1)
      bitmap.font.color = GameGuy::ForeFontColor
      bitmap.draw_text(0, 22, 160, 36, damage_string, 1)
      bitmap.font.size = GameGuy::FontSize
      bitmap.font.color = GameGuy::BackFontColor
      bitmap.draw_text(-1, -1, 160, 32, GameGuy::LuckyMessage, 1)
      bitmap.draw_text(+1, -1, 160, 32, GameGuy::LuckyMessage, 1)
      bitmap.draw_text(-1, +1, 160, 32, GameGuy::LuckyMessage, 1)
      bitmap.draw_text(+1, +1, 160, 32, GameGuy::LuckyMessage, 1)
      bitmap.font.color = GameGuy::ForeFontColor
      bitmap.draw_text(0, 0, 160, 32, GameGuy::LuckyMessage, 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 = 3000
      @_damage_duration = 40
    end
  end
end
class Game_Battler
  alias deal_7777_attack attack_effect
  def attack_effect(attacker)
    if attacker.is_a?(Game_Enemy)
      if GameGuy::EnemiesUse != true
        return deal_7777_attack(attacker)
      elsif GameGuy::CantUseEnemies.include?(attacker.id)
        return deal_7777_attack(attacker)
      elsif attacker.hp == GameGuy::LuckyNumber
        result = deal_7777_attack(attacker)
        if result
          self.critical = GameGuy::LuckyNumber
          self.damage = GameGuy::LuckyNumber
          last_hp = self.hp
          self.hp -= self.damage
        else
          self.critical = false
          self.damage = "Miss"
        end
      else
        return deal_7777_attack(attacker)
      end
    end
    if attacker.is_a?(Game_Actor)
      if GameGuy::CantUseActors.include?(attacker.id)
        return deal_7777_attack(attacker)
      elsif attacker.hp == GameGuy::LuckyNumber
        result = deal_7777_attack(attacker)
        if result
          self.critical = GameGuy::LuckyNumber
          self.damage = GameGuy::LuckyNumber
          last_hp = self.hp
          self.hp -= self.damage
        else
          self.critical = false
          self.damage = miss
        end
      else
        return deal_7777_attack(attacker)
      end
    end
  end
end



Instructions

In the script.


Compatibility

Not tested with SDK.
Should work with any custom battle system (Including Blizz Abs)


Credits and Thanks


  • game_guy ~ for making it
  • Blizzard ~ teaching me a few things I used in here.



Author's Notes

Give credits and enjoy!

Aqua

Isn't it usually 777 the lucky number, not 7777? XD

Mmm...
Maybe you should make the number configurable? XD

G_G

August 13, 2009, 12:15:46 pm #2 Last Edit: August 13, 2009, 12:21:35 pm by game_guy
Mkay...I will *goes to update script*
EDIT:
Updated now has a customizable number insteadc of just 7777

Anywho how do you like the script?

Blizzard

Wasn't one of the skill scripts in Tons I made working like this already?
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

Wait which one? And this is attacking, not really skills but still which one?

EDIT: Thats the revenge skill, andc it deals max_hp - current_hp so I guess its kinda alike but not they're not the same.

Blizzard

I should probably add this one to Tons.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

Quote from: Blizzard on August 13, 2009, 02:07:53 pm
I should probably add this one to Tons.


I guess you should then xD

fugibo

You got this from FFIX, and I believe that you dealt 1, 7, 77, 777, or 7777 damage depending how many digits of your current HP read 7 from the right - ie, 1077 would deal 77, but 8777 would deal 777, and 7777 would deal the full 7777.

Blizzard

Ahhhhhhhhhh... THAT's what it was for. I could never figure out how that skill worked in FFIX. xD
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

winkio

it was in ff7 too, but just for 7777.  I'm pretty sure that that's where it originated.  It owned with barret's max limit break though.