Advertisement
thatparadox

Escort

Dec 14th, 2013
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.41 KB | None | 0 0
  1. -- http://www.youtube.com/watch?v=Eq27GOX71TU
  2. bot = 1 --assign OpenMech ID
  3. mech = peripheral.wrap("right") --attach robot controller
  4.  
  5. while true do
  6.   mechX, mechY, mechZ = mech.getLocation(bot) --find OpenMech location
  7.   mobIds = mech.getMobIds(bot) -- Find Mobs
  8.   player = mech.getPlayerData(bot, "remorsless") --get info on the player
  9.   if player ~= nil then
  10.     print("Player at: "..player.position.x) --print player position
  11.     mech.goto(bot, player.position.x + mechX, player.position.y + mechY, player.position.z + mechZ) --move to player
  12.     sleep(.1)
  13.   else  
  14.     print("player out of range") --if player can't be found print player out of range
  15.   end
  16.   if mobIds == nil then --if there are no mobs print no targets
  17.     print("no targets")
  18.   else
  19.     for k, mobId in pairs(mobIds) do  --get information stored in MobIds
  20.       mob = mech.getMobData(bot, mobId) -- get data on mobs
  21.       if mob ~= nil then
  22.         if mob.type ~= "entity.OpenPeripheral.RobotWarrior.name" then
  23.           print("Targeting: "..mob.type)
  24.           mech.lookAt(bot, mob.position.x + mechX, mob.position.y + mechY, mob.position.z + mechZ) --look at mob
  25.           mech.fireHeavy(bot)
  26.           term.clear()
  27.           term.setCursorPos(1,1)
  28.           print("Heat: "..mech.getHeat(bot)) --print OpenMech heat
  29.           print("Max: "..mech.getMaxHeat(bot))
  30.         end
  31.       end
  32.     sleep(.1)
  33.     end
  34.   os.sleep(.1)
  35.   end    
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement