[SOLVED] Please help! Summit Gates Error with hero.command()

I have a unknown error and i can’t fix it. When i use hero.command(soldier, “attack”, enemy) i have an error:


Argument error: COMMAND’s argument MINION should have type UNIT, but got OBJECT

code:
codecombaterror2

if you now please tell me

1 Like

Hello, after a quick look, I don’t see any problems with the hero.command() line or the variables linked to it. I’m able to run the code with no problems with the first part of Summit Gates. My only thought is that you haven’t defined the optional units in the .findByType() method (see below). You may be trying to command an enemy archer and you can’t do that. Adding the second optional part will ensure you are only selecting your friendly archers. If you are still having troubles, please post all of the code so we cans see if there are other components that are giving you an issue.

hero.findByType("archer", hero.findFriends())

One extra note, a “griffin-rider” is your friend while the “fangrider” is an enemy.

Below is a link to walk you through how to post the code directly into the forum without a screenshot. This lets others copy/paste your code to debug it in their console quickly.

1 Like

THANK YOU VERY MUCH!!! It works!))) I thoght only I have archers))

1 Like

Glad to help!! :nerd_face: The optional units portion becomes very important during the multiplayer battles where you can have the same type of armies on the both sides.

1 Like

YEEES!


I saw on forum people spent MOTHES to complete it, but I am just 12 years old and i made this for at least 2 hours! I DIDN’T USE FLAGS! But without you i couldn’t understood my error)))

3 Likes

Congrats!! :clap: Great job! It is a long level with some unique challenges. It is a great feeling to complete this one.

1 Like

thanks, i have very grate fillings))

1 Like

Please see my other post about posting solutions.
Danny