Navigation

    forum

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

    JPH

    @JPH

    2
    Posts
    718
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    JPH Follow

    Posts made by JPH

    • RE: Repair every structure fair

      Noticed my mistake...
      I must change "Return" with "break" and also add

      target_durch = target_durch/targets.length;

      posted in Help
      JPH
    • Repair every structure fair

      I want to repair every structure that they have nearly same hitpoints.

      First i tried this:

                      var target_num = 0;
                      var target_durch = 0;
                      for(var i = 0; i < targets.length; i++){
                          target_durch += targets[i].hits;
                      }
                      for(var i = 0; i < targets.length; i++){
                          if(targets[i].hits <= target_durch){
                              target_num = i;
                              return;
                          }
                      }


      I wanted to get the average actual hitpoints from every structure and than set the structure what need to repair first. The Creeps don´t walk with this code. With static target, the creep will only repair one target and a wall with a lot of hitpoints... well you know what i mean.

      I think i made an stupid mistake with the code. Also "traget_durch" means "traget_average"

      posted in Help
      JPH