confirmed, role.claimer is functional!
Posts made by UncreativeUsername
-
RE: Claiming a new room, please help
or, could I do somthing like this in the module:
var roleclaimer = {
run: function(creep) {
let flag = Game.flags[creep.memory.targetFlag]; let ctrl = creep.room.controller; if(flag){ if(creep.room == flag.room){ let claimResult = creep.claimController(ctrl); if(claimResult == ERR_NOT_IN_RANGE){ creep.moveTo(ctrl, {visualizePathStyle: {stroke: '#cc00cc'}}); } } else{ creep.moveTo(flag, {visualizePathStyle: {stroke: '#cc00cc'}}); } }
} }; module.exports = roleclaimer;
and then, since i will only use each creep once, spawn the creep like this :
Game.spawns['S1'].spawnCreep( [CLAIM, MOVE], 'Claimer1', { memory: { role: 'claimer' } {targetFlag: 'flag1'} );
-
RE: Claiming a new room, please help
so, i I just want one of my roles to involve flags, because my other roles are already working, how could I tell the one role to be assigned to a flag? like, without using assign new flag, and encorperating it into the same module?
-
RE: Claiming a new room, please help
const AssignNewFlag = require('routines.assignNewFlag');
does this assign the creep to a flag? how do you control wich flag if you have multiple flags?
edit: nvm i found at the bottom that you assign by color.
-
RE: Harvesting energy from an unclaimed room
@Lisp thank you for telling me how to format my code in the forum. thanks for editing the code, ill try it and see if it works.
-
RE: Claiming a new room, please help
so creeps can see flags in other rooms? or do you place the flag on the border of the first room so the creep goes into the second room?
I would love your code, but I also will want to know how it works, so if you are willing to give it to me expect potential questions on the how and why of the code.
-
Claiming a new room, please help
I have recently reached GCL 2 and am trying to claim a new room. i have been trying to use
creep.moveTo(new RoomPosition(47, 25, 'E15S5'));
however it is giving me error messages that make no sense. please give me a code that will tell my creep to move to a specific room, go to the controler in that room, and claim it -
Harvesting energy from an unclaimed room
I am trying to get a creep to harvest energy from an unclaimed room adjacent to mine then return to mine to deposit the energy in an extension in my room, but it tells me that else is undefined. Please help!
Here is my code:
var roleouterharvester = {
run: function(creep) {
if(creep.carry.energy < creep.carryCapacity)
{ creep.moveTo(new RoomPosition(4, 13, 'W58S46'));
{ var sources = creep.room.find(FIND_SOURCES);
if(creep.harvest(sources[0]) == ERR_NOT_IN_RANGE) { creep.moveTo(sources[0], {visualizePathStyle: {stroke: '#ffaa00'}}); } }
}
Else {
{creep.moveTo(new RoomPosition(48, 15, ' W59S46'));
{ var targets = creep.pos.findClosestByRange (FIND_STRUCTURES, {
filter: (structure) => { return (structure.structureType ==
STRUCTURE_EXTENSION)
&& structure.energy < structure.energyCapacity; } }
});
if(targets.length > 0) { if(creep.transfer(targets[0], RESOURCE_ENERGY) ==
ERR_NOT_IN_RANGE) {
creep.moveTo(targets[0], {visualizePathStyle: {stroke: '#ffffff'}}); } } } }
};
module.exports = roleouterharvester;
Please excuse the weird formatting, it pasted weirdly.