Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spawn setup #10

Open
Teriderol opened this issue Jun 17, 2017 · 3 comments
Open

spawn setup #10

Teriderol opened this issue Jun 17, 2017 · 3 comments

Comments

@Teriderol
Copy link

Hey thPion,

I has seen the video's on the script, however, could you add a setup for the spawn that sets their memory based on certain variables?
This and building logic would would make it a good step closer to automation...

@Tim-Pohlmann
Copy link
Owner

I'm not playing Screeps anymore, so don't expect any updates from me. Feel free to fork and add your own stuff however.

@Teriderol
Copy link
Author

sure, i'll butcher some code:

var allspawns = _.filter(Game.spawns, s => s.structureType == STRUCTURE_SPAWN);
// check for each spawn the numbers are set
for (let spawns of allspawns) {
if (spawns.memory.booted != true){
//put minCreeps in memory
minCreeps = {};
//define all the roles and amount
let numberOfCreeps = {};
let creepsInRoom = spawns.room.find(FIND_MY_CREEPS);
var evolve = numberOfCreeps['miner'] = _.sum(creepsInRoom, (c) => c.memory.role == 'miner');
spawns.memory.minCreeps = minCreeps;
spawns.memory.minCreeps.upgrader = 0
spawns.memory.minCreeps.builder = 1
spawns.memory.minCreeps.repairer = 1
spawns.memory.minCreeps.wallRepairer = 1
spawns.memory.minCreeps.LongDistanceHarvester = 0
spawns.memory.minCreeps.claimer = 0
spawns.memory.minCreeps.miner = 2
spawns.memory.minCreeps.harvester = 3-evolve
spawns.memory.minCreeps.lorry = 1
spawns.memory.booted = true;
spawns.memory.minLongDistanceHarvesters = {}
spawns.memory.minLongDistanceHarvesters.W7N4 = 1
spawns.memory.minLongDistanceHarvesters.W6N3 = 1
spawns.memory.minLongDistanceHarvesters.W8N3 = 3
spawns.memory.minLongDistanceHarvesters.W8N5 = 1
//spawns.memory.minLongDistanceHarvesters.W5N3 = 1
}
}

also, i noticed LongDistanceHarvesters to change energy sources at random intervals

@StormWingDelta
Copy link

Well for any remote roles it depends on if you want them returning to their home room or not so maybe something with an array of homeRoom, targetRoom, roleNameAmount if you want them to come back OR targetRoom, roleNameAmount if you don't want them back. As for Claimer it'd be an array of targetRooms that would clear each claimed room. Also in any of these cases you might want to clear the memory of specific ones when you can't send into or lose access to a target room. That said the Long distance or remote ones should likely be room level memory as oppose to spawn level unless there's some reason to have them that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants