Navigation

    forum

    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    1. Home
    2. Fisubus
    3. Topics
    • Flag Profile
    • block_user
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Groups
    • Blog

    Topics created by Fisubus

    • New point for profile
      General Discussion • • Fisubus

      1
      1
      Posts
      2666
      Views

      No one has replied

    • How i can control second room?
      Help • • Fisubus

      8
      8
      Posts
      17541
      Views

      Your question is very broad.  Loop through all creeps in the game and you don't need to worry about rooms.   for(var name in Game.creeps) {var creep = Game.creeps[name];//run creep role code}   If your question is regarding a second spawn , the above still applies. You may however want to let creeps store their home / source room in memory when spawning. var roomName = creep.room.name;creep.memory.sourceRoom = roomName;
    • Builder don't upgrade walls and ramparts
      Help • • Fisubus

      2
      2
      Posts
      6257
      Views

      on the english part: you made yourself clear so good job   on the programming part: you could much better filter you buildings instead of what your doing right now. il just copy my code for repairing. fully tested and it works.   this code is made out of 3 the same elements: is an building going to decay to its destruction? yes? REPAIR NOW (repairnow will be bigger dan 0 so it will do that) are there no buildings decaying into destructino? are there buildings with damage? aren't they walls or ramparts? yes? okey good repair them. are you done repairing all except walls and rempards? okey good repair the wals and rempards. the thing i did with repairwall.lengt - 1 is because the ramparts come last in the list (in my game, you should replace it with 0) and they decay and walls don't. the " - 1" is because list starts with 0 and the length counts from 1. && means and || means or all things bevore or after 'or' must be true so: if (true && false || true) will output trou because after the or it was true. that is why i have 2 times the same checks on each side of the or when checking if the building is an wall or rampart.   var repairitnow = creep.room.find(FIND_STRUCTURES, { filter: (structure) => { return (structure.hits < 650 && structure.hits > 0) } }); if (repairitnow.length > 0){ if (creep.repair(repairitnow[0]) == ERR_NOT_IN_RANGE) { creep.moveTo(repairitnow[0]); } } else { var repairit = creep.room.find(FIND_STRUCTURES, { filter: (structure) => { return (structure.hits < structure.hitsMax && structure.hits > 0 && structure.structureType != STRUCTURE_WALL && structure.structureType != STRUCTURE_RAMPART) } }); var repairwall = creep.room.find(FIND_STRUCTURES, { filter: (structure) => { return (structure.structureType == STRUCTURE_RAMPART && structure.hits < structure.hitsMax && structure.hits > 0 || structure.hits < structure.hitsMax && structure.hits > 0 && structure.structureType == STRUCTURE_WALL) } }); if(repairit.length > 0){ if (creep.repair(repairit[0]) == ERR_NOT_IN_RANGE) { creep.moveTo(repairit[0]); } } else { if (repairwall.length > 0){ if (creep.repair(repairwall[repairwall.length - 1]) == ERR_NOT_IN_RANGE) { //omgekeerde volgorde zodat ramparts eerst gerepaird worden creep.moveTo(repairwall[0]); } } else { roleHarvester.run(creep); // so it will alway's will be busy. DO NOT FORGET TO IMPORT(var roleHarvester = require('role.harvester');) IT  } } }   if you have any questions i'l bookmark this post and check it a couple of times next week. Hope i helped Quinten
    • Lost role's in memory
      Help • • Fisubus

      5
      5
      Posts
      6495
      Views

      The other thing I have noticed that could cause this is setting memory with the debug memory editor. When you save your changes, you are saving the whole tree you are under. So possibly, you were editing a different creep under the creeps tree, and when you saved, you overwrote the entire Memory.creeps.