09-15-2024, 07:48 AM
KStatsRefill VX + ACE
by Kyonides
Introduction
From now on you can make certain skills heal your heroes or monsters by a specific percent of their maximum HP or SP (aka MP).

Why!?




VX Script
Code:
# * KStatsRefill VX
# Scripter : Kyonides Arkanthes
# 2019-11-06
# This scriptlet allows you to setup heroes or monsters that will earn some
# Life or Mana by getting hit by certain skills only.
module KStats
REFILL_SKILL_IDS = {}# Do Not Edit This Line!
# Type : :life or :mana
# Actors' List: ActorID => { SkillID => [Type, percent], etc. }, etc. }
REFILL_SKILL_IDS[:actor] = {
1 => { 1 => [:life, 5], 2 => [:mana, 10] }
}
# Enemies' List: EnemyID => { SkillID => [Type, percent], etc. }, etc. }
REFILL_SKILL_IDS[:enemy] = {
1 => { 1 => [:life, 5], 2 => [:mana, 10] }
}
end
class Game_Battler
alias :kyon_stats_refill_gm_battler_se :skill_effect
def skill_effect(user, skill)
result = kyon_stats_refill_gm_battler_se(user, skill)
refill_stats(skill.id) if result
result
end
def refill_stats(skill_id)
data = KStats::REFILL_SKILL_IDS[self.kind] || {}
data = data[self.id] || {}
stype, percent = data[skill_id]
if stype == :life
self.hp += total = maxhp * percent / 100
@hp_damage = @hp_damage - total rescue -total
elsif stype == :mana
self.mp += total = maxmp * percent / 100
@mp_damage = @mp_damage - total rescue -total
end
end
end
class Game_Actor
def kind() :actor end
end
class Game_Enemy
def kind() :enemy end
end
VX ACE Script
Code:
# * KStatsRefill ACE
# Scripter : Kyonides Arkanthes
# 2019-11-06
# This scriptlet allows you to setup heroes or monsters that will earn some
# Life or Mana by getting hit by certain skills only.
module KStats
REFILL_SKILL_IDS = {}# Do Not Edit This Line!
# Type : :life or :mana
# Actors' List: ActorID => { SkillID => [Type, percent], etc. }, etc. }
REFILL_SKILL_IDS[:actor] = {
1 => { 1 => [:life, 5], 2 => [:mana, 10] }
}
# Enemies' List: EnemyID => { SkillID => [Type, percent], etc. }, etc. }
REFILL_SKILL_IDS[:enemy] = {
1 => { 1 => [:life, 5], 2 => [:mana, 10] }
}
end
class Game_ActionResult
alias :kyon_stats_refill_gm_ar_md :make_damage
def make_damage(value, item)
kyon_stats_refill_gm_ar_md(value, item)
return unless item.is_a?(RPG::Skill)
data = KStats::REFILL_SKILL_IDS[@battler.kind] || {}
data = data[@battler.id] || {}
stype, percent = data[item.id]
if stype == :life
@hp_damage -= @battler.mhp * percent / 100
elsif stype == :mana
@mp_damage -= @battler.mmp * percent / 100
end
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.
You are free to use it in non commercial games.
Give me a free copy of your completed game if you include at least 2 of my scripts!
