09-12-2024, 03:55 AM
KNegate VX
by Kyonides
Introduction
This time the explanation is quite simple indeed


VX Script
Code:
# * KNegate VX
# Scripter : Kyonides Arkanthes
# 2019-11-20
# This scriptlet will let battlers negate damage if it is lower than a percent
# of their MAXHP. It will not interfere with healing spells.
module KNegate
DAMAGE_BATTLER_IDS = {} # Do Not Edit This Line!
# BattlerID => MAXHP Percent, etc.
DAMAGE_BATTLER_IDS[:actor] = { 1 => 20 }
DAMAGE_BATTLER_IDS[:enemy] = {}
end
class Game_Battler
alias :kyon_negate_gm_battler_madv :make_attack_damage_value
alias :kyon_negate_gm_battler_modv :make_obj_damage_value
def make_attack_damage_value(user)
kyon_negate_gm_battler_madv(user)
check_damage_negation
end
def make_obj_damage_value(user, obj)
kyon_plotto_gm_battler_modv(user, obj)
check_damage_negation if obj.is_a?(RPG::Skill)
end
def check_damage_negation
no_dmg = KNegate::DAMAGE_BATTLER_IDS[self.kind][self.id]
return if !no_dmg or !@hp_damage.between?(1, maxhp * no_dmg / 100)
self.hp += @hp_damage
@hp_damage = 0
@critical = false
end
end
class Game_Actor
def kind() :actor end
end
class Game_Enemy
def kind() :enemy end
end
Terms & Conditions
You must include my nickname and the current website's URL in your game credits.
Do not repost it anywhere else!
Free for non commercial games.
Give me a free copy of your completed game if you include at least 2 of my scripts!
