While running Sarven Siege, I recieved this error: “Unhandled error: TypeError: Cannot read propreties of undefined (reading ‘length’)”
I don’t know what this error means. It appears when my summon()
function runs. Here’s that portion of the code:
function summon() {
let tower = hero.findByType("arrow-tower")[0].pos;
if (tower && hero.gold >= hero.costOf("griffin-rider")) {
hero.summon("griffin-rider");
hero.command(hero.built[hero.built.length - 1], "defend", tower);
}
}
...
while (true) {
summon();
...
}
I can PM the whole code if it appears to be necessary.