Willibab

The Lord of Whackery
Veteran
Joined
Jun 22, 2017
Messages
247
Reaction score
807
First Language
Norwegian
Primarily Uses
RMMZ
Im looking to make a necrotic healing spell. I have troops instead of health so instead of traditional healing spells i'd like to heal my allies (replenish their troops/raise their dead) based on the targeted enemies lost health (troops). The less health he has the better the healing. I think that would be thematically....ehh....neat :p

This might be a tricky one, but it seems like you guys like a challenge (could be easy for you guys, i can barely manage basic ones xD)

- Target 1 enemy
- Enemy's lost health is divided and healed to allies.

So if an enemy has 100/1000 health left then the healing spell is 900 strong. But divided on allies. and if I have 9 allies then it heals for 100 each.

If its not possible or very difficult then i'd also appreciate an alternative version or something similar.
 

JamesRyan

Game Designer
Veteran
Joined
Sep 13, 2014
Messages
725
Reaction score
235
First Language
Vietnamese
Primarily Uses
RMMV
So you want the damage to apply first to decrease the target's HP, then apply the amount missing health of the enemy as a healing amount to your whole party, right? Well, if you have Yanfly Skill Core, I may have an answer for you. Put the note tag below to your Skill:
Code:
<Post-Damage Eval>
//Get the amount of target's missing health. Round up in case it is a decimal number.
var mhealth = Math.round(target.mhp - target.hp);
// Get the living members of the user's party.
var members = user.friendsUnit().aliveMembers();
// Make an empty group to list affected members.
var affected = [];
// We'll go through each member to check them.
for (var i = 0; i < members.length; ++i) {
// Getting the individual member.
var member = members[i];
// Does the member exist?
if (member) {
   // If the member is affected, add it to the affected group.
    affected.push(member);}}
// Divide up the healing amount by how many members are affected. Round up in case of a decimal number
var heal = Math.round(mhealth / affected.length);
// We'll go through each of the affected members now.
for (var i = 0; i < affected.length; ++i) {
// Getting the individual affected member.
var member = affected[i];
// Let's play animation X on the affected member. X is your animation ID.
member.startAnimation(X);
// The affected member get the hp recover.
member.gainHp(heal);
      // We'll have the affected member reveal a damage popup.
member.startDamagePopup();
// Clear the results of the effect.
member.clearResult();}
</Post-Damage Eval>
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,857
Reaction score
969
First Language
English
Primarily Uses
RMMV
So I'm curious about this:
//Get the amount of target's missing health. Round up in case it is a decimal number.
var mhealth = Math.round(target.mhp - target.hp);
Under what circumstances could this be a decimal number?
 

JamesRyan

Game Designer
Veteran
Joined
Sep 13, 2014
Messages
725
Reaction score
235
First Language
Vietnamese
Primarily Uses
RMMV
So I'm curious about this:

Under what circumstances could this be a decimal number?
I just want to make sure. It can become a decimal if you make use of many damage-alternating plugins like Yanfly Damage Core. I used to have my characters or enemies' HP as a decimal number in that way.
 

Willibab

The Lord of Whackery
Veteran
Joined
Jun 22, 2017
Messages
247
Reaction score
807
First Language
Norwegian
Primarily Uses
RMMZ
Maybe im misunderstanding but your version damages the target first? I was thinking a skill that doesnt damage but only heals an ally based on the enemies lost health. (thematically raising the dead enemy soldiers to fight for you) But I can deffo use this version too, its like a more badass one :p

I tried it with scope to ''1 enemy'' and with and without a damage formula. It either damages the enemy (with formula) or ''has no effect on target'' without.

I feel like im missing something incredibly basic >.<

EDIT: My bad, the pop ups just didnt show up (using Lecode Tactical Battle System). It does heal :p Im using high numbers and didnt notice the difference at first.
 

Attachments

  • Capture.PNG
    Capture.PNG
    113.5 KB · Views: 3
Last edited:

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
632
Reaction score
848
First Language
German
Primarily Uses
RMMV
@Willibab
I think if you want a skill that does not do damage (i.e. no damage formula)
you gotta use <After Eval> instead of <Post-Damage Eval>

something like this:

JavaScript:
<After Eval>
var targets = user.friendsUnit().aliveMembers();
var heal = (target.mhp - target.hp) / targets.length;

for (var i = 0; i<targets.length; ++i) {
targets[i].startAnimation(X);
targets[i].gainHp(Math.round(heal));
}
</After Eval>
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,857
Reaction score
969
First Language
English
Primarily Uses
RMMV
I just want to make sure. It can become a decimal if you make use of many damage-alternating plugins like Yanfly Damage Core. I used to have my characters or enemies' HP as a decimal number in that way.
Huh, I didn't know the Damage Core allowed for decimal damage. But, then, if the user chooses to allow that setting, why decide on your part to change it? Especially since you do it again the very next time you use this variable, so the amount being used is going to be an integer at that point, regardless.

Not that it hurts anything, I was just curious since it seemed extraneous to me and I was wondering if I was actually missing something :smile:
 

JamesRyan

Game Designer
Veteran
Joined
Sep 13, 2014
Messages
725
Reaction score
235
First Language
Vietnamese
Primarily Uses
RMMV
@Willibab Maybe try turning the damage type to none and use what @ScorchedGround suggested? I misunderstood your idea that the skill would do damage to the target first, then heal your party after.

@ATT_Turan it is not that you are missing something. It was just my habit after encountering decimal HP haha.
 

Latest Threads

Latest Profile Posts

Working on a characteeer! (Why is it so hard to color hair?) ;-;
Silly-Sketches.png
Just finished eventing a couple simple puzzles in RMMV, for my very first game "Sample Quest." Just messing around, throwing things together, and calling it a story XD On a non-RM note, got my hair cut today!
I feel the need to inform everyone on the forums NOT to go with Web Hosting Canada for your hosting needs. It is by far the worst customer service and just overall experience I have ever had with hosting and I am Canadian...
BCj
Got another eye surgery monday. Hope I'll recover quick and all's well. A bit tired of surgeries. On a happy note, working on the next chapter of Escalia so hope I can continue soon :)
Celebrating the arrival of autumn in the Northern Hemisphere :)

Forum statistics

Threads
115,368
Messages
1,089,316
Members
150,057
Latest member
kotfwing
Top