![]() The problem lies with setting the players' gamemode to survival when they go outside the village. gamemode 2 ? with the radius of the village. Just before changing the gamemode, you could use the same target selectors as above to inform your players of the change using the tellraw or title commands.Īn easy way to do this would be to set up a command block and an extremely fast clock in the middle of the village that is perpetually setting the game mode of all players within a certain radius (r) of the command block to adventure: Players in spectator or creative mode are not affected. Now, add two commands to the end of your clock to set the gamemodes correctly: gamemode 0 2 the m selector ensures that gamemodes are only set when appropriate. Of course, you can use other target selector arguments to define your area as well. If a player is not in any of these areas, his score will remain at 0 instead. Now, create a fill clock and run the following commands scoreboard players set inTown 0Įach of these will define an area from (Xn,Yn,Zn) to (Xn+dXn,Yn+dYn,Zn+dZn) as part of your town, and set the score for players in that area to 1. Start by setting up the objective itself, let's call it inTown: scoreboard objectives add inTown dummy ![]() To do so, we'll set up a scoreboard objective, which will be changed based on the location of the player, allowing us to define the protected area with multiple different commands, thus allowing arbitrary shapes. For example, your server might have a main road that is off-limits, but players are encouraged to build houses next to it, or catacombs beneath. While has given a nice and easy solution, I'd like to provide a more powerful and robust solution, in case the protected area is not adequately described by a sphere of radius R.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |