so what level are you on
The one after ring of flowers or two flowers whatever
pic i am in dessert now for some reason my data didnt save
Oh sorry. Also, can someone like @Eric_Tang help me with the reindeer level thing my code:
# Ogres are trying to take out your reindeer!
# Keep your archers back while summoning soldiers to attack.
def pickUpCoin():
# Collect coins.
item = hero.findNearestItem()
hero.move(item.pos)
pass
def summonTroops():
# Summon soldiers if you have the gold.
if hero.gold >= hero.costOf("soldier"):
hero.summon("soldier")
pass
# This function has an argument named soldier.
# Arguments are like variables.
# The value of an argument is determined when the function is called.
def commandSoldier(soldier):
# Soldiers should attack enemies.
enemy = hero.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
pass
# Write a commandArcher function to tell your archers what to do!
# It should take one argument that will represent the archer passed to the function when it's called.
# Archers should only attack enemies who are closer than 25 meters, otherwise, stay still.
def commandArcher(archer):
enemy = hero.findNearestEnemy()
if enemy:
if friend.distanceTo(enemy) < 10:
hero.attack(enemy)
while True:
pickUpCoin()
summonTroops()
friends = hero.findFriends()
for friend in friends:
if friend.type == "soldier":
# This friend will be assigned to the variable soldier in commandSoldier
commandSoldier(friend)
elif friend.type == "archer":
# Be sure to command your archers.
commandArcher(friend)
pass
Which reindeer level i’m pretty sure you don’t need attack or summon code.
The one with the archers something about hunting… hunters and prey
that in hunting party
read this comment you didn’t make the archers stay in place
The archers and soldiers should find the closest enemies to them. If the archer’s distance is less than 25 to the archer’s nearest enemy, then command the archers to attack that enemy.
So, like, I don’t understand what they mean wrap with % or something on this level and my code:
def summonTroops():
type = summonTypes[len(hero.built) % len(summonTypes)]
if hero.gold >= hero.costOf(type):
hero.summon(type)
def commandTroops():
friends = hero.findFriends()
for i in range(len(friends)):
friend = friends[i]
# Use % to wrap around defendPoints based on friendIndex
# Command your minion to defend the defendPoint
while True:
summonTroops()
commandTroops()
That part. (20chars)
You would need to create a variable to find each ally’s point.
defendPoints[friendIndex % len(defendPoints)]
Then command your friends to defend the point.
ok! 20chars exactly.
I would say this is fine as long as you say the level and give a link along with saying when you pass the level @Dragonlouis. but maybe ask @Chaboi_3000 or @Deadpool198.
Like I said before, underneath this line, create a variable like this:
variable = defendPoints[friendIndex % len(defendPoints)]
Then command your friends to defend the variable with hero.command(unit, "action", target)
Ok, now @Eric_Tang I need help with reaping fire. My code:
# The goal is to survive for 30 seconds, and keep the mines intact for at least 30 seconds.
def chooseStrategy():
enemies = hero.findEnemies()
# If you can summon a griffin-rider, return "griffin-rider"
if hero.costOf("griffin-rider") <= hero.gold:
return"griffin-rider"
# If there is a fangrider on your side of the mines, return "fight-back"
if enemy and enemy.type == "fangrider" and hero.distanceTo(enemy) < 36:
return"fight-back"
# Otherwise, return "collect-coins"
else:
return"collect-coins"
def commandAttack():
# Command your griffin riders to attack ogres.
friends = hero.findFriends()
friendIndex = 0
friend = friends[friendIndex]
for friend in friends:
hero.command(friend, "attack", enemy)
pass
def pickUpCoin():
# Collect coins
item = hero.findNearestItem()
hero.move(item.pos)
pass
def heroAttack():
# Your hero should attack fang riders that cross the minefield.
enemy = hero.findNearestEnemy()
hero.attack(enemy)
pass
while True:
commandAttack()
strategy = chooseStrategy()
# Call a function, depending on what the current strategy is.
I don’t understand what they mean “Call a function, depending on what the current strategy is.”