# Kelvintaph Burgler chieftain too strong

Like the title says. I can get my allies past the yak without taking damage, but the chieftain kills them before I can get more than 1 heal off from my paladin. Even if the paladin is defending, he dies in 3-4 hits. Even if I damage the chieftain, the witch heals him. If I go for the witch first, the chieftain kills everything before the witch dies. Has anyone beat this level without purchasing power up items?

Hereâ€™s a tip: The Chieftainâ€™s attack is area of effect. And a Yak attacks anything that attacks it. So if you send in a unit and the Chieftain goes for itâ€¦you we where Iâ€™m going here?

thanks, I wondered if that would do it. having the paladin is kind of a red herring I suppose, donâ€™t even need him to heal or do anything other than attack the witch after the yak kills the chief.

i beat the level but i had another question, one iâ€™ve been trying to figure out for a few days now: is there a way to dodge incoming missiles without having a goal vector? like, in burgler i dodged the missiles by having my avatar constantly moving between two goal vectors while avoiding the missile vectors, and in the prior level (yak dodging) my avatar would dodge yaks while constantly moving towards the end goal. How can you dodge stuff without having a goal in mind? Is there a way to dodge with vectors while standing still?

I used `distanceTo` to detect the projectile, then moved up or down depending on how close I was to either wall. Thatâ€™s one way without using vectors.

You actually use vectors without knowing it

The key is to take the direction in which the thing to avoid moves, then rotate it by Math.PI/2 (thatâ€™s 90 deg) to get the sidestep direction. Move in the sidestep direction.

If the thing to avoid moves horizontally, then you will sidestep vertically without realizing you had to compute a vectorial rotation.

1 Like

there we go, thatâ€™s what i was looking for. so how do you rotate the vector 90 degreesâ€¦ do you use Vector.multiply(avoidThingVect, Math.PI/2)â€¦ nah that wouldnâ€™t work would itâ€¦ but how else would you multiply the vectorâ€¦ is there a math function that does it?

``````my_rotated_vector=my_vector.rotate(Math.PI/2);
``````

Remember that all vectors are considered starting from origin. To get position from a vector you must replace the origin with your origin position:

``````position_to_go=direction.add(my_current_position);
``````

Therefore:

``````//missiles have a constant speed and they go forever until they hit something
//You must write your isMissile function. Look if the projectile's type
//or if it has a defined targetPos
if (isMissile(projectile))
direction=projectile.velocity;
// else, lobbed shot: they do not have a constant velocity but have instead
//a intended target
else
direction=Vector.subtract(projectile.targetPos,projectile.pos);
sidestep=direction.rotate(Math.PI/2);
// check if you can run in that direction.
//Multiply with -1 to run into the opposite direction
sidestep.multiply(step_length/sidestep.magnitude());
``````
1 Like

wooo thanks, thatâ€™s awesome! tyvm

Iâ€™m still having a tough time with vectorsâ€¦ is there a gui somewhere that would let me play around with vectors and see them drawn out as lines while the program is running?

edit: nvm, Iâ€™m playing around in level Circle Walking with the ring that creates flowers behind you while you walk, and self.saying the vector that Iâ€™m heading to. itâ€™s helping a LOT.

Hi

How can I make the two robots hit each other? I think the program has the right idea, but thereâ€™s an error i canâ€™t place.

``````    robotWalker = self.findByType("robot-walker")
robot = self.findByType("robot")
moveToPosTimes2 = Vector.subtract(robotWalker.pos,robot.pos)
moveToPos = Vector.divide(moveToPosTimes2/2)
self.move(moveToPos)
self.say("Hit me with your best shot!")
self.moveXY(36, 12)``````

Wait, how do you figure out if it is a lobbed or Projectile?

findByType returns a list.

Since there are two robots in the level, you can do:
mean(a,b) = (a+b)/2

``````robotWalker = self.findByType("robot-walker")