Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
PHOBOSS98

DELUX DRONE SWARM/ARMY...FOR FREE!!!

Recommended Posts

Hi, are you tired of your mundane minions? do you have a s@$# ton of drones and have no idea what to do with them? are you tired of havi- you know what here's the code for your Drone Army (I don't know what else to say to convince you that this is a program worth playing with):

Le client.lua (this goes in your tablet):

  1. local component = require("component")
  2. local event = require("event")
  3. local serialization= require("serialization")
  4. local computer= require("computer")
  5. local modem = component.modem
  6. modem.open(2412)
  7. modem.broadcast(2412,"r= component.proxy(component.list('radar')())")
  8. modem.broadcast(2412,"n= component.proxy(component.list('navigation')())")
  9. modem.broadcast(2412,"d= component.proxy(component.list('drone')())")
  10. modem.broadcast(2412,"function sleep(timeout) checkArg(1, timeout, 'number', 'nil') local deadline = computer.uptime() + (timeout or 0) repeat computer.pullSignal(deadline - computer.uptime()) until computer.uptime() >= deadline end")
  11.  
  12. local function sleep(timeout) checkArg(1, timeout, "number", "nil") local deadline = computer.uptime() + (timeout or 0) repeat computer.pullSignal(deadline - computer.uptime()) until computer.uptime() >= deadline end
  13.  
  14. while true do
  15.   local cmd=io.read()
  16.   if not cmd then return end
  17.  
  18.   if cmd=="ALLFLW" then -- # all follow
  19.     print("Target: ") tag=io.read()
  20.     repeat
  21.        local cmd=select(1,event.pull(1))    
  22.        modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name== '" ..tag.. "' then x= v.x + math.random(-3,3) y=v.y + math.random(-3,3) z=v.z + math.random(-3,3) d.move(x,y,z) end end") sleep(0.5)
  23.     until cmd=="key_down"
  24.   end
  25.  
  26.   if cmd=="FLW" then -- # specific drone
  27.     print("Target: ") tag=io.read()
  28.     print("Drone No.: ") srm=io.read()
  29.     repeat
  30.        local cmd=select(1,event.pull(1))    
  31.        modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name== '" ..tag.. "' and d.name()== '"..srm.."' then x= v.x + math.random(-3,3) y=v.y + math.random(-3,3) z=v.z + math.random(-3,3) d.move(x,y,z) end end") sleep(0.5)
  32.     until cmd=="key_down"
  33.   end
  34.  
  35.   if cmd=="ALLMOV" then  --# all move
  36.     print("x: ") x=io.read()
  37.     print("y: ") y=io.read()
  38.     print("z: ") z=io.read()
  39.     modem.broadcast(2412," d.move("..x..","..y..","..z..")")
  40.   end
  41.  
  42.   if cmd=="MOV" then  --# specific drone
  43.     print("Drone No.: ") srm=io.read()
  44.     print("x: ") x=io.read()
  45.     print("y: ") y=io.read()
  46.     print("z: ") z=io.read()
  47.     modem.broadcast(2412,"if d.name()== '"..srm.."' then d.move("..x..","..y..","..z..") end")
  48.   end
  49.  
  50.   if cmd=="STK" then -- # stalk
  51.     print("Target: ") tag=io.read()
  52.     print("Drone No.: ") srm=io.read()
  53.     repeat
  54.       local cmd=select(1,event.pull(1))
  55.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name== '"..tag.. "' and d.name()== '"..srm.."' then x= v.x + 15*((math.random(1,2)*2)-3) y=v.y + 15 z=v.z + 15*((math.random(1,2)*2)-3) d.move(x,y,z) sleep(0.5) end end")
  56.     until cmd=="key_down"
  57.   end
  58.  
  59.   if cmd=="GOTO" then --# converge at target position
  60.     print("Target: ") tag=io.read()
  61.     print("Drone No.: ") srm=io.read()
  62.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name== '" ..tag.. "' and d.name()== '"..srm.. "' then d.move(v.x,v.y,v.z) end end")
  63.   end
  64.  
  65.   if cmd=="ALLGOTO" then -- # all converge at target position
  66.     print("Target: ") tag=io.read()
  67.        modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name== '" ..tag.. "' then d.move(v.x,v.y,v.z) end end")
  68.   end
  69.  
  70.   if cmd=="SET8" then --# make 8 drones from swarm converge at target position, used to set up shield and other stuff that I have yet to think about.
  71.     print("Target: ") tag=io.read()
  72.     t={1,2,3,4,5,6,7,8,9,10,11,12,13,14}
  73.     local n = #t
  74.     while n >= 2 do
  75.       local k = math.random(n) t[n], t[k] = t[k], t[n] n = n - 1
  76.     end
  77.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[1].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  78.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[2].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  79.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[3].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  80.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[4].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  81.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[5].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  82.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[6].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  83.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[7].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  84.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[8].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  85.    
  86.     while true do
  87.      
  88.     print("What Is Thy Bidding?") bid=io.read()
  89.       if bid=="X" then --# use this to adjust drone alignment
  90.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[1].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  91.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[2].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  92.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[3].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  93.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[4].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  94.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[5].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  95.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[6].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  96.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[7].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  97.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[8].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  98.       end
  99.  
  100.       if bid=="OK" then
  101.       break
  102.       end
  103.  
  104.       if bid=="PORTAFORT" then--# builds a simple 5X2X5 wall (complete with small entrances/exits) around the set center with any block in the drones inventory slot 1, you need atleast 30 blocks (that's atleast 4 for each drone (technically 2 of them only need 3 blocks but you don't need to bother with that))
  105.       modem.broadcast(2412,"if d.name()== '"..t[1].."' then d.move(2,2,0) end") sleep(0.5)
  106.       modem.broadcast(2412,"if d.name()== '"..t[1].."'  then repeat local dis=select(2, d.detect(0)) d.move(0,-1,0) until dis=='solid' d.move(0,5,0) sleep(0.00005) d.select(1) sleep(0.00005) d.place(0) sleep(0.00005) d.move(0,0,1) sleep(0.00005) d.place(0) sleep(0.00005) d.move(0,1,0) sleep(0.00005) d.place(0) sleep(0.00005) d.move(0,0,-1) sleep(0.00005) d.place(0) end") sleep(0.5)
  107.  
  108.       modem.broadcast(2412,"if d.name()== '"..t[2].."' then d.move(2,2,-2) end") sleep(0.5)
  109.       modem.broadcast(2412,"if d.name()== '"..t[2].."'  then repeat local dis=select(2, d.detect(0)) d.move(0,-1,0) until dis=='solid' d.move(0,5,0) sleep(0.00005) d.select(1) sleep(0.00005) d.place(0) sleep(0.00005) d.move(0,0,1) sleep(0.00005) d.place(0) sleep(0.00005) d.move(0,1,0) sleep(0.00005) d.place(0) sleep(0.00005) d.move(0,0,-1) sleep(0.00005) d.place(0) end") sleep(3)
  110.  
  111.       modem.broadcast(2412,"if d.name()== '"..t[6].."' then d.move(-2,2,2) end") sleep(0.5)
  112.       modem.broadcast(2412,"if d.name()== '"..t[6].."'  then repeat local dis=select(2, d.detect(0)) d.move(0,-1,0) until dis=='solid' d.move(0,5,0) sleep(0.00005) d.select(1) sleep(0.00005) d.place(0) sleep(0.00005) d.move(0,0,-1) sleep(0.00005) d.place(0) sleep(0.00005) d.move(0,1,0) sleep(0.00005) d.place(0) sleep(0.00005) d.move(0,0,1) sleep(0.00005) d.place(0) end") sleep(0.5)
  113.  
  114.       modem.broadcast(2412,"if d.name()== '"..t[4].."' then d.move(-2,2,0) end") sleep(0.5)
  115.       modem.broadcast(2412,"if d.name()== '"..t[4].."'  then repeat local dis=select(2, d.detect(0)) d.move(0,-1,0) until dis=='solid' d.move(0,5,0) sleep(0.00005) d.select(1) sleep(0.00005) d.place(0) sleep(0.00005) d.move(0,0,-1) sleep(0.00005) d.place(0) sleep(0.00005) d.move(0,1,0) sleep(0.00005) d.place(0) sleep(0.00005) d.move(0,0,1) sleep(0.005) d.place(0) end") sleep(4)
  116.  
  117.       modem.broadcast(2412,"if d.name()== '"..t[3].."' then d.move(2,2,2) end") sleep(0.5)
  118.       modem.broadcast(2412,"if d.name()== '"..t[3].."'  then repeat local dis=select(2, d.detect(0)) d.move(0,-1,0) until dis=='solid' d.move(0,5,0) sleep(0.00005) d.select(1) sleep(0.00005) d.place(0) sleep(0.00005) d.move(-1,0,0) sleep(0.3) d.place(0) sleep(0.00005) d.move(0,1,0) sleep(0.00005) d.move(1,0,0) sleep(0.3) d.place(0) end") sleep(0.5)
  119.    
  120.       modem.broadcast(2412,"if d.name()== '"..t[5].."' then d.move(-2,2,-2) end") sleep(0.5)
  121.       modem.broadcast(2412,"if d.name()== '"..t[5].."'  then repeat local dis=select(2, d.detect(0)) d.move(0,-1,0) until dis=='solid' d.move(0,5,0) sleep(0.00005) d.select(1) sleep(0.00005) d.place(0) sleep(0.00005) d.move(1,0,0) sleep(0.3) d.place(0) sleep(0.00005) d.move(0,1,0) sleep(0.00005) d.move(-1,0,0) sleep(0.3) d.place(0) end") sleep(3)
  122.  
  123.       modem.broadcast(2412,"if d.name()== '"..t[7].."' then d.move(0,2,-2) end") sleep(0.5)
  124.       modem.broadcast(2412,"if d.name()== '"..t[7].."'  then repeat local dis=select(2, d.detect(0)) d.move(0,-1,0) until dis=='solid' d.move(0,5,0) sleep(0.00005) d.select(1) sleep(0.00005) d.place(0) sleep(0.00005) d.move(1,0,0) sleep(0.2) d.place(0) sleep(0.00005) d.move(0,1,0) sleep(0.2) d.place(0) sleep(0.00005) d.move(-1,0,0) sleep(0.2) d.place(0) end") sleep(0.5)
  125.  
  126.       modem.broadcast(2412,"if d.name()== '"..t[8].."' then d.move(0,2,2) end") sleep(0.5)
  127.       modem.broadcast(2412,"if d.name()== '"..t[8].."'  then repeat local dis=select(2, d.detect(0)) d.move(0,-1,0) until dis=='solid' d.move(0,5,0) sleep(0.00005) d.select(1) sleep(0.00005) d.place(0) sleep(0.00005) d.move(-1,0,0) sleep(0.2) d.place(0) sleep(0.00005) d.move(0,1,0) sleep(0.2) d.place(0) sleep(0.00005) d.move(1,0,0) sleep(0.2) d.place(0) end") sleep(0.5)
  128.       end
  129.  
  130.     end
  131.   end
  132.  
  133.  if cmd=="SET9" then --# make 9 drones from swarm converge at target position, used to set up carpet bombing and other stuff that I have yet to think about.
  134.     print("Target: ") tag=io.read()
  135.     t={1,2,3,4,5,6,7,8,9,10,11,12,13,14}
  136.     local n = #t
  137.     while n >= 2 do
  138.       local k = math.random(n) t[n], t[k] = t[k], t[n] n = n - 1
  139.     end
  140.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[1].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  141.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[2].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  142.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[3].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  143.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[4].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  144.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[5].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  145.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[6].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  146.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[7].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  147.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[8].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  148.     modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[9].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  149.  
  150.     while true do
  151.       print("What Is Thy Bidding?") bid=io.read()
  152.       if bid=="X" then --# use this to adjust drone alignment
  153.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[1].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  154.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[2].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  155.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[3].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  156.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[4].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  157.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[5].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  158.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[6].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  159.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[7].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  160.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[8].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  161.       modem.broadcast(2412,"for k, v in ipairs(r.getEntities()) do if v.name=='"..tag.."' and d.name()== '"..t[9].."'  then d.move(v.x,v.y,v.z) end end") sleep(0.5)
  162.       end
  163.  
  164.       if bid=="OK" then
  165.       break
  166.       end
  167.    
  168.     if bid=="SETPLANT" then --# have atleast 1 redstone torch at inventory slot 2 and 1 TNT block at slot 3 for each drone...
  169.         modem.broadcast(2412,"if d.name()=='"..t[1].."' then while select(2,d.detect(0))=='air' do local dis=select(2,d.detect(0)) d.move(0,-1,0) sleep(0.00005) if dis~='air' then break end end sleep(0.5) if select(2,d.detect(0))=='solid' then d.move(0,1,0) d.select(2) d.place(0) d.select(3) d.place(0) d.select(1) end end")
  170.         modem.broadcast(2412,"if d.name()=='"..t[2].."' then while select(2,d.detect(0))=='air' do local dis=select(2,d.detect(0)) d.move(0,-1,0) sleep(0.00005) if dis~='air' then break end end sleep(0.5) if select(2,d.detect(0))=='solid' then d.move(0,1,0) d.select(2) d.place(0) d.select(3) d.place(0) d.select(1) end end")
  171.         modem.broadcast(2412,"if d.name()=='"..t[3].."' then while select(2,d.detect(0))=='air' do local dis=select(2,d.detect(0)) d.move(0,-1,0) sleep(0.00005) if dis~='air' then break end end sleep(0.5) if select(2,d.detect(0))=='solid' then d.move(0,1,0) d.select(2) d.place(0) d.select(3) d.place(0) d.select(1) end end")
  172.         modem.broadcast(2412,"if d.name()=='"..t[4].."' then while select(2,d.detect(0))=='air' do local dis=select(2,d.detect(0)) d.move(0,-1,0) sleep(0.00005) if dis~='air' then break end end sleep(0.5) if select(2,d.detect(0))=='solid' then d.move(0,1,0) d.select(2) d.place(0) d.select(3) d.place(0) d.select(1) end end")
  173.         modem.broadcast(2412,"if d.name()=='"..t[5].."' then while select(2,d.detect(0))=='air' do local dis=select(2,d.detect(0)) d.move(0,-1,0) sleep(0.00005) if dis~='air' then break end end sleep(0.5) if select(2,d.detect(0))=='solid' then d.move(0,1,0) d.select(2) d.place(0) d.select(3) d.place(0) d.select(1) end end")
  174.         modem.broadcast(2412,"if d.name()=='"..t[6].."' then while select(2,d.detect(0))=='air' do local dis=select(2,d.detect(0)) d.move(0,-1,0) sleep(0.00005) if dis~='air' then break end end sleep(0.5) if select(2,d.detect(0))=='solid' then d.move(0,1,0) d.select(2) d.place(0) d.select(3) d.place(0) d.select(1) end end")
  175.         modem.broadcast(2412,"if d.name()=='"..t[7].."' then while select(2,d.detect(0))=='air' do local dis=select(2,d.detect(0)) d.move(0,-1,0) sleep(0.00005) if dis~='air' then break end end sleep(0.5) if select(2,d.detect(0))=='solid' then d.move(0,1,0) d.select(2) d.place(0) d.select(3) d.place(0) d.select(1) end end")
  176.         modem.broadcast(2412,"if d.name()=='"..t[8].."' then while select(2,d.detect(0))=='air' do local dis=select(2,d.detect(0)) d.move(0,-1,0) sleep(0.00005) if dis~='air' then break end end sleep(0.5) if select(2,d.detect(0))=='solid' then d.move(0,1,0) d.select(2) d.place(0) d.select(3) d.place(0) d.select(1) end end")
  177.         modem.broadcast(2412,"if d.name()=='"..t[9].."' then while select(2,d.detect(0))=='air' do local dis=select(2,d.detect(0)) d.move(0,-1,0) sleep(0.00005) if dis~='air' then break end end sleep(0.5) if select(2,d.detect(0))=='solid' then d.move(0,1,0) d.select(2) d.place(0) d.select(3) d.place(0) d.select(1) end end")
  178.  
  179.     end
  180.    
  181.     if bid=="MAT" then --#covers a 33X33 area with 9 drones
  182.         print("N,S,E,W") dir=io.read()  
  183.         if dir=="N" then -- #-Z
  184.         modem.broadcast(2412,"if d.name()== '"..t[1].."'  then d.move(0,0,-20) end") sleep(0.5)    
  185.         modem.broadcast(2412,"if d.name()== '"..t[2].."'  then d.move(-10,0,-20) end") sleep(0.5)  
  186.         modem.broadcast(2412,"if d.name()== '"..t[3].."'  then d.move(10,0,-20) end") sleep(0.5)    
  187.         modem.broadcast(2412,"if d.name()== '"..t[4].."'  then d.move(0,0,-30) end") sleep(0.5)    
  188.         modem.broadcast(2412,"if d.name()== '"..t[5].."'  then d.move(-10,0,-30) end") sleep(0.5)  
  189.         modem.broadcast(2412,"if d.name()== '"..t[6].."'  then d.move(10,0,-30) end") sleep(0.5)    
  190.         modem.broadcast(2412,"if d.name()== '"..t[7].."'  then d.move(0,0,-40) end") sleep(0.5)    
  191.         modem.broadcast(2412,"if d.name()== '"..t[8].."'  then d.move(10,0,-40) end") sleep(0.5)
  192.         modem.broadcast(2412,"if d.name()== '"..t[9].."'  then d.move(-10,0,-40) end") sleep(0.5)
  193.         end
  194.         if dir=="S" then -- #Z
  195.         modem.broadcast(2412,"if d.name()== '"..t[1].."'  then d.move(0,0,20) end") sleep(0.5)  
  196.         modem.broadcast(2412,"if d.name()== '"..t[2].."'  then d.move(-10,0,20) end") sleep(0.5)    
  197.         modem.broadcast(2412,"if d.name()== '"..t[3].."'  then d.move(10,0,20) end") sleep(0.5)    
  198.         modem.broadcast(2412,"if d.name()== '"..t[4].."'  then d.move(0,0,30) end") sleep(0.5)  
  199.         modem.broadcast(2412,"if d.name()== '"..t[5].."'  then d.move(-10,0,30) end") sleep(0.5)    
  200.         modem.broadcast(2412,"if d.name()== '"..t[6].."'  then d.move(10,0,30) end") sleep(0.5)    
  201.         modem.broadcast(2412,"if d.name()== '"..t[7].."'  then d.move(0,0,40) end") sleep(0.5)  
  202.         modem.broadcast(2412,"if d.name()== '"..t[8].."'  then d.move(10,0,40) end") sleep(0.5)
  203.         modem.broadcast(2412,"if d.name()== '"..t[9].."'  then d.move(-10,0,40) end") sleep(0.5)
  204.         end
  205.         if dir=="E" then -- #+X
  206.         modem.broadcast(2412,"if d.name()== '"..t[1].."'  then d.move(20,0,-10) end") sleep(0.5)    
  207.         modem.broadcast(2412,"if d.name()== '"..t[2].."'  then d.move(20,0,10) end") sleep(0.5)    
  208.         modem.broadcast(2412,"if d.name()== '"..t[3].."'  then d.move(20,0,0) end") sleep(0.5)  
  209.         modem.broadcast(2412,"if d.name()== '"..t[4].."'  then d.move(30,0,-10) end") sleep(0.5)    
  210.         modem.broadcast(2412,"if d.name()== '"..t[5].."'  then d.move(30,0,10) end") sleep(0.5)    
  211.         modem.broadcast(2412,"if d.name()== '"..t[6].."'  then d.move(30,0,0) end") sleep(0.5)  
  212.         modem.broadcast(2412,"if d.name()== '"..t[7].."'  then d.move(40,0,-10) end") sleep(0.5)    
  213.         modem.broadcast(2412,"if d.name()== '"..t[8].."'  then d.move(40,0,10) end") sleep(0.5)
  214.         modem.broadcast(2412,"if d.name()== '"..t[9].."'  then d.move(40,0,0) end") sleep(0.5)
  215.         end
  216.         if dir=="W" then -- #+X
  217.         modem.broadcast(2412,"if d.name()== '"..t[1].."'  then d.move(-20,0,-10) end") sleep(0.5)  
  218.         modem.broadcast(2412,"if d.name()== '"..t[2].."'  then d.move(-20,0,10) end") sleep(0.5)    
  219.         modem.broadcast(2412,"if d.name()== '"..t[3].."'  then d.move(-20,0,0) end") sleep(0.5)    
  220.         modem.broadcast(2412,"if d.name()== '"..t[4].."'  then d.move(-30,0,-10) end") sleep(0.5)  
  221.         modem.broadcast(2412,"if d.name()== '"..t[5].."'  then d.move(-30,0,10) end") sleep(0.5)    
  222.         modem.broadcast(2412,"if d.name()== '"..t[6].."'  then d.move(-30,0,0) end") sleep(0.5)    
  223.         modem.broadcast(2412,"if d.name()== '"..t[7].."'  then d.move(-40,0,-10) end") sleep(0.5)  
  224.         modem.broadcast(2412,"if d.name()== '"..t[8].."'  then d.move(-40,0,10) end") sleep(0.5)
  225.         modem.broadcast(2412,"if d.name()== '"..t[9].."'  then d.move(-40,0,0) end") sleep(0.5)
  226.         end
  227.     end
  228.     end
  229.  end
  230.    
  231. if cmd=="PLANT" then --# have atleast 1 redstone torch at inventory slot 2 and 1 TNT block at slot 3...
  232.     print("Drone No.: ") srm=io.read()
  233.     modem.broadcast(2412,"if d.name()=='"..srm.."' then while select(2,d.detect(0))=='air' do local dis=select(2,d.detect(0)) d.move(0,-1,0) sleep(0.00005) if dis~='air' then break end end sleep(0.5) if select(2,d.detect(0))=='solid' then d.move(0,1,0) d.select(2) d.place(0) d.select(3) d.place(0) d.select(1) end end")
  234. end
  235.  
  236.  if cmd=="BUNKERBUST" then --# yeah, you need more redstone torches and TNT...  
  237.     print("Drone No.: ") srm=io.read()
  238.     repeat
  239.       local cmd= select(1,event.pull(3))
  240.     modem.broadcast(2412,"if d.name()=='"..srm.."' then while select(2,d.detect(0))=='air' do local dis=select(2,d.detect(0)) d.move(0,-1,0) sleep(0.00005) if dis~='air' then break end end sleep(0.5) if select(2,d.detect(0))=='solid' then d.move(0,1,0) d.select(2) d.place(0) d.select(3) d.place(0) d.select(1) end end") sleep(0.5)
  241.     until cmd=="key_down"
  242.  end
  243.  
  244.  if cmd=="HUSH" then--# kill command
  245.      modem.broadcast(2412," computer.shutdown()")
  246.  end
  247.  
  248.  if cmd=="RISE" then --# wake message, you need to restart client after using this command
  249.      modem.broadcast(2412,"RISE")
  250.  end
  251.  
  252.   print(select(6, event.pull(3, "modem_message")))
  253. end
 
Le BRAIN.lua (this goes in the drone)
  1. local m=component.proxy(component.list("modem")())
  2. local d=component.proxy(component.list("drone")())
  3. d.setLightColor(0x00FFE8)            -- Edit the first character of the method should have been in lowercase
  4. d.setStatusText(d.name())            -- Same here my B
  5. m.open(2412)
  6. m.setWakeMessage("RISE")
  7. local function respond(...)
  8.   local args=table.pack(...)
  9.   pcall(function() m.broadcast(2412, table.unpack(args)) end)
  10. end
  11. local function receive()
  12.   while true do
  13.     local evt,_,_,_,_,cmd=computer.pullSignal()
  14.     if evt=="modem_message" then return load(cmd) end
  15.   end
  16. end
  17. while true do
  18.   local result,reason=pcall(function()
  19.     local result,reason=receive()
  20.     if not result then return respond(reason) end
  21.     respond(result())
  22.   end)
  23.   if not result then respond(reason) end
  24. end
 
here you'll also need these to work with:
atleast 64 TNT blocks
atleast 64 redstone torches
atleast 64 building materials (blocks preferably)
Creative drone Case (sorry survivalists, I couldn't find a way to put it all in a T2 case :(
Computronics 1.6.6 for 1.12.2 Radar upgrade heres: a link to the add-on:https://files.vexatos.com/?dir=Computronics/dev
(ps: you need to go into the computronics config file and set the radar range to atleast 50 blocks and set it to return coordinates to true)
5X T3 Battery upgrade (or you can use less if you use more solar upgrades)
Inventory upgrade
Inventory controller upgrade
T3 CPU
2X T3.5 Memory
wireless network card

(you'll need atleast 14 of these drones named from '1' to '14' )

and a creative tablet (might as well... or if your upto it, you can use a regular tablet)

oh yeah I almost forgot:


some of the commands:
FLW-- # call a specific drone to follow (randomly flys about)

1384979405_doneswarm.png.caefb7ac10b1c689370b2589366104bb.png
ALLFLW-- # all follow ( they all randomly fly about)
MOV-- # call a specific drone to move
ALLMOV-- # all move
GOTO-- # call a specific drone to converge at a target
ALLGOTO--# all will converge at target
STK-- # call a specific drone to stalk a target (its default is to follow a target 15 blocks above)
PLANT--# have atleast 1 redstone torch at inventory slot 2 and 1 TNT block at slot 3...

BOMB.png.51102845862be66226e8cafec6eb93fa.png

BUNKERBUST --# does the samething as PLANT but throws it in a loop yeah, you need more redstone torches and TNT...
HUSH --# kill command
RISE--# wake message (you need to restart client after using this command)

---for the following type in 'X' to re-center drones and 'OK' to break out of 'SET' (you'll know what I mean ;) )--- 
SET8--# make 8 drones from swarm converge at target position, used to set up fort and other stuff that I have yet to think about. 
    PORTAFORT--# builds a simple 5X2X5 wall (complete with small entrances/exits) around the set center with any block in the drones inventory slot 1, you need atleast 30 blocks (that's atleast 4 for each drone (technically 2 of them only need 3 blocks but you don't need to bother with that))

FORT.png.06958a5ca0827a4864f731f7a688e324.png

SET9--# make 9 drones from swarm converge at target position, used to set up carpet bombing and other stuff that I have yet to think about.
    MAT --#covers a 33X33 area with 9 drones
    SETPLANT--# have atleast 1 redstone torch at inventory slot 2 and 1 TNT block at slot 3 for each drone...

mat3.png.b30f3b78c1e0891f70cc1c3ff2718183.png

have fun causing Havoc and chaos :) 

and this might be the first and last time I write a program for opencomputers... Byeeeee :)

Edited by PHOBOSS98
PROMOTIONAL IMPROVEMENT
Link to post
Share on other sites
On 11/19/2018 at 11:27 PM, ajacobs said:

I'm a total noob so I'm sure it's something I'm doing wrong but I keep getting nil value errors on my drones (lightcolor).
Would it be possible for anyone to help? Thank you so much in advance!

Hi, sorry for the late reply, are you using your own code or my code above. it would really help if you could show us the part code you edited...

Link to post
Share on other sites
On 11/29/2018 at 8:35 AM, ajacobs said:

Im just using your code as is on the latest version of opencomputers

yeah about that... I might have forgotten to document the version I used for this... I haven't even checked if my code even works on the latest version... its going to take me a while to sort this out actually... so you might want to start tweaking the code a bit while I can't...

Link to post
Share on other sites
On 11/29/2018 at 8:35 AM, ajacobs said:

Im just using your code as is on the latest version of opencomputers

ok buddy Im back about the lightcolors thing I finally had time too look into it and found what might be the problem:

let me know if it works

Le BRAIN.lua (this goes in the drone)
  1. local m=component.proxy(component.list("modem")())
  2. local d=component.proxy(component.list("drone")())
  3. d.setLightColor(0x00FFE8)               -- the first character 's' of the method should have been in lower case
  4. d.setStatusText(d.name())                -- same here... my bad
  5. m.open(2412)
  6. m.setWakeMessage("RISE")
  7. local function respond(...)
  8.   local args=table.pack(...)
  9.   pcall(function() m.broadcast(2412, table.unpack(args)) end)
  10. end
  11. local function receive()
  12.   while true do
  13.     local evt,_,_,_,_,cmd=computer.pullSignal()
  14.     if evt=="modem_message" then return load(cmd) end
  15.   end
  16. end
  17. while true do
  18.   local result,reason=pcall(function()
  19.     local result,reason=receive()
  20.     if not result then return respond(reason) end
  21.     respond(result())
  22.   end)
  23.   if not result then respond(reason) end
  24. end
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.