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.

HP Transfer Skill?

Does everyone remember how in RPG Maker 2003 they had things in the skill tab of the database that allowed skills to transfer HP? For example, Player A attacks Enemy A and uses the "Drain" skill. This skill transfers 20 HP from Enemy A to Player A, thus Enemy A lost 20 HP and Player A gained 20 HP.

I've attempted to do this via common events, to no avail. I've also searched everywhere for scripts that allow you to do this. The only script that I've found was by Trickster, however it's old and has disappeared. (like so many other scripts here  :pissed:)

Anyway, if someone knew of any scripts that allowed you to do this, or if it was possible to do this via events, that would be just dandy.  :straightthumb:

Thanks!

(By the way, I wasn't quite sure where to put this, as I wasn't sure if a script had to be used or if could be done with events. If this should be in Script Requests then a mod can move it if they see fit)
 
I reckon you are using RMXP. A very simple way to do this, is to find the line 176 in Game_Battler 3, which should be:
Code:
self.hp -= self.damage
Right below (or above) this line, set the damage to a variable, such as:
Code:
$game_variables[1] = self.damage
This will assign the damage to variable 1. So basically, use this variable to heal the player in the common event, though also another modification is needed, which makes common events get executed AFTER the skill. Basically find the line:
Code:
@common_event_id = @skill.common_event_id
Found in Scene_Battle 4 at line 350. Cut out this line, and paste if after this block:
Code:
    # Apply skill effect
    for target in @target_battlers
      target.skill_effect(@active_battler, @skill)
    end
Now everything should be working perfectly.

Hope this simple modification works.
 
Oops, forgot to specify I was using XP. I'll do that in a sec.

FireRaven, thanks for the tips, I'll try 'em out in a sec.  :thumb:

EDIT: Okay, it works great now, thanks FireRaven. Now I just have to figure out how to make it so the amount of HP taken is actually shown, like in the green numbers it normally does.
 
I think you could easily enough use the Deal Damage handler on Event Page 3. Just make sure that before you do this, take an extra variable, call it Heal Damage. Do the following operation:
Code:
Variable [0002: Heal Damage] -= Variable [0001: Damage]
Deal Damage: 1. Actor, Variable [0002: Heal Damage]
Hope this works.
 

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