[SOLVED] Underground Business Level Help

Hi, I’m having some trouble with underground business, After I collected 150 coins it stops collecting, so I’m running out of time. This is my Code

# Accumulate 300 gold and escape from the dungeon.

def onSpawn(event):
    # Send the pet to walk around the dungeon:
    coin = pet.findNearestByType("gold-coin")
    if coin:
        pet.moveXY(coin.pos.x, coin.pos.y)
        pet.moveXY(hero.pos.x, hero.pos.y)
    pass
pet.on("spawn", onSpawn)
while True:
    # Guard peasants:
    while True:
        enemy = hero.findNearestEnemy()
        if enemy:
            if hero.canCast("summon-burl", enemy):
                hero.cast("summon-burl", enemy)
            if hero.canCast("raise-dead"):
                hero.cast("raise-dead")
            if hero.canCast("summon-undead", enemy):
                hero.cast("summon-undead", enemy)
            if hero.canCast("fear", enemy):
                hero.cast("fear", enemy)
            if hero.canCast("poison-cloud", enemy):
                hero.cast("poison-cloud", enemy)
            else:
                hero.attack(enemy)
        
    # When you have 300+ gold move to the red mark:
    if hero.gold >= 300:
        hero.moveXY(50, 34)
    pass

Thanks

There aren’t just gold coins in the dungeon. All of the coins & chests are just items. Instead of trying to have the pet move through just the gold coins, and then to the hero, have the pet move through the entirety of the dungeon first and then bring the items to the hero. After that, have the hero (who should be attacking the skeletons in the meantime) escape to the red mark.

Hope that helps,

-@Anna

I tried it like this didnt work :frowning:

# Accumulate 300 gold and escape from the dungeon.
def onSpawn(event):
    # Send the pet to walk around the dungeon:
    item = pet.findNearestItem(item)
    if item:
        pet.moveXY(item.pos.x, item.pos.y)
        pet.moveXY(hero.pos.x, hero.pos.y)
    pass
pet.on("spawn", onSpawn)
while True:
    # Guard peasants:
    enemy = hero.findNearestEnemy()
    if enemy:
        if hero.canCast("summon-burl", enemy):
            hero.cast("summon-burl", enemy)
        if hero.canCast("raise-dead"):
            hero.cast("raise-dead")
        if hero.canCast("summon-undead", enemy):
            hero.cast("summon-undead", enemy)
        if hero.canCast("fear", enemy):
            hero.cast("fear", enemy)
        if hero.canCast("poison-cloud", enemy):
                hero.cast("poison-cloud", enemy)
        else:
                hero.attack(enemy)
        
    # When you have 300+ gold move to the red mark:
    if hero.gold >= 300:
        hero.moveXY(50, 34)
    pass

The mimic pet accumulates gold without moving to it’s exact position. Just use a few moveXY commands to move the pet around the dungeon and back to the hero and it will drag the coins and chests with it.

This isn’t a function.
You could do it moving to the exact item’s position but it would be quite complex, and you definitely shouldn’t move back to the hero inbetween each item because that would take forever.
Danny

1 Like

Thanks for the help but I already figured it out.

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.