Underground Business: I need help please


#1

Can you help me please because I don’t know how to get the pet move to my flag and here is my code

# Accumulate 300 gold and escape from the dungeon.

def onSpawn(event):
    # Send the pet to walk around the dungeon:
    flag = hero.findFlag("green")
    flag = pet.findNearestByType("green")
    if flag:
        pet.moveXY(flag.pos.x, flag.pos.y)
        pass

pet.on("spawn", onSpawn)
hero.cast("summon-undead")
hero.cast("summon-burl")
while True:
    # When you have 300+ gold move to the red mark:
    if hero.gold == 300:
        hero.moveXY(50, 34)

#2
flag = pet.findNearestByType("green")

The type is “flag”.

You should use loop inside onSpawn or it will be one time event.


#3

If that is a little confusing what @htrnblr is trying to say is that in findNearestByType, there is no object called green. But you can find the nearest flag by type by inserting “flag” inside the brackets.


#4

Thank guy.:slightly_smiling_face: