Ah! Thanks, I think I figured it out... correct me if Im wrong. The .name is a property of the creep instance. Which is not what is stored in memory. So when I call memCreeps[deadCreep].name Im attempting to access the .name property of the of the creep's memory instead of the creep instance. Which will obviously error because the creep's memory doesnt contain a name property.
dogzilla3
@dogzilla3
2
Posts
869
Profile views
0
Followers
0
Following
Posts made by dogzilla3
-
RE: Memory.creeps have no names?
-
Memory.creeps have no names?
Not sure what is going on here but when I try to iterate through my creeps in memory I an unable to do anything useful with them... i.e. access their memory and what not.
Any ideas?
var memCreeps = Memory.creeps;
console.log(JSON.stringify(memCreeps)); //outputs as expected
for (var deadCreep in memCreeps){
console.log("Creep: " + memCreeps[deadCreep].name); //outputs "Creep: undefined
var spawn = Game.getObjectById(memCreeps[deadCreep].homeSpawnID);
console.log(spawn.name); //Throws an error
}