And what can I do then?
Code your hero part
with
self.move()
Itās changing but not egouth Can you give me your code???
do you have some other advices?
define
friends = self.findFriends()
for friend in friends:
witch=self.findByType("witch",friends[0].findEnemies())[0]
if witch and witch.health>0:
if friend.type=="paladin" or friend.type=="archer":
hero.command(friend,"attack",witch)
elif friend.type=="soldier":
ogre=self.findByType("ogre",friend.findEnemies())
if ogre:
self.command(friend,"attack",ogre[0])
if friend.type=="paladin":
if friend.canCast("heal") and friend.health<300:
self.command(friend,"cast","heal",friend)
else:
enemy=friend.findNearestEnemy()
if enemy:
hero.command(friend,"attack",enemy)
if friend.type=="paladin":
if friend.canCast("heal") and friend.health<300:
self.command(friend,"cast","heal",friend)
as function command()
modify moving part to the
point2 = { "x" : 37, "y" : 16 }
while hero.distanceTo( point2 ) > 1:
command()
self.move( point2 )
itās not better!! I donāt understand
your code with mod
deleted
my hero died but your say its work for you
my hero also died!!!
modify point1
must help
I change something and now I cont dy
But why have I not win?
move your ally to the exit
oh thanks I donāt see that
I canāt do it !! HELP!!!
start command if no enemy
use same method as for hero
point2 = { "x" : 37, "y" : 16 }
while hero.distanceTo( point2 ) > 1:
self.move( point2 )
use 2 points
first point is corridor corner
second point is exit
for success
enough to bring one to exit
Itās do a bug can you say why?
Here is my new code :
def command():
friends = self.findFriends()
for friend in friends:
witch=self.findByType("witch",friends[0].findEnemies())[0]
if witch and witch.health>0:
if friend.type=="paladin" or friend.type=="archer":
hero.command(friend,"attack",witch)
elif friend.type=="soldier":
ogre=self.findByType("ogre",friend.findEnemies())
if ogre:
self.command(friend,"attack",ogre[0])
if friend.type=="paladin":
if friend.canCast("heal") and friend.health<300:
self.command(friend,"cast","heal",friend)
else:
enemy=friend.findNearestEnemy()
if enemy:
hero.command(friend,"attack",enemy)
else:
point2 = { "x" : 61, "y" : 57 }
while hero.distanceTo( point2 ) > 1:
hero.command(friend,"move",point2)
point2 = { "x" : 78, "y" : 40 }
while hero.distanceTo( point2 ) > 1:
hero.command(friend,"move",point2)
if friend.type=="paladin":
if friend.canCast("heal") and friend.health<300:
self.command(friend,"cast","heal",friend)
while True:
command()
enemy = self.findNearest(self.findEnemies())
if "Trogdor":
hero.cast( "chain-lightning", "Trogdor" )
else:
hero.cast( "chain-lightning", "Rusty" )
point1 = { "x" : 69, "y" : 15 }
point2 = { "x" : 37, "y" : 16 }
while hero.pos.x<69:
command()
self.move( point1 )
while hero.pos.x>37:
command()
self.move( point2 )
for i in range(3):
enemy = self.findNearest(self.findByType("catapult"))
if enemy:
self.attack(enemy)
point3 = { "x" : 37, "y" : 16 }
point4 = { "x" : 78, "y" : 14 }
while hero.pos.x>37:
command()
self.move( point3 )
while hero.pos.x<78:
command()
self.move( point4 )
you command in
loop with condition
without hero action
its friend who must measure distance
else:
point5 = { "x" : 50, "y" : 38 }
while friend.distanceTo( point5 ) > 1:
hero.command(friend,"move",point5)
hero.wait( 0.01 )
point6 = { "x" : 78, "y" : 40 }
while friend.distanceTo( point6 ) > 1:
hero.command(friend,"move",point6)
hero.wait( 0.01 )
Ok thanks I donāt do the wait(0.01)
And with the wait I canātdo it !! Help!
I do it!!!
Congratulations!
It was not easy
for both of us
for different reasons
however