Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 KNegate XP & VX
#1
KNegate XP & VX

by Kyonides Arkanthes


Introduction

This time the explanation is quite simple indeed Laughing you only need to setup battlers that will negate any damage taken if it is less than a percent of their MAXHP. Shocked

XP Script
Code:
# * KNegate XP
#   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_ae :attack_effect
 alias :kyon_negate_gm_battler_se :skill_effect
 def attack_effect(user)
   result = kyon_negate_gm_battler_ae(user)
   result |= check_damage_negation(result)
   result
 end

 def skill_effect(user, skill)
   result = kyon_negate_gm_battler_se(user, skill)
   result |= check_damage_negation(result)
   result
 end

 def check_damage_negation(result)
   no_dmg = KNegate::DAMAGE_BATTLER_IDS[self.kind][self.id]
   return result if !no_dmg or !@damage.between?(1, maxhp * no_dmg / 100)
   self.hp += @damage
   @damage = 0
   false
 end
end

class Game_Actor
 def kind() :actor end
end

class Game_Enemy
 def kind() :enemy end
end


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! Laughing + Tongue sticking out
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX
Reply }




Users browsing this thread: