Hello 🙂
I'm trying to make a state : at the end of each turn, the party member with the lowest hp_rate gets healed, with YEP plugins on MV.
So this is how I did it.
State :
There's probably a way to make this work entirely within the <Custom Turn End Effect> but for simplicity's sake I forced an action.
$gameActors.actor(7) is a hidden actor that I use for these kinds of shenanigans so that forcing actions doesn't mess with the real actors' buff turns.
Skill 88 :
I took that code from this thread : https://forums.rpgmakerweb.com/index.php?threads/skill-target-lowest-hp-ally.68287/
Everything seems to work, except for the targetting. It's always the first party member getting healed and not the lowest hp_rate (or even lowest flat HP, which wouldn't be good either).
I seem to be missing something... Could you help me please make the targetting of that skill work ? Or maybe there's an even easier way with something kinda like this in the state ?
What do you think ?
____________________________
EDIT
A friend of mine helped me.
->
(The downside is that enemies won't be able to use it but it's fine by me).
->
I'm trying to make a state : at the end of each turn, the party member with the lowest hp_rate gets healed, with YEP plugins on MV.
So this is how I did it.
State :
Code:
<Custom Turn End Effect>
BattleManager.queueForceAction($gameActors.actor(7), 88, -1);
</Custom Turn End Effect>
There's probably a way to make this work entirely within the <Custom Turn End Effect> but for simplicity's sake I forced an action.
$gameActors.actor(7) is a hidden actor that I use for these kinds of shenanigans so that forcing actions doesn't mess with the real actors' buff turns.
Skill 88 :
Code:
<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>
<target action>
action animation
animation wait: 1
action effect
</target action>
I took that code from this thread : https://forums.rpgmakerweb.com/index.php?threads/skill-target-lowest-hp-ally.68287/
Everything seems to work, except for the targetting. It's always the first party member getting healed and not the lowest hp_rate (or even lowest flat HP, which wouldn't be good either).
I seem to be missing something... Could you help me please make the targetting of that skill work ? Or maybe there's an even easier way with something kinda like this in the state ?
Code:
<Custom Turn End Effect>
var LOWHP%TARGET = SOMETHING SOMETHING TO TARGET THE LOWEST HP% PARTY MEMBER
LOWHP%TARGET.startAnimation(animationID, true, 1);
LOWHP%TARGET.gainHp(healformula);
</Custom Turn End Effect>
What do you think ?
____________________________
EDIT
A friend of mine helped me.
->
allies.aliveMembers()[0]; isn't a thing apparently? So I used $gameParty.aliveMembers()[0];(The downside is that enemies won't be able to use it but it's fine by me).
->
hp_rate isn't a thing either, it's hpRate()... I feel kinda dumb because I've used it before. Now it works. Here's the result for anyone interested, the thread can be closed 🙂
Code:
<Custom Turn End Effect>
var lowestMember = $gameParty.aliveMembers()[0];
for (var i = 1; i < $gameParty.aliveMembers().length; ++i) {
var member = $gameParty.aliveMembers()[i];
if (member.hpRate() < lowestMember.hpRate()) {
lowestMember = member;
}
}
lowestMember.startAnimation(animation id, true, 1);
lowestMember.gainHp(healformula);
lowestMember.startDamagePopup();
lowestMember.clearResult();
</Custom Turn End Effect>