Save-Point
KStatsRefill XP - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker XP (RGSS) Engine (https://www.save-point.org/forum-116.html)
+---- Thread: KStatsRefill XP (/thread-7573.html)



KStatsRefill XP - kyonides - 11-05-2019

KStatsRefill XP

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). Shocked
Why!? Happy with a sweat Well, Confused that might be because your monsters are kind of resistant to magic!? Laughing Just go pick an excuse and make your game different from any other games uploaded to the net! Laughing + Tongue sticking out  

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

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! Laughing + Tongue sticking out


RE: KStatsRefill XP VX & ACE - kyonides - 11-06-2019

Yeah, I've Got a Hidden ACE Under My Sleeve
Laughing

Well, I came back to make minor changes to the XP and VX versions of my script but guess what? Happy with a sweat I posted a version for VX Ace as well! Shocked

If there's any bug I might still need to smash to smithereens... Confused Send me a private message then! Laughing + Tongue sticking out

EDIT

I've just found two bugs in VX Ace version but I've fixed them immediately.