I've been doing a bit of searching and I don't think I've found a method to achieve exactly what I want, I can just get pretty close.
I want to use a YEP Target Core <Custom Target Eval> to achieve the following in a skill:
Strike three times, at different targets if possible.
So, some use cases:
- If >= 3 Troop members are alive, target up to three to hit ONCE each.
- If 3 Troop members are alive, hit all three ONCE each.
- If 2 Troop members are alive, hit two ONCE each, and then select one of them as a random target for the third hit.
- If 1 Troop member is alive, this target receives all three hits.
The closest I can get to this, is a little script from Yanfly for Chain Lightning:
^ This one will hit up to 2 other targets, but will not hit the same target more than once if there are less than three targets.
Just to reiterate - I need the skill to hit different targets if it can, but if it cannot, it will strike a previous target (chosen at random) until it has completed 3 hits.
Thanks!
I want to use a YEP Target Core <Custom Target Eval> to achieve the following in a skill:
Strike three times, at different targets if possible.
So, some use cases:
- If >= 3 Troop members are alive, target up to three to hit ONCE each.
- If 3 Troop members are alive, hit all three ONCE each.
- If 2 Troop members are alive, hit two ONCE each, and then select one of them as a random target for the third hit.
- If 1 Troop member is alive, this target receives all three hits.
The closest I can get to this, is a little script from Yanfly for Chain Lightning:
Code:
<Custom Target Eval>
// Adds the selected target to the target list.
targets.push(target);
// Grab the group of alive foes as candidates.
var members = foes.aliveMembers();
// Remove the target from the group of candidates.
members.splice(members.indexOf(target), 1);
// This is the number of extra targets to select with Chain Lightning.
var extraTargets = 2;
// Loop the extra targets.
while (extraTargets--) {
// Grab a random foe from the alive foes.
var member = members[Math.floor(Math.random() * members.length)];
// Check to see if the member exists.
if (member) {
// Add the member to the group of targets.
targets.push(member);
// Remove the member as a viable candidate.
members.splice(members.indexOf(member), 1);
}
}
</Custom Target Eval>
^ This one will hit up to 2 other targets, but will not hit the same target more than once if there are less than three targets.
Just to reiterate - I need the skill to hit different targets if it can, but if it cannot, it will strike a previous target (chosen at random) until it has completed 3 hits.
Thanks!