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]

How do Zonaite and Zonai-based materials work together? How do Zonaite and Zonai-based materials work together?

Posted On: June 15, 2023
I am very confused about Zonai-based materials and how they work together to produce bigger/larger things. Specifically:. Zonaite. Zonai Charges. Energy Cells. Zonai Devices. Autobuild ...[More]


Missing pushups in UFC Trainer Missing pushups in UFC Trainer

Posted On: March 27, 2023
I am about 3 days into my first 30-day challenge on UFC Trainer and have been getting frustrated that the game isn't picking up all of my push-ups. I can grind out 20 or so in the allotted...[More]


Zelda Breath Of The Wild Where can I find spicy peppers? Zelda Breath Of The Wild Where can I find spicy peppers?

Posted On: May 3, 2023
I used all the spicy peppers and the old man says that I will find them by the citadel of time, but I've searched and found nothing. What does this plant look like and where is it? Question ...[More]


Is there any way in Minecraft to detect who deposited a diamond into a chest using command blocks? Is there any way in Minecraft to detect who deposited a diamond into a chest using command blocks?

Posted On: April 26, 2024
So far, I've been able to detect when a diamond is placed into a chest's inventory but how can I detect who placed that diamond?I'd prefer not to use the nearest player because someone else could pote...[More]


Elder Scrolls Quest objectives not updating, even though the quest is already completed Elder Scrolls Quest objectives not updating, even though the quest is already completed

Posted On: March 9, 2023
Are there any console commands or mods that can fix this? It's for the “Liberate Haafingar” and “Report to Ulfric Stormcloak” objectives. Question from user cyber at ...[More]


How do I make food? How do I make food?

Posted On: March 29, 2024
In The Planet Crafter, I'm building my base, and I have enough food for now. I don't have any machines to make food, but I know I'm going to eventually run out. I guess that, like with water, I'm goin...[More]


Do BG fans feel threatened by Bethesda's Starfield? Do BG fans feel threatened by Bethesda's Starfield?

Posted On: September 24, 2023
Do you think Starfield is going to completely overshadow BG3? Question from user ThanosofTitan92 at BaldursGate3 at reddit. Answer: No. Answer from user funkyfritter at BaldursGate3 at red...[More]


Diablo IV: Is the Elementalist glyph triggered by +X elemental damage affixes? Diablo IV: Is the Elementalist glyph triggered by +X elemental damage affixes?

Posted On: August 21, 2023
The Elementalist Glyph says:. Dealing Fire, Cold, or Lightning damage to an enemy increases all damage you deal to them by 5%[x] for 10 seconds, stacking once per element. I have an item with th...[More]


Attention to detail is awesome! Attention to detail is awesome!

Posted On: September 6, 2023
I’ve spent a lot of time in the Middle East/Africa. There is a non spin-able globe in the headmasters office. Given that the game takes place in 1890, while it’s not 100% perfect, the glob...[More]


What do the stars under can produce mean in against the storm What do the stars under can produce mean in against the storm

Posted On: February 7, 2023
Does it mean it can produce those goods faster, higher quality or what? Is it worth it to replace buildings with higher starred versions or prioritize going for buildings with new stuff?So for example...[More]