[SOLVED] Noble sacrifice help please

i cant seem to get what

# Use range to make an array to loop over.
# Match the friends to the points and command them to move

means this is my code so far

# Collect 80 gold
while hero.gold < 80:
    item = hero.findNearestItem()
    hero.moveXY(item.pos.x, item.pos.y)
# Build 4 soldiers to use as bait
hero.summon("soldier")
hero.summon("soldier")
hero.summon("soldier")
hero.summon("soldier")
# Send your soldiers into position
points = []
points[0] = { "x": 13, "y": 73 }
points[1] = { "x": 51, "y": 73 }
points[2] = { "x": 51, "y": 53 }
points[3] = { "x": 90, "y": 52 }
friends = hero.findFriends()
# Use range to make an array to loop over.
# Match the friends to the points and command them to move

is there a way so i can use one

hero.summon("soldier")

or no?

@AnSeDra (20 characters)

Sorry, but I can not help you because I am gone at countryside and I will not stay for long in this zone with signal, so I will ask @dedreous and @Deadpool198 to help you. Sorry if I disappointed you!

Andrei

Yes, there is…use a ‘range’. Something as simple as this:

for i in range(4):
    hero.summon("soldier")
1 Like

Try hero.move instead of ``hero.moveXY```

i have to use moveXY or my hero dosent move.

everything is fine i just need to get my troops to move

OK. The last two instructions are:

# Use range to make an array to loop over.
# Match the friends to the points and command them to move

Can you post your code for these, and we can help.

# Collect 80 gold
while hero.gold < 80:
    item = hero.findNearestItem()
    hero.moveXY(item.pos.x, item.pos.y)
# Build 4 soldiers to use as bait
for i in range(4):
    hero.summon("soldier")
# Send your soldiers into position
points = []
points[0] = { "x": 13, "y": 73 }
points[1] = { "x": 51, "y": 73 }
points[2] = { "x": 51, "y": 53 }
points[3] = { "x": 90, "y": 52 }
friends = hero.findFriends()
# Use range to make an array to loop over.
# Match the friends to the points and command them to move

Try to use a for loop to loop over all of the soldiers and command them individually. Would you like a help code on how to do that?

Andrei

yes please i dont think i get it.

Ok. Here it is:

#here make an array of your soldiers called soldiers
for i in range(len(soldiers)):
    #here make soldier soldiers[i]
    #here make pos points[i]
    hero.command(soldier, "move", pos)

Andrei

1 Like

do i need to use this 4 times? or is there a way to get it all in one?

now im just more confused about this

No. Use it only one time.

Andrei

im still really confused

my screen keeps saying soldiers is unidentified

here is my current code

# Collect 80 gold
while hero.gold < 80:
    item = hero.findNearestItem()
    hero.moveXY(item.pos.x, item.pos.y)
# Build 4 soldiers to use as bait
for i in range(4):
    hero.summon("soldier")
# Send your soldiers into position
points = []
points[0] = { "x": 13, "y": 73 }
points[1] = { "x": 51, "y": 73 }
points[2] = { "x": 51, "y": 53 }
points[3] = { "x": 90, "y": 52 }
friends = hero.findFriends()
# Use range to make an array to loop over.
# Match the friends to the points and command them to move
for i in range(len(soldiers)):
    hero.command(soldiers, "move", 51, 53)

Please do what the comments that I gave you tell you to do.

Andrei

my screen saying solders are unidentified still