Soldier command error


#1
for friend in self.findFriends():
        if friend.type == "soldier":
            enem = friend.findNearestEnemy()
            # If there's an enemy, command her to attack.
            if hero.canCast("sacrifice"):
                soldier = hero.findNearest( hero.findByType( "soldier" ) )
                if hero.health <= hero.maxHealth - 300:
                    if soldier:
                        hero.cast("sacrifice",soldier,hero )
            if enem:
                self.command(friend,"attack",enem)
      

It shows that I can’t command the opposing side’s soldier. How am I commanding the opposing soldier this way?


#2

Well, all I know is that when your opponent uses raiseDead(), necromancer units automatically join the opponent’s team (even if they were on your side while they were alive).


#3

Well, when you use raise dead ability the corpse which got raised goes into your team, not the opponent’s team


#4

Not exactly, raise dead will raise all units, no matter what side they are on. Sorry, i read your post worng, you are right, i was just anwering the worng question.


#5

the error strikes again. this time I lost because I have twilight glasses on which makes me see the other side’s soldiers


#6

I tried your code and it worked fine.


#7

did you do it against someone called Thomas Twinklestar? Now it seems as if the error is coming when I battle him, not anybody else.


#8

No, let me try agianst him. What clan


#9

is Thomas in, to duel him.


#10

You are one of the only people i cant beat, your code is preety good. :grinning:


#11

I get killed again. By Mr-borges this time (The previous ones included Lord Cyber. They aren’t giving me the error anymore, but this is getting ridiculous).