Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Healing SP

Code:
class RPG::Skill
  # Percent: skill_id => percent (skill 5 - 10% would be 5 => 10)
  SP_Recovery_P = {}
  # Direct
  SP_Recovery_D = {}
  [SP_Recovery_P, SP_Recovery_D].each {|c| c.default = 0}
  def sp_recovery_p
    return SP_Recovery_P[@id]
  end
  def sp_recovery_d
    return SP_Recovery_D[@id]
  end
end

class Game_Battler
  alias_method :seph_skillsprec_gmbtlr_se, :skill_effect
  def skill_effect(user, skill)
    result = seph_skillsprec_gmbtlr_se(user, skill)
    if result
      if skill.sp_recover_p > 0
        self.sp += Integer(self.maxsp * (skill.sp_recover_p / 100.0))
      end
      if skill.sp_recover_d > 0
        self.sp += skill.sp_recover_d
      end
    end
    return result
  end
end

That should do the trick. :)
 
:3

---------------------------
Whisper of a Rose
---------------------------
Script 'SP Recovery Skills' line 11: NameError occurred.

uninitialized constant RPG::Skill::SP_RecoverD
---------------------------
OK   
---------------------------

Edit: Had to change SP_RecoverD into SP_Recover_D. Now it doesn't work, though. Maybe I'm using it wrong. I have a skill set to One Ally target, 0 power, and then:
SP_Recover_D = {skillID(112) => 150}
But it just calls out MISS. ^^;

Edit2: Okay, so I changed 0 power to -90, and now it restores HP -and- SP. XD But instead of also showing the little # pop-up for the recovery of SP, it only pops up for the HP. Whilst with regular SP recovering ways, like Elixers, the little # pop-up for SP does..well, pop up. Tsk tsk, Seph, you should have known as you have all my scripts. =p
 
Code:
class RPG::Skill
  # Percent: skill_id => percent (skill 5 - 10% would be 5 => 10)
  SP_Recovery_P = {}
  # Direct
  SP_Recovery_D = {}
  [SP_Recovery_P, SP_Recovery_D].each {|c| c.default = 0}
  def sp_recovery_p
    return SP_Recovery_P[@id]
  end
  def sp_recovery_d
    return SP_Recovery_D[@id]
  end
end

class Game_Battler
  alias_method :seph_skillsprec_gmbtlr_se, :skill_effect
  def skill_effect(user, skill)
    result = seph_skillsprec_gmbtlr_se(user, skill)
    if result
      d = 0
      if skill.sp_recover_p > 0
        d += Integer(self.maxsp * (skill.sp_recover_p / 100.0))
      end
      if skill.sp_recover_d > 0
        d += skill.sp_recover_d
      end
      self.sp += d
      if d > 0
        self.damage = d
      end
    end
    return result
  end
end

Sorry I missed the bump.

That should add the sp to the damage display as well. However if it recovers both hp and sp, it will just show the sp recovery. To fix this, you can use my multiple damage script. Actually, that will but won't. I need to make an adjustment to it. It'll be in the next MACL, but I will post it here as soon as I update it.
 
^

Okay, thanks. ^_^ I don't need HP + SP recovery, though. I'll leave that to the standard stuff like items. =) Thanks~~

Edit: Haha, Seph, do you actually test that script? Some defs aren't named the same. Fixed it up, and checking to see if it works now. ^^

Edit2: I get this error:

---------------------------
Whisper of a Rose
---------------------------
Script '    Connected Attacking Ver1.02' line 271: TypeError occurred.

cannot convert Game_Actor into Integer
---------------------------
OK 
---------------------------

You have my scripts, so.. :s
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top