[SOLVED] Noble Sacrifice level help

quite confused. I am a wizard in the level noble sacrifice, that shouldn’t affect anything but just putting it on the radar. and It is quite frustrating. I try to command my troops but they just don’t budge. I then get the big X around my character. it says that I have an array instead of a unit, I tried finding the nearest friend (singular) but plural was my only option. here is my code, please help

sincerely: Ookboxthegreat

Collect 80 gold

while not hero.gold >= 83:
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

hero.command(friends, “move”, points)

my code did not look right there, let me try here
while not hero.gold >= 83:
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

hero.command(friends, “move”, points)

Hello Ookboxthegreat and welcome to the forum! Could you please format your code using this button:
image
Thanks!

Hi @Ookboxthegreat and welcome to the forum! :partying_face:

Can you format your code as it is described below so we will be able to help you?

Andrei

1 Like

@Ookboxthegreat, the problem with your code is this:

You cannot just tell your hero to move to points, because points has no value:
image
What you are going to want to do is use a for loop to iterate through points and through your friends, it should look something like this:

For i in range(4):
     (Iterate through friends)
     (Command friends to move to points[i])

Hope this helps!

ok! this is my first time posting. so I did not realize! will do! thanks for helping me out. :grinning:

1 Like

Did you complete the level?

Grzmot, I understand for i in range 4 and points i, but what exactly do you mean by, “Iterate through friends?” what is iterating?

AHA! I figured it out! I finished the level and even completed the bonus! thanks so much yall, you have been very helpful! with all my thanks

Ookboxthegreat :turtle:

1 Like

@Ookboxthegreat Congrats on completing the level! :partying_face: When you have the chance could you please change this topic to solved? Thanks and congrats again!

2 Likes

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.