I thought this would be easy by checking the code to see how the Battle Engine code handles 'this.furthestRight' (this.maxItems() - 1😉 but apparently not.
Is it possible to create a skill that only targets the enemy on the far right side of the screen? Alternatively, attacking only the living enemy with the highest (or lowest) troop ID also works.
If you use Yanfly Selection Control, something like this should work:
<Custom Select Condition>
var unit = target.friendsUnit().aliveMembers();
if (unit.indexOf(target) == unit.length - 1) {
condition = true;
} else {
condition = false;
}
</Custom Select Condition>
Custom select conditions provide you with a "target" object, and you have to say whether said target is valid or invalid.
target.friendsUnit() gives you the troop for enemies and the party for actors, so this should work for either team.
.aliveMembers() gives us a list of only the surviving visible members, and then we store that in "unit" because it's a mouthful otherwise.
So now that we have a list of available targets, we use unit.indexOf(target) to see what position target is at- 0 is the furthest left, so the furthest right is list length - 1 (unit.length - 1).
I haven't tested it myself, so there's a chance something's missing, but it should be pretty close.
Thanks, this works as intended!