So I'm fairly new to using the /execute command, but have been working with command blocks for some time, and am having some difficulty identifying a problem...
I'm working on making a push-able block (smooth granite), and have the block be cloned to a space one further away from the player after a delay of 10 ticks (using a scoreboard with objective 'pushDelay'). I've set up a system whereby the following commands function as intended:
However, any other direction (negative x, positive or negative z) doesn't work. For example, the following command doesn't give me any output info, even though all I changed (I believe) was the direction:
Note entirely sure why changing direction would cause it to fail if you know your block and data type are correct for what you intend to test for.
Note that you could put your position offset for the detection in the execute side. The XYZ part of the execute command with relative coordinates would be relative to the entity, so:
execute @a ~ ~ ~ detect ~1 ~ ~ stone 0
execute @a ~1 ~ ~ detect ~ ~ ~ stone 0
Are both equivalent in where they will test. I'm wondering if perhaps it's failing because it's testing multiple players and one of them is failing the test? Might be worth looking into.
And it is very confusing, why do you have 4 coordinates? there is only the x, y and z axis. You need proper formatting, too. You do not simply put in numbers and it works, you need to specify what the numbers mean, for example:
Coordinates work as (Question marks being where you insert your coordinates):
"@e[x=?,y=?,z=?]"
If you want to add a radius from that location it would be this:
"@e[x=?,y=?,z=?,r=?]"
So, assuming that the first 3 numbers in the first UUID section are coordinates, and the fourth is a radius, this is the command you are looking for:
The extra "coordinate" isn't a coordinate, it's the range from the x y and z values before it. For example, "execute @a[0,64,0,4] ~ ~ ~ " will execute a command to anyone within a 4 block radius of the coords 0 64 0.
EDIT: Oh haha, I didn't read your earlier post and misunderstood the post I quoted. Forget I said anything XD
And it is very confusing, why do you have 4 coordinates? there is only the x, y and z axis. You need proper formatting, too. You do not simply put in numbers and it works, you need to specify what the numbers mean
-snip-
I tried your suggestion, despite other users suggesting that the UUID portion was OK the way I had it and Lo and Behold, it worked, Go figure. Thank you all for your help.
P.S. for all of you wondering what I was actually making, I am making an elevator that is big enough to move around in and can hold multiple entities, not just players, e.g. a cow.
So i want to make it so that when a player holds a torch it places a torch right under them, then removes it right after, making it seem like they're holding a flashlight type torch. I saw someone has this command:
execute @p ~ ~ ~ setblock ~ ~ ~ minecraft:torch
So i ran it but it never removes the torch afterwords. How would i be able to break it right after it's placed? Would this be an entirely diffrent command?
I'm making it so when the wither boss dies and drops a nether star it detects the nether star and turns into a wither skeleton that when you kill the wither skeleton it splits into 2 of them kind of like a hydra but every time I have the wither skeleton get summoned it spawns at the command block and I heard that I need to use the execute command to make it so the wither skeletons spawn where the nether star drops so can you guys help
You could run a setblock or fill command which removes the torch right after. Although I'm not sure about the timing. Since if you do it too fast it might not show th light update and if it's too slow it'd look choppy.
Thanks, i'll try to figure out how to do this. I'm sure i can run a slower/ish clock that will fix the problem
I'm making it so when the wither boss dies and drops a nether star it detects the nether star and turns into a wither skeleton that when you kill the wither skeleton it splits into 2 of them kind of like a hydra but every time I have the wither skeleton get summoned it spawns at the command block and I heard that I need to use the execute command to make it so the wither skeletons spawn where the nether star drops so can you guys help
So first make an objective. /scoreboard objectives add Star dummy
Then add nether stars to that objective: /scoreboard players add @e[type=Item] Star 1 {Item:{id:"minecraft:nether_star"}}
Now, do /execute @e[score_Star_min=1,score_Star=1] ~ ~ ~ /summon Skeleton ~ ~ ~ {Type:99}
Or whatever command you want. There ya go
EDIT: Have the first command in chat and then the second two on repeat command blocks.
So i want to make it so that when a player holds a torch it places a torch right under them, then removes it right after, making it seem like they're holding a flashlight type torch. I saw someone has this command:
execute @p ~ ~ ~ setblock ~ ~ ~ minecraft:torch
So i ran it but it never removes the torch afterwords. How would i be able to break it right after it's placed? Would this be an entirely diffrent command?
What you are trying to do will be quite buggy and not aesthetically pleasing. But it is indeed very easy.
Simply create a fill clock, ex: Command block below = /setblock ~ ~1 ~ air, 2 blocks up place another command block with: /setblock ~ ~-1 ~ redstone_block, then place a redstone block in the middle and place redstone leading into another command block...
That command block [A] should have the command:
/testfor @a {SelectedItem:{id:"minecraft:torch"}}
Place a two comparators leading from two different sides. On one, have it lead into a repeater, which leads into another comparator. Turn this one onto subtraction mode by right-clicking it once so that the red light turns on. Have some redstone surround this comparator in a semi-circle like shape as shown in the attached photo. Now, it's quite possible you know that this is a basic clock, but just incase you don't right? Place redstone coming out of that leading into the two more command blocks, [B] and [C]. [b]Warn - Sometimes this clock will not work correctly, if it does not, try changing the angle that the redstone leads into the command block. sometimes it's straight ahead, sometimes it's to the left (Like in the attached photo) or the right.[/b]
B (Below) has the command:
/execute @a ~ ~ ~ setblock ~ ~ ~ torch
Command block C (On top) has the command:
/execute @a ~ ~ ~ fill ~2 ~1 ~2 ~-2 ~-1 ~-2 air 0 replace torch
Finally, on the other comparator that you put down a while ago, have it lead into a block with a redstone torch to invert the signal. Have the redstone torch power a repeater which powers a command block [D] which has the command:
/execute @a ~ ~ ~ fill ~2 ~1 ~2 ~-2 ~-1 ~-2 air 0 replace torch
(The same as block C)
This should make the mechanism work. Some of things however might not be very aesthetically pleasing.
- When you jump off a ledge, it will start flinging torches (in item form) everywhere.
- The torch is of course, visible when you look down
Okay. So I am trying to make it so that any player who has a score of 0 in my "Lives" scoreboard will have their score in "Deaths" set to 0. This is so that upon their next death I can see that they have "Deaths 1" and "Lives 0" and take away movement and mining from them so that it is like hardcore with multiple lives.
I have the below command but anytime I run it I get no error and my deaths stays the same.
I am attempting to make it so that whenever a player is near a certain villager, the villager is supposed to "speak" to the player. But it hasn't been working at all. Here's the command:
/execute @e[type=Villager,name=Kris the Tinkerer] ~ ~ ~ tellraw @p[r=2] "*Psst* I know something. . ."
Rollback Post to RevisionRollBack
"90% of everything is crud." -Theodore Sturgeon
Care about useless facts? My Site: thatfactoid.wordpress.com
The Meaning of Life, the Universe, and Everything.
Join Date:
8/20/2015
Posts:
58
Member Details
You can spawn them wearing a helmet, but making it not visible. Or, you repeatedlyplace water over them and remove it with commands. The water could be invisible.
Note entirely sure why changing direction would cause it to fail if you know your block and data type are correct for what you intend to test for.
Note that you could put your position offset for the detection in the execute side. The XYZ part of the execute command with relative coordinates would be relative to the entity, so:
execute @a ~ ~ ~ detect ~1 ~ ~ stone 0
execute @a ~1 ~ ~ detect ~ ~ ~ stone 0
Are both equivalent in where they will test. I'm wondering if perhaps it's failing because it's testing multiple players and one of them is failing the test? Might be worth looking into.
I'm trying to create a device that teleports all entities in a certain area relative to their position. I am using the command:
but the command returns "The entity UUID is provided in an invalid format."
What am I doing wrong? I know it is not the tp command because I get the same result when I replace the tp command with the "say" command.
There are many problems here -
And it is very confusing, why do you have 4 coordinates? there is only the x, y and z axis. You need proper formatting, too. You do not simply put in numbers and it works, you need to specify what the numbers mean, for example:
Coordinates work as (Question marks being where you insert your coordinates):
"@e[x=?,y=?,z=?]"
If you want to add a radius from that location it would be this:
"@e[x=?,y=?,z=?,r=?]"
So, assuming that the first 3 numbers in the first UUID section are coordinates, and the fourth is a radius, this is the command you are looking for:
Hope this helps, your comment is difficult to understand, why are there four numbers? Please explain if I can help further. Good luck
I've never tried that before, and did not know.
The extra "coordinate" isn't a coordinate, it's the range from the x y and z values before it. For example, "execute @a[0,64,0,4] ~ ~ ~ " will execute a command to anyone within a 4 block radius of the coords 0 64 0.
EDIT: Oh haha, I didn't read your earlier post and misunderstood the post I quoted. Forget I said anything XD
Click here for my youtube!
Click here for my modpack!
I tried your suggestion, despite other users suggesting that the UUID portion was OK the way I had it and Lo and Behold, it worked, Go figure. Thank you all for your help.
P.S. for all of you wondering what I was actually making, I am making an elevator that is big enough to move around in and can hold multiple entities, not just players, e.g. a cow.
We can do this
REPEAT UNCONDITIONAL ALWAYS ACTIVE
execute @e[type=Item,OnGround:1b,Item:{id:"minecraft:dye",Count:1b,Damage:4s}] ~ ~ ~ execute @e[type=Item{OnGround:1b,Item:{id:"minecraft:clay",Count:8b}] ~ ~ ~ execute @p ~ ~ ~ summon Item ~ ~ ~ {Item:{id:"minecraft:clay",Count:8b}}
CHAIN CONDITIONAL ALWAYS ACTIVE
execute @p ~ ~ ~ say yay!! I crafted it
I do this for red
So i want to make it so that when a player holds a torch it places a torch right under them, then removes it right after, making it seem like they're holding a flashlight type torch. I saw someone has this command:
execute @p ~ ~ ~ setblock ~ ~ ~ minecraft:torch
So i ran it but it never removes the torch afterwords. How would i be able to break it right after it's placed? Would this be an entirely diffrent command?
I'm making it so when the wither boss dies and drops a nether star it detects the nether star and turns into a wither skeleton that when you kill the wither skeleton it splits into 2 of them kind of like a hydra but every time I have the wither skeleton get summoned it spawns at the command block and I heard that I need to use the execute command to make it so the wither skeletons spawn where the nether star drops so can you guys help
if your command ever says
"The entity UUID provided is in an invalid format"
it's most likely failing to find the entity you tell it to. Make sure you spell everything correctly, and the player actually has the score.
<--- click to hatch my dragon(s)
Thanks, i'll try to figure out how to do this. I'm sure i can run a slower/ish clock that will fix the problem
So first make an objective. /scoreboard objectives add Star dummy
Then add nether stars to that objective: /scoreboard players add @e[type=Item] Star 1 {Item:{id:"minecraft:nether_star"}}
Now, do /execute @e[score_Star_min=1,score_Star=1] ~ ~ ~ /summon Skeleton ~ ~ ~ {Type:99}
Or whatever command you want. There ya go
EDIT: Have the first command in chat and then the second two on repeat command blocks.
Click here for my youtube!
Click here for my modpack!
So i want to make it so that when a player holds a torch it places a torch right under them, then removes it right after, making it seem like they're holding a flashlight type torch. I saw someone has this command:
execute @p ~ ~ ~ setblock ~ ~ ~ minecraft:torch
So i ran it but it never removes the torch afterwords. How would i be able to break it right after it's placed? Would this be an entirely diffrent command?
What you are trying to do will be quite buggy and not aesthetically pleasing. But it is indeed very easy.
Simply create a fill clock, ex: Command block below = /setblock ~ ~1 ~ air, 2 blocks up place another command block with: /setblock ~ ~-1 ~ redstone_block, then place a redstone block in the middle and place redstone leading into another command block...
That command block [A] should have the command:
Place a two comparators leading from two different sides. On one, have it lead into a repeater, which leads into another comparator. Turn this one onto subtraction mode by right-clicking it once so that the red light turns on. Have some redstone surround this comparator in a semi-circle like shape as shown in the attached photo. Now, it's quite possible you know that this is a basic clock, but just incase you don't right? Place redstone coming out of that leading into the two more command blocks, [B] and [C]. [b]Warn - Sometimes this clock will not work correctly, if it does not, try changing the angle that the redstone leads into the command block. sometimes it's straight ahead, sometimes it's to the left (Like in the attached photo) or the right.[/b]
B (Below) has the command:
Command block C (On top) has the command:
Finally, on the other comparator that you put down a while ago, have it lead into a block with a redstone torch to invert the signal. Have the redstone torch power a repeater which powers a command block [D] which has the command:
(The same as block C)
This should make the mechanism work. Some of things however might not be very aesthetically pleasing.
- When you jump off a ledge, it will start flinging torches (in item form) everywhere.
- The torch is of course, visible when you look down
And of course, the attached image as promised:
Buddy, you have unbalanced brackets and they're out of order. Best of luck.
You can use nested /execute commands.
This command will target entities with the tag of entityproperty1 and 2. Not either one. Doesn't work in all situations, though.
Okay. So I am trying to make it so that any player who has a score of 0 in my "Lives" scoreboard will have their score in "Deaths" set to 0. This is so that upon their next death I can see that they have "Deaths 1" and "Lives 0" and take away movement and mining from them so that it is like hardcore with multiple lives.
I have the below command but anytime I run it I get no error and my deaths stays the same.
I am attempting to make it so that whenever a player is near a certain villager, the villager is supposed to "speak" to the player. But it hasn't been working at all. Here's the command:
Thanks, that helped out my map a lot. Quest Items FTW!
Need a tutorial to create mobs and cannot burn in sun and do certain functions at certain times and a custom command like custom commands people make
You can spawn them wearing a helmet, but making it not visible. Or, you repeatedlyplace water over them and remove it with commands. The water could be invisible.