[SOLVED]Clash of Clones - Help Needed Again

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

Wait a sec, this computer is incredibly slow

@Eric_Tang? You there?

You probably want weaker armour because your clone has the same thing I got to go to bed now

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);
    }
}

even if I do that I get an error. It says “target.say is not a function”

I think the problem is the flags

The flash code works better but still stuck

So weird… the code works now…

Why did it say that though? I never even used say!

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.