im trying to create a CTF game and i was wondering if you could test for items that have been dropped on the floor when a player has been killed. is there anyway to do this or am i just wasting my time??
I'm not sure what version of Minecraft you're using, but since your in the standard Minecraft forum im going to go ahead and assume that its bedrock edition. If you are playing on xbox, ps4, windows 10, or pocket edition, this will most likely work for you.
Heres the command you are looking for: /testfor @e[type=item]
If you only want to test for certain items you can do /testfor @e[type=item,name="cobblestone"]
-Replace the word cobblestone with the name of the item you want to test for.
You can even be more specific and add co-ordinates into the selector.
For example, /testfor @e[type=item,name="cobblestone",x=0,y=0,z=0,r=5]
This command will test for cobblestone within a radius of 5 at coordinates [0,0,0]
Perhaps you may even want the item to trigger a command itself. This can get a little complicated here. It involves using an execute command.
For example: /execute @e[type=item,name="cobblestone"] ~ ~ ~ tell @p "The flag has been dropped."
What this command is doing is telling the closest player to the cobblestone that the flag has been dropped. You can replace the tell command with whatever command you want and it will execute on behalf of the entity selected (which in this case is cobblestone)
Hopefully this helped, if you have any questions feel free to ask. If you want me to join your world to help then feel free to add me. Gamertag: Silentism
@vozzar (idk if tags work in this but sure imma try it) thanks for that it seems to be working. i used the testfor with a comparator instead so i could execute more than one command but the general concept was there. thanks so much
You should learn chain command blocks if you are using comparators... I legit can't remember the last time I used a comparator and I do an insane amount of commands.
With that said I started with comparators and lines of redstone repeaters between cmd blocks.
My best advice is learn /execute. Learn why execute almost always can be used in place of testfor. Learn what chain command blocks are. And then learn how the "conditional" works on chain command blocks.
im trying to create a CTF game and i was wondering if you could test for items that have been dropped on the floor when a player has been killed. is there anyway to do this or am i just wasting my time??
bedrock latest edition
Which MC version number exactly?
There is likely a way but Java or Bedrock?
I'm not sure what version of Minecraft you're using, but since your in the standard Minecraft forum im going to go ahead and assume that its bedrock edition. If you are playing on xbox, ps4, windows 10, or pocket edition, this will most likely work for you.
Heres the command you are looking for: /testfor @e[type=item]
If you only want to test for certain items you can do /testfor @e[type=item,name="cobblestone"]
-Replace the word cobblestone with the name of the item you want to test for.
You can even be more specific and add co-ordinates into the selector.
For example, /testfor @e[type=item,name="cobblestone",x=0,y=0,z=0,r=5]
This command will test for cobblestone within a radius of 5 at coordinates [0,0,0]
Perhaps you may even want the item to trigger a command itself. This can get a little complicated here. It involves using an execute command.
For example: /execute @e[type=item,name="cobblestone"] ~ ~ ~ tell @p "The flag has been dropped."
What this command is doing is telling the closest player to the cobblestone that the flag has been dropped. You can replace the tell command with whatever command you want and it will execute on behalf of the entity selected (which in this case is cobblestone)
Hopefully this helped, if you have any questions feel free to ask. If you want me to join your world to help then feel free to add me. Gamertag: Silentism
@vozzar (idk if tags work in this but sure imma try it) thanks for that it seems to be working. i used the testfor with a comparator instead so i could execute more than one command but the general concept was there. thanks so much
You should learn chain command blocks if you are using comparators... I legit can't remember the last time I used a comparator and I do an insane amount of commands.
With that said I started with comparators and lines of redstone repeaters between cmd blocks.
My best advice is learn /execute. Learn why execute almost always can be used in place of testfor. Learn what chain command blocks are. And then learn how the "conditional" works on chain command blocks.
/testfor @e[name=stone] in a repeating command block no Redstone needed, if I remember it right XD
No Discord. Contact me through Xbox or Minecraft. RubberDuck4114 is my Gamer Tag.
I have had a look into /execute and it seems rather confusing. Is there a certain way to approch it or am I just bad at commands?
edit: i got /execute working i just dont know how to do chain command blocks now
thank you