Tundra tower help/problem

In tundra tower, my guardian suddenly freezes when no enemies are around. When they are around it stays that way, can someone help?

Here’s my code for that part

if enemy and distance < 60:
            guard.attack(enemy)
            guard.special("haste")
        else:
            guard.special("roar")

Nvm I think it’s a problem with distance cause removed distance and it’s working fine now

It’s hero.distanceTo(enemy), for future references.

no, it’s guard.distanceTo(enemy), remember it’s Tundra Tower.

1 Like

oh I did hero.distanceTo(enemy) so it didn’t work, ty

Oh right I frgt abt that

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

Hey Moonwatcher348,
I wanted to develop a code in Tundra Tower that can teleport enemies back if they have just recently been teleported from the enemy side at the end x and y coordinates. How would i be able to do that?
Regards

JavaScript:

for (let effect of hero.findActiveAnomalies()) {
    if (effect.name === 'teleport') {
        if (hero.isReady('teleport')) hero.special('teleport', effect.endX, effect.endY);
    }
}

Python:

for effect in hero.findActiveAnomalies():
    if effect.name is 'teleport':
        if hero.isReady('teleport'):
            hero.special('teleport', effect.endX, effect.endY);

(if the Python doesn’t work replace is with ==)

doesn’t work sadly :c

Same it does not work!
@moonwatcher348

It works. At least the javascript does.

Teleport works on a cooldown. If you are in that cooldown, then you wont be able to teleport enemies back.

I mean I had to move a line down for one of the commands for it to work, but the code itself when put into the proper placement works very well.

1 Like

You have to put it in a while true loop
@DeM0n_S

still doesn’t work : ( @moonwatcher348

Works for me :] (20 chars verifies)

Ok it’s working now but for some reason, none of my other effects are working or my yetis are just standing their

hero.on(spawn, guardAct) or something like that should be in your code. Can you make sure it is still there? Also, abilities act on a cooldown. If you want to use your abilities in that you’ll have to incroporate it into the while(true) loop.

hero.on("spawn-guard", defend), not hero.on("spawn", defend)