Welcome to the forum @kayden4444 let’s see if I can help you…
first of all can you post your code?
yes
// This shows how to define a function called cleaveWhenClose
// The function defines a parameter called target
function cleaveWhenClose(target) {
if(hero.distanceTo(target) < 5) {
// Put your attack code here
// If cleave is ready, then cleave target
var ready = hero.isReady(“cleave”);
hero.cleave(enemy);
// else, just attack target
!
else {
hero.attack(enemy);
}
}
}
// This code is not part of the function.
while(true) {
var enemy = hero.findNearestEnemy();
if(enemy) {
// Note that inside cleaveWhenClose, we refer to the enemy
as target
.
cleaveWhenClose(enemy);
}
}
my bad
I am new sorry
can you do this? 20000 char
and can you send me the link?
// This shows how to define a function called cleaveWhenClose
// The function defines a parameter called `target`
function cleaveWhenClose(target) {
if(hero.distanceTo(target) < 5) {
// Put your attack code here
// If cleave is ready, then cleave target
var ready = hero.isReady("cleave");
hero.cleave(enemy);
// else, just attack `target`!
else {
hero.attack(enemy);
}
}
}
// This code is not part of the function.
while(true) {
var enemy = hero.findNearestEnemy();
if(enemy) {
// Note that inside cleaveWhenClose, we refer to the `enemy` as `target`.
cleaveWhenClose(enemy);
}
}
The link of what???
If you mean the link of codecombat I am using the app.
CoCo has an app? 20 char
yay for chrome. it’s nice and and good to see what they have me do.
then what world is it? (kithgaurd dungeon etc.)
of it’s backwoods forest level 15.
ok lets see 20 characters
Here’s the link: https://codecombat.com/play/level/leave-it-to-cleaver
your first problem is
It shouldn’t be a variable it should be an If
function cleaveWhenClose(target) {
if(hero.distanceTo(target) < 5) {
// Put your attack code here
// If cleave is ready, then cleave target
if (enemy) {
var ready = hero.isReady("cleave");
hero.cleave(enemy);
}
// else, just attack `target`!
else {
hero.attack(enemy);
}
}
}
it still won't let me attack the ogres
no it should be 20 char
if hero.isReady("cleave");