Bombing run help in kelvintaph glacier

hi everyone I need help in bombing run as well as kenvintaph defiler and kenvintaph burgler in kenvintaph glacier and the trials in sarven desert

2 Likes

Hi Code,

Welcome to the forum!

We’re really happy to help. Can you post the code that you’ve written (instructions on how to format it are at [Essentials] How To Post/Format Your Code Correctly), and a bit of information on what is not working/error messages that you’re getting.

It’s probably easier if you get help with one level at a time. I found on the Glacier I quite often needed to spend a few days on each level. Maybe have a go at solving problems for each of them and post your code if you need more help.

2 Likes

but i don’t want to do it but thanks for your help!

1 Like

You don’t want to try and beat the level? If so, I’m afraid we can’t help you. We don’t give solutions on this forum.
Danny

2 Likes
while(true) {
    var enemy = hero.findNearestEnemy();
    if(enemy) {
        // Find the vector of attack
        var ogreAttack = Vector.add(enemy.pos, hero.pos);
        // Use trigonometry to find the the angle in Radians!
        var degrees = Math.atan2(enemy.pos, hero.pos);
        // The answer must be in Degrees!
        var rad = degrees * (180 - Math.PI);
        // To convert Radians to Degrees multiply by (180 / Math.PI)
        
        // Say the angle!
        hero.say(rad);
    }
}

1 Like

and this too in kelvintaph defiler rhat was for bombing run

# Your hero can't do anything besides command and move without angering the warlocks.
# Beware ice, robots, traps, antigravity fields, and other dark magic.
# Somehow, you'll need to defeat Nalfar and save your paladin.
# The great treasure of Kelvintaph awaits your victory.
def commandPaladin(paladin):
    if hero.time >= 2:
        if paladin.canCast("heal") and paladin.health < paladin.maxHealth * 0.7:
            hero.command(paladin, "cast", "heal", paladin)
        else:
            hero.command(paladin, "shield")
    

def commandArcher(friend):
    if step == 1:
        enemy = friend.findNearestEnemy()
        if enemy and enemy.type != "yeti":
            hero.command(friend, "attack", enemy)
    elif step == 2 and friend.id == "Mirana":
        hero.command(friend, "move", {"x":9, "y":77})
    elif step == 2:
        hero.command(friend, "move", {"x":28, "y":49})

    
def commandSolider(friend):
    if hero.time >= 3:
        if hero.time <= 7:
            hero.command(friend, "move", {"x":21, "y":73})
        elif hero.time <= 9:
            enemy = friend.findNearestEnemy()
            if enemy and enemy.type != "yeti":
                hero.command(friend, "attack", enemy)
        elif hero.time == 10:
            step = 2
    elif step == 2:
        hero.command(friend, "move", {"x":24, "y":66})

def commandAllies():
    friends = hero.findFriends()
    for friend in friends:
        if friend.type == "paladin":
            commandPaladin(friend)
        elif friend.type == "archer":
            commandArcher(friend)
        else:
            commandSolider(friend)
step = 0
hero.move({"x":32, "y":17})

#hero.cast("invisibility", hero)
while True:
    if hero.time <= 1:
        step = 1
    commandAllies()
`
1 Like

and enter all of the code in preformatted text please

1 Like

Two things. Firstly:

You’re trying to find the difference between the enemy position and the hero position. This line needs one word changed in it.

Secondly:

var degrees = Math.atan2(enemy.pos, hero.pos);

You’re trying to find the atan2 of two components of ‘ogreAttack’. What should these be?

1 Like

aye aye ok fine i’ll do that

1 Like

hmm…i don’t understand

1 Like

I know its subtract instead of add

1 Like

the second one i don’t know

1 Like

So, to start off with, what is ogreAttack currently? I think it’s a pos (hopefully you agree). What components does a pos have? You’ve used them before. Make sure you read the hints as well for an important detail (the order of the components is not what you might think (if I remember the level correctly)).
Danny

2 Likes

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.