Help On Levels In Mountain

um, @abc or @ZAX155 can you help?

my brain has shut down sorry

um… okay?20exactly

why is it smaller it should be bigger

you didn’t define enemy

delete this

check if there’s a item

check if there’s a enemy

also this your just attacking the enemy nomatter what make it so you attack the enemy only if the enemy is on your side of the minefield
it defined strategy as chooseStrategy() so put like ex if strategy == ‘griffin-rider’ that summon a griffin and stuff like that

What happens if the fang rider is past the mine-fields but not this close. Change that so it is checking if the enemy’s position x is less than 38.

Now the munchkins and scouts are blowing up the mines. My code:

# The goal is to survive for 30 seconds, and keep the mines intact for at least 30 seconds.

def chooseStrategy():
    enemies = hero.findEnemies()
    # If you can summon a griffin-rider, return "griffin-rider"
    if hero.costOf("griffin-rider") >= hero.gold:
        return"griffin-rider"
    # If there is a fangrider on your side of the mines, return "fight-back"
    enemy = hero.findNearestEnemy()
    if enemy and enemy.type == "fangrider" and hero.distanceTo(enemy) < 36:
        return"fight-back"
    # Otherwise, return "collect-coins"
    else:
        return"collect-coins"

def commandAttack():
    # Command your griffin riders to attack ogres.
    friends = hero.findFriends()
    friendIndex = 0
    enemy = hero.findNearestEnemy()
    for friend in friends:
        hero.command(friend, "attack", enemy)
    pass
    
def pickUpCoin():
    # Collect coins
    item = hero.findNearestItem()
    if item:
        hero.move(item.pos)
    pass
    
def heroAttack():
    # Your hero should attack fang riders that cross the minefield.
    enemy = hero.findNearestEnemy()
    hero.attack(enemy)
    pass
    
while True:
    commandAttack()
    strategy = chooseStrategy()
    # Call a function, depending on what the current strategy is.
    if strategy == "griffin-rider":
        hero.summon("griffin-rider")
    if strategy == "fight-back":
        heroAttack()
    if strategy == "collect-coins":
        pickUpCoin()

@abc or @Eric_Tang help?

can i have the level link please

ok. just a moment 20

Here it is:
Reaping Fire - Learn to Code in Python, JavaScript, HTML | CodeCombat

thanks i will help you out

are you getting a type error

do what abc said you need to know if the fangriders are past the mines not the distance to them

you didn’t check if their is a enemy either

i think i figured oyt his problem he is getting a type error

delete this
20 charrr

here is error image

Ok! I will do this!!

found out the problem switch those hero.gold and hero.CostOf around

still does not work but i have things i am tring

I’m not sure if this will work. But I did it as I first defined fangrider as None. And then I defined fangrider as my hero’s nearest, hero find by type “fangrider”. And then I check if there is a fangrider and if the fangrider’s x pos is less than 36. And return “fight-back”

I’m not sure if this will work, but I just defined friends (like you’ve done) and then use a for loop to find the nearest enemy to my friend, and check if the friend.type is griffin-rider and command the friend to attack the enemy closest to my friend.

For this, you first need to define itemPos as the item’s pos. And then move your hero to itemPos.

You have to check if there is an enemy, and if the hero.distanceTo(enemy) is less than 30 and if the enemy’s x pos is less than 38.
And then attack.

Lydia