Hello, I am making a mini game and I need a bit of assistance. To prevent players from staying away from other players for the entire game, I want to implement a system where players get an effect if they are not near other players for a set amount of time. I think I have the rest of the system figured out, but I could not figure out how to affect a player if they don't go near another player for a while.
The command I'm currently using is /execute as @a[x=950,y=50,z=950,dx=100,dy=50,dz=100] unless entity @a[distance=..5] run effect give @s minecraft:wither 1 2 true
Right off the bat, I knew this command wouldn't work, because it takes into account the executing entity as a player within a radius of 5, but I can't figure out a way to exclude the executing entity. Since a player is always within 5 blocks of themself, they will never get the wither effect for staying away from other players, if that makes sense. I tried adding a [email protected] to exclude the executing entity, but that format is invalid and doesn't do any good.
If anyone knows how to give an effect to a player if they aren't near other players for a while, that would be great! Thanks!
Edit: Apparently the format I currently have still does give the wither effect to players in the specified area, but even if they're near other players, which I don't want. I want it to give the effect to players only when they aren't near other players.
Figured out a solution. If you make the @a[distance=..5] to be @a[distance=0.01..5] then it will only test for players outside of your exact location. I also added an "at @s" so that it would test for players within a 5-block radius of the player, rather than where the command block was situated. I totally forgot about that. Never thought it would be that simple ;P