Beta Test "Tundra Cup" Arena

targetAnomaly = None
anomalies = hero.findActiveAnomalies()
for anomaly in anomalies:
    if anomaly.type == "teleport":
        targetAnomaly = anomaly
if targetAnomaly:
    hero.special("burst", targetAnomaly.endX, targetAnomaly.endY)

this would find any teleport anomalies (including your own! so watch out for that) and do a burst right where they end.

Thanks for the example!
This really helps me. Thanks very much! :slight_smile:

What username are you in CodeCombat? You are so pro at coding! I still couldn’t figure out how can detect if someone is teleporting. Can I detect forever throughout my code? Thank you for your explanation. Have a good day! :slight_smile: :slight_smile:

@Luke_Crawford where would we put that in our code cause it doesn’t work for me like would I put it before after or during my code.

@Chadder You would have to run it constantly to detect any new anomalies

1 Like

@Luke_Crawford Thanks so much!

Whenever I add this code to mine it doesn’t work like when I put it after every other line even if there is a teleport it doesn’t work

it works for me when I replace my current anomaly code. Are you putting it in between build commands? When you try to build a tower but don’t have enough mana, the hero will wait until you have enough mana, but it will remain idle and not execute any commands.

It did not work for me too

I peeked into Tower.attackCooldown but it says its undefined

But oh well didn’t realize its in the docs anyway, not really important to fix

Wait so If I put it between like

Hero. build, "Mage", 32, 51)

It wont work

It has to be in your own squares (the red ones on the left)

Oh, by the way, here’s something I noticed.
If you are having your guards cross the gap when you don’t want them to, try to put a distance cap on what enemies they’ll attack.
Something kind of like:

if(guard.distanceTo(guard.findNearestMonster())<30){
    guard.attack(guard.findNearestMonster());
}

No we were talking about the anomaly code like if I were to but that and it used all my mana the code for the anomaly wouldn’t work.

nope. It will check only just after it is done building that tower, then it will wait for the next one

so how do i get it to always be checking for that anomaly

I used while loops in between every build command, and ran the anomalies code until there was enough mana to get another tower.

So I would do like

Hero. build "Mage", 32, 51)

then I would repeat the anomaly code then I would do it till I see there is enough mana then do build next tower.

:+1: that should do it!

1 Like