1
As stated in the title, I'm curious if there's a way to set an objective for an entity based on another entity. For example, here's my command
Basically I have an entity [bcursor], who is used to point at things. I have an array of slimes 2 blocks above it (hence the [type=Slime,~,~2,~] section). The command seems to work based on this 'previous output' entry:
The issue is that the entity in that location is supposed to perform an action based on that outcome, which has been tested by manually setting it for the objective, but yeah.
I'd prefer to use relative coordinates as there are 162 different entities above the bcursor entity and I'd really prefer not to have to make 162 command blocks if at all possible.
Thanks
execute @e[name=bcursor] ~ ~ ~ detect ~ ~5 ~ stained_hardened_clay 9 ~ ~ ~ scoreboard players set @e[type=Slime,~,~2,~] hit 1
Basically I have an entity [bcursor], who is used to point at things. I have an array of slimes 2 blocks above it (hence the [type=Slime,~,~2,~] section). The command seems to work based on this 'previous output' entry:
span>[22:23:31] Set score of hit for player @e[type=Slime,~,~2,~] to 1
The issue is that the entity in that location is supposed to perform an action based on that outcome, which has been tested by manually setting it for the objective, but yeah.
I'd prefer to use relative coordinates as there are 162 different entities above the bcursor entity and I'd really prefer not to have to make 162 command blocks if at all possible.
Thanks
Create an account or sign in to comment.
3
1
None of those worked. It just made all of the array entities increase in that objective. Thanks anyway though
I ended up doing a big workaround instead
I ended up doing a big workaround instead
1
Is your issue here that you essentially have a bunch of slimes, and you want to detect and execute a command from the one that is directly above bcursor? If so I believe you can do this with a nested execute:
Also just a sidenote on the command you currently have, if your output looks like this:
EDIT probably should have read the post right above me... Would have saved me quite a lot of typing XD
execute @e[name=bcursor] ~ ~2 ~ execute @e[type=Slime,r=0] ~ ~ ~ detect ~ ~3 ~ stained_hardened_clay 9 scoreboard players set @e[type=Slime,r=0] hit 1
Essentially this command finds bcursor and looks 2 blocks above it for a slime. If there is one there, then it will check if there is a clay 9 block 3 blocks above the slime (5 above bcursor). If there is, then that slime's hit score will be set to 1.Also just a sidenote on the command you currently have, if your output looks like this:
Set score of hit for player @e[type=Slime,~,~2,~] to 1
then your command didn't work right. You can't use relative coordinates inside a player selector, and I think if you want to be able to cut off the x= prefixes like you did you have to put them in the very front of the brackets. What this does is saves a score to the fake player "@e[type=Slime,~,~2,~]". If the actual slime has its score set, it will show the slime's UUID.EDIT probably should have read the post right above me... Would have saved me quite a lot of typing XD
1
/execute @e[name=bcursor] ~ ~2 ~ detect ~ ~3 ~ stained_hardened_clay 9 execute @e[type=Slime,c=1] ~ ~ ~ scoreboard players set @e[type=Slime,c=1] hit 1
This should work
This should work