I have created a command that sets the nearest player that has press the button using armor stands with nbt. The actual detection for the "execute as" is working perfectly, but the scoreboard command afterwards acts like the command block is doing it.
execute as @e[nbt={Invulnerable:1b,Invisible:1b,Health:2f}] at @s if block ~ ~ ~ minecraft:stone_button[powered=true] run scoreboard players set @p ingame 5
whats Suppose to happen: the player presses the button, the command block executes as the armor stand and sets the nearest player to 5.
what actually happened: the player presses the button, the command block executes as the armor stand but then sets the player nearest to the command block to 5.
without the "at @s" the ~ ~ ~ wouldn't work for some reason.
The Meaning of Life, the Universe, and Everything.
Join Date:
2/11/2017
Posts:
662
Member Details
The "as" modifier only changes the executor. The "at" modifier will change the actual position. The "@p" selector works off of the position, not the executor. It makes perfect sense for the command not to work without "at @s".
I'm quite confused about why you want to do this in the first place. Wouldn't it be easier just to put a command block behind the button?
Rollback Post to RevisionRollBack
Remember those versions that minecraft pranked us with? Specifically:
Minecraft 2.0
Minecraft 1.VR-Pre1
Snapshot 15w14a
Minecraft 3D
Those are still downloadable! Watch this video for 2.0:
To download the other ones you need to make a folder in the versions folder for minecraft and put the client and JSON file for the versions in there. They all need to be named the same aside from file extensions. Once you do that, you will be able to choose that version when making a new profile with the minecraft launcher.
I'm making a more modular system for a map and I want to be able to make a spawn and extraction system by simply summoning an armor stand. My main problem is that it sets "@p ingame 5" but when i run the command it executes as the command block instead of the armor stand. Even though i used the "execute as" to say who executes the command. I dont know if this is a bug or if i'm not using it correctly.
The Meaning of Life, the Universe, and Everything.
Join Date:
2/11/2017
Posts:
662
Member Details
The command with the "at @s" added to it should work.
The "@p" selector selects the nearest player to the position of the command that is executing. The "as" modifier changes the executor, but not the position. It will still run at the position of the command block. The "at" modifier allows you to edit the position.
Rollback Post to RevisionRollBack
Remember those versions that minecraft pranked us with? Specifically:
Minecraft 2.0
Minecraft 1.VR-Pre1
Snapshot 15w14a
Minecraft 3D
Those are still downloadable! Watch this video for 2.0:
To download the other ones you need to make a folder in the versions folder for minecraft and put the client and JSON file for the versions in there. They all need to be named the same aside from file extensions. Once you do that, you will be able to choose that version when making a new profile with the minecraft launcher.
I have created a command that sets the nearest player that has press the button using armor stands with nbt. The actual detection for the "execute as" is working perfectly, but the scoreboard command afterwards acts like the command block is doing it.
execute as @e[nbt={Invulnerable:1b,Invisible:1b,Health:2f}] at @s if block ~ ~ ~ minecraft:stone_button[powered=true] run scoreboard players set @p ingame 5
whats Suppose to happen: the player presses the button, the command block executes as the armor stand and sets the nearest player to 5.
what actually happened: the player presses the button, the command block executes as the armor stand but then sets the player nearest to the command block to 5.
without the "at @s" the ~ ~ ~ wouldn't work for some reason.
The "as" modifier only changes the executor. The "at" modifier will change the actual position. The "@p" selector works off of the position, not the executor. It makes perfect sense for the command not to work without "at @s".
I'm quite confused about why you want to do this in the first place. Wouldn't it be easier just to put a command block behind the button?
Remember those versions that minecraft pranked us with? Specifically:
Those are still downloadable! Watch this video for 2.0:
https://www.youtube.com/watch?v=PQdu9LKAdIU
To download the other ones you need to make a folder in the versions folder for minecraft and put the client and JSON file for the versions in there. They all need to be named the same aside from file extensions. Once you do that, you will be able to choose that version when making a new profile with the minecraft launcher.
15w14a is on this link:
http://minecraft.gamepedia.com/15w14a
1.RV-Pre1 is here:
http://minecraft.gamepedia.com/1.RV-Pre1
Minecraft 3D is here:
https://minecraft.gamepedia.com/Java_Edition_3D_Shareware_v1.34
I'm making a more modular system for a map and I want to be able to make a spawn and extraction system by simply summoning an armor stand. My main problem is that it sets "@p ingame 5" but when i run the command it executes as the command block instead of the armor stand. Even though i used the "execute as" to say who executes the command. I dont know if this is a bug or if i'm not using it correctly.
The command with the "at @s" added to it should work.
The "@p" selector selects the nearest player to the position of the command that is executing. The "as" modifier changes the executor, but not the position. It will still run at the position of the command block. The "at" modifier allows you to edit the position.
Remember those versions that minecraft pranked us with? Specifically:
Those are still downloadable! Watch this video for 2.0:
https://www.youtube.com/watch?v=PQdu9LKAdIU
To download the other ones you need to make a folder in the versions folder for minecraft and put the client and JSON file for the versions in there. They all need to be named the same aside from file extensions. Once you do that, you will be able to choose that version when making a new profile with the minecraft launcher.
15w14a is on this link:
http://minecraft.gamepedia.com/15w14a
1.RV-Pre1 is here:
http://minecraft.gamepedia.com/1.RV-Pre1
Minecraft 3D is here:
https://minecraft.gamepedia.com/Java_Edition_3D_Shareware_v1.34
Ok it works now. Thanks for the help!