xD
Let say I was tired ^^
Hi,
I was trying to share the energy load to spwan genral purpose creep (as attacker, healer,...) betwen rooms and found something weird..
function checkAttackFlag(tFlags)
{
for(var i = 0; i < tFlags.length; ++i)
{
var defender = _.filter(Game.creeps, (minion) => { return minion.memory.role == 'defender' && minion.memory.target == tFlags[i].name})
var qt = defender.length;
_.forEach(Game.spawns, function(spawn) {
if(!(qt < tFlags[i].memory.qt))
return false;
if(!_.includes(spawnUsed, spawn.name))
{
var newName = Game.spawns.HomeSweetHome.createCreep(defenderLayout[tFlags[i].memory.rank], {role:'defender', criticalStatus:false, target:tFlags[i].name});
if(_.isString(newName))
{
console.log(spawn.name+'=>Spawning new defender('+tFlags[i].name+') '+newName);
spawnUsed.push(spawn.name);
++qt;
}
else
{
console.log("Busy ("+tFlags[i].name+"): "+spawn.name+" | ");
}
}
});
}
}
As you can see 5 creeps were order to be produce but in fact only HomeSweetHome did produce a creep and spawn1 was already producing an other creep but it did return a name and not ERR_BUSY..
Is there a link with loadash I don't know..
Hi,
It could be nice to have a double click when you want to remove a flag like with creeps or structures, because too many time with a miss click when trying to click on "view memory" I delete the flags and I think I'm not the only one ^^
Thanks,
Shadow_Bird
Indeed I'm more interested with distance rather than path because it's only to choose the closest spawn from a flag.. And the pathfinder is very costly.
@cyberblast I didn't have time to check the pathfinder docs and getRoomLinearDistance, yet
Hi,
I'm trying to find the closest objects from an array of objects that could be across differents room.
I tried pos.findClosestByRange but it only work if it's in the same room (The documentation doesn't say it by the way).
Also I tried wit pos.GetRangeTo but it return infinity.
So do we have to process RoomName and calculate by ourself the distance ?
Thanks,
Shadow_Bird
Thanks,
I was writting the scout way but I didn't though about simulating my own ticksToEnd ;).
Hi,
I'm trying to have efficients claimer because at low RCL they are costly. What I'm trying to do is analyze the situation in the targeted room (by a flag) to know if I have to spawn a claimer to make the reservation ticks go up. The problem is that I have no vision in the room so I can't check the controller (I didn't unlock the observer yet), is there any workarround ?
Thanks,
Shadow_Bird
Hey
You could also check for energy available. With every find function you can add a function to filter your research.
var source = spawn.pos.findClosestByRange(FIND_SOURCES, {
filter:(source)=>{ return /*your test here*/ true;}
});
if(!source){/**no sources found, do something else*/}
if(creep.harvest(source) == ERR_NOT_IN_RANGE) {
creep.moveTo(source);
}
http://support.screeps.com/hc/en-us/articles/203079211-Source
Ok, I didn't know that boosted creep drop minerals I only saw energy when I did encountered them
Hi,
I found something strange today, someone did have zynthium hydride stored in a container but he didn't had any lab/terminal and no one in the area have one of them... So how could that be ?
Room history => https://screeps.com/a/#!/history/E52N53?t=12829360
I did found a previous delete hidden, it's working properly.
---------------------------------------------------------------
Hi,
Did you found a solution ?
I have a similar issue, the following code work properly. The test array is visible in the memory view
if(!Memory.test)Memory.test = {o:'one', t:'two'};
console.log(Memory.test.o);\s
But after several execution, if I remove the first two lines it will not work anymore, because for some reason, the test array isn't stored in memory anymore, and didn't make any delete call. And so there is a undefined error 'Memory.test.o'
Ok, let me know if there is a change about it one day.
I do know that, this what I was saying with the look up table.
An Example :
var links = room.find(STRUCTURE_LINK);
var state = Memory.objects[ links[0].id ][ 'state' ];
this is one way to do it right now but it could be easier that way :
var links = room.find(STRUCTURE_LINK);
var state = links[0].memory.state;
Actualy it's already possible with spawns ...
Hi,
I'm relatively new (I don't know if that requested has already been made), I've been in trouble when I tried to add behaviour to my link.
Right now only spawns/flags have memory slot to store data, and that pretty fine but other structures like tower or link don't have that privilege, so we have to make some workarround with look up table ['id', [data1, data2]] and store it somewhere in the memory I think it could be nice to allow data storage on those structures to ease theire data access.
Thanks,
Shadow_bird