Multi Room Question
-
So I've been playing for less than a week now, but just started branching out and harvesting resources from a neighboring room.
The issue I am having is that once all my creeps exit said room (when they're returning with their energy), Game.getObjectById() returns null for the source that my harvester was working on when I try to move them back there.
Is there a way to get the objects from that room without actually being in it?
-
There is no way to get the objects from that room without actually being in it (if you've started recently).
There are two alternatives, available for advanced players, that let you observe room's objects: build any structure at the observed room or use an 'observer' (available at RCL8)
What you can do is this:
- send a single [MOVE] creep to stay at the observed room
- or use flags to point destination position:
creep.moveTo(Game.flags['flagname']) will work even when a room is creep-free
-
It's an issue of visibility: You can only access objects in rooms that you have either a building or a creep in.
You can however just store the position of the source in the creeps memory and send them to the position instead of the actual source.
-
Don't use the source ID, use flags and their ID, that's their primary purpose