So, I have my code and I don’t seem to really have any errors in my code.
But I’m hesitant to submit it to see if it works, because i have flags in my code…
while True:
item = hero.findNearestItem()
if item:
item = hero.findNearestItem()
hero.move(item.pos)
enemy = hero.findNearestEnemy()
if enemy and hero.canCast("chain-lightning", enemy):
enemy = hero.findNearestEnemy()
hero.cast("chain-lightning", enemy)
while hero.gold >= 50:
hero.consecrate()
hero.buildXY("decoy", hero.pos.x, hero.pos.y)
flag = hero.findFlag()
if flag:
hero.buildXY("fire-trap", flag.pos.x, flag.pox.y)
hero.pickUpFlag(flag)
EnderMarkoth:
()
you need the colour of the flag in quotes. Ex: flag = hero.findFlag("black")
okay. I had that before, but i was told to take it out. Anything else?
no. (20 cahracters with balck flags)
flag = hero.findFlag("black")
if flag:
hero.buildXY("fire-trap", flag.pos.x, flag.pox.y)
hero.pickUpFlag(flag)
so here it is.
should i do anything else…or should i risk it and submit it?
my character does most of what its supposed to.
then gets stuck in a corner and beaten when i just run it…
edited some of the code now.
while True:
item = hero.findNearestItem()
if item:
item = hero.findNearestItem()
hero.move(item.pos)
enemy = hero.findNearestEnemy()
if enemy and hero.canCast("chain-lightning", enemy):
enemy = hero.findNearestEnemy()
hero.cast("chain-lightning", enemy)
while hero.gold >= 50:
hero.consecrate()
hero.buildXY("decoy", hero.pos.x, hero.pos.y)
if enemy and hero.health > 500 :
hero.consecrate()
flag = hero.findFlag("black")
if flag:
hero.buildXY("fire-trap", flag.pos.x, flag.pox.y)
hero.pickUpFlag(flag)
cuz for flags to work you need to press submti to USE the flags
EnderMarkoth:
> 500
and here i think you mean <500?
i know that. do you think my code is good enough to submit now?
so flags are risky. i prefer not using them you dont have to
if enemy and hero.health <= 500 :
hero.consecrate()
im only using the flags to put down a fire trap if there are too many ogres after me to kill one by one.
i think you should just use a sword and find if distance equals this then attack otherwise just get coins
sooo…
if hero.distanceTo(enemy) < 10:
hero.attack(enemy)
else:
return item
will that do instead of flags?
EnderMarkoth:
else:
return item
i dont think you need this
and you need a good weapon
then what do i put for the else?
just…
hero.findNearestItem
hero.move(item.pos)
then i can get the sword on instead of the hammer.