06-24-2016, 11:43 AM
Greetings, companions of RPG Maker XP!
Today, I've developed a small add-on which adds Draining Skills to RMXP, which means that some heroes (and enemies as well!) may recover HPs depending on the damage inflicted to their target. Since this is not a proper script, but an add-on, you must follow those instructions to make them work^^
Instructions
First of all, you need to create an element in the database which will be the one for our draining skills (important!). You can name it as you wish. Then, to set how much percentage of HP will be recovered, (e.g. 50%, 30%...) you must put inside the STR_F field of the skill the proper number (e.g. 50, 30...). Then, check if your BS has a configuration module (you can recognize it by the format "module [name]"). If you have one, just copy this small string inside the configuration module:
If you DON'T have a custom a BS, here's the module:
Be sure to place this module above the Game_Battler scripts
Then, right-click on the list of scripts, and search for the string "def skill_effect(user, skill)" and jump on that page (keep in mind, if you have a custom BS/ABS, you must use its scripts, not the game defaults!)
Scroll some lines down until you find the string "self.hp -= self.damage"
Then, DIRECTY below it, paste this code:
That's it. After you've done all the steps correctly, you can use your draining skills at your wish to recover the desired amount of HPs. Furthermore, as long as you have maximum HP, you won't recover more
Happy making^^
Today, I've developed a small add-on which adds Draining Skills to RMXP, which means that some heroes (and enemies as well!) may recover HPs depending on the damage inflicted to their target. Since this is not a proper script, but an add-on, you must follow those instructions to make them work^^
Instructions
First of all, you need to create an element in the database which will be the one for our draining skills (important!). You can name it as you wish. Then, to set how much percentage of HP will be recovered, (e.g. 50%, 30%...) you must put inside the STR_F field of the skill the proper number (e.g. 50, 30...). Then, check if your BS has a configuration module (you can recognize it by the format "module [name]"). If you have one, just copy this small string inside the configuration module:
Code:
DRAINING_MOVE = 28 # In my case it's the 28th element. Be sure you put the proper number
If you DON'T have a custom a BS, here's the module:
Code:
module Doc
DRAINING_MOVE = 28
end
Be sure to place this module above the Game_Battler scripts
Then, right-click on the list of scripts, and search for the string "def skill_effect(user, skill)" and jump on that page (keep in mind, if you have a custom BS/ABS, you must use its scripts, not the game defaults!)
Scroll some lines down until you find the string "self.hp -= self.damage"
Then, DIRECTY below it, paste this code:
Code:
# Draining Skills
if skill.element_set.include?([yourmodulename]::DRAINING_MOVE) && user.hp != user.maxhp
percentage = skill.str_f.to_f / 100
user.damage = [(0 - [last_hp, self.damage].min*percentage),0].min.to_i
user.hp -= user.damage
end
That's it. After you've done all the steps correctly, you can use your draining skills at your wish to recover the desired amount of HPs. Furthermore, as long as you have maximum HP, you won't recover more
Happy making^^
"Fairies are bad. I had to kill an innocent and fight my own sister to save the world, and they looked at me disgusted and left me dying. Two years later, I was revived and had to sacrifice another innocent with a Dark Ritual to save the world again. That's why I became a Succubus. And I don't regret it"
- The Khaleesi, Queen of Apocalypse and of the Succubi
- The Khaleesi, Queen of Apocalypse and of the Succubi