2

I have recently started playing a local server with a few friends. We have been doing ok, and at the moment, I am the only one who hasn't lost my gear, multiple times, due to either lag or inexperience.

We are getting to the point now where we have access to a couple of Bosses, initially, the Wither, but I don't want people to feel like they won't be helpful, due to their previous track record. So, I wanted to use command blocks to detect if a player is (however many blocks) away from a "Boss Mob", i.e. a mob that has an on-screen health bar.

Is this possible, or do I have to specifically state the Mob in the command?

2
  • There are just two bosses in the game. Is this for modded Minecraft or do you want to prepare your commands for future versions when more bosses might be added? In that case your commands will very likely break anyway (for example 1.13 already breaks almost all existing command systems), so you would have to change it anyway. Sep 20, 2017 at 9:03
  • @Fabian just vanilla
    – Ben
    Sep 20, 2017 at 9:09

1 Answer 1

4

There is no way to target all boss mobs at once. You can however fake this behaviour by giving every boss mob a scoreboard tag like this:

scoreboard players tag add @e[type=YOURMOB] boss

The above command should be placed in a repeating command block and should be copied for every boss mob.

you can target all players close to boss mobs like this:

# this command puts all player names in chat of those who are within 20 blocks of a boss.
execute @e[tag=boss] ~ ~ ~ execute @a[r=20] ~ ~ ~ say @s

You can ofcourse replace say @s with any command

You must log in to answer this question.

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