I'm looking for a way to make the user target any enemies only if there are no enemies in the same row as the user. Otherwise the user is forced to target that enemy.
Target selection comes to mind to do what im looking for but l have no idea how would l write the javascript condition.
I tried a few things with what you wrote but even if the logic seems right it doesn't seem to work
l put that on my skill as a Custom Select Condition
There are no errors, l just can still target someone else even though there is one enemy in the same row as l am
<Custom Select Condition>
// To obtain the current user's opponent's unit's row X's alive members...
user.opponentsUnit().rowAliveSize(user.row())
// Can replace x with user.row() so if the user is in row 2, it would check the number of alive members in the enemy row 2.
// Equal the above to a variable. So something like...
var rowCheck = user.opponentsUnit().rowAliveSize(user.row());
// So the whole code should be similar to...
if (rowCheck >= 1) {
// This means the opponent's row, which is the same as the user's row, has at least 1 alive member
// Only targets in the same row as the user can be correct selections.
if (target.row() == user.row()) {
condition = true;
}else{
condition = false;
}
} else {
// This means the opponent's row, which is the same as the user's row, has no alive members
// Any target can be correct selections. You can probably just have conditon = true alone here instead of another if statement.
if (target.row() >= 0) {
condition = true;
}else{
condition = false;
}
}
</Custom Select Condition>