Navigation

    forum

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

    Posts made by ThN1saHead

    • RE: Actual hit points of creeps not accessible. findClosest fails too.

      My bad, I found out that I had overwritten the "hits" property previously to the execution of this code. Can this be prevented by making the "hits" property read-only?

      posted in Technical Issues and Bugs
      ThN1saHead
    • Actual hit points of creeps not accessible. findClosest fails too.

      The following code, that used to run correctly, suddenly stopped working.

      var MDId = 0;

      for(var cName in Game.creeps)
      {
      var c = Game.creeps[cName];

      console.log(cName, c.hits, c.hitsMax);
      
      if(c.memory.role == "medic")
      {
          var Patient = c.pos.findClosest(FIND_MY_CREEPS, {filter: function(object) {return object.hits < object.hitsMax; }});
      
          if(Patient) {
              c.moveTo(Patient);
              c.heal(Patient);
          } else {
              if(c.pos.getRangeTo(Spawns[0]) > 3) c.moveTo(Spawns[0]); 
          };
      
          MDId++;
      };
      

      }

      Specifically, Patient results to be null even if there are accessible damaged creeps. The previous print function prints full hit points even for damaged creeps. I'm running the code into the simulation room.

      posted in Technical Issues and Bugs
      ThN1saHead