Arqade Asked on August 20, 2021
I want to have a redstone timer that has a signal into a command block, with /execute @a ~ ~ ~ testforblocks <Coordinate 1> <Coordinate 2> <Relative Position>
and then a compartor, testing if a structure 1 X away from the player (I may make it 2) is the same as a structure I built somewhere else. (A chest with a sign on top of it reading “[Case]” and then having 2 iron blocks next to the chest) Then, the chest will fill with random loot, and the iron and sign disappear. I know how to do the random loot, and how to make the blocks disappear, but using /execute
will only test if A player is next to the structure. How do I tell the players that are near the structure from the players that aren’t?
Note: this Answer is based off the assumption that you are making that structure using a command or making it yourself. Sorry if this is not correct.
A) Marking the structure:
First, whenever that structure is spawned, summon an armorstand in one of those blocks with the NBT tags Invisible, CustomName and Marker. (Ex. /summon ArmorStand x y z {Marker:1b, Invisible:1b, CustomName:bob}
)
B) marking the player as near the structure:
Make a dummy scoreboard (example name:nearS) Now add this command to a 20 t/s clock: execute @a ~ ~ ~ execute @e[type=ArmorStand,name=bob,r=1] ~ ~ ~ scoreboard players set @p nearS 1
and this command also on that clock: scoreboard players set @a nearS 0
(making 20 tick/s clock)
Then, you can distinguish which players are near it and which are not by their number on the scoreboard nearS.
Answered by Judge2020 on August 20, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP