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]

Did any of Metagaming Concepts board games make it to the PC? Did any of Metagaming Concepts board games make it to the PC?

Posted On: June 11, 2023
I loved Metagaming Concepts' board games like Ogre and WarpWar and always thought that they could have been made into PC games. Did any of Metagaming Concepts' board games make it to the PC...[More]


Addicted to the game Addicted to the game

Posted On: September 14, 2023
Got the game and ps5 recently. I always try to limit my playtime but alwaysss end up playing for sooooo long! Its super addictive and fun!! Where’s my hufflepuffs?!. Question from user Fiery-...[More]


What do the Fruit Ninja notifications under the Gold Apples buttons mean? What do the Fruit Ninja notifications under the Gold Apples buttons mean?

Posted On: May 8, 2023
As you can see, there's a "(1)" under both the Gold Apples and Starfruit buttons. I've tried tapping them, but there's nothing seemingly pertaining to the "notifications&quo...[More]


How do I find: inactive jump gate At the beginning of Kingdoms End in X4: Foundations? How do I find: inactive jump gate At the beginning of Kingdoms End in X4: Foundations?

Posted On: August 31, 2023
How do I do this? Its somewhere in the Great Reef system, if I leave the mission changes to travel to Great Reef. There's nothing on the map. The mission description provides no hints. No...[More]


How do I keep my animals from eating my people food in Rimworld? How do I keep my animals from eating my people food in Rimworld?

Posted On: May 22, 2023
I've got a reasonably flourishing village with decent population and all the amenities. However, lately I've been having severe issues because my tame animals keep breaking into the food wareh...[More]


Regional differences in Borderlands 2 Regional differences in Borderlands 2

Posted On: May 19, 2023
General question: Are there any differences in Borderlands 2, based on the game's region code? Specific case: I received a game coded for Region 3, but I live in the U.S.. Are there any signifi...[More]


Why am I dealing so little damage to enemies in ToTK? Why am I dealing so little damage to enemies in ToTK?

Posted On: May 16, 2023
Despite being several hours into the game, almost all the weapons I'm finding are still really weak. As such, I'm barely dealing any damage to the enemies I come across. Enemies on the other h...[More]


Is Porofessor a cheat in League Of Legends? Is Porofessor a cheat in League Of Legends?

Posted On: February 23, 2023
I've been using a legitimate app called Porofessor that provides a lot of helpful info when playing league of legends. Such as displaying objective / jungle camp timers when things will respa...[More]


How to unlock the Bandolier via ammo caches? How to unlock the Bandolier via ammo caches?

Posted On: March 17, 2024
Aside from buying the Bandolier as a tier3 item at the shop, I've read you can unlock it by other means, after accessing some secret exits in Chaos Generator and Marksman and hitting some switches. H...[More]


What's the worst way to re-class every companion? What's the worst way to re-class every companion?

Posted On: October 16, 2025
Everyone talks about the best way. .What would be the worst and/or most unhinged classes to give each companion. .My favorite would be making Minthara a Wizard.Question from user kikicandraw at Baldur...[More]