Advertisement
thatparadox

killMobs

Dec 14th, 2013
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.69 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. mobs = mech.getMobIds(bot) --find mobs
  6.  
  7. for k, mobId in pairs(mobs) do --get info on Mobs
  8.   mob = mech.getMobData(bot, mobId)
  9.   if mob ~= nil then --ensure we don't try to do the following if there aren't any mobs
  10.     if mob.type ~= "entity.OpenPeripheral.RobotWarrior.name" then --don't target the OpenMech
  11.       print("Targeting: "..mob.type) --print target mob
  12.       mech.lookAt(bot, mob.position.x + mechX, mob.position.y + mechY + 1, mob.position.z + mechZ) --look at mob
  13.       mech.fireLight(bot) --shoot light weapon
  14.     end
  15.   os.sleep(.1)
  16.   end    
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement