[Solved] Sacred grove help


#1
# Don’t let ogres step into the grove.

def onSpawn():
    while True:
        scout = pet.findNearestByType("scout")
        if scout and pet.isReady("charm"):
            pet.charm(scout)

# Assign the event handler to the pet's "spawn" event.
def onSpawn():
    while True:
        ogre = pet.findNearestByType("ogre")
        if pet.isReady("charm") and ogre:
            pet.charm(ogre)
# Fight!
while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.attack(enemy)


#2

Can anyone help? :face_with_raised_eyebrow:


#3

What is wrong? 200000000000000 @Gamestack


#4


#5

ogres got in the forest.


#6

and I need the pet to charm the ogres


#7

You have 2 def on spawns


#8

What should I do with the second one


#9

Do this

def onSpawn():
    while True:
        scout = find scout
        ogre = find ogre
        if pet.isReady charm and ogre or scout:
              charm

#10

I got this @Enderlord832


#11

no do this you just need to charm scouts

def onSpawn():
    while True:
        scout = pet.findNearestByType("scout")
        if scout and pet.isReady("charm"):
            pet.charm(scout)

#12

When i said that i didn’t really mean you to put scout = find scout. I meant you do whatever code to find a scout


#13

do this @Gamestack

def onSpawn():
    while True:
        scout = pet.findNearestByType("scout")
        if scout and pet.isReady("charm"):
            pet.charm(scout)

#14

ok :sunglasses::sunglasses::sunglasses:


#15

ogres still got in. :sob:


#16

what did you put show me your code


#17


#18

That is my code. :sunglasses:


#19

Delete one of them and put

pet.on("spawn", onSpawn)

#20

never mind I got it.