Main Menu
  • Welcome to The RPG Maker Resource Kit.

Skills that cost HP

Started by modern algebra, February 25, 2008, 01:05:53 PM

0 Members and 1 Guest are viewing this topic.

Armisael191

Hey Modern Algebra, just wanted to say that I can't seem to get this script functioning with Tankentai. I've tried placing this script into a fresh download of the SBS, changed the script to have a skill take 40% of my maximum HP, and when I use the skill, it kills the user.

I was attempting to make an attack that Drained his health and healed all the allies.

I made another attack that damaged all enemies and drained 10% of his Maximum HP, and it took way more than 10%. I've tried placing the script, above, below, all around and upside down in my list of scripts, and still doesn't seem to work. Any idea? I love this script and have a character in my RPG completely based around his skills functioning like this. I'm also not a complete newbie when it comes to editting scripts and customizing them a bit, so I do not think that is the issue. You placed a pretty easy to follow example in the script itself.

modern algebra

#26
Hmm, it looks like it might not have anything to do with tankentai - just a straight up logic error - totally my fault. I'll fix it.

EDIT::

Alright, I did a quick and messy "fix" and it is now in the first post. It should fix the initial problem, which was that I was subtracting the HP every time the skill hit a target. So 3 targets meant 120% instead of 40%. However, I haven't tested the new fix so I might have screwed up with syntax or any other number of reasons it's dumb not to test things.

Also, now it really might not be compatible with Tankentai, as I directly alias a method in Scene_Battle, which may operate unexpectedly now. So test it out in a new project and see if everything is dandy before putting it in your main project. If I created an incompatibility or created a new error, just let me know and I will address the problem more fully once I have time.

Armisael191

Here is the error that I receive now. The skill fires off, but when it goes to calculate the HP done, this happens. I don't actually see the HP get subtracted.



Uploaded with ImageShack.us

modern algebra

Sorry, dumb mistake. I have again updated the first post so try it again.

Breezer226

Getting a similar problem to the guy above. The HP is subtracted after the skill is used, but then I get this error and the game crashes.


modern algebra

Are you using a non-default battle system? Either way, you might be able to fix it by replacing:


class Scene_Battle
  #--------------------------------------------------------------------------
  # * Execute Battle Action: Skill
  #--------------------------------------------------------------------------
  alias mala_hpcost_excut_skill_6yh1 execute_action_skill
  def execute_action_skill (*args)
    mala_hpcost_excut_skill_6yh1 (*args)
    basic, percent = @active_battler.action.skill.hp_cost
    @active_battler.hp -= ((percent*@active_battler.maxhp).to_i + basic)
  end
end


with:


class Scene_Battle
  #--------------------------------------------------------------------------
  # * Execute Battle Action: Skill
  #--------------------------------------------------------------------------
  alias mala_hpcost_excut_skill_6yh1 execute_action_skill
  def execute_action_skill (*args)
    mala_hpcost_excut_skill_6yh1 (*args)
    return if !@active_battler || !@active_battler.action || !@active_battler.action.skill
    basic, percent = @active_battler.action.skill.hp_cost
    @active_battler.hp -= ((percent*@active_battler.maxhp).to_i + basic)
  end
end

Breezer226

Ah, that took care of it. Thanks. I was using the Tankentai Side View System, which may have caused the problem. But that code took care of it.

kathy

How do I set up the displayed cost for a skill? To have either the text be misleading or have a skill cost both MP and HP is very annoying.