Can someone help me to fix this error. I want to be able to teleport the enemies if they are within the range of 7 coordinates from HERO. Else the code should pull then bust at the coordinates (14, 52)
when you define a function you do something like this:
def function(argument1, argument2):
stuff()
not
def function('argument1', 'argument2'):
stuff()
Could you be so kind to like write the whole code because i am still confused of what to do
He’s saying remove the quotes around enemy.
yes :] (20 chars says I’m correct)
So my code is fine but i just need to remove the quotes to make it work?
yep (20 chars agrees)
Hello,
what shall I code if the opponent has teleported enemies to your base and you want to teleport it back at that exact time. Please could you be so kind to help.
I have been struggling on this code for the past 2 days
@moonwatcher348
Anomalies have their cooldown, so if you want to make pull/burst/teleport work you need write something like this:
if hero.isReady("burst")
hero.special("burst", 14, 52)
Also, what do you mean by 'enemy' <7
? Enemy is not a number, it’s an object. Do you want to find the distance to enemy or the number of enemies?
Could you write the whole code as it is sooo hard!
Okay, then you need to write this:
if enemy and hero.distanceTo(enemy) <7:
if hero.isReady("teleport")
hero.special("teleport", 14, 52)
By the way, don’t forget to determine the enemy in the beginning.
Something like this before i enter the code?
if enemy and guard.distanceTo(enemy) < 7:
if hero.isReady("teleport")
hero.special("teleport", 14, 52)
remember, guard
, not hero
guard.findNearest(enemies)
Put all that in a while true loop.
You need isReady for pull and burst as well as teleport.
If you want to write hero find nearest enemy, you need to write a function for that. If you do not want to do that, you should use guard’s nearest enemies.
Sorry for the inconvenience but i have defined the guards but they do not seem to move. I have written the exact code from the start and my guards remain stationary. Could you be so kind to help?
Are you still facing the same problem?