screeps - Why won't my Creep stay still? -
i've commanded bunch of creeps positions when command particular 1 keeps spazzing out. i've done nothing different how controlled other creeps doesn't work same. other ones stay still.
if(creep == game.creeps["transport1"]) { creep.moveto(harvesterloc.x, harvesterloc.y - 2); creep.transferenergy(game.creeps["transport2"]); } if(creep == game.creeps["transport2"]) { creep.moveto(harvesterloc.x, harvesterloc.y - 3); creep.transferenergy(game.spawns.spawn1); }
the first 1 works, 2nd 1 doesn't? location 2nd 1 within ramparts, cause issue?
you have typo in line:
if(creep = game.creeps["transport1"])
replace =
==
this:
if(creep == game.creeps["transport1"])
=
assignment operator, ==
equality operator. more operators in js in mdn reference.
Comments
Post a Comment