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

Clouddrip Mountain-Timber Guard

I looked at other’s codes and this should work, yet it kept saying I can’t command troops to go that coordinate


while True:
# Collect gold.
item = hero.findNearestItem()
if item:
# If you have enough gold, summon a soldier.
if > hero.costOf(“soldier”):
# Use a for-loop to command each soldier.
# For loops have two parts: “for X in Y”
# Y is the array to loop over.
# The loop will run once for each item in Y, with X set to the current item.
for friend in hero.findFriends():
if friend.type == “soldier”:
enemy = friend.findNearestEnemy()
# If there’s an enemy, command her to attack.
if enemy:
hero.command(friend, “attack”, enemy)
# Otherwise, move her to the right side of the map.
hero.command(friend, “move”, 84, 45)

The duck said the place with *** should have type object, but got number.

Howdy and welcome to the forum. Please post you code properly formatted…you can learn how here: [Essentials] How To Post/Format Your Code Correctly

That being said, the problem looks to be with your final .command statement. If you read the resulting error message closely, it pretty much tells you how to fix it:

like this?

hero.command(friend, “move”, {84, 45})

the duck then said "don’t know how to transform: Set "

try {“x”: 84, “y”: 45} instead