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]

Frequency of the Golden Bowser Train? Frequency of the Golden Bowser Train?

Posted On: January 28, 2023
Does anyone happen to know how often you can go to the Golden Bowser Train? For those that don't yet know, it is a level with nothing but coins, and is a great way to bolster your extra lives.Questio...[More]


Whats the best possible score on the credits mini game? Whats the best possible score on the credits mini game?

Posted On: November 7, 2023
In the credits minigame you get a point for every name you hit and lose points whenever an enemy hits you. Since there's only a limited number of names to hit, what's the best possible score y...[More]


Build the greatest possible sleight of hand. Build the greatest possible sleight of hand.

Posted On: December 14, 2025
I'm looking to start a new campaign in honor mode for myself. In my current campaign, I'm having a lot of trouble buying items from merchants, even though I'm collecting everything in the world to sel...[More]


Is there something I'm missing? Is there something I'm missing?

Posted On: March 8, 2026
Hello guys, I'm going through my first playthrough.I feel as if I've done everything before the Shadowfell Entrance but for some reason I'm only level 8.I'm also not close to being level 9. I'm only a...[More]


In Skyrim How do I unselect a completed quest? In Skyrim How do I unselect a completed quest?

Posted On: May 3, 2023
A completed quest in my journal is selected, as shown below:. This causes new quests to not be selected immediately. How can I unselect it? Clicking on the quest title does not deselect it. Q...[More]


What are Gibdo Guts useful for? What are Gibdo Guts useful for?

Posted On: August 9, 2023
Gibdo Guts are a rare drop from Gibdos (10%) and Moth Gibdos (20%), but they are much less useful than Gibdo Bones, which are much more common. They have a sale value of 2, which is one ruppee less th...[More]


Is there a way to increase the number of potions I can carry in Final Fantasy 16? Is there a way to increase the number of potions I can carry in Final Fantasy 16?

Posted On: July 25, 2023
I'm still in the early parts of Final Fantasy 16, and Clive can only carry 4 potions and 3 high potions. During certain boss fights, I found myself using them all early on in the fights and not ha...[More]


Did they have to go so overboard with the Hogwarts woke-ness? Did they have to go so overboard with the Hogwarts woke-ness?

Posted On: July 8, 2023
It's a fun game (even though I can't help wishing they could have made it more like a GTA- hogwarts..that would be amazing ), but ffs why did they go sooo over the top making every second char...[More]


In the Fallout series, who launched the nuclear weapons first? In the Fallout series, who launched the nuclear weapons first?

Posted On: April 21, 2024
Is there sufficient information in the Fallout universe to infer who launched nukes first?Question from user SMeznaric at gaming.stackexchange.com.Answer:From Fallout Wikia:. It is not known who laun...[More]


In Assassins Creed 3, What is the best way to expose a ships powder stores? In Assassins Creed 3, What is the best way to expose a ships powder stores?

Posted On: April 16, 2023
On some of the ship missions, there is an optional objective of "sink ships by firing on their powder stores". I know how this works broadly - I've shot up some ships and got the spec...[More]