Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local typex="Cow"
- local sens=peripheral.wrap("right") -- sensor side
- local RSside="left" -- redstone side
- local amount=5 -- how many mobs you want to spawn
- local active=0
- while true do
- local counter=0
- if active==0 then
- print("Press the spacebar button in order to spawn a "..typex.." "..amount.." times.")
- local event,scancode=os.pullEvent("key")
- if scancode==57 then
- redstone.setOutput(RSside,true)
- active=1
- end
- else
- for i,v in ipairs(sens.getMobIds()) do
- if sens.getMobData(v)["type"]==typex then
- counter=counter+1
- print("Mob number "..counter.." spawned.")
- if counter==amount then
- print("All mobs spawned, halting.")
- redstone.setOutput(RSside,false)
- active=0
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment