0

I am making a spleef game where when the player falls after the final level they fall through a certain area and they get a tag removed. I am only stuck on detecting a full area and not just single cords.

So basically I am trying to execute a command when a player enters a certain area.
This can either be using a radius or just a set of two cords. I'd prefer to use two sets of cords though.

2 Answers 2

1

Radius: execute as @e[tag=center] at @s run tag @a[distance=..15] remove alive

replace 15 with desired radius, replace alive with the name of the tag you want to remove, spawn an entity with the tag "center" at the center of this tag removal radius

Set of two coords: execute as @e[tag=center] at @s run tag @a[x=,y=,z=,dx=,dy=,dz=] remove alive

Put a number after each = in the second target selector https://www.jdogofficial.com/how-to-use-dx-dy-dz-in-minecraft-radius-command/

2
  • 1
    execute as @a[tag=testtest] at @s run tag @a[x=197, y=-54, z=-185, dx=218, dy=-54, dz=-164] remove test didn't quite work. It says it failed to execute 'tag' as FuryRex09. I double-checked my cords as well. I have both tags on me.
    – FuryRex09
    Jan 9, 2023 at 23:29
  • for the first command I see why you'd execute at a center entity, assuming it marks the center of the detection area (which makes the as unneeded), but why do you execute as said entity for the cubic selection if you'll redefine the x/y/z anyways? No need for an execute here at all. Or leave out the x/y/z if you want to use the entity as the lower corner marker (though then the tag name is a bad choice).
    – Plagiatus
    Feb 6, 2023 at 6:50
1

You can do both, select players by distance / radius around a certain point or in an area defined by 2 sets of coordinates. For more info see here: https://minecraft.wiki/w/Target_selectors#Selecting_targets_by_distance

Radius

Using r and rm (in ) / distance (in ) you can define the minimum and maximum distance around a point you want to check. Say you want to check for anyone around 10 20 30 in a 50 block radius, it would look like this:

@a[x=10,y=20,z=30,r=50]          # bedrock
@a[x=10,y=20,z=30,distance=..50] # java

Cubic area

To define a cubic area for the selector to select players in, you can use dx/dy/dz. The d stands for "delta" which in math is generally used for a difference between two things. And that is also how it's used in the selector argument: You subtract the smaller coordinate corner from the bigger coordinate corner to get the dx/dy/dz values to use.
For example, say your area is from 10 20 30 to 30 50 70. Then the x/y/z coordinates would be the smaller set of coordinates, while dx/dy/dz would be calculated like this:

dx = 30 - 10 = 20
dy = 50 - 20 = 30
dz = 70 - 30 = 40

So the full selector would look like this:

@a[x=10,y=20,z=30,dx=20,dy=30,dz=40]

Three things to note about the dx selectors though:

  • The selected area checks for overlapping entity hitboxes, not entity feet position like the radius selector.
  • Setting all dx/dy/dz to 0 will make a 1x1x1 cube of selection area, and it's expanding from there.
  • If you define any single one of them, the unmentioned ones default to 0.

Command

So, for your system all you need is the following full command, depending which one you want to use.

/tag <selector> remove alive

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .