Guys getting two errors, please find the code as below"
var defendPoints = [{"x": 59, "y": 73},{"x": 97, "y": 53},{"x": 57, "y": 49},{"x": 94, "y": 71}]; var summonTypes = ["griffin-rider","archer","paladin","archer","archer","archer","griffin-rider","griffin-rider"]; var priorityType = ["headhunter","thrower","shaman"]; this.summonTroops = function() { var type = summonTypes[this.built.length % summonTypes.length]; if(this.gold >= this.costOf(type)) { this.summon(type); } }; this.commandTroops = function() { var friends = this.findFriends(); for(var friendIndex=0; friendIndex < friends.length; friendIndex++) { var friend = friends[friendIndex]; var point = defendPoints[friendIndex % defendPoints.length]; if (friend && friend.type != "peasant"){ this.command(friend, "defend", point ); } } }; this.commandPaladin = function(paladin){ paladin = this.findNearest(this.findByType("paladin")); if (paladin && this.health < 1000){ this.command(paladin, "cast","heal", this); } else { this.command(paladin, "shield"); } }; loop{ var friends = this.findFriends(); for ( i=0; i<friends.length; i++){ var friend = friends[i]; if (friend && friend.type == "peasant"){ var coins = friend.findNearest(friend.findItems()); if (coins){ this.command(friend, "move", coins.pos); } } } this.summonTroops(); this.commandTroops(); this.commandPaladin();
var nearest = this.findNearest(this.findEnemies());
if (nearest ){ this.attack(nearest); } else { this.moveXY(78, 60);} }
- cannot summon paladin
- paladin cannot shield
using boss star 3
thanks in advance