What i am trying to do is make an entity say hi when it is in a certain radius of another entity. I have used a scoreboard called PigProgress. What is happening is that I am giving a score of 1 to every porkchop item dropped. Then when a diamond is dropped next to i want them both to dissappear an then other things to happen.
I have tried this command but it has failed
/execute @e[score_PigProgress_min=1,score=1] ~ ~ ~ /execute @e[type=Item,r=1] {Item:{id:minecraft:diamond}} ~ ~ ~ /say hi
Best Answer
There are two things wrong with your command.
The target selector for the first execute is wrong, although I assume this to be a typo. It should (probably) be
@e[score_PigProgress_min=1,score_PigProgress=1]
although the second part is not really necessary, unless porkchops with a score of 2 are a different thing.
/execute
does not support matching dataTags, which is what you are attempting in the second execute. You will have to assign a scoreboard value for diamond items, similar to what you did with the porkchops.Lastly, to achieve what you want, I suggest summoning an invisible Armor Stand to work using the double execute and work from there. I.e.
This assumes all pork chops and only those have a PigProgress score of 1 or more, and all Diamond Items (and only those) have a
isDiamond
score of 1 or more.Now you can execute everything else (
/kill
ing the items, saying "Hi", etc.) from the armor stand usingDon't forget to kill the armor stand in the end as well.