Pet charming problem


#1

Im passing the level with the dead general on the mountain. Anyway, I want to use my pugicorn to charm skeletons, but my code doesn’t work:
def onSpawn():
while True:
skeleton=pet.findNearestByType(“skeleton”)
#if skeleton:
# pet.say(skeleton.health)
if skeleton and pet.isReady(“charm”) and skeleton.maxHealth<=hero.maxHealth:
pet.charm(skeleton)
pet.moveXY(50, 21)
pet.on(“spawn”, onSpawn)

I guess the problem is with my onSpawn function becaouse I put a pet.say(“something”) inside it and it didn’t work. I’d be thankfull for any kind of help.


#2

The skeleton’s health needs to be 1/10 of the hero’s max health


#3

No, the health only needs to be 1/5 of the hero’s health, it’s the only one out of all the pet abilities which does that, but your code works fine with the right amount of health, but you would need 1500 health for it to work against a skeleton. :grin:


#4

I have 4500 health lel


#5

Please read this topic before posting your code, thanks!