Skill target lowest HP ally

Joined
Dec 15, 2014
Messages
91
Reaction score
47
First Language
English
Primarily Uses
RMMV
I'm looking for a way to make a skill only target the ally(ies) with the lowest HP


Any help with this is greatly appreciated.
 

XIIIthHarbinger

Part Time Super Villain
Veteran
Joined
Apr 27, 2014
Messages
676
Reaction score
805
First Language
English
Primarily Uses
RMMV
Yanfly has a plugin that allows a skill to target via parameters that should work fairly well.


I want to say it was called "Selection Control" or something like that. If I am remember correctly it allows you to assign priority based upon parameter levels, by notetags.


That would probably be the easiest way to accomplish what you want.
 
Joined
Dec 15, 2014
Messages
91
Reaction score
47
First Language
English
Primarily Uses
RMMV
I have looked through the selection and targeting plugins by yanfly, but I can't seem to figure out how to achieve the effect. I really just need it for one skill, a heal that targets the two lowest hp members. I think there may be a way to do it with yanflys script but I think I would need to use the lunatic tags and I don't really know anything about how to use them.
 
Last edited by a moderator:
Joined
Dec 15, 2014
Messages
91
Reaction score
47
First Language
English
Primarily Uses
RMMV
I hope i can bump this now... still want to add this skill in. If someone knows how to do this using selection control or targeting plugins lunatic note tags, or could maybe point me in the right direction I would be very grateful. I think this would be a great thing for a lot of games.
 
Last edited by a moderator:

LadyBaskerville

Hell-poodle
Veteran
Joined
Sep 12, 2016
Messages
645
Reaction score
524
First Language
German
Primarily Uses
RMMV
I'll have a look at Yanfly's Target Core. It should be possible with the <Custom Target Eval> lunatic mode notetag, just have to figure out the right way to do it.


This works for targeting the ally with the lowest HP:


<Custom Target Eval>


var lowestMember = allies.aliveMembers()[0];


var lowestHP = lowestMember.hp;


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


var member = allies.aliveMembers();


if (member.hp < lowestHP) {


lowestHP = member.hp;


lowestMember = member;


}


}


targets.push(lowestMember);


</Custom Target Eval>


I'm not sure how to apply the concept to multiple allies, though. Maybe someone with more experience in Javascript can help.


A (rather dirty) workaround could be the following:


Create one skill "Heal lowest" with the above notetag.


Create another skill "Heal lowest twice" (or whatever name you want). This will be the skill the actor uses. No notetag required for this one.


Create a common event that uses the "Force Action" command twice with the "Heal lowest" skill.


Have the "Heal lowest twice" skill call the common event.


Hope that helps a bit :)
 
Last edited by a moderator:
Joined
Dec 15, 2014
Messages
91
Reaction score
47
First Language
English
Primarily Uses
RMMV
@LadyBaskerville thank you, if nothing else I could do a lowest hp only heal skill with this. I think that might be my only option. 


I really want a multi target heal. I didn't want a generic full party heal, and I thought the two lowest hp targets would work well. I will try your workaround, the only problem with that solution is that the same target could be healed twice. 


I'm a little surprised that isn't as doable as I thought...
 

LadyBaskerville

Hell-poodle
Veteran
Joined
Sep 12, 2016
Messages
645
Reaction score
524
First Language
German
Primarily Uses
RMMV
Found a different solution, after spending some more time learning Javascript:


<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>


If there are less than two allies alive, this skill will only heal once.


You can change the 2 in "for (var k = 0; k < 2; ++k)" to a different value if you want to heal more than just two allies with lowest HP.
 
Joined
Dec 15, 2014
Messages
91
Reaction score
47
First Language
English
Primarily Uses
RMMV
Thank you so much, that worked perfectly!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,848
Messages
1,016,974
Members
137,562
Latest member
visploo100
Top