@orlet Thanks.
YeaYuh
@YeaYuh
3
Posts
662
Profile views
0
Followers
0
Following
Posts made by YeaYuh
-
RE: CreateCreep getting error with passed array
Thanks for the help. That is what was going wrong.
-
CreateCreep getting error with passed array
Working on a function to build a creep based on a given main body then add repeat body parts until energy is used up or repeated x number of times. When I use the bodyMain: [WORK, CARRY, MOVE] passed to the function it work great. When I create a new array and push() the bodyMain to the array, i get an error ERR_INVALID_ARGS -10 Body is not properly described or name was not provided. Not sure what I am doing wrong with my code below.
var roleProperty = { harvester:{ maxNum: 2, bodyMain: [WORK, CARRY, MOVE], bodyRepeat: [MOVE, CARRY], repeatMax: 2,}, }; StructureSpawn.prototype.checkCreepNumbers = function () { this.createDefaultCreep('harvester', roleProperty['harvester'].bodyMain, roleProperty['harvester'].bodyRepeat); } // spawns a creep based on passed parameters // roleName -> role assigned to Memory // mainParts -> base body parts to used // repeatParts -> what parts to repeat // StructureSpawn.prototype.createDefaultCreep = function (roleName, mainParts , repeatParts ) { var creepName = roleName + Game.time; var bodyBuild = []; bodyBuild.push(mainParts); var creepMaker = this.createCreep(mainParts, creepName, { role: roleName, working: false }); //WORKS var creepMaker = this.createCreep(bodyBuild, creepName, { role: roleName, working: false }); // Return -10 return creepMaker; }; '''