Problems with code tmp13[tmp14] [SOLVED]

I was creating a solution for a custom level I created, I received this error tmp13[tmp14] is not a function on posChange = Vector.substract(friend.pos,nearest.pos); and I am unable to spot any errors in this function even though I experienced similar error before.

   this.kite = function(friend){
        var enemies = friend.findEnemies();
        var nearest = friend.findNearest(enemies);
            var posChange = Vector.substract(friend.pos,nearest.pos);
            //var posChange = Vector.substract(friendPos,enemyPos);
            posChange = Vector.normalize(posChange);
            posChange = Vector.multiply(posChange,10);
            var finalPos = Vector.add(posChange,nearestPos);
                //this.command(friend, "move", {x:friend.pos.x+10,y:friend.pos.y
                    this.command(friend, "move", finalPos);
                this.command(friend, "attack", nearest);

I also found out that the value of friend.pos and nearest.pos returns 3 axis, x,y,z. I tried making an extra variable without the z axis but the same error still happens.

friendPos = {x:friend.pos.x,y:friend.pos.y;
enemyPos = {x:nearest.pos.x,y:nearest.pos.y};
var posChange = Vector.substract(friendPos,enemyPos);

same error still applies ^^

You have a typo: “substract” should be “subtract”.

And yes, the error message could do with improvements.

Thank you, I have fixed the problem. There is indeed a typo :blush: