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]

I caught an Eevee, which of its evolutions will it evolve into? I caught an Eevee, which of its evolutions will it evolve into?

Posted On: February 14, 2023
So I just caught an Eevee. Now, I need 25 candies to evolve it. The fact is that in the GameBoy color versions, that Pokémon needed a stone to evolve instead of experience. Depending of the sto...[More]


Are the quiz answers included in Return To Monkey Island? Are the quiz answers included in Return To Monkey Island?

Posted On: March 3, 2023
Ahoy there, fancy pants.On my Return to Monkey Island I found a several quiz cards. As I don't remember all previous adventures in detail and looking up the answers feels like cheating, I'm wondering ...[More]


Is there a way to respec attributes? Is there a way to respec attributes?

Posted On: October 25, 2023
I'm pretty sure there isn't a way-explicitly-offered-by-the-game to unset and reinvest health, stamina, and/or magicka advancements, but I'm also curious about exploits, console commands, ...[More]


Does Lore Bard get good at later levels? Does Lore Bard get good at later levels?

Posted On: September 25, 2023
Hey all, I know basically all straight classes end up good enough, but I am trying to decide between a pure sorcerer or pure bard. I have a paladin/warlock sitting at the start of ACT 3 and just got b...[More]


Is BG3 worth playing if I wouldn't like the combat? Is BG3 worth playing if I wouldn't like the combat?

Posted On: August 5, 2025
I prefer games to have as little luck involved in possible, I want everything to be within the player's control. Mechanics like hit chance and random critical hits are annoying to me. Are the other as...[More]


Is shoving enemies supposed to make you an oath breaker? Is shoving enemies supposed to make you an oath breaker?

Posted On: June 9, 2025
I'm confused. Got into a conflict in act one with zarys and her goons. They initiate combat and my paladin shoved one of them off a cliff. Immediate oathbreaker. I reloaded and just killed them normal...[More]


How can I fix a Minecraft stair to its shape? How can I fix a Minecraft stair to its shape?

Posted On: July 2, 2023
I am trying to build an arch roof using stairs and in doing so I need stairs to get a fixed stair shape. Here are some pictures to clarify:. Two stairs together can form a corner stair:. However...[More]


How is the additional damage from Chosen weaknesses calculated? How is the additional damage from Chosen weaknesses calculated?

Posted On: January 18, 2023
Some of the Chosens' possible weaknesses make them take additional damage from particular damage sources. These are:.Shell-shocked - additional damage from explosives.Brittle - additional damage from ...[More]


Statement from Larian Statement from Larian

Posted On: November 27, 2023
Regarding patch 4:. " In Patch 4 we introduced a fix that would prevent the Scrying Eyes in Moonrise Towers from immediately calling the guards on you when stealing, even if you were sneaking,...[More]


Can you add a custom item to Minecraft Java using a resource pack? Can you add a custom item to Minecraft Java using a resource pack?

Posted On: May 18, 2023
I'm trying to add a custom item to Minecraft that players can use as a currency (e.g., a gold coin block). Can I do this with a resource pack, or do I need a full client-side mod? I haven't be...[More]