Advertisement
konalisp

spawnturret.lua

May 31st, 2015
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. local statelist = {
  2.   ["top"] = rs.getInput("top"),
  3.   ["front"] = rs.getInput("front"),
  4.   ["left"] = rs.getInput("left"),
  5.   ["right"] = rs.getInput("right"),
  6.   ["back"] = rs.getInput("back"),
  7.   ["bottom"] = rs.getInput("bottom"),
  8. }
  9.  
  10. local function spawn()
  11.     if commands.blockdata then
  12.         -- User is on at least MineCraft 1.8, snapshot 14w02a.
  13.         commands.exec("summon Skeleton ~0 ~1 ~0 {Equipment:[{id:bow,tag:{ench:[{id:48,lvl:4}]}},{},{},{},{id:iron_helmet}],CustomName:Turret,CustomNameVisible:0,Attributes:[{Name:generic.maxHealth,Base:2},{Name:generic.movementSpeed,Base:0.001},{Name:generic.followRange,Base:32}],PersistenceRequired:1}")
  14.     else
  15.         -- User is on something earlier.
  16.         --commands.exec("summon Skeleton ~0 ~1 ~0 {Equipment:[{id:261,tag:{ench:[{id:48,lvl:4}]}},{},{},{} {id:306}],CustomName:Turret,CustomNameVisible:0,Attributes:[{Name:generic.maxHealth,Base:2},{Name:generic.movementSpeed,Base:0.001} {Name:generic.followRange,Base:32}],PersistenceRequired:1}")
  17.     end
  18. end
  19.  
  20. while(true) do
  21.     local event = os.pullEvent("redstone")
  22.     for side, state in pairs(statelist) do
  23.         if rs.getInput(side) then
  24.             spawn()
  25.         end
  26.         statelist[side] = rs.getInput(side)
  27.     end
  28.     --spawn()
  29.     os.sleep(1)
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement