I got that error when an enemy used a <scope: any one> attack. I'm not sure if that is what causes the issue, but I swapped the skill out for a copy without the tag because it was a boss that I didn't want to target itself, and it ended up working.
If that is the case, you can use two copies, one that targets 1 enemy and one that targets 1 ally, and put them both in the enemy's action pattern to get around it.
Another issue I ran into was that when there are dead troop or party members the target indexes get all mixed up. e.g. Bat A is killed. Bat C is selected as target. Spell is cast on Bat B.
I was able to fix this one by adding this function:
Code:
Scene_Battle.prototype.aliveGuys = function() {
var targets = [];
var battlers = BattleManager.allBattleMembers();
for (var i = 0; i < battlers.length; i++) {
var battler = battlers[i];
if (battler.isAlive()) {
targets.push(battler);
}
}
return targets;
}
And then replacing
BattleManager.allBattleMembers() with
Scene_Battle.prototype.aliveGuys() in the following two functions:
Code:
Game_Action.prototype.targetsForAny = function() {
var targets = [];
var battlers = Scene_Battle.prototype.aliveGuys();
if (this.isForAnyAll()) {
// hardcodeonly alive members
for (var i = 0; i < battlers.length; i++) {
var battler = battlers[i];
if (battler.isAlive()) {
targets.push(battler);
}
}
}
else if (this.isForAnyOne()) {
var battler = battlers[this._targetIndex];
// assume we target next friend
var unit = battler.friendsUnit();
targets.push(unit.smoothTarget(battler.index()));
}
return targets;
}
Window_BattleAll.prototype.refresh = function() {
this._enemies = []
var battlers = Scene_Battle.prototype.aliveGuys();
for (var i = 0; i < battlers.length; i++) {
var battler = battlers[i];
if (battler.isAlive()) {
this._enemies.push(battler);
}
}