This is definitely some form of advanced command blocking, and I just can't get past this little problem. What I'm doing is taking the player and setting Player to gamemode 3 and summoning an ArmorStand. I have made this work for infinitely many players thus far be having the game give them an automatic id and then making the ArmorStand's score match theirs. The next step is the only part that I need to minimize. The player can activate a trigger called return and it will set them back to survival and teleport them to the ArmorStand with the same score as theirs. I know that all sounds like a lot, but I'll put the commands below for the return process. My question is how can I take this (Which requires 3 commands per id) and make it so that it fits all of the ids? Thanks for any help if this is possible.
Obviously, to make it for each id I can just change score_id_min=1,score_id=1 to any number I need for that particular id. I need to make this work for all players.
Well I'm not sure how you are setting the id's for each player so I'm going to start from the beginning as I have made a pretty effective method for this which I use frequently.
We will be using a few objectives:
/scoreboard objectives add id dummy
/scoreboard objectives add tempId dummy
/scoreboard objectives add spectate dummy
/scoreboard objectives add return dummy
Start off with a one time activated circuit to get the ball rolling:
/scoreboard players reset * id
/scoreboard players set #ServerScore id 1
This can also be activated at any time to reset the system and the following circuit will automatically reassign new id's to everyone.
This will be a repeating chain that is always active:
/scoreboard players add @a id 0
/scoreboard players operation @r[score_id=0] id = #ServerScore id
/scoreboard players add #ServerScore id 1
I'm not sure how you are marking people for when they are supposed to go into gamemode 3, so I'm just going to assume here. This will be continued on the same chain:
The way this works is by taking one player at a time that is ready to return and set every single armor stand's tempId score to that of the player returning. Then we subtract the original id from that number. Only one armor stand has the same id as the player so only one armor stand will have a new value set to 0, because 5-5=0. So now we act on the armor stand with a value of 0.
This is definitely some form of advanced command blocking, and I just can't get past this little problem. What I'm doing is taking the player and setting Player to gamemode 3 and summoning an ArmorStand. I have made this work for infinitely many players thus far be having the game give them an automatic id and then making the ArmorStand's score match theirs. The next step is the only part that I need to minimize. The player can activate a trigger called return and it will set them back to survival and teleport them to the ArmorStand with the same score as theirs. I know that all sounds like a lot, but I'll put the commands below for the return process. My question is how can I take this (Which requires 3 commands per id) and make it so that it fits all of the ids? Thanks for any help if this is possible.
Obviously, to make it for each id I can just change score_id_min=1,score_id=1 to any number I need for that particular id. I need to make this work for all players.
Well I'm not sure how you are setting the id's for each player so I'm going to start from the beginning as I have made a pretty effective method for this which I use frequently.
We will be using a few objectives:
/scoreboard objectives add id dummy
/scoreboard objectives add tempId dummy
/scoreboard objectives add spectate dummy
/scoreboard objectives add return dummy
Start off with a one time activated circuit to get the ball rolling:
/scoreboard players reset * id
/scoreboard players set #ServerScore id 1
This can also be activated at any time to reset the system and the following circuit will automatically reassign new id's to everyone.
This will be a repeating chain that is always active:
/scoreboard players add @a id 0
/scoreboard players operation @r[score_id=0] id = #ServerScore id
/scoreboard players add #ServerScore id 1
I'm not sure how you are marking people for when they are supposed to go into gamemode 3, so I'm just going to assume here. This will be continued on the same chain:
/execute @a[score_spectate_min=1] ~ ~ ~ summon ArmorStand ~ ~ ~ {NoGravity:1,Invisible:1,Marker:1,Invulnerable:1,CustomName:"Marker"}
/execute @a[score_spectate_min=1] ~ ~ ~ scoreboard players operation @e[type=ArmorStand,name=Marker,c=1] id = @a[c=1,r=0] id
/gamemode 3 @a[score_spectate_min=1]
/scoreboard players reset @a[score_spectate_min=1] spectate
And finally to actually answer your question.. This will also be continued in the same chain:
/scoreboard players add @r[score_return_min=1] return
/scoreboard players operation @e[type=ArmorStand,name=Marker] tempId = @a[score_return_min=2,c=1] id
/execute @e[type=ArmorStand,name=Marker] ~ ~ ~ scoreboard players operation @e[type=ArmorStand,name=Marker,c=1] tempId -= @e[type=ArmorStand,name=Marker,c=1] id
/tp @a[score_return_min=2] @e[type=ArmorStand,name=Marker,score_tempId=0,score_tempId_min=0]
/scoreboard players reset @a[score_return_min=2] return
/kill @e[type=ArmorStand,name=Marker,score_tempId=0,score_tempId_min=0]
The way this works is by taking one player at a time that is ready to return and set every single armor stand's tempId score to that of the player returning. Then we subtract the original id from that number. Only one armor stand has the same id as the player so only one armor stand will have a new value set to 0, because 5-5=0. So now we act on the armor stand with a value of 0.
Well, I first want to apologize for not giving you the necessary information, but you actually guessed EVERYTHING right
I really appreciate your help with this! Thank you!