Jump to content

Welcome to FTB Forums
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!
Photo

I need help with melee turtles!


Best Answer Hippieshaman , 01 March 2013 - 07:36 PM

while true do
turtle.attack()
end

This will make the turtle attack everything in front of it (including you!) endlessly, you have to terminate it by holding ctrl+T if you want to end the program. Fill the turtles inventory with cobblestone and it wont be able to pick up items.

 

If you want it to pick up items and drop it into a chest directly below the turtle, use this:

 

while true do
turtle.attack()
i = turtle.getItemCount(16)
if i == 64 then
for j=1,16 do
turtle.select(j)
turtle.drop()
end
turtle.select(1)
end
end

Note that I am not 100% sure the above code will work, but I think it should.

Go to the full post »


  • This topic is locked This topic is locked
19 replies to this topic

#1
SekCbeast

SekCbeast

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts
  • Modpack:Direwolf20 1.5 Pack

Hello i have the direwolf pack and i'm struggling with melee turtles. I can't really program them, does anybody know what to do? I'm making a mob grinder and i want them to constantly kill the mob infront of them and dont pick up items (if thats possible) or else just put the items in a chest/pipe under the turtle.



#2
Hippieshaman

Hippieshaman

    Advanced Member

  • Members
  • PipPipPip
  • 185 posts
  • Location:Hippiecraft HQ
  • Modpack:FTB Unleashed
✓  Best Answer
while true do
turtle.attack()
end

This will make the turtle attack everything in front of it (including you!) endlessly, you have to terminate it by holding ctrl+T if you want to end the program. Fill the turtles inventory with cobblestone and it wont be able to pick up items.

 

If you want it to pick up items and drop it into a chest directly below the turtle, use this:

 

while true do
turtle.attack()
i = turtle.getItemCount(16)
if i == 64 then
for j=1,16 do
turtle.select(j)
turtle.drop()
end
turtle.select(1)
end
end

Note that I am not 100% sure the above code will work, but I think it should.


Hippiecraft Community, since 2012.

Forum, Twitch, Youtube, Twitter, Planet Minecraft, Steam, Website

Contact us by e-mail: mail@hippiecraft.net | Support: support@hippiecraft.net


#3
SekCbeast

SekCbeast

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts
  • Modpack:Direwolf20 1.5 Pack

what does while true mean?



#4
TheLaw

TheLaw

    Advanced Member

  • Members
  • PipPipPip
  • 162 posts
  • Location:Tingaroa Island
  • Modpack:MindCrack Pack

While True do Is a loop





~TheLaw

If you didn't like me, that your problem not mine.
Anything that advertises(on the side ads over whatever) causes malware or dissatisfaction BUT MINECRAFT DOESENT advertise at ALL

#5
SekCbeast

SekCbeast

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts
  • Modpack:Direwolf20 1.5 Pack

so you first write While true do 



#6
SekCbeast

SekCbeast

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts
  • Modpack:Direwolf20 1.5 Pack

so you first write While true do 

and can you make it so it only attacks mobs not yourself?



#7
TheLaw

TheLaw

    Advanced Member

  • Members
  • PipPipPip
  • 162 posts
  • Location:Tingaroa Island
  • Modpack:MindCrack Pack

Probably so but I don't know.





~TheLaw

If you didn't like me, that your problem not mine.
Anything that advertises(on the side ads over whatever) causes malware or dissatisfaction BUT MINECRAFT DOESENT advertise at ALL

#8
Hippieshaman

Hippieshaman

    Advanced Member

  • Members
  • PipPipPip
  • 185 posts
  • Location:Hippiecraft HQ
  • Modpack:FTB Unleashed

and can you make it so it only attacks mobs not yourself?

No, there is no function available that makes you able to see the difference between players and mobs.


Hippiecraft Community, since 2012.

Forum, Twitch, Youtube, Twitter, Planet Minecraft, Steam, Website

Contact us by e-mail: mail@hippiecraft.net | Support: support@hippiecraft.net


#9
SekCbeast

SekCbeast

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts
  • Modpack:Direwolf20 1.5 Pack

Probably so but I don't know.

 

 

while true do
turtle.attack()
end

This will make the turtle attack everything in front of it (including you!) endlessly, you have to terminate it by holding ctrl+T if you want to end the program. Fill the turtles inventory with cobblestone and it wont be able to pick up items.

 

If you want it to pick up items and drop it into a chest directly below the turtle, use this:

 

while true do
turtle.attack()
i = turtle.getItemCount(16)
if i == 64 then
for j=1,16 do
turtle.select(j)
turtle.drop()
end
turtle.select(1)
end
end

Note that I am not 100% sure the above code will work, but I think it should.

The one with dropping the items in chests didnt work.



#10
ZL123

ZL123

    Me.

  • Administrators
  • 2079 posts
  • Location:Not somewhere where people say a fake location to try to be funny
  • IGN:ZL123
  • Modpack:Private Pack

Just do this:

 

Make a new file called 'startup'. You have to call it startup otherwise it will not automatically load up when you open the world.

Now type in this code:

 

while true do
turtle.attack()
turtle.select(1)
turtle.dropDown()
turtle.select(2)
turtle.dropDown()
turtle.attack()
turtle.select(3)
turtle.dropDown()
turtle.select(4)
turtle.dropDown()
turtle.attack()
turtle.select(5)
turtle.dropDown()
turtle.select(6)
turtle.dropDown()
turtle.attack()
turtle.select(7)
turtle.dropDown()
turtle.select(8)
turtle.dropDown()
end

...if you have a chest under it.

You can continue this setup until turtle.select(16) if you want.


-ZL123
Hope I helped!

YT: http://youtube.com/ZL234
Twitter: https://twitter.com/ZL234


#11
ViperSRT3g

ViperSRT3g

    Advanced Member

  • Moderators
  • 212 posts
  • IGN:ViperSRT3g
  • Modpack:Unlisted Pack
You can also substitute the following for all of that.
while true do
for x=0,15 do
turtle.attack()
turtle.select(x)
turtle.dropDown()
end
end

Vanilla Server: vanilla.vipersrt3g.net
banner-13472.png
Snapshot Server: snap.vipersrt3g.net
banner-25377.png

#12
ZL123

ZL123

    Me.

  • Administrators
  • 2079 posts
  • Location:Not somewhere where people say a fake location to try to be funny
  • IGN:ZL123
  • Modpack:Private Pack

You can also substitute the following for all of that.

while true do
for x=0,15 do
turtle.attack()
turtle.select(x)
turtle.dropDown()
end
end

I think that the first slot is 1, not 0.


-ZL123
Hope I helped!

YT: http://youtube.com/ZL234
Twitter: https://twitter.com/ZL234


#13
ViperSRT3g

ViperSRT3g

    Advanced Member

  • Moderators
  • 212 posts
  • IGN:ViperSRT3g
  • Modpack:Unlisted Pack
You can change the values if it doesn't follow normal programming rules.
Vanilla Server: vanilla.vipersrt3g.net
banner-13472.png
Snapshot Server: snap.vipersrt3g.net
banner-25377.png

#14
Hippieshaman

Hippieshaman

    Advanced Member

  • Members
  • PipPipPip
  • 185 posts
  • Location:Hippiecraft HQ
  • Modpack:FTB Unleashed

you guys are making the turtle drop items for every attack cycle, there is no need to select the whole inventory then since there will be 1-2 different items in there.


Hippiecraft Community, since 2012.

Forum, Twitch, Youtube, Twitter, Planet Minecraft, Steam, Website

Contact us by e-mail: mail@hippiecraft.net | Support: support@hippiecraft.net


#15
ZL123

ZL123

    Me.

  • Administrators
  • 2079 posts
  • Location:Not somewhere where people say a fake location to try to be funny
  • IGN:ZL123
  • Modpack:Private Pack

you guys are making the turtle drop items for every attack cycle, there is no need to select the whole inventory then since there will be 1-2 different items in there.

I think up to a maximum of 4 should be enough, yeah.


-ZL123
Hope I helped!

YT: http://youtube.com/ZL234
Twitter: https://twitter.com/ZL234


#16
ZER0-0

ZER0-0

    Advanced Member

  • Contributor
  • PipPipPip
  • 295 posts
  • Location:Planet Earth
  • Modpack:FTB Ultimate

I think up to a maximum of 4 should be enough, yeah.

Or, the turtle could drop items after every 5 attack cycles, and clear the whole inventory.


When in Trouble or in Doubt, Run in circles, Scream and Shout!


#17
SekCbeast

SekCbeast

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts
  • Modpack:Direwolf20 1.5 Pack

I kinda want it to drop when the inventory is full



#18
ZL123

ZL123

    Me.

  • Administrators
  • 2079 posts
  • Location:Not somewhere where people say a fake location to try to be funny
  • IGN:ZL123
  • Modpack:Private Pack

This should work:

 

while true do
  turtle.attack()
  while turtle.getItemCount(16) > 1 do
    for x=0,15 do
    turtle.select(x)
    turtle.dropDown()
    end
  end
end

-ZL123
Hope I helped!

YT: http://youtube.com/ZL234
Twitter: https://twitter.com/ZL234


#19
SekCbeast

SekCbeast

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts
  • Modpack:Direwolf20 1.5 Pack

This should work:

 

while true do
turtle.attack()
while turtle.getItemCount(16) > 1 do
for x=0,15 do
turtle.select(x)
turtle.dropDown()
end
end
end

Do you need to write end three times?



#20
ZL123

ZL123

    Me.

  • Administrators
  • 2079 posts
  • Location:Not somewhere where people say a fake location to try to be funny
  • IGN:ZL123
  • Modpack:Private Pack

Do you need to write end three times?

Yes, definitely.


-ZL123
Hope I helped!

YT: http://youtube.com/ZL234
Twitter: https://twitter.com/ZL234





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users