Navigation

    forum

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

    Topics created by Necromunger

    • Open world - Spawner will not create creeps
      Help • • Necromunger

      2
      2
      Posts
      3910
      Views

      According to this changelog: Breaking change: All constants removed from the deprecated Game scope. Now they are accessible only through the global scope. You have to amend your code like this: var bodyExtractor = [CARRY, MOVE, WORK, WORK, WORK]; Game.spawns.Spawn1.createCreep(bodyExtractor, null, {role: "harvester", set: "extractor"});
    • Small snippet to clear the memory of dead creeps.
      General Discussion • • Necromunger

      9
      9
      Posts
      26453
      Views

      I'm using something like the OP's snippet as part of a garbage collector, but wanted to share part of my learning curve. When using createCreep with a memory argument, that creeps memory created and available to code for the remainder of that tick. The creep itself isn't available until the start of the next tick. My first pass had an OP style GC at the end of my code, and I couldn't figure out why my creeps memory were being wipe before the creep was even being created. What was happening was: This tick: createCreep called with memory argument Memory.creeps.myNewCreep available GC runs seeing Memory.creep.myNewCreep but not Game.creep.myNewCreep so deletes Memory.creep.myNewCreep Next tick: Game.creep.myNewCreep has no memory. Moving the GC earlier in the tick solved the problem. This tick run GC, myNewCreep hasen't been created yet, so isn't deleted createCreep Memory.creep.myNewCreep available Next tick Now when GC runs both Memory and Game versions of myNewCreep are available, so it is not deleted from memory. TL;DR: If you use this snippet, use it very early in your code.