This is my code for role.claimer, and it doesn't work, any idea?
-
So the creep moves towards the controller, but then it stands still without claiming it... This is the code
var roleClaimer = {
run: function(creep) { creep.memory.target = 'E1S42'; if(creep.room.name != creep.memory.target){ var getMeOut = creep.room.findExitTo(creep.memory.target); creep.moveTo(creep.pos.findClosestByRange(getMeOut)); } else{ creep.moveTo(creep.room.controller); creep.claimController(creep.room.controller); } }
};
module.exports = roleClaimer;
-
check the return code of the creep.claimController function, it will tell you why its failing.
var result = creep.claimController(creep.room.controller); console.log(creep + " tried to claim controller, got result " + result);
OK 0 The operation has been scheduled successfully.
ERR_NOT_OWNER -1 You are not the owner of this creep.
ERR_BUSY -4 The creep is still being spawned.
ERR_INVALID_TARGET -7 The target is not a valid neutral controller object.
ERR_FULL -8 You cannot claim more than 3 rooms in the Novice Area.
ERR_NOT_IN_RANGE -9 The target is too far away.
ERR_NO_BODYPART -12 There are no CLAIM body parts in this creepβs body.
ERR_GCL_NOT_ENOUGH -15 Your Global Control Level is not enough.
-
Thx, I'll try
-
@geir1983 Ok, so I don't have enough gcl, do you know how can I increase it? I'm kinda noob
-
You level up GCL (Global Control Level) by upgrading controller(s) w/ energy done by creeps, you can read more here:
-
Claiming a controller requires 600 available energy in your base.
-
@powerdude said in This is my code for role.claimer, and it doesn't work, any idea?:
Claiming a controller requires 600 available energy in your base.
Would you please explain how you arrived at that conclusion?
Because it is a false statement, if left alone.
-
@charlycreeper When your controller reaches RCL8 you should also gain a GCL for the first time.
Develop a profitable remote mining operation, if done wrong remote mining wastes resources.
I looked at your base, you have a lot of possible savings that you can pump into your controller.
But figuring that out is your job
-
@mrfaul I misinterpreted the docs. It's just the cost of the claim bodypart.
But if you knew it was false already, why didn't say so?
-
@powerdude where is the learning in that
-
@mrfaul well, that's not entirely true. I have a GCL of 2, when I reached RCL3. Atleast the game tells me when I join the public servers.
-
@powerdude said in This is my code for role.claimer, and it doesn't work, any idea?:
@mrfaul well, that's not entirely true. I have a GCL of 2, when I reached RCL3. Atleast the game tells me when I join the public servers.
You already played a bit in 2017, control points for GCL are global every bit counts and is not lost.
He really just started.
-
@mrfaul Ahh I see.