Is there a way to detect enemies in a room i don't own?
-
Hello,
I use a flag system to harvest energy from unowned rooms. From time to time, hostile creeps spawn in this room and kill my own creeps.
My first thought was to have the flag detecting enemies, so when there are any, i just stop spawning creeps for this room until it despawns, but
flag.room.find()
won't work if i don't own a structure or creep in the mentioned room and creating a container to own a structure and make that room visible is expensive (and don't think a road will do), so...Is there any way i can do this? If not, how do u guys do this?
-
You have to gain vision in a room and there are a few methods. Have a creep in the room, have an owned structure in the room, have control or reservation of the room, or use an Observer to see into the room.
-
@kyralee Reservation is not give you vision in room.
-
Another option is simply checking the
ticksToLive
property of the hostile creeps and turn off harvesting for that number of ticks. This doesn't require vision in the remote room.
-
I just set a "flag" in the memory of my base room.
so room.memory.remoteHostilesFlag = invaderCreep.ticksToLive + Game.time;
if(Game.time > room.memory.remoteHostilesFlag) delete room.memory.remoteHostilesFlag;
-
Hi again, and thanks to all of you for your help!!
Finally i did something similar to what @JBYoshi and @Famine said, and it works pretty well.
Thanks again!!