GolvaeGames

Veteran
Veteran
Joined
Dec 15, 2014
Messages
140
Reaction score
85
First Language
English
Primarily Uses
RMMV
Is there a way to make a skill target the two actors with most missing HP? I got help with a notetag a while back but it only takes current HP into consideration, which means that if I have two party members with 100 Max HP but 75 current HP, and one party member with 50 Max HP, one of the people healed will be the 50 HP actor even though she hasn't taken any damage.

This is the notetag -

<Custom Target Eval>



var members = [];

for (var j = 0; j < allies.aliveMembers().length; ++j) {

members.push(allies.aliveMembers()[j]);

}



for (var k = 0; k < 2; ++k) {

if (members.length > 0) {

var lowestMember = members[0];

var lowestHP = lowestMember.hp;

for (var i = 1; i < members.length; ++i) {

var member = members;

if (member.hp < lowestHP) {

lowestHP = member.hp;

lowestMember = member;

}

}

targets.push(lowestMember);

members.splice(members.indexOf(lowestMember), 1);

}

}



</Custom Target Eval>
 
Last edited:

JGreene

Veteran
Veteran
Joined
Oct 24, 2015
Messages
452
Reaction score
361
First Language
English
Primarily Uses
RMMV
You would have to make a var for the percentage of hp left on each actor.

var hppercent = Math.ceil(member.hp / member.mhp)

A formula like that, but change "member" to your defined var.
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
650
Reaction score
264
First Language
English
Primarily Uses
RMMV
You don't need to do that calculation yourself, MV provides it for you.

JavaScript:
member.hpRate()

You may still want the Math.ceil call.

JavaScript:
Math.ceil(member.hpRate())
 

Latest Threads

Latest Posts

Latest Profile Posts

When you're forced to make a tutorial for something obvious.
246907756_284595507001402_2098549601125689312_n.jpg
one dislike. tragic really ofended me bruh
i only have one decent song and i dont even think it fits for a video game
Update: I finished the combat arena! My goodness, it took a while! There were numerous little bugs to squash.
Maldra wrote on stramin's profile.
Hi regarding the 32 bit -> 64 bit
I am running on a 64 bit windows OS and tried doing this conversion. I converted all of the .exe files that I could find in the KADOKAWA\RPGMV folder using the 4gbpatch.exe file. However, after trying to access RPG Maker MV after this conversion, it simply will not load. Do you have any advice or any ideas?

Forum statistics

Threads
115,932
Messages
1,094,176
Members
151,193
Latest member
Edison0057
Top