1

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
  • 1
    Have you tried making this yourself? If so, I'd recommend including that. Arqade works best when you've tried something, and are stuck. You get a better answer, and answerers know what you've already tried. So everybody wins! – Frank Jul 5 '15 at 13:50
  • You should add that to your question, not as a comment. – pinckerman Jul 5 '15 at 14:06
1

There are two things wrong with your command.

  1. 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.

  2. /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.

/execute @e[type=Item,score_PigProgress_min=1] ~ ~ ~ /execute @e[type=Item,score_isDiamond_min=1,r=1] ~ ~ ~ /summon ArmorStand ~ ~ ~ {CustomName:"Marker1",Marker:1b,Invisible:1,Invulnerable:1,NoGravity:1}

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 (/killing the items, saying "Hi", etc.) from the armor stand using

/execute @e[type=ArmorStand,name=Marker1] ~ ~ ~ <command>

Don't forget to kill the armor stand in the end as well.

  • thxs! This solves everything! – Chrisdude011 Jul 5 '15 at 14:54
  • @Chrisdude011, you should now accept the question. – Jacques Marais Jul 6 '15 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.