Might not be exactly what u want but u might be able to use the distance from the scoreboard.
Minecraft
Welcome to the Minecraft community on Lemmy and Kbin!
The home for all posts related to the Minecraft franchise: from the classic game to the mobile ports, mods, adventure games, merchandise and similar!
Official Lemmy.world server available!
Lemmy.world hosts an official server that welcomes all players to contribute and have fun:
Minecraft Version: 1.20.x
Address: minecraft.lemmy.world
Please make sure you read our rules before posting.
Rules:
Rules can be clicked on to be expanded.
1: Treat all users with respect.
Bullying, threathening, doxxing, or toherwise hostile behaviors with any of our users will not be tolerated. Be civil, have fun.
2: Posts must be related to the Minecraft franchise.
This includes the main game, titles like Dungeons, fan art, wiki pages, toys, new feature votes, and similar content.
3: No advertising.
If you want to share a product you're a manufacturer or seller of, please contact the moderation team first. Affiliate links to online shopping stores or affiliate coupon codes are not allowed.
4: No piracy.
Links or discussions about cracked versions of games, unauthorized copies of copyrighted material and other similar piracy-related content are not allowed.
5: No NSFW or adult content.
This community is inclusive to users of all ages. Keep in mind Minecraft attracts children and adults alike. Therefore, no NSFW content is allowed.
6: No low-effort meme content.
Memes are allowed, and so are comics or other fan creations. However, low-effort reposts and otherwise overused memes will be removed.
Reddit reposts are allowed.
Reddit reposts are allowed, but you need to include the tag [Reddit] in the title.
Related communities:
-
PC Gaming: !pcgaming@lemmy.world
-
Games: !games@lemmy.world
-
PC Handhelds: !pchandhelds@lemmy.world
-
Minecraft modding: !moddedminecraft@sopuli.xyz
Damn, that's actually pretty clever.
Could maybe use command blocks and the invisible barrier blocks together somehow. Like moving a box of barriers around the player on a timed delay or after an input. Ive never used command blocks but some of the videos ive watched of games made with them seem like it could work.
Before I give you an actual answer, (which will probably be tomorrow since I'm sick rn) how big is the area where you are trying to capture players, and are you saying this area isn't square?
Kind of like an RPG where you only get given lets say, 7 meters.
I'm not really trying to limit the area, but instead the distance. So it would make a theoretical circle of movement.
I only mention squares because worldborders are square, not bad, but probs could be better.
Also, since it's turn based, it would be nice to have only one person move at a time.
Hope u get well soon :-]
I figured out a couple of commands for you to keep the player in a certain radius. It does this by teleporting a marker entity to your position every tick, but only within the radius of the sphere, so once the player leaves the sphere a second command can teleport the player back to the marker. These commands can be run in repeating command blocks or a function. Here's the commands necessary:
Load Commands (run once)
/tag username add constrained
Adds a tag to the player to keep them in this spot. If you have multiple players you'll need to set up a system with multiple tags or teams or something similar. you can also change the target selector to whatever you want.
/execute at username run summon marker ~ ~ ~ {Tags:["pos"]}
Summons a marker at the player that will be used to track their location.
You can change the target selector as well as the tag for this one, just make sure to keep the tags consistent.
Tick Commands (run every tick)
execute positioned x y z as @e[type=marker,tag=pos,distance=..7] if entity @a[tag=constrained,distance=..7] run tp @a[tag=test,distance=..7,limit=1]
Runs as the closest marker with the tag pos inside a 7 block spherical radius centered around a chosen location. If a player with the tag constrained is found within this radius, the marker is teleported to the player. Make sure to change the x, y, and z coords to a location of your choice, you can change the radius to something other then 7, and you can change the tag names.
execute positioned x y z as @a[tag=constrained,distance=7..,limit=1] run tp @e[type=minecraft:marker,tag=pos,limit=1]
Runs as the closest player with the tag constrained outside a 7 block spherical radius. If found, it teleports the player to a marker entity with the tag pos inside of the 7 block radius. Make sure to change the x, y, and z coords to a location of your choice, you can change the radius to something other then 7, and you can change the tag names.
See if this works for you. If it doesn't, let me know, or just try a different method.