So i am new to CodeCombat and the tutorial did nothing to help me in multiplayer so i have been doing the best i can to figure out how to wright and use the different codes/spells. Anyway so I use the guide in dungeon battle or whatever and use this code:
this.findTypeInRange = function(units, type) {
for (var i = 0; 1 < units.length; ++i) {
var unit = units[i];
if (unit.type === type && this.distance(unit) < this.attackRange)
return unit;
}
return null;
};
var enemies = this.getEnemies();
for(var i = 0; i < enemies.length; ++i) {
var enemy = enemies[i];
}
var shaman = this.findTypeInRange(enemies, "shaman");
var brawler = this.findTypeInRange(enemies, "brawler");
var munchkin = this.findTypeInRange(enemies, "munchkin");
var thrower = this.findTypeInRange(enemies, "thrower", "spear");
and when i do the cast spell (btw this is on tharin) it says could not define ‘type’ and in the guide this is almost exactly how its written except for a couple of things. And i do not know how to define ‘type’ cause its nowhere in the guide and when i go the ‘type’ spell in the bottom all it says is this.type-string or something like that. So i need help if any of you veterens gan give me tips or help me with the problem at hand that would be very helpful thanks