Monsty
December 17, 2020, 4:16am
1
I thought I might revisit Clash of Clones, so I did and tried out a new code. It did not work. It says I have an infinite loop. The screen freezes at a random point. Here’s my code:
while(true) {
var flag = hero.findFlag();
var enemy = hero.findNearestEnemy();
if (flag) {
hero.pickUpFlag(flag);
} else if (enemy) {
hero.attack(enemy);
if (hero.isReady ("flash")) {
hero.flash();
}
}
}
You might want to post your equipment I don’t see anything wrong with your code
Monsty
December 17, 2020, 4:29am
3
Wait a sec, this computer is incredibly slow
You probably want weaker armour because your clone has the same thing I got to go to bed now
Monsty
December 17, 2020, 4:41am
7
I even tried that.
It didn’t work. It says infinite loop.
@Deadpool198 !!
If you have Tauran, try to just flash, consecrate and try to equip the thornprick.
I used your exact equipment and code and it worked fine… Could you post a screenshot of the level screen?
Danny
Try to put the “flash” after the else, so that it flashes first instead of looping over an enemy, put the if enemy after the “flash” in an else
Like this
if (isReady("flash")) {
hero.flash(enemy);
} else {
if (enemy) {
hero.attack(enemy);
}
}
Monsty
December 18, 2020, 2:52am
12
even if I do that I get an error. It says “target.say is not a function”
Monsty
December 18, 2020, 2:54am
13
I think the problem is the flags
Monsty
December 18, 2020, 2:54am
14
The flash code works better but still stuck
Monsty
December 18, 2020, 3:01am
15
So weird… the code works now…
Monsty
December 18, 2020, 3:02am
16
Why did it say that though? I never even used say!
system
Closed
December 18, 2020, 3:03pm
17
This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.