my hero keeps getting an error and my soldiers never defend
Send me ur code?
Mumbo_6
What is the error? Also, like @Mumbo_6 said, what is your code? Remember to put 3 backticks before and after your code to format it correctly, like this
.
@GraySkayl007 rather post the link to where @cheddarcheese can see how to post it?
Mumbo_6
Ooooooh, I see, @cheddarcheese is from canada (as you can see in PeterPalovs great topi: [Idea] Illia shieldsmith biography #adventurer)
So @cheddarcheese is asleep right now
Mumbo_6
Umm… if he has a bedtime of 10 pm, then probably.
Lydia
Yea, but it anyways is almost midnight in canada (from my location (Munich, Germany)) ≈ -8 hours
Mumbo_6
it is not 10 it is 9
I don’t know if he is in Central, Mountain, Pacific, or East time zone. So it is 9-10 pm
Lydia
I’m in Canada just saying…
east its east time zone
Ok, can we change this back into a level help topic and not a „Time-zone-arguing“ topic? @cheddarcheese can you send your code (formatted using the </> button)?
Mumbo_6
# Protect the cage.
# Put a soldier at each X.
points = []
points[0] = {"x": 33, "y": 42}
points[1] = {"x": 47, "y": 42}
points[2] = {"x": 33, "y": 26}
points[3] = {"x": 47, "y": 26}
# 1. Collect 80 gold.
item = hero.findNearestItem()
while hero.gold < 80:
hero.move(item.pos)
item = hero.findNearestItem()
# 2. Build 4 soldiers.
for i in range(4):
hero.summon("soldier")
# 3. Send your soldiers into position.
while True:
friends = hero.findFriends()
for j in range(len(friends)):
point = points[j]
friend = friends[j]
enemy = friend.findNearestEnemy()
if enemy and enemy.team == "ogres" and friend.distanceTo(enemy) < 5:
# Command friend to attack.
friend = hero.findFriends()
hero.command(friend, "attack", enemy)
pass
else:
# Command friend to move to point.
hero.command(friend, "move", {"x": 40, "y": 32})
pass
What’s your problem?
Mumbo_6
You may need to define enemy = Friend.findNearestEnemy
Mumbo_6
Also, what’s This: for i in range
And for j in range
?
Mumbo_6
i dont know the level typed it in itself
it says it dosent know what to command
Could you please ask someone else to help for now? I’m kind of busy in school…
Mumbo_6
it says should have typed minion instead got and array