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
724
Reaction score
234
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,844
Reaction score
965
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
724
Reaction score
234
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
847
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,844
Reaction score
965
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
724
Reaction score
234
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

Lately I have been taking a break from game and resource making so I won't get burnt out. But I am also interested in the Game Jams this site periodically holds. It'd be great if I knew when the next one, if any, is planned.
elexy 1.2.pngSome bust art to be cropped and cleaned. May use in special decision moments. Depending on how it looks in game I may cut it.
Tiamat-86 wrote on ATT_Turan's profile.
apparently since its turning 15 years old this year the ps3 is considered "retro". now how old do you feel?
guess that means im an "antique" gamer since ill still play games as old as i am.
"you know your getting old when your childhood console changes ethnicity" lol it turned yellow
I'm making Toilet in Wonderland 2. and tell vinny about it lol

Forum statistics

Threads
115,346
Messages
1,089,176
Members
150,021
Latest member
Jackitrick
Top