0

Minecraft 1.12.2

I want to create a re-spawn system for the enemies in the different map areas. I could use a counter on a scoreboard with an armor stand as the entity but with all the areas I have in my map I think it would cause lag.

For example:

I want 5 zombies in an area of 20 block, the player comes and kills 2 of them. The player leaves. The system re-spawns the dead mobs making a total of 5 again.

I know how to test if the player left the area:

/testfor @a[r={radius}]

But what I don't know how to test for the minimum amount of enemies without a scoreboard i can't make it.

I tried the Count modifier in the selector but I realized that is not how it works. I tried something like this:

/testfor @e[type={entity},r={radius},c={amount}]

but it would activate when there was only 1.

In the end:

Is there a way too test for a minimum amount of mobs in a certain radius without a scoreboard?

  • You should specify more clearly that you are in 1.12.2, since that changes a lot of things about possible answers. And it's not the scoreboard that's the enemy of performance, it's the holders, aka armour stands and even those a tiny amount. I'm not sure whether something like execute if score for fake players in 1.13 can be complety mimicked in 1.12, I don't think you can. – Fabian Röling Jan 14 at 2:20
  • sorry I actually didn't realized I'll edit the post – martor Jan 14 at 6:23
0

Could you use tags? Here's a method I whipped up:

You'll want to tag the zombies one by one until you can't tag them anymore, then detect where the tagging stopped. Let's assume you have a maximum of 5 zombies. Repeat these two commands 5 times in a command block, each time adding the number in the first command by 1:

scoreboard players tag @e[type=zombie,tag=!tagged] add 1
scoreboard players tag @e[type=zombie,tag=1] add tagged

This machine will stop tagging zombies once the number tag is equal to the amount of zombies. You can then use these testfor commands to see if there are 3 but not 4 zombies, for example.

testfor @e[type=zombie,tag=3]
testfor @e[type=zombie,tag=4]

Combine with chain command blocks/comparators (whichever is best for you in your situation) until you have the machine you need. And of course you'll have to remove the tags 1 2 3 4 5 and tagged from all zombies, and combine with the radius condition.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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