Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

"Raise dead" - Help (SOLVED)

As you know (or not), there is a spell “raise-dead”. It turns nearby corpses to undead that fight on your side. They can’t be commanded though (f.e. you can’t command an undead archer). How do I check if a unit is undead (so I can command it if not)?

1 Like

Hi @xantar, welcome back!
I use this code to avoid that annoying bug:

archers = hero.findByType("archer", hero.findFriends())
corpses = hero.findCorpses()
for archer in archers:
    if not archer in corpses:
    enemy = archer.findNearestEnemy()
        hero.command(archer, "attack", enemy)
    else:
        continue

I hope this solves your problem.
:lion: :lion: :lion:

2 Likes

Thanks! I didn’t know that zombies are in corpses, too.

1 Like

I know! It doesn’t really make sense, but it’s helpful.
:lion: :lion: :lion:

1 Like