Infinite Loop Help (Backwoods Brawl)

This is my code

hero.toggleFlowers(False)
type = "griffin-rider"
while hero.time < 60:
    # friends, enemy, corpses
    enemy = hero.findNearest(self.findEnemies())
    friends = hero.findFriends()
    corpses = hero.findCorpses()
    cth = 0 # corpse total health
    # just summon stuff
    if self.gold > self.costOf(type):
        self.summon(type)
    if hero.canCast("summon-burl"):
        self.cast("summon-burl")
    if hero.canCast("summon-undead"):
        self.cast("summon-undead")
    for corpse in corpses: # value of raising the dead
        if hero.distanceTo(corpse) < 20:
            cth += corpse.maxHealth
    if hero.canCast("raise-dead") and cth > 500:
        # raise the dead if enough value
        self.cast("raise-dead")
    if enemy and enemy.health > 0:
        for friend in friends: # get all friends to attack the enemy
            if friend.type == type:
                self.command(friend, "attack", enemy)

The error says:
Code never finished. It’s either really slow or has an infinite loop.
I’m using Nalfor.

1 Like

Try while True instead of while time < 60 idk while loops are glitchy

1 Like