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)
Grzmot
September 2, 2020, 5:49pm
3
Hello Ookboxthegreat and welcome to the forum! Could you please format your code using this button:
Thanks!
AnSeDra
September 2, 2020, 5:49pm
4
Can you format your code as it is described below so we will be able to help you?
Formatting your code before posting code is essential to our community, and if you don’t we might not be able to help Everyone must know how to format ALL of your code properly. It’s really easy and only requires a very small amount of effort.
[Screen Shot 2020-04-04 at 11.55.07]
To post your code from the game , use the </> button or it won’t format properly. When you click the </> button, the following will appear:
[Screen Shot 2020-04-04 at 11.55.36]
Please paste ALL …
Andrei
1 Like
Grzmot
September 2, 2020, 5:57pm
5
@Ookboxthegreat , the problem with your code is this:
You cannot just tell your hero to move to points, because points has no value:
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.
1 Like
Grzmot
September 2, 2020, 8:03pm
7
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
1 Like
Grzmot
September 3, 2020, 6:58pm
10
@Ookboxthegreat Congrats on completing the level! When you have the chance could you please change this topic to solved? Thanks and congrats again!
2 Likes
system
Closed
September 4, 2020, 6:58am
11
This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.