Hello welcome to episode 263 today we’re going to be teleporting players that enter or leave a large or odd-shaped area probably the longest title we’ve had this is very similar to episode 259 but there’s a comment on there from celu Sparks about an alternate way to do it And I thought well it’s nice to have Alternatives and this is a good one so uh I thought I’d show you I’m going to make my area so our last version of was checking a square area oh there’s a I should fill that in really shouldn’t I Uh this time we’re going to check an area which is just a little bit different shaped there we go we’ll check that so you don’t have to put this wall where it’s visible in fact selus Spar spark suggested you put it down at zero so it’s underneath the Bedrock you know the Bottom layer of Bedrock you put this down there no one’s ever going to see it but we’re going to put it there just so you can see it for the demonstration so we’re going to check for that red wall uh we’ll do a version that runs every Tick this is probably fine if you’re just doing it for a map uh you don’t have many players to uh check so should be all right if you’re doing it on a server or something or you’ve got lots of players we we’ll do a version which is timed as well so we will Execute as every player at themselves unless the block at their location but y55 as I said you can change that put it down at y z they’re never going to see it so it’s could be completely hidden unless it’s red wool then we will run TP that player well we better get some Coordinates done let’s go and get some coordinates we’ll TP them to here fi tab tab tab that’s a nice easy way of getting block coordinates and we’ll put that in now here is a mistake if I turn this on I’m going to be teleported in there and I’m not going To be able to get out and effectively I’m going to be stuck now what I like to do when I’m playing with teleports like that I like to put in somewhere so we’ll execute with all players who tag equals not Dev all players who don’t have the Dev tag now If I make a mistake I can just give myself that tag and I’m free is this worth doing because otherwise you’re going to have to open up your map in some editor or something and try and turn that command block off let’s turn this command block on right we’re in We’re in our Strange shaped area as long as we stay on the red wall we’re fine in fact we can even make ourselves a path and off we go but as soon as we leave we’re back in fantastic well that’s leaving the area What if we want to do it if they go into the area okay that’s no problem well I can’t get to command block luckily luckily we added that little bit in there so now I’m free so we can turn this off now okay and let’s change it and all we should have to Do is first of all make sure we’re teleporting them back outside so let’s teleport them to this will do random area fill tab tab tab copy so let’s change the location with teleporting them to we’ll do that first and then we’re just going to say if instead of unless that’s all we have To change if done and we’ll turn it back on nothing’s going to happen two reasons one I haven’t walked on the red wall and you’ll probably see a problem as well here two I’ve still got the tag so let’s get rid of that tag remove now do you see a Problem my area I’m checking is the same block as the area I’m teleporting to I am stuck I cannot Escape because I’m on a red wall so it’s teleporting me back here now luckily obviously I’m in Creative so I can just break that okay let’s change the color of that and fix that Problem there we go now let’s go into the odd shaped area we’ll go on to the end over here well here we are we’re back cool no problem working fine right let’s turn that off that’s probably all you need to be honest uh unless you’re making a rather Large map or as I say just want to slow it down do we need to run it every tick I mean that’s that’s 20 times a second we’re check in you probably don’t need to so let’s just do a timed version as well and we’ll need a scoreboard for This which I seem to have gone into the habit of always calling setup scoreboard objectives add timer dummy okay my setup these are the sort of things you run one time and never run again make sure we run it let’s pop a lever on top of that first thing we’re going to Do make it repeating um we are going to scoreboard players add we need a name of a fake player um a block check or floor check or something let’s call it block check block check timer one and I’m going to copy the fake player name and the Objective name contrl c copy that hey you should be on did I press cancel instead of uh done well that was rather silly wasn’t it okay well better do that again then scoreboard players add one done there we go make sure we press the right button then we go in Here and we’re going to check execute if score that score matches one run scoreboard Players block check uhoh what have we done well we haven’t said what we want to do to the score I’m just going to reset it cool now I’ve put matches one so that’s going to be resetting quite often Let’s put it every second so instead of running 20 times a second we will just run once a second done now we’ll have another block and this is where the command will go we’ll copy that control middle Mouse pop it on the end and we’ll make it chain always active And we’ll make it conditional and that should be okay just say done so conditional so it’s only going to run if this one runs and this one’s only going to run if the score equals 20 let’s turn it on H admittedly we can get in quite Far but we it’s 20 times less we’re checking the player’s position now so that’s pretty good now if you going to have a little thin thing like this obviously it might be possible yeah look see I got across that so it’s up to you what suits your needs if you are just Going to have a little tiny thin barrier to be honest this this way is probably not the best way to check this is a good way for checking big strange random shapes and obviously we can check it back the other way as well let’s just get the coordinates of sun block in There fill tap tap tap copy that and we’ll go in here we’ll check we’ve got the not Dev tag so execute as anyone who doesn’t have that tag and we’ll just change this to unless and we’ll go to the end and we’ll change the position turn it on every second if I Try and escape this way works better for this sort of for the once a second because I’m never going to get very far before I get teleported back in So this this is okay for this if they’re trying to escape right give myself that tag or I’m stuck in here forever Tag now again another use for that tag it’s it’s very it’s very useful for stopping you getting trapped what situation could we be trapped in here maybe we didn’t change this so had we we left that as this block copy that so if the player is Not on red if the player is not on red wool teleport them there well I’m teleporting them out of the red wool area that is pretty nasty because it’s teleporting me away from the red wall so I’m I’m never going to get very far now okay that is why I Always when when playing around with teleports and things for things that could do like that killing people on repeat teleporting people on repeat pop in that little tag there it can save you a lot of hassle in the long run okay job done stretched it on a bit longer than I Needed to really there didn’t I okay H thanks to ca Sparks for the suggestion and I will catch you soon bye-bye Video Information
This video, titled ‘263: Teleport players that enter or leave a random shaped area. [Minecraft Map Making]’, was uploaded by Infernal Device on 2024-03-09 14:43:05. It has garnered 665 views and 16 likes. The duration of the video is 00:09:59 or 599 seconds.
Ep263: An alternate way to detect players entering or leaving a large or random shaped area.
Java Version: 1.19
Suggested by: SelcouthSparks
Alternate: Episode 259 [Teleport players that leave an area.]
Commands, builds and ideas for people making their own Minecraft maps.
Check out my collabs on Coppit’s channel: https://www.youtube.com/c/CoppitJ
Join the CoppitCraft server that I play on and the Discord where I hang out. Server IP: 51.81.246.145:25588 Discord: https://discord.gg/amU84KykEu
The following commands are prefixed with three letters which represent the settings of the command block. E.g IUN: = Impulse Unconditional Needs_Redstone. These prefixes need to be removed if copying the commands.
Since angled brackets are not allowed in YouTube descriptions you will have to replace “greater than” with the appropriate angled bracket. Ascii code: 62
Commands used:
Every tick: RUA: execute as @a at @s unless block ~ 55 ~ red_wool run tp @s x y z
Setup for Timed: IUN: scoreboar objectives add timer dummy
Timed: RUA: scoreboard players add #floorCheck timer 1 CUA: execute if score #floorCheck timer matches 20.. run scoreboard players reset #floorCheck timer CCA: execute as @a at @s unless block ~ 55 ~ red_wool run tp @s x y z