KStatsRefill XP VX & ACE - kyonides - 11-05-2019
KStatsRefill XP VX & ACE
by Kyonides Arkanthes
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!? Well, that might be because your monsters are kind of resistant to magic!? Just go pick an excuse and make your game different from any other games uploaded to the net!
XP Script
Code: # * KStatsRefill XP
# 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]
return unless stype
if stype == :life
self.hp += total = maxhp * percent / 100
elsif stype == :mana
self.sp += total = maxsp * percent / 100
end
@damage = @damage - total rescue -total
end
end
class Game_Actor
def kind() :actor end
end
class Game_Enemy
def kind() :enemy end
end
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!
RE: KStatsRefill XP VX & ACE - kyonides - 11-06-2019
Yeah, I've Got a Hidden ACE Under My Sleeve
Well, I came back to make minor changes to the XP and VX versions of my script but guess what? I posted a version for VX Ace as well! 
If there's any bug I might still need to smash to smithereens... Send me a private message then! 
EDIT
I've just found two bugs in VX Ace version but I've fixed them immediately.
|