Hello folks,
I'm back with another question that I need some help and or advice on. I am working on a 1.10 multiplayer mini game, and players throw ender pearls as a way to advance their position in particular areas of the map. If they successful throw their ender pearl and stay within the maps boundaries their /spawnpoint is saved at that location. If they are unsuccessful with their throw they are immediately teleport ed back to their last spawnpoint.
So I have a few things that I am trying to work out and I may be approaching this problem in all the wrong ways. Let me try to explain whats going through my head and ask for your help or guidance.
As for the setting of the spawnpoint, I thought about using a detect command like:
Problem, If the map was made out of one block that would be easy, but my map will have many materials and levels so constructing a check for every possible block type would be expensive and not really practical. The "out of boundry" areas could use barriers so perhaps I could get away with using something like: !minecraft:barriers as a detection but I am not sure if it's the best solution... Anyway, there are other issues so it might be mute anyway.
The next issue is with /spawnpoint. Unless there is a command I don't know about, the only way to put the player back is to kill them. I would prefer to teleport them then display a title saying "OUT OF BOUNDS" or something. I tried finding a way to teleport a player back to the spawnpoint without killing them but nada. In addition, I would like to execute a /tp command to prevent the players from walking around and force them to use the ender pearl as a form of progression. So a form of player control that was /tp accessible would probably be better anyway.
This lead me to think about a scoreboard objective that holds the players location as a score. But I couldn't work out how to get their location into the scoreboard let alone construct a command to act on it. My guess is that I would need more than one scoreboard to store their last location, weather they went out of bounds, and possibly other in which to calculate from.
So, I suspect I am over complicating things. So I thought I would ask for your opinions, and or sample commands that you used or would suggest that might work.
But as mentioned before, I would prefer not to kill them, and instead rely on a friendlier experience using teleportation to their previous spawnpoint. I think it's the setting of their coordinates into a scoreboard that I need help with. I was also thinking I might be able to summon an armor stand where they land, but need to work out how to manage them correctly so I do not create a problem with lag or multiplayer.
Even if you managed to get their coordinates into a scoreboard objective (you can't.) you wouldn't even be able to use it for anything. You cannot use scoreboard objective values as parameters for commands, aside from json formatted text.
The only thing other than using /spawnpoint and killing them is to summon an entity where you used to use /spawnpoint and then /tp the player to their specific spawned entity. This can get complex, but is still possible as long as the chunk that contains their spawnpoint entity is not unloaded.
If you are curious about my idea, I will go into more detail, but honestly if you have the keepInventory gamerule set to true, killing isn't really a bad option. It also makes room for a lot more command block mechanisms elsewhere. (The more running command blocks you have the more lag you create.)
Thanks for the insight @nigathan. The scoreboard idea seemed doomed when I found a showcase video of such an idea but took what appeared to be a few hundred command blocks to create. As mentioned in my last comment, I was also trying to work out the summoning and killing of armor stands on success of a throw. The chunks should be loaded as the distance from the player is at max what a player can throw an ender pearl.
I am very much interested in your ideas. So please feel free to share them. I am pretty noobish at command blocks, and there is much I do not know and understand yet. So ideas are fantastic.
FWIW, keep inventory is true, and killing the player is what I do currently.
Even if you managed to get their coordinates into a scoreboard objective (you can't.)
While the rest of your reply is true, this is not. It is very much possible to obtain a players X Y Z coords as scoreboard values. However yes, you cannot do anything with it after that.
While the rest of your reply is true, this is not. It is very much possible to obtain a players X Y Z coords as scoreboard values. However yes, you cannot do anything with it after that.
Without testing every possible coordinate? Sure you can "/tp @a ~ ~ ~" and their coords will be printed as the output of the command, but that doesn't allow any means of grabbing the info without some sort of external application or mod.
So the easiest way to setup some check points would probably be to manually summon armor stands everywhere you want to be a checkpoint, use a scoreboard objective to give each checkpoint a unique number greater than 0, then have these commands running:
If each armor stand has a different unique number then only one of them will have a tempCP score of 0 after these operations. That will be the one the player last touched. Also, be sure to make the armor stands NoGravity, Marker, Invulnerable or ender pearls will be able to hit them.
Don't forget to setup the two dummy objectives tempCP and checkPoint.
You can do it without checking every coord and without summoning any ArmorStands.
My good friend Shane Stone made a video on it. It uses a binary search to get the players location as a scoreboard and then displays it in chat. He even went as far as to add some decimal accuracy, so if you remove that and only go for integers that cuts down on the command blocks by a decent amount.
Thanks for the feedback fellas. I thinkwhat I have learned so far is that I probably need to use armor stands to do what I envision. @nigathan, the checkpoint example helps me to visualize what I need to do so thanks. In my case players are not activating checkpoints per-se, but rather unable to move except by throwing an ender pearl. After every successful throw I need to summon an armor stand where they stand. If their throw ends up out of bounds then no armor stand will be summoned and they will be teleported back to their last location. The exact mechanics I don't know yet how to achieve this, but I think from what you both have said, this should be the best approach.
Then instead of assigning each armor stand a different objective value, assign each player one, assign the armor stand you are summoning the same value as the player, and do essentially the same operations to find the correct armor stand. Also don't forget to kill all armor stands that have the same value as the player before summoning the new one.
I'm actually heading to bed now, but later if you like, I can explain a quick and easy method for assigning players a unique value upon joining the server. They will keep this value even if they leave and no one else will be given the same one.
Thanks Nigathan, Any help you can provide is absolutely welcome. And thanks for the feedback. The mention about killing stands before setting a new one was just what I needed. It seems so obvious after you mention it. I was trying to work out a tagging method to just summon them sequentially then killing them all at the end of the round using yet another tag. /execute @e[type=ArmorStand,tag=CheckPointStand] In this case CheckPointStand was global to all players. I like your idea better as the map would be littered with armorstands until the round ends. Summoning a new one only after clearing previous armor stands will help with clutter greatly. Especially since one of the mechanics I have in place is put players who complete the round into spectator mode and automatically teleport them to a random players still in the game. (don't want people hanging out in a boring lobby while friends are still battling it out) Reducing armor stands would be aesthetically pleasing since players in spectator mode can see invisible armor stands.
Hello again,
So I have been trying to work this out on my own for the last two nights and I am just not making any real progress. I wanted to see if I could get some more help on this subject.
So here is what I have been messing with so far.
I added a dummy scoreboard called PlayerOnGround
I then detect if the player is in the air and set the PlayerOnGround value to 0 if they are in the air or 1 if they are on the ground.
I set up a conditional command to summon an armor stand when the player is on the ground. This sort of worked when the player jumped, except it would never work when the player ender pearled since the value of PlayerOnGround never changed. I tried setting it to 0 when the player threw an ender pearl but that didn't work either. I believe the command I used went something like this: /execute @e[type=ThrownEnderpearl] ~ ~ ~ /scoreboard players set @p PlayerOnGround 0
It all may be mute if I cannot figure out how to tie the armor stand to the player. What I mean is, I am summoning an armor stand called CheckpointStand, however in a multiplayer setting everyone would summon an armor stand with the same name. If I kill all armor stands with a name of CheckpointStand it would kill them for other players as well. also I could not /tp them back to their armor stand without a unique identifier. I tried adding @p as if it were a variable in the name, but that obviously doesn't work. :/
So my questions are as follows:
How would you suggest I go about summoning an armor stand for the player when they are on the ground and after ender pearling?
How do you /tp the player back to their armor stand if they fail their last throw (e.g. Out of bounds) The two issues I see are a lack of unique identifiers, and the killing of armor stands before placing new ones means the player could be left with no armor stand to be returned to.
How (or when) should armor stands be killed
Sorry if this isn't making the most sense. It's late and I am tired from trying to work this out for two days (very late nights)
If I need to clarify anything let me know what I am missing and I will try to address it when I am at work tomorrow.
criteria for throwing ender pearl should be stat.useItem.ender_pearl.
You can execute players who has that score >= 1 to summon an armorstand.
tp back to their armorstand: give a unique score to players(give a score to player and add one...repeat this, you should do it at first), and summon the armorstand, and 'execute <player selector> ~ ~ ~ scoreboard players operation @e[c=1,type=ArmorStand] objective = @p objective' to give them the same score. When you need to teleport the player back, just 'scoreboard players operation @e[type=ArmorStand] objective -= <player> objective'
And you can teleport the player back to the armorstand having 0 score.
When those armorstands should be killed: when there are no ender_pearl(maybe you should delay for a few gameticks)
Thanks @pca006132 I really want to understand this but I am having a difficult time constructing the commands in a way that makes sense. I feel like I am grasping at straws especially with the scoreboard operations. Let me see if I understand what your suggesting by throwing out what I think I understand so far. If you could help fill in the blanks or make corrections to my mistakes that would be very helpful.
So first, you suggest creating creating a scoreboard to give everyone a unique id. I had no idea how to do this so I went looking for a solution and found what appeared to be a decent tutorial by CrushedPixel. Your may already be familiar with it but it looks like this.
/scoreboard players add @a id 0
/execute @e[score_id=0,c=1] ~ ~ ~ /scoreboard players add #maxid id 1
/execute @e[score_id=0,c=1] ~ ~ ~ /scoreboard players operation @e[c=1,r=0] id = #maxid id
With an id system in place I believe I can set the score for an armor stand equal to the score used as the unique ID for the player.
/summon ArmorStand ~ ~1 ~ {CustomName:"CheckpointStand"}
/scoreboard players set @e[type=ArmorStand,name=CheckpointStand] id #maxid
The following commands as you suggested are the part that gets me. I cant work out how to construct the command as I am not clear what it's doing and why. I slotted in a few of the pieces they are probably wrong. Lets see if I am on the right track tho:
/execute ~ ~ ~ scoreboard players operation @e[c=1,type=ArmorStand] id = @p #maxid Does this 'objective = @p objective' statement look right? My assumption is that I needed to set the id score equal to the players unique id.
/scoreboard players operation @e[type=ArmorStand] id -= @p[r=0] id
The second command is equally confusing, I wasnt sure if was a selector for a specific player or if @p was whoever was closes to the armor stand. Or if this was intended to be part of an execute command that teleported the player as part of a condition.
Sorry for the wall of text. I am new to command blocks and really trying to understand but I clearly am not a good programmer.
For the /execute ~ ~ ~ scoreboard players operation @e[c=1,type=ArmorStand] id = @p #maxid, it should be /execute @e[c=1,type=ArmorStand,tag=new] ~ ~ ~ scoreboard players operation @e[c=1,type=ArmorStand] id = @p #maxid. When you summon the ArmorStand, it is better to have a tag 'new', and remove the tag after finishing scoreboard operation with it, to make sure that you won't mess with other armorstands.
The last command is wrong. The player who should execute that command is the player who NEED TO BE TELEPORTED BACK, but not @p, because we are comparing the id of the player who need to be teleported back with the score of armorstands, rather than comparing score of the armorstands to the id of the nearest player.
I am sorry that my explanation is quite confusing:P, I am not familiar with explaining. Sorry for no highlighting as i type it on my phone.
Hope that you will become a master in command block and having fun with it.:D
Btw, i am trying to simplify these logics into something like coding(features like converting expression into operations, custom commands for some clusy work, if/else statements etc.), there are a lot of works that need to be done(coding and logics in command block), if you are interested in it, can you please give your email to me? So we can discuss about the syntax and logics etc.
Hello folks,
I'm back with another question that I need some help and or advice on. I am working on a 1.10 multiplayer mini game, and players throw ender pearls as a way to advance their position in particular areas of the map. If they successful throw their ender pearl and stay within the maps boundaries their /spawnpoint is saved at that location. If they are unsuccessful with their throw they are immediately teleport ed back to their last spawnpoint.
So I have a few things that I am trying to work out and I may be approaching this problem in all the wrong ways. Let me try to explain whats going through my head and ask for your help or guidance.
As for the setting of the spawnpoint, I thought about using a detect command like:
Problem, If the map was made out of one block that would be easy, but my map will have many materials and levels so constructing a check for every possible block type would be expensive and not really practical. The "out of boundry" areas could use barriers so perhaps I could get away with using something like: !minecraft:barriers as a detection but I am not sure if it's the best solution... Anyway, there are other issues so it might be mute anyway.
The next issue is with /spawnpoint. Unless there is a command I don't know about, the only way to put the player back is to kill them. I would prefer to teleport them then display a title saying "OUT OF BOUNDS" or something. I tried finding a way to teleport a player back to the spawnpoint without killing them but nada. In addition, I would like to execute a /tp command to prevent the players from walking around and force them to use the ender pearl as a form of progression. So a form of player control that was /tp accessible would probably be better anyway.
This lead me to think about a scoreboard objective that holds the players location as a score. But I couldn't work out how to get their location into the scoreboard let alone construct a command to act on it. My guess is that I would need more than one scoreboard to store their last location, weather they went out of bounds, and possibly other in which to calculate from.
So, I suspect I am over complicating things. So I thought I would ask for your opinions, and or sample commands that you used or would suggest that might work.
As always, thank in advance!
Yes, that is what I am doing currently as I work through this issue. I am killing the player when I detect that they are standing on a barrier block.
But as mentioned before, I would prefer not to kill them, and instead rely on a friendlier experience using teleportation to their previous spawnpoint. I think it's the setting of their coordinates into a scoreboard that I need help with. I was also thinking I might be able to summon an armor stand where they land, but need to work out how to manage them correctly so I do not create a problem with lag or multiplayer.
Even if you managed to get their coordinates into a scoreboard objective (you can't.) you wouldn't even be able to use it for anything. You cannot use scoreboard objective values as parameters for commands, aside from json formatted text.
The only thing other than using /spawnpoint and killing them is to summon an entity where you used to use /spawnpoint and then /tp the player to their specific spawned entity. This can get complex, but is still possible as long as the chunk that contains their spawnpoint entity is not unloaded.
If you are curious about my idea, I will go into more detail, but honestly if you have the keepInventory gamerule set to true, killing isn't really a bad option. It also makes room for a lot more command block mechanisms elsewhere. (The more running command blocks you have the more lag you create.)
Thanks for the insight @nigathan. The scoreboard idea seemed doomed when I found a showcase video of such an idea but took what appeared to be a few hundred command blocks to create. As mentioned in my last comment, I was also trying to work out the summoning and killing of armor stands on success of a throw. The chunks should be loaded as the distance from the player is at max what a player can throw an ender pearl.
I am very much interested in your ideas. So please feel free to share them. I am pretty noobish at command blocks, and there is much I do not know and understand yet. So ideas are fantastic.
FWIW, keep inventory is true, and killing the player is what I do currently.
While the rest of your reply is true, this is not. It is very much possible to obtain a players X Y Z coords as scoreboard values. However yes, you cannot do anything with it after that.
Without testing every possible coordinate? Sure you can "/tp @a ~ ~ ~" and their coords will be printed as the output of the command, but that doesn't allow any means of grabbing the info without some sort of external application or mod.
So the easiest way to setup some check points would probably be to manually summon armor stands everywhere you want to be a checkpoint, use a scoreboard objective to give each checkpoint a unique number greater than 0, then have these commands running:
/scoreboard players tag @a[tag=onGround] remove onGround {OnGround:0b}
/scoreboard players tag @a[tag=!onGround] add onGround {OnGround:1b}
/execute @e[type=ArmorStand,score_checkPoint_min=1] ~ ~ ~ scoreboard players operation @a[tag=onGround,r=1] checkPoint = @e[type=ArmorStand,c=1] checkPoint
The reason I added the onGround check is so if a player just jumps past the check point and falls, they never really quite made the check point.
Now where you used to /kill the player use this instead:
/scoreboard players tag @r[arguments_that_a_respawning_player_has] add respawn
Conditional: /execute @e[type=ArmorStand,score_checkPoint_min=1] ~ ~ ~ scoreboard players operation @e[type=ArmorStand,c=1] tempCP = @e[type=ArmorStand,c=1] checkPoint
Conditional: /scoreboard players operation @e[type=ArmorStand,score_checkPoint_min=1] tempCP -= @a[tag=respawn,c=1] checkPoint
/tp @a[tag=respawn,c=1] @e[type=ArmorStand,score_checkPoint_min=1,score_tempCP_min=0,score_tempCP=0,c=1]
/scoreboard players tag @a[tag=respawn] remove respawn
If each armor stand has a different unique number then only one of them will have a tempCP score of 0 after these operations. That will be the one the player last touched. Also, be sure to make the armor stands NoGravity, Marker, Invulnerable or ender pearls will be able to hit them.
Don't forget to setup the two dummy objectives tempCP and checkPoint.
You can do it without checking every coord and without summoning any ArmorStands.
My good friend Shane Stone made a video on it. It uses a binary search to get the players location as a scoreboard and then displays it in chat. He even went as far as to add some decimal accuracy, so if you remove that and only go for integers that cuts down on the command blocks by a decent amount.
Thanks for the feedback fellas. I thinkwhat I have learned so far is that I probably need to use armor stands to do what I envision. @nigathan, the checkpoint example helps me to visualize what I need to do so thanks. In my case players are not activating checkpoints per-se, but rather unable to move except by throwing an ender pearl. After every successful throw I need to summon an armor stand where they stand. If their throw ends up out of bounds then no armor stand will be summoned and they will be teleported back to their last location. The exact mechanics I don't know yet how to achieve this, but I think from what you both have said, this should be the best approach.
Then instead of assigning each armor stand a different objective value, assign each player one, assign the armor stand you are summoning the same value as the player, and do essentially the same operations to find the correct armor stand. Also don't forget to kill all armor stands that have the same value as the player before summoning the new one.
I'm actually heading to bed now, but later if you like, I can explain a quick and easy method for assigning players a unique value upon joining the server. They will keep this value even if they leave and no one else will be given the same one.
Thanks Nigathan, Any help you can provide is absolutely welcome. And thanks for the feedback. The mention about killing stands before setting a new one was just what I needed. It seems so obvious after you mention it. I was trying to work out a tagging method to just summon them sequentially then killing them all at the end of the round using yet another tag. /execute @e[type=ArmorStand,tag=CheckPointStand] In this case CheckPointStand was global to all players. I like your idea better as the map would be littered with armorstands until the round ends. Summoning a new one only after clearing previous armor stands will help with clutter greatly. Especially since one of the mechanics I have in place is put players who complete the round into spectator mode and automatically teleport them to a random players still in the game. (don't want people hanging out in a boring lobby while friends are still battling it out) Reducing armor stands would be aesthetically pleasing since players in spectator mode can see invisible armor stands.
Thanks again for the feedback and support!
Hello again,
So I have been trying to work this out on my own for the last two nights and I am just not making any real progress. I wanted to see if I could get some more help on this subject.
So here is what I have been messing with so far.
It all may be mute if I cannot figure out how to tie the armor stand to the player. What I mean is, I am summoning an armor stand called CheckpointStand, however in a multiplayer setting everyone would summon an armor stand with the same name. If I kill all armor stands with a name of CheckpointStand it would kill them for other players as well. also I could not /tp them back to their armor stand without a unique identifier. I tried adding @p as if it were a variable in the name, but that obviously doesn't work. :/
So my questions are as follows:
Sorry if this isn't making the most sense. It's late and I am tired from trying to work this out for two days (very late nights)
If I need to clarify anything let me know what I am missing and I will try to address it when I am at work tomorrow.
criteria for throwing ender pearl should be stat.useItem.ender_pearl.
You can execute players who has that score >= 1 to summon an armorstand.
tp back to their armorstand: give a unique score to players(give a score to player and add one...repeat this, you should do it at first), and summon the armorstand, and 'execute <player selector> ~ ~ ~ scoreboard players operation @e[c=1,type=ArmorStand] objective = @p objective' to give them the same score. When you need to teleport the player back, just 'scoreboard players operation @e[type=ArmorStand] objective -= <player> objective'
And you can teleport the player back to the armorstand having 0 score.
When those armorstands should be killed: when there are no ender_pearl(maybe you should delay for a few gameticks)
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-tools/2703820-command-pcb-command-editor-ooc-generator-for-mc-1
pcb, a command editor and OOC generator
Thanks @pca006132 I really want to understand this but I am having a difficult time constructing the commands in a way that makes sense. I feel like I am grasping at straws especially with the scoreboard operations. Let me see if I understand what your suggesting by throwing out what I think I understand so far. If you could help fill in the blanks or make corrections to my mistakes that would be very helpful.
So first, you suggest creating creating a scoreboard to give everyone a unique id. I had no idea how to do this so I went looking for a solution and found what appeared to be a decent tutorial by CrushedPixel. Your may already be familiar with it but it looks like this.
/scoreboard players add @a id 0
/execute @e[score_id=0,c=1] ~ ~ ~ /scoreboard players add #maxid id 1
/execute @e[score_id=0,c=1] ~ ~ ~ /scoreboard players operation @e[c=1,r=0] id = #maxid id
With an id system in place I believe I can set the score for an armor stand equal to the score used as the unique ID for the player.
/summon ArmorStand ~ ~1 ~ {CustomName:"CheckpointStand"}
/scoreboard players set @e[type=ArmorStand,name=CheckpointStand] id #maxid
The following commands as you suggested are the part that gets me. I cant work out how to construct the command as I am not clear what it's doing and why. I slotted in a few of the pieces they are probably wrong. Lets see if I am on the right track tho:
/execute ~ ~ ~ scoreboard players operation @e[c=1,type=ArmorStand] id = @p #maxid Does this 'objective = @p objective' statement look right? My assumption is that I needed to set the id score equal to the players unique id.
/scoreboard players operation @e[type=ArmorStand] id -= @p[r=0] id
The second command is equally confusing, I wasnt sure if was a selector for a specific player or if @p was whoever was closes to the armor stand. Or if this was intended to be part of an execute command that teleported the player as part of a condition.
Sorry for the wall of text. I am new to command blocks and really trying to understand but I clearly am not a good programmer.
For the /execute ~ ~ ~ scoreboard players operation @e[c=1,type=ArmorStand] id = @p #maxid, it should be /execute @e[c=1,type=ArmorStand,tag=new] ~ ~ ~ scoreboard players operation @e[c=1,type=ArmorStand] id = @p #maxid. When you summon the ArmorStand, it is better to have a tag 'new', and remove the tag after finishing scoreboard operation with it, to make sure that you won't mess with other armorstands.
The last command is wrong. The player who should execute that command is the player who NEED TO BE TELEPORTED BACK, but not @p, because we are comparing the id of the player who need to be teleported back with the score of armorstands, rather than comparing score of the armorstands to the id of the nearest player.
I am sorry that my explanation is quite confusing:P, I am not familiar with explaining. Sorry for no highlighting as i type it on my phone.
Hope that you will become a master in command block and having fun with it.:D
Btw, i am trying to simplify these logics into something like coding(features like converting expression into operations, custom commands for some clusy work, if/else statements etc.), there are a lot of works that need to be done(coding and logics in command block), if you are interested in it, can you please give your email to me? So we can discuss about the syntax and logics etc.
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-tools/2703820-command-pcb-command-editor-ooc-generator-for-mc-1
pcb, a command editor and OOC generator
Just quick question, how do you post a NEW topic now without replying to someone else? Kinda off topic, but idk...
i am wondering where should i post about my project, mapping tools or command block?
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-tools/2703820-command-pcb-command-editor-ooc-generator-for-mc-1
pcb, a command editor and OOC generator
Planet Minecraft, or if ur uploading it as an official thing, Minecraft Maps.