RPG Maker Forums

So I made this free script to always deal a certain minimum amount of damage. But sadly the heal spell (and a few other skills) now cause damage instead of healing. And some skills damage both the enemy AND me...

I have no idea why. It's something simple I know it.

Script (updated):

#sb:nap_min_dmg [battle]=beginAuthor: NapoleonVersion: 1.01About: Both you and enemies now always deal a minimum damage (percentage) when       dealing damage. This is to prevent doing 0 damage or just not enough       damage when an ally/enemy has just too much defense.Note:  When dealing percentage damage the percentage is based on a single       attack/magic damage * percentage. And not "attack x4" for example.License: CC3 (But attribution is not required).=end$imported ||= {}$imported[:nap_min_damage] = 1.01#===============================================================================# Settings#===============================================================================module Nap; module Battle  MIN_DMG_PERC = 0.25 # A value between 0.0 and 1.0  MIN_DMG      = 1  # The absolute minimum amount of damage dealt no matter whatend; end#===============================================================================# RPG::UsableItem::Damage# For: Never deal less than Nap::Battle::MIN_DMG damage for a damaging-ability#===============================================================================class RPG::UsableItem::Damage  alias nap_min_dmg_eval eval  def eval(a, b, v)    damage = nap_min_dmg_eval(a, b, v)    # if-check is required because HP/MP Recovery is a negative value.    damage >= 0 ? [damage, Nap::Battle::MIN_DMG].max : damage  endend#===============================================================================# Game Battler# For: To ensure to deal a minimum amount of damage (in %) when the target's#      defense is too high (part 1/2).#===============================================================================class Game_Battler < Game_BattlerBase  #-----------------------------------------------------------------------------  # Make Damage Value                                                    [ALIAS]  #-----------------------------------------------------------------------------  alias nap_min_dmg_perc_make_damage_value make_damage_value  def make_damage_value(user, item)    $nap_temp_battle_user = user    nap_min_dmg_perc_make_damage_value(user, item)  endend#===============================================================================# Game Action Result# For: To ensure to deal a minimum amount of damage (in %) when the target's#      defense is too high (part 2/2).#===============================================================================class Game_ActionResult  #-----------------------------------------------------------------------------  # Make Damage                                                          [ALIAS]  #-----------------------------------------------------------------------------  alias nap_min_dmg_perc_make_damage make_damage  def make_damage(value, item)    user = $nap_temp_battle_user    $nap_temp_battle_user = nil        # Return normally if it's a hp/mp recovery.    return nap_min_dmg_perc_make_damage(value.to_i, item) if item.damage.type.between?(3, 4)    if ((item.physical?) || item.certain?) && (value <= (user.atk * Nap::Battle::MIN_DMG_PERC))      value = (user.atk * Nap::Battle::MIN_DMG_PERC)    elsif value <= (user.mat * Nap::Battle::MIN_DMG_PERC)      value = (user.mat * Nap::Battle::MIN_DMG_PERC)    end    nap_min_dmg_perc_make_damage(value.to_i, item)  endend#===============================================================================
I'm aware of the:

item.damage.type == 3 # 3 = hp recoverybut I can't find a use for it.

I also tried:

def eval(a, b, v) damage = nap_min_dmg_eval(a, b, v) if damage >= 0 # if-check is required because HP Recovery is a negative value. return [damage, Nap::Battle::MIN_DMG].max else return damage end endto prevent it from making a negative value positive. But... to no avail.

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,050
Messages
1,018,548
Members
137,835
Latest member
yetisteven
Top