I want to create a protection system for a Bedrock Realm with Armor Stands, the armor stand will teleport the players without the tag outside the area (the tag it's like and ID), but here is the problem, with a Book or Another Item I will summon an invisible armor stand and add a tag with the nearest player name.
For example, if the player is named Deku, how can I add the tag "Deku" to him and the armor stand?
/tag @p add @p gives me an error
Also, this is possible on Java? Or, can I use another system on bedrock to allow only the owner to get in?
That's because @p is a selector and it doesn't consider it a string.
For the PvE world I'm in they personally tag each of the players that own a property. Then they just change the property commands to not tp people with the players named tag. Unfortunately through this method you will have to manually add players.
You could do it with scoreboard and assign a unique score for each player. In a separate room you would have a bunch of these preset with an armor stand that tps each time someone has an area in front of the next set of commands. (I know this is hard to picture)
So when the first person gets their area. It would increment scoreboard. TP an armorstand at base to the next set of commands. And clone those commands to where you need them. This is how I would do protections automatically. Before I go into too much more detail I would want to know more.
Is this like a dungeon map and you are trying to prevent players from going into certain parts or is it structured like a property?
Well, Today I make a system to assign a unique ID to players with an armor stand, every time a new player enters the realm, the armor stand increases the score IDcounter by one and this is copied to the player ID score.
Well, now I can summon an armor stand with books and copy the player's ID score to the armor stand and match them.
And, I have another problem, I don't know how to execute a command as the player's armor stand if the ID score isn't the same.
Sorry, I'm not good at English, I don't know if I wrote this comment correctly :'(
I have the unique ID for the player and the armor stand, Now the problem is to compare if the players that are in the area have the same ID, if they ID score don't match, kick them out the zone with /tp command
I don't know if this is possible on Bedrock Edition
Yes, but it's possible to do this automatically comparing the player uniqueID with the armor stand uniqueID and leaving the players who doesn't have the same uniqueID?
For execute the commands I will use the /execute command and I will add a tag for the armor stands with uniqueID, the problem is to check if the player have the same uniqueID of the armor stand(the owner of the area) or if he doesn't have the same uniqueID(a thief) teleport outside the area
It shouldn't tbh. It generates very little unless you're doing a lot of fill and clone commands but the method that you are planning to do I imagine would generate very little and have a very low quantity of use as well.
I'm trying to figure out how to test between 2 entity scores. That way you can increment the scoreboard and assign it to the player and the armor stand and as long as entity1 == entity 2 leave it alone. Else tp them away. It seems like it should be feasible but I'm not 100% sure if it's doable in Bedrock
I'm going to create a function with multiple parts
For example, will execute your command:
execute @e[type=armor_stand,scores={uniqueID=1}] ~ ~ ~ execute @e[type=player,scores=!{uniqueID=1}] function protection/kick
But for all the possibles IDs between 1 and 150
If the armor stand is loaded (a player is near), the command above will run as the player the command /function protection/kick (that will be a precise teleport system)
A function that will check if the scores matches and kick the players if they don't have the same ID
If you want to do a function with all the ID's presetup and then just assign each player that claims a new house a new ID that will work great too. That's pretty much the way I did it but I was assuming you weren't planning to do functions.
Just make sure you have a radius selector around your target
The ID assing system will give every player a uniqueID, and when a player try to protect his house with the book, the book will summon an invisible armor stand and copy the player's ID to the armor stand and, it's ready
One more question... Just in case... Do you know if it's posible to use selectors for names (in the text, not in the syntax) in Bedrock Tellraw?
Np, I literally just tried to tellraw with selectors and it didn't work. I was able to include selector as a separate part of the cmd but the json ignored it and just output the tellraw msg
The Meaning of Life, the Universe, and Everything.
Join Date:
12/24/2018
Posts:
47
Member Details
I know this is resolved but as a side note, you might want to add some failsafes whenever you are using commands that tp players.
I would suggest adding a line to all your command blocks so that they don't affect you as the host, or alternatively any player that is in creative. That way you are freely able to move into any player's property if you need to for whatever reason.
sorry for necro post but you can tellraw players names with the selector json thing, you can also color text and other fun stuff here's some example command:
/tellraw @a [{"text":"asd ", "color":"green"},{"selector":"@p"}]
should print: asd <playername>
you can also do this to signs.
setblock ~ ~ ~ minecraft:oak_sign{Text1:'[{"text":"placer: "},{"selector":"@p","color":"green"}]'}
the ' ' are there to make the [] into a string. you could use "" but youd have to have a \ before every single " within those square brackets. (to not connect with the other " (this is known as character escaping))
I want to create a protection system for a Bedrock Realm with Armor Stands, the armor stand will teleport the players without the tag outside the area (the tag it's like and ID), but here is the problem, with a Book or Another Item I will summon an invisible armor stand and add a tag with the nearest player name.
For example, if the player is named Deku, how can I add the tag "Deku" to him and the armor stand?
/tag @p add @p gives me an error
Also, this is possible on Java? Or, can I use another system on bedrock to allow only the owner to get in?
Sorry for my bad English TwT
That's because @p is a selector and it doesn't consider it a string.
For the PvE world I'm in they personally tag each of the players that own a property. Then they just change the property commands to not tp people with the players named tag. Unfortunately through this method you will have to manually add players.
You could do it with scoreboard and assign a unique score for each player. In a separate room you would have a bunch of these preset with an armor stand that tps each time someone has an area in front of the next set of commands. (I know this is hard to picture)
So when the first person gets their area. It would increment scoreboard. TP an armorstand at base to the next set of commands. And clone those commands to where you need them. This is how I would do protections automatically. Before I go into too much more detail I would want to know more.
Is this like a dungeon map and you are trying to prevent players from going into certain parts or is it structured like a property?
It's a survival map for Bedrock Realm or Bedrock Server
I already have a TP System to Spawn and Player to Player with Books, but I need a Protection System for Players' Houses to prevent stealing
Do you mind manually setting it up? That can easily be done and I'd do as you mentioned above with the
/tag DrHubs add DrHubs
and then in the commands I'd exclude DrHubs. Idk if you are on PC but you can do ctrl+pickblock to pickblock command blocks but keep the data in them
Well, Today I make a system to assign a unique ID to players with an armor stand, every time a new player enters the realm, the armor stand increases the score IDcounter by one and this is copied to the player ID score.
Well, now I can summon an armor stand with books and copy the player's ID score to the armor stand and match them.
And, I have another problem, I don't know how to execute a command as the player's armor stand if the ID score isn't the same.
Sorry, I'm not good at English, I don't know if I wrote this comment correctly :'(
I have the unique ID for the player and the armor stand, Now the problem is to compare if the players that are in the area have the same ID, if they ID score don't match, kick them out the zone with /tp command
I don't know if this is possible on Bedrock Edition
Do you mean like whitelisting players on a property?
so for the person who is of score 1.
/tp @e[scores=!{uniqueID=1}] <target coordinates>
Yes, but it's possible to do this automatically comparing the player uniqueID with the armor stand uniqueID and leaving the players who doesn't have the same uniqueID?
For execute the commands I will use the /execute command and I will add a tag for the armor stands with uniqueID, the problem is to check if the player have the same uniqueID of the armor stand(the owner of the area) or if he doesn't have the same uniqueID(a thief) teleport outside the area
Didn't my command do that? Ill do it with your execute.
execute @e[type=armor_stand,scores={uniqueID=1}] ~ ~ ~ tp @e[type=player,scores=!{uniqueID=1},r=30] <target coordinates>
But this will need a command block for all uniqueIDs from 1 to (i don't known, 100 players or more?)
Isn't possible with one command block for all the future IDs?
I don't think it's possible but Ill try something tomorrow and lyk what I find
Any idea right? I think I can use Functions, but I don't know if executing 150 commands will decrease a lot the performance
It shouldn't tbh. It generates very little unless you're doing a lot of fill and clone commands but the method that you are planning to do I imagine would generate very little and have a very low quantity of use as well.
I'm trying to figure out how to test between 2 entity scores. That way you can increment the scoreboard and assign it to the player and the armor stand and as long as entity1 == entity 2 leave it alone. Else tp them away. It seems like it should be feasible but I'm not 100% sure if it's doable in Bedrock
Well, what do you think about .mcfunctions
I'm going to create a function with multiple parts
For example, will execute your command:
execute @e[type=armor_stand,scores={uniqueID=1}] ~ ~ ~ execute @e[type=player,scores=!{uniqueID=1}] function protection/kick
But for all the possibles IDs between 1 and 150
If the armor stand is loaded (a player is near), the command above will run as the player the command /function protection/kick (that will be a precise teleport system)
A function that will check if the scores matches and kick the players if they don't have the same ID
I will think in other form less complicated
If you want to do a function with all the ID's presetup and then just assign each player that claims a new house a new ID that will work great too. That's pretty much the way I did it but I was assuming you weren't planning to do functions.
Just make sure you have a radius selector around your target
So... It's resolved :3
The ID assing system will give every player a uniqueID, and when a player try to protect his house with the book, the book will summon an invisible armor stand and copy the player's ID to the armor stand and, it's ready
One more question... Just in case... Do you know if it's posible to use selectors for names (in the text, not in the syntax) in Bedrock Tellraw?
Also, thank you for the ideas :3
Np, I literally just tried to tellraw with selectors and it didn't work. I was able to include selector as a separate part of the cmd but the json ignored it and just output the tellraw msg
Mind posting the command block code? That would be cool.
I know this is resolved but as a side note, you might want to add some failsafes whenever you are using commands that tp players.
I would suggest adding a line to all your command blocks so that they don't affect you as the host, or alternatively any player that is in creative. That way you are freely able to move into any player's property if you need to for whatever reason.
sorry for necro post but you can tellraw players names with the selector json thing, you can also color text and other fun stuff here's some example command:
/tellraw @a [{"text":"asd ", "color":"green"},{"selector":"@p"}]
should print: asd <playername>
you can also do this to signs.
setblock ~ ~ ~ minecraft:oak_sign{Text1:'[{"text":"placer: "},{"selector":"@p","color":"green"}]'}
the ' ' are there to make the [] into a string. you could use "" but youd have to have a \ before every single " within those square brackets. (to not connect with the other " (this is known as character escaping))