# Problems with code tmp13\[tmp14\] \[SOLVED\]

**URL:** <https://discourse.codecombat.com/t/problems-with-code-tmp13-tmp14-solved/6874>\
**Category:** Uncategorized\
**Created:** [February 29, 2016, 1:31pm UTC](https://discourse.codecombat.com/t/problems-with-code-tmp13-tmp14-solved/6874 "2016-02-29T13:31:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DoomKiller](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/doomkiller/32/3787_2.png) [@DoomKiller](https://discourse.codecombat.com/u/DoomKiller)\
**Post date:** [February 29, 2016, 1:31pm UTC](https://discourse.codecombat.com/t/problems-with-code-tmp13-tmp14-solved/6874/1 "2016-02-29T13:31:19Z")

</div>

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);
        if(nearest){
            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);
            if(friend.distanceTo(nearest)<10){
                //this.command(friend, "move", {x:friend.pos.x+10,y:friend.pos.y
                    this.command(friend, "move", finalPos);
            }else{
                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 ^^

---

<div class="post-metadata">

**Author:** ![UltCombo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ultcombo/32/3822_2.png) [@UltCombo](https://discourse.codecombat.com/u/UltCombo)\
**Post date:** [February 29, 2016, 1:47pm UTC](https://discourse.codecombat.com/t/problems-with-code-tmp13-tmp14-solved/6874/2 "2016-02-29T13:47:51Z")

</div>

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

And yes, the error message could do with improvements.

---

<div class="post-metadata">

**Author:** ![DoomKiller](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/doomkiller/32/3787_2.png) [@DoomKiller](https://discourse.codecombat.com/u/DoomKiller)\
**Post date:** [February 29, 2016, 3:10pm UTC](https://discourse.codecombat.com/t/problems-with-code-tmp13-tmp14-solved/6874/3 "2016-02-29T15:10:53Z")

</div>

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