Oh yeah I forgot its boss star 1
Also you can use
if hero.isReady("envenom"):
hero.envenom(enemy)
No (200000 characters)
while True:
enemy = hero.findNearestEnemy()
item = hero.findNearestItem()
if enemy:
if hero.isReady("throw"):
hero.throw(enemy)
else:
if hero.isReady("envenom"):
hero.envenom()
hero.attack(enemy)
elif item:
hero.moveXY(item.pos.x, item.pos.y)
elif hero.gold > hero.costOf("soldier"):
hero.summon("soldier")
friends = hero.findFriends()
if friends:
for i in range(len(friends)):
friend = friends[i]
enemy1 = friend.findNearestEnemy
if friend:
if enemy1:
hero.command(friend, "attack", enemy1)
else:
hero.moveXY(19, 40)
This is what it says for line 37
while True:
enemy = hero.findNearestEnemy()
item = hero.findNearestItem()
if enemy:
if hero.isReady("throw"):
hero.throw(enemy)
else:
if hero.isReady("envenom"):
hero.envenom()
hero.attack(enemy)
elif item:
hero.moveXY(item.pos.x, item.pos.y)
elif hero.gold > hero.costOf("soldier"):
hero.summon("soldier")
hero.summon("soldier")
hero.summon("soldier")
friends = hero.findFriends()
if friends:
for i in range(len(friends)):
friend = friends[i]
enemy1 = friend.findNearestEnemy()
if friend:
if enemy1:
hero.command(friend, "attack", enemy1)
else:
hero.moveXY(19, 40)
This is my code now, the first soldier that I summon actually moves to fight the skeletons, but for some reason, the rest doesnât.
I can summon archers now, I got the boss star II.
I have the boss star II, but I donât know how to use it. Someone please teach me.
while True:
enemy = hero.findNearestEnemy()
item = hero.findNearestItem()
if enemy:
if hero.isReady("throw"):
hero.throw(enemy)
else:
if hero.isReady("envenom"):
while True:
enemy = hero.findNearestEnemy()
item = hero.findNearestItem()
if enemy:
if hero.isReady("bash"):
hero.bash(enemy)
else:
hero.attack(enemy)
elif item:
hero.moveXY(item.pos.x, item.pos.y)
elif hero.gold >= hero.costOf("archer"):
hero.summon("archer")
friends = hero.findFriends()
if friends:
for i in range(len(friends)):
friend = friends[i]
enemy1 = friend.findNearestEnemy()
if enemy1:
hero.command(friend, "defend", {'x':55, 'y': 48})
else:
hero.moveXY(19, 40)
Iâve now switched to Gordon The Stalwart to see if he is any better, but in this code, I can only summon 1 archer in the very beginning, and I donât collect all the coins.
CAN Anyone, ANYONE help ME! (Iâve been stuck on this level for 100000 Years)
I see a few problems first, your already check if hero.isReady()
but you need to actually use it like hero.envenom()
or something I never used Gordon.
Why is did you put 2 loop delete the first one and add it to the second.
I think it easier to use for loop its easier to use and more manageable, you can do something like this
elif hero.gold >= hero.costOf("archer"):
hero.summon("archer")
friends = hero.findFriends()
for friend in friends:
if friend.type == "soldier":
enemy = friend.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
If you have any more problems feel free to ask!
You forgot to write (If friend):
if friends:
for i in range(len(friends)):
friend = friends[i]
if friend:
enemy1 = friend.findNearestEnemy()
if enemy1:
hero.command(friend, "defend", {'x':55, 'y': 48})
Here is my newest code, sorry for posting so often. In this code, my archers finally attack the enemy. My hero just instantly gets crowded by the skeletons.But I keep dying. Is it my armor and hero, or is it my tactics?
while True:
enemy = hero.findNearestEnemy()
item = hero.findNearestItem()
if enemy:
if hero.isReady("bash"):
hero.bash(enemy)
else:
hero.attack(enemy)
elif item:
hero.moveXY(item.pos.x, item.pos.y)
elif hero.gold >= hero.costOf("archer"):
hero.summon("archer")
friends = hero.findFriends()
for friend in friends:
if friend.type == "archer":
enemy = friend.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
else:
hero.moveXY(57, 24)
hero.moveXY(19, 40)
This is my armor.
Archers are a bit weak for this level IMO. Especially because the rot general has the lightning beam. I would stick to soldiers.
Danny
Ok I will try that!
def commandSoldiers():
if hero.gold >= hero.costOf("soldier"):
hero.summon("soldier")
for friend in hero.findFriends():
if friend.type == "soldier":
enemy = friend.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
def collectCoins():
coin = hero.findNearestItem()
if coin:
hero.move(coin.pos)
hero.moveXY(55, 18)
enemyuser = hero.findNearestEnemy()
if enemyuser:
if hero.isReady("bash"):
hero.bash(enemyuser)
else:
hero.attack(enemyuser)
hero.moveXY(19, 40)
while True:
collectCoins()
commandSoldiers()
enemyuser = hero.findNearestEnemy()
if enemyuser:
if hero.isReady("bash"):
hero.bash(enemyuser)
else:
hero.attack(enemyuser)
My new code, some of my soldiers move but they stop attacking for a while in the middle and start attacking again. Would flags be useful in this level?
Your soldiers probably stop while youâre moving to bash an enemy, maybe remove that part⌠Or move() towards the enemy (not moveXY() which interrupts commands) and once youâre within 2 metres bash them.
Your code works for my wizard so there are no actual errors, from now on itâs just tactics Iâm afraid.
If you could tell me whatâs happening to your hero - how far youâre getting in the level, that would help.
Danny
def commandSoldiers():
if hero.gold >= hero.costOf("soldier"):
hero.summon("soldier")
for friend in hero.findFriends():
if friend.type == "soldier":
enemy = friend.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
else:
hero.command(friend, "defend", {'x':63, 'y':57})
def collectCoins():
coin = hero.findNearestItem()
if coin:
hero.move(coin.pos)
hero.moveXY(55, 18)
enemyuser = hero.findNearestEnemy()
if enemyuser:
if hero.isReady("throw"):
hero.throw(enemyuser)
else:
hero.attack(enemyuser)
hero.moveXY(19, 40)
while True:
collectCoins()
commandSoldiers()
enemyuser = hero.findNearestEnemy()
if enemyuser:
if hero.distanceTo(enemyuser) > 10:
hero.move(enemyuser.pos)
if hero.isReady("throw"):
hero.throw(enemyuser)
else:
hero.attack(enemyuser)
This is my code now, Iâm using Naria
Have you cracked the code @Lydia_Song?
Not yet
def findFlags():
flag = hero.findFlag("black")
if flag:
hero.moveXY(flag.pos.x, flag.pos.y)
hero.pickUpFlag(flag)
def commandSoldiers():
if hero.gold >= hero.costOf("soldier"):
hero.summon("soldier")
for friend in hero.findFriends():
if friend.type == "soldier":
enemy = friend.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
else:
hero.command(friend, "defend", {'x':63, 'y':57})
def collectCoins():
coin = hero.findNearestItem()
if coin:
hero.move(coin.pos)
enemyuser = hero.findNearestEnemy()
if enemyuser:
if hero.isReady("throw"):
hero.throw(enemyuser)
else:
hero.attack(enemyuser)
while True:
collectCoins()
commandSoldiers()
enemyuser = hero.findNearestEnemy()
if enemyuser:
if hero.distanceTo(enemyuser) > 10:
hero.move(enemyuser.pos)
if hero.isReady("throw"):
hero.throw(enemyuser)
else:
hero.attack(enemyuser)
This is my newest code, I added flags so itâll be easier for my hero to move, but after I put a flag down, my hero doesnât even identify the flag nor move to it. Please Help!
Here you define a function to move to the flag. Do you ever use it?
Try to use:
def findFlags():
flag = hero.findFlag("black")
if flag:
hero.pickUpFlag(flag)
hero.remove(flag)