[Solved] Sacred grove help

# 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)

Can anyone help? :face_with_raised_eyebrow:

What is wrong? 200000000000000 @Gamestack

ogres got in the forest.

and I need the pet to charm the ogres

You have 2 def on spawns

What should I do with the second one

Do this

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

I got this @Archion

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)

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

do this @Gamestack

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

ok :sunglasses::sunglasses::sunglasses:

ogres still got in. :sob:

what did you put show me your code

That is my code. :sunglasses:

Delete one of them and put

pet.on("spawn", onSpawn)

never mind I got it.