Mendenbarr

Creeper Spawning

Sep 23rd, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var creeperList = [
  2.     ['mule', [CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE], 1],
  3.     ['harvester', [WORK, WORK, WORK, WORK, WORK, MOVE], 2],
  4.     ['hauler', [CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE], 2],
  5.     ['builder', [WORK, WORK, WORK, WORK, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY, CARRY], 1],
  6.     ['upgrader', [WORK, WORK, WORK, WORK, WORK, WORK, WORK, WORK, WORK, WORK, WORK, WORK, WORK, WORK, WORK, WORK, MOVE, MOVE, CARRY, CARRY], 1],
  7.     ['archer', [TOUGH, TOUGH, TOUGH, TOUGH, TOUGH, RANGED_ATTACK, RANGED_ATTACK, RANGED_ATTACK, MOVE], 0],
  8.     ['guard', [TOUGH, TOUGH, ATTACK, ATTACK, ATTACK, ATTACK, ATTACK, ATTACK, MOVE], 0],
  9.     ['recovery', [WORK, MOVE, MOVE, CARRY, CARRY], 0],
  10.     ];
  11.  
  12. // Creeper Spawning Code
  13. for (var i = creeperList.length - 1; i >= 0; i--) {
  14.     for (var p = 0, length = creeperList[i][2]; p < length; p++){
  15.         // If there is no beta version of the creep, or if it will die before the alpha creep is born, spawn the alpha creep.
  16.         if (Game.creeps[creeperList[i][0] + p + '_Beta'] == undefined || Game.creeps[creeperList[i][0] + p + '_Beta'].ticksToLive <= creeperList[i][1].length * 3 + 10){
  17.             Game.spawns.Spawn1.createCreep( creeperList[i][1], creeperList[i][0] + p + '_Alpha', {role: creeperList[i][0], health: 'healthy'});
  18.         }
  19.         // If there is no alpha version of the creep, or if it will die before the beta creep is born, spawn the beta creep.
  20.         if (Game.creeps[creeperList[i][0] + p + '_Alpha'] == undefined || Game.creeps[creeperList[i][0] + p + '_Alpha'].ticksToLive <= creeperList[i][1].length * 3 + 10) {
  21.             Game.spawns.Spawn1.createCreep( creeperList[i][1], creeperList[i][0] + p +  '_Beta', {role: creeperList[i][0], health: 'healthy'});
  22.         }
  23.        
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment