2

I am building a Adventure map and I want to include a Backstab-like feature, where when player is behind "Mob" he is given a diamond sword with sharpness 99999. If he is not, the sword is removed. (Sword will have a durability of 1 so it breaks when you use it)

Is that possible in any way?

5
  • Even if you get an answer here, I suggest looking for alternative ways to implement it. If you give a player a sword, he will not have it equipped, unless he happens to have the lowest (or highest, idr) empty slot selected.
    – MrLemon
    Jul 1, 2015 at 15:37
  • 3
    I'd recommend a brief-duration potion/beacon effect.
    – Kevin
    Jul 1, 2015 at 15:41
  • I know of a way using execute commands to set a scoreboard objective and work from there. The problem is that you'll have to use a whole lot of commands for all sorts of different angles, and manually set a "behind" area for every angle.
    – MrLemon
    Jul 1, 2015 at 15:42
  • I remember someone on reddit posted a command block to do active camo, I imagine using that would be a great place to start
    – Cole Busby
    Jul 1, 2015 at 15:54
  • Actually, for single-player this should be fairly easy, since you do not have to check if a mob is behind you at all, just if he is looking in the same direction as you. If you are looking in the same direction you have to be behind him to target him. Not sure about multiplayer though.
    – MrLemon
    Jul 1, 2015 at 15:58

1 Answer 1

-1

Yes, but you need a lot of command blocks. The more you'll have, the more accurate this will be. Basically you need to have a command block for every mob rotation or so.

For example:

The first command block checks if the player is meeting the requirements while the mob is facing the 0 to 5 degree y rotation.

The second command block checks if the player is meeting the requirements while the mob is facing the 5 to 10 degree y rotation.

The third command block...

...

...

...The < insert big number here > command block checks if the player is meeting the requirements while the mob is facing the 355 to 360 (=0) y rotation.

1
  • Your idea doesn't seem to test whether the player is actually behind the mob, only if they are facing the same direction. Unless of course that is what you mean by if the player is meeting the requirements Jun 8, 2016 at 9:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .