Backwoods Brawl bugging out?


#1

I decided to head on back to some old replayable levels for fun and gems. This instance is for Backwoods Brawl. For some reason this code does not work and my hero just stands there.

while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.attack(enemy)
    if hero.gold >= hero.costOf("soldier"):
        hero.summon("soldier")
    friends = hero.findFriends()
    for friend in friends:
        hero.command(friend, "attack", enemy)

I don’t see anything wrong. Can anyone help? Thanks! :slight_smile:


#2

I’ve been having problems like this too. I see nothing wrong with this code. The enemy = hero.findNearestEnemy() could be too old and you have to do enemies. Or the level isn’t working properly for your advanced equipment/code.


#3

Ok…
I also decided to do some old levels, but the hero did nothing. I reviewed the code and saw that, thanks to my new gear, the code was “outdated”. Like @BobBobson412 was saying, you might need to update your code to fit you gear like I did :smiley:
Hope this helps!


#4

@BobBobson412 @barboon3 I think I know what you’re talking about since I have Programmaticon V (which is probably overloading the system with things like Math.atan2(y, x) :joy:)


#5

You need different more non outdated code.
For example the past code could be find.NearestEnemy
and the new code is find nearest enemies with a for loop.


#6

I think you may need ("attack")


#7

Try redefining enemy. The hero may be confused if it already killed it.

while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.attack(enemy)
    if hero.gold >= hero.costOf("soldier"):
        hero.summon("soldier")
    friends = hero.findFriends()
    enemy = hero.findNearestEnemy() [or something like that, I'm no expert at Python]
    for friend in friends:
        hero.command(friend, "attack", enemy)

#8

Thank you so much for all the advice! I managed to get up from 4 to 6! :smile:


#9

Congratumalations :smiley: :smiley: :smiley:!!!