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]

Does Hogwarts Legacy have multiple endings? Does Hogwarts Legacy have multiple endings?

Posted On: March 13, 2023
I am planning to replay Hogwarts Legacy after I've completed current story, but if there is multiple endings, I think I'm going to try this game out without learning the unforgivable curses. S...[More]


If I have fewer than 6 Pokemon in my party, does each gain more EXP? If I have fewer than 6 Pokemon in my party, does each gain more EXP?

Posted On: March 24, 2024
I have a few weak Pokemon that I'm trying to level quickly. I'm wondering if it helps to keep less than 6 Pokemon in my party.Does that divide the total EXP gained by fewer Pokemon? Or does each Pokem...[More]


How did the cat end up in the city in Stray? How did the cat end up in the city in Stray?

Posted On: August 14, 2023
At the beginning of Stray, the cat is walking with his cat friends in nature presumably outside the city. How did the cat end up in the city at the beginning of the game if the city had been sealed? ...[More]


What happens to my boarding party if the enemy ship surrenders? What happens to my boarding party if the enemy ship surrenders?

Posted On: March 15, 2024
In Faster than Light, if I still have crew members on the enemy ship when they surrender: What happens to my boarding crew members if I accept the offer from the enemy ship?Question from user stack_ho...[More]


Where does this blue cube-shaped object belong in Unpacking? Where does this blue cube-shaped object belong in Unpacking?

Posted On: July 25, 2023
I cannot understand what this blue cube-shaped object is. I cannot find where it belongs. Every place I put it in shows it's wrong. Where should I place this object? Question from user sdo at s...[More]


Did anyone else hate Lae'zel as much as I did? Did anyone else hate Lae'zel as much as I did?

Posted On: November 19, 2023
I mean come on, she literally was just an asshole from the moment you meet her. She constantly talks down to literally everyone, acts like she is god's gift to the world, and talks like everyone a...[More]


How do I open the gate in Fungi Forest near warp point 5 in Donkey Kong 64? How do I open the gate in Fungi Forest near warp point 5 in Donkey Kong 64?

Posted On: March 7, 2023
In Fungi Forest there is a metal gate near warp point 5. It is guarded by an enemy with a spiked club and has a blue banana behind it. Punching it with Funky Kong has no effect. How do I open this ...[More]


Why is Shadowheart so…. loved? Why is Shadowheart so…. loved?

Posted On: November 30, 2023
Hear me out, I’m not trying to shart (hehe) on her character or anything. I just kind of find her annoying? I think a lot of it might be due to the fact that she was overhyped to me before I pla...[More]


How do I destroy the Harley Heads? How do I destroy the Harley Heads?

Posted On: September 5, 2023
I'm talking about the Harley Heads in the Steel Mill where if you press the button, you hear Harley talking through the intercom. I know I have to do something to them, because there's a count...[More]


Roll a CON check Roll a CON check

Posted On: March 16, 2026
Question from user PaddywackShaq at BaldursGate3 at reddit.com.Answer:I always got the impression that Astarion was always an asshole even before he became a vampire, and being abused by Cazador just ...[More]