Replace your vector subtract line with
vector = Vector.subtract(enemy.pos, hero.pos)
and you have to do vector.y vector.x not vector.y vector.y
Replace your vector subtract line with
vector = Vector.subtract(enemy.pos, hero.pos)
and you have to do vector.y vector.x not vector.y vector.y
should be this
radians = Math.atan2(vector.y,vector.x)
and not this
radians = Math.atan2(vector.y,vector.y)
Now I’m stuck on kelvintaph crusader
# You can find friends through walls, but not enemies.
# Watch out for smooth, frictionless ice patches!
while True:
enemy = hero.findNearestEnemy()
friends = hero.findFriends()
flag = hero.findFlag("green")
for friend in friends:
witch = friend.findNearest(hero.findByType("witch"))
enemy = friend.findNearestEnemy()
if enemy:
if friend.type == "paladin" and witch:
hero.command(friend, "attack", witch)
elif friend.type == "paladin" and enemy:
hero.command(friend, "shield", friend)
else:
if friend.pos.x < 42:
hero.command(friend, "move", {'x': 42, 'y': 58})
elif friend.pos.x < 56:
hero.command(friend, "move", {'x': 38, 'y': 56})
else:
hero.command(friend, "move", {'x': 78, 'y': 40})
if enemy:
ogre = hero.findNearest(hero.findByType("ogre"))
if ogre and hero.canCast("chain-lightning"):
hero.cast("chain-lightning", ogre)
elif flag:
hero.pickUpFlag(flag)
is my code. The ogres die alright but when it’s time for chain-lightning 2 my hero stays in place. HELP!
You don’t attack and what if your friend type is not paladin what are they going to do
ah, well, the ogres die ok. And the friends auto-attack too. I just need the paladin to target the witch, and be a shielding decoy.
It’s the chain-lightning. After 20.75 secs my hero just stays there. Doesn’t move.
You dont need the paladin to do this
you can just command your paladin to move to the x spot and use your other troops as bait
Not fast enough. Killing the enemies is more important. My archer is stuck.
use flags for your friends too.
maybe command your archer too
see look it works for me
I just commanded the paladin to heal self and to move to the x
My friends aren’t attacking. It’s kelvintaph burglar. @Eric_Tang help?
# What eldritch artifacts are these? Don't let them blast you!
# The ice gate will open when both ogres are defeated.
points = 0
while True:
flag = hero.findFlag("green")
friends = hero.findFriends()
enemy = hero.findNearestEnemy()
for friend in friends:
if hero.isPathClear(friend, enemy) and enemy.type != "ice-yak":
hero.command(friend, "attack", enemy)
elif points == 0:
hero.command(friend, "move", {'x': 26, 'y': 50})
points += 1
elif points == 1:
hero.command(friend, "move", {'x': 53, 'y': 50})
points += 1
else:
hero.command(friend, "move", {'x': 78, 'y': 40})
if flag:
hero.pickUpFlag(flag)
Post your code please
Just delete the is pathClear part.
Add also try to use flags for your friends its not easy but possible.
# What eldritch artifacts are these? Don't let them blast you!
# The ice gate will open when both ogres are defeated.
points = 0
while True:
flag = hero.findFlag("green")
friends = hero.findFriends()
enemy = hero.findNearestEnemy()
for friend in friends:
enemy = friend.findNearestEnemy()
witch = hero.findNearest(hero.findByType("witch"))
if enemy and enemy.type != "ice-yak":
if witch and friend.type == "paladin":
hero.command(friend, "attack", witch)
hero.command(friend, "attack", enemy)
elif points == 0:
hero.command(friend, "move", {'x': 26, 'y': 50})
points += 1
elif points == 1:
while points == 1:
hero.command(friend, "move", {'x': 54, 'y': 38})
points += 1
else:
hero.command(friend, "move", {'x': 78, 'y': 40})
if flag:
hero.pickUpFlag(flag)
Try to do flags instead of points.
There’s trig in glacier!!