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.

Where can I set the max possible damage to deal to 9999?

I think when the damages go above 9999 it just makes it waaay to easy. It's not always possible to deal that much damage in my game it's just that when an enemy is poisoned and they have really high HP, they seem to take a lot more damage than they should.
 
Well here I will make this easy on you

Code:
 class Game_Battler
  #--------------------------------------------------------------------------
  # * Damage Limit
  #   syntax - [minimum, maximum] or nil for no limit
  #--------------------------------------------------------------------------
  Damage_Limit = [-9999, 9999]
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :damage_limit_enabled
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  alias_method :trick_limits_battler_initialize, :initialize
  def initialize
    # The Usual
    trick_limits_battler_initialize
    # Set Damage limit flag
    @damage_limit_enabled = false
  end
#--------------------------------------------------------------------------
  # * Attack Effect
  #--------------------------------------------------------------------------
  alias_method :trick_limits_battler_attack_effect, :attack_effect
  def attack_effect(*args)
    # Set Damage Limit Enabled Flag
    @damage_limit_enabled = true
    # The Usual
    trick_limits_battler_attack_effect(*args)
    # Return True
    return true
  end
  #--------------------------------------------------------------------------
  # * Skill Effect
  #--------------------------------------------------------------------------
  alias_method :trick_limits_battler_skill_effect, :skill_effect
  def skill_effect(*args)
    # Set Damage Limit Enabled Flag
    @damage_limit_enabled = true
    # The Usual
    effective = trick_limits_battler_skill_effect(*args)
    # Return Effective Flag
    return effective
  end
  #--------------------------------------------------------------------------
  # * Item Effect
  #--------------------------------------------------------------------------
  alias_method :trick_limits_battler_item_effect, :item_effect
  def item_effect(*args)
    # Set Damage Limit Enabled Flag
    @damage_limit_enabled = true
    # The Usual
    effective = trick_limits_battler_item_effect(*args)
    # Return Effective Flag
    return effective
  end
  #--------------------------------------------------------------------------
  # * Set Hp (Damage Limit)
  #--------------------------------------------------------------------------
  alias_method :trick_limits_battler_hp=, :hp=
  def hp=(hp)
    # Get old hp and
    old_hp, new_hp = self.hp, hp
    # If Damage is A Number and Difference is damage
    if (self.damage.is_a?(Numeric) and old_hp - new_hp == self.damage and 
        @damage_limit_enabled and not Damage_Limit.nil?)
      # Get Damage
      n = self.damage
      # Set New Damage
      damage_hp = [[n, Damage_Limit[0]].max, Damage_Limit[1]].min
      # Set Hp
      self.trick_limits_battler_hp = old_hp - damage_hp
      # Set Damage
      self.damage = damage_hp
    else
      # The usaul
      self.trick_limits_battler_hp = hp
    end
    # Reset Damage Enabled Flag
    @damage_limit_enabled = false
  end
end

Taken from my Limit Break script, add this code in a new script above main I have already set it up to meet your specifications if you have any trouble with this code please reply with the problems and the description leading to the problem Thank you.
 

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