Navigation

    forum

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

    sowonya

    @sowonya

    3
    Posts
    285
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    sowonya Follow

    Posts made by sowonya

    • RE: This weird error.

      Update: it didn't work. my creeps are still just spawning and not doing anything.

      posted in Help
      sowonya
    • RE: This weird error.

      Ok thank you! I'll run it through in simulator mode and see whether it works.

      posted in Help
      sowonya
    • This weird error.

      So i have a problem. I recently got invaded by an NPC, and my attackers are supposed to spawn whenever there is a hostile creep in the room. However, all they do is spawn and they don't move. Can anyone help?

      var roleAttacker = {

      /** param {Creep} creep **/
      run: function (creep) {
          
          if(creep.store.getFreeCapacity() > 0) {
              var sources = creep.room.find(FIND_SOURCES);
              if(creep.harvest(sources[0]) == ERR_NOT_IN_RANGE) {
                  creep.moveTo(sources[0], {visualizePathStyle: {stroke: '#ffaa00'}});
              }
          }
          else {
              var hostile = creep.pos.findClosestByRange(FIND_HOSTILE_CREEPS);
              if(hostile) {
                  if(creep.attack(hostile[0] == ERR_NOT_IN_RANGE) 
                      creep.moveTo(hostile[0])
                      creep.attack(hostile);
              }
          }
      }
      

      } module.exports = roleAttacker

      I also got this weird error that doesn't tell me where my code error is, but just won't let my code run.

      [10:23:58][shard3]SyntaxError: Unexpected identifier [role.

      posted in Help
      sowonya