# \[SOLVED\] Noble sacrifice help please

**URL:** <https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588>\
**Category:** Level Help\
**Created:** [June 27, 2020, 2:03pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588 "2020-06-27T14:03:15Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![098765432123](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/098765432123/32/25850_2.png) [@098765432123](https://discourse.codecombat.com/u/098765432123)\
**Post date:** [June 27, 2020, 2:03pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/1 "2020-06-27T14:03:15Z")

</div>

i cant seem to get what

```python
# 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

```python
# 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

```python
hero.summon("soldier")

```

or no?

---

<div class="post-metadata">

**Author:** ![098765432123](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/098765432123/32/25850_2.png) [@098765432123](https://discourse.codecombat.com/u/098765432123)\
**Post date:** [June 27, 2020, 2:05pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/2 "2020-06-27T14:05:30Z")

</div>

@AnSeDra (20 characters)

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [June 27, 2020, 2:59pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/3 "2020-06-27T14:59:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dedreous](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/dedreous/32/13849_2.png) [@dedreous](https://discourse.codecombat.com/u/dedreous)\
**Post date:** [June 27, 2020, 4:22pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/4 "2020-06-27T16:22:19Z")

</div>

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

```python
for i in range(4):
    hero.summon("soldier")

```

---

<div class="post-metadata">

**Author:** ![FalconX11\_312](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/falconx11_312/32/26330_2.png) [@FalconX11\_312](https://discourse.codecombat.com/u/FalconX11_312)\
**Post date:** [June 27, 2020, 6:55pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/5 "2020-06-27T18:55:02Z")

</div>

> [@098765432123](#):
>
> ```python
> while hero.gold < 80:
> item = hero.findNearestItem()
> hero.moveXY(item.pos.x, item.pos.y)
> 
> ```

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

---

<div class="post-metadata">

**Author:** ![098765432123](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/098765432123/32/25850_2.png) [@098765432123](https://discourse.codecombat.com/u/098765432123)\
**Post date:** [June 30, 2020, 2:04pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/6 "2020-06-30T14:04:44Z")

</div>

i have to use moveXY or my hero dosent move.

---

<div class="post-metadata">

**Author:** ![098765432123](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/098765432123/32/25850_2.png) [@098765432123](https://discourse.codecombat.com/u/098765432123)\
**Post date:** [June 30, 2020, 2:05pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/7 "2020-06-30T14:05:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jka2706](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/jka2706/32/13636_2.png) [@jka2706](https://discourse.codecombat.com/u/jka2706)\
**Post date:** [June 30, 2020, 2:44pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/8 "2020-06-30T14:44:47Z")

</div>

OK. The last two instructions are:

```python
# 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.

---

<div class="post-metadata">

**Author:** ![098765432123](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/098765432123/32/25850_2.png) [@098765432123](https://discourse.codecombat.com/u/098765432123)\
**Post date:** [July 1, 2020, 1:44pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/9 "2020-07-01T13:44:26Z")

</div>

```python
# 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

```

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [July 1, 2020, 1:50pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/10 "2020-07-01T13:50:21Z")

</div>

> [@098765432123](#):
>
> ```python
> # 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

---

<div class="post-metadata">

**Author:** ![098765432123](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/098765432123/32/25850_2.png) [@098765432123](https://discourse.codecombat.com/u/098765432123)\
**Post date:** [July 1, 2020, 1:50pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/11 "2020-07-01T13:50:44Z")

</div>

yes please i dont think i get it.

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [July 1, 2020, 1:55pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/12 "2020-07-01T13:55:40Z")

</div>

Ok. Here it is:

```python
#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

---

<div class="post-metadata">

**Author:** ![098765432123](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/098765432123/32/25850_2.png) [@098765432123](https://discourse.codecombat.com/u/098765432123)\
**Post date:** [July 1, 2020, 1:58pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/13 "2020-07-01T13:58:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![098765432123](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/098765432123/32/25850_2.png) [@098765432123](https://discourse.codecombat.com/u/098765432123)\
**Post date:** [July 1, 2020, 2:00pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/14 "2020-07-01T14:00:09Z")

</div>

now im just more confused about this

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [July 1, 2020, 2:02pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/15 "2020-07-01T14:02:25Z")

</div>

No. Use it only one time.

Andrei

---

<div class="post-metadata">

**Author:** ![098765432123](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/098765432123/32/25850_2.png) [@098765432123](https://discourse.codecombat.com/u/098765432123)\
**Post date:** [July 1, 2020, 2:03pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/16 "2020-07-01T14:03:57Z")

</div>

im still really confused

---

<div class="post-metadata">

**Author:** ![098765432123](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/098765432123/32/25850_2.png) [@098765432123](https://discourse.codecombat.com/u/098765432123)\
**Post date:** [July 1, 2020, 2:04pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/17 "2020-07-01T14:04:30Z")

</div>

my screen keeps saying soldiers is unidentified

---

<div class="post-metadata">

**Author:** ![098765432123](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/098765432123/32/25850_2.png) [@098765432123](https://discourse.codecombat.com/u/098765432123)\
**Post date:** [July 1, 2020, 2:05pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/18 "2020-07-01T14:05:02Z")

</div>

here is my current code

```python
# 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)

```

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [July 1, 2020, 2:06pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/19 "2020-07-01T14:06:01Z")

</div>

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

Andrei

---

<div class="post-metadata">

**Author:** ![098765432123](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/098765432123/32/25850_2.png) [@098765432123](https://discourse.codecombat.com/u/098765432123)\
**Post date:** [July 1, 2020, 2:09pm UTC](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588/20 "2020-07-01T14:09:35Z")

</div>

my screen saying solders are unidentified still

[Next page](https://discourse.codecombat.com/t/solved-noble-sacrifice-help-please/22588.md?page=2)
