mob detection

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

schmru

New Member
Jul 29, 2019
36
0
1
Hi, im building mobfarm with soulcages and i need a liitle help.

Im using direwolf20 pack and i need some ideas how to create mob detector, so that while it detects mobs turtle would attack or wait till i gets close. So that i could control how long turtles should attack, so that after there would be no more mobs turtle would stop.

Thanks for any help
 

Celestialphoenix

Too Much Free Time
Nov 9, 2012
3,741
3,204
333
Tartarus.. I mean at work. Same thing really.
Generally soul shards produce mobs fast enough for turtles to attack 24/7

You could probably wire in off switch with the soul cage, so you can shutdown if needed.


Lower tier shards- you can work out the spawn rate/check the wiki- you also know how many hits it takes to kill the mobs, so you can shorten/extend the sleep cycle between attack patterns to match the spawn rate. (you could also wire in an off switch if needed)
 

schmru

New Member
Jul 29, 2019
36
0
1
Generally soul shards produce mobs fast enough for turtles to attack 24/7

You could probably wire in off switch with the soul cage, so you can shutdown if needed.


Lower tier shards- you can work out the spawn rate/check the wiki- you also know how many hits it takes to kill the mobs, so you can shorten/extend the sleep cycle between attack patterns to match the spawn rate. (you could also wire in an off switch if needed)


In my case i already have tier5 soul cage so i can control them with redstone signal and now i need to somehow control turtles to stop working after i stop spawning and kill all the mobs
 

maid450

New Member
Jul 29, 2019
13
0
0
You can run the same redstone cable to the turtles, and then in the attack loop read the redstone input (rs.getInput(side)), so if it's on they stop (or, ideally run some seconds more to kill remaining mobs and then stop) and keeps waiting for the signal to go off again to resume attacking loop...
 

schmru

New Member
Jul 29, 2019
36
0
1
You can run the same redstone cable to the turtles, and then in the attack loop read the redstone input (rs.getInput(side)), so if it's on they stop (or, ideally run some seconds more to kill remaining mobs and then stop) and keeps waiting for the signal to go off again to resume attacking loop...

I had the same idea, but the problem is, that i can't realy tell how long should i keep runing turtle, because diffrent mobs need a diffrent time to get to turtle, so this solution is not so good.
 

SReject

New Member
Jul 29, 2019
433
0
0
Hi, im building mobfarm with soulcages and i need a liitle help.

Im using direwolf20 pack and i need some ideas how to create mob detector, so that while it detects mobs turtle would attack or wait till i gets close. So that i could control how long turtles should attack, so that after there would be no more mobs turtle would stop.

Thanks for any help
Can we see a screen shot of your current setup?
 

maid450

New Member
Jul 29, 2019
13
0
0
Well, turtle detecting pressure plates redstone signal seems like a valid option too, or you could just set the time to the one of the the 'slowest' mob
 

Abdiel

New Member
Jul 29, 2019
1,062
0
0
turtle.attack() returns true if the turtle actually hit something. You could have the turtle attack once every 10-20 seconds, and if it hits a mob, attack in quick succession as long as there is something to kill.

Alternatively, pressure plate in front of the turtle, and attack while you're getting redstone signal.
 

SReject

New Member
Jul 29, 2019
433
0
0
If you were to place a wooden pressure plate directly in front of a turtle, and then placed a chest below the turtle (and a brain jar above the turtle), you could use the following to kill, collect items (and xp w/ the jar):
Code:
-- Select the first slot on startup
turtle.select(1)
 
-- Start the main loop
while true do
 
    -- Wait until a change in redstone occurs.
    os.pullEvent("redstone")
 
    -- repeatedly loop to check if we are getting a redstone signal from the pressure plate infront
    while rs.getInput("front") do
 
        -- Attack and if the turtle didn't hit anything; suck up items.
        if (not turtle.attack()) and turtle.suck() then
 
            -- Loop through each slot in the turtles inv.
            for i=1,16 do
 
                -- drop items in a chest below the turtle
                turtle.select(i)
                turtle.dropDown()
            end
 
            -- reset the selected slot
            turtle.select(1)
 
        end
 
        -- Wait one second and check to see if we still have a redstone signal
        sleep(1)
 
    end
 
end

Updates:
* Incorporated Abdiel's suggestion to use os.pullEvent
* Incorporated MilConDoin's suggest of having the chest directly below the turtle
 

Abdiel

New Member
Jul 29, 2019
1,062
0
0
You could improve it further by waiting for the redstone input passively, using os.pullEvent("redstone").
 

SReject

New Member
Jul 29, 2019
433
0
0
You could improve it further by waiting for the redstone input passively, using os.pullEvent("redstone").
very nice. Am also going to loop through all of the turtles slots for when it drops items into the chest.

After reading, the problem with the redstone event is that there isn't a built in "redstone on" event.
 

MilConDoin

New Member
Jul 29, 2019
1,204
0
0
Put the chest below the turtle and use turtle.dropDown(), so you don't have to turn around all the time.
 

schmru

New Member
Jul 29, 2019
36
0
1
https://docs.google.com/file/d/0B9fPcCtD-OFEOEx3N01OYlVvaEU/edit?usp=sharing

This is my current mob farm wich i'm trying to improve. So if you'll try spiders, you'll soon see they don't fall down like other mobs, sometimes they get stuck at top, so i can't control my turtles with time

Thinknig about making the hole bigger and then use presure plate like SReject to detect if there are any more mobs in front, that way spiders maybe wouldnt get stucted