Timber guard help

idk this one im confused

while True:
    flag = hero.findFlag()
    enemy = hero.findNearestEnemy()
    
    if flag:
        # Pick up the flag.
        hero.pickUpFlag(flag)
    elif enemy:
        # Only attack if the enemy distance is < 10 meters
        if hero.distanceTo(enemy) < 10:
            hero.attack(enemy)
```thats my code i just tried to kill the hunters

Obviously there are many ways to complete this level, and the way your trying to do it, simply by defending the peasants with just your hero, I think is possible, but your hero has to be very powerful. The point of the level is to help you get used to for loops. The hero collects coins, summons a soldier, and commands it to defend a certain point. If your finding it hard to get your head around for loops, then you could try going back to the previous levels that introduce the concept.

I hope this clears things up a bit.

2 Likes

You tried brute force, but there are 2 mistakes. 1. if hero.distanceTo(enemy) < 10: hero.attack(enemy) will only have your hero attack if an enemy is within 10 meters. 2. Legitimately do it!

You only have to have the burl staff or a bunch of archers to beat this level.

and subscribe before that.

i have 3 answers
1: i sub
2:i dont think i have enogh gemssssahh to buy burl staff
3:i pretty much **** at coding

btw thanks for the advice :slight_smile:

I don’t think really expensive equipment’s necessary, look at @alexbrand on cavern survival or serpentine on multiplayer treasure grove. They did well without a subscription, just the basic heroes. And @ducky,

Since most people don’t have, or can’t get the burl staff, Brenin was showing a way of doing this level which would work for everyone and teach the level’s lessons properly, whether they had a subscription or not.
So just saying: “You only have to have the burl staff”, makes it seem like anyone could have it. But not everyone can.
The same with “or a bunch of archers”, at this point in the campaign, players who are doing this level for the first time won’t have, boss star 2, which allows archers.
Maybe FrostedGaming did have a subscription, but did you know that?
Please don’t contradict a helpful statement with an unhelpful one.
Thanks. :lion:

2 Likes

Thnx) Just a couple of tricks and a little bit of luck)

@FrostedGamingX
I cheked this lvl if I done it. So, yes. My stuff was kinda this

and I think it could be even much more simple. Becouse the main point here is tactics and summoning troops and giving orders for them. Oh, sure, and collecting coins, thus Ring of speed and good boots are helpful items. I did everithing strictly the way it was provided by lvl inctructions.
Good luck!)

1 Like

Listen to Deadpool198: “I don’t think really expensive equipment’s necessary,” You can beat the level simply by defending the peasants and I think the creativeness must be stimulated. But it’s easier to follow first the instructions if you don’t master well some programming tricks.
Alex posted part of his solution and this is mine:


But I don’t understand something: Why the two peasants marked with red circles don’t follow hero’s move instructions?

1 Like

first, you have a lot of gems. second, maybr they’re rebels.

1 Like

Think it could be done to make the level more difficult.
Maybe their team is neutral.

But this is more funny)

No. I ran this:

print( i + ' ' + friend.id + '  ' + friend.team )

and the console displays the name of two culprits:
image

I’m sorry. the ogres kept coming too fast for me.

That’s absolutely fine. :lion:

How many gold do you have right from the start?

I think their behavior strictly coded by level designer. It looks like lvl could be easily win by sending everybody to “x”: 67, “y”: 45 and protecting them by hero himself if he is strong enough. So to prevent it and make player summon troops and use “for”, thees two dummies are hanging and wandering there.

60 gold :rice_ball::rice_ball::rice_ball:

So, you have boss star III and can star the level with summoning 3 soldiers)
Summon them, command troops to protect civilians and tell peasants to go to the safe place (or to collect gold). Follow the instructions literally and you’ll win.
Good luck!)

i already finis it
thanks i just use some glitch hehe