1

Hey I'm trying to use command blocks to detect if an entity is in a players point of view and then effect said player with instant damage or something along the lines of that. So far this is what I have, but it is not working, please help.

 /execute @e[name=SlenderMob] ~ ~ ~ /execute @p[rym=1,ry=2] ~ ~ ~
/effect @s instant_damage 1 0 true

If you don't understand the question please explain what you don't understand so I can evaluate.

  • Would it work to just put an invisible enderman at that position? Otherwise you need something called "raycasting", which either needs a lot of Math or a lot of commands. – Fabian Röling Oct 15 '17 at 1:09
  • the enderman thing might work but how might i detect who looked at the enderman? – HungryBoy02 Oct 15 '17 at 1:10
  • And how would i detect if the enderman got agrovatted? – HungryBoy02 Oct 15 '17 at 2:43
  • I'm not sure. There's probably no elegant solution to this. But raycasting also can't be called an "elegant solution". If you just google "Minecraft raycasting", there are many different versions. Does that do what you want? – Fabian Röling Oct 15 '17 at 4:02
  • Unfortunately no, this did not help. – HungryBoy02 Oct 20 '17 at 0:52
-1

I'm not a pro at these things, but you might want to get rid of the 2nd and 3rd slashes, and put[name=SlenderMob]right next to @e. If that doesn't work I can't help you.

  • Wait is this command for 1.13? – Stetson Daisy Aug 3 '18 at 13:57
  • This question was asked in October 2017 so it most definitely was for 1.12. – Virusbomb Aug 3 '18 at 14:19

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.