Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Infinite Loop Help (Backwoods Brawl)


This is my code

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.costOf(type):
    if hero.canCast("summon-burl"):
    if hero.canCast("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
    if enemy and > 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.


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