How do I make it so that a command only runs when Im at a certain position

[BACK]
How do I make it so that a command only runs when Im at a certain position
Posted On: February 14, 2023

I'm trying to make it so that if someone goes to a certain coordinate, it will trigger a boss fight.


I have a chain of commands set up to do this, but it can only activate when I pull a lever. I want to make it so that the chain is only run if the player is at the coordinates, but for some reason the following doesn't work as expected:.


/execute if entity @a[x=-519.5,y=141,z=-258.5] run . 


The command I put after run just runs even if I'm not at the specified coordinates. Does anyone know how to make this work? I looked up how /execute works but I actually can't understand why this isn't working.


Question from user VeryHotClara at gaming.stackexchange.com.


Answer:

The issue is that with your selector, you're only moving the starting point at which the selector starts looking for players, and you didn't actually limit the area it'll search in.


For that you can either use distance (to create a spherical selection, based on feet position) or dx/dy/dz (to create a cuboid selection based on hitbox overlap).


In your case, assuming you want to know when a player is inside the block you mention, your selector should look like this:.


@a[x=-519.0,y=141.0,z=-258.0,dx=0,dy=0,dz=0].


Read more about target selectors here: https://minecraft.fandom.com/wiki/Target_selectors.


Answer from user Plagiatus at gaming.stackexchange.com.



[BACK]
How do I make it so that a command only runs when Im at a certain position
Posted On: February 14, 2023

I'm trying to make it so that if someone goes to a certain coordinate, it will trigger a boss fight.


I have a chain of commands set up to do this, but it can only activate when I pull a lever. I want to make it so that the chain is only run if the player is at the coordinates, but for some reason the following doesn't work as expected:.


/execute if entity @a[x=-519.5,y=141,z=-258.5] run . 


The command I put after run just runs even if I'm not at the specified coordinates. Does anyone know how to make this work? I looked up how /execute works but I actually can't understand why this isn't working.


Question from user VeryHotClara at gaming.stackexchange.com.


Answer:

The issue is that with your selector, you're only moving the starting point at which the selector starts looking for players, and you didn't actually limit the area it'll search in.


For that you can either use distance (to create a spherical selection, based on feet position) or dx/dy/dz (to create a cuboid selection based on hitbox overlap).


In your case, assuming you want to know when a player is inside the block you mention, your selector should look like this:.


@a[x=-519.0,y=141.0,z=-258.0,dx=0,dy=0,dz=0].


Read more about target selectors here: https://minecraft.fandom.com/wiki/Target_selectors.


Answer from user Plagiatus at gaming.stackexchange.com.



[BACK]

Whats the quickest way to get all of the achievements in StarCraft 2? Whats the quickest way to get all of the achievements in StarCraft 2?

Posted On: February 24, 2023
As the title says, are there any shortcuts to getting all of the achievements in the game (preferably without cheesing through games, etc.)? Question from user happy_soil at gaming.stackexchange.co...[More]


How do you role play anything but nice characters? How do you role play anything but nice characters?

Posted On: October 27, 2023
I'm someone who feels bad in any video game if I am mean to some NPC. I'm also someone who tries to get everything in a single playthrough and try to pick the right dialogue option for that, r...[More]


Storyline of Hogwarts Legacy Storyline of Hogwarts Legacy

Posted On: April 7, 2023
Did anyone else feel like the storyline of the entire game was too weak? Like I loved the game and its beautiful creation of the world of Hogwarts but the main storyline about the ancient magic, ranro...[More]


How do I make food in Planet Crafter? How do I make food in Planet Crafter?

Posted On: April 29, 2024
In The Planet Crafter, I'm building my base, and I have enough food for now. I don't have any machines to make food, but I know I'm going to eventually run out. I guess that, like with water, I'm goin...[More]


In Pokemon Go does the Vivilion postcard pinning overflow to the next medal? In Pokemon Go does the Vivilion postcard pinning overflow to the next medal?

Posted On: March 3, 2023
If I have a Vivilion medal at 12 out of 15 and then pins 5 postcards for that model, would the medal be completed and the left over of 2 be brought over to the next medal? Or would the new medal st...[More]


What Is the Best Y Level to Find Ancient Debris? What Is the Best Y Level to Find Ancient Debris?

Posted On: July 18, 2023
I was playing the new 1.16 snapshot and was wondering where the best place to look for ancient debris would be. Question from user PuppyLover101 at stackexchange. Answer: The best Y-coordinat...[More]


Whats the difference between DirectX 10 and DirectX 9? Whats the difference between DirectX 10 and DirectX 9?

Posted On: May 29, 2023
In Civilization V, when starting the game, it offers me the option of using DirectX 10 or DirectX 9. Are there any graphics quality or performance gains present when using the DirectX 10 version? I kn...[More]


BG3 trophy list is a bit... BG3 trophy list is a bit...

Posted On: September 26, 2023
Hostile. I don't mind trophies for playing the game badly that take a few minutes to unlock or which can be done in the context of a throwaway save. But Jack of all Trades? Who in their right m...[More]


Whats wrong with my Pokemon Go curveball? Whats wrong with my Pokemon Go curveball?

Posted On: May 10, 2023
So I've got pretty good at landing curveballs. Well, according to How to throw a curveball that's what I think I'm doing. But I never seem to get the 10xp bonus for curveball, whether I hi...[More]


What are the advantages of alignment in Star Wars The Old Republic? What are the advantages of alignment in Star Wars The Old Republic?

Posted On: May 10, 2023
How do Dark Side and Light Side points work with regard to your faction? . In Star Wars the Old Republic, you can earn alignment points towards light side or dark side from conversation choices and...[More]