Article Categories
- Baldur's Gate 3
- Diablo
- Elder Scrolls
- General
- Hogwarts Legacy
- League of Legends
- Minecraft
- Pokemon Go
- Sims 4
- StarCraft
- Steam Platform
- Xbox Game Console
More Articles
How do I make it so that a command only runs when Im at a certain position

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.

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.
What are those icons in the top left of the Rain World hibernation screen?
Regarding the You didnt need it anyway achievement
is there a way to auto-join conversations in multiplayer Baldurs Gate 3?
How do you evolve trade Pokémon on Lets Go Pikachu - Eevee?
Are there any merchants in Legend of Grimrock 2?
Sona-Taric League Of Legends bot lane in Season 9
Are the Draugr apologizing to me?
Why can't I catch a Thestral in Hogwarts Legacy?
How do I check where to go next?
Is there a bobble head equivalent in Fallout: New Vegas?


