I receive an "Unexpected token { " error, but can’t see what I messed up. I wanted to cleave when the cool down is over and enemies are close, else attack normally. The error points to the “else” line.
var enemy = this.findNearestEnemy();
if (this.isReady("cleave") && this.distanceTo(enemy) < 10) {
this.cleave(enemy);
}
else (enemy) {
this.attack(enemy);
}
I think I know why you put the (enemy) there (though at the wrong place.
It might be that there is no enemy when checking the distance, so you want to if (enemy) {...}.
I keep getting arugmenterror in this code, can someone help pls?
enemy = self.findEnemies()
loop:
if enemy: self.isReady(“cleave”)
self.cleave(enemy)
if self.isReady(“electrocute”):
self.electrocute(enemy)
else:
self.attack(enemy)
self.attack(enemy)